repository

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAll added in v0.2.1

func CloseAll(ctx context.Context) error

CloseAll closes all repositories

func RegisterFactory

func RegisterFactory(f Factory) error

RegisterFactory registers provided Factory within the container.

Types

type Factory

type Factory interface {
	FactoryCloser

	// Namer gets the repository name for given factory.
	DriverName() string

	// New creates new instance of the Repository for given 'model'.
	New(structer ModelStructer, model *mapping.ModelStruct) (Repository, error)
}

Factory is the interface used for creating the repositories. It implements FactoryCloser and Namer interface.

func GetFactory

func GetFactory(name string) Factory

GetFactory gets the factory with given driver 'name'.

type FactoryCloser added in v0.2.1

type FactoryCloser interface {
	Close(ctx context.Context, done chan<- interface{})
}

FactoryCloser is the interface used to close the connections.

type ModelStructer

type ModelStructer interface {
	ModelStruct(model interface{}) (*mapping.ModelStruct, error)
}

ModelStructer gets the model struct from the given model.

type Namer added in v0.2.1

type Namer interface {
	RepositoryName() string
}

Namer is the interface that gets the repository name for the 'Namer'.

type Repository

type Repository interface {
	Namer
	Close(ctx context.Context) error
}

Repository is the interface that defines the base neuron Repository.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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