data

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateFormat      = "2006-01-02"
	DateTimeFormat  = "2006-01-02 15:04:05"
	TimeStampFormat = "2006-01-02 15:04:05.000"
)

Variables

View Source
var InvalidDecimalErr = errors.New("invalid decimal")
View Source
var Null = NullData{}

Functions

func IsDataEqual

func IsDataEqual(d1 Data, d2 Data) bool

Types

type Array

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

func ArrayFromSlice

func ArrayFromSlice(data ...interface{}) (*Array, error)

func NewArray

func NewArray() *Array

func NewArrayWithType

func NewArrayWithType(typ *datatype.ArrayType) *Array

func (*Array) Append

func (a *Array) Append(data ...interface{}) error

func (*Array) Index

func (a *Array) Index(i int) Data

func (*Array) Len

func (a *Array) Len() int

func (*Array) SafeAppend

func (a *Array) SafeAppend(data ...interface{}) error

func (*Array) Scan

func (a *Array) Scan(value interface{}) error

func (*Array) SetType

func (a *Array) SetType(typ *datatype.ArrayType)

func (*Array) Sql

func (a *Array) Sql() string

func (*Array) String

func (a *Array) String() string

func (*Array) ToSlice

func (a *Array) ToSlice() []Data

func (*Array) Type

func (a *Array) Type() datatype.DataType

func (*Array) TypeInfer

func (a *Array) TypeInfer() (datatype.DataType, error)

func (*Array) UnSafeAppend

func (a *Array) UnSafeAppend(data ...Data)

type BigInt

type BigInt int64

func (*BigInt) Scan

func (b *BigInt) Scan(value interface{}) error

func (BigInt) Sql

func (b BigInt) Sql() string

func (BigInt) String

func (b BigInt) String() string

func (BigInt) Type

func (b BigInt) Type() datatype.DataType

type Binary

type Binary []byte

func (*Binary) Scan

func (b *Binary) Scan(value interface{}) error

func (Binary) Sql

func (b Binary) Sql() string

func (Binary) String

func (b Binary) String() string

func (Binary) Type

func (b Binary) Type() datatype.DataType

type Bool

type Bool bool

func (*Bool) Scan

func (b *Bool) Scan(value interface{}) error

func (Bool) Sql

func (b Bool) Sql() string

func (Bool) String

func (b Bool) String() string

func (Bool) Type

func (b Bool) Type() datatype.DataType

type Char

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

func NewChar

func NewChar(length int, data string) (*Char, error)

func (*Char) Data

func (c *Char) Data() string

func (*Char) Scan

func (c *Char) Scan(value interface{}) error

func (*Char) Sql

func (c *Char) Sql() string

func (*Char) String

func (c *Char) String() string

func (*Char) Type

func (c *Char) Type() datatype.DataType

type CharOverflowError

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

func NewCharOverflowError

func NewCharOverflowError(maxLen, realLen int) CharOverflowError

func (CharOverflowError) Error

func (c CharOverflowError) Error() string

type Data

type Data interface {
	Type() datatype.DataType
	fmt.Stringer
	Sql() string
}

func TryConvertGoToOdpsData

func TryConvertGoToOdpsData(i interface{}) (Data, error)

type Date

type Date time.Time

func NewDate

func NewDate(s string) (Date, error)

func (*Date) Scan

func (d *Date) Scan(value interface{}) error

func (Date) Sql

func (d Date) Sql() string

func (Date) String

func (d Date) String() string

func (Date) Time

func (d Date) Time() time.Time

func (Date) Type

func (d Date) Type() datatype.DataType

type DateTime

type DateTime time.Time

func NewDateTime

func NewDateTime(s string) (DateTime, error)

func (*DateTime) Scan

func (d *DateTime) Scan(value interface{}) error

func (DateTime) Sql

func (d DateTime) Sql() string

func (DateTime) String

func (d DateTime) String() string

func (DateTime) Time

func (d DateTime) Time() time.Time

func (DateTime) Type

func (d DateTime) Type() datatype.DataType

type Decimal

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

func DecimalFromStr

func DecimalFromStr(value string) (*Decimal, error)

func NewDecimal

func NewDecimal(precision, scale int, value string) *Decimal

func (*Decimal) Precision

func (d *Decimal) Precision() int

func (*Decimal) Scale

func (d *Decimal) Scale() int

func (*Decimal) Scan

func (d *Decimal) Scan(value interface{}) error

func (*Decimal) Sql

func (d *Decimal) Sql() string

func (*Decimal) String

func (d *Decimal) String() string

func (*Decimal) Type

func (d *Decimal) Type() datatype.DataType

func (*Decimal) Value

func (d *Decimal) Value() string

type Double

type Double float64

func (*Double) Scan

func (d *Double) Scan(value interface{}) error

func (Double) Sql

func (d Double) Sql() string

func (Double) String

func (d Double) String() string

func (Double) Type

func (d Double) Type() datatype.DataType

type Float

type Float float32

func (*Float) Scan

func (f *Float) Scan(value interface{}) error

func (Float) Sql

func (f Float) Sql() string

func (Float) String

func (f Float) String() string

func (Float) Type

func (f Float) Type() datatype.DataType

type Int

type Int int32

func (*Int) Scan

func (i *Int) Scan(value interface{}) error

func (Int) Sql

func (i Int) Sql() string

func (Int) String

func (i Int) String() string

func (Int) Type

func (i Int) Type() datatype.DataType

type IntervalDayTime

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

func NewIntervalDayTime

func NewIntervalDayTime(totalSeconds int64, nanos int32) IntervalDayTime

func (IntervalDayTime) Days

func (i IntervalDayTime) Days() int32

func (IntervalDayTime) Hours

