core

package
v0.0.0-...-38ac173 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLog

func GetLog() *zap.SugaredLogger

GetLog returns a application logger instance

func GetRedisClient

func GetRedisClient() *redis.Client

GetRedisClient returns a redis client instance

func GetStore

func GetStore() db.Store

GetStore returns a application store interface

func NewApplication

func NewApplication(echo *echo.Echo)

NewApplication creates and set a server instance

func NewConfig

func NewConfig()

NewConfig creates and set application config instance

func NewDBConn

func NewDBConn(conn *sql.DB)

NewDBConn creates and set a database instance

func NewRedis

func NewRedis(r *redis.Client)

NewRedis set a redis instance

func NewStore

func NewStore(st db.Store)

NewStore set a store interface

func SetupLog

func SetupLog()

SetupLog creates a log instance

Types

type AppConfig

type AppConfig struct{}

func GetConfig

func GetConfig() *AppConfig

GetConfig application config 반환

func (*AppConfig) Bool

func (*AppConfig) Bool(key string) bool

Bool returns a bool value of key

func (*AppConfig) DefaultInt

func (*AppConfig) DefaultInt(key string, defaultVal int) int

DefaultInt returns a int value of key, if not exists key then returns a default value

func (*AppConfig) DefaultString

func (*AppConfig) DefaultString(key string, defaultVal string) string

DefaultString returns a string value of key, if not exists key then returns a default value

func (*AppConfig) Duration

func (*AppConfig) Duration(key string) time.Duration

Duration returns a time.duration value of key

func (*AppConfig) GetMode

func (c *AppConfig) GetMode() string

GetMode returns GO_ENV value

func (*AppConfig) Int

func (*AppConfig) Int(key string) int

Int returns a int value of key

func (*AppConfig) IsDev

func (c *AppConfig) IsDev() bool

IsDev returns true if GO_ENV has a development value, otherwise false

func (*AppConfig) String

func (*AppConfig) String(key string) string

String returns a string value of key

type Application

type Application struct {
	*echo.Echo
}

func GetApplication

func GetApplication() *Application

GetApplication return a application instance

func (*Application) PrintRoutes

func (app *Application) PrintRoutes(filename string)

PrintRoutes prints route information of echo server to a file

func (*Application) RegisterHandler

func (app *Application) RegisterHandler(fn context.AppRegisterFunc, path string, h context.AppHandlerFunc, m ...echo.MiddlewareFunc) *echo.Route

RegisterHandler 핸들러 등록

func (*Application) RegisterRoutes

func (app *Application) RegisterRoutes(register func(*Application))

RegisterRoutes Routes 등록

func (*Application) RoutePath

func (app *Application) RoutePath(name string, params ...interface{}) string

RoutePath returns a reverse routes path

func (*Application) RunServer

func (app *Application) RunServer()

RunServer starts a server

type DBConn

type DBConn struct {
	*sql.DB
}

func GetDefaultConnection

func GetDefaultConnection() *DBConn

GetDefaultConnection returns a database connection

Directories

Path Synopsis
pkg
db

Jump to

Keyboard shortcuts

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