odm

package
v0.1.40 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClient added in v0.1.5

func GetClient() *mongo.Client

Types

type BootRepository added in v0.1.35

type BootRepository[T any] interface {
	Save(model DbModel) chan error
	FindOneById(id string) (chan *T, chan error)
	IsExistsById(id string) bool
	CountDocuments(filters bson.M) (chan int64, chan error)
	Distinct(fieldName string, filters bson.D, serverMaxTime time.Duration) (chan []interface{}, chan error)
	FindOne(filters bson.M) (chan *T, chan error)
	Find(filters bson.M, sort bson.D, limit, skip int64) (chan []T, chan error)
	DeleteById(id string) chan error
	DeleteOne(filters bson.M) chan error
	GetModel(proto interface{}) *T
	Aggregate(pipeline bson.A) (chan []T, chan error)
}

type DbModel

type DbModel interface {
	Id() string
}

type UnimplementedBootRepository added in v0.1.35

type UnimplementedBootRepository[T any] struct {
	Database       string
	CollectionName string
}

func (*UnimplementedBootRepository[T]) Aggregate added in v0.1.35

func (r *UnimplementedBootRepository[T]) Aggregate(pipeline bson.A) (chan []T, chan error)

func (*UnimplementedBootRepository[T]) CountDocuments added in v0.1.35

func (r *UnimplementedBootRepository[T]) CountDocuments(filters bson.M) (chan int64, chan error)

Finds documents count on filters.

func (*UnimplementedBootRepository[T]) DeleteById added in v0.1.35

func (r *UnimplementedBootRepository[T]) DeleteById(id string) chan error

func (*UnimplementedBootRepository[T]) DeleteOne added in v0.1.35

func (r *UnimplementedBootRepository[T]) DeleteOne(filters bson.M) chan error

func (*UnimplementedBootRepository[T]) Distinct added in v0.1.35

func (r *UnimplementedBootRepository[T]) Distinct(fieldName string, filters bson.D, serverMaxTime time.Duration) (chan []interface{}, chan error)

Finds all unique values for a field

func (*UnimplementedBootRepository[T]) Find added in v0.1.35

func (r *UnimplementedBootRepository[T]) Find(filters bson.M, sort bson.D, limit, skip int64) (chan []T, chan error)

func (*UnimplementedBootRepository[T]) FindOne added in v0.1.35

func (r *UnimplementedBootRepository[T]) FindOne(filters bson.M) (chan *T, chan error)

Finds one object based on filters.

func (*UnimplementedBootRepository[T]) FindOneById added in v0.1.35

func (r *UnimplementedBootRepository[T]) FindOneById(id string) (chan *T, chan error)

Finds one object based on Id.

func (*UnimplementedBootRepository[T]) GetModel added in v0.1.35

func (r *UnimplementedBootRepository[T]) GetModel(proto interface{}) *T

Gets an instance of model from proto or othe object.

func (*UnimplementedBootRepository[T]) IsExistsById added in v0.1.35

func (r *UnimplementedBootRepository[T]) IsExistsById(id string) bool

checks if a record exists by id. Synchronous becuase it is expected to be very light-weighted without deserialization etc.

func (*UnimplementedBootRepository[T]) Save added in v0.1.35

func (r *UnimplementedBootRepository[T]) Save(model DbModel) chan error

Jump to

Keyboard shortcuts

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