Documentation
¶
Index ¶
- func Aggregate(results any, pipeline any, opts ...options.Lister[options.AggregateOptions]) error
- func AggregateFirst(model ModelInterface, pipeline any, ...) (bool, error)
- func AggregateFirstWithCtx(ctx context.Context, result ModelInterface, pipeline any, ...) (bool, error)
- func AggregateWithCtx(ctx context.Context, results any, pipeline any, ...) error
- func Close()
- func Coll(model ModelInterface) *mongo.Collection
- func Ctx() context.Context
- func Delete(model ModelInterface, opts ...options.Lister[options.DeleteOneOptions]) error
- func DeleteMany(model ModelInterface, query any, ...) (*mongo.DeleteResult, error)
- func DeleteManyWithCtx(ctx context.Context, model ModelInterface, query any, ...) (*mongo.DeleteResult, error)
- func DeleteOne(model ModelInterface, query any, ...) (*mongo.DeleteResult, error)
- func DeleteOneWithCtx(ctx context.Context, model ModelInterface, query any, ...) (*mongo.DeleteResult, error)
- func DeleteWithCtx(ctx context.Context, model ModelInterface, ...) error
- func FindByObjectID(model ModelInterface, id any, opts ...options.Lister[options.FindOneOptions]) error
- func FindByObjectIDWithCtx(ctx context.Context, model ModelInterface, id any, ...) error
- func FindByObjectIDs(results any, ids any, additionalPipeline ...any) error
- func FindByObjectIDsWithCtx(ctx context.Context, results any, ids any, additionalPipeline ...any) error
- func FindMany(results any, query any, opts ...options.Lister[options.FindOptions]) error
- func FindManyWithCtx(ctx context.Context, results any, query any, ...) error
- func FindOne(model ModelInterface, query any, ...) error
- func FindOneWithCtx(ctx context.Context, model ModelInterface, query any, ...) error
- func GetClient() (*mongo.Client, error)
- func GetCollection(collectionName string) (*mongo.Collection, error)
- func GetDatabase() (*mongo.Database, error)
- func Initialise(cfg Config, opts ...*options.ClientOptions) error
- func InsertOne(model ModelInterface, opts ...options.Lister[options.InsertOneOptions]) error
- func InsertOneWithCtx(ctx context.Context, model ModelInterface, ...) error
- func Transaction(fn codegen.TransactionFunc) error
- func TransactionWithCtx(ctx context.Context, fn codegen.TransactionFunc) error
- func TransactionWithCtxOptions(ctx context.Context, fn codegen.TransactionFunc, ...) error
- func TransactionWithOptions(fn codegen.TransactionFunc, opts *options.SessionOptionsBuilder) error
- func Update(model ModelInterface, opts ...options.Lister[options.UpdateOneOptions]) error
- func UpdateMany(model ModelInterface, filter any, update any, ...) (*mongo.UpdateResult, error)
- func UpdateManyWithCtx(ctx context.Context, model ModelInterface, filter any, update any, ...) (*mongo.UpdateResult, error)
- func UpdateOne(model ModelInterface, filter any, update any, ...) (*mongo.UpdateResult, error)
- func UpdateOneWithCtx(ctx context.Context, model ModelInterface, filter any, update any, ...) (*mongo.UpdateResult, error)
- func UpdateWithCtx(ctx context.Context, model ModelInterface, ...) error
- type Config
- type ModelInterface
- type ModelQueryMethods
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AggregateFirst ¶
func AggregateFirst(model ModelInterface, pipeline any, opts ...options.Lister[options.AggregateOptions]) (bool, error)
func AggregateFirstWithCtx ¶
func AggregateFirstWithCtx(ctx context.Context, result ModelInterface, pipeline any, aggregateOpts ...options.Lister[options.AggregateOptions]) (bool, error)
func AggregateWithCtx ¶
func Coll ¶
func Coll(model ModelInterface) *mongo.Collection
func Delete ¶
func Delete(model ModelInterface, opts ...options.Lister[options.DeleteOneOptions]) error
func DeleteMany ¶
func DeleteMany(model ModelInterface, query any, opts ...options.Lister[options.DeleteManyOptions]) (*mongo.DeleteResult, error)
func DeleteManyWithCtx ¶
func DeleteManyWithCtx(ctx context.Context, model ModelInterface, query any, opts ...options.Lister[options.DeleteManyOptions]) (*mongo.DeleteResult, error)
func DeleteOne ¶
func DeleteOne(model ModelInterface, query any, opts ...options.Lister[options.DeleteOneOptions]) (*mongo.DeleteResult, error)
func DeleteOneWithCtx ¶
func DeleteOneWithCtx(ctx context.Context, model ModelInterface, query any, opts ...options.Lister[options.DeleteOneOptions]) (*mongo.DeleteResult, error)
func DeleteWithCtx ¶
func DeleteWithCtx(ctx context.Context, model ModelInterface, opts ...options.Lister[options.DeleteOneOptions]) error
func FindByObjectID ¶
func FindByObjectID(model ModelInterface, id any, opts ...options.Lister[options.FindOneOptions]) error
func FindByObjectIDWithCtx ¶
func FindByObjectIDWithCtx(ctx context.Context, model ModelInterface, id any, opts ...options.Lister[options.FindOneOptions]) error
func FindByObjectIDsWithCtx ¶
func FindManyWithCtx ¶
func FindOne ¶
func FindOne(model ModelInterface, query any, opts ...options.Lister[options.FindOneOptions]) error
func FindOneWithCtx ¶
func FindOneWithCtx(ctx context.Context, model ModelInterface, query any, opts ...options.Lister[options.FindOneOptions]) error
func GetCollection ¶
func GetCollection(collectionName string) (*mongo.Collection, error)
func GetDatabase ¶
func Initialise ¶
func Initialise(cfg Config, opts ...*options.ClientOptions) error
func InsertOne ¶
func InsertOne(model ModelInterface, opts ...options.Lister[options.InsertOneOptions]) error
func InsertOneWithCtx ¶
func InsertOneWithCtx(ctx context.Context, model ModelInterface, opts ...options.Lister[options.InsertOneOptions]) error
func Transaction ¶
func Transaction(fn codegen.TransactionFunc) error
func TransactionWithCtx ¶
func TransactionWithCtx(ctx context.Context, fn codegen.TransactionFunc) error
func TransactionWithCtxOptions ¶
func TransactionWithCtxOptions(ctx context.Context, fn codegen.TransactionFunc, opts *options.SessionOptionsBuilder) error
func TransactionWithOptions ¶
func TransactionWithOptions(fn codegen.TransactionFunc, opts *options.SessionOptionsBuilder) error
func Update ¶
func Update(model ModelInterface, opts ...options.Lister[options.UpdateOneOptions]) error
func UpdateMany ¶
func UpdateMany(model ModelInterface, filter any, update any, opts ...options.Lister[options.UpdateManyOptions]) (*mongo.UpdateResult, error)
func UpdateManyWithCtx ¶
func UpdateManyWithCtx(ctx context.Context, model ModelInterface, filter any, update any, opts ...options.Lister[options.UpdateManyOptions]) (*mongo.UpdateResult, error)
func UpdateOne ¶
func UpdateOne(model ModelInterface, filter any, update any, opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
func UpdateOneWithCtx ¶
func UpdateOneWithCtx(ctx context.Context, model ModelInterface, filter any, update any, opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
func UpdateWithCtx ¶
func UpdateWithCtx(ctx context.Context, model ModelInterface, opts ...options.Lister[options.UpdateOneOptions]) error
Types ¶
type Config ¶
type Config struct { OperationTimeout time.Duration DatabaseName string TxnSessionOptions *options.SessionOptionsBuilder }
type ModelInterface ¶
type ModelQueryMethods ¶
type ModelQueryMethods interface { AggregateFirst(pipeline any, opts ...options.Lister[options.AggregateOptions]) (bool, error) AggregateFirstWithCtx(ctx context.Context, pipeline any, opts ...options.Lister[options.AggregateOptions]) (bool, error) Find(any, ...options.Lister[options.FindOneOptions]) error FindWithCtx(context.Context, any, ...options.Lister[options.FindOneOptions]) error FindByObjectID(any, ...options.Lister[options.FindOneOptions]) error FindByObjectIDWithCtx(context.Context, any, ...options.Lister[options.FindOneOptions]) error Create(...options.Lister[options.InsertOneOptions]) error CreateWithCtx(context.Context, ...options.Lister[options.InsertOneOptions]) error Update(...options.Lister[options.UpdateOneOptions]) error UpdateWithCtx(context.Context, ...options.Lister[options.UpdateOneOptions]) error Delete(...options.Lister[options.DeleteOneOptions]) error DeleteWithCtx(context.Context, ...options.Lister[options.DeleteOneOptions]) error }
Available query methods
Click to show internal directories.
Click to hide internal directories.