Documentation
¶
Overview ¶
Package app 提供 core、database 和 server 的约定式应用运行时。
Index ¶
- func DB() *dbx.DB
- func Main()
- func RegisterBootstrap(functions ...BootstrapFunc)
- func RegisterGRPC(functions ...standard.GRPCRegisterFunc)
- func RegisterGateway(functions ...standard.GatewayRegisterFunc)
- func RegisterMigration(up, down func(*dbx.DB) error)
- func RegisterMigrationOptions(options ...migrate.Option)
- func RegisterRoute(method, path string, handler standard.HandlerFunc)
- func RegisterServerOptionFactories(factories ...ServerOptionFactory)
- func RegisterServerOptions(options ...standard.Option)
- func Run() error
- func Server() *standard.Server
- type BootstrapFunc
- type ServerOptionFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterBootstrap ¶
func RegisterBootstrap(functions ...BootstrapFunc)
RegisterBootstrap 登记数据库迁移后的业务初始化函数。
func RegisterGRPC ¶
func RegisterGRPC(functions ...standard.GRPCRegisterFunc)
RegisterGRPC 登记业务 gRPC 服务。
func RegisterGateway ¶
func RegisterGateway(functions ...standard.GatewayRegisterFunc)
RegisterGateway 登记由 google.api.http 生成的 Gateway 路由。
func RegisterMigration ¶
RegisterMigration 从直接调用方的文件名生成迁移 ID 并登记数据库迁移。 文件名必须符合 YYYYMMDD_HHMMSS_NN_description.go,发布后不得重命名。
func RegisterMigrationOptions ¶
RegisterMigrationOptions 登记数据库迁移的全局执行选项。
func RegisterRoute ¶
func RegisterRoute(method, path string, handler standard.HandlerFunc)
RegisterRoute 登记不适合 Proto JSON 映射的额外 HTTP 接口。
func RegisterServerOptionFactories ¶
func RegisterServerOptionFactories(factories ...ServerOptionFactory)
RegisterServerOptionFactories 登记需要在数据库初始化后构造的 Server Option。
func RegisterServerOptions ¶
RegisterServerOptions 登记不依赖运行时数据库的 Server Option。
Types ¶
type BootstrapFunc ¶
BootstrapFunc 在数据库迁移完成后、Server 启动前执行一次业务初始化。
type ServerOptionFactory ¶
ServerOptionFactory 在数据库初始化后创建 Server Option。 需要访问 DB 的鉴权拦截器等组件应通过该工厂注册。
Click to show internal directories.
Click to hide internal directories.