Documentation ¶
Index ¶
- func BatchInsertCollection(m *mongo.Client, db string, collection string, data []interface{}) (res *mongo.InsertManyResult, err error)
- func CountCollection(m *mongo.Client, db string, collection string, filter map[string]interface{}) (int64, int64, error)
- func DeleteOneRecord(m *mongo.Client, db string, collection string, filter map[string]interface{}) (res *mongo.DeleteResult, err error)
- func InitGormMysql(dsn string, args ...[]int) (*gorm.DB, error)
- func InitMongoDb(addr string) (*mongo.Client, error)
- func InitRedisClient(addr, password string, db int) (*redis.Client, error)
- func InitXormMysql(dsn string, showSql bool, args ...[]int) (*xorm.Engine, error)
- func InsertCollection(m *mongo.Client, db string, collection string, data interface{}) (res *mongo.InsertOneResult, err error)
- func UpdateOneRecord(m *mongo.Client, db string, collection string, id string, data bson.D) (res *mongo.UpdateResult, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BatchInsertCollection ¶
func BatchInsertCollection(m *mongo.Client, db string, collection string, data []interface{}) ( res *mongo.InsertManyResult, err error)
BatchInsertCollection 批量写入
func CountCollection ¶
func CountCollection(m *mongo.Client, db string, collection string, filter map[string]interface{}) (int64, int64, error)
CountCollection 统计
func DeleteOneRecord ¶
func DeleteOneRecord(m *mongo.Client, db string, collection string, filter map[string]interface{}) ( res *mongo.DeleteResult, err error)
DeleteOneRecord 删除单条记录
func InitGormMysql ¶
InitGormMysql gorm 初始化mysql连接 eg: root:123456@tcp(127.0.0.1:3306)/jiaxiao?charset=utf8mb4&parseTime=True&loc=Local
func InitRedisClient ¶
InitRedisClient 初始化redis 连接
func InitXormMysql ¶
InitXormMysql xorm 初始化mysql连接
func InsertCollection ¶
func InsertCollection(m *mongo.Client, db string, collection string, data interface{}) ( res *mongo.InsertOneResult, err error)
InsertCollection 写入 db 写入的数据库 collection 写入的文档(表) data 写入的数据
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.