gsf

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: MulanPSL-2.0 Imports: 13 Imported by: 5

README

gsf-fof

Documentation

Index

Constants

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

	CliAppEnv     = "app-env"
	CliAppVer     = "app-version"
	CliAppLogMore = "app-log-more"
	InvalidPath   = "__invalid__"
)
View Source
const (
	CliWebIP           = "web-ip"
	CliWebPort         = "web-port"
	CliWebReadTimeout  = "web-r-timeout"
	CliWebWriteTimeout = "web-w-timeout"
	CliWebIdleTimeout  = "web-idle-timeout"
)

Variables

View Source
var (
	EnvVersion = "1.0.0"

	EnvLocalArg   = "local"   // 本地
	EnvTestArg    = "test"    // 测试
	EnvPrevArg    = "preview" // 预发布
	EnvReleaseArg = "release" // 线上
)
View Source
var (
	CmdNoFind = errors.New(" Command No Find")
)

Functions

This section is empty.

Types

type Application added in v0.5.0

type Application struct {
	Component map[string]Component
	Log       logger.Interface
	Cfg       Config
	Ser       Service
}

func (*Application) Start added in v0.5.0

func (app *Application) Start(cmd *cli.App, args []string, service Service)

type CmdArg added in v0.5.0

type CmdArg struct {
	Name, Default string
}

type CmdHandle added in v0.5.0

type CmdHandle interface {
	Flags() []CmdArg
	Run(logger.Interface, map[string]string) error
}

type CmdService added in v0.5.0

type CmdService struct {
	Router                map[string]CmdHandle
	BeforeRun, BeforeInit func(l logger.Interface) error
	// contains filtered or unexported fields
}

func (*CmdService) AddCmdFunc added in v0.5.0

func (c *CmdService) AddCmdFunc(name string, handle func(logger.Interface) error) *CmdService

func (*CmdService) AddCmdHandle added in v0.5.0

func (c *CmdService) AddCmdHandle(name string, handle CmdHandle) *CmdService

func (*CmdService) CliFlags added in v0.5.0

func (c *CmdService) CliFlags() []cli.Flag

func (*CmdService) Close added in v0.5.0

func (c *CmdService) Close()

func (*CmdService) Init added in v0.5.0

func (c *CmdService) Init(cfg *Config, _ *cli.Context) (logger.Interface, error)

func (*CmdService) Run added in v0.5.0

func (c *CmdService) Run(l logger.Interface, _ *Config) error

type Component added in v0.5.0

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

type Config added in v0.5.0

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

func (*Config) Env added in v0.5.0

func (v *Config) Env() int

func (*Config) EnvDesc added in v0.5.0

func (v *Config) EnvDesc() string

func (*Config) ExecDir added in v0.5.0

func (v *Config) ExecDir() string

func (*Config) LogMore added in v0.5.0

func (v *Config) LogMore() bool

func (*Config) Version added in v0.5.0

func (v *Config) Version() string

type Service added in v0.5.0

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

type WebConfig added in v0.5.0

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 WebService added in v0.5.0

type WebService struct {
	Cfg                   WebConfig
	Handler               http.Handler
	BeforeRun, BeforeInit func(l logger.Interface) error
}

func (*WebService) CliFlags added in v0.5.0

func (c *WebService) CliFlags() []cli.Flag

func (*WebService) Close added in v0.5.0

func (c *WebService) Close()

func (*WebService) Init added in v0.5.0

func (c *WebService) Init(cfg *Config, _ *cli.Context) (logger.Interface, error)

func (*WebService) Run added in v0.5.0

func (c *WebService) Run(l logger.Interface, cfg *Config) error

Directories

Path Synopsis
web

Jump to

Keyboard shortcuts

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