Documentation
¶
Index ¶
- func WithDefaultNotNullFields(o *Options)
- type Closer
- type Dialer
- type Option
- func WithAuthenticator(authenticator auth.Authenticator) Option
- func WithDefaultFileStore(s filestore.Store) Option
- func WithDefaultRepository(r repository.Repository) Option
- func WithDefaultStore(s store.Store) Option
- func WithFileStore(name string, s filestore.Store) Option
- func WithHandleSignal(handle bool) Option
- func WithMigrateModels(models ...mapping.Model) Option
- func WithModels(models ...mapping.Model) Option
- func WithNamingConvention(convention mapping.NamingConvention) Option
- func WithRepositoryModels(r repository.Repository, models ...mapping.Model) Option
- func WithServer(s server.Server) Option
- func WithStore(name string, s store.Store) Option
- func WithSynchronousConnections(sync bool) Option
- func WithTimeFunc(timeFunc func() time.Time) Option
- func WithTokener(tokener auth.Tokener) Option
- func WithVerifier(authorizer auth.Verifier) Option
- type Options
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithDefaultNotNullFields ¶ added in v0.21.0
func WithDefaultNotNullFields(o *Options)
DefaultNotNullFields sets the non-pointer model fields to not null by default. By default all fields are set as nullable in the model's definition. WithThis might be helpful in the model migration.
Types ¶
type Closer ¶ added in v0.21.0
Closer is an interface that closes all connection for given instance.
type Option ¶
type Option func(o *Options)
Option is the function that sets the options for the service.
func WithAuthenticator ¶ added in v0.21.0
func WithAuthenticator(authenticator auth.Authenticator) Option
WithAuthenticator sets the authenticator option.
func WithDefaultFileStore ¶ added in v0.21.0
WithDefaultFileStore sets the default file store for the service.
func WithDefaultRepository ¶ added in v0.21.0
func WithDefaultRepository(r repository.Repository) Option
WithDefaultRepository sets the default repository for all models without specified repository.
func WithDefaultStore ¶ added in v0.21.0
WithDefaultStore sets the default store for the service.
func WithFileStore ¶ added in v0.21.0
WithFileStore sets the service store 's' obtainable at 'name'.
func WithHandleSignal ¶ added in v0.21.0
WithHandleSignal is the option that determines if the os signals should be handled by the service.
func WithMigrateModels ¶ added in v0.21.0
WithMigrateModels is the option that sets the models to migrate in their repositories.
func WithModels ¶ added in v0.21.0
WithModels is the option that sets the models for given service.
func WithNamingConvention ¶ added in v0.21.0
func WithNamingConvention(convention mapping.NamingConvention) Option
WithNamingConvention sets the naming convention option.
func WithRepositoryModels ¶ added in v0.21.0
func WithRepositoryModels(r repository.Repository, models ...mapping.Model) Option
WithRepositoryModels maps the repository 'r' to provided 'models'.
func WithServer ¶ added in v0.21.0
WithServer sets the service server option.
func WithSynchronousConnections ¶ added in v0.21.0
WithSynchronousConnections defines if the service should query repositories synchronously.
func WithTimeFunc ¶ added in v0.21.0
WithTimeFunc sets the time function for the service.
func WithTokener ¶ added in v0.21.0
WithTokener sets provided tokener for the service options.
func WithVerifier ¶ added in v0.21.0
WithVerifier sets the authorization verifier for the service.
type Options ¶
type Options struct {
// Database Layer
MigrateModels []mapping.Model
DefaultRepository repository.Repository
RepositoryModels map[repository.Repository][]mapping.Model
SynchronousConnections bool
// Key-value stores.
DefaultStore store.Store
Stores map[string]store.Store
// File stores.
DefaultFileStore filestore.Store
FileStores map[string]filestore.Store
// Model options.
NamingConvention mapping.NamingConvention
Models []mapping.Model
DefaultNotNull bool
// Service server.
Server server.Server
// Auth abstractions.
Verifier auth.Verifier
Authenticator auth.Authenticator
Tokener auth.Tokener
// Service detailed options.
HandleSignals bool
// TimeFunc sets the time function for the service.
TimeFunc func() time.Time
}
Options is the structure that contains service options.
type Service ¶
type Service struct {
Options *Options
// ModelMap is a mapping for the model's structures.
ModelMap *mapping.ModelMap
// DB contains the databases connection.
DB database.DB
// Stores is the mapping of the stores with their names.
Stores map[string]store.Store
// DefaultStore is the default key-value store used by this controller.
DefaultStore store.Store
// Authenticator is the service authenticator.
Authenticator auth.Authenticator
// Tokener is the service authentication token creator.
Tokener auth.Tokener
// Verifier is the authorization verifier.
Verifier auth.Verifier
// FileStores is the mapping of the stores with their names.
FileStores map[string]filestore.Store
// DefaultFileStore is the default file store used by this controller.
DefaultFileStore filestore.Store
// Server serves defined models.
Server server.Server
}
Service is the neuron service struct definition.