Documentation
¶
Index ¶
Constants ¶
View Source
const (
DefaultTimeout = time.Second * 30
)
Variables ¶
This section is empty.
Functions ¶
func GetMongoDbClient ¶ added in v0.8.0
GetMongoDbClient, return new mongo driver client
func GetMongoDbConnection ¶
NewMongoDbConn, get a new db connection
Types ¶
type ChangeInfo ¶
type ChangeInfo struct { Updated int // Number of documents updated Removed int // Number of documents removed Matched int // Number of documents matched but not necessarily changed }
/////////////////////////////////////////////// deprecated, Will be removed in a later version /////////////////////////////////////////////// ChangeInfo holds details about the outcome of an update operation.
type FindOptions ¶ added in v0.8.0
type FindOptions struct { Sort map[string]int `json:"sort,omitempty"` Skip int64 `json:"skip"` Limit int64 `json:"limit"` }
FindOptions
func (*FindOptions) ToMongoCountOptions ¶ added in v0.8.0
func (fo *FindOptions) ToMongoCountOptions() *options.CountOptions
ToMongoCountOptions
func (*FindOptions) ToMongoFindOneOptions ¶ added in v0.8.0
func (fo *FindOptions) ToMongoFindOneOptions() *options.FindOneOptions
ToMongoFindOneOptions
func (*FindOptions) ToMongoFindOptions ¶ added in v0.8.0
func (fo *FindOptions) ToMongoFindOptions() *options.FindOptions
ToMongoFindOptions
type IBaseRepo ¶ added in v0.8.0
type IBaseRepo interface { InsertOne(collection string, doc interface{}, args ...interface{}) (interface{}, error) InsertMany(collection string, docs []interface{}, args ...interface{}) ([]interface{}, error) CountDocuments(collection string, filter interface{}, args ...interface{}) (int64, error) EstimatedDocumentCount(collection string, args ...interface{}) (int64, error) Find(collection string, filter interface{}, result interface{}, args ...interface{}) error FindOne(collection string, filter interface{}, result interface{}, args ...interface{}) error UpdateOne(collection string, filter interface{}, update interface{}, args ...interface{}) (*UpdateResult, error) UpdateMany(collection string, filter interface{}, update interface{}, args ...interface{}) (*UpdateResult, error) DeleteOne(collection string, filter interface{}, args ...interface{}) (int64, error) DeleteMany(collection string, filter interface{}, args ...interface{}) (int64, error) }
func NewMongoBaseRepo ¶ added in v0.8.0
NewMongoBaseRepo, return base repo instance
type MongoDb ¶
/////////////////////////////////////////////// deprecated, Will be removed in a later version /////////////////////////////////////////////// Db struct for mongodb
type UpdateResult ¶ added in v0.8.0
type UpdateResult struct { MatchedCount int64 ModifiedCount int64 UpsertedCount int64 UpsertedID interface{} }
UpdateResult
Click to show internal directories.
Click to hide internal directories.