Back to

Package trinitygo

Latest Go to latest

The highest tagged major version is .

Published: Aug 17, 2020 | License: MIT | Module:


func DefaultGRPC

func DefaultGRPC() application.Application

DefaultGRPC default grpc server

func DefaultHTTP

func DefaultHTTP(args ...bool) application.Application

DefaultHTTP default http server

func EnableHealthCheckURL

func EnableHealthCheckURL(path ...string)

EnableHealthCheckURL set config path

func New

func New(args ...bool) application.Application

New new application

func RegisterController

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

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

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

func SetCasbinConfPath(path string)

SetCasbinConfPath set config path

func SetConfigPath

func SetConfigPath(path string)

SetConfigPath set config path

func SetFuncGetWhoAmI

func SetFuncGetWhoAmI(f func(app application.Application, c *gin.Context, db *gorm.DB) (interface{}, error))

SetFuncGetWhoAmI set _funcToGetWhoAmI

func SetHealthCheckDefaultHandler

func SetHealthCheckDefaultHandler(handler func(app application.Application) func(c *gin.Context))

SetHealthCheckDefaultHandler set default health check handler

func SetIsLogSelfCheck

func SetIsLogSelfCheck(isLog bool)

SetIsLogSelfCheck set is log self check by default , it is true

func SetKeyword

func SetKeyword(k keyword.Keyword)

SetKeyword set keywork list

func SetResponseFactory

func SetResponseFactory(f func(status int, res interface{}, runtime map[string]string) interface{})

SetResponseFactory set response factory

type Application

type Application struct {
	// contains filtered or unexported fields

Application core of trinity

func (*Application) Conf

func (app *Application) Conf() conf.Conf

Conf get conf

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) DB

func (app *Application) DB() *gorm.DB

DB get db

func (*Application) Enforcer

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) InitGRPC

func (app *Application) InitGRPC()

InitGRPC serve grpc

func (*Application) InitHTTP

func (app *Application) InitHTTP()

InitHTTP serve http

func (*Application) InitRouter

func (app *Application) InitRouter()

InitRouter init router use gin framework by default

func (*Application) InitTrinity

func (app *Application) InitTrinity()

InitTrinity serve grpc

func (*Application) InstallDB

func (app *Application) InstallDB(f func() *gorm.DB)

InstallDB install db

func (*Application) InstancePool

func (app *Application) InstancePool() *application.InstancePool

InstancePool get all service pool

func (*Application) IsLogSelfCheck

func (app *Application) IsLogSelfCheck() bool

IsLogSelfCheck if log self check

func (*Application) Keyword

func (app *Application) Keyword() keyword.Keyword

Keyword get key word list

func (*Application) Logger

func (app *Application) Logger() *golog.Logger

Logger get logger

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

func (app *Application) ResponseFactory() func(status int, res interface{}, runtime map[string]string) interface{}

ResponseFactory get response factory

func (*Application) Router

func (app *Application) Router() *gin.Engine

Router get router

func (*Application) RuntimeKeys

func (app *Application) RuntimeKeys() []truntime.RuntimeKey

RuntimeKeys get runtime keys

func (*Application) ServeGRPC

func (app *Application) ServeGRPC()

ServeGRPC serve grpc server

func (*Application) ServeHTTP

func (app *Application) ServeHTTP()

InitHTTP serve grpc

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier