Documentation ¶
Index ¶
- Constants
- func Elapse(f func()) int64
- func ElapseString(f func()) string
- func GetCurrentTimeFormat(format string) string
- func GetLocalIP() string
- func GetMonthDays(year, month int) int
- func GetTimeFormat(second int64, format string) string
- func GetTimestamp() int64
- func GetTimestampInMicro() int64
- func GetTimestampInMicroString() string
- func GetTimestampInMilli() int64
- func GetTimestampInMilliString() string
- func GetTimestampString() string
- func HealthcheckHandler(w http.ResponseWriter, r *http.Request)
- func HeartbeatForRegistry(lbHost, svrHost, hcURL string, uriPath []string) error
- func IsLeapYear(year int) bool
- func NewMultipleHostsReverseProxy(targets []*url.URL, transport *http.Transport) *httputil.ReverseProxy
- func SetStructField(obj interface{}, name string, value interface{}) error
- func WriteHTTPResponseAsJson(w http.ResponseWriter, data interface{}) error
- type CommonResp
- type LBPolicyEnum
- type LogLevelEnum
Constants ¶
View Source
const ( REG_WORKER_OK = 0 REG_WORKER_FAILED = -1 HEARTBEAT_INTERVAL = 3 )
View Source
const ( DATE_TIME_FMT = "2006-01-02 15:04:05" DATE_FMT = "2006-01-02" TIME_FMT = "15:04:05" DATE_TIME_FMT_CN = "2006年01月02日 15时04分05秒" DATE_FMT_CN = "2006年01月02日" TIME_FMT_CN = "15时04分05秒" )
FMT_TYPE_NOMAL
View Source
const SecondInNano = 1000 * 1000 * 1000
Variables ¶
This section is empty.
Functions ¶
func ElapseString ¶
func ElapseString(f func()) string
Timing the cost of function call, unix nano was returned
func GetLocalIP ¶
func GetLocalIP() string
func GetMonthDays ¶
GetMonthDays return days of the month/year
func GetTimeFormat ¶
func GetTimestampInMilliString ¶
func GetTimestampInMilliString() string
return 1441007112776 in millisecond
func HealthcheckHandler ¶
func HealthcheckHandler(w http.ResponseWriter, r *http.Request)
HealthcheckHandler for healthcheck
func HeartbeatForRegistry ¶
HeartbeatForRegistry HeartbeatForRegistry
func NewMultipleHostsReverseProxy ¶
func NewMultipleHostsReverseProxy(targets []*url.URL, transport *http.Transport) *httputil.ReverseProxy
NewMultipleHostsReverseProxy creates reverse proxy instance, the parameter `transport` can be nil, which is used to replace the default one
func SetStructField ¶
func WriteHTTPResponseAsJson ¶
func WriteHTTPResponseAsJson(w http.ResponseWriter, data interface{}) error
WriteHTTPResponseAsJson write json-data to client
Types ¶
type CommonResp ¶
type LBPolicyEnum ¶
type LBPolicyEnum int
const ( LB_RANDOM LBPolicyEnum LB_ROUNDROBIN LB_FASTRESP )
type LogLevelEnum ¶
type LogLevelEnum int
const ( LOG_DEBUG LogLevelEnum LOG_INFO LOG_WARN LOG_ERROR )
Click to show internal directories.
Click to hide internal directories.