mysql

package
v0.0.0-...-e67e6ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityType = "mysql"

	THING_PROPERTY_TYPE_INT32   = "int32"
	THING_PROPERTY_TYPE_FLOAT32 = "float"
	THING_PROPERTY_TYPE_FLOAT64 = "double"
	THING_PROPERTY_TYPE_ARRAY   = "array"
	THING_PROPERTY_TYPE_BOOL    = "bool"
	THING_PROPERTY_TYPE_ENUM    = "enum"
	THING_PROPERTY_TYPE_DATE    = "date"
	THING_PROPERTY_TYPE_STRUCT  = "struct"
	THING_PROPERTY_TYPE_STRING  = "string"
)
View Source
const (
	MYSQL_SSQL_TLP = `INSERT INTO %s.%s (%s) VALUES (%s)`
)

Variables

View Source
var (
	NewJSONContext = ruleql.NewJSONContext
	NewMapContext  = ruleql.NewMapContext
)
View Source
var (
	NewMessage        = utils.NewMessage
	Execute           = utils.Execute
	NewMessageContext = utils.NewMessageContext
)

Functions

func BuildValue

func BuildValue(key string, value interface{}) (interface{}, error)

func ToFloat32

func ToFloat32(val interface{}) (float32, error)

ToFloat64 coerce a value to a double/float64

func ToFloat64

func ToFloat64(val interface{}) (float64, error)

ToFloat64 coerce a value to a double/float64

func ToInt

func ToInt(val interface{}) (int, error)

ToInt coerce a value to an int

func ToInt32

func ToInt32(val interface{}) (int32, error)

ToInteger coerce a value to an integer

func ToInt64

func ToInt64(val interface{}) (int64, error)

ToInteger coerce a value to an integer

func ToString

func ToString(val interface{}) (string, error)

Types

type Data

type Data struct {
	Value interface{} `json:"value"`
	Time  int64       `json:"ts"`
}

type EvalContext

type EvalContext struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext(key string, rawJsonStr string, baseCtx ...ruleql.Context) *EvalContext

NewContext new context from json

func (*EvalContext) Call

func (this *EvalContext) Call(expr *ruleql.CallExpr, args []ruleql.Node) ruleql.Node

func (*EvalContext) Range

func (this *EvalContext) Range(expr string) []*EvalContext

func (*EvalContext) Range2

func (this *EvalContext) Range2(expr string) []*EvalContext

func (*EvalContext) Value

func (this *EvalContext) Value(key string) ruleql.Node

type Field

type Field struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type Fields

type Fields struct {
	// contains filtered or unexported fields
}

type Message

type Message struct {
	Data     map[string]*Data `json:"data"`
	DeviceId string           `json:"device_id"`
}

type Option

type Option struct {
	// Addrs     string `json:"addrs,omitempty"`
	Urls   []string         `json:"urls"`
	DbName string           `json:"dbName,omitempty"`
	Table  string           `json:"table,omitempty"`
	Fields map[string]Field `json:"fields,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL