repository

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryPolyfeaRepository

type InMemoryPolyfeaRepository[ItemType interface{ GetName() string }] struct {
	// contains filtered or unexported fields
}

func NewInMemoryPolyfeaRepository

func NewInMemoryPolyfeaRepository[ItemType interface{ GetName() string }]() *InMemoryPolyfeaRepository[ItemType]

func (*InMemoryPolyfeaRepository[ItemType]) DeleteItem

func (r *InMemoryPolyfeaRepository[ItemType]) DeleteItem(item ItemType) error

func (*InMemoryPolyfeaRepository[ItemType]) GetItem added in v0.1.3

func (r *InMemoryPolyfeaRepository[ItemType]) GetItem(item ItemType) (ItemType, error)

func (*InMemoryPolyfeaRepository[ItemType]) GetItems

func (r *InMemoryPolyfeaRepository[ItemType]) GetItems(filter PolyfeaRepositoryFilterFunc[ItemType]) ([]ItemType, error)

func (*InMemoryPolyfeaRepository[ItemType]) StoreItem

func (r *InMemoryPolyfeaRepository[ItemType]) StoreItem(item ItemType) error

type PolyfeaRepository

type PolyfeaRepository[ItemType interface{ GetName() string }] interface {
	StoreItem(item ItemType) error

	GetItem(item ItemType) (ItemType, error)

	GetItems(filter PolyfeaRepositoryFilterFunc[ItemType]) ([]ItemType, error)

	DeleteItem(item ItemType) error
}

PolyfeaRepository is a generic interface for storing and retrieving items of type ItemType. The type ItemType must implement the GetName() method.

type PolyfeaRepositoryFilterFunc

type PolyfeaRepositoryFilterFunc[ItemType interface{}] func(mf ItemType) bool

PolyfeaRepositoryFilterFunc is a function that takes an item of type ItemType and returns a boolean.

Jump to

Keyboard shortcuts

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