Versions in this module Expand all Collapse all v1 v1.0.0 Mar 24, 2021 Changes in this version + const AutoIdTableName + const DBTimeOutDuration + const DatabaseName + type AutoId struct + Id int + Name string + type DBIndex struct + Key map[string]int + NS string + Name string + type MongoOptions struct + DBAddr string + DBName string + DBPort string + DBPwd string + DBUser string + type MongoRepo struct + Client *mongo.Client + func NewMongoRepo(options MongoOptions) (*MongoRepo, error) + func (r *MongoRepo) Count(tableName string, filter interface{}, opts ...*options.CountOptions) (int64, error) + func (r *MongoRepo) CreateDefaultIndex(tableName string, keys []string) (err error) + func (r *MongoRepo) DeleteMany(tableName string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) + func (r *MongoRepo) DeleteOne(tableName string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) + func (r *MongoRepo) Drop(tableName string) error + func (r *MongoRepo) Find(tableName string, filter interface{}, opts ...*options.FindOptions) (context.Context, mongo.Cursor, error) + func (r *MongoRepo) FindOne(tableName string, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult + func (r *MongoRepo) FindOneAndReplace(tableName string, filter interface{}, replacement interface{}, ...) *mongo.SingleResult + func (r *MongoRepo) FindOneAndUpdate(tableName string, filter interface{}, replacement interface{}, ...) *mongo.SingleResult + func (r *MongoRepo) GetAutoId(name string, baseId int) (id int) + func (r *MongoRepo) GetClient() (client *mongo.Client) + func (r *MongoRepo) InsertMany(tableName string, document []interface{}, opts ...*options.InsertManyOptions) (err error) + func (r *MongoRepo) InsertOne(tableName string, document interface{}, opts ...*options.InsertOneOptions) (err error) + func (r *MongoRepo) ReplaceOne(tableName string, filter interface{}, replacement interface{}, ...) (*mongo.UpdateResult, error) + func (r *MongoRepo) UpdateMany(tableName string, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error) + func (r *MongoRepo) UpdateOne(tableName string, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error) + func (r *MongoRepo) UpdateOneOrInsert(tableName string, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)