Documentation ¶
Index ¶
- func Aggregate(results interface{}, pipeline interface{}, opts ...*options.AggregateOptions) error
- func AggregateFirst(model ModelInterface, pipeline interface{}, opts ...*options.AggregateOptions) (bool, error)
- func AggregateFirstWithCtx(ctx context.Context, result ModelInterface, pipeline interface{}, ...) (bool, error)
- func AggregateWithCtx(ctx context.Context, results interface{}, pipeline interface{}, ...) error
- func Close()
- func Coll(model ModelInterface) *mongo.Collection
- func Ctx() context.Context
- func Delete(model ModelInterface, opts ...*options.DeleteOptions) error
- func DeleteMany(model ModelInterface, query interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func DeleteManyWithCtx(ctx context.Context, model ModelInterface, query interface{}, ...) (*mongo.DeleteResult, error)
- func DeleteOne(model ModelInterface, query interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func DeleteOneWithCtx(ctx context.Context, model ModelInterface, query interface{}, ...) (*mongo.DeleteResult, error)
- func DeleteWithCtx(ctx context.Context, model ModelInterface, opts ...*options.DeleteOptions) error
- func FindByObjectID(model ModelInterface, id interface{}, opts ...*options.FindOneOptions) error
- func FindByObjectIDWithCtx(ctx context.Context, model ModelInterface, id interface{}, ...) error
- func FindByObjectIDs(results interface{}, ids interface{}, additionalPipeline ...interface{}) error
- func FindByObjectIDsWithCtx(ctx context.Context, results interface{}, ids interface{}, ...) error
- func FindMany(results interface{}, query interface{}, opts ...*options.FindOptions) error
- func FindManyWithCtx(ctx context.Context, results interface{}, query interface{}, ...) error
- func FindOne(model ModelInterface, query interface{}, opts ...*options.FindOneOptions) error
- func FindOneWithCtx(ctx context.Context, model ModelInterface, query interface{}, ...) 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.InsertOneOptions) error
- func InsertOneWithCtx(ctx context.Context, model ModelInterface, opts ...*options.InsertOneOptions) error
- func Transaction(fn codegen.TransactionFunc) error
- func TransactionWithCtx(ctx context.Context, fn codegen.TransactionFunc) error
- func TransactionWithCtxOptions(ctx context.Context, fn codegen.TransactionFunc, opts *options.SessionOptions) error
- func TransactionWithOptions(fn codegen.TransactionFunc, opts *options.SessionOptions) error
- func Update(model ModelInterface, opts ...*options.UpdateOptions) error
- func UpdateMany(model ModelInterface, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func UpdateManyWithCtx(ctx context.Context, model ModelInterface, filter interface{}, ...) (*mongo.UpdateResult, error)
- func UpdateOne(model ModelInterface, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func UpdateOneWithCtx(ctx context.Context, model ModelInterface, filter interface{}, ...) (*mongo.UpdateResult, error)
- func UpdateWithCtx(ctx context.Context, model ModelInterface, opts ...*options.UpdateOptions) error
- type Config
- type ModelInterface
- type ModelQueryMethods
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Aggregate ¶
func Aggregate(results interface{}, pipeline interface{}, opts ...*options.AggregateOptions) error
func AggregateFirst ¶
func AggregateFirst(model ModelInterface, pipeline interface{}, opts ...*options.AggregateOptions) (bool, error)
func AggregateFirstWithCtx ¶
func AggregateFirstWithCtx(ctx context.Context, result ModelInterface, pipeline interface{}, aggregateOpts ...*options.AggregateOptions) (bool, error)
func AggregateWithCtx ¶
func AggregateWithCtx(ctx context.Context, results interface{}, pipeline interface{}, aggregateOpts ...*options.AggregateOptions) error
func Coll ¶
func Coll(model ModelInterface) *mongo.Collection
func Delete ¶
func Delete(model ModelInterface, opts ...*options.DeleteOptions) error
func DeleteMany ¶
func DeleteMany(model ModelInterface, query interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func DeleteManyWithCtx ¶
func DeleteManyWithCtx(ctx context.Context, model ModelInterface, query interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func DeleteOne ¶
func DeleteOne(model ModelInterface, query interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func DeleteOneWithCtx ¶
func DeleteOneWithCtx(ctx context.Context, model ModelInterface, query interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func DeleteWithCtx ¶
func DeleteWithCtx(ctx context.Context, model ModelInterface, opts ...*options.DeleteOptions) error
func FindByObjectID ¶
func FindByObjectID(model ModelInterface, id interface{}, opts ...*options.FindOneOptions) error
func FindByObjectIDWithCtx ¶
func FindByObjectIDWithCtx(ctx context.Context, model ModelInterface, id interface{}, opts ...*options.FindOneOptions) error
func FindByObjectIDs ¶
func FindByObjectIDs(results interface{}, ids interface{}, additionalPipeline ...interface{}) error
func FindByObjectIDsWithCtx ¶
func FindMany ¶
func FindMany(results interface{}, query interface{}, opts ...*options.FindOptions) error
func FindManyWithCtx ¶
func FindManyWithCtx(ctx context.Context, results interface{}, query interface{}, opts ...*options.FindOptions) error
func FindOne ¶
func FindOne(model ModelInterface, query interface{}, opts ...*options.FindOneOptions) error
func FindOneWithCtx ¶
func FindOneWithCtx(ctx context.Context, model ModelInterface, query interface{}, opts ...*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.InsertOneOptions) error
func InsertOneWithCtx ¶
func InsertOneWithCtx(ctx context.Context, model ModelInterface, opts ...*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.SessionOptions) error
func TransactionWithOptions ¶
func TransactionWithOptions(fn codegen.TransactionFunc, opts *options.SessionOptions) error
func Update ¶
func Update(model ModelInterface, opts ...*options.UpdateOptions) error
func UpdateMany ¶
func UpdateMany(model ModelInterface, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func UpdateManyWithCtx ¶
func UpdateManyWithCtx(ctx context.Context, model ModelInterface, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func UpdateOne ¶
func UpdateOne(model ModelInterface, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func UpdateOneWithCtx ¶
func UpdateOneWithCtx(ctx context.Context, model ModelInterface, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func UpdateWithCtx ¶
func UpdateWithCtx(ctx context.Context, model ModelInterface, opts ...*options.UpdateOptions) error
Types ¶
type Config ¶
type Config struct { OperationTimeout time.Duration DatabaseName string TxnSessionOptions *options.SessionOptions }
type ModelInterface ¶
type ModelQueryMethods ¶
type ModelQueryMethods interface { AggregateFirst(pipeline interface{}, opts ...*options.AggregateOptions) (bool, error) Find(interface{}, ...*options.FindOneOptions) error FindWithCtx(context.Context, interface{}, ...*options.FindOneOptions) error FindByObjectID(interface{}, ...*options.FindOneOptions) error FindByObjectIDWithCtx(context.Context, interface{}, ...*options.FindOneOptions) error Create(...*options.InsertOneOptions) error CreateWithCtx(context.Context, ...*options.InsertOneOptions) error Update(...*options.UpdateOptions) error UpdateWithCtx(context.Context, ...*options.UpdateOptions) error Delete(...*options.DeleteOptions) error DeleteWithCtx(context.Context, ...*options.DeleteOptions) error }
Available query methods
Click to show internal directories.
Click to hide internal directories.