Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewRepositoryOptions ¶
func NewRepositoryOptions(fnopts ...RepositoryOptions) *repositoryOptions
func NewSearchOptions ¶
func NewSearchOptions(fnopts ...SearchOptions) *searchOptions
Types ¶
type Repository ¶
type Repository[M any] interface { FindOne(ctx context.Context, id string) (M, error) Find(ctx context.Context, ids []string) ([]M, error) FindAll(ctx context.Context) ([]M, error) Search(ctx context.Context, filters map[string][]any, opts ...SearchOptions) ([]M, error) CountDocuments(ctx context.Context, filters map[string][]any) (int64, error) Upsert(ctx context.Context, id string, m M) error Delete(ctx context.Context, id string) (M, error) DeleteMany(ctx context.Context, filters map[string][]any) error }
func NewRepository ¶
func NewRepository[M, D any](col *mongo.Collection, ser Serializer[M, D]) (Repository[M], error)
func NewSimpleRepository ¶
func NewSimpleRepository[M any](col *mongo.Collection, opts ...RepositoryOptions) (Repository[M], error)
type RepositoryOptions ¶
type RepositoryOptions func(*repositoryOptions)
func WithBloomFilter ¶
func WithBloomFilter(bf filters.Bloom[string]) RepositoryOptions
func WithDefaultPageSize ¶
func WithDefaultPageSize(size int) RepositoryOptions
func WithMaxPageSize ¶
func WithMaxPageSize(size int) RepositoryOptions
type SearchOptions ¶
type SearchOptions func(*searchOptions)
func WithPage ¶
func WithPage(page int) SearchOptions
func WithPageMethod ¶
func WithPageMethod(method string) SearchOptions
func WithPageSize ¶
func WithPageSize(pageSize int) SearchOptions
func WithSort ¶
func WithSort(sort map[string]int) SearchOptions
type Serializer ¶
Click to show internal directories.
Click to hide internal directories.