mongorepo

package
v0.0.0-...-4ca6748 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongodbMutexes

type MongodbMutexes struct {
	// contains filtered or unexported fields
}

func NewMongodbMutexes

func NewMongodbMutexes(client *mongo.Client, database string, collection string) *MongodbMutexes

func (*MongodbMutexes) Lock

func (mutexes *MongodbMutexes) Lock(ctx context.Context, id any) (ok bool, absent bool, err error)

func (*MongodbMutexes) NewAndLock

func (mutexes *MongodbMutexes) NewAndLock(ctx context.Context, id any) (ok bool, err error)

func (*MongodbMutexes) UnlockAll

func (mutexes *MongodbMutexes) UnlockAll(ctx context.Context, ids []any)

type MongodbRepository

type MongodbRepository[T any] struct {
	arp.Repository[T]
	// contains filtered or unexported fields
}

func NewMongodbRepository

func NewMongodbRepository[T any](client *mongo.Client, database string, collection string, newZeroEntity arp.NewZeroEntity[T]) *MongodbRepository[T]

func NewMongodbRepositoryWithMutexesimpl

func NewMongodbRepositoryWithMutexesimpl[T any](client *mongo.Client, database string, collection string, newZeroEntity arp.NewZeroEntity[T], mutexesimpl arp.Mutexes) *MongodbRepository[T]

func (*MongodbRepository[T]) Count

func (repo *MongodbRepository[T]) Count(ctx context.Context) (uint64, error)

func (*MongodbRepository[T]) QueryAllByField

func (repo *MongodbRepository[T]) QueryAllByField(ctx context.Context, fieldName string, fieldValue any) ([]T, error)

func (*MongodbRepository[T]) QueryAllIds

func (repo *MongodbRepository[T]) QueryAllIds(ctx context.Context) (ids []any, err error)

type MongodbStore

type MongodbStore[T any] struct {
	// contains filtered or unexported fields
}

func NewMongodbStore

func NewMongodbStore[T any](coll *mongo.Collection, newZeroEntity arp.NewZeroEntity[T]) *MongodbStore[T]

func (*MongodbStore[T]) Load

func (store *MongodbStore[T]) Load(ctx context.Context, id any) (entity T, found bool, err error)

func (*MongodbStore[T]) RemoveAll

func (store *MongodbStore[T]) RemoveAll(ctx context.Context, ids []any) error

func (*MongodbStore[T]) Save

func (store *MongodbStore[T]) Save(ctx context.Context, id any, entity T) error

func (*MongodbStore[T]) SaveAll

func (store *MongodbStore[T]) SaveAll(ctx context.Context, entitiesToInsert map[any]any, entitiesToUpdate map[any]*arp.ProcessEntity) error

Jump to

Keyboard shortcuts

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