go-mocket

Go GORM & SQL mocking library

  • 所有者: Selvatico/go-mocket
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

GoDoc Build Status Go Report Card

Go-Mocket – Go GORM & SQL Mocking Library

Go-Mocket is a library inspired by DATA-DOG/go-sqlmock.

As an inspiration library, it is the implementation of sql/driver interface but at the same time it follows a different approach and only has a similar API.
This library helps to mock any DB connection with jinzhu/gorm, as it was the created to serve this purpose.

List of features in the library:

  • Mock INSERT, UPDATE, SELECT, DELETE
  • Support for transactions
  • 2 API's to use - chaining and via specifying a whole mock object
  • Matching by prepared statements arguments
  • You don't require to change anything inside your code to start using this library
  • Ability to trigger exceptions
  • Attach callbacks to mocked responses to add an additional check or modify a response

NOTE, Please be aware that driver catches SQL without DB specifics. Generation of queries is done by SQL package

Install

go get github.com/Selvatico/go-mocket

Documentation

For detailed usage and examples, look at the Documentation

License

MIT License

Copyright (c) 2017 Seredenko Dmitry

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

主要指标

概览
名称与所有者Selvatico/go-mocket
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2017-06-02 15:34:56
推送于2022-08-03 12:22:37
最后一次提交2018-11-30 09:53:52
发布数8
最新版本名称v1.0.7 (发布于 )
第一版名称v1.0.0 (发布于 )
用户参与
星数222
关注者数6
派生数36
提交数53
已启用问题?
问题数17
打开的问题数13
拉请求数7
打开的拉请求数4
关闭的拉请求数3
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?