gsf

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 16 Imported by: 5

README

gsf-core

web config json

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

Documentation

Index

Constants

View Source
const (
	LogLevelInfo = iota
	LogLevelWarn
	LogLevelError
)

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) GetEnv

func (v *AppConfig) GetEnv() string

func (*AppConfig) GetExecDir

func (v *AppConfig) GetExecDir() string

func (*AppConfig) GetVersion

func (v *AppConfig) GetVersion() string

func (*AppConfig) IsDevEnv

func (v *AppConfig) IsDevEnv() bool

func (*AppConfig) IsProdEnv

func (v *AppConfig) IsProdEnv() bool

func (*AppConfig) IsTestEnv

func (v *AppConfig) IsTestEnv() bool

type CmdFunc

type CmdFunc func(LoggerInterface) 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) Init

func (r *CmdRouter) Init(cfg *AppConfig) LoggerInterface

func (CmdRouter) Run

func (r CmdRouter) Run(name string, log LoggerInterface) error

type Component

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

type Crontab

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

func (*Crontab) AddTask

func (c *Crontab) AddTask(name string, duration time.Duration, limit int, handle Task) error

func (*Crontab) GetTask

func (c *Crontab) GetTask(name string) (Task, int, error)

func (*Crontab) Init

func (c *Crontab) Init()

func (*Crontab) RemoveTask

func (c *Crontab) RemoveTask(name string) error

func (*Crontab) Run

func (c *Crontab) Run()

func (*Crontab) Stop

func (c *Crontab) Stop()

type LoggerCommon

type LoggerCommon struct {
	LoggerInterface
	// contains filtered or unexported fields
}

func (*LoggerCommon) Error

func (output *LoggerCommon) Error(format string, v ...interface{})

func (*LoggerCommon) Info

func (output *LoggerCommon) Info(format string, v ...interface{})

func (*LoggerCommon) Init

func (output *LoggerCommon) Init(level int, colorful bool, normal, err io.Writer)

func (*LoggerCommon) Warn

func (output *LoggerCommon) Warn(format string, v ...interface{})

type LoggerInterface

type LoggerInterface interface {
	Info(format string, v ...interface{})
	Warn(format string, v ...interface{})
	Error(format string, v ...interface{})
}

type LoggerToNull

type LoggerToNull struct {
	LoggerInterface
}

********************* toNull

func (*LoggerToNull) Debug

func (output *LoggerToNull) Debug(format string, v ...interface{})

func (*LoggerToNull) Error

func (output *LoggerToNull) Error(format string, v ...interface{})

func (*LoggerToNull) Info

func (output *LoggerToNull) Info(format string, v ...interface{})

func (*LoggerToNull) Warn

func (output *LoggerToNull) Warn(format string, v ...interface{})

type Node

type Node interface {
	Name() string
	Run(time.Time)
	ExecuteAt() time.Time
	SetExecuteAt(time.Time)
	Idx() int
	SetIdx(int)
	Duration() time.Duration
	Valid() bool
	SetRemove()
	ResetValid(time.Time)
	OnRemove()
	OnClose()
}

***** Node

type PassiveCache

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

**** PassiveCache

func (*PassiveCache) Delete

func (c *PassiveCache) Delete(name string) error

func (*PassiveCache) Get

func (c *PassiveCache) Get(name string) (interface{}, error)

func (*PassiveCache) GetAndStore

func (c *PassiveCache) GetAndStore(name string, duration time.Duration, handle TickerCacheLoad) (interface{}, error)

func (*PassiveCache) Init

func (c *PassiveCache) Init()

func (*PassiveCache) Run

func (c *PassiveCache) Run()

func (*PassiveCache) Stop

func (c *PassiveCache) Stop()

type Task

type Task interface {
	Run(tm time.Time, remain int)
	Close()
}

type Ticker

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

***** Ticker

func (*Ticker) Get

func (c *Ticker) Get(name string) (Node, error)

func (*Ticker) Init

func (c *Ticker) Init()

func (*Ticker) Register

func (c *Ticker) Register(node Node) error

func (*Ticker) Remove

func (c *Ticker) Remove(name string) error

func (*Ticker) Run

func (c *Ticker) Run()

func (*Ticker) Stop

func (c *Ticker) Stop()

type TickerCacheLoad

type TickerCacheLoad func() (interface{}, 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, LoggerInterface, 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