clickhouse

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TAG_PARTITION defines expression of PARTITION BY
	TAG_PARTITION = "clickhouse_partition_by"

	// TAG_ORDER defines fields of ORDER BY
	TAG_ORDER = "clickhouse_order_by"

	// TAG_TTL defines table TTL
	TAG_TTL = "clickhouse_ttl"

	EXTRA_OPTION_ENGINE_KEY             = "clickhouse_engine"
	EXTRA_OPTION_ENGINE_VALUE_MERGETRUE = "MergeTree"
	EXTRA_OPTION_ENGINE_VALUE_MYSQL     = "MySQL"

	// 'host:port', 'database', 'table', 'user', 'password'
	EXTRA_OPTION_CLICKHOUSE_MYSQL_HOSTPORT_KEY = "clickhouse_mysql_hostport"
	EXTRA_OPTION_CLICKHOUSE_MYSQL_DATABASE_KEY = "clickhouse_mysql_database"
	EXTRA_OPTION_CLICKHOUSE_MYSQL_TABLE_KEY    = "clickhouse_mysql_table"
	EXTRA_OPTION_CLICKHOUSE_MYSQL_USERNAME_KEY = "clickhouse_mysql_username"
	EXTRA_OPTION_CLICKHOUSE_MYSQL_PASSWORD_KEY = "clickhouse_mysql_password"
)

Variables

This section is empty.

Functions

func MySQLExtraOptions

func MySQLExtraOptions(hostport, database, table, user, passwd string) sqlchemy.TableExtraOptions

Types

type CompoundColumn

type CompoundColumn struct {
	STextColumn
	sqlchemy.SBaseCompoundColumn
}

CompoundColumn represents a column of compound tye, e.g. a JSON, an Array, or a struct

func NewCompoundColumn

func NewCompoundColumn(name string, tagmap map[string]string, isPointer bool) CompoundColumn

NewCompoundColumn returns an instance of CompoundColumn

func (*CompoundColumn) ConvertFromString

