core

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(e error, isFatal bool)

Check checks multiple err != nil mantras & logs if something went wrong

func GetEnv added in v0.0.9

func GetEnv(key string, fallback interface{}) interface{}

GetEnv returns ENV variable value or fallback if not set

func NewRouter added in v0.3.0

func NewRouter(mountPoints []Mountable, log *Logger) *router.Router

NewRouter creates root loader and mounts subrouters

Types

type Cache added in v0.2.0

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

func NewCache added in v0.2.0

func NewCache(config *Configuration) *Cache

func (*Cache) Get added in v0.2.0

func (c *Cache) Get(key string, expiration time.Duration, cache CacheMethod) (interface{}, error)

GetCached returns cached result of a func

type CacheMethod added in v0.0.19

type CacheMethod func() (interface{}, error)

CacheMethod generic cacheable function

type Configuration added in v0.2.0

type Configuration struct {
	BaseURL           string
	Debug             bool
	HostAddress       string
	Port              int
	TemplatePath      string
	MediaPath         string
	MediaURL          string
	ThumbnailsPrefix  string
	CacheEnabled      bool
	DbHost            string
	DbPort            string
	DbName            string
	DbUser            string
	DbPassword        string
	SMTPHost          string
	SMTPPort          int
	SMTPUser          string
	SMTPPassword      string
	SessionVersion    string
	SecureAuthKey     string
	SecureVault       *securecookie.SecureCookie
	SecondsRarely     time.Duration
	SecondsFrequently time.Duration
	Timezone          *time.Location
}

func NewConfiguration added in v0.2.0

func NewConfiguration(namespace string, overrides map[string]interface{}) *Configuration

NewConfiguration sets Config singletone by ENV variables overriden by map

type Logger added in v0.2.0

type Logger struct {
	logrus.Logger
}

func NewLogger added in v0.2.0

func NewLogger() *Logger

InitLogger sets debug level and logger preferences

type Mountable added in v0.3.0

type Mountable interface {
	Mount(*router.Router)
}

Mountable describes a routing group to be attached in the main pnk

type QueryLogger

type QueryLogger struct{}

QueryLogger logs formatted queries

func (QueryLogger) AfterQuery

func (ql QueryLogger) AfterQuery(c context.Context, q *bun.QueryEvent)

AfterQuery logs formatted query after it finishes

func (QueryLogger) BeforeQuery

func (ql QueryLogger) BeforeQuery(c context.Context, q *bun.QueryEvent) context.Context

BeforeQuery dummy

type Server added in v0.3.0

type Server struct {
	fasthttp.Server
	// contains filtered or unexported fields
}

func NewServer added in v0.3.0

func NewServer(name string, routes []Mountable, config *Configuration, log *Logger) *Server

func (*Server) Run added in v0.3.0

func (srv *Server) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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