definitions

package
v0.0.0-...-e406146 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Aggregate

func Aggregate(results any, pipeline any, opts ...options.Lister[options.AggregateOptions]) error

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 AggregateWithCtx(ctx context.Context, results any, pipeline any, aggregateOpts ...options.Lister[options.AggregateOptions]) error

func Close

func Close()

func Coll

func Coll(model ModelInterface) *mongo.Collection

func Ctx

func Ctx() context.Context

func Delete

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 FindByObjectIDs

func FindByObjectIDs(results any, ids any, additionalPipeline ...any) error

func FindByObjectIDsWithCtx

func FindByObjectIDsWithCtx(ctx context.Context, results any, ids any, additionalPipeline ...any) error

func FindMany

func FindMany(results any, query any, opts ...options.Lister[options.FindOptions]) error

func FindManyWithCtx

func FindManyWithCtx(ctx context.Context, results any, query any, opts ...options.Lister[options.FindOptions]) error

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 GetClient

func GetClient() (*mongo.Client, error)

func GetCollection

func GetCollection(collectionName string) (*mongo.Collection, error)

func GetDatabase

func GetDatabase() (*mongo.Database, error)

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 Update

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 ModelInterface interface {
	CollectionName() string

	// Field Information
	GetID() any
	SetID(id any)

	// Hooks
	Queried() error
	Creating() error
	Created() error
	Saving() error
	Saved() error
	Updating() error
	Updated() error
	Deleting() error
	Deleted() error
}

type ModelQueryMethods

Available query methods

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL