repositories

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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 added in v0.6.3

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)

Jump to

Keyboard shortcuts

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