scaffold

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppSection ConfigKey = "app"

	AppName            = AppSection + ".name"
	AppVersion         = AppSection + ".version"
	AppEnv             = AppSection + ".env"
	AppPortRest        = AppSection + ".port.rest"
	AppPortGrpc        = AppSection + ".port.grpc"
	AppGracefulTimeout = AppSection + ".graceful_timeout"

	AppLogLevel             = AppSection + ".log.level"
	AppLogTimezone          = AppSection + ".log.tz"
	AppLogUseCustomTimezone = AppSection + ".log.use_custom_timezone"

	AppHealth       = AppSection + ".healthcheck.health"
	AppMetric       = AppSection + ".healthcheck.metrics"
	AppDependencies = AppSection + ".healthcheck.dependencies"
)
View Source
const (
	DefaultKey = "default"
)

Variables

This section is empty.

Functions

func GracefulStop added in v0.3.0

func GracefulStop(port int, timeout time.Duration, engine GracefulEngine, logger GracefulLogger)

func GracefulStopWithContext added in v0.3.0

func GracefulStopWithContext(ctx context.Context, port int, timeout time.Duration, engine GracefulEngine, logger GracefulLogger)

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

func (*Application) AuditLog added in v0.3.0

func (app *Application) AuditLog() audit.Manager

func (*Application) ClientAuth added in v0.3.0

func (app *Application) ClientAuth() auth.ClientManager

func (*Application) Config

func (app *Application) Config() config.Manager

func (*Application) Context added in v0.3.0

func (app *Application) Context() context.Context

func (*Application) DB

func (app *Application) DB(key string) db.Manager

func (*Application) DefaultDB

func (app *Application) DefaultDB() db.Manager

func (*Application) DefaultDBR added in v0.3.0

func (app *Application) DefaultDBR() db.Manager

func (*Application) DefaultInMemory added in v0.3.0

func (app *Application) DefaultInMemory() inmemory.Manager

func (*Application) DefaultScheduler

func (app *Application) DefaultScheduler() scheduler.Manager

func (*Application) Env

func (app *Application) Env() string

func (*Application) FeatureFlag

func (app *Application) FeatureFlag() fflag.Manager

func (*Application) GRPC

func (app *Application) GRPC(context string) rpc.ClientManager

func (*Application) HasDB

func (app *Application) HasDB(key string) bool

func (*Application) HasDBS added in v0.3.0

func (app *Application) HasDBS() bool

func (*Application) HasDefaultDB added in v0.3.3

func (app *Application) HasDefaultDB() bool

func (*Application) HasInMemory added in v0.3.0

func (app *Application) HasInMemory() bool

func (*Application) HasScheduler

func (app *Application) HasScheduler() bool

func (*Application) InMemory added in v0.3.0

func (app *Application) InMemory(key string) inmemory.Manager

func (*Application) Log

func (app *Application) Log() logger.Manager

func (*Application) MaskedFields

func (app *Application) MaskedFields() []string

func (*Application) MaskedHeaders

func (app *Application) MaskedHeaders() []string

func (*Application) Metrics

func (app *Application) Metrics() telemetry.MetricsManager

func (*Application) MiddlewareTelemetry

func (app *Application) MiddlewareTelemetry() interface{}

func (*Application) Name

func (app *Application) Name() string

func (*Application) PortGrpc added in v0.3.0

func (app *Application) PortGrpc() int

func (*Application) PortRest added in v0.3.0

func (app *Application) PortRest() int

func (*Application) REST

func (app *Application) REST(context string) rest.Manager

func (*Application) Run

func (app *Application) Run(run func(a *Application))

func (*Application) RunAsDaemon

func (app *Application) RunAsDaemon(run func(a *Application))

func (*Application) RunGrpcServer

func (app *Application) RunGrpcServer(run func(app *Application, rpcServer *grpc.Server))

func (*Application) RunRestApiUseEcho

func (app *Application) RunRestApiUseEcho(run func(a *Application, e *echo.Echo))

func (*Application) RunUseEcho added in v0.1.1

func (app *Application) RunUseEcho(run func(a *Application, e *echo.Echo))

func (*Application) SOAP

func (app *Application) SOAP(context string) soap.Manager

func (*Application) Scheduler

func (app *Application) Scheduler(key string) scheduler.Manager

func (*Application) Scope

func (app *Application) Scope() string

func (*Application) Telemetry

func (app *Application) Telemetry() telemetry.Manager

func (*Application) Version

func (app *Application) Version() string

func (*Application) WithAuditLog added in v0.3.0

func (app *Application) WithAuditLog() IApplication

func (*Application) WithClientAuthorization added in v0.3.0

func (app *Application) WithClientAuthorization() IApplication

func (*Application) WithContext added in v0.3.0

func (app *Application) WithContext(ctx context.Context) IApplication

