Documentation ¶
Index ¶
- Constants
- func Debug(event, message string)
- func Error(event string, err error)
- func Exists(key string) bool
- func GetBool(key string, defaultValue bool) bool
- func GetDuration(key string, defaultDuration time.Duration) time.Duration
- func GetInt(key string, defaultNumber int) int
- func GetString(key, defaultValue string) string
- func GetUint(key string, defaultNumber uint) uint
- func Healthz(request *Request, response *Response)
- func Info(event, message string)
- func Warn(event, message string)
- type Command
- type Configurator
- type DBInfo
- type IConfigurator
- type ILogger
- type IRepository
- type Logger
- type Monitor
- type MonitorStatus
- type Repository
- type Request
- type Response
- type Route
Constants ¶
const DefaultDBType = "postgres"
DefaultDBType is the default db type
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(event, message string)
Debug writes a debug message to the underlying logger
func GetDuration ¶
GetDuration provides additional valiation on top of the standard library because Viper returned zero duraction which could cause significant performance issues
Types ¶
type Configurator ¶
Configurator sets up configuration in production
func NewConfigurator ¶
func NewConfigurator(env, location string) *Configurator
NewConfigurator gets a new production configurator
func (*Configurator) LoadWithCallback ¶
func (c *Configurator) LoadWithCallback(reload func(in fsnotify.Event))
LoadWithCallback loads up the configuration from the sources
type IConfigurator ¶
IConfigurator interface for injectiong configuration set up
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is the wrapper around the health checks
func (*Monitor) AddCheck ¶
AddCheck adds checkers that implement IChecker dynamically to list TODO: This is bleeding the underlying interface
func (*Monitor) AddHTTPCheck ¶
AddHTTPCheck adds a check to a specific HTTP end point
func (*Monitor) GetStatus ¶
func (m *Monitor) GetStatus() MonitorStatus
GetStatus returns the status of the monitor
type MonitorStatus ¶
MonitorStatus represents the current status of the dependencies
type Repository ¶
type Repository struct { Name string Database *gorm.DB Username string Password string DBName string DBTypeKey string AllowedDBTypes []string DefaultDBType string Attempts uint // Number of attempts Delay time.Duration MaxIdle int MaxOpen int MaxLifetime time.Duration SetDBFunc func() (*gorm.DB, error) Info DBInfo }
Repository that reprents the access to the underlying database
func NewRepository ¶
func NewRepository(name string) *Repository
NewRepository returns production database access
func (*Repository) Create ¶
func (r *Repository) Create(entity interface{}) error
Create the entity in the database
func (*Repository) Migrate ¶
func (r *Repository) Migrate(entity interface{}) error
Migrate placeholder for service specific migration
func (*Repository) Open ¶
func (r *Repository) Open() error
Open the database and sets the underlying configuration
func (*Repository) Ping ¶
func (r *Repository) Ping() error
Ping pings the underlying database to ensure it's contactable
type Request ¶
type Request struct {
Body map[string]interface{}
}
Request generically represents inputs to the service