Documentation
¶
Index ¶
- Constants
- Variables
- func GetGroupProperty(groupNames ...string) (map[string]GroupProperty, error)
- func GetItems(itemInfo ItemInfo) ([]map[string]string, error)
- type AddGroupColumnInfo
- type AddGroupInfo
- type AddItemInfo
- type BatchWriteString
- type Cols
- type ColumnNameError
- type DeadZone
- type DeletedGroupColumnInfo
- type DeletedGroupInfo
- type DeletedHistoricalDataInfo
- type ExcelError
- type Gdb
- func (gdb *Gdb) AddCalcItemHandler(c *gin.Context)
- func (gdb *Gdb) AddGroupColumnsHandler(c *gin.Context)
- func (gdb *Gdb) AddGroupsHandler(c *gin.Context)
- func (gdb *Gdb) AddItems(itemInfo AddItemInfo) (Rows, error)
- func (gdb *Gdb) AddItemsHandler(c *gin.Context)
- func (gdb *Gdb) BatchWrite(kv [][]string, withTimeStamp bool) (Rows, error)
- func (gdb *Gdb) BatchWriteHandler(c *gin.Context)
- func (gdb *Gdb) Calc() error
- func (gdb *Gdb) DeleteCalculationItemHandler(c *gin.Context)
- func (gdb *Gdb) DeleteGroupColumnsHandler(c *gin.Context)
- func (gdb *Gdb) DeleteGroupsHandler(c *gin.Context)
- func (gdb *Gdb) DeleteHistoricalData(itemNames []string, timeStamps []TimeStamp) (Rows, error)
- func (gdb *Gdb) DeleteHistoricalDataHandler(c *gin.Context)
- func (gdb *Gdb) DeleteItems(itemInfo ItemInfo) (Rows, error)
- func (gdb *Gdb) DeleteItemsHandler(c *gin.Context)
- func (gdb *Gdb) GetCalcItemHandler(c *gin.Context)
- func (gdb *Gdb) GetDbInfoHandler(c *gin.Context)
- func (gdb *Gdb) GetDbSpeedHistoryHandler(c *gin.Context)
- func (gdb *Gdb) GetGroupPropertyHandler(c *gin.Context)
- func (gdb *Gdb) GetGroupsHandler(c *gin.Context)
- func (gdb *Gdb) GetHistoricalData(itemNames []string, startTimeStamps []int, endTimeStamps []int, ...) (cmap.ConcurrentMap, error)
- func (gdb *Gdb) GetHistoricalDataHandler(c *gin.Context)
- func (gdb *Gdb) GetHistoricalDataWithCondition(itemNames []string, startTime []int, endTime []int, intervals []int, ...) (cmap.ConcurrentMap, error)
- func (gdb *Gdb) GetHistoricalDataWithConditionHandler(c *gin.Context)
- func (gdb *Gdb) GetHistoricalDataWithStamp(itemNames []string, timeStamps ...string) (cmap.ConcurrentMap, error)
- func (gdb *Gdb) GetHistoricalDataWithStampHandler(c *gin.Context)
- func (gdb *Gdb) GetItemsHandler(c *gin.Context)
- func (gdb *Gdb) GetJsCodeHandler(c *gin.Context)
- func (gdb *Gdb) GetLogsHandler(c *gin.Context)
- func (gdb *Gdb) GetProcessInfo() error
- func (gdb *Gdb) GetRealTimeData(itemNames ...string) (cmap.ConcurrentMap, error)
- func (gdb *Gdb) GetRealTimeDataHandler(c *gin.Context)
- func (gdb *Gdb) HandleAddItemsByExcel(c *gin.Context)
- func (gdb *Gdb) HandleGetItemsWithCount(c *gin.Context)
- func (gdb *Gdb) HandleGetUerInfo(c *gin.Context)
- func (gdb *Gdb) HandleUploadFile(c *gin.Context)
- func (gdb *Gdb) HandleUserLogin(c *gin.Context)
- func (gdb *Gdb) InitialDb(flag int) error
- func (gdb *Gdb) StartCalculationItemHandler(c *gin.Context)
- func (gdb *Gdb) StopCalculationItemHandler(c *gin.Context)
- func (gdb *Gdb) UpdateCalcItemHandler(c *gin.Context)
- func (gdb *Gdb) UpdateGroupColumnNamesHandler(c *gin.Context)
- func (gdb *Gdb) UpdateGroupNamesHandler(c *gin.Context)
- func (gdb *Gdb) UpdateItems(itemInfo ItemInfo) (Rows, error)
- func (gdb *Gdb) UpdateItemsHandler(c *gin.Context)
- type GroupInfo
- type GroupProperty
- type HistoricalDataInfo
- type ItemInfo
- type Items
- type OperationResponseData
- type RealTimeDataString
- type ResponseData
- type Rows
- type TimeStamp
- type UpdatedGroupColumnInfo
- type UpdatedGroupInfo
Constants ¶
const ( TimeKey = "currentTimeStamp" Ram = "ram" WrittenItems = "writtenItems" Speed = "speed" )
Variables ¶
Functions ¶
func GetGroupProperty ¶
func GetGroupProperty(groupNames ...string) (map[string]GroupProperty, error)
get the column and item count of the given groupname
Types ¶
type AddGroupColumnInfo ¶
type AddGroupInfo ¶
type AddItemInfo ¶
type BatchWriteString ¶
type Cols ¶
type Cols struct {
EffectedCols int `json:"effectedCols"`
}
function return effectedCol {"effectedCols": 1}
func AddGroupColumns ¶
func AddGroupColumns(info AddGroupColumnInfo) (Cols, error)
add columns to group, all columns type are text
func DeleteGroupColumns ¶
func DeleteGroupColumns(info DeletedGroupColumnInfo) (Cols, error)
delete columns from group, the operation is atomic
func UpdateGroupColumnNames ¶
func UpdateGroupColumnNames(info UpdatedGroupColumnInfo) (Cols, error)
update column names of group, the operation is atomic
type ColumnNameError ¶
type ColumnNameError struct {
ErrorInfo string
}
func (ColumnNameError) Error ¶
func (cn ColumnNameError) Error() string
type DeletedGroupColumnInfo ¶
type DeletedGroupInfo ¶
type DeletedGroupInfo struct {
GroupNames []string `json:"groupNames"`
}
type ExcelError ¶
type ExcelError struct {
ErrorInfo string
}
func (ExcelError) Error ¶
func (oe ExcelError) Error() string
type Gdb ¶
type Gdb struct {
RtDb *leveldb.DB // the pointer of realTime database
HisDb *leveldb.DB // the pointer of history database
InfoDb *leveldb.DB // the pointer of gdb info database
RtDbFilter cmap.ConcurrentMap // key filter
DbPath string
}
func (*Gdb) AddCalcItemHandler ¶
func (*Gdb) AddGroupColumnsHandler ¶
func (*Gdb) BatchWrite ¶
Batch write real-time data
kv : Key-value pair to be written withTimeStamp: Whether there is a time stamp when writing, if not, the default is the current time Unix timestamp if it is true, then v should be like [[ItemNames...],[Values...],[UnixTimeStamp... ]]
func (*Gdb) DeleteCalculationItemHandler ¶
func (*Gdb) DeleteGroupColumnsHandler ¶
func (*Gdb) DeleteGroupsHandler ¶
func (*Gdb) DeleteHistoricalData ¶
func (*Gdb) DeleteHistoricalDataHandler ¶
delete historical data, you should stop other operation when deleting historical data
func (*Gdb) DeleteItemsHandler ¶
func (*Gdb) GetCalcItemHandler ¶
func (*Gdb) GetDbInfoHandler ¶
get db info : ram, writtenItems, timestamp, speed
func (*Gdb) GetDbSpeedHistoryHandler ¶
func (*Gdb) GetGroupPropertyHandler ¶
func (*Gdb) GetGroupsHandler ¶
func (*Gdb) GetHistoricalData ¶
func (gdb *Gdb) GetHistoricalData(itemNames []string, startTimeStamps []int, endTimeStamps []int, intervals []int) (cmap.ConcurrentMap, error)
get historical data
func (*Gdb) GetHistoricalDataHandler ¶
func (*Gdb) GetHistoricalDataWithCondition ¶
func (gdb *Gdb) GetHistoricalDataWithCondition(itemNames []string, startTime []int, endTime []int, intervals []int, filterCondition string, zones ...DeadZone) (cmap.ConcurrentMap, error)
filter condition must be correct js expression,itemName should be startedWith by item. eg: item["itemName1"]>10 && item["itemName2"] > 30 .... It should be noted that the entire judgment is based on the itemName with less historical value in the condition. If the longest itemName is used as the benchmark, we cannot make an accurate judgment on the AND logic in it. Just imagine the history of Item1 It is [3,4,5], and item2 is [10,11]. If item1 is used as the benchmark, we cannot determine how much other elements of item2 should be expanded, because the condition may have complicated logic about item1 and item2 And or logic, no matter what the number is expanded, there may be a judgment error.
func (*Gdb) GetHistoricalDataWithConditionHandler ¶
func (*Gdb) GetHistoricalDataWithStamp ¶
func (gdb *Gdb) GetHistoricalDataWithStamp(itemNames []string, timeStamps ...string) (cmap.ConcurrentMap, error)
get history data according to the given time stamps
func (*Gdb) GetHistoricalDataWithStampHandler ¶
func (*Gdb) GetItemsHandler ¶
func (*Gdb) GetJsCodeHandler ¶
func (*Gdb) GetLogsHandler ¶
func (*Gdb) GetRealTimeData ¶
func (gdb *Gdb) GetRealTimeData(itemNames ...string) (cmap.ConcurrentMap, error)
get realTime data
func (*Gdb) GetRealTimeDataHandler ¶
func (*Gdb) HandleAddItemsByExcel ¶
func (*Gdb) HandleGetItemsWithCount ¶
func (*Gdb) HandleGetUerInfo ¶
func (*Gdb) HandleUploadFile ¶
func (*Gdb) StartCalculationItemHandler ¶
func (*Gdb) StopCalculationItemHandler ¶
func (*Gdb) UpdateCalcItemHandler ¶
func (*Gdb) UpdateGroupColumnNamesHandler ¶
func (*Gdb) UpdateGroupNamesHandler ¶
func (*Gdb) UpdateItemsHandler ¶
type GroupInfo ¶
type GroupInfo struct {
GroupNames []string `json:"groupNames"`
}
function return GroupName, every item of slice is the name of group {"groupNames": ["1DCS", "2DCS"]}
type GroupProperty ¶
type GroupProperty struct {
ItemCount string `json:"itemCount"`
ItemColumnNames []string `json:"itemColumnNames"`
}
function return GroupProperty {"itemCount": 10, "itemColumnNames": ["units", "type"]}
type HistoricalDataInfo ¶
type HistoricalDataInfo struct {
ItemNames []string `json:"itemNames"` // ItemNames
TimeStamps []string `json:"timeStamps"` // time stamp
StartTimes []int `json:"startTimes"` // startTime Unix TimeStamp
EndTimes []int `json:"endTimes"` // endTime Unix TimeStamp
Intervals []int `json:"intervals"` // interval
FilterCondition string `json:"filterCondition"` // filter condition: item["itemNames1"] > 100
DeadZones []DeadZone `json:"deadZones"` // deadZone filter condition
}
type Items ¶
type Items struct {
ItemCount int64 `json:"itemCount"`
ItemValues []map[string]string `json:"itemValues"`
}
func GetItemsWithCount ¶
type OperationResponseData ¶
type RealTimeDataString ¶
type RealTimeDataString struct {
ItemNames []string `json:"itemNames"` // ItemNames
}
type ResponseData ¶
type Rows ¶
type Rows struct {
EffectedRows int `json:"effectedRows"`
}
function return effectedRow {"effectedRows": 1}
func DeleteGroups ¶
func DeleteGroups(groupInfos DeletedGroupInfo) (Rows, error)
delete group from GDB notes: Since leveldb uses the default bloom filter deleting the key may affect performance. Therefore, when deleting groups and items in the current version, only the content in SQLite will be deleted, and the keys in the real-time and historical databases of leveldb will not be deleted.
func UpdateGroupNames ¶
func UpdateGroupNames(groupInfos ...UpdatedGroupInfo) (Rows, error)
update groupNames, the operation is atomic