common

package
v3.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxTaosSqlLen   = 1048576
	DefaultUser     = "root"
	DefaultPassword = "taosdata"
)
View Source
const (
	PrecisionMilliSecond = 0
	PrecisionMicroSecond = 1
	PrecisionNanoSecond  = 2
)
View Source
const (
	TSDB_OPTION_LOCALE = iota
	TSDB_OPTION_CHARSET
	TSDB_OPTION_TIMEZONE
	TSDB_OPTION_CONFIGDIR
	TSDB_OPTION_SHELL_ACTIVITY_TIMER
	TSDB_OPTION_USE_ADAPTER
)
View Source
const (
	TMQ_RES_INVALID    = -1
	TMQ_RES_DATA       = 1
	TMQ_RES_TABLE_META = 2
	TMQ_RES_METADATA   = 3
)
View Source
const (
	Int8Size    = unsafe.Sizeof(int8(0))
	Int16Size   = unsafe.Sizeof(int16(0))
	Int32Size   = unsafe.Sizeof(int32(0))
	Int64Size   = unsafe.Sizeof(int64(0))
	UInt8Size   = unsafe.Sizeof(uint8(0))
	UInt16Size  = unsafe.Sizeof(uint16(0))
	UInt32Size  = unsafe.Sizeof(uint32(0))
	UInt64Size  = unsafe.Sizeof(uint64(0))
	Float32Size = unsafe.Sizeof(float32(0))
	Float64Size = unsafe.Sizeof(float64(0))
)
View Source
const (
	TAOS_NOTIFY_PASSVER       = 0
	TAOS_NOTIFY_WHITELIST_VER = 1
	TAOS_NOTIFY_USER_DROPPED  = 2
)
View Source
const (
	TSDB_DATA_TYPE_NULL       = 0  // 1 bytes
	TSDB_DATA_TYPE_BOOL       = 1  // 1 bytes
	TSDB_DATA_TYPE_TINYINT    = 2  // 1 byte
	TSDB_DATA_TYPE_SMALLINT   = 3  // 2 bytes
	TSDB_DATA_TYPE_INT        = 4  // 4 bytes
	TSDB_DATA_TYPE_BIGINT     = 5  // 8 bytes
	TSDB_DATA_TYPE_FLOAT      = 6  // 4 bytes
	TSDB_DATA_TYPE_DOUBLE     = 7  // 8 bytes
	TSDB_DATA_TYPE_BINARY     = 8  // string
	TSDB_DATA_TYPE_TIMESTAMP  = 9  // 8 bytes
	TSDB_DATA_TYPE_NCHAR      = 10 // unicode string
	TSDB_DATA_TYPE_UTINYINT   = 11 // 1 byte
	TSDB_DATA_TYPE_USMALLINT  = 12 // 2 bytes
	TSDB_DATA_TYPE_UINT       = 13 // 4 bytes
	TSDB_DATA_TYPE_UBIGINT    = 14 // 8 bytes
	TSDB_DATA_TYPE_JSON       = 15
	TSDB_DATA_TYPE_VARBINARY  = 16
	TSDB_DATA_TYPE_DECIMAL    = 17
	TSDB_DATA_TYPE_BLOB       = 18
	TSDB_DATA_TYPE_MEDIUMBLOB = 19
	TSDB_DATA_TYPE_GEOMETRY   = 20
)
View Source
const (
	TSDB_DATA_TYPE_NULL_Str      = "NULL"
	TSDB_DATA_TYPE_BOOL_Str      = "BOOL"
	TSDB_DATA_TYPE_TINYINT_Str   = "TINYINT"
	TSDB_DATA_TYPE_SMALLINT_Str  = "SMALLINT"
	TSDB_DATA_TYPE_INT_Str       = "INT"
	TSDB_DATA_TYPE_BIGINT_Str    = "BIGINT"
	TSDB_DATA_TYPE_FLOAT_Str     = "FLOAT"
	TSDB_DATA_TYPE_DOUBLE_Str    = "DOUBLE"
	TSDB_DATA_TYPE_BINARY_Str    = "VARCHAR"
	TSDB_DATA_TYPE_TIMESTAMP_Str = "TIMESTAMP"
	TSDB_DATA_TYPE_NCHAR_Str     = "NCHAR"
	TSDB_DATA_TYPE_UTINYINT_Str  = "TINYINT UNSIGNED"
	TSDB_DATA_TYPE_USMALLINT_Str = "SMALLINT UNSIGNED"
	TSDB_DATA_TYPE_UINT_Str      = "INT UNSIGNED"
	TSDB_DATA_TYPE_UBIGINT_Str   = "BIGINT UNSIGNED"
	TSDB_DATA_TYPE_JSON_Str      = "JSON"
	TSDB_DATA_TYPE_VARBINARY_Str = "VARBINARY"
	TSDB_DATA_TYPE_GEOMETRY_Str  = "GEOMETRY"
)
View Source
const (
	BufferSize4M          = 4 * 1024 * 1024
	DefaultMessageTimeout = time.Minute * 5
	DefaultPongWait       = 60 * time.Second
	DefaultPingPeriod     = (60 * time.Second * 9) / 10
	DefaultWriteWait      = 10 * time.Second
)
View Source
const DefaultHttpPort = 6041
View Source
const ReqIDKey = "taos_req_id"
View Source
const (
	TAOS_CONN_MODE_BI = 0
)

