services

package
v0.0.0-...-0b542b9 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() *serviceManager

Types

type Database

type Database interface {
	Generic
	WithServiceManager(c ServiceManager) Database
	WithUserDatabase() Database
	WithMasterClient(*sql.DB) Database
	WithReplicaClient(*sql.DB) Database
	OpenTransactionMaster(ctx context.Context) (context.Context, error)
	TransactionMaster(ctx context.Context, f func(tx DatabaseTransaction) error) error
	OpenTransactionReplica(ctx context.Context) (context.Context, error)
	TransactionReplica(ctx context.Context, f func(tx DatabaseTransaction) error) error
	CloseTransaction(ctx context.Context, err error) error
}

type DatabaseTransaction

type DatabaseTransaction interface {
	Insert(query string, args ...interface{}) (sql.Result, error)
	Update(query string, args ...interface{}) (sql.Result, error)
	Get(query string, args ...interface{}) (*sql.Rows, error)
	Migrate(script string) (sql.Result, error)
}

type Environment

type Environment interface {
	Generic
	WithServiceManager(c ServiceManager) Environment
	Env() string
	Service() string
	Version() string
	DebugPprof() bool
	AwsRegion() string
	AwsEndpoint() string
	AwsAccessKey() string
	AwsSecretKey() string
	SpanUrl() string
	UserDatabaseDsn() string
	UserReplicaDatabaseDsn() string
	UserTopicAddress() string
	Configs() map[string]interface{}
}

type Events

type Events interface {
	Generic
	WithServiceManager(c ServiceManager) Events
	Send(ctx context.Context, req domains.EventRequest) error
	SendBulk(ctx context.Context, req []domains.EventRequest) error
}

type Generic

type Generic interface {
	ServiceManager() ServiceManager
	Init(ctx context.Context) error
	Close() error
	Readiness(ctx context.Context) error
	Liveness(ctx context.Context) error
}

type HttpServer

type HttpServer interface {
	Generic
	WithServiceManager(c ServiceManager) HttpServer
	Run() error
}

type Logger

type Logger interface {
	Generic
	WithServiceManager(c ServiceManager) Logger
	WithCallerCount(c int) Logger
	Info(ctx context.Context, message string, fields ...map[string]interface{})
	Warn(ctx context.Context, message string, fields ...map[string]interface{})
	Error(ctx context.Context, message string, fields ...map[string]interface{})
	Fatal(ctx context.Context, message string, fields ...map[string]interface{})
}

type NoopDatabase

type NoopDatabase struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopDatabase

func NewNoopDatabase() *NoopDatabase

func (*NoopDatabase) CloseTransaction

func (n *NoopDatabase) CloseTransaction(_ context.Context, err error) error

func (*NoopDatabase) Get

func (n *NoopDatabase) Get(_ context.Context, _ string, _ ...interface{}) (*sql.Rows, error)

func (*NoopDatabase) Insert

func (n *NoopDatabase) Insert(_ context.Context, _ string, _ ...interface{}) (sql.Result, error)

func (*NoopDatabase) OpenTransactionMaster

func (n *NoopDatabase) OpenTransactionMaster(ctx context.Context) (context.Context, error)

func (*NoopDatabase) OpenTransactionReplica

func (n *NoopDatabase) OpenTransactionReplica(ctx context.Context) (context.Context, error)

func (*NoopDatabase) Ping

func (n *NoopDatabase) Ping(_ context.Context) error

func (*NoopDatabase) TransactionMaster

func (n *NoopDatabase) TransactionMaster(context.Context, func(tx DatabaseTransaction) error) error

func (*NoopDatabase) TransactionReplica

func (n *NoopDatabase) TransactionReplica(context.Context, func(tx DatabaseTransaction) error) error

func (*NoopDatabase) Update

func (n *NoopDatabase) Update(_ context.Context, _ string, _ ...interface{}) (sql.Result, error)

func (*NoopDatabase) WithMasterClient

func (n *NoopDatabase) WithMasterClient(_ *sql.DB) Database

func (*NoopDatabase) WithReplicaClient

func (n *NoopDatabase) WithReplicaClient(_ *sql.DB) Database

func (*NoopDatabase) WithServiceManager