func (*Application) WithDatabases

func (app *Application) WithDatabases() IApplication

func (*Application) WithFeatureFlag

func (app *Application) WithFeatureFlag() IApplication

func (*Application) WithGrpcClients

func (app *Application) WithGrpcClients() IApplication

func (*Application) WithInMemories added in v0.3.0

func (app *Application) WithInMemories() IApplication

func (*Application) WithRestClients

func (app *Application) WithRestClients() IApplication

func (*Application) WithSchedulers

func (app *Application) WithSchedulers() IApplication

func (*Application) WithSoapClients

func (app *Application) WithSoapClients() IApplication

func (*Application) WithValue added in v0.3.0

func (app *Application) WithValue(key any, value any) IApplication

type ConfigKey added in v0.3.0

type ConfigKey string

func (ConfigKey) String added in v0.3.0

func (c ConfigKey) String() string

type EnvKey added in v0.3.0

type EnvKey string
const (
	EAppEnv EnvKey = "APP_ENV"
)

func (EnvKey) String added in v0.3.0

func (e EnvKey) String() string

type GracefulEngine added in v0.1.1

type GracefulEngine interface {
	Start(port string) error
	Shutdown(ctx context.Context) error
}

type GracefulLogger added in v0.1.1

type GracefulLogger interface {
	Info(i ...interface{})
	Fatal(i ...interface{})
}

type IApplication

type IApplication interface {
	Name() string
	Version() string
	Env() string
	Config() config.Manager

	IMonitoring
	IRemotes
	IRun
	IStorage
	IScheduler
	IFeatureFlag
	IContext
	IAuth
	IAudit
}

func NewApp

func NewApp(opts ...Option) IApplication

type IAudit added in v0.3.0

type IAudit interface {
	WithAuditLog() IApplication

	AuditLog() audit.Manager
}

type IAuth added in v0.3.0

type IAuth interface {
	WithClientAuthorization() IApplication

	ClientAuth() auth.ClientManager
}

type IContext added in v0.3.0

type IContext interface {
	WithValue(key any, value any) IApplication
	WithContext(ctx context.Context) IApplication

	Context() context.Context
}

type IFeatureFlag

type IFeatureFlag interface {
	WithFeatureFlag() IApplication

	FeatureFlag() fflag.Manager
}

type IMonitoring

type IMonitoring interface {
	Log() logger.Manager
	Telemetry() telemetry.Manager
	Metrics() telemetry.MetricsManager
	MiddlewareTelemetry() interface{}
	// contains filtered or unexported methods
}

type IRemotes

type IRemotes interface {
	WithRestClients() IApplication
	WithSoapClients() IApplication
	WithGrpcClients() IApplication

	REST(context string) rest.Manager
	SOAP(context string) soap.Manager
	GRPC(context string) rpc.ClientManager
}

type IRun

type IRun interface {
	Run(run func(a *Application))
	RunAsDaemon(run func(a *Application))
	RunUseEcho(run func(app *Application, e *echo.Echo))
	RunRestApiUseEcho(run func(app *Application, e *echo.Echo))
	RunGrpcServer(run func(app *Application, rpcServer *grpc.Server))
}

type IScheduler

type IScheduler interface {
	WithSchedulers() IApplication
	HasScheduler() bool
	Scheduler(key string) scheduler.Manager
	DefaultScheduler() scheduler.Manager
}

type IStorage

type IStorage interface {
	WithDatabases() IApplication
	DB(key string) db.Manager
	HasDBS() bool
	HasDB(key string) bool
	HasDefaultDB() bool
	DefaultDB() db.Manager
	DefaultDBR() db.Manager

	WithInMemories() IApplication
	InMemory(key string) inmemory.Manager
	HasInMemory() bool
	DefaultInMemory() inmemory.Manager
}

type Key added in v0.3.0

type Key string
const (
	DbKey       Key = "db"
	InMemoryKey Key = "in_memory"
	StatusKey   Key = "status"
)

func (Key) String added in v0.3.0

func (k Key) String() string

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithCustomRequestIdGenerator added in v0.3.0

func WithCustomRequestIdGenerator(v func() string) Option

func WithGracefulTimeout added in v0.3.0

func WithGracefulTimeout(v time.Duration) Option

func WithName

func WithName(v string) Option

func WithParseRequestId added in v0.3.0

func WithParseRequestId(v bool) Option

func WithPortGrpcConfigPath added in v0.3.1

func WithPortGrpcConfigPath(path string) Option

func WithPortRestConfigPath added in v0.3.1

func WithPortRestConfigPath(path string) Option

func WithScope

func WithScope(v string) Option

func WithStartContext added in v0.3.0

func WithStartContext(v context.Context) Option

func WithVersion added in v0.3.0

func WithVersion(v string) Option

Jump to

Keyboard shortcuts

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