cj_hhdb_gosdk

package module
v0.0.0-...-d8e7e68 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 12 Imported by: 0

README

changjiang-iot-db-go-sdk

长江物联网存储时序库go语言sdk

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ResampleMode_name = map[int32]string{
		0: "kRmSuggest",
		1: "kRmBefore",
		2: "kRmAfter",
		3: "kRmInter",
		4: "kRmNone",
	}
	ResampleMode_value = map[string]int32{
		"kRmSuggest": 0,
		"kRmBefore":  1,
		"kRmAfter":   2,
		"kRmInter":   3,
		"kRmNone":    4,
	}
)

Enum value maps for ResampleMode.

View Source
var (
	RangeQueryMode_name = map[int32]string{
		0:  "kRqmAll",
		1:  "kRqmMax",
		2:  "kRqmMin",
		3:  "kRqmSum",
		4:  "kRqmAvg",
		5:  "kRqmWeightSum",
		6:  "kRqmWeightAvg",
		7:  "kRqmFirst",
		8:  "kRqmLast",
		9:  "kRqmTimeDiff",
		10: "kRqmLastDiff",
		11: "kRqmMaxDiff",
		12: "kRqmMse",
		13: "kRqmMode",
		14: "kRqmRate",
	}
	RangeQueryMode_value = map[string]int32{
		"kRqmAll":       0,
		"kRqmMax":       1,
		"kRqmMin":       2,
		"kRqmSum":       3,
		"kRqmAvg":       4,
		"kRqmWeightSum": 5,
		"kRqmWeightAvg": 6,
		"kRqmFirst":     7,
		"kRqmLast":      8,
		"kRqmTimeDiff":  9,
		"kRqmLastDiff":  10,
		"kRqmMaxDiff":   11,
		"kRqmMse":       12,
		"kRqmMode":      13,
		"kRqmRate":      14,
	}
)

Enum value maps for RangeQueryMode.

View Source
var (
	PointType_name = map[int32]string{
		0: "开关量",
		1: "模拟量",
		2: "打包点",
	}
	PointType_value = map[string]int32{
		"开关量": 0,
		"模拟量": 1,
		"打包点": 2,
	}
)

Enum value maps for PointType.

View Source
var (
	CompressMode_name = map[int32]string{
		0: "阈值压缩",
		1: "跳变压缩",
		2: "定时压缩",
		3: "有损压缩",
		4: "无损压缩",
	}
	CompressMode_value = map[string]int32{
		"阈值压缩": 0,
		"跳变压缩": 1,
		"定时压缩": 2,
		"有损压缩": 3,
		"无损压缩": 4,
	}
)

Enum value maps for CompressMode.

View Source
var (
	ValueType_name = map[int32]string{
		0:  "bool",
		1:  "float",
		2:  "double",
		3:  "char",
		4:  "byte",
		5:  "short",
		6:  "word",
		7:  "int",
		8:  "dword",
		9:  "long",
		10: "qword",
		11: "string",
		12: "bool array",
		13: "float array",
		14: "double array",
		15: "char array",
		16: "byte array",
		17: "short array",
		18: "word array",
		19: "int array",
		20: "dword array",
		21: "long array",
		22: "qword array",
		23: "string array",
	}
	ValueType_value = map[string]int32{
		"bool":         0,
		"float":        1,
		"double":       2,
		"char":         3,
		"byte":         4,
		"short":        5,
		"word":         6,
		"int":          7,
		"dword":        8,
		"long":         9,
		"qword":        10,
		"string":       11,
		"bool array":   12,
		"float array":  13,
		"double array": 14,
		"char array":   15,
		"byte array":   16,
		"short array":  17,
		"word array":   18,
		"int array":    19,
		"dword array":  20,
		"long array":   21,
		"qword array":  22,
		"string array": 23,
	}
)

Enum value maps for ValueType.

