Documentation ¶
Index ¶
- Constants
- Variables
- 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 GetWebServer() (s *server.Server)
- 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 QueryPage[Model any, Dto any](pager *SimplePager[Model, Dto]) (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) EnableDatabaseLog() *ApplicationBuilder
- func (h *ApplicationBuilder) EnableMqtt(options ...mqtt.ClientOption) *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) RegisterAmqpHandlers(handlers ...amqp.Handler) *ApplicationBuilder
- func (h *ApplicationBuilder) SetMonitorPrefix(prefix string) *ApplicationBuilder
- func (h *ApplicationBuilder) SetWebLogLevel(lvl string) *ApplicationBuilder
- type BasePager
- type OperatorChangeInfo
- type OperatorInfo
- type Pager
- type PagerResponse
- type Pk
- type Response
- type ResponseWrapper
- type SimplePager
- type TableChangeInfo
- type TableInfo
- type Tenant
- type TenantPk
- type TokenValidatorBuilder
- type TokenValidatorInjectFunc
Constants ¶
View Source
const ( Disable = iota Enable )
Variables ¶
Functions ¶
func GetNamedOrm ¶ added in v1.6.9
func GetNamedOrm(aliaName string) *persistence.OrmContext
func GetOrm ¶
func GetOrm() *persistence.OrmContext
func GetWebServer ¶ added in v1.20.0
func MqttPublish ¶ added in v1.10.4
func Query ¶ added in v1.6.6
func Query(h func(ctx persistence.OrmContext) (err error)) (err error)
func QueryPage ¶ added in v1.20.3
func QueryPage[Model any, Dto any](pager *SimplePager[Model, Dto]) (err error)
QueryPage 单表分页查询(默认pageNo=1 pageSize=10)
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) 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, options ...rabbit.SessionOption) *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) EnableDatabaseLog ¶ added in v1.20.5
func (h *ApplicationBuilder) EnableDatabaseLog() *ApplicationBuilder
EnableDatabaseLog 打开orm log输出
func (*ApplicationBuilder) EnableMqtt ¶ added in v1.10.0
func (h *ApplicationBuilder) EnableMqtt(options ...mqtt.ClientOption) *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) RegisterAmqpHandlers ¶ added in v1.10.2
func (h *ApplicationBuilder) RegisterAmqpHandlers(handlers ...amqp.Handler) *ApplicationBuilder
RegisterAmqpHandlers 注册amqp handler
业务类任务使用延时执行策略,在连接型任务之后执行
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 BasePager ¶ added in v1.20.3
type OperatorChangeInfo ¶ added in v1.10.15
type OperatorChangeInfo struct { OperatorInfo UpdateOperator int `orm:"column(moperator)"` }
OperatorChangeInfo 不可与 OperatorInfo 同时使用
type OperatorInfo ¶ added in v1.10.15
type OperatorInfo struct {
CreateOperator int `orm:"column(coperator)"`
}
type PagerResponse ¶ added in v1.1.3
type PagerResponse struct {
Response
}
type ResponseWrapper ¶ added in v1.11.4
type SimplePager ¶ added in v1.20.2
type TableChangeInfo ¶ added in v1.9.11
type TableChangeInfo struct { // 状态 Status int `orm:"column(status)"` // 创建时间 TableInfo // 修改时间 UpdateTime time.Time `orm:"auto_now;type(datetime);column(mtime)"` }
TableChangeInfo 不可与 TableInfo 同时使用
type Tenant ¶ added in v1.10.15
type Tenant struct {
Org int `orm:"column(org)"` // org为tenant标记
}
Tenant 多租户
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.