func (n *NoopDatabase) WithServiceManager(_ ServiceManager) Database

func (*NoopDatabase) WithUserDatabase

func (n *NoopDatabase) WithUserDatabase() Database

type NoopEnvironment

type NoopEnvironment struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopEnvironment

func NewNoopEnvironment() *NoopEnvironment

func (*NoopEnvironment) AwsAccessKey

func (n *NoopEnvironment) AwsAccessKey() string

func (*NoopEnvironment) AwsEndpoint

func (n *NoopEnvironment) AwsEndpoint() string

func (*NoopEnvironment) AwsRegion

func (n *NoopEnvironment) AwsRegion() string

func (*NoopEnvironment) AwsSecretKey

func (n *NoopEnvironment) AwsSecretKey() string

func (*NoopEnvironment) Configs

func (n *NoopEnvironment) Configs() map[string]interface{}

func (*NoopEnvironment) DebugPprof

func (n *NoopEnvironment) DebugPprof() bool

func (*NoopEnvironment) Env

func (n *NoopEnvironment) Env() string

func (*NoopEnvironment) LockerConfigDynamoTable

func (n *NoopEnvironment) LockerConfigDynamoTable() string

func (*NoopEnvironment) Service

func (n *NoopEnvironment) Service() string

func (*NoopEnvironment) SpanUrl

func (n *NoopEnvironment) SpanUrl() string

func (*NoopEnvironment) UserDatabaseDsn

func (n *NoopEnvironment) UserDatabaseDsn() string

func (*NoopEnvironment) UserReplicaDatabaseDsn

func (n *NoopEnvironment) UserReplicaDatabaseDsn() string

func (*NoopEnvironment) UserTopicAddress

func (n *NoopEnvironment) UserTopicAddress() string

func (*NoopEnvironment) Version

func (n *NoopEnvironment) Version() string

func (*NoopEnvironment) WithServiceManager

func (n *NoopEnvironment) WithServiceManager(_ ServiceManager) Environment

type NoopEvents

type NoopEvents struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopEvents

func NewNoopEvents() *NoopEvents

func (*NoopEvents) Send

func (*NoopEvents) SendBulk

func (n *NoopEvents) SendBulk(_ context.Context, _ []domains.EventRequest) error

func (*NoopEvents) WithServiceManager

func (n *NoopEvents) WithServiceManager(_ ServiceManager) Events

type NoopHealth

type NoopHealth struct{}

func (*NoopHealth) Liveness

func (n *NoopHealth) Liveness(_ context.Context) error

func (*NoopHealth) Readiness

func (n *NoopHealth) Readiness(_ context.Context) error

type NoopHttpServer

type NoopHttpServer struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopHttpServer

func NewNoopHttpServer() *NoopHttpServer

func (*NoopHttpServer) Run

func (n *NoopHttpServer) Run() error

func (*NoopHttpServer) WithServiceManager

func (n *NoopHttpServer) WithServiceManager(_ ServiceManager) HttpServer

type NoopLogger

type NoopLogger struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopLogger

func NewNoopLogger() *NoopLogger

func (*NoopLogger) Error

func (n *NoopLogger) Error(_ context.Context, _ string, _ ...map[string]interface{})

func (*NoopLogger) Fatal

func (n *NoopLogger) Fatal(_ context.Context, _ string, _ ...map[string]interface{})

func (*NoopLogger) Info

func (n *NoopLogger) Info(_ context.Context, _ string, _ ...map[string]interface{})

func (*NoopLogger) Warn

func (n *NoopLogger) Warn(_ context.Context, _ string, _ ...map[string]interface{})

func (*NoopLogger) WithCallerCount

func (n *NoopLogger) WithCallerCount(_ int) Logger

func (*NoopLogger) WithServiceManager

func (n *NoopLogger) WithServiceManager(_ ServiceManager) Logger

type NoopServiceManager

type NoopServiceManager struct{}

func (*NoopServiceManager) Close

func (n *NoopServiceManager) Close() error

func (*NoopServiceManager) Init

func (*NoopServiceManager) ServiceManager

func (n *NoopServiceManager) ServiceManager() ServiceManager

type NoopSpans

type NoopSpans struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopSpans

func NewNoopSpans() *NoopSpans

