Documentation ¶
Index ¶
- Variables
- func HttpErrorHandler(ctx context.Context, mux *runtime.ServeMux, m runtime.Marshaler, ...)
- func HttpSuccHandler(ctx context.Context, w http.ResponseWriter, p proto.Message) error
- type ServerConfig
- func (t *ServerConfig) Gorm() *ServerConfig
- func (t *ServerConfig) GrpcGateway() *ServerConfig
- func (t *ServerConfig) Init() *ServerConfig
- func (t *ServerConfig) Redis() *ServerConfig
- func (t *ServerConfig) RunGrpc()
- func (t *ServerConfig) RunGrpcGateway(middleware ...func(next http.Handler) http.Handler)
- func (t *ServerConfig) Wait()
- type StandardResp
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func HttpErrorHandler ¶
func HttpSuccHandler ¶
Types ¶
type ServerConfig ¶
type ServerConfig struct { Path string //配置类型:file->本地配置文件;consul->consul配置中心 Type string //配置路径: 如./config/config_develop.yaml 或 http://192.168.3.91:8500 Token string //consul的token,type=file时为空 KvPath string //consul的远程key/value路径 RemoteType string //consul远程配置类型,如:yaml、json、hcl GrpcServer *grpc.Server GatewayService *http.Server GatewayConn *grpc.ClientConn GatewayMux *runtime.ServeMux Interceptors []grpc.ServerOption //拦截器 ServeMuxOption []runtime.ServeMuxOption }
func (*ServerConfig) GrpcGateway ¶
func (t *ServerConfig) GrpcGateway() *ServerConfig
GrpcGateway 初始化grpc-gateway(前提需要先开启grpc服务)
func (*ServerConfig) Init ¶
func (t *ServerConfig) Init() *ServerConfig
Init 初始化配置,包括:初始化gorm、redis、zap日志等等初始化行为
func (*ServerConfig) RunGrpcGateway ¶
func (t *ServerConfig) RunGrpcGateway(middleware ...func(next http.Handler) http.Handler)
RunGrpcGateway 开启并运行grpc-gateway服务(前提需要通过ServerConfig.GrpcGateway()进行初始化)
type StandardResp ¶
Click to show internal directories.
Click to hide internal directories.