Documentation
¶
Index ¶
- Constants
- func BytesToStringWithNoCopy(bytes []byte) string
- func CloneContext(ctx context.Context) context.Context
- func FileLastName(file string) string
- func FormatFuncName(f string) string
- func FromContext(ctx context.Context, key string) interface{}
- func FromDomainProject(domainProject string) (domain, project string)
- func FromMetadata(ctx context.Context, key string) string
- func FuncName(f interface{}) string
- func GenerateUUID() string
- func GetCaller(skip int) (string, string, int, bool)
- func GetEnvInt(name string, def int) int
- func GetEnvString(name string, def string) string
- func GetIPFromContext(ctx context.Context) string
- func GetProcCPUUsage() (pt float64, ct float64)
- func GetRealIP(r *http.Request) string
- func HostName() (hostname string)
- func InetAton(ip string) (ipnr uint32)
- func InetNtoIP(ipnr uint32) net.IP
- func InetNtoa(ipnr uint32) string
- func Int16ToInt64(bs []int16) (in int64)
- func IsBigEndian() bool
- func IsLittleEndian() bool
- func IsVersionOrHealthPattern(pattern string) bool
- func ListToMap(list []string) map[string]struct{}
- func MapToList(dict map[string]struct{}) []string
- func ParseDomain(ctx context.Context) string
- func ParseDomainProject(ctx context.Context) string
- func ParseEndpoint(ep string) (string, error)
- func ParseProject(ctx context.Context) string
- func ParseRequestURL(r *http.Request) string
- func ParseTargetDomain(ctx context.Context) string
- func ParseTargetDomainProject(ctx context.Context) string
- func ParseTargetProject(ctx context.Context) string
- func PathExist(path string) bool
- func ResetTimer(timer *time.Timer, d time.Duration)
- func SafeCloseChan(c chan struct{})
- func SetContext(ctx context.Context, key string, val interface{}) context.Context
- func SetDomain(ctx context.Context, domain string) context.Context
- func SetDomainProject(ctx context.Context, domain string, project string) context.Context
- func SetProject(ctx context.Context, project string) context.Context
- func SetRequestContext(r *http.Request, key string, val interface{}) *http.Request
- func SetTargetDomain(ctx context.Context, domain string) context.Context
- func SetTargetDomainProject(ctx context.Context, domain string, project string) context.Context
- func SetTargetProject(ctx context.Context, project string) context.Context
- func Sizeof(obj interface{}) uint64
- func SliceHave(arr []string, str string) bool
- func StringJoin(args []string, sep string) string
- func StringTRUE(s string) bool
- func StringToBytesWithNoCopy(s string) []byte
- func ToDomainProject(domain, project string) (domainProject string)
- type ConcurrentMap
- func (cm *ConcurrentMap) Clear()
- func (cm *ConcurrentMap) Fetch(key interface{}, f func() (interface{}, error)) (v interface{}, err error)
- func (cm *ConcurrentMap) ForEach(f func(item MapItem) (next bool))
- func (cm *ConcurrentMap) Get(key interface{}) (val interface{}, b bool)
- func (cm *ConcurrentMap) Put(key, val interface{})
- func (cm *ConcurrentMap) PutIfAbsent(key, val interface{}) (exist interface{})
- func (cm *ConcurrentMap) Remove(key interface{})
- func (cm *ConcurrentMap) Size() (s int)
- type IPPort
- type JSONObject
- type MapItem
- type Node
- type ReflectObject
- type Reflector
- type StringContext
- type Tree
Constants ¶
View Source
const ( HeaderRev = "X-Resource-Revision" CtxGlobal = "global" CtxNocache = "noCache" CtxCacheOnly = "cacheOnly" CtxRequestRevision = "requestRev" CtxResponseRevision = "responseRev" )
View Source
const ( CtxDomain = "domain" CtxProject = "project" CtxTargetDomain = "target-domain" CtxTargetProject = "target-project" )
View Source
const DASH = "-"
Variables ¶
This section is empty.
Functions ¶
func BytesToStringWithNoCopy ¶
func FileLastName ¶
func FormatFuncName ¶
func FromContext ¶
func FromDomainProject ¶
func GenerateUUID ¶
func GenerateUUID() string
func GetEnvString ¶
func GetIPFromContext ¶
func GetProcCPUUsage ¶
func Int16ToInt64 ¶
func IsBigEndian ¶
func IsBigEndian() bool
func IsLittleEndian ¶
func IsLittleEndian() bool
func ParseDomain ¶
func ParseDomainProject ¶
func ParseEndpoint ¶
func ParseProject ¶
func ParseRequestURL ¶
func ParseTargetDomain ¶
func ParseTargetProject ¶
func ResetTimer ¶
do not call after drain timer.C channel
func SafeCloseChan ¶
func SafeCloseChan(c chan struct{})
func SetDomainProject ¶
func SetRequestContext ¶
func SetTargetDomainProject ¶
func StringJoin ¶
func StringTRUE ¶
func StringToBytesWithNoCopy ¶
func ToDomainProject ¶
Types ¶
type ConcurrentMap ¶
type ConcurrentMap struct {
// contains filtered or unexported fields
}
func NewConcurrentMap ¶
func NewConcurrentMap(_ int) *ConcurrentMap
func (*ConcurrentMap) Clear ¶
func (cm *ConcurrentMap) Clear()
func (*ConcurrentMap) Fetch ¶
func (cm *ConcurrentMap) Fetch(key interface{}, f func() (interface{}, error)) (v interface{}, err error)
func (*ConcurrentMap) ForEach ¶
func (cm *ConcurrentMap) ForEach(f func(item MapItem) (next bool))
func (*ConcurrentMap) Get ¶
func (cm *ConcurrentMap) Get(key interface{}) (val interface{}, b bool)
func (*ConcurrentMap) Put ¶
func (cm *ConcurrentMap) Put(key, val interface{})
func (*ConcurrentMap) PutIfAbsent ¶
func (cm *ConcurrentMap) PutIfAbsent(key, val interface{}) (exist interface{})
func (*ConcurrentMap) Remove ¶
func (cm *ConcurrentMap) Remove(key interface{})
func (*ConcurrentMap) Size ¶
func (cm *ConcurrentMap) Size() (s int)
type IPPort ¶
func ParseIPPort ¶
type JSONObject ¶
type JSONObject map[string]interface{}
func NewJSONObject ¶
func NewJSONObject() JSONObject
func (JSONObject) Bool ¶
func (c JSONObject) Bool(k interface{}, def bool) bool
func (JSONObject) Int ¶
func (c JSONObject) Int(k interface{}, def int) int
func (JSONObject) Object ¶
func (c JSONObject) Object(k interface{}) JSONObject
func (JSONObject) Set ¶
func (c JSONObject) Set(k interface{}, v interface{}) JSONObject
func (JSONObject) String ¶
func (c JSONObject) String(k interface{}, def string) string
type ReflectObject ¶
type ReflectObject struct { // full name FullName string Type reflect.Type // if type is not struct, Fields is nil Fields []reflect.StructField }
func Reflect ¶
func Reflect(obj interface{}) *ReflectObject
func (*ReflectObject) Name ¶
func (o *ReflectObject) Name() string
Name returns a short name of the object type
type Reflector ¶
type Reflector struct {
// contains filtered or unexported fields
}
func (*Reflector) Load ¶
func (r *Reflector) Load(obj interface{}) *ReflectObject
type StringContext ¶
type StringContext struct {
// contains filtered or unexported fields
}
func NewStringContext ¶
func NewStringContext(ctx context.Context) *StringContext
func (*StringContext) Done ¶
func (c *StringContext) Done() <-chan struct{}
func (*StringContext) Err ¶
func (c *StringContext) Err() error
func (*StringContext) SetKV ¶
func (c *StringContext) SetKV(key string, val interface{})
func (*StringContext) Value ¶
func (c *StringContext) Value(key interface{}) interface{}
Click to show internal directories.
Click to hide internal directories.