Documentation
¶
Index ¶
- Constants
- Variables
- func GetDataFormString(t DataFormByte) string
- func GetDataTypeString(t DataTypeByte) string
- type ArrayVector
- type Category
- type CategoryString
- type Chart
- func (ch *Chart) GetChartType() string
- func (ch *Chart) GetDataForm() DataFormByte
- func (ch *Chart) GetDataType() DataTypeByte
- func (ch *Chart) GetDataTypeString() string
- func (ch *Chart) GetTitle() string
- func (ch *Chart) GetXAxisName() string
- func (ch *Chart) GetYAxisName() string
- func (ch *Chart) Render(w *protocol.Writer, bo protocol.ByteOrder) error
- func (ch *Chart) Rows() int
- func (ch *Chart) String() string
- type DataForm
- type DataFormByte
- type DataType
- type DataTypeByte
- type DataTypeExtend
- type DataTypeList
- type Dictionary
- func (dict *Dictionary) Get(key string) (DataType, error)
- func (dict *Dictionary) GetDataForm() DataFormByte
- func (dict *Dictionary) GetDataType() DataTypeByte
- func (dict *Dictionary) GetDataTypeString() string
- func (dict *Dictionary) KeyStrings() []string
- func (dict *Dictionary) Render(w *protocol.Writer, bo protocol.ByteOrder) error
- func (dict *Dictionary) Rows() int
- func (dict *Dictionary) Set(key, value DataType)
- func (dict *Dictionary) String() string
- type Matrix
- func (mtx *Matrix) Get(row, col int) DataType
- func (mtx *Matrix) GetDataForm() DataFormByte
- func (mtx *Matrix) GetDataType() DataTypeByte
- func (mtx *Matrix) GetDataTypeString() string
- func (mtx *Matrix) IsNull(row, col int) bool
- func (mtx *Matrix) Render(w *protocol.Writer, bo protocol.ByteOrder) error
- func (mtx *Matrix) Rows() int
- func (mtx *Matrix) Set(row, col int, d DataType) error
- func (mtx *Matrix) SetNull(row, col int)
- func (mtx *Matrix) String() string
- type Pair
- type Scalar
- func (s *Scalar) GetDataForm() DataFormByte
- func (s *Scalar) GetDataType() DataTypeByte
- func (s *Scalar) GetDataTypeString() string
- func (s *Scalar) IsNull() bool
- func (s *Scalar) Render(w *protocol.Writer, bo protocol.ByteOrder) error
- func (s *Scalar) Rows() int
- func (s *Scalar) SetNull()
- func (s *Scalar) String() string
- type Set
- type Table
- func (t *Table) Columns() int
- func (t *Table) GetColumnByIndex(ind int) *Vector
- func (t *Table) GetColumnByName(colName string) *Vector
- func (t *Table) GetColumnNames() []string
- func (t *Table) GetDataForm() DataFormByte
- func (t *Table) GetDataType() DataTypeByte
- func (t *Table) GetDataTypeString() string
- func (t *Table) GetSubtable(indexes []int) *Table
- func (t *Table) Render(w *protocol.Writer, bo protocol.ByteOrder) error
- func (t *Table) Rows() int
- func (t *Table) String() string
- type Vector
- func (vct *Vector) AsOf(d DataType) int
- func (vct *Vector) Combine(in *Vector) (*Vector, error)
- func (vct *Vector) Get(ind int) DataType
- func (vct *Vector) GetDataForm() DataFormByte
- func (vct *Vector) GetDataType() DataTypeByte
- func (vct *Vector) GetDataTypeString() string
- func (vct *Vector) GetSubvector(indexes []int) *Vector
- func (vct *Vector) GetVectorValue(ind int) *Vector
- func (vct *Vector) HashBucket(ind, bucket int) int
- func (vct *Vector) IsNull(ind int) bool
- func (vct *Vector) Render(w *protocol.Writer, bo protocol.ByteOrder) error
- func (vct *Vector) Rows() int
- func (vct *Vector) Set(ind int, d DataType) error
- func (vct *Vector) SetNull(ind int)
- func (vct *Vector) String() string
Constants ¶
const ( // MinInt8 is the minimum int8 of type uint8. MinInt8 uint8 = 128 // MinInt32 is minimum int32 of type uint32. MinInt32 uint32 = 2147483648 )
Variables ¶
var ( // Null value for DtString, DtSymbol. NullString = "" // Null value for DtAny. NullAny = nullDataForm // Null value for DtUUID. NullUUID = "00000000-0000-0000-0000-000000000000" // Null value for DtInt128. NullInt128 = "00000000000000000000000000000000" // Null value for DtIP. NullIP = "0.0.0.0" // Null value for DTShort. NullShort = int16(math.MinInt16) // Null value for DtDate,DtDateHour,DtDatetime,DtMinute,DtNanoTime,DtNanoTimestamp,DtSecond,DtMonth,DtTimestamp. NullTime = emptyTime // Null value for DtLong. NullLong = int64(math.MinInt64) // Null value for DtDuration. NullDuration = "" // Null value for DtFloat. NullFloat = float32(-math.MaxFloat32) // Null value for DtDouble. NullDouble = -math.MaxFloat64 // Null value for DtInt. NullInt = int32(math.MinInt32) // Null value for DtComplex. NullComplex = [2]float64{-math.MaxFloat64, -math.MaxFloat64} // Null value for DtPoint. NullPoint = [2]float64{-math.MaxFloat64, -math.MaxFloat64} // Null value for DtBlob. NullBlob = []byte{} // Null value for DtBool. NullBool = MinInt8 // Null value for DtChar. NullChar = MinInt8 // Null value for DtCompress. NullCompress = MinInt8 )
var ChartType = map[string]string{
"0": "CT_AREA",
"1": "CT_BAR",
"2": "CT_COLUMN",
"3": "CT_HISTOGRAM",
"4": "CT_LINE",
"5": "CT_PIE",
"6": "CT_SCATTER",
"7": "CT_TREND",
"8": "CT_KLINE",
"9": "CT_STACK",
}
ChartType is a map storing the mapping relationship.
Functions ¶
func GetDataFormString ¶
func GetDataFormString(t DataFormByte) string
GetDataFormString returns the data form in the string format based on its byte format.
func GetDataTypeString ¶
func GetDataTypeString(t DataTypeByte) string
GetDataTypeString returns the data type in the string format based on its byte format.
Types ¶
type ArrayVector ¶
type ArrayVector struct {
// contains filtered or unexported fields
}
ArrayVector is an element type of Vector.
func NewArrayVector ¶
func NewArrayVector(vl []*Vector) []*ArrayVector
NewArrayVector returns an object of ArrayVector with specified data. You can initialize the data by using NewDataTypeList or NewDataTypeListWithRaw.
type Category ¶
type Category struct {
DataForm DataFormByte
DataType DataTypeByte
}
Category stores the DataFormByte and the DataTypeByte of a DataForm.
type CategoryString ¶
type CategoryString string
CategoryString is the string type of Category.
const ( // LOGICAL is the string type of category LOGICAL. LOGICAL CategoryString = "LOGICAL" // NOTHING is the string type of category NOTHING. NOTHING CategoryString = "NOTHING" // INTEGRAL is the string type of category INTEGRAL. INTEGRAL CategoryString = "INTEGRAL" // FLOATING is the string type of category FLOATING. FLOATING CategoryString = "FLOATING" // TEMPORAL is the string type of category TEMPORAL. TEMPORAL CategoryString = "TEMPORAL" // LITERAL is the string type of category LITERAL. LITERAL CategoryString = "LITERAL" // SYSTEM is the string type of category SYSTEM. SYSTEM CategoryString = "SYSTEM" // MIXED is the string type of category MIXED. MIXED CategoryString = "MIXED" // BINARY is the string type of category BINARY. BINARY CategoryString = "BINARY" // ARRAY is the string type of category ARRAY. ARRAY CategoryString = "ARRAY" )
func GetCategory ¶
func GetCategory(d DataTypeByte) CategoryString
GetCategory returns the category string according to the dt.
type Chart ¶
type Chart struct {
Title DataForm
ChartType *Scalar
Stacking *Scalar
Data *Matrix
Extras *Dictionary
// contains filtered or unexported fields
}
Chart is a DataForm.
func (*Chart) GetChartType ¶
GetChartType returns the string type of the ChartType.
func (*Chart) GetDataForm ¶
func (ch *Chart) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Chart) GetDataType ¶
func (ch *Chart) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Chart) GetDataTypeString ¶
GetDataTypeString returns the string format of the DataType.
func (*Chart) GetXAxisName ¶
GetXAxisName returns the XAxisName of the title.
func (*Chart) GetYAxisName ¶
GetYAxisName returns the YAxisName of the title.
type DataForm ¶
type DataForm interface {
// Render serializes the DataForm with bo and input it into w
Render(w *protocol.Writer, bo protocol.ByteOrder) error
// GetDataForm returns the byte type of the DataForm
GetDataForm() DataFormByte
// GetDataType returns the byte type of the DataType
GetDataType() DataTypeByte
// GetDataTypeString returns the string format of the DataType
GetDataTypeString() string
// String returns the string of the DataForm
String() string
// Rows returns the row num of the DataForm
Rows() int
}
DataForm interface declares functions to handle DataForm data.
func CastDateTime ¶
func CastDateTime(src DataForm, d DataTypeByte) (DataForm, error)
CastDateTime casts src to other DataForm according to the dt.
type DataFormByte ¶
type DataFormByte byte
DataFormByte is the byte type of DataForm.
const ( // DfScalar is the byte type of Scalar. DfScalar DataFormByte = iota // DfVector is the byte type of Vector. DfVector // DfPair is the byte type of Pair. DfPair // DfMatrix is the byte type of Matrix. DfMatrix // DfSet is the byte type of Set. DfSet // DfDictionary is the byte type of Dictionary. DfDictionary // DfTable is the byte type of Table. DfTable // DfChart is the byte type of Chart. DfChart // DfChunk is the byte type of Chunk. DfChunk )
type DataType ¶
type DataType interface {
// DataType returns the byte type of DataType
DataType() DataTypeByte
// Render serializes the DataType into w with the bo
Render(w *protocol.Writer, bo protocol.ByteOrder) error
// String returns the string format of the DataType
String() string
// Bool returns the bool value of the DataType.
// Only when th DataType is DtBool, you can call the func successful
Bool() (bool, error)
// Value returns an interface value of DataType, you can assert it to get the real value
Value() interface{}
// HashBucket calculates the hashcode with the value of DataType and buckets
HashBucket(buckets int) int
// IsNull checks whether the value of DataType is null
IsNull() bool
// SetNull sets the value of DataType to null
SetNull()
// contains filtered or unexported methods
}
DataType interface declares functions to handle DataType data.
func NewDataType ¶
func NewDataType(datatype DataTypeByte, arg interface{}) (DataType, error)
NewDataType returns an object of DataType according to datatype and arg. You should input in according to the datatype. See README.md for more details.
type DataTypeByte ¶
type DataTypeByte byte
DataTypeByte is the byte type of DataType.
const ( // DtVoid is the byte type of Void. DtVoid DataTypeByte = iota // DtBool is the byte type of Bool. DtBool // DtChar is the byte type of Char. DtChar // DtShort is the byte type of Short. DtShort // DtInt is the byte type of Int. DtInt // DtLong is the byte type of Long. DtLong // DtDate is the byte type of Date. DtDate // DtMonth is the byte type of Month. DtMonth // DtTime is the byte type of Time. DtTime // DtMinute is the byte type of Minute. DtMinute // DtSecond is the byte type of Second. DtSecond // DtDatetime is the byte type of Datetime. DtDatetime // DtTimestamp is the byte type of Timestamp. DtTimestamp // DtNanoTime is the byte type of NanoTime. DtNanoTime // DtNanoTimestamp is the byte type of NanoTimestamp. DtNanoTimestamp // DtFloat is the byte type of Float. DtFloat // DtDouble is the byte type of Double. DtDouble // DtSymbol is the byte type of Symbol. DtSymbol // DtString is the byte type of String. DtString // DtUUID is the byte type of UUID. DtUUID // DtFunction is the byte type of Function. DtFunction // DtHandle is the byte type of Handle. DtHandle // DtCode is the byte type of Code. DtCode // DtDatasource is the byte type of Datasource. DtDatasource // DtResource is the byte type of Resource. DtResource // DtAny is the byte type of Any. DtAny // DtCompress is the byte type of Compress. DtCompress // DtDictionary is the byte type of Dictionary. DtDictionary // DtDateHour is the byte type of DateHour. DtDateHour // DtDateMinute is the byte type of DateMinute. DtDateMinute // DtIP is the byte type of IP. DtIP // DtInt128 is the byte type of Int128. DtInt128 // DtBlob is the byte type of Blob. DtBlob // DtComplex is the byte type of Complex. DtComplex // DtPoint is the byte type of Point. DtPoint // DtDuration is the byte type of Duration. DtDuration // DtObject is the byte type of Object. DtObject )
type DataTypeExtend ¶
type DataTypeExtend struct {
BaseID uint32
BaseSize uint32
Base DataTypeList
}
DataTypeExtend is only valid for Symbol DataType.
type DataTypeList ¶
type DataTypeList interface {
// DataType returns the byte type of the DataTypeList
DataType() DataTypeByte
// Render serializes the DataForm with bo and input it into w
Render(w *protocol.Writer, bo protocol.ByteOrder) error
// Len returns the length of DataTypeList
Len() int
// Get returns a DataType value in DataTypeList according to the ind
// which must be less than len(DataTypeList)
Get(ind int) DataType
// Set inserts dt into DataTypeList according to the ind
// which must be less than or equal to len(DataTypeList).
// If ind < len(DataTypeList), cover the original value in DataTypeList
Set(ind int, t DataType) error
// SetWithRaw inserts raw data into DataTypeList according to the ind
// which must be less than or equal to len(DataTypeList).
// If ind < len(DataTypeList), cover the original value in DataTypeList
SetWithRaw(ind int, t interface{}) error
// Append inserts a DataType value to the end of DataTypeList.
// The type of d must be the same as DataTypeList's
Append(t DataType) DataTypeList
// Sub returns the len end-st of DataTypeList.
// End must be larger than st,
// but less than the len of DataTypeList.
// St must be large than -1
Sub(st, end int) DataTypeList
// AsOf returns the index of the d in DataTypeList.
// If d is not in DataTypeList, returns -1
AsOf(d DataType) int
// StringList returns the string array of Datatype list
StringList() []string
// Value returns the value of Datatype list
Value() []interface{}
// IsNull checks whether the value of DataType is null based on the index
IsNull(ind int) bool
// SetNull sets the value of DataType with index ind to null
SetNull(ind int)
// GetSubList instantiates a DataTypeList with the values in indexes which is a list of index.
// Value in indexes should be less than the length of DataTypeList
GetSubList(indexes []int) DataTypeList
// ElementValue returns the value of Datatype list element according to the ind
ElementValue(ind int) interface{}
// ElementString returns the string value of Datatype list element according to the ind
ElementString(ind int) string
// contains filtered or unexported methods
}
DataTypeList interface declares functions to handle DataType list.
func NewDataTypeList ¶
func NewDataTypeList(datatype DataTypeByte, data []DataType) DataTypeList
NewDataTypeList instantiates a DataTypeList according to the datatype and data. The DataType byte of element in data should be equal to d.
func NewDataTypeListWithRaw ¶
func NewDataTypeListWithRaw(datatype DataTypeByte, args interface{}) (DataTypeList, error)
NewDataTypeListWithRaw instantiates a DataTypeList with specified datatype and args. Refer to README_CN.md for the valid type of args and d.
func NewEmptyDataTypeList ¶
func NewEmptyDataTypeList(datatype DataTypeByte, size int) DataTypeList
NewEmptyDataTypeList instantiates an empty DataTypeList.
type Dictionary ¶
Dictionary is a DataForm. Refer to https://www.dolphindb.com/help/DataTypesandStructures/DataForms/Dictionary.html for more details.
func NewDictionary ¶
func NewDictionary(keys, val *Vector) *Dictionary
NewDictionary returns an object of Dictionary according to keys and values. You can instantiate the Vector object by NewVector.
func (*Dictionary) Get ¶
func (dict *Dictionary) Get(key string) (DataType, error)
Get returns the value in dictionary based on the specified key.
func (*Dictionary) GetDataForm ¶
func (dict *Dictionary) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Dictionary) GetDataType ¶
func (dict *Dictionary) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Dictionary) GetDataTypeString ¶
func (dict *Dictionary) GetDataTypeString() string
GetDataTypeString returns the string format of the DataType.
func (*Dictionary) KeyStrings ¶
func (dict *Dictionary) KeyStrings() []string
KeyStrings returns the string list of dictionary keys.
func (*Dictionary) Rows ¶
func (dict *Dictionary) Rows() int
Rows returns the row num of the DataForm.
func (*Dictionary) Set ¶
func (dict *Dictionary) Set(key, value DataType)
Set sets the key and value of a dictionary. If a key already exists, update the value, otherwise append the key-value pair.
func (*Dictionary) String ¶
func (dict *Dictionary) String() string
type Matrix ¶
type Matrix struct {
RowLabels *Vector
ColumnLabels *Vector
Data *Vector
// contains filtered or unexported fields
}
Matrix is a DataForm. Refer to https://www.dolphindb.cn/cn/help/130/DataTypesandStructures/DataForms/Matrix.html for details.
func NewMatrix ¶
NewMatrix returns an object of matrix according to data, rowLabels and columnLabels. RowLabels and columnLabels are optional. You can instantiate the Vector object by using NewVector.
func (*Matrix) GetDataForm ¶
func (mtx *Matrix) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Matrix) GetDataType ¶
func (mtx *Matrix) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Matrix) GetDataTypeString ¶
GetDataTypeString returns the string format of the DataType.
func (*Matrix) Set ¶
Set sets DataType for mtx according to the row and col. index = col*row + row. If index >= len(mtx.Data), return an error. If index < len(mtx.Data), cover the original value.
type Pair ¶
type Pair struct {
Vector *Vector
// contains filtered or unexported fields
}
Pair is a DataForm. Refer to https://www.dolphindb.cn/cn/help/130/DataTypesandStructures/DataForms/Pair.html for details.
func NewPair ¶
NewPair returns an object of pair with specified vector v. You can instantiate it by NewVector.
func (*Pair) GetDataForm ¶
func (p *Pair) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Pair) GetDataType ¶
func (p *Pair) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Pair) GetDataTypeString ¶
GetDataTypeString returns the string format of the DataType.
type Scalar ¶
type Scalar struct {
DataType
// contains filtered or unexported fields
}
Scalar is a DataForm. Refer to https://www.dolphindb.cn/cn/help/130/DataTypesandStructures/DataForms/Scalar.html for more details.
func NewScalar ¶
NewScalar returns an object of scalar with d. You can instantiate the d by NewDataType.
func (*Scalar) GetDataForm ¶
func (s *Scalar) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Scalar) GetDataType ¶
func (s *Scalar) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Scalar) GetDataTypeString ¶
GetDataTypeString returns the string format of the DataType.
type Set ¶
type Set struct {
Vector *Vector
// contains filtered or unexported fields
}
Set is a DataForm. Refer to https://www.dolphindb.cn/cn/help/130/DataTypesandStructures/DataForms/Set.html for more details.
func NewSet ¶
NewSet returns an object of Set based on vector v. You can instantiate v by NewVector.
func (*Set) GetDataForm ¶
func (s *Set) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Set) GetDataType ¶
func (s *Set) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Set) GetDataTypeString ¶
GetDataTypeString returns the string format of the DataType.
type Table ¶
type Table struct {
ColNames []string
// contains filtered or unexported fields
}
Table is a DataForm. Refer to https://www.dolphindb.cn/cn/help/130/DataTypesandStructures/DataForms/Table.html for more details.
func NewTable ¶
NewTable returns an object of Table with colNames and colValues. You can instantiate the vector object by NewVector.
func (*Table) GetColumnByIndex ¶
GetColumnByIndex returns the column in table with the column index.
func (*Table) GetColumnByName ¶
GetColumnByName returns the column in table with the column name.
func (*Table) GetColumnNames ¶
GetColumnNames returns all column names of the table.
func (*Table) GetDataForm ¶
func (t *Table) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Table) GetDataType ¶
func (t *Table) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Table) GetDataTypeString ¶
GetDataTypeString returns the string format of the DataType.
func (*Table) GetSubtable ¶
GetSubtable instantiates a table with the values in indexes. The specified indexes should be less than the number of columns.
type Vector ¶
type Vector struct {
RowCount uint32
ColumnCount uint32
// If the DataTypeByte of the Vector is less than 64, Data stores the values of the vector.
// If the DataTypeByte of the Vector is greater than 64 and less than 128, Data is invalid.
// If the DataTypeByte of the Vector is greater than 128, Data stores the indexs of the values and
// the value are stored in the Base of Extend.
// You can call GetDataType() to get the DataTypeByte of the Vector.
Data DataTypeList
// ArrayVector is a special form of data for DolphinDB. Unlike a regular vector,
// each of its elements is an array with the same DataType, but the length can vary.
// ArrayVector is only valid when the DataTypeByte of the Vector is greater than 64 and less than 128.
// You can call GetDataType() to get the DataTypeByte of the Vector.
ArrayVector []*ArrayVector
// Extend is only valid when the DataTypeByte of the Vector is greater than 128.
// The Base of the Extend stores the values of the vector.
// You can call GetDataType() to get the DataTypeByte of the Vector.
Extend *DataTypeExtend
// contains filtered or unexported fields
}
Vector is a DataForm. Refer to https://www.dolphindb.cn/cn/help/130/DataTypesandStructures/DataForms/Vector/index.html for more details.
func NewVector ¶
func NewVector(data DataTypeList) *Vector
NewVector returns an object of vector with specified data. You can instantiate the data by NewDataTypeList or NewDataTypeListWithRaw.
func NewVectorWithArrayVector ¶
func NewVectorWithArrayVector(data []*ArrayVector) *Vector
NewVectorWithArrayVector returns an object of vector according to the data. You can instantiates the data by NewArrayVector.
func (*Vector) AsOf ¶
AsOf returns the index of the d in vct. ArrayVector does not support AsOf. If d is not in vct, returns -1.
func (*Vector) Combine ¶
Combine combines two Vectors and returns a new one. ArrayVector does not support Combine.
func (*Vector) GetDataForm ¶
func (vct *Vector) GetDataForm() DataFormByte
GetDataForm returns the byte type of the DataForm.
func (*Vector) GetDataType ¶
func (vct *Vector) GetDataType() DataTypeByte
GetDataType returns the byte type of the DataType.
func (*Vector) GetDataTypeString ¶
GetDataTypeString returns the string format of the DataType.
func (*Vector) GetSubvector ¶
GetSubvector instantiates a Vector with the values in indexes. ArrayVector does not support GetSubvector. The specified indexes should be less than the length of Vector.
func (*Vector) GetVectorValue ¶
GetVectorValue returns the element of the ArrayVector based on the ind.
func (*Vector) HashBucket ¶
HashBucket calculates the hash with the bucket and the value whose index is ind in vct.
func (*Vector) IsNull ¶
IsNull checks whether the value of DataType in vector is null based on the index. ArrayVector does not support IsNull.
func (*Vector) Set ¶
Set sets DataType of the vct with ind. ArrayVector does not support Set. If ind >= len(vct.Data), return an error, otherwise cover the original value.