Documentation ¶
Overview ¶
Index ¶
- Constants
- type AutoId
- type DBIndex
- type MongoOptions
- type MongoRepo
- 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)
Examples ¶
Constants ¶
View Source
const ( DatabaseName = "gameserver" DBTimeOutDuration = time.Second * 30 AutoIdTableName = "__auto__id" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoOptions ¶
type MongoRepo ¶
type MongoRepo struct { MongoOptions Client *mongo.Client }
func NewMongoRepo ¶
func NewMongoRepo(options MongoOptions) (*MongoRepo, error)
func (*MongoRepo) CreateDefaultIndex ¶
func (*MongoRepo) DeleteMany ¶
func (r *MongoRepo) DeleteMany(tableName string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*MongoRepo) DeleteOne ¶
func (r *MongoRepo) DeleteOne(tableName string, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*MongoRepo) FindOne ¶
func (r *MongoRepo) FindOne(tableName string, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
func (*MongoRepo) FindOneAndReplace ¶
func (r *MongoRepo) FindOneAndReplace(tableName string, filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) *mongo.SingleResult
func (*MongoRepo) FindOneAndUpdate ¶
func (r *MongoRepo) FindOneAndUpdate(tableName string, filter interface{}, replacement interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult
func (*MongoRepo) InsertMany ¶
func (r *MongoRepo) InsertMany(tableName string, document []interface{}, opts ...*options.InsertManyOptions) (err error)
func (*MongoRepo) InsertOne ¶
func (r *MongoRepo) InsertOne(tableName string, document interface{}, opts ...*options.InsertOneOptions) (err error)
func (*MongoRepo) ReplaceOne ¶
func (r *MongoRepo) ReplaceOne(tableName string, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
func (*MongoRepo) UpdateMany ¶
func (r *MongoRepo) UpdateMany(tableName string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*MongoRepo) UpdateOne ¶
func (r *MongoRepo) UpdateOne(tableName string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*MongoRepo) UpdateOneOrInsert ¶
func (r *MongoRepo) UpdateOneOrInsert(tableName string, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Click to show internal directories.
Click to hide internal directories.