View Source
var (
	PointStatus_name = map[int32]string{
		0:   "kPsInit",
		1:   "kPsGood",
		10:  "kPsShowWarnning",
		11:  "kPsUncertain",
		12:  "kPsInavtive",
		13:  "kPsQualityIssue",
		14:  "kPsDataTypeMisMatch",
		15:  "kPsOutService",
		16:  "kPsOverRange",
		17:  "kPsUnderRange",
		100: "kPsShowError",
		101: "kPsNotFound",
		102: "kPsBad",
		106: "kPsDeviceFailure",
		107: "kPsSensorFailure",
		108: "kPsCommunFailure",
	}
	PointStatus_value = map[string]int32{
		"kPsInit":             0,
		"kPsGood":             1,
		"kPsShowWarnning":     10,
		"kPsUncertain":        11,
		"kPsInavtive":         12,
		"kPsQualityIssue":     13,
		"kPsDataTypeMisMatch": 14,
		"kPsOutService":       15,
		"kPsOverRange":        16,
		"kPsUnderRange":       17,
		"kPsShowError":        100,
		"kPsNotFound":         101,
		"kPsBad":              102,
		"kPsDeviceFailure":    106,
		"kPsSensorFailure":    107,
		"kPsCommunFailure":    108,
	}
)

Enum value maps for PointStatus.

View Source
var HHDB_CONNECT_ERR = errors.New("connect hhdb failed;")
View Source
var HHDB_LOSS_DB_CONNECT_PARAMS_ERR = errors.New("loss db connect params;")

Functions

This section is empty.

Types

type CompressMode

type CompressMode int32

压缩模式

const (
	CompressMode_kCmThreshold CompressMode = 0 //阈值压缩
	CompressMode_kCmLeap      CompressMode = 1 //跳变压缩
	CompressMode_kCmTime      CompressMode = 2 //定时压缩
	CompressMode_kCmLoss      CompressMode = 3 //有损压缩
	CompressMode_kCmNone      CompressMode = 4 //无损压缩
)

func (CompressMode) Enum

func (x CompressMode) Enum() *CompressMode

func (CompressMode) StrEnum

func (x CompressMode) StrEnum(str string) CompressMode

func (CompressMode) String

func (x CompressMode) String() string

type DbInfo

type DbInfo struct {
	Username string `json:"username"` //用户名
	Password string `json:"password"` //用户密码
	Url      string `json:"url"`      //连接信息127.0.0.1:6666
	DbName   string
}

type HhdbConPool

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

func NewHhdbConPool

func NewHhdbConPool() *HhdbConPool

func (*HhdbConPool) AddDbInfo

func (hhdb *HhdbConPool) AddDbInfo(info *DbInfo)

func (*HhdbConPool) ClearTable

func (hhdb *HhdbConPool) ClearTable(dbName string, TableId int32, TableName string) (int32, error)

func (*HhdbConPool) DelPoints

func (hhdb *HhdbConPool) DelPoints(dbName string, pointList *[]PointInfo) (int32, []int32, error)

func (*HhdbConPool) DeleteTable

func (hhdb *HhdbConPool) DeleteTable(dbName string, TableId int32, TableName string) (int32, error)

func (*HhdbConPool) InsertHisValueListByIdList

func (hhdb *HhdbConPool) InsertHisValueListByIdList(dbName string, pointIdList *[]int32, valueList *[][]PointValue) (*[]int32, error)

func (*HhdbConPool) InsertHisValueListByNameList

func (hhdb *HhdbConPool) InsertHisValueListByNameList(dbName string, pointNameList *[]string, valueList *[][]PointValue) (*[]int32, error)

func (*HhdbConPool) InsertPoints

func (hhdb *HhdbConPool) InsertPoints(dbName string, pointList *[]PointInfo) (int32, []int32, error)

func (*HhdbConPool) InsertTable

func (hhdb *HhdbConPool) InsertTable(dbName string, tableInfo TableInfo) (int32, error)

func (*HhdbConPool) QueryErrorCode

func (hhdb *HhdbConPool) QueryErrorCode(dbName string, errCodeList *[]int32) (*[]string, error)

func (*HhdbConPool) QueryHisRangeValueListReqByIdList

func (hhdb *HhdbConPool) QueryHisRangeValueListReqByIdList(dbName string, pointIdList *[]int32, startMs uint64, endMs uint64, mode RangeQueryMode) (*[][]PointValue, *[]int32, error)

func (*HhdbConPool) QueryHisRangeValueListReqByNameList

func (hhdb *HhdbConPool) QueryHisRangeValueListReqByNameList(dbName string, pointNameList *[]string, startMs uint64, endMs uint64, mode RangeQueryMode) (*[][]PointValue, *[]int32, error)

func (*HhdbConPool) QueryHisResampleValueListByIdList

func (hhdb *HhdbConPool) QueryHisResampleValueListByIdList(dbName string, pointIdList *[]int32, startMs uint64, endMs uint64, priodMs uint64, mode ResampleMode) (*[][]PointValue, *[]int32, error)

func (*HhdbConPool) QueryHisResampleValueListByNameList

