gsf

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 5

README

gsf-core

web config json

{
  "ip" : "0.0.0.0",
  "port" : 9902,
  "timeout": {
    "read" : 5,
    "write" : 5,
    "idle" : 10
  }
}

命令行参数

--app-env value      env(local-本地环境, test-测试环境, preview-预发布环境, release-线上环境) (default: "local")
--app-version value  version (default: "1.0.0")
--app-log-more       log more (default: false)
--app-cmd value      cmd

Documentation

Index

Constants

View Source
const (
	EnvDev  = 0 // 本地
	EnvTest = 1 // 测试
	EnvPrev = 2 // 预发布
	EnvProd = 3 // 线上

)

Variables

View Source
var (
	AppCmdNoFind = errors.New(" Command No Find")
)

Functions

func AppCmd

func AppCmd() *_CmdApplication

func AppWeb

func AppWeb() *_ApplicationWeb

Types

type AppConfig

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

func (*AppConfig) CheckEnv added in v0.0.4

func (v *AppConfig) CheckEnv(e int) bool

func (*AppConfig) GetEnv

func (v *AppConfig) GetEnv() int

func (*AppConfig) GetEnvDesc added in v0.0.4

func (v *AppConfig) GetEnvDesc() string

func (*AppConfig) GetExecDir

func (v *AppConfig) GetExecDir() string

func (*AppConfig) GetLogMore added in v0.0.4

func (v *AppConfig) GetLogMore() bool

func (*AppConfig) GetVersion

func (v *AppConfig) GetVersion() string

type CmdFunc

type CmdFunc func(logger.Interface) error

type CmdRouter

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

func (*CmdRouter) AddCmdHandle

func (r *CmdRouter) AddCmdHandle(name string, handle CmdFunc) *CmdRouter

func (*CmdRouter) AddComponent

func (r *CmdRouter) AddComponent(name string, c Component) *CmdRouter

func (*CmdRouter) CheckCmd

func (r *CmdRouter) CheckCmd(name string) (err error)

func (*CmdRouter) Components added in v0.0.4

func (r *CmdRouter) Components() map[string]Component

func (*CmdRouter) Init

func (r *CmdRouter) Init(cfg *AppConfig) logger.Interface

func (CmdRouter) Run

func (r CmdRouter) Run(name string, log logger.Interface) error

func (*CmdRouter) SetLog added in v0.0.4

func (r *CmdRouter) SetLog(v logger.Interface)

type CmdRouterInterface added in v0.0.4

type CmdRouterInterface interface {
	Init(*AppConfig) logger.Interface
	CheckCmd(name string) (err error)
	Run(name string, log logger.Interface) error
	Components() map[string]Component
}

type Component

type Component interface {
	CliFlags() []cli.Flag
	Init(logger.Interface, *AppConfig, *cli.Context) error
	Run() error
	Close() error
}

type WebConfig

type WebConfig struct {
	IP      string `json:"ip"   yaml:"ip"`
	Port    int    `json:"port" yaml:"port"`
	Timeout struct {
		Read  int `json:"read"  yaml:"read"`
		Write int `json:"write" yaml:"write"`
		Idle  int `json:"idle"  yaml:"idle"`
	} `json:"timeout" yaml:"timeout"`
}

type WebRouter

type WebRouter func(r gin.IRouter) error

type WebService

type WebService interface {
	Components() map[string]Component
	Init(*AppConfig, *WebConfig) (logger.Interface, error)
	RunBefore(*AppConfig) (WebRouter, error)
	CloseBefore()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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