provider

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity interface {
	Shutdown() error
	Start() error
}

type IEniter

type IEniter interface {
	// CreateEnity should create connection using passed parameters.
	// It is up to provider to cast passed options into required data
	// type and provide instructions for configuring.
	// Passed conn should be a pointer to needed structure that might be
	// provided by database provider. Provider should not attempt to
	// replace pointer if nil is passed. Provider should check if passed
	// conn is a pointer to valid structure and return error if it is
	// invalid AND continue with connection creating.
	CreateEnity(connectionName string, options interface{}) error
	// GetEnity should return pointer to connection structure to
	// caller. It is up to caller to cast returned interface{} into
	// required data type.
	// Passed conn should be a pointer to needed structure that might be
	// provided by database provider. Provider should not attempt to
	// replace pointer if nil is passed. Provider should check if passed
	// conn is a pointer to valid structure and return error if it is
	// invalid.
	GetEnity(connectionName string) (interface{}, error)
}

type IEnityManager

type IEnityManager interface {
	IEniter
	// StartEnity starts connection things.
	StartEnity(connectionName string) error
	// ShutdownEnity shutdown connection things.
	ShutdownEnity(connectionName string) error
}

type IProvider

type IProvider interface {
	// Start start all connections
	Start() error
	// Shutdown should shutdown all connections.
	Shutdown() error
}

type MapEnity

type MapEnity struct {
	sync.Map
}

type Provider

type Provider struct {
	Entitys MapEnity
	Log     *zerolog.Logger
	Logger  *logger.Logger

	Name string
	// contains filtered or unexported fields
}

Provider provides abstract worker.

func NewProvider

func NewProvider(ctx context.Context, providersName, providerName string) *Provider

NewProvider creates provider

func (*Provider) GetContext

func (bp *Provider) GetContext() context.Context

func (*Provider) Shutdown

func (bp *Provider) Shutdown() error

Shutdown should shutdown all known entitys.

func (*Provider) ShutdownEnity

func (bp *Provider) ShutdownEnity(enityName string) error

ShutdownEnity starts connection things like watchers and queues.

func (*Provider) Start

func (bp *Provider) Start() error

Start starts all known entitys.

func (*Provider) StartEnity

func (bp *Provider) StartEnity(enityName string) error

StartEnity starts connection things like watchers and queues.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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