Documentation ¶
Index ¶
- Variables
- type Attr
- type Criteria
- type MongoAnd
- type MongoNot
- type MongoOr
- type Repository
- func (r *Repository[K]) Create(ctx context.Context, e K) (K, error)
- func (r *Repository[K]) Delete(ctx context.Context, entity K) error
- func (r *Repository[K]) Match(ctx context.Context, c criteria.Criteria) ([]K, error)
- func (r *Repository[K]) MatchOne(ctx context.Context, c criteria.Criteria) (k K, err error)
- func (r *Repository[K]) Read(ctx context.Context, id entity.Id) (e K, err error)
- func (r *Repository[K]) ReadAll(ctx context.Context) ([]K, error)
- func (r *Repository[K]) Start(ctx context.Context, onBootstrap func(ctx context.Context) error) error
- func (r *Repository[K]) Update(ctx context.Context, entity K) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ComparisonConversion = map[criteria.Comparator]string{ criteria.ComparisonEq: "$eq", criteria.ComparisonGt: "$gt", criteria.ComparisonGte: "$gte", criteria.ComparisonLt: "$lt", criteria.ComparisonLte: "$lte", criteria.ComparisonNe: "$ne", }
Functions ¶
This section is empty.
Types ¶
type Attr ¶
type Attr struct { Name string Value any Comparison criteria.Comparator }
func (Attr) GetExpression ¶
type Repository ¶
type Repository[K entity.Entity] struct { Collection *mongo.Collection // contains filtered or unexported fields }
func NewMongoRepository ¶
func NewMongoRepository[K entity.Entity](collection *mongo.Collection) *Repository[K]
func NewMongoRepositoryWithOpts ¶
func NewMongoRepositoryWithOpts[K entity.Entity](collection *mongo.Collection, logger *logrus.Entry) *Repository[K]
Click to show internal directories.
Click to hide internal directories.