datatype

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BigIntType = PrimitiveType{BIGINT}
View Source
var BinaryType = PrimitiveType{BINARY}
View Source
var BooleanType = PrimitiveType{BOOLEAN}
View Source
var DateTimeType = PrimitiveType{DATETIME}
View Source
var DateType = PrimitiveType{DATE}
View Source
var DoubleType = PrimitiveType{DOUBLE}
View Source
var FloatType = PrimitiveType{FLOAT}
View Source
var IntType = PrimitiveType{INT}
View Source
var IntervalDayTimeType = PrimitiveType{IntervalDayTime}
View Source
var IntervalYearMonthType = PrimitiveType{IntervalYearMonth}
View Source
var NullType = PrimitiveType{NULL}
View Source
var SmallIntType = PrimitiveType{SMALLINT}
View Source
var StringType = PrimitiveType{STRING}
View Source
var TimestampType = PrimitiveType{TIMESTAMP}
View Source
var TinyIntType = PrimitiveType{TINYINT}

Functions

func IsNullType

func IsNullType(t DataType) bool

func IsTypeEqual

func IsTypeEqual(t1, t2 DataType) bool

Types

type ArrayType

type ArrayType struct {
	ElementType DataType
}

func NewArrayType

func NewArrayType(elementType DataType) ArrayType

func (ArrayType) ID

func (a ArrayType) ID() TypeID

func (ArrayType) Name

func (a ArrayType) Name() string

func (ArrayType) String

func (a ArrayType) String() string

type CharType

type CharType struct {
	Length int
}

func NewCharType

func NewCharType(length int) CharType

func (CharType) ID

func (c CharType) ID() TypeID

func (CharType) Name

func (c CharType) Name() string

func (CharType) String

func (c CharType) String() string

type ColumnDataType

type ColumnDataType struct {
	DataType
}

type DataType

type DataType interface {
	ID() TypeID
	Name() string
}

func ParseDataType

func ParseDataType(name string) (DataType, error)

func TryConvertGoToOdpsType

func TryConvertGoToOdpsType(i interface{}) (DataType, error)

type DecimalType

type DecimalType struct {
	Precision int32
	Scale     int32
}

func NewDecimalType

func NewDecimalType(precision, scale int32) DecimalType

func (DecimalType) ID

func (d DecimalType) ID() TypeID

func (DecimalType) Name

func (d DecimalType) Name() string

func (DecimalType) String

func (d DecimalType) String() string

type JsonType added in v0.2.4

type JsonType struct {
}

func NewJsonType added in v0.2.4

func NewJsonType() JsonType

func (JsonType) ID added in v0.2.4

func (j JsonType) ID() TypeID

func (JsonType) Name added in v0.2.4

func (j JsonType) Name() string

type MapType

type MapType struct {
	KeyType   DataType
	ValueType DataType
}

func NewMapType

func NewMapType(keyType, valueType DataType) MapType

func (MapType) ID

func (m MapType) ID() TypeID

func (MapType) Name

func (m MapType) Name() string

func (MapType) String

func (m MapType) String() string

type PrimitiveType

type PrimitiveType struct {
	TypeCode TypeID
}

func NewPrimitiveType

func NewPrimitiveType(code TypeID) PrimitiveType

func (PrimitiveType) ID

func (p PrimitiveType) ID() TypeID

func (PrimitiveType) Name

func (p PrimitiveType) Name() string

func (PrimitiveType) String

func (p PrimitiveType) String() string

type StructFieldType

type StructFieldType struct {
	Name string
	Type DataType
}

func NewStructFieldType

func NewStructFieldType(name string, _type DataType) StructFieldType

type StructFields

type StructFields []StructFieldType

func (StructFields) Len

func (s StructFields) Len() int

func (StructFields) Less

func (s StructFields) Less(i, j int) bool

func (StructFields) Swap

func (s StructFields) Swap(i, j int)

type StructType

type StructType struct {
	Fields []StructFieldType
}

func NewStructType

func NewStructType(fields ...StructFieldType) StructType

func (StructType) FieldType

func (s StructType) FieldType(fileName string) DataType

func (StructType) ID

func (s StructType) ID() TypeID

func (StructType) Name

func (s StructType) Name() string

func (StructType) String

func (s StructType) String() string

type TypeID

type TypeID int
const (
	NULL TypeID = iota
	BIGINT
	DOUBLE
	BOOLEAN
	DATETIME
	STRING
	DECIMAL
	MAP
	ARRAY
	VOID
	TINYINT
	SMALLINT
	INT
	FLOAT
	CHAR
	VARCHAR
	DATE
	TIMESTAMP
	BINARY
	IntervalDayTime
	IntervalYearMonth
	STRUCT
	JSON
	TypeUnknown
)

func TypeCodeFromStr

func TypeCodeFromStr(s string) TypeID

func (TypeID) String

func (t TypeID) String() string

func (*TypeID) UnmarshalJSON

func (t *TypeID) UnmarshalJSON(b []byte) error

type VarcharType

type VarcharType struct {
	Length int
}

func NewVarcharType

func NewVarcharType(length int) VarcharType

func (VarcharType) ID

func (c VarcharType) ID() TypeID

func (VarcharType) Name

func (c VarcharType) Name() string

func (VarcharType) String

func (c VarcharType) String() string

Jump to

Keyboard shortcuts

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