Documentation ¶
Index ¶
- Variables
- func BareObjID(objectID string) string
- func CountRows(dbName, collName string, client *mongo.Client, filter DP) (int64, error)
- func DeleteOne(dbName, collName string, client *mongo.Client, filter DP) (bool, error)
- func DeleteOneByID(dbName, collName string, client *mongo.Client, objID string) (bool, error)
- func GetFieldValue(dbName, collName string, client *mongo.Client, filter DP, bsonFieldName string) (string, error)
- func GetFieldValueByID(dbName, collName string, client *mongo.Client, objID, bsonFieldName string) (string, error)
- func InitMG(dbConStr string) (*mongo.Client, error)
- func InsertOne(dbName, collName string, client *mongo.Client, data DP) (bool, error)
- func IsExist(dbName, collName string, client *mongo.Client, filter DP) (bool, error)
- func UpdateOne(dbName, collName string, client *mongo.Client, data DP, filter DP) (bool, error)
- func UpdateOneByID(dbName, collName string, client *mongo.Client, data DP, objID string) (bool, error)
- type DM
- type DP
- type MGC
- type ObjID
Constants ¶
This section is empty.
Variables ¶
View Source
var ClientMG *mongo.Client
ClientMG initialize the MongoDB's client's pointer.
Functions ¶
func BareObjID ¶ added in v1.0.5
BareObjID removes the "ObjectID()" from the object id and returns the bare string value only.
func DeleteOneByID ¶
DeleteOneByID delete any single row permanently filetered MongoDB object ID from a MongoDB collection.
func GetFieldValue ¶ added in v1.0.3
func GetFieldValue(dbName, collName string, client *mongo.Client, filter DP, bsonFieldName string) (string, error)
GetFieldValue gets the string value of any specific field name from a collection. e.g Struct field "PCName" then the bson field is "pc_name", the bson field name must be
func GetFieldValueByID ¶ added in v1.0.4
func GetFieldValueByID(dbName, collName string, client *mongo.Client, objID, bsonFieldName string) (string, error)
GetFieldValueByID gets the string value of any specific field filtered by object id from a collection.
Types ¶
type DM ¶ added in v1.0.1
type DM []map[string]interface{}
DM type is a slice map container for collection results storage.
Click to show internal directories.
Click to hide internal directories.