func (*NoopSpans) New

func (*NoopSpans) Tracer

func (n *NoopSpans) Tracer() *zipkin.Tracer

func (*NoopSpans) WithServiceManager

func (n *NoopSpans) WithServiceManager(_ ServiceManager) Spans

type NoopUsersHandler

type NoopUsersHandler struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopUserHandler

func NewNoopUserHandler() *NoopUsersHandler

func (*NoopUsersHandler) Create

func (*NoopUsersHandler) Delete

func (n *NoopUsersHandler) Delete(_ context.Context, _ string) (*domains.User, error)

func (*NoopUsersHandler) Get

func (*NoopUsersHandler) List

func (*NoopUsersHandler) Update

func (*NoopUsersHandler) WithServiceManager

func (n *NoopUsersHandler) WithServiceManager(_ ServiceManager) UsersHandler

type NoopUsersRepository

type NoopUsersRepository struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopUsersRepository

func NewNoopUsersRepository() *NoopUsersRepository

func (*NoopUsersRepository) Create

func (*NoopUsersRepository) Delete

func (*NoopUsersRepository) Migrate

func (n *NoopUsersRepository) Migrate(_ context.Context) error

func (*NoopUsersRepository) Search

func (*NoopUsersRepository) Update

func (*NoopUsersRepository) WithServiceManager

func (n *NoopUsersRepository) WithServiceManager(_ ServiceManager) UsersRepository

type NoopValidator

type NoopValidator struct {
	NoopHealth
	NoopServiceManager
}

func NewNoopValidator

func NewNoopValidator() *NoopValidator

func (*NoopValidator) Validate

func (n *NoopValidator) Validate(_ context.Context, _ interface{}) error

func (*NoopValidator) ValidateSlice

func (n *NoopValidator) ValidateSlice(_ context.Context, _ interface{}) error

func (*NoopValidator) WithServiceManager

func (n *NoopValidator) WithServiceManager(_ ServiceManager) Validator

type ServiceManager

type ServiceManager interface {
	Init() error
	Close() error
	Readiness(ctx context.Context) error
	Liveness(ctx context.Context) error
	Context() context.Context
	WithLogger(d Logger) ServiceManager
	Logger() Logger
	WithHttpServer(d HttpServer) ServiceManager
	HttpServer() HttpServer
	WithEnvironment(d Environment) ServiceManager
	Environment() Environment
	WithValidator(d Validator) ServiceManager
	Validator() Validator
	WithSpans(d Spans) ServiceManager
	Spans() Spans
	WithUserDatabase(d Database) ServiceManager
	UserDatabase() Database
	WithUsersRepository(d UsersRepository) ServiceManager
	UsersRepository() UsersRepository
	WithUsersHandler(d UsersHandler) ServiceManager
	UsersHandler() UsersHandler
	WithUsersEvents(d Events) ServiceManager
	UsersEvents() Events
}

type Spans

type Spans interface {
	Generic
	WithServiceManager(c ServiceManager) Spans
	New(ctx context.Context, spanConfigs ...domains.SpanConfig) (context.Context, *domains.Span)
	Tracer() *zipkin.Tracer
}

type UsersHandler

type UsersHandler interface {
	Generic
	WithServiceManager(c ServiceManager) UsersHandler
	Create(ctx context.Context, c domains.UserCreate) (*domains.User, error)
	Update(ctx context.Context, c domains.UserUpdate) (*domains.User, error)
	Get(ctx context.Context, productId string) (*domains.User, error)
	List(ctx context.Context) ([]domains.User, error)
	Delete(ctx context.Context, productId string) (*domains.User, error)
}

type UsersRepository

type UsersRepository interface {
	Generic
	WithServiceManager(ServiceManager) UsersRepository
	Search(ctx context.Context, search domains.UserSearch) ([]domains.User, error)
	Create(ctx context.Context, product *domains.User) error
	Update(ctx context.Context, product *domains.User) error
	Delete(ctx context.Context, product *domains.User) error
	Migrate(ctx context.Context) error
}

type Validator

type Validator interface {
	Generic
	WithServiceManager(c ServiceManager) Validator
	Validate(ctx context.Context, obj interface{}) error
	ValidateSlice(ctx context.Context, objs interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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