Documentation ¶
Index ¶
- Constants
- func AmqpPub(m rabbit.Message) error
- func GetAmqp() (session rabbit.Session)
- func GetCache() (c cache.C)
- func GetMqtt() (session mqtt.Session)
- func GetNamedOrm(aliaName string) *persistence.OrmContext
- func GetOrm() *persistence.OrmContext
- func GetRpc() (session rpc.Session)
- func MqttPub(topic string, qos byte, retained bool, data []byte) error
- func MqttPublish(topic string, data []byte) error
- 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) 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, options ...rabbit.SessionOption) *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) EnableMqtt(options ...mqtt.ClientOption) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableOrmLog() *ApplicationBuilder
- func (h *ApplicationBuilder) EnableRpcClient(rpcOpts ...rpc.RpcClientOptions) *ApplicationBuilder
- func (h *ApplicationBuilder) EnableRpcServer(rpcOpts ...rpc.RpcServerOptions) *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) RegisterAmqpHandlers(handlers ...amqp.Handler) *ApplicationBuilder
- func (h *ApplicationBuilder) RegisterRpcMethods(methods ...any) *ApplicationBuilder
- func (h *ApplicationBuilder) SetMonitorPrefix(prefix string) *ApplicationBuilder
- func (h *ApplicationBuilder) SetWebLogLevel(lvl string) *ApplicationBuilder
- type OperatorChangeInfo
- type OperatorInfo
- type Pager
- type PagerResponse
- type Pk
- type Response
- type ResponseWrapper
- type TableChangeInfo
- type TableInfo
- type Tenant
- type TenantPk
- type TokenValidatorBuilder
- type TokenValidatorInjectFunc
Constants ¶
View Source
const ( Disable = iota Enable )
Variables ¶
This section is empty.
Functions ¶
func GetNamedOrm ¶
func GetNamedOrm(aliaName string) *persistence.OrmContext
func GetOrm ¶
func GetOrm() *persistence.OrmContext
func MqttPublish ¶
func Query ¶
func Query(h func(ctx persistence.OrmContext) (err error)) (err error)
func Transaction ¶
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 ¶
type ApplicationBuilder struct {
// contains filtered or unexported fields
}
func (*ApplicationBuilder) ComponentAfter ¶
func (h *ApplicationBuilder) ComponentAfter(component func(context.Context) (err error)) *ApplicationBuilder
func (*ApplicationBuilder) ComponentBefore ¶
func (h *ApplicationBuilder) ComponentBefore(component func(context.Context) (err error)) *ApplicationBuilder
func (*ApplicationBuilder) EnableAmqp ¶
func (h *ApplicationBuilder) EnableAmqp(c amqp.Connector, options ...rabbit.SessionOption) *ApplicationBuilder
func (*ApplicationBuilder) EnableCache ¶
func (h *ApplicationBuilder) EnableCache(redisOpts cache.RedisOptions, cacheOpts cache.Options) *ApplicationBuilder
func (*ApplicationBuilder) EnableDatabase ¶
func (h *ApplicationBuilder) EnableDatabase(config persistence.BaseConfig, models ...interface{}) *ApplicationBuilder
func (*ApplicationBuilder) EnableMqtt ¶
func (h *ApplicationBuilder) EnableMqtt(options ...mqtt.ClientOption) *ApplicationBuilder
func (*ApplicationBuilder) EnableOrmLog ¶
func (h *ApplicationBuilder) EnableOrmLog() *ApplicationBuilder
func (*ApplicationBuilder) EnableRpcClient ¶ added in v0.0.2
func (h *ApplicationBuilder) EnableRpcClient(rpcOpts ...rpc.RpcClientOptions) *ApplicationBuilder
func (*ApplicationBuilder) EnableRpcServer ¶ added in v0.0.2
func (h *ApplicationBuilder) EnableRpcServer(rpcOpts ...rpc.RpcServerOptions) *ApplicationBuilder
默认80端口
func (*ApplicationBuilder) EnableStaticWeb ¶
func (h *ApplicationBuilder) EnableStaticWeb(assetFile func() http.FileSystem) *ApplicationBuilder
func (*ApplicationBuilder) EnableTokenValidator ¶
func (h *ApplicationBuilder) EnableTokenValidator(builder TokenValidatorBuilder) *ApplicationBuilder
EnableTokenValidator 验证Token,使用RedisTokenValidator前需要enableCache
func (*ApplicationBuilder) EnableWeb ¶
func (h *ApplicationBuilder) EnableWeb(listen string, components ...server.Component) *ApplicationBuilder
func (*ApplicationBuilder) HealthyHandler ¶
func (h *ApplicationBuilder) HealthyHandler(handler func() int) *ApplicationBuilder
func (*ApplicationBuilder) LoadConfig ¶
func (h *ApplicationBuilder) LoadConfig(config interface{}, callback func(etc.Loader)) (err error)
func (*ApplicationBuilder) PrintVersion ¶
func (h *ApplicationBuilder) PrintVersion() *ApplicationBuilder
func (*ApplicationBuilder) ReadyHandler ¶
func (h *ApplicationBuilder) ReadyHandler(handler func() int) *ApplicationBuilder
func (*ApplicationBuilder) RegisterAmqpHandlers ¶
func (h *ApplicationBuilder) RegisterAmqpHandlers(handlers ...amqp.Handler) *ApplicationBuilder
RegisterAmqpHandlers 注册amqp handler
业务类任务使用延时执行策略,在连接型任务之后执行
func (*ApplicationBuilder) RegisterRpcMethods ¶ added in v0.0.2
func (h *ApplicationBuilder) RegisterRpcMethods(methods ...any) *ApplicationBuilder
func (*ApplicationBuilder) SetMonitorPrefix ¶
func (h *ApplicationBuilder) SetMonitorPrefix(prefix string) *ApplicationBuilder
func (*ApplicationBuilder) SetWebLogLevel ¶
func (h *ApplicationBuilder) SetWebLogLevel(lvl string) *ApplicationBuilder
type OperatorChangeInfo ¶
type OperatorChangeInfo struct { OperatorInfo UpdateOperator int `orm:"column(moperator)"` }
OperatorChangeInfo 不可与 OperatorInfo 同时使用
type OperatorInfo ¶
type OperatorInfo struct {
CreateOperator int `orm:"column(coperator)"`
}
type Pager ¶
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 ¶
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 ¶
type Response ¶
type ResponseWrapper ¶
type ResponseWrapper struct { Response Data interface{} `json:"data,omitempty"` }
type TableChangeInfo ¶
type TableChangeInfo struct { // 状态 Status int `orm:"column(status)"` // 创建时间 TableInfo // 修改时间 UpdateTime time.Time `orm:"auto_now;type(datetime);column(mtime)"` }
TableChangeInfo 不可与 TableInfo 同时使用
type TokenValidatorBuilder ¶
type TokenValidatorBuilder func(injectFunc TokenValidatorInjectFunc)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.