Variables

View Source
var (
	NullInt8    = reflect.TypeOf(types.NullInt8{})
	NullInt16   = reflect.TypeOf(types.NullInt16{})
	NullInt32   = reflect.TypeOf(types.NullInt32{})
	NullInt64   = reflect.TypeOf(types.NullInt64{})
	NullUInt8   = reflect.TypeOf(types.NullUInt8{})
	NullUInt16  = reflect.TypeOf(types.NullUInt16{})
	NullUInt32  = reflect.TypeOf(types.NullUInt32{})
	NullUInt64  = reflect.TypeOf(types.NullUInt64{})
	NullFloat32 = reflect.TypeOf(types.NullFloat32{})
	NullFloat64 = reflect.TypeOf(types.NullFloat64{})
	NullTime    = reflect.TypeOf(types.NullTime{})
	NullBool    = reflect.TypeOf(types.NullBool{})
	NullString  = reflect.TypeOf(types.NullString{})
	Bytes       = reflect.TypeOf([]byte{})
	NullJson    = reflect.TypeOf(types.NullJson{})
	UnknownType = reflect.TypeOf(new(interface{})).Elem()
)
View Source
var BigIntType = DBType{
	ID:          TSDB_DATA_TYPE_BIGINT,
	Name:        TSDB_DATA_TYPE_BIGINT_Str,
	Length:      8,
	ReflectType: NullInt64,
	IsVarData:   false,
}
View Source
var BinaryType = DBType{
	ID:          TSDB_DATA_TYPE_BINARY,
	Name:        TSDB_DATA_TYPE_BINARY_Str,
	Length:      0,
	ReflectType: NullString,
	IsVarData:   true,
}
View Source
var BoolType = DBType{
	ID:          TSDB_DATA_TYPE_BOOL,
	Name:        TSDB_DATA_TYPE_BOOL_Str,
	Length:      1,
	ReflectType: NullBool,
	IsVarData:   false,
}
View Source
var ColumnTypeMap = map[int]reflect.Type{
	TSDB_DATA_TYPE_BOOL:      NullBool,
	TSDB_DATA_TYPE_TINYINT:   NullInt8,
	TSDB_DATA_TYPE_SMALLINT:  NullInt16,
	TSDB_DATA_TYPE_INT:       NullInt32,
	TSDB_DATA_TYPE_BIGINT:    NullInt64,
	TSDB_DATA_TYPE_UTINYINT:  NullUInt8,
	TSDB_DATA_TYPE_USMALLINT: NullUInt16,
	TSDB_DATA_TYPE_UINT:      NullUInt32,
	TSDB_DATA_TYPE_UBIGINT:   NullUInt64,
	TSDB_DATA_TYPE_FLOAT:     NullFloat32,
	TSDB_DATA_TYPE_DOUBLE:    NullFloat64,
	TSDB_DATA_TYPE_BINARY:    NullString,
	TSDB_DATA_TYPE_NCHAR:     NullString,
	TSDB_DATA_TYPE_TIMESTAMP: NullTime,
	TSDB_DATA_TYPE_JSON:      NullJson,
	TSDB_DATA_TYPE_VARBINARY: Bytes,
	TSDB_DATA_TYPE_GEOMETRY:  Bytes,
}
View Source
var DefaultDialer = websocket.Dialer{
	Proxy:            http.ProxyFromEnvironment,
	HandshakeTimeout: 45 * time.Second,
	ReadBufferSize:   BufferSize4M,
	WriteBufferSize:  BufferSize4M,
	WriteBufferPool:  &sync.Pool{},
}
View Source
var DoubleType = DBType{
	ID:          TSDB_DATA_TYPE_DOUBLE,
	Name:        TSDB_DATA_TYPE_DOUBLE_Str,
	Length:      8,
	ReflectType: NullFloat64,
	IsVarData:   false,
}
View Source
var FloatType = DBType{
	ID:          TSDB_DATA_TYPE_FLOAT,
	Name:        TSDB_DATA_TYPE_FLOAT_Str,
	Length:      4,
	ReflectType: NullFloat32,
	IsVarData:   false,
}
View Source
var GeometryType = DBType{
	ID:          TSDB_DATA_TYPE_GEOMETRY,
	Name:        TSDB_DATA_TYPE_GEOMETRY_Str,
	Length:      0,
	ReflectType: NullString,
	IsVarData:   true,
}
View Source
var IntType = DBType{
	ID:          TSDB_DATA_TYPE_INT,
	Name:        TSDB_DATA_TYPE_INT_Str,
	Length:      4,
	ReflectType: NullInt32,
	IsVarData:   false,
}
View Source
var JsonType = DBType{
	ID:          TSDB_DATA_TYPE_JSON,
	Name:        TSDB_DATA_TYPE_JSON_Str,
	Length:      0,
	ReflectType: NullJson,
	IsVarData:   true,
}
View Source
var NcharType = DBType{
	ID:          TSDB_DATA_TYPE_NCHAR,
	Name:        TSDB_DATA_TYPE_NCHAR_Str,
	Length:      0,
	ReflectType: NullString,
	IsVarData:   true,
}
View Source
var NullType = DBType{
	ID:          TSDB_DATA_TYPE_NULL,
	Name:        TSDB_DATA_TYPE_NULL_Str,
	Length:      0,
	ReflectType: UnknownType,
	IsVarData:   false,
}
View Source
var SmallIntType = DBType{
	ID:          TSDB_DATA_TYPE_SMALLINT,
	Name:        TSDB_DATA_TYPE_SMALLINT_Str,
	Length:      2,
	ReflectType: NullInt16,
	IsVarData:   false,
}
View Source
var TimestampType = DBType{
	ID:          TSDB_DATA_TYPE_TIMESTAMP,
	Name:        TSDB_DATA_TYPE_TIMESTAMP_Str,
	Length:      8,
	ReflectType: NullTime,
	IsVarData:   false,
}
View Source
var TinyIntType = DBType{
	ID:          TSDB_DATA_TYPE_TINYINT,
	Name:        TSDB_DATA_TYPE_TINYINT_Str,
	Length:      1,
	ReflectType: NullInt8,
	IsVarData:   false,
}
View Source
var TypeLengthMap = map[int]int{
	TSDB_DATA_TYPE_NULL:      1,
	TSDB_DATA_TYPE_BOOL:      1,
	TSDB_DATA_TYPE_TINYINT:   1,
	TSDB_DATA_TYPE_SMALLINT:  2,
	TSDB_DATA_TYPE_INT:       4,
	TSDB_DATA_TYPE_BIGINT:    8,
	TSDB_DATA_TYPE_FLOAT:     4,
	TSDB_DATA_TYPE_DOUBLE:    8,
	TSDB_DATA_TYPE_TIMESTAMP: 8,
	TSDB_DATA_TYPE_UTINYINT:  1,
	TSDB_DATA_TYPE_USMALLINT: 2,
	TSDB_DATA_TYPE_UINT:      4,
	TSDB_DATA_TYPE_UBIGINT:   8,
}
View Source
var UBigIntType = DBType{
	ID:          TSDB_DATA_TYPE_UBIGINT,
	Name:        TSDB_DATA_TYPE_UBIGINT_Str,
	Length:      8,
	ReflectType: NullUInt64,
	IsVarData:   false,
}
View Source
var UIntType = DBType{
	ID:          TSDB_DATA_TYPE_UINT,
	Name:        TSDB_DATA_TYPE_UINT_Str,
	Length:      4,
	ReflectType: NullUInt32,
	IsVarData:   false,
}
View Source
var USmallIntType = DBType{
	ID:          TSDB_DATA_TYPE_USMALLINT,
	Name:        TSDB_DATA_TYPE_USMALLINT_Str,
	Length:      2,
	ReflectType: NullUInt16,
	IsVarData:   false,
}
View Source
var UTinyIntType = DBType{
	ID:          TSDB_DATA_TYPE_UTINYINT,
	Name:        TSDB_DATA_TYPE_UTINYINT_Str,
	Length:      1,
	ReflectType: NullUInt8,
	IsVarData:   false,
}
View Source
var VarBinaryType = DBType{
	ID:          TSDB_DATA_TYPE_VARBINARY,
	Name:        TSDB_DATA_TYPE_VARBINARY_Str,
	Length:      0,
	ReflectType: NullString,
	IsVarData:   true,
}

Functions

func GetReqID

func GetReqID() int64

func InterpolateParams

func InterpolateParams(query string, args []driver.NamedValue) (string, error)

func TimeToTimestamp

func TimeToTimestamp(t time.Time, precision int) (timestamp int64)

func TimestampConvertToTime

func TimestampConvertToTime(timestamp int64, precision int) time.Time

func ValueArgsToNamedValueArgs

func ValueArgsToNamedValueArgs(args []driver.Value) (values []driver.NamedValue)

Types

type DBType

type DBType struct {
	IsVarData   bool
	ID          int
	Length      int
	Name        string
	ReflectType reflect.Type
}

type TDEngineRestfulResp

type TDEngineRestfulResp struct {
	Code      int
	Rows      int
	Desc      string
	ColNames  []string
	ColTypes  []int
	ColLength []int64
	Data      [][]driver.Value
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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