app

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg interface {

	// GetValue 参数值
	GetValue() interface{}
	// GetDefaultText 默认值
	GetDefaultText() string
	// contains filtered or unexported methods
}

type Command

type Command interface {

	// Run 命令实际执行
	Run(ctx *Context) error

	// SubCommands 子命令
	SubCommands() []Command
	// contains filtered or unexported methods
}

Command 描述一个可以被执行的命令

type Context

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

Context 描述上下文

func NewContext

func NewContext(ctx *cli.Context) *Context

NewContext 创建一个上下文

func (*Context) String

func (c *Context) String(name string) string

type Service added in v1.0.1

type Service interface {
	// NextId 生成下一个编号
	NextId() int64

	// Debug 记录调试日志
	Debug(msg string, fields ...gox.Field)

	// Info 记录普通信息日志
	Info(msg string, fields ...gox.Field)

	// Warn 记录警告日志
	Warn(msg string, fields ...gox.Field)

	// Error 记录错误日志
	Error(msg string, fields ...gox.Field)

	// Panic 记录异常日志,程序会退出,可以使用recover机制来阻止程序退出
	Panic(msg string, fields ...gox.Field)

	// Fatal 记录致命错误日志,程序会退出
	Fatal(msg string, fields ...gox.Field)
}

Service 应用服务,用来组装常用行为

func NewDefaultService added in v1.0.1

func NewDefaultService(logger glog.Logger, snowflake *gox.Snowflake) Service

NewDefaultService 创建默认的应用服务

Jump to

Keyboard shortcuts

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