Documentation
¶
Index ¶
- type Connection
- func (c *Connection) All(ctx context.Context, like string, pageSize uint32, pageToken string) ([]*drivers.OlapTable, string, error)
- func (c *Connection) AsAI(instanceID string) (drivers.AIService, bool)
- func (c *Connection) AsAdmin(instanceID string) (drivers.AdminService, bool)
- func (c *Connection) AsCatalogStore(instanceID string) (drivers.CatalogStore, bool)
- func (c *Connection) AsFileStore() (drivers.FileStore, bool)
- func (c *Connection) AsInformationSchema() (drivers.InformationSchema, bool)
- func (c *Connection) AsModelExecutor(instanceID string, opts *drivers.ModelExecutorOptions) (drivers.ModelExecutor, error)
- func (c *Connection) AsModelManager(instanceID string) (drivers.ModelManager, error)
- func (c *Connection) AsNotifier(properties map[string]any) (drivers.Notifier, error)
- func (c *Connection) AsOLAP(instanceID string) (drivers.OLAPStore, bool)
- func (c *Connection) AsObjectStore() (drivers.ObjectStore, bool)
- func (c *Connection) AsRegistry() (drivers.RegistryStore, bool)
- func (c *Connection) AsRepoStore(instanceID string) (drivers.RepoStore, bool)
- func (c *Connection) AsWarehouse() (drivers.Warehouse, bool)
- func (c *Connection) Close() error
- func (c *Connection) Config() map[string]any
- func (c *Connection) Delete(ctx context.Context, res *drivers.ModelResult) error
- func (c *Connection) Dialect() drivers.Dialect
- func (c *Connection) Driver() string
- func (c *Connection) Exec(ctx context.Context, stmt *drivers.Statement) error
- func (c *Connection) Exists(ctx context.Context, res *drivers.ModelResult) (bool, error)
- func (c *Connection) GetTable(ctx context.Context, database, databaseSchema, table string) (*drivers.TableMetadata, error)
- func (c *Connection) InformationSchema() drivers.OLAPInformationSchema
- func (c *Connection) ListDatabaseSchemas(ctx context.Context, pageSize uint32, pageToken string) ([]*drivers.DatabaseSchemaInfo, string, error)
- func (c *Connection) ListTables(ctx context.Context, database, databaseSchema string, pageSize uint32, ...) ([]*drivers.TableInfo, string, error)
- func (c *Connection) LoadPhysicalSize(ctx context.Context, tables []*drivers.OlapTable) error
- func (c *Connection) Lookup(ctx context.Context, db, schema, name string) (*drivers.OlapTable, error)
- func (c *Connection) MayBeScaledToZero(ctx context.Context) bool
- func (c *Connection) MergePartitionResults(a, b *drivers.ModelResult) (*drivers.ModelResult, error)
- func (c *Connection) Migrate(ctx context.Context) (err error)
- func (c *Connection) MigrationStatus(ctx context.Context) (current, desired int, err error)
- func (c *Connection) Ping(ctx context.Context) error
- func (c *Connection) Query(ctx context.Context, stmt *drivers.Statement) (res *drivers.Result, outErr error)
- func (c *Connection) QuerySchema(ctx context.Context, query string, args []any) (*runtimev1.StructType, error)
- func (c *Connection) Rename(ctx context.Context, res *drivers.ModelResult, newName string, ...) (*drivers.ModelResult, error)
- func (c *Connection) WithConnection(ctx context.Context, priority int, fn drivers.WithConnectionFunc) error
- type InsertTableOptions
- type ModelInputProperties
- type ModelOutputProperties
- type ModelResultProperties
- type SQLConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶ added in v0.60.7
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) AsAI ¶ added in v0.60.7
func (c *Connection) AsAI(instanceID string) (drivers.AIService, bool)
AsAI implements drivers.Handle.
func (*Connection) AsAdmin ¶ added in v0.60.7
func (c *Connection) AsAdmin(instanceID string) (drivers.AdminService, bool)
AsAdmin implements drivers.Handle.
func (*Connection) AsCatalogStore ¶ added in v0.60.7
func (c *Connection) AsCatalogStore(instanceID string) (drivers.CatalogStore, bool)
Catalog implements drivers.Handle.
func (*Connection) AsFileStore ¶ added in v0.60.7
func (c *Connection) AsFileStore() (drivers.FileStore, bool)
AsFileStore implements drivers.Handle.
func (*Connection) AsInformationSchema ¶ added in v0.78.0
func (c *Connection) AsInformationSchema() (drivers.InformationSchema, bool)
AsInformationSchema implements drivers.Handle.
func (*Connection) AsModelExecutor ¶ added in v0.60.7
func (c *Connection) AsModelExecutor(instanceID string, opts *drivers.ModelExecutorOptions) (drivers.ModelExecutor, error)
AsModelExecutor implements drivers.Handle.
func (*Connection) AsModelManager ¶ added in v0.60.7
func (c *Connection) AsModelManager(instanceID string) (drivers.ModelManager, error)
AsModelManager implements drivers.Handle.
func (*Connection) AsNotifier ¶ added in v0.60.7
AsNotifier implements drivers.Handle.
func (*Connection) AsOLAP ¶ added in v0.60.7
func (c *Connection) AsOLAP(instanceID string) (drivers.OLAPStore, bool)
OLAP implements drivers.Handle.
func (*Connection) AsObjectStore ¶ added in v0.60.7
func (c *Connection) AsObjectStore() (drivers.ObjectStore, bool)
AsObjectStore implements drivers.Handle.
func (*Connection) AsRegistry ¶ added in v0.60.7
func (c *Connection) AsRegistry() (drivers.RegistryStore, bool)
Registry implements drivers.Handle.
func (*Connection) AsRepoStore ¶ added in v0.60.7
func (c *Connection) AsRepoStore(instanceID string) (drivers.RepoStore, bool)
Repo implements drivers.Handle.
func (*Connection) AsWarehouse ¶ added in v0.60.7
func (c *Connection) AsWarehouse() (drivers.Warehouse, bool)
AsWarehouse implements drivers.Handle.
func (*Connection) Close ¶ added in v0.60.7
func (c *Connection) Close() error
Close implements drivers.Handle.
func (*Connection) Config ¶ added in v0.60.7
func (c *Connection) Config() map[string]any
Config used to open the Connection
func (*Connection) Delete ¶ added in v0.60.7
func (c *Connection) Delete(ctx context.Context, res *drivers.ModelResult) error
func (*Connection) Dialect ¶ added in v0.60.7
func (c *Connection) Dialect() drivers.Dialect
func (*Connection) Driver ¶ added in v0.60.7
func (c *Connection) Driver() string
Driver implements drivers.Handle.
func (*Connection) Exists ¶ added in v0.60.7
func (c *Connection) Exists(ctx context.Context, res *drivers.ModelResult) (bool, error)
func (*Connection) GetTable ¶ added in v0.78.0
func (c *Connection) GetTable(ctx context.Context, database, databaseSchema, table string) (*drivers.TableMetadata, error)
func (*Connection) InformationSchema ¶ added in v0.60.7
func (c *Connection) InformationSchema() drivers.OLAPInformationSchema
func (*Connection) ListDatabaseSchemas ¶ added in v0.78.0
func (c *Connection) ListDatabaseSchemas(ctx context.Context, pageSize uint32, pageToken string) ([]*drivers.DatabaseSchemaInfo, string, error)
func (*Connection) ListTables ¶ added in v0.78.0
func (*Connection) LoadPhysicalSize ¶ added in v0.78.0
func (*Connection) MayBeScaledToZero ¶ added in v0.60.7
func (c *Connection) MayBeScaledToZero(ctx context.Context) bool
func (*Connection) MergePartitionResults ¶ added in v0.60.7
func (c *Connection) MergePartitionResults(a, b *drivers.ModelResult) (*drivers.ModelResult, error)
func (*Connection) Migrate ¶ added in v0.60.7
func (c *Connection) Migrate(ctx context.Context) (err error)
Migrate implements drivers.Handle.
func (*Connection) MigrationStatus ¶ added in v0.60.7
func (c *Connection) MigrationStatus(ctx context.Context) (current, desired int, err error)
MigrationStatus implements drivers.Handle.
func (*Connection) Ping ¶ added in v0.60.7
func (c *Connection) Ping(ctx context.Context) error
Ping implements drivers.Handle.
func (*Connection) QuerySchema ¶ added in v0.78.0
func (c *Connection) QuerySchema(ctx context.Context, query string, args []any) (*runtimev1.StructType, error)
func (*Connection) Rename ¶ added in v0.60.7
func (c *Connection) Rename(ctx context.Context, res *drivers.ModelResult, newName string, env *drivers.ModelEnv) (*drivers.ModelResult, error)
func (*Connection) WithConnection ¶ added in v0.60.7
func (c *Connection) WithConnection(ctx context.Context, priority int, fn drivers.WithConnectionFunc) error
type InsertTableOptions ¶ added in v0.60.7
type InsertTableOptions struct {
Strategy drivers.IncrementalStrategy
BeforeInsert string
AfterInsert string
}
type ModelInputProperties ¶ added in v0.45.0
type ModelOutputProperties ¶ added in v0.45.0
type ModelOutputProperties struct {
// Table is the name of the table to create. If not specified, the model name is used.
Table string `mapstructure:"table"`
// Materialize is a flag to indicate if the model should be materialized as a physical table or dictionary.
// If false, the model will be created as a view.
// If unspcecified, a default is selected based on context.
Materialize *bool `mapstructure:"materialize"`
// IncrementalStrategy is the strategy to use for incremental inserts.
IncrementalStrategy drivers.IncrementalStrategy `mapstructure:"incremental_strategy"`
// UniqueKey is the unique key for the model. This is used for the incremental strategy "merge".
UniqueKey []string `mapstructure:"unique_key"`
// Typ to materialize the model into. Possible values include `TABLE`, `VIEW` or `DICTIONARY`. Optional.
Typ string `mapstructure:"type"`
// Columns sets the column names and data types. If unspecified these are detected from the select query by clickhouse.
// It is also possible to set indexes with this property.
// Example : (id UInt32, username varchar, email varchar, created_at datetime, INDEX idx1 username TYPE set(100) GRANULARITY 3)
Columns string `mapstructure:"columns"`
// EngineFull can be used to set the table parameters like engine, partition key in SQL format without setting individual properties.
// It also allows creating dictionaries using a source.
// Example:
// ENGINE = MergeTree
// PARTITION BY toYYYYMM(__time)
// ORDER BY __time
// TTL d + INTERVAL 1 MONTH DELETE
EngineFull string `mapstructure:"engine_full"`
// Engine sets the table engine. Default: MergeTree
Engine string `mapstructure:"engine"`
// OrderBy sets the order by clause. Default: tuple() for MergeTree and not set for other engines
OrderBy string `mapstructure:"order_by"`
// PartitionBy sets the partition by clause.
PartitionBy string `mapstructure:"partition_by"`
// PrimaryKey sets the primary key clause.
PrimaryKey string `mapstructure:"primary_key"`
// SampleBy sets the sample by clause.
SampleBy string `mapstructure:"sample_by"`
// TTL sets ttl for column and table.
TTL string `mapstructure:"ttl"`
// TableSettings set the table specific settings.
TableSettings string `mapstructure:"table_settings"`
// QuerySettings sets the settings clause used in insert/create table as select queries.
QuerySettings string `mapstructure:"query_settings"`
// DistributedSettings is table settings for distributed table.
DistributedSettings string `mapstructure:"distributed_settings"`
// DistributedShardingKey is the sharding key for distributed table.
DistributedShardingKey string `mapstructure:"distributed_sharding_key"`
// DictionarySourceUser is the user that case access the source dictionary table. Only used when typ is DICTIONARY.
DictionarySourceUser string `mapstructure:"dictionary_source_user"`
// DictionarySourcePassword is the password for the user that can access the source dictionary table. Only used when typ is DICTIONARY.
DictionarySourcePassword string `mapstructure:"dictionary_source_password"`
}
type ModelResultProperties ¶ added in v0.45.0
type SQLConn ¶ added in v0.78.0
When supportSettings is false, the cluster is in readonly mode and does not allow modifying any settings. The clickhouse-go driver automatically sets 'max_execution_time' if a context has a deadline, which would cause errors. To avoid this, we override the connection methods to remove the deadline from the context before executing any query.