Version: v0.0.0-...-0b542b9 Latest Latest

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




This section is empty.


This section is empty.


func New

func New() *serviceManager


type Database

type Database interface {
	WithServiceManager(c ServiceManager) Database
	WithProductDatabase() 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 Discounts

type Discounts interface {
	WithServiceManager(c ServiceManager) Discounts
	Get(ctx context.Context, req domains.DiscountRequest) (*domains.DiscountResponse, error)

type Environment

type Environment interface {
	WithServiceManager(c ServiceManager) Environment
	Env() string
	Service() string
	Version() string
	DebugPprof() bool
	AwsRegion() string
	AwsEndpoint() string
	AwsAccessKey() string
	AwsSecretKey() string
	DiscountsAddress() string
	SpanUrl() string
	ProductDatabaseDsn() string
	ProductReplicaDatabaseDsn() string
	ProductTopicAddress() string
	Configs() map[string]interface{}

type Events

type Events interface {
	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 {
	WithServiceManager(c ServiceManager) HttpServer
	Run() error

type Logger

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

type NoopDatabase

type NoopDatabase struct {

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) WithProductDatabase

func (n *NoopDatabase) WithProductDatabase() Database

func (*NoopDatabase) WithReplicaClient

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

func (*NoopDatabase) WithServiceManager

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

type NoopDiscounts

type NoopDiscounts struct {

func NewNoopDiscounts

func NewNoopDiscounts() *NoopDiscounts

func (*NoopDiscounts) Get

func (*NoopDiscounts) WithServiceManager

func (n *NoopDiscounts) WithServiceManager(_ ServiceManager) Discounts

type NoopEnvironment

type NoopEnvironment struct {

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) DiscountsAddress

func (n *NoopEnvironment) DiscountsAddress() string

func (*NoopEnvironment) Env

func (n *NoopEnvironment) Env() string

func (*NoopEnvironment) LockerConfigDynamoTable

func (n *NoopEnvironment) LockerConfigDynamoTable() string

func (*NoopEnvironment) ProductDatabaseDsn

func (n *NoopEnvironment) ProductDatabaseDsn() string

func (*NoopEnvironment) ProductReplicaDatabaseDsn

func (n *NoopEnvironment) ProductReplicaDatabaseDsn() string

func (*NoopEnvironment) ProductTopicAddress

func (n *NoopEnvironment) ProductTopicAddress() string

func (*NoopEnvironment) Service

func (n *NoopEnvironment) Service() string

func (*NoopEnvironment) SpanUrl

func (n *NoopEnvironment) SpanUrl() string

func (*NoopEnvironment) StatsdServer

func (n *NoopEnvironment) StatsdServer() string

func (*NoopEnvironment) Version

func (n *NoopEnvironment) Version() string

func (*NoopEnvironment) WithServiceManager

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

type NoopEvents

type NoopEvents struct {

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 {

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 {

func NewNoopLogger

func NewNoopLogger() *NoopLogger

func (*NoopLogger) Error

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

func (*NoopLogger) Fatal

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

func (*NoopLogger) Info

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

func (*NoopLogger) Warn

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

func (*NoopLogger) WithCallerCount

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

func (*NoopLogger) WithServiceManager

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

type NoopProductsHandler

type NoopProductsHandler struct {

func NewNoopProductsHandler

func NewNoopProductsHandler() *NoopProductsHandler

func (*NoopProductsHandler) Create

func (*NoopProductsHandler) Delete

func (*NoopProductsHandler) Get

func (*NoopProductsHandler) List

func (*NoopProductsHandler) Update

func (*NoopProductsHandler) WithServiceManager

func (n *NoopProductsHandler) WithServiceManager(_ ServiceManager) ProductsHandler

type NoopProductsRepository

type NoopProductsRepository struct {

func NewNoopProductsRepository

func NewNoopProductsRepository() *NoopProductsRepository

func (*NoopProductsRepository) Create

func (*NoopProductsRepository) Delete

func (*NoopProductsRepository) Migrate

func (*NoopProductsRepository) Search

func (*NoopProductsRepository) Update

func (*NoopProductsRepository) WithServiceManager

func (n *NoopProductsRepository) WithServiceManager(_ ServiceManager) ProductsRepository

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 {

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 NoopValidator

type NoopValidator struct {

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 ProductsHandler

type ProductsHandler interface {
	WithServiceManager(c ServiceManager) ProductsHandler
	Create(ctx context.Context, c domains.ProductCreate) (*domains.Product, error)
	Update(ctx context.Context, c domains.ProductUpdate) (*domains.Product, error)
	Get(ctx context.Context, productId string) (*domains.Product, error)
	List(ctx context.Context) ([]domains.Product, error)
	Delete(ctx context.Context, productId string) (*domains.Product, error)

type ProductsRepository

type ProductsRepository interface {
	WithServiceManager(ServiceManager) ProductsRepository
	Search(ctx context.Context, search domains.ProductSearch) ([]domains.Product, error)
	Create(ctx context.Context, product *domains.Product) error
	Update(ctx context.Context, product *domains.Product) error
	Delete(ctx context.Context, product *domains.Product) error
	Migrate(ctx context.Context) error

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
	WithDiscounts(d Discounts) ServiceManager
	Discounts() Discounts
	WithValidator(d Validator) ServiceManager
	Validator() Validator
	WithSpans(d Spans) ServiceManager
	Spans() Spans
	WithProductDatabase(d Database) ServiceManager
	ProductDatabase() Database
	WithProductsRepository(d ProductsRepository) ServiceManager
	ProductsRepository() ProductsRepository
	WithProductsHandler(d ProductsHandler) ServiceManager
	ProductsHandler() ProductsHandler
	WithProductsEvents(d Events) ServiceManager
	ProductsEvents() Events

type Spans

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

type Validator

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


Path Synopsis

Jump to

Keyboard shortcuts

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