Categorygithub.com/lepingbeta/go-common-v2-dh-mongo
modulepackage
0.0.0-20240905134928-e7ed2675a8c3
Repository: https://github.com/lepingbeta/go-common-v2-dh-mongo.git
Documentation: pkg.go.dev

# README

使用时需要删除 go.mod 中的replace语句 修改.env.example文件为.env,并且修改其中的mongo信息为你的

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
FilterBsonM 函数接受原始 bson.M 数据和要保留的字段列表, 返回一个新的 bson.M 只包含指定的字段。 示例 keepFields := []string{"name", "email"}.
查找多条数据 [start].
查找一条数据 [start].
No description provided by the author
GetInstance 返回 Database 类的单例实例.
判断bson.M中的键值是否存在.
InsertOne 插入一条数据 [start].
No description provided by the author
No description provided by the author
mapToBsonD 将 map[string]interface{} 转换为 bson.D,键按字典序排序.
No description provided by the author
ParseSortString 将形如 "field1=1,field2=-1" 的字符串转换为 bson.M 映射.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
updateOne 更新数据 [start].

# Structs

Database 包含 MongoDB 数据库连接信息的结构体.