Documentation ¶
Index ¶
- Variables
- func Banner(data interface{}, bannerType BannerType) *optionBanner
- func Default(isDefault bool) *optionDefault
- func Name(name string) *optionName
- func NewElasticsearch(config gox.ElasticsearchConfig) (client *elastic.Client, err error)
- func NewRedis(config gox.RedisConfig) (client *redis.Client, err error)
- func NewResty(config gox.HttpClientConfig) (req *resty.Request)
- func NewXormEngine(config gox.DatabaseConfig, debug gox.Debug) (engine *xorm.Engine, err error)
- func Validate(isValidate bool) *optionValidate
- type Application
- func (a *Application) AddArgs(args ...app.Arg) error
- func (a *Application) AddCommands(commands ...app.Command) error
- func (a *Application) AddMigration(source fs.FS) error
- func (a *Application) AddServes(serves ...Serve) error
- func (a *Application) Get(function interface{}) error
- func (a *Application) GetConfig(config interface{}) (err error)
- func (a *Application) Run(bootstrap func(*Application) Bootstrap) (err error)
- func (a *Application) Set(constructor interface{}) (err error)
- func (a *Application) Sets(constructors ...interface{}) (err error)
- type BannerType
- type Bootstrap
- type Serve
- type Session
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // AppName 应用名称 AppName = `没有设置,请使用-ldflags "-s -X 'github.com/storezhang/pangu.AppName=$APP_NAME"来注入值` // AppVersion 应用版本 AppVersion = `没有设置,请使用-ldflags "-s -X 'github.com/storezhang/pangu.AppVersion=$APP_VERSION"来注入值` // BuildVersion 编译版本 BuildVersion = `没有设置,请使用-ldflags "-s -X 'github.com/storezhang/pangu.BuildVersion=$BUILD_VERSION"来注入值` // BuildTime 编译时间 BuildTime = `没有设置,请使用-ldflags "-s -X 'github.com/storezhang/pangu.BuildTime=$BUILD_TIME"来注入值` // ScmRevision 分支版本 ScmRevision = `没有设置,请使用-ldflags "-s -X 'github.com/storezhang/pangu.ScmRevision=$SCM_REVISION"来注入值` // ScmBranch 分支名称 ScmBranch = `没有设置,请使用-ldflags "-s -X 'github.com/storezhang/pangu.ScmBranch=$SCM_BRANCH"来注入值` // GoVersion Golang信息 GoVersion = runtime.Version() )
Functions ¶
func NewElasticsearch ¶
func NewElasticsearch(config gox.ElasticsearchConfig) (client *elastic.Client, err error)
NewElasticsearch 创建Elasticsearch客户端
func NewRedis ¶
func NewRedis(config gox.RedisConfig) (client *redis.Client, err error)
NewRedis 创建Redis客户端
func NewXormEngine ¶
NewXormEngine 创建Xorm操作引擎
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application 应用程序,可以加入两种种类型的程序 Serve 用于描述应用程序内的服务 Command 用于描述应用程序内可以被执行的命令
func (*Application) AddCommands ¶ added in v1.0.1
func (a *Application) AddCommands(commands ...app.Command) error
AddCommands 添加一个可以被执行的命令到应用程序中
func (*Application) AddMigration ¶
func (a *Application) AddMigration(source fs.FS) error
AddMigration 添加一个升级脚本到系统中
func (*Application) AddServes ¶ added in v1.0.1
func (a *Application) AddServes(serves ...Serve) error
AddServes 添加一个服务器到应用程序中
func (*Application) Get ¶
func (a *Application) Get(function interface{}) error
func (*Application) GetConfig ¶
func (a *Application) GetConfig(config interface{}) (err error)
GetConfig 取得解析后的配置
func (*Application) Run ¶
func (a *Application) Run(bootstrap func(*Application) Bootstrap) (err error)
Run 启动应用程序
func (*Application) Set ¶
func (a *Application) Set(constructor interface{}) (err error)
func (*Application) Sets ¶
func (a *Application) Sets(constructors ...interface{}) (err error)
type BannerType ¶
type BannerType string
BannerType 标志类型
const ( // BannerTypeTxt 文本文件 BannerTypeTxt BannerType = "txt" // BannerTypeFilepath 图片文件 BannerTypeFilepath BannerType = "filepath" // BannerTypeString 直接显示 BannerTypeString BannerType = "string" // BannerTypeAscii 内部转换 BannerTypeAscii BannerType = "ascii" // BannerTypeBinary 二进制文件数据 BannerTypeBinary BannerType = "binary" // BannerTypeFile 文件数据 BannerTypeFile BannerType = "file" )
type Bootstrap ¶
type Bootstrap interface { // Setup 配置系统 Setup() error }
Bootstrap 描述一个启动器,全局只能有一个启动器,且只能返回 Bootstrap 才能被正确的启动,需要完成的事情有 添加系统的依赖关系 使用 pangu.Application.Set 添加 pangu.Serve 实现类到 pangu.Application 中 使用 pangu.Application.Set 添加 pangu.Command 实现类到 pangu.Application 中
Source Files ¶
Click to show internal directories.
Click to hide internal directories.