func (hhdb *HhdbConPool) QueryHisResampleValueListByNameList(dbName string, pointNameList *[]string, startMs uint64, endMs uint64, priodMs uint64, mode ResampleMode) (*[][]PointValue, *[]int32, error)

func (*HhdbConPool) QueryHisTimePointValueListByIdList

func (hhdb *HhdbConPool) QueryHisTimePointValueListByIdList(dbName string, pointIdList *[]int32, msTimePoint uint64, mode ResampleMode) (*[]PointValue, *[]int32, error)

func (*HhdbConPool) QueryHisTimePointValueListByNameList

func (hhdb *HhdbConPool) QueryHisTimePointValueListByNameList(dbName string, pointNameList *[]string, msTimePoint uint64, mode ResampleMode) (*[]PointValue, *[]int32, error)

func (*HhdbConPool) QueryPointInfoListByID

func (hhdb *HhdbConPool) QueryPointInfoListByID(dbName string, pointIdList *[]int32) (*[]PointInfo, error)

func (*HhdbConPool) QueryPointInfoListByName

func (hhdb *HhdbConPool) QueryPointInfoListByName(dbName string, pointNameList *[]string) (*[]PointInfo, error)

func (*HhdbConPool) QueryPoints

func (hhdb *HhdbConPool) QueryPoints(dbName string, tableName string, pointSearchInfo *PointInfo, enablePage bool,
	page uint32, limit uint32) (list *[]PointInfo, total int32, err error)

func (*HhdbConPool) QueryRealtimeValueListByIdList

func (hhdb *HhdbConPool) QueryRealtimeValueListByIdList(dbName string, pointIdList *[]int32) (*[]PointValue, *[]int32, error)

func (*HhdbConPool) QueryTableList

func (hhdb *HhdbConPool) QueryTableList(dbName string, TableId int32, TableName string,
	enablePage bool, page uint32, limit uint32) (*[]TableInfo, error)

func (*HhdbConPool) SetDisconnectTimewait

func (hhdb *HhdbConPool) SetDisconnectTimewait(disconnectTimewait time.Duration)

func (*HhdbConPool) SetOuttime

func (hhdb *HhdbConPool) SetOuttime(outtimeSec time.Duration)

func (*HhdbConPool) UpdatePoints

func (hhdb *HhdbConPool) UpdatePoints(dbName string, pointList *[]PointInfo) (int32, []int32, error)

func (*HhdbConPool) UpdateRealtimeValueListByIdList

func (hhdb *HhdbConPool) UpdateRealtimeValueListByIdList(dbName string, pointIdList *[]int32, valueList *[]PointValue, useSysTime bool) (int32, *[]int32, error)

func (*HhdbConPool) UpdateRealtimeValueListByNameList

func (hhdb *HhdbConPool) UpdateRealtimeValueListByNameList(dbName string, pointNameList *[]string, valueList *[]PointValue, useSysTime bool) (int32, *[]int32, error)

func (*HhdbConPool) UpdateTable

func (hhdb *HhdbConPool) UpdateTable(dbName string, tableInfo *TableInfo) (int32, error)

type OperatorInfo

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

type PointInfo

type PointInfo struct {
	PointId        int32             `json:"pointId"`        //测点ID,为>=0的整数
	PointName      string            `json:"pointName"`      //测点名
	PointUnit      string            `json:"pointUnit"`      //测点单位
	PointDesc      string            `json:"pointDesc"`      //测点描述
	PointType      PointType         `json:"pointType"`      //测点类型
	WriteEnable    bool              `json:"writeEnable"`    //是否可写
	CheckEnable    bool              `json:"checkEnable"`    //是否进行值校验
	LowerThreshold float64           `json:"lowerThreshold"` //低限阈值
	UpperThreshold float64           `json:"upperThreshold"` //高限阈值
	ValueOffset    float64           `json:"valueOffset"`    //数据偏移量
	ValueRate      float64           `json:"valueRate"`      //数据倍率
	CompressMode   CompressMode      `json:"compressMode"`   //压缩模式
	CompressParam1 float64           `json:"compressParam1"` //压缩备用参数1
	CompressParam2 float64           `json:"compressParam2"` //压缩备用参数2
	OuttimeDay     int32             `json:"outtimeDay"`     //超时时间(单位:天)=0则不启用,>0为对应的超时时间,<0代表仅缓存实时数据不存储历史数据
	ValueType      ValueType         `json:"valueType"`      //测点值类型
	TableId        int32             `json:"tableId"`        //点组ID
	CreateTime     uint64            `json:"createTime"`     //测点创建时间
	ExtraField     map[string]string `json:"extraField"`     //自定义的拓展字段
}

