Documentation ¶
Index ¶
- type InMemoryRepository
- func (r *InMemoryRepository[Key, Entity]) Create(entity Entity) (Entity, error)
- func (r *InMemoryRepository[Key, Entity]) Delete(key Key) error
- func (r *InMemoryRepository[Key, Entity]) FindBy(predicate types.Predicate[Entity]) []Entity
- func (r *InMemoryRepository[Key, Entity]) FindById(key Key) (Entity, error)
- func (r *InMemoryRepository[Key, Entity]) FindOneBy(predicate types.Predicate[Entity]) (Entity, error)
- func (r *InMemoryRepository[Key, Entity]) TotalCount() int
- func (r *InMemoryRepository[Key, Entity]) Update(entity Entity) (Entity, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryRepository ¶
type InMemoryRepository[Key comparable, Entity any] struct { AllowEmptyKey bool GetKey func(Entity) Key // contains filtered or unexported fields }
func (*InMemoryRepository[Key, Entity]) Create ¶
func (r *InMemoryRepository[Key, Entity]) Create(entity Entity) (Entity, error)
func (*InMemoryRepository[Key, Entity]) Delete ¶
func (r *InMemoryRepository[Key, Entity]) Delete(key Key) error
func (*InMemoryRepository[Key, Entity]) FindBy ¶
func (r *InMemoryRepository[Key, Entity]) FindBy(predicate types.Predicate[Entity]) []Entity
func (*InMemoryRepository[Key, Entity]) FindById ¶
func (r *InMemoryRepository[Key, Entity]) FindById(key Key) (Entity, error)
func (*InMemoryRepository[Key, Entity]) FindOneBy ¶ added in v0.5.0
func (r *InMemoryRepository[Key, Entity]) FindOneBy(predicate types.Predicate[Entity]) (Entity, error)
FindOneBy returns the first element that satisfies the predicate. If more than one or none found, returns an error.
func (*InMemoryRepository[Key, Entity]) TotalCount ¶
func (r *InMemoryRepository[Key, Entity]) TotalCount() int
func (*InMemoryRepository[Key, Entity]) Update ¶
func (r *InMemoryRepository[Key, Entity]) Update(entity Entity) (Entity, error)
Click to show internal directories.
Click to hide internal directories.