func (i IntervalDayTime) Hours() int32

func (IntervalDayTime) MillisecondsFraction

func (i IntervalDayTime) MillisecondsFraction() int32

func (IntervalDayTime) Minutes

func (i IntervalDayTime) Minutes() int32

func (IntervalDayTime) NanosFraction

func (i IntervalDayTime) NanosFraction() int32

func (*IntervalDayTime) Scan

func (i *IntervalDayTime) Scan(value interface{}) error

func (IntervalDayTime) Seconds

func (i IntervalDayTime) Seconds() int64

func (IntervalDayTime) SecondsFraction

func (i IntervalDayTime) SecondsFraction() int32

func (IntervalDayTime) Sql

func (i IntervalDayTime) Sql() string

func (IntervalDayTime) String

func (i IntervalDayTime) String() string

func (IntervalDayTime) Type

type IntervalYearMonth

type IntervalYearMonth int32

func (*IntervalYearMonth) Scan

func (i *IntervalYearMonth) Scan(value interface{}) error

func (IntervalYearMonth) Sql

func (i IntervalYearMonth) Sql() string

func (IntervalYearMonth) String

func (i IntervalYearMonth) String() string

func (IntervalYearMonth) Type

type Map

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

func MapFromGoMap

func MapFromGoMap(m interface{}) (*Map, error)

func NewMap

func NewMap() *Map

func NewMapWithType

func NewMapWithType(typ *datatype.MapType) *Map

func (*Map) SafeSet

func (m *Map) SafeSet(keyI Data, valueI Data) error

func (*Map) Scan

func (m *Map) Scan(value interface{}) error

func (*Map) Set

func (m *Map) Set(keyI interface{}, valueI interface{}) error

func (*Map) Sql

func (m *Map) Sql() string

func (*Map) String

func (m *Map) String() string

func (*Map) ToGoMap

func (m *Map) ToGoMap() map[Data]Data

func (*Map) Type

func (m *Map) Type() datatype.DataType

func (*Map) TypeInfer

func (m *Map) TypeInfer() (datatype.DataType, error)

type NullData

type NullData struct{}

func (NullData) Scan

func (n NullData) Scan(interface{}) error

func (NullData) Sql

func (n NullData) Sql() string

func (NullData) String

func (n NullData) String() string

func (NullData) Type

func (n NullData) Type() datatype.DataType

type Record

type Record []Data

func NewRecord

func NewRecord(columnNums int) Record

func (*Record) Append

func (r *Record) Append(d Data)

func (*Record) Get

func (r *Record) Get(i int) Data

func (*Record) Len

func (r *Record) Len() int

func (*Record) String

func (r *Record) String() string

type SmallInt

type SmallInt int16

func (SmallInt) Sql

func (s SmallInt) Sql() string

func (SmallInt) String

func (s SmallInt) String() string

func (SmallInt) Type

func (s SmallInt) Type() datatype.DataType

type String

type String string

func (*String) Scan

func (s *String) Scan(value interface{}) error

func (*String) Sql

func (s *String) Sql() string

func (*String) String

func (s *String) String() string

func (*String) Type

func (s *String) Type() datatype.DataType

type Struct

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

Struct 这里用slice而不用map,是要保持Field顺序

func NewStruct

func NewStruct() *Struct

func NewStructWithTyp

func NewStructWithTyp(typ *datatype.StructType) *Struct

func StructFromGoStruct

func StructFromGoStruct(i interface{}) (*Struct, error)

func (*Struct) Fields

func (s *Struct) Fields() []StructField

func (*Struct) FillGoStruct

func (s *Struct) FillGoStruct(i interface{}) error

func (*Struct) GetField

func (s *Struct) GetField(fieldName string) Data

func (*Struct) SafeSetField

func (s *Struct) SafeSetField(fieldName string, i interface{}) error

func (*Struct) Scan

func (s *Struct) Scan(value interface{}) error

func (*Struct) SetField

func (s *Struct) SetField(fieldName string, a interface{}) error

func (*Struct) Sql

func (s *Struct) Sql() string

func (*Struct) String

func (s *Struct) String() string

func (*Struct) Type

func (s *Struct) Type() datatype.DataType

func (*Struct) TypeInfer

func (s *Struct) TypeInfer() (datatype.DataType, error)

type StructField

type StructField struct {
	Name  string
	Value Data
}

func NewStructField

func NewStructField(name string, value Data) StructField

type Timestamp

type Timestamp time.Time

func NewTimestamp

func NewTimestamp(s string) (Timestamp, error)

func (*Timestamp) Scan

func (t *Timestamp) Scan(value interface{}) error

func (Timestamp) Sql

func (t Timestamp) Sql() string

func (Timestamp) String

func (t Timestamp) String() string

func (Timestamp) Time

func (t Timestamp) Time() time.Time

func (Timestamp) Type

func (t Timestamp) Type() datatype.DataType

type TinyInt

type TinyInt int8

func (*TinyInt) Scan

func (t *TinyInt) Scan(value interface{}) error

func (TinyInt) Sql

func (t TinyInt) Sql() string

func (TinyInt) String

func (t TinyInt) String() string

func (TinyInt) Type

func (t TinyInt) Type() datatype.DataType

type VarChar

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

func NewVarChar

func NewVarChar(length int, data string) (*VarChar, error)

func (*VarChar) Data

func (v *VarChar) Data() string

func (*VarChar) Scan

func (v *VarChar) Scan(value interface{}) error

func (*VarChar) Sql

func (v *VarChar) Sql() string

func (*VarChar) String

func (v *VarChar) String() string

func (*VarChar) Type

func (v *VarChar) Type() datatype.DataType

Jump to

Keyboard shortcuts

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