Documentation ¶
Overview ¶
* Tencent is pleased to support the open source community by making 蓝鲸 available. * Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * http://opensource.org/licenses/MIT * 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.
Index ¶
- func AddCommonFlags(cmdline *pflag.FlagSet) *bool
- func ArrayUnique(a interface{}) (ret []interface{})
- func CalSliceDiff(oldslice, newslice []string) (subs, plugs []string)
- func CalSliceInt64Diff(oldslice, newslice []int64) (subs, inter, plugs []int64)
- func CheckLen(sInput string, min, max int) bool
- func CloneHeader(src http.Header) http.Header
- func Contains(set []string, substr string) bool
- func ContainsAnyString(s string, subs ...string) bool
- func ContainsInt(set []int64, sub int64) bool
- func ContainsInt64(set []int64, sub int64) bool
- func ConvParamsTime(data interface{}) interface{}
- func ConverToInterfaceSlice(value interface{}) []interface{}
- func CopyHeader(src http.Header, target http.Header)
- func CopyMap(data map[string]interface{}, keys []string, ignores []string) map[string]interface{}
- func DecodeJSON(r io.Reader, v interface{}) ([]byte, error)
- func ExtractRequestIDFromContext(ctx context.Context) string
- func ExtractRequestUserFromContext(ctx context.Context) string
- func FileExists(name string) bool
- func FirstNotEmptyString(strs ...string) string
- func FormatPeriod(period string) (string, error)
- func GenerateRID() string
- func GetCurrentTimePtr() *time.Time
- func GetCurrentTimeStr() string
- func GetDBContext(parent context.Context, header http.Header) context.Context
- func GetDailAddress(URL string) (string, error)
- func GetFloat64ByInterface(a interface{}) (float64, error)
- func GetHTTPCCRequestID(header http.Header) string
- func GetHTTPCCTransaction(header http.Header) string
- func GetInt64ByInterface(a interface{}) (int64, error)
- func GetIntByInterface(a interface{}) (int, error)
- func GetLanguage(header http.Header) string
- func GetMapInterfaceByInerface(data interface{}) ([]interface{}, error)
- func GetOwnerID(header http.Header) string
- func GetStrByInterface(a interface{}) string
- func GetStrValsFromArrMapInterfaceByKey(arrI []interface{}, key string) []string
- func GetSupplierID(header http.Header) (int64, error)
- func GetTypeSensitiveUInt64(v interface{}) (uint64, bool)
- func GetUser(header http.Header) string
- func InArray(obj interface{}, target interface{}) bool
- func InStrArr(arr []string, key string) bool
- func InitFlags()
- func Int64Join(data []int64, separator string) string
- func IntArrIntersection(slice1 []int64, slice2 []int64) []int64
- func IntArrayUnique(a []int64) (ret []int64)
- func IsChar(sInput string) bool
- func IsDate(sInput string) bool
- func IsExistSupplierID(header http.Header) bool
- func IsInnerObject(objID string) bool
- func IsNil(value interface{}) bool
- func IsNumChar(sInput string) bool
- func IsStrProperty(propertyType string) bool
- func IsTime(sInput string) bool
- func IsTimeZone(sInput string) bool
- func MapMatch(src, tar interface{}) bool
- func NewCloserWrapper(r io.Reader, closeFunc func() error) io.ReadCloser
- func PeekRequest(req *http.Request) (content []byte, err error)
- func RemoveDuplicatesAndEmpty(slice []string) (ret []string)
- func SetModOwner(condition interface{}, ownerID string) map[string]interface{}
- func SetOwnerIDAndAccount(req *restful.Request)
- func SetQueryOwner(condition interface{}, ownerID string) map[string]interface{}
- func SliceStrToInt(sliceStr []string) ([]int, error)
- func SliceStrToInt64(sliceStr []string) ([]int64, error)
- func SplitStrField(str, sep string) []string
- func Str2Time(timeStr string) time.Time
- func StrArrDiff(slice1 []string, slice2 []string) []string
- func StrArrayUnique(a []string) (ret []string)
- func ValidPropertyOption(propertyType string, option interface{}, errProxy errors.DefaultCCErrorIf) error
- func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
- func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
- type AtomicBool
- type Int64Slice
- type MapBuiler
- type ParseInterface
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCommonFlags ¶
AddCommonFlags add common flags that is needed by all modules
func ArrayUnique ¶
func ArrayUnique(a interface{}) (ret []interface{})
func CalSliceDiff ¶
func CalSliceInt64Diff ¶
func ContainsAnyString ¶
func ContainsInt64 ¶
ContainsInt64 if int64 target in array
func ConvParamsTime ¶
func ConvParamsTime(data interface{}) interface{}
func ConverToInterfaceSlice ¶
func ConverToInterfaceSlice(value interface{}) []interface{}
func CopyHeader ¶
CopyHeader copy http header into target
func DecodeJSON ¶
DecodeJSON decode json to v and returns readed bytes
func FileExists ¶
func FirstNotEmptyString ¶
FirstNotEmptyString return the first string in slice strs that is not empty
func FormatPeriod ¶
00002H --> 2H 0000D/0M ---> ∞ empty string / ∞ ---> ∞ regexp matched: positive integer (include positive integer begin with more the one '0') + D/H/M/S eg. 0H, 000H, 0002H, 32M,34S... examples of no matched: 1.4H, -2H, +2H ...
func GenerateRID ¶
func GenerateRID() string
func GetCurrentTimePtr ¶
func GetCurrentTimeStr ¶
func GetCurrentTimeStr() string
func GetDBContext ¶
GetDBContext returns a new context that contains JoinOption
func GetDailAddress ¶
GetDailAddress returns the address for net.Dail
func GetFloat64ByInterface ¶
func GetHTTPCCRequestID ¶
GetHTTPCCRequestID return config center request id from http header
func GetHTTPCCTransaction ¶
GetHTTPCCTransaction return config center request id from http header
func GetInt64ByInterface ¶
func GetIntByInterface ¶
func GetLanguage ¶
func GetMapInterfaceByInerface ¶
func GetMapInterfaceByInerface(data interface{}) ([]interface{}, error)
func GetOwnerID ¶
func GetStrByInterface ¶
func GetStrByInterface(a interface{}) string
func GetStrValsFromArrMapInterfaceByKey ¶
GetStrValsFromArrMapInterfaceByKey get []string from []map[string]interface{}, Do not consider errors
func GetSupplierID ¶
GetSupplierID return supplier_id from http header
func GetTypeSensitiveUInt64 ¶
func IntArrIntersection ¶
func IntArrayUnique ¶
IntArrayUnique get unique int array
func IsExistSupplierID ¶
IsExistSupplierID check supplier_id exist from http header
func IsNil ¶
func IsNil(value interface{}) bool
IsNil returns whether value is nil value, including map[string]interface{}{nil}, *Struct{nil}
func MapMatch ¶
func MapMatch(src, tar interface{}) bool
MapMatch return whether src is partial match to tar, means src is smaller than tar
func NewCloserWrapper ¶
func NewCloserWrapper(r io.Reader, closeFunc func() error) io.ReadCloser
func SetModOwner ¶
SetModOwner set condition equal owner id, the condition must be a map or struct
func SetOwnerIDAndAccount ¶
func SetOwnerIDAndAccount(req *restful.Request)
set supplier id and account in head
func SetQueryOwner ¶
SetQueryOwner returns condition that in default ownerid and request ownerid
func SliceStrToInt ¶
SliceStrToInt: 将字符串切片转换为整型切片
func SliceStrToInt64 ¶
SliceStrToInt64 将字符串切片转换为整型切片
func SplitStrField ¶
SplitStrField split string field, remove empty string
func StrArrDiff ¶
func StrArrayUnique ¶
StrArrayUnique get unique string array
func ValidPropertyOption ¶
func ValidPropertyOption(propertyType string, option interface{}, errProxy errors.DefaultCCErrorIf) error
ValidPropertyOption valid property field option
func WarnWordSepNormalizeFunc ¶
func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
WarnWordSepNormalizeFunc changes and warns for flags that contain "_" separators
func WordSepNormalizeFunc ¶
func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName
WordSepNormalizeFunc changes all flags that contain "_" separators
Types ¶
type AtomicBool ¶
type AtomicBool int32
func NewBool ¶
func NewBool(yes bool) *AtomicBool
func (*AtomicBool) IsSet ¶
func (b *AtomicBool) IsSet() bool
func (*AtomicBool) Set ¶
func (b *AtomicBool) Set()
func (*AtomicBool) SetIfNotSet ¶
func (b *AtomicBool) SetIfNotSet() bool
func (*AtomicBool) SetTo ¶
func (b *AtomicBool) SetTo(yes bool)
func (*AtomicBool) UnSet ¶
func (b *AtomicBool) UnSet()
type Int64Slice ¶
type Int64Slice []int64
func (Int64Slice) Len ¶
func (p Int64Slice) Len() int
func (Int64Slice) Less ¶
func (p Int64Slice) Less(i, j int) bool
func (Int64Slice) Swap ¶
func (p Int64Slice) Swap(i, j int)
type MapBuiler ¶
type MapBuiler struct {
// contains filtered or unexported fields
}
func NewMapBuilder ¶
func NewMapBuilder(kvpairs ...interface{}) *MapBuiler
type ParseInterface ¶
type ParseInterface struct {
// contains filtered or unexported fields
}
ParseInterface parse interface use struct
func NewParseInterface ¶
func NewParseInterface(data interface{}) *ParseInterface
NewParseInterface return a struct
func (*ParseInterface) ArrayInterface ¶
func (p *ParseInterface) ArrayInterface() ([]interface{}, error)
ArrayInterface return interface val
func (*ParseInterface) Get ¶
func (p *ParseInterface) Get(key string) *ParseInterface
Get get key from interface to ParseInterface
func (*ParseInterface) Interface ¶
func (p *ParseInterface) Interface() (interface{}, error)
Interface return interface val
func (*ParseInterface) String ¶
func (p *ParseInterface) String() (string, error)
String return string val