core

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

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package core handles most of the common db, config and proto initialization.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLog = New(
	LogLevelDebug,
	log.New(os.Stderr, "", log.LstdFlags),
)
View Source
var ErrNoFile = errors.New("config: No file specified")

Functions

func WaitUntilInterrupt

func WaitUntilInterrupt()

Types

type App

type App struct {
	AppName       string
	ModuleName    string
	Config        *Config
	Log           *Logger
	ClientFactory sarif.ClientFactory
}

func NewApp

func NewApp(appName, moduleName string) *App

func (*App) ClientDial

func (app *App) ClientDial(ci sarif.ClientInfo) (sarif.Client, error)

func (*App) Close

func (app *App) Close()

func (*App) Init

func (app *App) Init()

func (*App) InitClientFactory

func (app *App) InitClientFactory() (err error)

func (*App) Must

func (app *App) Must(err error)

func (*App) WriteConfig

func (app *App) WriteConfig()

type Config

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

func FindConfig

func FindConfig(app, module string) (*Config, error)

func NewConfig

func NewConfig(file string) *Config

func OpenConfig

func OpenConfig(file string, create bool) (*Config, error)

func (*Config) Dir

func (cfg *Config) Dir() string

func (*Config) Exists

func (cfg *Config) Exists(section string) bool

func (*Config) Get

func (cfg *Config) Get(section string, v interface{}) (error, bool)

func (*Config) IsModified

func (cfg *Config) IsModified() bool

func (*Config) Path

func (cfg *Config) Path() string

func (*Config) Section

func (c *Config) Section(name string) *Section

func (*Config) Set

func (cfg *Config) Set(section string, v interface{}) error

func (*Config) Write

func (cfg *Config) Write() error

type ErrConfNotFound

type ErrConfNotFound struct {
	Section string
}

func (ErrConfNotFound) Error

func (e ErrConfNotFound) Error() string

type LogLevel

type LogLevel int
const (
	LogLevelTrace LogLevel = iota
	LogLevelDebug
	LogLevelInfo
	LogLevelWarn
	LogLevelError
	LogLevelFatal
	LogLevelCritical
)

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

func New

func New(level LogLevel, l *log.Logger) *Logger

func (*Logger) Criticalf

func (l *Logger) Criticalf(format string, v ...interface{})

func (*Logger) Criticalln

func (l *Logger) Criticalln(v ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Debugln

func (l *Logger) Debugln(v ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Errorln

func (l *Logger) Errorln(v ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

func (*Logger) Fatalln

func (l *Logger) Fatalln(v ...interface{})

func (*Logger) GetLevel

func (l *Logger) GetLevel() LogLevel

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Infoln

func (l *Logger) Infoln(v ...interface{})

func (*Logger) SetLevel

func (l *Logger) SetLevel(level LogLevel)

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

func (*Logger) Warnln

func (l *Logger) Warnln(v ...interface{})

type Section

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

func (*Section) Dir

func (s *Section) Dir() string

func (*Section) Exists

func (s *Section) Exists() bool

func (*Section) Get

func (s *Section) Get(v interface{}) (error, bool)

func (*Section) Set

func (s *Section) Set(v interface{}) error

Directories

Path Synopsis
Package apphost provides a modular host for microservices.
Package apphost provides a modular host for microservices.
Package server provides a broker and modular host for microservices.
Package server provides a broker and modular host for microservices.

Jump to

Keyboard shortcuts

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