Documentation
¶
Overview ¶
Copyright 2019 txn2
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package micro is a gin-gonic micro services wrapper.
Index ¶
Constants ¶
View Source
const ( HealthzDefaultUser = "healthz" HealthzDefaultPassword = "healthz" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientCfg ¶
type ClientCfg struct {
MaxIdleConnsPerHost int // 10 connections
DialContextTimeout int // 10 seconds
NetTimeout int // 10 seconds
ConTimeout int // 60 seconds
}
ClientCfg
type MappedMetricFamily ¶
type MappedMetricFamily map[string]*io_prometheus_client.MetricFamily
MappedMetricFamily
type PxyCfg ¶ added in v0.0.6
type PxyCfg struct {
Scheme *string // http, https
Host *string // elasticsearch:9200
Strip *string // /db
}
PxyCfg
type Server ¶
type Server struct {
Cfg *ServerCfg
Logger *zap.Logger
Router *gin.Engine
Client *Client
Token *token.Jwt
}
Server
func NewServer ¶
NewServer
serverCfg, _ := micro.NewServerCfg("Example")
server := micro.NewServer(serverCfg)
server.Router.GET("/test", func(c *gin.Context) {
})
server.Run()
func (*Server) ReverseProxy ¶ added in v0.0.6
func (srv *Server) ReverseProxy(cfg PxyCfg) gin.HandlerFunc
reverseProxy
Click to show internal directories.
Click to hide internal directories.