Documentation
¶
Overview ¶
Package repository is the package that defines neuron repositories and it's factories. A repository is a structure that gives an access with well known interfaces to the models databases, datastores. A factory is the structure with unique name that is responsible of creating new repository instances of given type. The package is used to register, get and close (finish) factory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseAll ¶ added in v0.2.1
CloseAll closes all repositoriy instances for all registered factories.
func RegisterFactory ¶
RegisterFactory registers provided Factory within the container.
Types ¶
type Controller ¶ added in v0.2.2
type Controller interface {
ModelStruct(model interface{}) (*mapping.ModelStruct, error)
}
Controller gets the model struct from the given model.
type Factory ¶
type Factory interface { // Namer gets the repository name for given factory. DriverName() string // New creates new instance of the Repository for given 'model'. New(c Controller, model *mapping.ModelStruct) (Repository, error) // Close should close all the repository instances for this factory. Close(ctx context.Context, done chan<- interface{}) }
Factory is the interface used for creating the repositories.
func GetFactory ¶
GetFactory gets the factory with given driver 'name'.