func (c *CompoundColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of CompoundColumn for IColumnSpec

func (*CompoundColumn) ConvertFromValue

func (c *CompoundColumn) ConvertFromValue(val interface{}) interface{}

ConvertFromValue implementation of CompoundColumn for IColumnSpec

func (*CompoundColumn) DefinitionString

func (c *CompoundColumn) DefinitionString() string

DefinitionString implementation of CompoundColumn for IColumnSpec

func (*CompoundColumn) IsZero

func (c *CompoundColumn) IsZero(val interface{}) bool

IsZero implementation of CompoundColumn for IColumnSpec

type IClickhouseColumnSpec

type IClickhouseColumnSpec interface {
	sqlchemy.IColumnSpec

	// IsOrderBy defines whether the column appears in order by clause
	IsOrderBy() bool

	// PartitionBy defines expression that the column appaers in Partition by clause
	PartitionBy() string

	// SetOrderBy set isOrderBy field
	SetOrderBy(on bool)

	// SetPartitionBy set partitonby field
	SetPartitionBy(expr string)

	// GetTTL returns the ttl setting of a time column
	GetTTL() (int, string)

	// SetTTL sets the ttl parameters of a time column
	SetTTL(int, string)
}

type SBooleanColumn

type SBooleanColumn struct {
	SClickhouseBaseColumn
}

SBooleanColumn represents a boolean type column, which is a int(1) for mysql, with value of true or false

func NewBooleanColumn

func NewBooleanColumn(name string, tagmap map[string]string, isPointer bool) SBooleanColumn

NewBooleanColumn return an instance of SBooleanColumn

func (*SBooleanColumn) ConvertFromString

func (c *SBooleanColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of SBooleanColumn for IColumnSpec

func (*SBooleanColumn) ConvertFromValue

func (c *SBooleanColumn) ConvertFromValue(val interface{}) interface{}

ConvertFromValue implementation of STristateColumn for IColumnSpec

func (*SBooleanColumn) DefinitionString

func (c *SBooleanColumn) DefinitionString() string

DefinitionString implementation of SBooleanColumn for IColumnSpec

func (*SBooleanColumn) IsZero

func (c *SBooleanColumn) IsZero(val interface{}) bool

IsZero implementation of SBooleanColumn for IColumnSpec

type SClickhouseBackend

type SClickhouseBackend struct {
	sqlchemy.SBaseBackend
}

func (*SClickhouseBackend) CanInsert

func (click *SClickhouseBackend) CanInsert() bool

CanInsert returns wether the backend supports Insert

func (*SClickhouseBackend) CanInsertOrUpdate

func (click *SClickhouseBackend) CanInsertOrUpdate() bool

CanInsertOrUpdate returns weather the backend supports InsertOrUpdate

func (*SClickhouseBackend) CanSupportRowAffected

func (click *SClickhouseBackend) CanSupportRowAffected() bool

func (*SClickhouseBackend) CanUpdate

func (click *SClickhouseBackend) CanUpdate() bool

CanUpdate returns wether the backend supports update

func (*SClickhouseBackend) CaseInsensitiveLikeString

func (click *SClickhouseBackend) CaseInsensitiveLikeString() string

func (*SClickhouseBackend) CommitTableChangeSQL

func (clickhouse *SClickhouseBackend) CommitTableChangeSQL(ts sqlchemy.ITableSpec, changes sqlchemy.STableChanges) []string

func (*SClickhouseBackend) CurrentTimeStampString

func (click *SClickhouseBackend) CurrentTimeStampString() string

func (*SClickhouseBackend) CurrentUTCTimeStampString

func (click *SClickhouseBackend) CurrentUTCTimeStampString() string

func (*SClickhouseBackend) FetchTableColumnSpecs

func (click *SClickhouseBackend) FetchTableColumnSpecs(ts sqlchemy.ITableSpec) ([]sqlchemy.IColumnSpec, error)

func (*SClickhouseBackend) GROUP_CONCAT2

func (click *SClickhouseBackend) GROUP_CONCAT2(name string, sep string, field sqlchemy.IQueryField) sqlchemy.IQueryField

GROUP_CONCAT1 represents the SQL function GROUP_CONCAT

func (*SClickhouseBackend) GetColumnSpecByFieldType

func (click *SClickhouseBackend) GetColumnSpecByFieldType(table *sqlchemy.STableSpec, fieldType reflect.Type, fieldname string, tagmap map[string]string, isPointer bool) sqlchemy.IColumnSpec

func (*SClickhouseBackend) GetCreateSQLs

func (click *SClickhouseBackend) GetCreateSQLs(ts sqlchemy.ITableSpec) []string

func (*SClickhouseBackend) IsSupportIndexAndContraints

func (click *SClickhouseBackend) IsSupportIndexAndContraints() bool

func (*SClickhouseBackend) Name

func (*SClickhouseBackend) RegexpWhereClause

func (click *SClickhouseBackend) RegexpWhereClause(cond *sqlchemy.SRegexpConition) string

func (*SClickhouseBackend) SupportMixedInsertVariables

func (click *SClickhouseBackend) SupportMixedInsertVariables() bool

func (*SClickhouseBackend) UnionAllString

func (click *SClickhouseBackend) UnionAllString() string

func (*SClickhouseBackend) UnionDistinctString

func (click *SClickhouseBackend) UnionDistinctString() string

func (*SClickhouseBackend) UpdateSQLTemplate

func (click *SClickhouseBackend) UpdateSQLTemplate() string

type SClickhouseBaseColumn

type SClickhouseBaseColumn struct {
	sqlchemy.SBaseColumn
	// contains filtered or unexported fields
}

func NewClickhouseBaseColumn

func NewClickhouseBaseColumn(name string, sqltype string, tagmap map[string]string, isPointer bool) SClickhouseBaseColumn

func (*SClickhouseBaseColumn) GetTTL

func (c *SClickhouseBaseColumn) GetTTL() (int, string)

func (*SClickhouseBaseColumn) IsOrderBy

func (c *SClickhouseBaseColumn) IsOrderBy() bool

func (*SClickhouseBaseColumn) PartitionBy

func (c *SClickhouseBaseColumn) PartitionBy() string

func (*SClickhouseBaseColumn) SetOrderBy

func (c *SClickhouseBaseColumn) SetOrderBy(on bool)

func (*SClickhouseBaseColumn) SetPartitionBy

func (c *SClickhouseBaseColumn) SetPartitionBy(expr string)

func (*SClickhouseBaseColumn) SetTTL

func (c *SClickhouseBaseColumn) SetTTL(int, string)

type SDateTimeColumn

type SDateTimeColumn struct {
	STimeTypeColumn
	// contains filtered or unexported fields
}

SDateTimeColumn represents a DateTime type of column

func NewDateTimeColumn

func NewDateTimeColumn(name string, tagmap map[string]string, isPointer bool) SDateTimeColumn

NewDateTimeColumn returns an instance of DateTime column

func (*SDateTimeColumn) IsCreatedAt

func (c *SDateTimeColumn) IsCreatedAt() bool

func (*SDateTimeColumn) IsDateTime

func (c *SDateTimeColumn) IsDateTime() bool

func (*SDateTimeColumn) IsUpdatedAt

func (c *SDateTimeColumn) IsUpdatedAt() bool

type SDecimalColumn

type SDecimalColumn struct {
	SClickhouseBaseColumn

	Precision int
	// contains filtered or unexported fields
}

SDecimalColumn represents a DECIMAL type of column, i.e. a float with fixed width of digits

func NewDecimalColumn

func NewDecimalColumn(name string, tagmap map[string]string, isPointer bool) SDecimalColumn

NewDecimalColumn returns an instance of SDecimalColumn

func (*SDecimalColumn) ColType

func (c *SDecimalColumn) ColType() string

ColType implementation of SDecimalColumn for IColumnSpec

func (*SDecimalColumn) ConvertFromString

func (c *SDecimalColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of STristateColumn for IColumnSpec

func (*SDecimalColumn) DefinitionString

func (c *SDecimalColumn) DefinitionString() string

DefinitionString implementation of SDecimalColumn for IColumnSpec

func (*SDecimalColumn) IsNumeric

func (c *SDecimalColumn) IsNumeric() bool

IsNumeric implementation of SDecimalColumn for IColumnSpec

func (*SDecimalColumn) IsZero

func (c *SDecimalColumn) IsZero(val interface{}) bool

IsZero implementation of SDecimalColumn for IColumnSpec

type SFloatColumn

type SFloatColumn struct {
	SClickhouseBaseColumn
}

SFloatColumn represents a float type column, e.g. float32 or float64

func NewFloatColumn

func NewFloatColumn(name string, sqlType string, tagmap map[string]string, isPointer bool) SFloatColumn

NewFloatColumn returns an instance of SFloatColumn

func (*SFloatColumn) ConvertFromString

func (c *SFloatColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of STristateColumn for IColumnSpec

func (*SFloatColumn) DefinitionString

func (c *SFloatColumn) DefinitionString() string

DefinitionString implementation of SFloatColumn for IColumnSpec

func (*SFloatColumn) IsNumeric

func (c *SFloatColumn) IsNumeric() bool

IsNumeric implementation of SFloatColumn for IColumnSpec

func (*SFloatColumn) IsZero

func (c *SFloatColumn) IsZero(val interface{}) bool

IsZero implementation of SFloatColumn for IColumnSpec

type SIntegerColumn

type SIntegerColumn struct {
	SClickhouseBaseColumn
	// contains filtered or unexported fields
}

SIntegerColumn represents an integer type of column, with value of integer

func NewIntegerColumn

func NewIntegerColumn(name string, sqltype string, tagmap map[string]string, isPointer bool) SIntegerColumn

NewIntegerColumn return an instance of SIntegerColumn

func (*SIntegerColumn) ConvertFromString

func (c *SIntegerColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of STristateColumn for IColumnSpec

func (*SIntegerColumn) DefinitionString

func (c *SIntegerColumn) DefinitionString() string

DefinitionString implementation of SIntegerColumn for IColumnSpec

func (*SIntegerColumn) IsAutoVersion

func (c *SIntegerColumn) IsAutoVersion() bool

IsAutoVersion implements IsAutoVersion for IColumnSpec

func (*SIntegerColumn) IsNumeric

func (c *SIntegerColumn) IsNumeric() bool

IsNumeric implementation of SIntegerColumn for IColumnSpec

func (*SIntegerColumn) IsZero

func (c *SIntegerColumn) IsZero(val interface{}) bool

IsZero implementation of SIntegerColumn for IColumnSpec

type STextColumn

type STextColumn struct {
	SClickhouseBaseColumn
}

STextColumn represents a text type of column

func NewTextColumn

func NewTextColumn(name string, sqlType string, tagmap map[string]string, isPointer bool) STextColumn

NewTextColumn return an instance of STextColumn

func (*STextColumn) ConvertFromString

func (c *STextColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of STristateColumn for IColumnSpec

func (*STextColumn) DefinitionString

func (c *STextColumn) DefinitionString() string

DefinitionString implementation of STextColumn for IColumnSpec

func (*STextColumn) IsAscii

func (c *STextColumn) IsAscii() bool

IsAscii implementation of STextColumn for IColumnSpec

func (*STextColumn) IsSearchable

func (c *STextColumn) IsSearchable() bool

IsSearchable implementation of STextColumn for IColumnSpec

func (*STextColumn) IsString

func (c *STextColumn) IsString() bool

func (*STextColumn) IsText

func (c *STextColumn) IsText() bool

IsText implementation of STextColumn for IColumnSpec

func (*STextColumn) IsZero

func (c *STextColumn) IsZero(val interface{}) bool

IsZero implementation of STextColumn for IColumnSpec

type STimeTypeColumn

type STimeTypeColumn struct {
	SClickhouseBaseColumn
	// contains filtered or unexported fields
}

STimeTypeColumn represents a Detetime type of column, e.g. DateTime

func NewTimeTypeColumn

func NewTimeTypeColumn(name string, typeStr string, tagmap map[string]string, isPointer bool) STimeTypeColumn

NewTimeTypeColumn return an instance of STimeTypeColumn

func (*STimeTypeColumn) ConvertFromString

func (c *STimeTypeColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of STristateColumn for IColumnSpec

func (*STimeTypeColumn) DefinitionString

func (c *STimeTypeColumn) DefinitionString() string

DefinitionString implementation of STimeTypeColumn for IColumnSpec

func (*STimeTypeColumn) GetTTL

func (c *STimeTypeColumn) GetTTL() (int, string)

func (*STimeTypeColumn) IsText

func (c *STimeTypeColumn) IsText() bool

IsText implementation of STimeTypeColumn for IColumnSpec

func (*STimeTypeColumn) IsZero

func (c *STimeTypeColumn) IsZero(val interface{}) bool

IsZero implementation of STimeTypeColumn for IColumnSpec

func (*STimeTypeColumn) SetTTL

func (c *STimeTypeColumn) SetTTL(cnt int, u string)

type STristateColumn

type STristateColumn struct {
	SClickhouseBaseColumn
}

STristateColumn represents a tristate type column, with value of true, false or none

func NewTristateColumn

func NewTristateColumn(table, name string, tagmap map[string]string, isPointer bool) STristateColumn

NewTristateColumn return an instance of STristateColumn

func (*STristateColumn) ConvertFromString

func (c *STristateColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of STristateColumn for IColumnSpec

func (*STristateColumn) ConvertFromValue

func (c *STristateColumn) ConvertFromValue(val interface{}) interface{}

ConvertFromValue implementation of STristateColumn for IColumnSpec

func (*STristateColumn) DefinitionString

func (c *STristateColumn) DefinitionString() string

DefinitionString implementation of STristateColumn for IColumnSpec

func (*STristateColumn) IsZero

func (c *STristateColumn) IsZero(val interface{}) bool

IsZero implementation of STristateColumn for IColumnSpec

Jump to

Keyboard shortcuts

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