Documentation ¶
Index ¶
- func DefaultGRPC() application.Application
- func DefaultHTTP(args ...bool) application.Application
- func EnableHealthCheckURL(path ...string)
- func New(args ...bool) application.Application
- func RegisterController(controllerName string, instance interface{}, ...)
- func RegisterInstance(instance interface{}, tags ...string)
- func RegisterModel(instance interface{}, defaultValues ...interface{})
- func SetCasbinConfPath(path string)
- func SetConfigPath(path string)
- func SetFuncGetWhoAmI(...)
- func SetHealthCheckDefaultHandler(handler func(app application.Application) func(c *gin.Context))
- func SetIsLogSelfCheck(isLog bool)
- func SetKeyword(k keyword.Keyword)
- func SetResponseFactory(f func(status int, res interface{}, runtime map[string]string) interface{})
- type Application
- func (app *Application) Conf() conf.Conf
- func (app *Application) ContextPool() *application.ContextPool
- func (app *Application) ControllerPool() *application.ControllerPool
- func (app *Application) DB() *gorm.DB
- func (app *Application) Enforcer() *casbin.Enforcer
- func (app *Application) GetGRPCServer() *grpc.Server
- func (app *Application) InitGRPC()
- func (app *Application) InitHTTP()
- func (app *Application) InitRouter()
- func (app *Application) InitTrinity()
- func (app *Application) InstallDB(f func() *gorm.DB)
- func (app *Application) InstancePool() *application.InstancePool
- func (app *Application) IsLogSelfCheck() bool
- func (app *Application) Keyword() keyword.Keyword
- func (app *Application) Logger() *golog.Logger
- func (app *Application) RegRuntimeKey(runtime ...truntime.RuntimeKey) application.Application
- func (app *Application) ResponseFactory() func(status int, res interface{}, runtime map[string]string) interface{}
- func (app *Application) Router() *gin.Engine
- func (app *Application) RuntimeKeys() []truntime.RuntimeKey
- func (app *Application) ServeGRPC()
- func (app *Application) ServeHTTP()
- func (app *Application) UseInterceptor(interceptor ...grpc.UnaryServerInterceptor) application.Application
- func (app *Application) UseMiddleware(middleware ...gin.HandlerFunc) application.Application
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHTTP ¶
func DefaultHTTP(args ...bool) application.Application
DefaultHTTP default http server
func EnableHealthCheckURL ¶ added in v0.0.19
func EnableHealthCheckURL(path ...string)
EnableHealthCheckURL set config path
func RegisterController ¶ added in v0.0.25
func RegisterController(controllerName string, instance interface{}, requestMaps ...*application.RequestMap)
RegisterController register service @controllerName basic request path of the controller @instance controller instance ,should be ptr @requestMaps optional ,register the request based on the basic path of controller
func RegisterInstance ¶ added in v0.0.25
func RegisterInstance(instance interface{}, tags ...string)
RegisterInstance register instance @instance instance of the class , should be ptr @tags the tags for the instance to specify
func RegisterModel ¶ added in v0.1.3
func RegisterModel(instance interface{}, defaultValues ...interface{})
RegisterModel register model @instance should be ptr instance @defaultValues should be ptr instance default value will create the instance and will not update .
func SetCasbinConfPath ¶ added in v0.0.35
func SetCasbinConfPath(path string)
SetCasbinConfPath set config path
func SetFuncGetWhoAmI ¶ added in v0.0.35
func SetFuncGetWhoAmI(f func(app application.Application, c *gin.Context, db *gorm.DB) (interface{}, error))
SetFuncGetWhoAmI set _funcToGetWhoAmI
func SetHealthCheckDefaultHandler ¶ added in v0.0.19
func SetHealthCheckDefaultHandler(handler func(app application.Application) func(c *gin.Context))
SetHealthCheckDefaultHandler set default health check handler
func SetIsLogSelfCheck ¶ added in v0.0.22
func SetIsLogSelfCheck(isLog bool)
SetIsLogSelfCheck set is log self check by default , it is true
func SetResponseFactory ¶ added in v0.0.37
SetResponseFactory set response factory
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application core of trinity
func (*Application) ContextPool ¶
func (app *Application) ContextPool() *application.ContextPool
ContextPool get contextpoo;
func (*Application) ControllerPool ¶
func (app *Application) ControllerPool() *application.ControllerPool
ControllerPool get all service pool
func (*Application) Enforcer ¶ added in v0.0.35
func (app *Application) Enforcer() *casbin.Enforcer
Enforcer get casbin enforcer instance
func (*Application) GetGRPCServer ¶
func (app *Application) GetGRPCServer() *grpc.Server
GetGRPCServer get grpc server instance
func (*Application) InitRouter ¶
func (app *Application) InitRouter()
InitRouter init router use gin framework by default
func (*Application) InstallDB ¶
func (app *Application) InstallDB(f func() *gorm.DB)
InstallDB install db
func (*Application) InstancePool ¶ added in v0.0.25
func (app *Application) InstancePool() *application.InstancePool
InstancePool get all service pool
func (*Application) IsLogSelfCheck ¶ added in v0.0.22
func (app *Application) IsLogSelfCheck() bool
IsLogSelfCheck if log self check
func (*Application) Keyword ¶ added in v0.0.37
func (app *Application) Keyword() keyword.Keyword
Keyword get key word list
func (*Application) RegRuntimeKey ¶
func (app *Application) RegRuntimeKey(runtime ...truntime.RuntimeKey) application.Application
RegRuntimeKey register runtime key the runtime key should be lower case , because when the metadata transfer , it will all transform to lower case
func (*Application) ResponseFactory ¶ added in v0.0.37
func (app *Application) ResponseFactory() func(status int, res interface{}, runtime map[string]string) interface{}
ResponseFactory get response factory
func (*Application) RuntimeKeys ¶
func (app *Application) RuntimeKeys() []truntime.RuntimeKey
RuntimeKeys get runtime keys
func (*Application) UseInterceptor ¶
func (app *Application) UseInterceptor(interceptor ...grpc.UnaryServerInterceptor) application.Application
UseInterceptor application use interceptor, only impact on http server
func (*Application) UseMiddleware ¶
func (app *Application) UseMiddleware(middleware ...gin.HandlerFunc) application.Application
UseMiddleware application use middleware , only impact on http server
Directories ¶
Path | Synopsis |
---|---|
* * @ Author: Daniel Tan * @ Date: 2020-04-07 09:41:11 * @ LastEditTime: 2020-07-29 19:03:26 * @ LastEditors: Daniel Tan * @ Description: * @ FilePath: /trinitygo/application/app.go * @
|
* * @ Author: Daniel Tan * @ Date: 2020-04-07 09:41:11 * @ LastEditTime: 2020-07-29 19:03:26 * @ LastEditors: Daniel Tan * @ Description: * @ FilePath: /trinitygo/application/app.go * @ |
example
|
|
interceptor
|
|
middleware
|
|
cmd
* @Author: Daniel TAN * @Description: * @Date: 2020-09-01 09:15:45 * @LastEditTime: 2021-01-22 16:53:33 * @LastEditors: Daniel TAN * @FilePath: /trinitygo/trinitygo/cmd/version.go
|
* @Author: Daniel TAN * @Description: * @Date: 2020-09-01 09:15:45 * @LastEditTime: 2021-01-22 16:53:33 * @LastEditors: Daniel TAN * @FilePath: /trinitygo/trinitygo/cmd/version.go |