测点全量信息

type PointStatus

type PointStatus int32
const (
	PointStatus_kPsInit             PointStatus = 0   //初始化0-9为好的状态
	PointStatus_kPsGood             PointStatus = 1   //正常,表示测点的值是有效的且在正常范围内。这是最常见的状态
	PointStatus_kPsShowWarnning     PointStatus = 10  //>=10为警告状态
	PointStatus_kPsUncertain        PointStatus = 11  //不确定,表示测点的值可能有效,但存在某种不确定性或不可靠性。这通常用于表示数据质量差、未知状态或临时问题。
	PointStatus_kPsInavtive         PointStatus = 12  //不活动,表示测点当前处于非活动状态,可能是因为设备已停用或者该测点当前不可用。
	PointStatus_kPsQualityIssue     PointStatus = 13  //数据质量问题,表示测点的数据存在质量问题,可能是由于噪声、干扰或其他原因导致的不准确性。
	PointStatus_kPsDataTypeMisMatch PointStatus = 14  //数据类型不匹配
	PointStatus_kPsOutService       PointStatus = 15  //停用,表示测点当前处于停用状态,通常是因为设备维护或其他原因。
	PointStatus_kPsOverRange        PointStatus = 16  //超出范围,表示测点的值超出了其正常范围,通常用于指示测点的测量值超出了可接受的上限。
	PointStatus_kPsUnderRange       PointStatus = 17  //低于范围,表示测点的值低于其正常范围,通常用于指示测点的测量值低于可接受的下限。
	PointStatus_kPsShowError        PointStatus = 100 //>=100为错误状态
	PointStatus_kPsNotFound         PointStatus = 101 //错误,表示测点的值无效或处于错误状态。
	PointStatus_kPsBad              PointStatus = 102 //错误,表示测点的值无效或处于错误状态。
	PointStatus_kPsDeviceFailure    PointStatus = 106 //设备故障,表示测点所关联的设备发生故障,无法提供有效的数据。
	PointStatus_kPsSensorFailure    PointStatus = 107 //传感器故障,表示与测点关联的传感器发生故障,导致无法获得有效的测量数据。
	PointStatus_kPsCommunFailure    PointStatus = 108 //通信故障,表示测点与数据源之间的通信故障,导致无法获取或更新数据。
)

func (PointStatus) Enum

func (x PointStatus) Enum() *PointStatus

func (PointStatus) StrEnum

func (x PointStatus) StrEnum(str string) PointStatus

func (PointStatus) String

func (x PointStatus) String() string

type PointType

type PointType int32

测点类型

const (
	PointType_kPtNone    PointType = -1 //无效类型
	PointType_kPtSwitch  PointType = 0  //开关量
	PointType_kPtAnalog  PointType = 1  //模拟量
	PointType_kPtPackage PointType = 2  //打包点
)

func (PointType) Enum

func (x PointType) Enum() *PointType

func (PointType) StrEnum

func (x PointType) StrEnum(str string) PointType

func (PointType) String

func (x PointType) String() string

type PointValue

type PointValue struct {
	Value  interface{} `json:"v"` //测点值
	Mstime uint64      `json:"t"` //测点值时间
	Status PointStatus `json:"s"` //测点值状态
}

type RangeQueryMode

type RangeQueryMode int32

时间段查询模式

const (
	RangeQueryMode_kRqmAll       RangeQueryMode = 0  //时间段内所有数据
	RangeQueryMode_kRqmMax       RangeQueryMode = 1  //时间段内最大值
	RangeQueryMode_kRqmMin       RangeQueryMode = 2  //时间段内最小值
	RangeQueryMode_kRqmSum       RangeQueryMode = 3  //时间段内和值
	RangeQueryMode_kRqmAvg       RangeQueryMode = 4  //时间段内平均值
	RangeQueryMode_kRqmWeightSum RangeQueryMode = 5  //时间段内加权和值
	RangeQueryMode_kRqmWeightAvg RangeQueryMode = 6  //时间段内加权平均值
	RangeQueryMode_kRqmFirst     RangeQueryMode = 7  //取第一个值
	RangeQueryMode_kRqmLast      RangeQueryMode = 8  //取最后一个值
	RangeQueryMode_kRqmTimeDiff  RangeQueryMode = 9  //取时间段内开始时间点数据-结束时间点数据,若时间点数据不存在则kResSuggest模式进行查询
	RangeQueryMode_kRqmLastDiff  RangeQueryMode = 10 //取时间段内第一条数据-最后一条数据差值
	RangeQueryMode_kRqmMaxDiff   RangeQueryMode = 11 //取时间段内最大值减最小值的差值
	RangeQueryMode_kRqmMse       RangeQueryMode = 12 //均方差
	RangeQueryMode_kRqmMode      RangeQueryMode = 13 //众数
	RangeQueryMode_kRqmRate      RangeQueryMode = 14 //增长率
)

