Documentation ¶
Index ¶
- Constants
- func GenerateDockerfile(config ApplicationConfig) (err error)
- func GetAmqp() (session rabbit.Session)
- func GetCache() (c cache.C)
- func GetNamedOrm(aliaName string) *persistence.OrmContext
- func GetOrm() *persistence.OrmContext
- func Query(h func(ctx persistence.OrmContext) (err error)) (err error)
- func Transaction(h func(ctx persistence.TxContext) error) (err error)
- type Application
- type ApplicationBuilder
- func (h *ApplicationBuilder) AmqpOptions(options ...rabbit.SessionOption) *ApplicationBuilder
- func (h *ApplicationBuilder) ComponentAfter(component func(context.Context) (err error)) *ApplicationBuilder
- func (h *ApplicationBuilder) ComponentBefore(component func(context.Context) (err error)) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableAmqp(c amqp.Connector, handlers ...amqp.Handler) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableCache(redisOpts cache.RedisOptions, cacheOpts cache.Options) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableDatabase(config persistence.BaseConfig, models ...interface{}) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableOrmLog() *ApplicationBuilder
- func (h *ApplicationBuilder) EnableStaticWeb(assetFile func() http.FileSystem) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableTokenValidator(builder TokenValidatorBuilder) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableWeb(listen string, components ...server.Component) *ApplicationBuilder
- func (h *ApplicationBuilder) HealthyHandler(handler func() int) *ApplicationBuilder
- func (h *ApplicationBuilder) LoadConfig(config interface{}, callback func(etc.Loader)) (err error)
- func (h *ApplicationBuilder) PrintVersion() *ApplicationBuilder
- func (h *ApplicationBuilder) ReadyHandler(handler func() int) *ApplicationBuilder
- func (h *ApplicationBuilder) SetMonitorPrefix(prefix string) *ApplicationBuilder
- func (h *ApplicationBuilder) SetWebLogLevel(lvl string) *ApplicationBuilder
- type ApplicationConfig
- type Pager
- type PagerResponse
- type Response
- type TokenValidatorBuilder
- type TokenValidatorInjectFunc
Constants ¶
View Source
const ( DockerfileName = "Dockerfile" BuildFileName = "build.sh" )
Variables ¶
This section is empty.
Functions ¶
func GenerateDockerfile ¶ added in v1.7.2
func GenerateDockerfile(config ApplicationConfig) (err error)
func GetNamedOrm ¶ added in v1.6.9
func GetNamedOrm(aliaName string) *persistence.OrmContext
func Query ¶ added in v1.6.6
func Query(h func(ctx persistence.OrmContext) (err error)) (err error)
func Transaction ¶ added in v1.6.6
func Transaction(h func(ctx persistence.TxContext) error) (err error)
Types ¶
type Application ¶
type Application interface {
Start(buildHandler func(ctx context.Context, builder *ApplicationBuilder) error, onTerminate func(string)) error
}
func New ¶
func New() (instance Application)
type ApplicationBuilder ¶ added in v1.2.1
type ApplicationBuilder struct {
// contains filtered or unexported fields
}
func (*ApplicationBuilder) AmqpOptions ¶ added in v1.8.9
func (h *ApplicationBuilder) AmqpOptions(options ...rabbit.SessionOption) *ApplicationBuilder
func (*ApplicationBuilder) ComponentAfter ¶ added in v1.2.1
func (h *ApplicationBuilder) ComponentAfter(component func(context.Context) (err error)) *ApplicationBuilder
func (*ApplicationBuilder) ComponentBefore ¶ added in v1.2.1
func (h *ApplicationBuilder) ComponentBefore(component func(context.Context) (err error)) *ApplicationBuilder
func (*ApplicationBuilder) EnableAmqp ¶ added in v1.8.0
func (h *ApplicationBuilder) EnableAmqp(c amqp.Connector, handlers ...amqp.Handler) *ApplicationBuilder
func (*ApplicationBuilder) EnableCache ¶ added in v1.4.0
func (h *ApplicationBuilder) EnableCache(redisOpts cache.RedisOptions, cacheOpts cache.Options) *ApplicationBuilder
func (*ApplicationBuilder) EnableDatabase ¶ added in v1.2.1
func (h *ApplicationBuilder) EnableDatabase(config persistence.BaseConfig, models ...interface{}) *ApplicationBuilder
func (*ApplicationBuilder) EnableOrmLog ¶ added in v1.7.3
func (h *ApplicationBuilder) EnableOrmLog() *ApplicationBuilder
func (*ApplicationBuilder) EnableStaticWeb ¶ added in v1.2.1
func (h *ApplicationBuilder) EnableStaticWeb(assetFile func() http.FileSystem) *ApplicationBuilder
func (*ApplicationBuilder) EnableTokenValidator ¶ added in v1.9.0
func (h *ApplicationBuilder) EnableTokenValidator(builder TokenValidatorBuilder) *ApplicationBuilder
EnableTokenValidator 验证Token,使用RedisTokenValidator前需要enableCache
func (*ApplicationBuilder) EnableWeb ¶ added in v1.2.1
func (h *ApplicationBuilder) EnableWeb(listen string, components ...server.Component) *ApplicationBuilder
func (*ApplicationBuilder) HealthyHandler ¶ added in v1.5.0
func (h *ApplicationBuilder) HealthyHandler(handler func() int) *ApplicationBuilder
func (*ApplicationBuilder) LoadConfig ¶ added in v1.2.1
func (h *ApplicationBuilder) LoadConfig(config interface{}, callback func(etc.Loader)) (err error)
func (*ApplicationBuilder) PrintVersion ¶ added in v1.7.3
func (h *ApplicationBuilder) PrintVersion() *ApplicationBuilder
func (*ApplicationBuilder) ReadyHandler ¶ added in v1.5.0
func (h *ApplicationBuilder) ReadyHandler(handler func() int) *ApplicationBuilder
func (*ApplicationBuilder) SetMonitorPrefix ¶ added in v1.5.0
func (h *ApplicationBuilder) SetMonitorPrefix(prefix string) *ApplicationBuilder
func (*ApplicationBuilder) SetWebLogLevel ¶ added in v1.3.3
func (h *ApplicationBuilder) SetWebLogLevel(lvl string) *ApplicationBuilder
type ApplicationConfig ¶ added in v1.7.2
type Pager ¶ added in v1.1.3
type Pager struct { TotalPage int `json:"totalPage"` // 总页数 PageSize int `json:"pageSize"` // 页面大小 PageNum int `json:"pageNum"` // 页号 More int `json:"more"` // 是否有下一页 Data []interface{} `json:"items,omitempty"` }
func QueryList ¶ added in v1.6.6
func QueryList(req Pager, dataPtr interface{}, queryHandler func(ctx persistence.OrmContext) (qs orm.QuerySeter), orderHandler func(persistence.OrmContext, orm.QuerySeter) (qs orm.QuerySeter), processHandler ...func(ctx persistence.OrmContext, dataPtr interface{}) error, ) (p Pager, err error)
type PagerResponse ¶ added in v1.1.3
type Response ¶ added in v1.1.3
type Response struct { Code interface{} `json:"code,omitempty"` Success interface{} `json:"success,omitempty"` Message string `json:"message,omitempty"` }
func (*Response) SetSuccess ¶ added in v1.1.3
type TokenValidatorBuilder ¶ added in v1.9.0
type TokenValidatorBuilder func(injectFunc TokenValidatorInjectFunc)
type TokenValidatorInjectFunc ¶ added in v1.9.0
Source Files ¶
Click to show internal directories.
Click to hide internal directories.