Documentation ¶
Index ¶
- Constants
- Variables
- func Byte2string(b []byte) string
- func Contains(leftList []interface{}, rightList []interface{}) bool
- func ConvertFeatures(features map[string]interface{}) map[string]*FeatureInfo
- func CostTime(start time.Time) int64
- func Equal(l interface{}, r interface{}) bool
- func EvalDate(expression string) (string, bool)
- func FormatDate(date time.Time, dateStyle string) string
- func GetClientIp() (string, error)
- func GetExperimentParamByPath(params model.LayerParams, path string, defaultValue interface{}) interface{}
- func GetTypeOf(value interface{}) string
- func GetValueByType(value interface{}, vtype string) interface{}
- func Greater(l interface{}, r interface{}) bool
- func GreaterEqual(l interface{}, r interface{}) bool
- func HashValue(hashKey string) uint64
- func In(l interface{}, r interface{}) bool
- func IndexOf(a []string, e string) int
- func IntContains(leftList []int, rightList []int) bool
- func IsDateExpression(expression string) bool
- func IsNil(i interface{}) bool
- func Less(l interface{}, r interface{}) bool
- func LessEqual(l interface{}, r interface{}) bool
- func Ln(n float64) float64
- func MaxInt(x, y int) int
- func Md5(msg string) string
- func MinInt(x, y int) int
- func MinInt64(x, y int64) int64
- func NotEqual(l interface{}, r interface{}) bool
- func Sigmoid(x float64) float64
- func String2byte(s string) (b []byte)
- func StringContains(leftList []string, rightList []string) bool
- func ToBool(i interface{}, defaultVal bool) bool
- func ToFloat(i interface{}, defaultVal float64) float64
- func ToInt(i interface{}, defaultVal int) int
- func ToInt64(i interface{}, defaultVal int64) int64
- func ToString(i interface{}, defaultVal string) string
- func UUID() string
- func UniqueStrings(strSlice []string) []string
- type Box
- type FeatureInfo
- type NestedMap
- func (nm *NestedMap) Delete(keys ...interface{}) error
- func (nm *NestedMap) Load(keys ...interface{}) (interface{}, error)
- func (nm *NestedMap) LoadOrStore(value interface{}, keys ...interface{}) (actual interface{}, loaded bool, err error)
- func (nm *NestedMap) Range(f func(keys []interface{}, value interface{}) bool, keys ...interface{}) error
- func (nm *NestedMap) Store(value interface{}, keys ...interface{}) error
Constants ¶
const ( BASE32 = "0123456789bcdefghjkmnpqrstuvwxyz" MAX_LATITUDE float64 = 90 MIN_LATITUDE float64 = -90 MAX_LONGITUDE float64 = 180 MIN_LONGITUDE float64 = -180 )
Variables ¶
var ( ErrNotBranch = errors.New("keys are not branch") // A node in the path specified by keys is not branch. ErrNotLeaf = errors.New("keys are not leaf") // A node in the path specified by keys is not leaf. ErrNotExist = errors.New("value is not exist") // No value is present )
Define error code for NestedMap.
Functions ¶
func ConvertFeatures ¶
func ConvertFeatures(features map[string]interface{}) map[string]*FeatureInfo
func GetClientIp ¶
func GetExperimentParamByPath ¶
func GetExperimentParamByPath(params model.LayerParams, path string, defaultValue interface{}) interface{}
func GetValueByType ¶
func GetValueByType(value interface{}, vtype string) interface{}
func GreaterEqual ¶
func GreaterEqual(l interface{}, r interface{}) bool
func IntContains ¶
func IsDateExpression ¶
func String2byte ¶
func StringContains ¶
func UniqueStrings ¶
Types ¶
type Box ¶
Box geohash的精度与其长度成正比 每个点的geohash值实际上代表了一个区域,这个区域的大小与geohash的精度成反比 坐标点的格式为(纬度,经度) 将这个区域用一个矩形表示
func GeoHashEncode ¶
GeoHashEncode 输入值:纬度,经度,精度(geohash的长度) 返回geohash, 以及该点所在的区域
type FeatureInfo ¶
type FeatureInfo struct { Value interface{} `json:"value"` Type string `json:"type"` }
type NestedMap ¶
NestedMap is is a map that can be nested infinitely, as shown below:
/->key1:value1 /->branch_map1 -->key2:value2
root_map \->key3:value3
\->branch_map2 -->branch_map3 -->key4:value4 \->key5:value5
NestedMap key type is ...interface{}, it can only be in the following formats: 1. "a", 2, "c" or, 2. [1, "b", 3] But it cannot be in the following format: 1. "a", ["b", "c"] or, 2. 1, [2, 3] or, 3. "a", [2, 3] or, 4. 1, ["b", "c"]
func (*NestedMap) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present.
func (*NestedMap) LoadOrStore ¶
func (nm *NestedMap) LoadOrStore(value interface{}, keys ...interface{}) (actual interface{}, loaded bool, err error)
LoadOrStore returns the existing value for the keys if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.