func (RangeQueryMode) Enum

func (x RangeQueryMode) Enum() *RangeQueryMode

func (RangeQueryMode) String

func (x RangeQueryMode) String() string

type ResampleMode

type ResampleMode int32

降采样取值方式

const (
	ResampleMode_kRmSuggest ResampleMode = 0 //根据压缩方式自动推荐准确的取值模式
	ResampleMode_kRmBefore  ResampleMode = 1 //当前时间点有值,则取该值,无值则取时间点前的第一个值
	ResampleMode_kRmAfter   ResampleMode = 2 //当前时间点有值,则取该值,无值则取时间点后的第一个值
	ResampleMode_kRmInter   ResampleMode = 3 //当前时间点有值,则取该值,无值则取时间点前、后的第一个值后,线性运算得到时间点值
	ResampleMode_kRmNone    ResampleMode = 4 //当前时间点有值,则取该值,无值则返回默认值
)

func (ResampleMode) Enum

func (x ResampleMode) Enum() *ResampleMode

func (ResampleMode) String

func (x ResampleMode) String() string

type TableInfo

type TableInfo struct {
	TableId           int32             `json:"TableId"`           //表ID
	TableName         string            `json:"TableName"`         //表名
	ExtraFiledAndDesc map[string]string `json:"ExtraFiledAndDesc"` //额外的字段与字段名
	// contains filtered or unexported fields
}

type ValueType

type ValueType int32

数据值类型

const (
	ValueType_kVtBool      ValueType = 0  // true 或 false 的二进制值
	ValueType_kVtFloat     ValueType = 1  //32 位实数值浮点型 IEEE-754 标准定义
	ValueType_kVtDouble    ValueType = 2  //64 位实数值双精度 IEEE-754 标准定义
	ValueType_kVtChar      ValueType = 3  // 有符号的 8 位整数数据
	ValueType_kVtByte      ValueType = 4  //无符号的 8 位整数数据
	ValueType_kVtShort     ValueType = 5  //有符号的 16 位整数数据
	ValueType_kVtWord      ValueType = 6  //无符号的 16 位整数数据
	ValueType_kVtInt       ValueType = 7  //有符号的 32 位整数数据
	ValueType_kVtDword     ValueType = 8  // 无符号的 32 位整数数据
	ValueType_kVtLong      ValueType = 9  //有符号的 64 位整数数据
	ValueType_kVtQword     ValueType = 10 //无符号的 64 位整数数据
	ValueType_kVtString    ValueType = 11 //字符串
	ValueType_kVtBoolArr   ValueType = 12 //bool数组
	ValueType_kVtFloatArr  ValueType = 13 //32 位实数值浮点型数组
	ValueType_kVtDoubleArr ValueType = 14 //64 位实数值浮点型数组
	ValueType_kVtCharArr   ValueType = 15 //char数组
	ValueType_kVtByteArr   ValueType = 16 //byte数组
	ValueType_kVtShortArr  ValueType = 17 //short数组
	ValueType_kVtWordArr   ValueType = 18 //word数组
	ValueType_kVtIntArr    ValueType = 19 //有符号的 32 位整数数据数组
	ValueType_kVtDwordArr  ValueType = 20 //无符号的 32 位整数数据数组
	ValueType_kVtLongArr   ValueType = 21 //有符号的 64 位整数数据数组
	ValueType_kVtQwordArr  ValueType = 22 //无符号的 64 位整数数据数组
	ValueType_kVtStringArr ValueType = 23 //字符串数组
)

func (ValueType) Enum

func (x ValueType) Enum() *ValueType

func (ValueType) StrEnum

func (x ValueType) StrEnum(str string) ValueType

func (ValueType) String

func (x ValueType) String() string

Directories

Path Synopsis
hhdb
rpc

Jump to

Keyboard shortcuts

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