ckdb

package
v0.0.0-...-b8a1a0e Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DF_STORAGE_POLICY     = "df_storage"
	DF_CLUSTER            = "df_cluster"
	DF_REPLICATED_CLUSTER = "df_replicated_cluster"
	DF_TIMEZONE           = "Asia/Shanghai"
)
View Source
const (
	METRICS_DB    = "flow_metrics"
	LOCAL_SUBFFIX = "_local"
)
View Source
const DEFAULT_COLUMN_COUNT = 256

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

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

func NewBlock

func NewBlock(batch driver.Batch) *Block

func (*Block) Send

func (b *Block) Send() error

func (*Block) Write

func (b *Block) Write(v ...interface{})

func (*Block) WriteAll

func (b *Block) WriteAll() error

func (*Block) WriteBool

func (b *Block) WriteBool(v bool)

func (*Block) WriteDateTime

func (b *Block) WriteDateTime(v uint32)

func (*Block) WriteIPv4

func (b *Block) WriteIPv4(v uint32)

func (*Block) WriteIPv6

func (b *Block) WriteIPv6(v net.IP)

type CodecType

type CodecType uint8
const (
	CodecDefault CodecType = iota // lz4
	CodecLZ4
	CodecLZ4HC
	CodecZSTD
	CodecT64
	CodecDelta
	CodecDoubleDelta
	CodecGorilla
	CodecNone
)

func (CodecType) String

func (t CodecType) String() string

type ColdStorage

type ColdStorage struct {
	Enabled   bool
	Type      DiskType
	Name      string
	TTLToMove int // after 'TTLToMove' hours, then move data to cold storage
}

func GetColdStorage

func GetColdStorage(coldStorages map[string]*ColdStorage, db, table string) *ColdStorage

type Column

type Column struct {
	Name    string     // 列名
	Type    ColumnType // 数据类型
	Codec   CodecType  // 压缩算法
	Index   IndexType  // 二级索引
	GroupBy bool       // 在AggregatingMergeTree表中用于group by的字段
	Comment string     // 列注释
}

func NewColumn

func NewColumn(name string, t ColumnType) *Column

func NewColumnWithGroupBy

func NewColumnWithGroupBy(name string, t ColumnType) *Column

func NewColumns

func NewColumns(names []string, t ColumnType) []*Column

func NewColumnsWithComment

func NewColumnsWithComment(nameComments [][2]string, t ColumnType) []*Column

nameComments: 需要同时创建的列列表,列表元素是长度为2的字符串数组, 第一个元素是列名,第二个是注释内容

func (*Column) MakeModifyTimeZoneSQL

func (c *Column) MakeModifyTimeZoneSQL(database, table, timeZone string) string

func (*Column) SetCodec

func (c *Column) SetCodec(ct CodecType) *Column

func (*Column) SetComment

func (c *Column) SetComment(comment string) *Column

func (*Column) SetGroupBy

func (c *Column) SetGroupBy() *Column

func (*Column) SetIndex

func (c *Column) SetIndex(i IndexType) *Column

type ColumnType

type ColumnType uint8
const (
	UInt64 ColumnType = iota
	UInt64Nullable
	UInt32
	UInt32Nullable
	UInt16
	UInt16Nullable
	UInt8
	UInt8Nullable
	Int64
	Int64Nullable
	Int32
	Int32Nullable
	Int16
	Int16Nullable
	Int8
	Int8Nullable
	Float64
	Float64Nullable
	String
	IPv6
	IPv4
	ArrayString
	ArrayUInt8
	ArrayUInt16
	ArrayUInt32
	ArrayInt64
	ArrayFloat64
	DateTime
	DateTime64
	DateTime64ms
	DateTime64us
	FixString8
	LowCardinalityString
	ArrayLowCardinalityString
)

func (ColumnType) HasDFTimeZone

func (t ColumnType) HasDFTimeZone() bool

func (ColumnType) String

func (t ColumnType) String() string

type DiskType

type DiskType uint8
const (
	Volume DiskType = iota
	Disk
)

func (DiskType) String

func (t DiskType) String() string

type EngineType

type EngineType uint8
const (
	Distributed EngineType = iota
	MergeTree
	ReplicatedMergeTree
	AggregatingMergeTree
	ReplicatedAggregatingMergeTree
	ReplacingMergeTree
	SummingMergeTree
)

func (EngineType) String

func (t EngineType) String() string

type IndexType

type IndexType uint8
const (
	IndexNone IndexType = iota
	IndexMinmax
	IndexSet
	IndexBloomfilter
)

func (IndexType) String

func (t IndexType) String() string

type Table

type Table struct {
	Version         string       // 表版本,用于表结构变更时,做自动更新
	ID              uint8        // id
	Database        string       // 所属数据库名
	LocalName       string       // 本地表名
	GlobalName      string       // 全局表名
	Columns         []*Column    // 表列结构
	TimeKey         string       // 时间字段名,用来设置partition和ttl
	SummingKey      string       // When using SummingMergeEngine, this field is used for Summing aggregation
	TTL             int          // 数据默认保留时长。 单位:小时
	ColdStorage     ColdStorage  // 冷存储配置
	PartitionFunc   TimeFuncType // partition函数作用于Time,
	Cluster         string       // 对应的cluster
	StoragePolicy   string       // 存储策略
	Engine          EngineType   // 表引擎
	OrderKeys       []string     // 排序的key
	PrimaryKeyCount int          // 一级索引的key的个数, 从orderKeys中数前n个,
}

func (*Table) MakeGlobalTableCreateSQL

func (t *Table) MakeGlobalTableCreateSQL() string

func (*Table) MakeLocalTableCreateSQL

func (t *Table) MakeLocalTableCreateSQL() string

func (*Table) MakePrepareTableInsertSQL

func (t *Table) MakePrepareTableInsertSQL() string

type TimeFuncType

type TimeFuncType uint8
const (
	TimeFuncNone TimeFuncType = iota
	TimeFuncMinute
	TimeFuncTenMinute
	TimeFuncHour
	TimeFuncTwoHour
	TimeFuncFourHour
	TimeFuncTwelveHour
	TimeFuncDay
	TimeFuncWeek
	TimeFuncMonth
	TimeFuncYYYYMM
	TimeFuncYYYYMMDD
)

func (TimeFuncType) String

func (t TimeFuncType) String(timeKey string) string

Jump to

Keyboard shortcuts

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