Documentation ¶
Index ¶
- Variables
- func Register(name string, f SetFunc)
- func Registries() map[string]SetFunc
- func RegistryNames() []string
- func Unregister(name string)
- type AreaRegistry
- type CommodityRegistry
- type Config
- type IDable
- type ImageRegistry
- type InvoiceRegistry
- type LocationRegistry
- type ManualRegistry
- type PIDable
- type Registry
- type Set
- type SetFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrCannotDelete = errors.New("cannot delete") ErrInvalidConfig = errors.New("invalid config") ErrFieldRequired = errors.New("field required") ErrAlreadyExists = errors.New("already exists") ErrBadDataStructure = errors.New("bad data structure") )
Functions ¶
func Register ¶
Register registers a new registry set func. It panics if the name is already registered. It is intended to be called from the init function in the registry set package. It is NOT safe for concurrent use.
func Registries ¶
Registries returns a map of registered registry set funcs. It can be used concurrently with itself, but not with Register or Unregister.
func RegistryNames ¶
func RegistryNames() []string
RegistryNames returns a slice of registered registry set names.
func Unregister ¶
func Unregister(name string)
Unregister unregisters a registry set func. It is intended to be called from tests. It is NOT safe for concurrent use.
Types ¶
type AreaRegistry ¶
type CommodityRegistry ¶
type CommodityRegistry interface { Registry[models.Commodity] AddImage(commodityID, imageID string) error GetImages(commodityID string) ([]string, error) DeleteImage(commodityID, imageID string) error AddManual(commodityID, manualID string) error GetManuals(commodityID string) ([]string, error) DeleteManual(commodityID, manualID string) error AddInvoice(commodityID, invoiceID string) error GetInvoices(commodityID string) ([]string, error) DeleteInvoice(commodityID, invoiceID string) error }
type ImageRegistry ¶
type InvoiceRegistry ¶
type LocationRegistry ¶
type ManualRegistry ¶
type Registry ¶
type Registry[T any] interface { // Create creates a new T in the registry. Create(T) (*T, error) // Get returns a T from the registry. Get(id string) (*T, error) // List returns a list of Ts from the registry. List() ([]*T, error) // Update updates a T in the registry. Update(T) (*T, error) // Delete deletes a T from the registry. Delete(id string) error // Count returns the number of Ts in the registry. Count() (int, error) }
type Set ¶
type Set struct { LocationRegistry LocationRegistry AreaRegistry AreaRegistry CommodityRegistry CommodityRegistry ImageRegistry ImageRegistry InvoiceRegistry InvoiceRegistry ManualRegistry ManualRegistry }
Click to show internal directories.
Click to hide internal directories.