Documentation ¶
Index ¶
- func ToBson(v interface{}) (doc *bson.D, err error)
- type IMongoModel
- type IMongoRepository
- type MongoRepository
- func (mr *MongoRepository[T]) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (error, int64)
- func (mr *MongoRepository[T]) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (error, int64)
- func (mr *MongoRepository[T]) Find(models []*T, filter interface{}, aggregate interface{}, ...) error
- func (mr *MongoRepository[T]) FindOne(model *T, filter interface{}, opts ...*options.FindOneOptions) error
- func (mr *MongoRepository[T]) GetCollection() *mongo.Collection
- func (mr *MongoRepository[T]) GetDB() *mongo.Database
- func (mr *MongoRepository[T]) InsertMany(models *[]T, opts ...*options.InsertManyOptions) (error, interface{})
- func (mr *MongoRepository[T]) InsertOne(model *T, opts ...*options.InsertOneOptions) (error, interface{})
- func (mr *MongoRepository[T]) ReplaceOne(filter interface{}, model *T, opts ...*options.ReplaceOptions) (error, int64)
- func (mr *MongoRepository[T]) UpdateMany(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (error, int64)
- func (mr *MongoRepository[T]) UpdateOne(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (error, int64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IMongoModel ¶
type IMongoModel interface {
Collection() string
}
type IMongoRepository ¶
type IMongoRepository[T IMongoModel] interface { GetDB() *mongo.Database FindOne(model *T, filter interface{}, opts ...*options.FindOneOptions) error Find( models []*T, filter interface{}, aggregate interface{}, opts ...*options.FindOptions, ) error InsertOne(model *T, opts ...*options.InsertOneOptions) (error, interface{}) InsertMany(models *[]T, opts ...*options.InsertManyOptions) (error, interface{}) ReplaceOne(filter interface{}, model *T, opts ...*options.ReplaceOptions) (error, int64) UpdateOne(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (error, int64) UpdateMany(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (error, int64) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (error, int64) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (error, int64) }
func InitRepository ¶
func InitRepository[T IMongoModel](database *mongo.Database, model IMongoModel) IMongoRepository[T]
type MongoRepository ¶
type MongoRepository[T IMongoModel] struct { IMongoRepository[T] Model T Database *mongo.Database }
func (*MongoRepository[T]) DeleteMany ¶
func (mr *MongoRepository[T]) DeleteMany( filter interface{}, opts ...*options.DeleteOptions, ) (error, int64)
func (*MongoRepository[T]) DeleteOne ¶
func (mr *MongoRepository[T]) DeleteOne( filter interface{}, opts ...*options.DeleteOptions, ) (error, int64)
func (*MongoRepository[T]) Find ¶
func (mr *MongoRepository[T]) Find( models []*T, filter interface{}, aggregate interface{}, opts ...*options.FindOptions, ) error
func (*MongoRepository[T]) FindOne ¶
func (mr *MongoRepository[T]) FindOne( model *T, filter interface{}, opts ...*options.FindOneOptions, ) error
func (*MongoRepository[T]) GetCollection ¶
func (mr *MongoRepository[T]) GetCollection() *mongo.Collection
func (*MongoRepository[T]) GetDB ¶
func (mr *MongoRepository[T]) GetDB() *mongo.Database
func (*MongoRepository[T]) InsertMany ¶
func (mr *MongoRepository[T]) InsertMany( models *[]T, opts ...*options.InsertManyOptions, ) (error, interface{})
func (*MongoRepository[T]) InsertOne ¶
func (mr *MongoRepository[T]) InsertOne( model *T, opts ...*options.InsertOneOptions, ) (error, interface{})
func (*MongoRepository[T]) ReplaceOne ¶
func (mr *MongoRepository[T]) ReplaceOne( filter interface{}, model *T, opts ...*options.ReplaceOptions, ) (error, int64)
func (*MongoRepository[T]) UpdateMany ¶
func (mr *MongoRepository[T]) UpdateMany( filter interface{}, update interface{}, opts ...*options.UpdateOptions, ) (error, int64)
func (*MongoRepository[T]) UpdateOne ¶
func (mr *MongoRepository[T]) UpdateOne( filter interface{}, update interface{}, opts ...*options.UpdateOptions, ) (error, int64)
Click to show internal directories.
Click to hide internal directories.