core

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *Options)

Option is the function that sets the options for the service.

type Options

type Options struct {
	Name              string
	Version           string
	NamingConvention  mapping.NamingConvention
	DefaultRepository repository.Repository
	RepositoryModels  map[repository.Repository][]mapping.Model
	DefaultStore      store.Store
	Stores            map[string]store.Store
	Collections       []database.Collection
	Models            []mapping.Model
	MigrateModels     []mapping.Model
	DefaultNotNull    bool
	Server            server.Server
	Verifier          auth.Verifier
	Authenticator     auth.Authenticator
	Tokener           auth.Tokener
	HandleSignals     bool
	Context           context.Context
	SynchronousORM    bool
	UTCTimestamps     bool
}

Options is the structure that contains service options.

type Service

type Service struct {
	Options *Options

	// Controller controls service model definitions, repositories and configuration.
	Controller *controller.Controller
	// Server serves defined models.
	Server        server.Server
	DB            database.DB
	Verifier      auth.Verifier
	Authenticator auth.Authenticator
	Tokener       auth.Tokener
}

Service is the neuron service struct definition.

func New

func New(options ...Option) *Service

New creates new service for provided controller config.

func (*Service) CloseAll

func (s *Service) CloseAll(ctx context.Context) error

CloseAll closes all connections with the repositories, proxies and services.

func (*Service) Initialize

func (s *Service) Initialize(ctx context.Context) (err error)

Initialize registers all repositories and models, establish the connection for each repository.

func (*Service) Run

func (s *Service) Run(ctx context.Context) error

Run starts the service.

type ServiceVersion

type ServiceVersion struct {
	Version string
	Service *Service
}

ServiceVersion is a structure that maps the service with it's version.

type VersionedOption

type VersionedOption func(o *VersionedOptions)

VersionedOption is an option that changes VersionedOptions.

type VersionedOptions

type VersionedOptions struct {
	HandleSignals bool
	Versions      []ServiceVersion
	Server        server.VersionedServer
}

VersionedOptions are the multi version service options.

type VersionedService

type VersionedService struct {
	Options *VersionedOptions
}

VersionedService is a service that supports multiple versions for the models server by single server.

func NewVersioned

func NewVersioned(options ...VersionedOption) *VersionedService

NewVersioned creates new versioned service.

func (*VersionedService) CloseAll

func (v *VersionedService) CloseAll(ctx context.Context) error

CloseAll closes all connections with the repositories, proxies and services.

func (*VersionedService) Initialize

func (v *VersionedService) Initialize(ctx context.Context) error

Initialize sets up all version services, register their models and repositories, and establish their connections.

func (*VersionedService) Run

func (v *VersionedService) Run(ctx context.Context) error

Run runs the versioned service.

Jump to

Keyboard shortcuts

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