output

package
v0.0.0-...-9264b10 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

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 Close

func Close()

func Coll

func Coll(model ModelInterface) *mongo.Collection

func Ctx

func Ctx() context.Context

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 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 GetClient

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

func GetCollection

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

func GetDatabase

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

func IgnoredFunction1

func IgnoredFunction1() string

func IgnoredFunction2

func IgnoredFunction2() string

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 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 AnotherModel

type AnotherModel struct {
	codegen.BaseModel
	Sub SubModel `bson:"sub"`
}

func (*AnotherModel) AggregateFirst

func (m *AnotherModel) AggregateFirst(pipeline interface{}, opts ...*options.AggregateOptions) (bool, error)

func (*AnotherModel) CollectionName

func (*AnotherModel) CollectionName() string

func (*AnotherModel) Create

func (m *AnotherModel) Create(opts ...*options.InsertOneOptions) error

func (*AnotherModel) CreateWithCtx

func (m *AnotherModel) CreateWithCtx(ctx context.Context, opts ...*options.InsertOneOptions) error

func (*AnotherModel) Created

func (m *AnotherModel) Created() error

func (*AnotherModel) Creating

func (m *AnotherModel) Creating() error

func (*AnotherModel) Delete

func (m *AnotherModel) Delete(opts ...*options.DeleteOptions) error

func (*AnotherModel) DeleteWithCtx

func (m *AnotherModel) DeleteWithCtx(ctx context.Context, opts ...*options.DeleteOptions) error

func (*AnotherModel) Deleted

func (m *AnotherModel) Deleted() error

func (*AnotherModel) Deleting

func (m *AnotherModel) Deleting() error

func (*AnotherModel) Find

func (m *AnotherModel) Find(query interface{}, opts ...*options.FindOneOptions) error

func (*AnotherModel) FindByObjectID

func (m *AnotherModel) FindByObjectID(id interface{}, opts ...*options.FindOneOptions) error

func (*AnotherModel) FindByObjectIDWithCtx

func (m *AnotherModel) FindByObjectIDWithCtx(ctx context.Context, id interface{}, opts ...*options.FindOneOptions) error

func (*AnotherModel) FindWithCtx

func (m *AnotherModel) FindWithCtx(ctx context.Context, query interface{}, opts ...*options.FindOneOptions) error

func (*AnotherModel) Queried

func (m *AnotherModel) Queried() error

func (*AnotherModel) Saved

func (m *AnotherModel) Saved() error

func (*AnotherModel) Saving

func (m *AnotherModel) Saving() error

func (*AnotherModel) Update

func (m *AnotherModel) Update(opts ...*options.UpdateOptions) error

func (*AnotherModel) UpdateWithCtx

func (m *AnotherModel) UpdateWithCtx(ctx context.Context, opts ...*options.UpdateOptions) error

func (*AnotherModel) Updated

func (m *AnotherModel) Updated() error

func (*AnotherModel) Updating

func (m *AnotherModel) Updating() error

type Config

type Config struct {
	OperationTimeout  time.Duration
	DatabaseName      string
	TxnSessionOptions *options.SessionOptions
}

type Model

type Model struct {
	codegen.BaseModel
	Sub                   SubModel
	Reference             primitive.ObjectID
	ReferencePtr          *primitive.ObjectID
	ReferenceSlice        []primitive.ObjectID
	ReferenceSliceInSlice [][]*primitive.ObjectID
	ReferenceMap          map[string]primitive.ObjectID
	ReferenceMapPtr       map[string]*primitive.ObjectID
	ReferencePtrSlice     *[]primitive.ObjectID
	ReferencePtrMap       *map[string]primitive.ObjectID
	// contains filtered or unexported fields
}

func (*Model) AggregateFirst

func (m *Model) AggregateFirst(pipeline interface{}, opts ...*options.AggregateOptions) (bool, error)

func (*Model) CollectionName

func (*Model) CollectionName() string

func (*Model) Create

func (m *Model) Create(opts ...*options.InsertOneOptions) error

func (*Model) CreateWithCtx

func (m *Model) CreateWithCtx(ctx context.Context, opts ...*options.InsertOneOptions) error

func (*Model) Created

func (m *Model) Created() error

func (*Model) Creating

func (m *Model) Creating() error

func (*Model) Delete

func (m *Model) Delete(opts ...*options.DeleteOptions) error

func (*Model) DeleteWithCtx

func (m *Model) DeleteWithCtx(ctx context.Context, opts ...*options.DeleteOptions) error

func (*Model) Deleted

func (m *Model) Deleted() error

func (*Model) Deleting

func (m *Model) Deleting() error

func (*Model) Find

func (m *Model) Find(query interface{}, opts ...*options.FindOneOptions) error

func (*Model) FindByObjectID

func (m *Model) FindByObjectID(id interface{}, opts ...*options.FindOneOptions) error

func (*Model) FindByObjectIDWithCtx

func (m *Model) FindByObjectIDWithCtx(ctx context.Context, id interface{}, opts ...*options.FindOneOptions) error

func (*Model) FindWithCtx

func (m *Model) FindWithCtx(ctx context.Context, query interface{}, opts ...*options.FindOneOptions) error

func (*Model) GetResolved_Reference

func (m *Model) GetResolved_Reference() (AnotherModel, error)

func (*Model) GetResolved_ReferenceMap

func (m *Model) GetResolved_ReferenceMap() (map[string]AnotherModel, error)

func (*Model) GetResolved_ReferenceMapPtr

func (m *Model) GetResolved_ReferenceMapPtr() (map[string]*AnotherModel, error)

func (*Model) GetResolved_ReferencePtr

func (m *Model) GetResolved_ReferencePtr() (*AnotherModel, error)

func (*Model) GetResolved_ReferencePtrMap

func (m *Model) GetResolved_ReferencePtrMap() (*map[string]AnotherModel, error)

func (*Model) GetResolved_ReferencePtrSlice

func (m *Model) GetResolved_ReferencePtrSlice() (*[]AnotherModel, error)

func (*Model) GetResolved_ReferenceSlice

func (m *Model) GetResolved_ReferenceSlice() ([]AnotherModel, error)

func (*Model) GetResolved_ReferenceSliceInSlice

func (m *Model) GetResolved_ReferenceSliceInSlice() ([][]*AnotherModel, error)

func (*Model) Queried

func (m *Model) Queried() error

func (*Model) Saved

func (m *Model) Saved() error

func (*Model) Saving

func (m *Model) Saving() error

func (*Model) Update

func (m *Model) Update(opts ...*options.UpdateOptions) error

func (*Model) UpdateWithCtx

func (m *Model) UpdateWithCtx(ctx context.Context, opts ...*options.UpdateOptions) error

func (*Model) Updated

func (m *Model) Updated() error

func (*Model) Updating

func (m *Model) Updating() error

type ModelInterface

type ModelInterface interface {
	CollectionName() string
	GetID() interface{}
	SetID(id interface{})
	Queried() error
	Creating() error
	Created() error
	Saving() error
	Saved() error
	Updating() error
	Updated() error
	Deleting() error
	Deleted() error

} // Field Information

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

type StructAddedInOutput

type StructAddedInOutput struct {
}

type SubModel

type SubModel struct {
}

Jump to

Keyboard shortcuts

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