Documentation
¶
Index ¶
- Constants
- func AnyToPointer[T any](data T) *T
- func Convert[T any](data []T, ...) error
- func FieldMapping[T any](key string, value *T, mapping map[string]any)
- func FloatDecimal(num float64, precision int) float64
- func FloatDecimalPtr(num *float64, precision int) *float64
- func Get[T any](value interface{}, def T) T
- func GetFloat32(value any, decimal ...int) float32
- func GetFloat32Ptr(value any, decimal ...int) *float32
- func GetFloat64(value any, decimal ...int) float64
- func GetFloat64Ptr(value any, decimal ...int) *float64
- func GetInt(value any) int
- func GetInt64(value any) int64
- func GetInt64Ptr(value any) *int64
- func GetIntPtr(value any) *int
- func GetPtr[T any](value interface{}) *T
- func GetString(value any) string
- func GetStringPtr(value any) *string
- func GetTime(value any) time.Time
- func GetTimePtr(value any) *time.Time
- func GetTimeString(timestamp int64) string
- func GetTimeStringFormat(timestamp int64, format string) string
- func GetTimeStringFormatPtr(timestamp *int64, format string) *string
- func InOr(where string, list []string) string
- func InRegex(list []string) string
- func NewPoint[T any](data []T, name string, batchPoint influxdb1.BatchPoints) error
- func Parser[T any](rows [][]any) []T
- func Round(num float64) int
- func SafetyMapping[T any](value *T, onCompute func(value T))
- func TagMapping(key string, value string, mapping map[string]string)
- func TryMapping[V any, M any](key string, value V, mapping map[string]M)
- func TryParser[T any](results []influxdb1.Result, onCompute func(element []any) T) []T
- type Params
- type Query
Constants ¶
View Source
const ( FnRaw = "raw" FnMean = "mean" FnLast = "last" FnFirst = "first" FnSum = "sum" FillPrevious = "previous" FillLinear = "linear" FillNone = "none" FillZero = "0" FillNull = "null" )
Variables ¶
This section is empty.
Functions ¶
func AnyToPointer ¶
func AnyToPointer[T any](data T) *T
func FieldMapping ¶ added in v1.0.3
func FloatDecimal ¶
func FloatDecimalPtr ¶ added in v1.2.1
func GetFloat32 ¶ added in v1.2.0
func GetFloat32Ptr ¶ added in v1.2.0
func GetFloat64 ¶
func GetFloat64Ptr ¶ added in v1.1.0
func GetInt64Ptr ¶ added in v1.1.0
func GetStringPtr ¶ added in v1.1.0
func GetTimePtr ¶ added in v1.1.0
func GetTimeString ¶
func GetTimeStringFormat ¶ added in v1.0.5
func GetTimeStringFormatPtr ¶ added in v1.2.1
func Parser ¶
Parser data to Struct How to use query := `
SELECT
time,
temperature,
humidity,
battery,
rssi,
code
FROM (
SELECT
mean(temperature) as temperature,
mean(humidity) as humidity,
mean(battery) as battery,
mean(rssi) as rssi
FROM minew_sensor_indoor
WHERE code =~ /A|B/ AND time >= now() and time <= now()
GROUP BY time(15m), code fill(previous) tz('Asia/Bangkok')
)`
values := [][]any{{"Timestamp", "Temperature", "Humidity", "Battery", "RSSI", "Code"}} values = append(values, response.Results[0].Series[0].Values...) sensors = influxx.Parser[MinewSensor](values)
func SafetyMapping ¶ added in v1.0.3
func SafetyMapping[T any](value *T, onCompute func(value T))
func TagMapping ¶ added in v1.0.3
Types ¶
Click to show internal directories.
Click to hide internal directories.