Documentation ¶
Overview ¶
Package element 提供各个类型的列值,列,记录以及记录通道
Index ¶
- Variables
- func ByteSize(src interface{}) int
- type BigInt
- func (b *BigInt) AsBigInt() *big.Int
- func (b *BigInt) AsDecimal() decimal.Decimal
- func (b *BigInt) BigInt() BigIntNumber
- func (b *BigInt) Bool() (bool, error)
- func (b *BigInt) CloneBigInt() BigIntNumber
- func (b *BigInt) CloneDecimal() DecimalNumber
- func (b *BigInt) Decimal() DecimalNumber
- func (b *BigInt) Float64() (v float64, err error)
- func (b *BigInt) Int64() (int64, error)
- func (b *BigInt) String() string
- type BigIntColumnValue
- func (b *BigIntColumnValue) AsBigInt() (BigIntNumber, error)
- func (b *BigIntColumnValue) AsBool() (bool, error)
- func (b *BigIntColumnValue) AsBytes() ([]byte, error)
- func (b *BigIntColumnValue) AsDecimal() (DecimalNumber, error)
- func (b *BigIntColumnValue) AsString() (string, error)
- func (b *BigIntColumnValue) AsTime() (time.Time, error)
- func (b *BigIntColumnValue) Clone() ColumnValue
- func (b *BigIntColumnValue) Cmp(right ColumnValue) (int, error)
- func (n *BigIntColumnValue) IsNil() bool
- func (b *BigIntColumnValue) String() string
- func (b *BigIntColumnValue) Type() ColumnType
- type BigIntNumber
- type BigIntStr
- func (b *BigIntStr) AsBigInt() *big.Int
- func (b *BigIntStr) AsDecimal() decimal.Decimal
- func (b *BigIntStr) BigInt() BigIntNumber
- func (b *BigIntStr) Bool() (bool, error)
- func (b *BigIntStr) CloneBigInt() BigIntNumber
- func (b *BigIntStr) CloneDecimal() DecimalNumber
- func (b *BigIntStr) Decimal() DecimalNumber
- func (b *BigIntStr) Float64() (v float64, err error)
- func (b *BigIntStr) Int64() (int64, error)
- func (b *BigIntStr) String() string
- type BoolColumnValue
- func (b *BoolColumnValue) AsBigInt() (BigIntNumber, error)
- func (b *BoolColumnValue) AsBool() (bool, error)
- func (b *BoolColumnValue) AsBytes() ([]byte, error)
- func (b *BoolColumnValue) AsDecimal() (DecimalNumber, error)
- func (b *BoolColumnValue) AsString() (string, error)
- func (b *BoolColumnValue) AsTime() (time.Time, error)
- func (b *BoolColumnValue) Clone() ColumnValue
- func (b *BoolColumnValue) Cmp(right ColumnValue) (int, error)
- func (n *BoolColumnValue) IsNil() bool
- func (b *BoolColumnValue) String() string
- func (b *BoolColumnValue) Type() ColumnType
- type BytesColumnValue
- func (b *BytesColumnValue) AsBigInt() (BigIntNumber, error)
- func (b *BytesColumnValue) AsBool() (bool, error)
- func (b *BytesColumnValue) AsBytes() ([]byte, error)
- func (b *BytesColumnValue) AsDecimal() (DecimalNumber, error)
- func (b *BytesColumnValue) AsString() (string, error)
- func (b *BytesColumnValue) AsTime() (t time.Time, err error)
- func (b *BytesColumnValue) Clone() ColumnValue
- func (b *BytesColumnValue) Cmp(right ColumnValue) (int, error)
- func (n *BytesColumnValue) IsNil() bool
- func (b *BytesColumnValue) String() string
- func (b *BytesColumnValue) Type() ColumnType
- type Column
- type ColumnType
- type ColumnValue
- func NewBigIntColumnValue(v *big.Int) ColumnValue
- func NewBigIntColumnValueFromInt64(v int64) ColumnValue
- func NewBigIntColumnValueFromString(v string) (ColumnValue, error)
- func NewBoolColumnValue(v bool) ColumnValue
- func NewBytesColumnValue(v []byte) ColumnValue
- func NewBytesColumnValueNoCopy(v []byte) ColumnValue
- func NewBytesColumnValueWithEncoder(v []byte, e TimeEncoder) ColumnValue
- func NewBytesColumnValueWithEncoderNoCopy(v []byte, e TimeEncoder) ColumnValue
- func NewDecimalColumnValue(d decimal.Decimal) ColumnValue
- func NewDecimalColumnValueFromFloat(f float64) ColumnValue
- func NewDecimalColumnValueFromString(s string) (ColumnValue, error)
- func NewNilBigIntColumnValue() ColumnValue
- func NewNilBoolColumnValue() ColumnValue
- func NewNilBytesColumnValue() ColumnValue
- func NewNilDecimalColumnValue() ColumnValue
- func NewNilStringColumnValue() ColumnValue
- func NewNilTimeColumnValue() ColumnValue
- func NewStringColumnValue(s string) ColumnValue
- func NewStringColumnValueWithEncoder(s string, e TimeEncoder) ColumnValue
- func NewTimeColumnValue(t time.Time) ColumnValue
- func NewTimeColumnValueWithDecoder(t time.Time, d TimeDecoder) ColumnValue
- type ColumnValueClonable
- type ColumnValueComparabale
- type Converter
- type Decimal
- type DecimalColumnValue
- func (d *DecimalColumnValue) AsBigInt() (BigIntNumber, error)
- func (d *DecimalColumnValue) AsBool() (bool, error)
- func (d *DecimalColumnValue) AsBytes() ([]byte, error)
- func (d *DecimalColumnValue) AsDecimal() (DecimalNumber, error)
- func (d *DecimalColumnValue) AsString() (string, error)
- func (d *DecimalColumnValue) AsTime() (time.Time, error)
- func (d *DecimalColumnValue) Clone() ColumnValue
- func (d *DecimalColumnValue) Cmp(right ColumnValue) (int, error)
- func (n *DecimalColumnValue) IsNil() bool
- func (d *DecimalColumnValue) String() string
- func (d *DecimalColumnValue) Type() ColumnType
- type DecimalNumber
- type DecimalStr
- func (d *DecimalStr) AsDecimal() decimal.Decimal
- func (d *DecimalStr) BigInt() BigIntNumber
- func (d *DecimalStr) Bool() (bool, error)
- func (d *DecimalStr) CloneDecimal() DecimalNumber
- func (d *DecimalStr) Decimal() DecimalNumber
- func (d *DecimalStr) Float64() (v float64, err error)
- func (d *DecimalStr) String() string
- type DefaultColumn
- func (d *DefaultColumn) AsFloat64() (float64, error)
- func (d *DefaultColumn) AsInt64() (int64, error)
- func (d *DefaultColumn) ByteSize() int64
- func (d *DefaultColumn) Clone() (Column, error)
- func (d *DefaultColumn) Cmp(c Column) (int, error)
- func (d *DefaultColumn) MemorySize() int64
- func (d *DefaultColumn) Name() string
- type DefaultRecord
- func (r *DefaultRecord) Add(c Column) error
- func (r *DefaultRecord) ByteSize() int64
- func (r *DefaultRecord) ColumnNumber() int
- func (r *DefaultRecord) GetByIndex(i int) (Column, error)
- func (r *DefaultRecord) GetByName(name string) (Column, error)
- func (r *DefaultRecord) MemorySize() int64
- func (r *DefaultRecord) Put(c Column) error
- func (r *DefaultRecord) Set(i int, c Column) error
- func (r *DefaultRecord) String() string
- type Float64
- type Int64
- func (i *Int64) AsBigInt() *big.Int
- func (i *Int64) AsDecimal() decimal.Decimal
- func (i *Int64) BigInt() BigIntNumber
- func (i *Int64) Bool() (bool, error)
- func (i *Int64) CloneBigInt() BigIntNumber
- func (i *Int64) CloneDecimal() DecimalNumber
- func (i *Int64) Decimal() DecimalNumber
- func (i *Int64) Float64() (float64, error)
- func (i *Int64) Int64() (int64, error)
- func (i *Int64) String() string
- type NilBigIntColumnValue
- func (n NilBigIntColumnValue) AsBigInt() (BigIntNumber, error)
- func (n NilBigIntColumnValue) AsBool() (bool, error)
- func (n NilBigIntColumnValue) AsBytes() ([]byte, error)
- func (n NilBigIntColumnValue) AsDecimal() (DecimalNumber, error)
- func (n NilBigIntColumnValue) AsString() (string, error)
- func (n NilBigIntColumnValue) AsTime() (time.Time, error)
- func (n *NilBigIntColumnValue) Clone() ColumnValue
- func (n NilBigIntColumnValue) IsNil() bool
- func (n NilBigIntColumnValue) String() string
- func (n *NilBigIntColumnValue) Type() ColumnType
- type NilBoolColumnValue
- func (n NilBoolColumnValue) AsBigInt() (BigIntNumber, error)
- func (n NilBoolColumnValue) AsBool() (bool, error)
- func (n NilBoolColumnValue) AsBytes() ([]byte, error)
- func (n NilBoolColumnValue) AsDecimal() (DecimalNumber, error)
- func (n NilBoolColumnValue) AsString() (string, error)
- func (n NilBoolColumnValue) AsTime() (time.Time, error)
- func (n *NilBoolColumnValue) Clone() ColumnValue
- func (n NilBoolColumnValue) IsNil() bool
- func (n NilBoolColumnValue) String() string
- func (n *NilBoolColumnValue) Type() ColumnType
- type NilBytesColumnValue
- func (n NilBytesColumnValue) AsBigInt() (BigIntNumber, error)
- func (n NilBytesColumnValue) AsBool() (bool, error)
- func (n NilBytesColumnValue) AsBytes() ([]byte, error)
- func (n NilBytesColumnValue) AsDecimal() (DecimalNumber, error)
- func (n NilBytesColumnValue) AsString() (string, error)
- func (n NilBytesColumnValue) AsTime() (time.Time, error)
- func (n *NilBytesColumnValue) Clone() ColumnValue
- func (n NilBytesColumnValue) IsNil() bool
- func (n NilBytesColumnValue) String() string
- func (n *NilBytesColumnValue) Type() ColumnType
- type NilDecimalColumnValue
- func (n NilDecimalColumnValue) AsBigInt() (BigIntNumber, error)
- func (n NilDecimalColumnValue) AsBool() (bool, error)
- func (n NilDecimalColumnValue) AsBytes() ([]byte, error)
- func (n NilDecimalColumnValue) AsDecimal() (DecimalNumber, error)
- func (n NilDecimalColumnValue) AsString() (string, error)
- func (n NilDecimalColumnValue) AsTime() (time.Time, error)
- func (n *NilDecimalColumnValue) Clone() ColumnValue
- func (n NilDecimalColumnValue) IsNil() bool
- func (n NilDecimalColumnValue) String() string
- func (n *NilDecimalColumnValue) Type() ColumnType
- type NilStringColumnValue
- func (n NilStringColumnValue) AsBigInt() (BigIntNumber, error)
- func (n NilStringColumnValue) AsBool() (bool, error)
- func (n NilStringColumnValue) AsBytes() ([]byte, error)
- func (n NilStringColumnValue) AsDecimal() (DecimalNumber, error)
- func (n NilStringColumnValue) AsString() (string, error)
- func (n NilStringColumnValue) AsTime() (time.Time, error)
- func (n *NilStringColumnValue) Clone() ColumnValue
- func (n NilStringColumnValue) IsNil() bool
- func (n NilStringColumnValue) String() string
- func (n *NilStringColumnValue) Type() ColumnType
- type NilTimeColumnValue
- func (n NilTimeColumnValue) AsBigInt() (BigIntNumber, error)
- func (n NilTimeColumnValue) AsBool() (bool, error)
- func (n NilTimeColumnValue) AsBytes() ([]byte, error)
- func (n NilTimeColumnValue) AsDecimal() (DecimalNumber, error)
- func (n NilTimeColumnValue) AsString() (string, error)
- func (n NilTimeColumnValue) AsTime() (time.Time, error)
- func (n *NilTimeColumnValue) Clone() ColumnValue
- func (n NilTimeColumnValue) IsNil() bool
- func (n NilTimeColumnValue) String() string
- func (n *NilTimeColumnValue) Type() ColumnType
- type Number
- type NumberConverter
- type OldConverter
- func (c *OldConverter) ConvertBigInt(s string) (num BigIntNumber, err error)
- func (c *OldConverter) ConvertBigIntFromInt(i int64) (num BigIntNumber)
- func (c *OldConverter) ConvertDecimal(s string) (num DecimalNumber, err error)
- func (c *OldConverter) ConvertDecimalFromFloat(f float64) (num DecimalNumber)
- type Record
- type RecordChan
- func (c *RecordChan) Buffered() int
- func (c *RecordChan) Close()
- func (c *RecordChan) PopFront() (r Record, ok bool)
- func (c *RecordChan) PopFrontAll(onRecord func(Record) error) error
- func (c *RecordChan) PushBack(r Record) int
- func (c *RecordChan) PushBackAll(fetchRecord func() (Record, error)) error
- type SetError
- type StringColumnValue
- func (s *StringColumnValue) AsBigInt() (BigIntNumber, error)
- func (s *StringColumnValue) AsBool() (v bool, err error)
- func (s *StringColumnValue) AsBytes() ([]byte, error)
- func (s *StringColumnValue) AsDecimal() (DecimalNumber, error)
- func (s *StringColumnValue) AsString() (string, error)
- func (s *StringColumnValue) AsTime() (t time.Time, err error)
- func (s *StringColumnValue) Clone() ColumnValue
- func (s *StringColumnValue) Cmp(right ColumnValue) (int, error)
- func (n *StringColumnValue) IsNil() bool
- func (s *StringColumnValue) String() string
- func (s *StringColumnValue) Type() ColumnType
- type StringTimeDecoder
- type StringTimeEncoder
- type TerminateRecord
- func (t *TerminateRecord) Add(Column) error
- func (t *TerminateRecord) ByteSize() int64
- func (t *TerminateRecord) ColumnNumber() int
- func (t *TerminateRecord) GetByIndex(i int) (Column, error)
- func (t *TerminateRecord) GetByName(name string) (Column, error)
- func (t *TerminateRecord) MemorySize() int64
- func (t *TerminateRecord) Put(c Column) error
- func (t *TerminateRecord) Set(i int, c Column) error
- func (t *TerminateRecord) String() string
- type TimeColumnValue
- func (t *TimeColumnValue) AsBigInt() (BigIntNumber, error)
- func (t *TimeColumnValue) AsBool() (bool, error)
- func (t *TimeColumnValue) AsBytes() (b []byte, err error)
- func (t *TimeColumnValue) AsDecimal() (DecimalNumber, error)
- func (t *TimeColumnValue) AsString() (s string, err error)
- func (t *TimeColumnValue) AsTime() (time.Time, error)
- func (t *TimeColumnValue) Clone() ColumnValue
- func (t *TimeColumnValue) Cmp(right ColumnValue) (int, error)
- func (n *TimeColumnValue) IsNil() bool
- func (t *TimeColumnValue) String() string
- func (t *TimeColumnValue) Type() ColumnType
- type TimeDecoder
- type TimeEncoder
- type TransformError
Constants ¶
This section is empty.
Variables ¶
var ( ErrColumnExist = errors.New("column exist") //列存在错误 ErrColumnNotExist = errors.New("column does not exist") //列不存在错误 ErrNilValue = errors.New("column value is nil") //空值错误 ErrIndexOutOfRange = errors.New("column index is out of range") //索引值超出范围 ErrValueNotInt64 = errors.New("value is not int64") //不是int64错误 ErrValueInfinity = errors.New("value is infinity") //无穷大实数错误 ErrNotColumnValueClonable = errors.New("columnValue is not clonable") //不是可克隆列值 ErrNotColumnValueComparable = errors.New("columnValue is not comparable") //不是可比较列值 ErrColumnNameNotEqual = errors.New("column name is not equal") //列名不同 )
错误
var DefaultTimeFormat = "2006-01-02 15:04:05.999999999Z07:00"
DefaultTimeFormat 默认时间格式
Functions ¶
Types ¶
type BigIntColumnValue ¶
type BigIntColumnValue struct {
// contains filtered or unexported fields
}
BigIntColumnValue 整数列值
func (*BigIntColumnValue) AsBigInt ¶
func (b *BigIntColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 转化成整数
func (*BigIntColumnValue) AsBool ¶
func (b *BigIntColumnValue) AsBool() (bool, error)
AsBool 转化成布尔值,不是0的转化为true,是0的转化成false
func (*BigIntColumnValue) AsBytes ¶
func (b *BigIntColumnValue) AsBytes() ([]byte, error)
AsBytes 转化成字节流,如1234556790转化为1234556790
func (*BigIntColumnValue) AsDecimal ¶
func (b *BigIntColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 转化成高精度实数
func (*BigIntColumnValue) AsString ¶
func (b *BigIntColumnValue) AsString() (string, error)
AsString 转化成字符串,如1234556790转化为1234556790
func (*BigIntColumnValue) AsTime ¶
func (b *BigIntColumnValue) AsTime() (time.Time, error)
AsTime 目前整数无法转化成时间
func (*BigIntColumnValue) Cmp ¶
func (b *BigIntColumnValue) Cmp(right ColumnValue) (int, error)
Cmp 返回1代表大于, 0代表相等, -1代表小于
func (*BigIntColumnValue) String ¶
func (b *BigIntColumnValue) String() string
type BigIntNumber ¶
type BigIntNumber interface { Number Int64() (int64, error) Decimal() DecimalNumber CloneBigInt() BigIntNumber AsBigInt() *big.Int }
BigIntNumber 高精度整数
type BigIntStr ¶
type BigIntStr struct {
// contains filtered or unexported fields
}
BigIntStr 高精度整数
func (*BigIntStr) CloneDecimal ¶
func (b *BigIntStr) CloneDecimal() DecimalNumber
CloneDecimal 克隆高精度实数
type BoolColumnValue ¶
type BoolColumnValue struct {
// contains filtered or unexported fields
}
BoolColumnValue 布尔列值
func (*BoolColumnValue) AsBigInt ¶
func (b *BoolColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 转化成整数,true转化为1,false转化为0
func (*BoolColumnValue) AsBytes ¶
func (b *BoolColumnValue) AsBytes() ([]byte, error)
AsBytes 转化成字节流,true转化为"true",false转化为"false"
func (*BoolColumnValue) AsDecimal ¶
func (b *BoolColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 转化成高精度实数,true转化为1.0,false转化为0.0
func (*BoolColumnValue) AsString ¶
func (b *BoolColumnValue) AsString() (string, error)
AsString 转化成字符串,true转化为"true",false转化为"false"
func (*BoolColumnValue) AsTime ¶
func (b *BoolColumnValue) AsTime() (time.Time, error)
AsTime 目前布尔无法转化成时间
func (*BoolColumnValue) Cmp ¶
func (b *BoolColumnValue) Cmp(right ColumnValue) (int, error)
Cmp 返回1代表大于, 0代表相等, -1代表小于
func (*BoolColumnValue) String ¶
func (b *BoolColumnValue) String() string
type BytesColumnValue ¶
type BytesColumnValue struct { TimeEncoder //时间编码器 // contains filtered or unexported fields }
BytesColumnValue 字节流列值
func (*BytesColumnValue) AsBigInt ¶
func (b *BytesColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 转化为整数,实数型以及科学性计数法字符串会被取整,不是数值型的会报错 如123.67转化为123 123.12转化为123
func (*BytesColumnValue) AsBool ¶
func (b *BytesColumnValue) AsBool() (bool, error)
AsBool 1, t, T, TRUE, true, True转化为true 0, f, F, FALSE, false, False转化为false,如果不是上述情况会报错
func (*BytesColumnValue) AsBytes ¶
func (b *BytesColumnValue) AsBytes() ([]byte, error)
AsBytes 转化成字节流
func (*BytesColumnValue) AsDecimal ¶
func (b *BytesColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 转化为高精度师叔,实数型以及科学性计数法字符串能够转化,不是数值型的会报错
func (*BytesColumnValue) AsString ¶
func (b *BytesColumnValue) AsString() (string, error)
AsString 转化为字符串
func (*BytesColumnValue) AsTime ¶
func (b *BytesColumnValue) AsTime() (t time.Time, err error)
AsTime 根据时间编码器转化成时间,不符合时间编码器格式会报错
func (*BytesColumnValue) Cmp ¶
func (b *BytesColumnValue) Cmp(right ColumnValue) (int, error)
Cmp 返回1代表大于, 0代表相等, -1代表小于
func (*BytesColumnValue) String ¶
func (b *BytesColumnValue) String() string
type Column ¶
type Column interface { ColumnValue AsInt64() (int64, error) //转化为64位整数 AsFloat64() (float64, error) //转化为64位实数 Clone() (Column, error) //克隆 Cmp(Column) (int, error) //比较, 1代表大于, 0代表相等, -1代表小于 Name() string //列名 ByteSize() int64 //字节流大小 MemorySize() int64 //内存大小 }
Column 列
func NewDefaultColumn ¶
func NewDefaultColumn(v ColumnValue, name string, byteSize int) Column
NewDefaultColumn 根据列值v,列名name,字节流大小byteSize,生成默认列
type ColumnType ¶
type ColumnType string
ColumnType 列类型
const ( TypeUnknown ColumnType = "unknown" //未知类型 TypeBool ColumnType = "bool" //布尔类型 TypeBigInt ColumnType = "bigInt" //整数类型 TypeDecimal ColumnType = "decimal" //高精度实数类型 TypeString ColumnType = "string" //字符串类型 TypeBytes ColumnType = "bytes" //字节流类型 TypeTime ColumnType = "time" //时间类型 )
列类型枚举
type ColumnValue ¶
type ColumnValue interface { fmt.Stringer Type() ColumnType //列类型 IsNil() bool //是否为空 AsBool() (bool, error) //转化为布尔值 AsBigInt() (BigIntNumber, error) //转化为整数 AsDecimal() (DecimalNumber, error) //转化为高精度实数 AsString() (string, error) //转化为字符串 AsBytes() ([]byte, error) //转化为字节流 AsTime() (time.Time, error) // 转化为时间 }
ColumnValue 列值
func NewBigIntColumnValue ¶
func NewBigIntColumnValue(v *big.Int) ColumnValue
NewBigIntColumnValue 从big.Int v中获取整数列值
func NewBigIntColumnValueFromInt64 ¶
func NewBigIntColumnValueFromInt64(v int64) ColumnValue
NewBigIntColumnValueFromInt64 从int64 v中获取整数列值
func NewBigIntColumnValueFromString ¶
func NewBigIntColumnValueFromString(v string) (ColumnValue, error)
NewBigIntColumnValueFromString 从string v中获取整数列值 当string v不是整数时,返回错误
func NewBoolColumnValue ¶
func NewBoolColumnValue(v bool) ColumnValue
NewBoolColumnValue 从布尔值v生成布尔列值
func NewBytesColumnValue ¶
func NewBytesColumnValue(v []byte) ColumnValue
NewBytesColumnValue 从字节流v 生成字节流列值,做拷贝
func NewBytesColumnValueNoCopy ¶
func NewBytesColumnValueNoCopy(v []byte) ColumnValue
NewBytesColumnValueNoCopy 从字节流v 生成字节流列值,不做拷贝
func NewBytesColumnValueWithEncoder ¶
func NewBytesColumnValueWithEncoder(v []byte, e TimeEncoder) ColumnValue
NewBytesColumnValueWithEncoder 从字节流v 和时间编码器e 生成字节流列值,做拷贝
func NewBytesColumnValueWithEncoderNoCopy ¶
func NewBytesColumnValueWithEncoderNoCopy(v []byte, e TimeEncoder) ColumnValue
NewBytesColumnValueWithEncoderNoCopy 从字节流v 和时间编码器e,不做拷贝
func NewDecimalColumnValue ¶
func NewDecimalColumnValue(d decimal.Decimal) ColumnValue
NewDecimalColumnValue 根据高精度实数 d生成高精度实数列值
func NewDecimalColumnValueFromFloat ¶
func NewDecimalColumnValueFromFloat(f float64) ColumnValue
NewDecimalColumnValueFromFloat 根据float64 f生成高精度实数列值
func NewDecimalColumnValueFromString ¶
func NewDecimalColumnValueFromString(s string) (ColumnValue, error)
NewDecimalColumnValueFromString 根据字符串s生成高精度实数列值 不是数值型或者科学计数法的字符串,就会报错
func NewNilBigIntColumnValue ¶
func NewNilBigIntColumnValue() ColumnValue
NewNilBigIntColumnValue 创建空值整数列值
func NewNilBoolColumnValue ¶
func NewNilBoolColumnValue() ColumnValue
NewNilBoolColumnValue 生成空值布尔列值
func NewNilBytesColumnValue ¶
func NewNilBytesColumnValue() ColumnValue
NewNilBytesColumnValue 创建空值字节流列值
func NewNilDecimalColumnValue ¶
func NewNilDecimalColumnValue() ColumnValue
NewNilDecimalColumnValue 生成空值高精度实数型列值
func NewNilStringColumnValue ¶
func NewNilStringColumnValue() ColumnValue
NewNilStringColumnValue 创建空值字符串列值
func NewNilTimeColumnValue ¶
func NewNilTimeColumnValue() ColumnValue
NewNilTimeColumnValue 创建空值时间列值
func NewStringColumnValue ¶
func NewStringColumnValue(s string) ColumnValue
NewStringColumnValue 根据字符串s 生成字符串列值
func NewStringColumnValueWithEncoder ¶
func NewStringColumnValueWithEncoder(s string, e TimeEncoder) ColumnValue
NewStringColumnValueWithEncoder 根据字符串s 时间编码器e生成字符串列值
func NewTimeColumnValue ¶
func NewTimeColumnValue(t time.Time) ColumnValue
NewTimeColumnValue 根据时间t获得时间列值
func NewTimeColumnValueWithDecoder ¶
func NewTimeColumnValueWithDecoder(t time.Time, d TimeDecoder) ColumnValue
NewTimeColumnValueWithDecoder 根据时间t和时间解码器t获得时间列值
type ColumnValueClonable ¶
type ColumnValueClonable interface {
Clone() ColumnValue //克隆
}
ColumnValueClonable 可克隆列值
type ColumnValueComparabale ¶
type ColumnValueComparabale interface { //比较 1代表大于, 0代表相等, -1代表小于 Cmp(ColumnValue) (int, error) }
ColumnValueComparabale 可比较列值
type Converter ¶
type Converter struct{}
Converter 数字转化器
func (*Converter) ConvertBigInt ¶
func (c *Converter) ConvertBigInt(s string) (num BigIntNumber, err error)
ConvertBigInt 把字符串转化成整数
func (*Converter) ConvertBigIntFromInt ¶
func (c *Converter) ConvertBigIntFromInt(i int64) (num BigIntNumber)
ConvertBigIntFromInt 转化成实数
func (*Converter) ConvertDecimal ¶
func (c *Converter) ConvertDecimal(s string) (num DecimalNumber, err error)
ConvertDecimal 把字符串转化成实数
func (*Converter) ConvertDecimalFromFloat ¶
func (c *Converter) ConvertDecimalFromFloat(f float64) (num DecimalNumber)
ConvertDecimalFromFloat 转化成实数
type DecimalColumnValue ¶
type DecimalColumnValue struct {
// contains filtered or unexported fields
}
DecimalColumnValue 高精度实数列值
func (*DecimalColumnValue) AsBigInt ¶
func (d *DecimalColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 对高精度实数取整,如123.67转化为123 123.12转化为123
func (*DecimalColumnValue) AsBool ¶
func (d *DecimalColumnValue) AsBool() (bool, error)
AsBool 非0转化为true, 0转化为false
func (*DecimalColumnValue) AsBytes ¶
func (d *DecimalColumnValue) AsBytes() ([]byte, error)
AsBytes 转化为字节流, 如10.123 转化为10.123
func (*DecimalColumnValue) AsDecimal ¶
func (d *DecimalColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 转化为高精度实数
func (*DecimalColumnValue) AsString ¶
func (d *DecimalColumnValue) AsString() (string, error)
AsString 转化为字符串, 如10.123 转化为10.123
func (*DecimalColumnValue) AsTime ¶
func (d *DecimalColumnValue) AsTime() (time.Time, error)
AsTime 目前无法转化为时间
func (*DecimalColumnValue) Cmp ¶
func (d *DecimalColumnValue) Cmp(right ColumnValue) (int, error)
Cmp 返回1代表大于, 0代表相等, -1代表小于
func (*DecimalColumnValue) String ¶
func (d *DecimalColumnValue) String() string
type DecimalNumber ¶
type DecimalNumber interface { Number Float64() (float64, error) BigInt() BigIntNumber CloneDecimal() DecimalNumber AsDecimal() decimal.Decimal }
DecimalNumber 高精度实数
type DecimalStr ¶
type DecimalStr struct {
// contains filtered or unexported fields
}
DecimalStr 高精度实数
func (*DecimalStr) CloneDecimal ¶
func (d *DecimalStr) CloneDecimal() DecimalNumber
CloneDecimal 克隆高精度实数
type DefaultColumn ¶
type DefaultColumn struct { ColumnValue // 列值 // contains filtered or unexported fields }
DefaultColumn 默认值
func (*DefaultColumn) AsFloat64 ¶
func (d *DefaultColumn) AsFloat64() (float64, error)
AsFloat64 转化为64位实数
func (*DefaultColumn) Clone ¶
func (d *DefaultColumn) Clone() (Column, error)
Clone 克隆列,如果不是可克隆列值,就会报错
type DefaultRecord ¶
type DefaultRecord struct {
// contains filtered or unexported fields
}
DefaultRecord 默认记录
func (*DefaultRecord) GetByIndex ¶
func (r *DefaultRecord) GetByIndex(i int) (Column, error)
GetByIndex 获取第i列,若索引i超出范围或者不存在,就会报错
func (*DefaultRecord) GetByName ¶
func (r *DefaultRecord) GetByName(name string) (Column, error)
GetByName 获取列名为name的列,若列名为name的列不存在,就会报错
type NilBigIntColumnValue ¶
type NilBigIntColumnValue struct {
// contains filtered or unexported fields
}
NilBigIntColumnValue 空值整数列值
func (NilBigIntColumnValue) AsBigInt ¶
func (n NilBigIntColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 无法转化整数
func (NilBigIntColumnValue) AsDecimal ¶
func (n NilBigIntColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 无法转化高精度实数
func (*NilBigIntColumnValue) Clone ¶
func (n *NilBigIntColumnValue) Clone() ColumnValue
Clone 克隆空值整数列值
type NilBoolColumnValue ¶
type NilBoolColumnValue struct {
// contains filtered or unexported fields
}
NilBoolColumnValue 空值布尔列值
func (NilBoolColumnValue) AsBigInt ¶
func (n NilBoolColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 无法转化整数
func (NilBoolColumnValue) AsDecimal ¶
func (n NilBoolColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 无法转化高精度实数
type NilBytesColumnValue ¶
type NilBytesColumnValue struct {
// contains filtered or unexported fields
}
NilBytesColumnValue 空值字节流列值
func (NilBytesColumnValue) AsBigInt ¶
func (n NilBytesColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 无法转化整数
func (NilBytesColumnValue) AsDecimal ¶
func (n NilBytesColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 无法转化高精度实数
func (*NilBytesColumnValue) Clone ¶
func (n *NilBytesColumnValue) Clone() ColumnValue
Clone 克隆空值字节流列值
type NilDecimalColumnValue ¶
type NilDecimalColumnValue struct {
// contains filtered or unexported fields
}
NilDecimalColumnValue 空值高精度实数型列值
func (NilDecimalColumnValue) AsBigInt ¶
func (n NilDecimalColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 无法转化整数
func (NilDecimalColumnValue) AsDecimal ¶
func (n NilDecimalColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 无法转化高精度实数
type NilStringColumnValue ¶
type NilStringColumnValue struct {
// contains filtered or unexported fields
}
NilStringColumnValue 空值字符串列值
func (NilStringColumnValue) AsBigInt ¶
func (n NilStringColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 无法转化整数
func (NilStringColumnValue) AsDecimal ¶
func (n NilStringColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 无法转化高精度实数
func (*NilStringColumnValue) Clone ¶
func (n *NilStringColumnValue) Clone() ColumnValue
Clone 克隆空值字符串
type NilTimeColumnValue ¶
type NilTimeColumnValue struct {
// contains filtered or unexported fields
}
NilTimeColumnValue 空值时间列值
func (NilTimeColumnValue) AsBigInt ¶
func (n NilTimeColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 无法转化整数
func (NilTimeColumnValue) AsDecimal ¶
func (n NilTimeColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 无法转化高精度实数
type NumberConverter ¶
type NumberConverter interface { ConvertBigIntFromInt(i int64) (num BigIntNumber) ConvertDecimalFromFloat(f float64) (num DecimalNumber) ConvertBigInt(s string) (num BigIntNumber, err error) ConvertDecimal(s string) (num DecimalNumber, err error) }
NumberConverter 数字转化器
type OldConverter ¶
type OldConverter struct{}
OldConverter 无检查转化
func (*OldConverter) ConvertBigInt ¶
func (c *OldConverter) ConvertBigInt(s string) (num BigIntNumber, err error)
ConvertBigInt 把字符串转化成整数
func (*OldConverter) ConvertBigIntFromInt ¶
func (c *OldConverter) ConvertBigIntFromInt(i int64) (num BigIntNumber)
ConvertBigIntFromInt 转化成实数
func (*OldConverter) ConvertDecimal ¶
func (c *OldConverter) ConvertDecimal(s string) (num DecimalNumber, err error)
ConvertDecimal 把字符串转化成实数
func (*OldConverter) ConvertDecimalFromFloat ¶
func (c *OldConverter) ConvertDecimalFromFloat(f float64) (num DecimalNumber)
ConvertDecimalFromFloat 转化成实数
type Record ¶
type Record interface { fmt.Stringer Add(Column) error //新增列 GetByIndex(i int) (Column, error) //获取第i个列 GetByName(name string) (Column, error) //获取列名为name的列 Set(i int, c Column) error //设置第i列 Put(c Column) error //设置对应列 ColumnNumber() int //获取列数 ByteSize() int64 //字节流大小 MemorySize() int64 //内存大小 }
Record 记录
type RecordChan ¶
type RecordChan struct {
// contains filtered or unexported fields
}
RecordChan 记录通道 修复内存溢出
func NewRecordChanBuffer ¶
func NewRecordChanBuffer(ctx context.Context, n int) *RecordChan
NewRecordChanBuffer 创建容量n的记录通道
func (*RecordChan) PopFront ¶
func (c *RecordChan) PopFront() (r Record, ok bool)
PopFront 在头部弹出记录r,并且返回是否还有值
func (*RecordChan) PopFrontAll ¶
func (c *RecordChan) PopFrontAll(onRecord func(Record) error) error
PopFrontAll 通过函数onRecord从头部弹出所有记录
func (*RecordChan) PushBack ¶
func (c *RecordChan) PushBack(r Record) int
PushBack 在尾部追加记录r,并且返回队列大小
func (*RecordChan) PushBackAll ¶
func (c *RecordChan) PushBackAll(fetchRecord func() (Record, error)) error
PushBackAll 通过函数fetchRecord获取多个记录,在尾部追加
type SetError ¶
type SetError struct {
// contains filtered or unexported fields
}
SetError 设置错误
func NewSetError ¶
func NewSetError(i interface{}, other ColumnType, err error) *SetError
NewSetError 通过值i设置成累心other类型的错误err生成设置错误
type StringColumnValue ¶
type StringColumnValue struct { TimeEncoder // contains filtered or unexported fields }
StringColumnValue 字符串列名 注意:Decimal 123.0(val:1230,exp:-1)和123(val:123,exp:0)不一致
func (*StringColumnValue) AsBigInt ¶
func (s *StringColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 转化为整数,实数型以及科学性计数法字符串会被取整,不是数值型的会报错 如123.67转化为123 123.12转化为123
func (*StringColumnValue) AsBool ¶
func (s *StringColumnValue) AsBool() (v bool, err error)
AsBool 1, t, T, TRUE, true, True转化为true 0, f, F, FALSE, false, False转化为false,如果不是上述情况会报错
func (*StringColumnValue) AsBytes ¶
func (s *StringColumnValue) AsBytes() ([]byte, error)
AsBytes 转化成字节流
func (*StringColumnValue) AsDecimal ¶
func (s *StringColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 转化为整数,实数型以及科学性计数法字符串能够转化,不是数值型的会报错
func (*StringColumnValue) AsString ¶
func (s *StringColumnValue) AsString() (string, error)
AsString 转化为字符串
func (*StringColumnValue) AsTime ¶
func (s *StringColumnValue) AsTime() (t time.Time, err error)
AsTime 根据时间编码器转化成时间,不符合时间编码器格式会报错
func (*StringColumnValue) Cmp ¶
func (s *StringColumnValue) Cmp(right ColumnValue) (int, error)
Cmp 返回1代表大于, 0代表相等, -1代表小于
func (*StringColumnValue) String ¶
func (s *StringColumnValue) String() string
type StringTimeDecoder ¶
type StringTimeDecoder struct {
// contains filtered or unexported fields
}
StringTimeDecoder 字符串时间编码器
func (*StringTimeDecoder) Layout ¶ added in v0.1.1
func (d *StringTimeDecoder) Layout() string
Layout 时间格式
func (*StringTimeDecoder) TimeDecode ¶
func (d *StringTimeDecoder) TimeDecode(t time.Time) (interface{}, error)
TimeDecode 根据go时间格式layout的字符串时间编码成string
type StringTimeEncoder ¶
type StringTimeEncoder struct {
// contains filtered or unexported fields
}
StringTimeEncoder 字符串时间编码器
func (*StringTimeEncoder) TimeEncode ¶
func (e *StringTimeEncoder) TimeEncode(i interface{}) (time.Time, error)
TimeEncode 编码成时间,若i不是string或者不是layout格式,会报错
type TerminateRecord ¶
type TerminateRecord struct{}
TerminateRecord 终止记录
func (*TerminateRecord) ColumnNumber ¶
func (t *TerminateRecord) ColumnNumber() int
ColumnNumber 空方法
func (*TerminateRecord) GetByIndex ¶
func (t *TerminateRecord) GetByIndex(i int) (Column, error)
GetByIndex 空方法
type TimeColumnValue ¶
type TimeColumnValue struct { TimeDecoder //时间解码器 // contains filtered or unexported fields }
TimeColumnValue 时间列值
func (*TimeColumnValue) AsBigInt ¶
func (t *TimeColumnValue) AsBigInt() (BigIntNumber, error)
AsBigInt 无法转化整数
func (*TimeColumnValue) AsBytes ¶
func (t *TimeColumnValue) AsBytes() (b []byte, err error)
AsBytes 变为字节流
func (*TimeColumnValue) AsDecimal ¶
func (t *TimeColumnValue) AsDecimal() (DecimalNumber, error)
AsDecimal 无法转化高精度实数
func (*TimeColumnValue) AsString ¶
func (t *TimeColumnValue) AsString() (s string, err error)
AsString 变为字符串
func (*TimeColumnValue) Cmp ¶
func (t *TimeColumnValue) Cmp(right ColumnValue) (int, error)
Cmp 返回1代表大于, 0代表相等, -1代表小于
func (*TimeColumnValue) String ¶
func (t *TimeColumnValue) String() string
type TimeDecoder ¶
TimeDecoder 时间解码器
func NewStringTimeDecoder ¶
func NewStringTimeDecoder(layout string) TimeDecoder
NewStringTimeDecoder 根据go时间格式layout的字符串时间编码器
type TimeEncoder ¶
TimeEncoder 时间编码器
func NewStringTimeEncoder ¶
func NewStringTimeEncoder(layout string) TimeEncoder
NewStringTimeEncoder 根据go时间格式layout的字符串时间编码器
type TransformError ¶
type TransformError struct {
// contains filtered or unexported fields
}
TransformError 转化错误
func NewTransformError ¶
func NewTransformError(msg string, err error) *TransformError
NewTransformError 根据消息msg和错误err生成转化错误
func NewTransformErrorFormColumnTypes ¶
func NewTransformErrorFormColumnTypes(one, other ColumnType, err error) *TransformError
NewTransformErrorFormColumnTypes 从one类型到other类型转化错误err生成转化错误
func NewTransformErrorFormString ¶
func NewTransformErrorFormString(one, other string, err error) *TransformError
NewTransformErrorFormString 从one到other转化错误err生成转化错误
func (*TransformError) Error ¶
func (e *TransformError) Error() string
func (*TransformError) Unwrap ¶
func (e *TransformError) Unwrap() error