Documentation ¶
Index ¶
- Constants
- func ConvertArray(s []interface{}) []interface{}
- func ConvertDuration(s any) (time.Duration, error)
- func ConvertMap(s map[interface{}]interface{}) map[string]interface{}
- func ConvertSlice(v interface{}) []interface{}
- func ConvertToInterfaceArr(orig map[string]interface{}) map[string]interface{}
- func FormatTime(time time.Time, f string) (string, error)
- func GetConfiguredTimeZone() *time.Location
- func InterfaceToDuration(i interface{}) (time.Duration, error)
- func InterfaceToTime(i interface{}, format string) (time.Time, error)
- func InterfaceToUnixMilli(i interface{}, format string) (int64, error)
- func JoinHostPortInt(host string, port int) string
- func MapToStruct(input, output interface{}) error
- func MapToStructStrict(input, output interface{}) error
- func MapToSyncMap(m map[string]interface{}) *sync.Map
- func ParseTime(t string, f string) (_ time.Time, err error)
- func ParseTimeByFormats(t string, formats []string) (_ time.Time, err error)
- func SetTimeZone(name string) error
- func StringToBytes(str string) []byte
- func SyncMapToMap(sm *sync.Map) map[string]interface{}
- func TimeFromUnixMilli(t int64) time.Time
- func TimeToUnixMilli(time time.Time) int64
- func ToBool(input interface{}, sn Strictness) (bool, error)
- func ToBoolSlice(input interface{}, sn Strictness) ([]bool, error)
- func ToByteA(input interface{}, sn Strictness) ([]byte, error)
- func ToBytes(input interface{}, sn Strictness) ([]byte, error)
- func ToBytesSlice(input interface{}, sn Strictness) ([][]byte, error)
- func ToFloat32(input interface{}, sn Strictness) (float32, error)
- func ToFloat32Slice(input interface{}, sn Strictness) ([]float32, error)
- func ToFloat64(input interface{}, sn Strictness) (float64, error)
- func ToFloat64Slice(input interface{}, sn Strictness, anc ArrayNilConvert) ([]float64, error)
- func ToInt(input interface{}, sn Strictness) (int, error)
- func ToInt16(input interface{}, sn Strictness) (int16, error)
- func ToInt32(input interface{}, sn Strictness) (int32, error)
- func ToInt64(input interface{}, sn Strictness) (int64, error)
- func ToInt64Slice(input interface{}, sn Strictness) ([]int64, error)
- func ToInt8(input interface{}, sn Strictness) (int8, error)
- func ToString(input interface{}, sn Strictness) (string, error)
- func ToStringAlways(input interface{}) string
- func ToStringMap(input interface{}) (map[string]interface{}, error)
- func ToStringSlice(input interface{}, sn Strictness) ([]string, error)
- func ToTimeDurationHookFunc() mapstructure.DecodeHookFunc
- func ToType(value interface{}, newType interface{}) (interface{}, bool)
- func ToTypedSlice(input interface{}, conv func(interface{}, Strictness) (interface{}, error), ...) (interface{}, error)
- func ToUint16(i interface{}, sn Strictness) (uint16, error)
- func ToUint32(i interface{}, sn Strictness) (uint32, error)
- func ToUint64(i interface{}, sn Strictness) (uint64, error)
- func ToUint64Slice(input interface{}, sn Strictness) ([]uint64, error)
- func ToUint8(i interface{}, sn Strictness) (uint8, error)
- type ArrayNilConvert
- type DurationConf
- type Strictness
Constants ¶
View Source
const ( JSISO = "2006-01-02T15:04:05.000Z07:00" ISO8601 = "2006-01-02T15:04:05" )
Variables ¶
This section is empty.
Functions ¶
func ConvertArray ¶
func ConvertArray(s []interface{}) []interface{}
func ConvertMap ¶
func ConvertMap(s map[interface{}]interface{}) map[string]interface{}
func ConvertSlice ¶
func ConvertSlice(v interface{}) []interface{}
func ConvertToInterfaceArr ¶
func GetConfiguredTimeZone ¶
func InterfaceToDuration ¶
InterfaceToDuration converts an interface to a time.Duration.
func InterfaceToUnixMilli ¶
func JoinHostPortInt ¶
func MapToStruct ¶
func MapToStruct(input, output interface{}) error
MapToStruct
* Convert a map into a struct. The output parameter must be a pointer to a struct * The struct can have the json metadata
func MapToStructStrict ¶
func MapToStructStrict(input, output interface{}) error
MapToStructStrict
* Convert a map into a struct. The output parameter must be a pointer to a struct * If the input have key/value pair output do not defined, will report error
func MapToSyncMap ¶
func ParseTimeByFormats ¶
func SetTimeZone ¶
func StringToBytes ¶
func SyncMapToMap ¶
func TimeFromUnixMilli ¶
func TimeToUnixMilli ¶
func ToBool ¶
func ToBool(input interface{}, sn Strictness) (bool, error)
func ToBoolSlice ¶
func ToBoolSlice(input interface{}, sn Strictness) ([]bool, error)
func ToByteA ¶
func ToByteA(input interface{}, sn Strictness) ([]byte, error)
ToByteA converts to eKuiper internal byte array
func ToBytes ¶
func ToBytes(input interface{}, sn Strictness) ([]byte, error)
func ToBytesSlice ¶
func ToBytesSlice(input interface{}, sn Strictness) ([][]byte, error)
func ToFloat32 ¶
func ToFloat32(input interface{}, sn Strictness) (float32, error)
func ToFloat32Slice ¶
func ToFloat32Slice(input interface{}, sn Strictness) ([]float32, error)
func ToFloat64 ¶
func ToFloat64(input interface{}, sn Strictness) (float64, error)
func ToFloat64Slice ¶
func ToFloat64Slice(input interface{}, sn Strictness, anc ArrayNilConvert) ([]float64, error)
func ToInt ¶
func ToInt(input interface{}, sn Strictness) (int, error)
func ToInt16 ¶
func ToInt16(input interface{}, sn Strictness) (int16, error)
func ToInt32 ¶
func ToInt32(input interface{}, sn Strictness) (int32, error)
func ToInt64 ¶
func ToInt64(input interface{}, sn Strictness) (int64, error)
func ToInt64Slice ¶
func ToInt64Slice(input interface{}, sn Strictness) ([]int64, error)
func ToInt8 ¶
func ToInt8(input interface{}, sn Strictness) (int8, error)
func ToString ¶
func ToString(input interface{}, sn Strictness) (string, error)
func ToStringMap ¶
func ToStringSlice ¶
func ToStringSlice(input interface{}, sn Strictness) ([]string, error)
func ToTimeDurationHookFunc ¶
func ToTimeDurationHookFunc() mapstructure.DecodeHookFunc
func ToType ¶
func ToType(value interface{}, newType interface{}) (interface{}, bool)
ToType cast value into newType type newType support bigint, float, string, boolean, datetime, bytea
func ToTypedSlice ¶
func ToTypedSlice(input interface{}, conv func(interface{}, Strictness) (interface{}, error), eleType string, sn Strictness) (interface{}, error)
func ToUint16 ¶
func ToUint16(i interface{}, sn Strictness) (uint16, error)
func ToUint32 ¶
func ToUint32(i interface{}, sn Strictness) (uint32, error)
func ToUint64 ¶
func ToUint64(i interface{}, sn Strictness) (uint64, error)
func ToUint64Slice ¶
func ToUint64Slice(input interface{}, sn Strictness) ([]uint64, error)
func ToUint8 ¶
func ToUint8(i interface{}, sn Strictness) (uint8, error)
Types ¶
type ArrayNilConvert ¶
type ArrayNilConvert int8
const ( IGNORE_NIL ArrayNilConvert = iota FORCE_CONVERT )
type DurationConf ¶
func (DurationConf) MarshalJSON ¶
func (d DurationConf) MarshalJSON() ([]byte, error)
func (DurationConf) MarshalYAML ¶
func (d DurationConf) MarshalYAML() (any, error)
func (*DurationConf) UnmarshalJSON ¶
func (dp *DurationConf) UnmarshalJSON(data []byte) error
func (*DurationConf) UnmarshalYAML ¶
func (dp *DurationConf) UnmarshalYAML(unmarshal func(any) error) error
type Strictness ¶
type Strictness int8
const ( STRICT Strictness = iota CONVERT_SAMEKIND CONVERT_ALL )
Click to show internal directories.
Click to hide internal directories.