Documentation ¶
Overview ¶
* @Author: lisheng * @Date: 2022-10-14 16:28:38 * @LastEditTime: 2023-01-06 14:14:58 * @LastEditors: lisheng * @Description: mongoDB驱动 * @FilePath: /jf-go-kit/database/mongo/mongo.go
Index ¶
- func CreateDBEngnine(addr string, port int) *mongo.Client
- func DBKeepAlive()
- func DeleteRecord(engineName string, tableName string, deleteMap *map[string]string) (int64, error)
- func ExistByQueryMap(engineName string, tableName string, queryMap *map[string]string, ...) (bool, error)
- func FindRecords(engineName string, tableName string, queryMap *map[string]string, ...) error
- func InitMgocli() func() error
- func InsertRecord(engineName string, tableName string, objPtr interface{}) (int64, error)
- func QueryRecord(engineName string, tableName string, queryMap *map[string]interface{}, ...) error
- func UpateRecord(engineName string, tableName string, queryMap *map[string]string, ...) (int64, error)
- type MgoManager
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteRecord ¶
*
- @description: D - 删除数据
- @param {string} tableName
- @param {*map[string]string} deleteMap
- @return {*}
- @author: liqiyuWorks
func ExistByQueryMap ¶
func ExistByQueryMap(engineName string, tableName string, queryMap *map[string]string, user interface{}) (bool, error)
*
- @description: R - 根据查询条件查看是否存在该条记录
- @param {string} tableName
- @param {*map[string]string} queryMap
- @param {interface{}} user
- @return {*}
- @author: liqiyuWorks
func FindRecords ¶
func FindRecords(engineName string, tableName string, queryMap *map[string]string, objPtr interface{}, pagerArg ...Pagination) error
*
- @description: R - 查询多条数据
- @param {string} tableName
- @param {*map[string]string} queryMap: 查询map{"username": "jiufang"}
- @param {interface{}} objPtr: 绑定查询对象
- @param {...Pagination} pagerArg: 分页器,可传入指定的分页
- @return {*}
- @author: liqiyuWorks
func InitMgocli ¶
func InitMgocli() func() error
func InsertRecord ¶
*
- @description: C-插入数据
- @param {string} tableName
- @param {interface{}} objPtr
- @return {*}
- @author: liqiyuWorks
func QueryRecord ¶
func QueryRecord(engineName string, tableName string, queryMap *map[string]interface{}, objPtr interface{}) error
*
- @description: R - 获取单条记录
- @param {string} tableName
- @param {*map[string]string} queryMap
- @param {interface{}} objPtr
- @return {*}
- @author: liqiyuWorks
func UpateRecord ¶
func UpateRecord(engineName string, tableName string, queryMap *map[string]string, updateMap *map[string]map[string]string) (int64, error)
*
- @description: U - 更新数据
- @param {string} tableName
- @param {*map[string]string} queryMap
- @param {*map[string]string} updateMap
- @param {interface{}} objPtr
- @return {*}
- @author: liqiyuWorks
Types ¶
type MgoManager ¶
var (
GMgoManager *MgoManager = new(MgoManager)
)
type Pagination ¶
type Pagination struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.