Documentation ¶
Index ¶
- func ApplyMacros(cfg *config.Config, path string) string
- func CalculateMaxFileSize(cfg *config.Config) (int64, error)
- func GetDisksByPaths(disks []Disk, dataPaths []string) map[string]string
- func IsClickhouseShadow(path string) bool
- type ClickHouse
- func (ch *ClickHouse) AttachPartitions(table metadata.TableMetadata, disks []Disk) error
- func (ch *ClickHouse) Close()
- func (ch *ClickHouse) Connect() error
- func (ch *ClickHouse) CreateDatabase(database, cluster string) error
- func (ch *ClickHouse) CreateDatabaseFromQuery(query, cluster string) error
- func (ch *ClickHouse) CreateDatabaseWithEngine(database, engine, cluster string) error
- func (ch *ClickHouse) CreateTable(table Table, query string, dropTable bool, onCluster string, version int) error
- func (ch *ClickHouse) CreateUserDefinedFunction(name string, query string) error
- func (ch *ClickHouse) DropTable(table Table, query string, onCluster string, version int) error
- func (ch *ClickHouse) FreezeTable(table *Table, name string) error
- func (ch *ClickHouse) FreezeTableOldWay(table *Table, name string) error
- func (ch *ClickHouse) GetAccessManagementPath(disks []Disk) (string, error)
- func (ch *ClickHouse) GetBackupTablesLegacy(backupName string, disks []Disk) ([]metadata.TableMetadata, error)
- func (ch *ClickHouse) GetConn() *sqlx.DB
- func (ch *ClickHouse) GetDatabases() ([]Database, error)
- func (ch *ClickHouse) GetDefaultPath(disks []Disk) (string, error)
- func (ch *ClickHouse) GetDisks() ([]Disk, error)
- func (ch *ClickHouse) GetPartitions(database, table string) (map[string][]metadata.Part, error)
- func (ch *ClickHouse) GetTables(tablePattern string) ([]Table, error)
- func (ch *ClickHouse) GetUserDefinedFunctions() ([]Function, error)
- func (ch *ClickHouse) GetVersion() (int, error)
- func (ch *ClickHouse) GetVersionDescribe() string
- func (ch *ClickHouse) IsAtomic(database string) (bool, error)
- func (ch *ClickHouse) LogQuery(query string) string
- func (ch *ClickHouse) Query(query string, args ...interface{}) (sql.Result, error)
- func (ch *ClickHouse) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- func (ch *ClickHouse) Select(dest interface{}, query string, args ...interface{}) error
- func (ch *ClickHouse) ShowCreateTable(database, name string) string
- func (ch *ClickHouse) SoftSelect(dest interface{}, query string) error
- type Database
- type Disk
- type Function
- type IsSystemTablesFieldPresent
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateMaxFileSize ¶ added in v1.3.2
func GetDisksByPaths ¶ added in v1.0.0
func IsClickhouseShadow ¶
Types ¶
type ClickHouse ¶
type ClickHouse struct { Config *config.ClickHouseConfig // contains filtered or unexported fields }
ClickHouse - provide
func (*ClickHouse) AttachPartitions ¶
func (ch *ClickHouse) AttachPartitions(table metadata.TableMetadata, disks []Disk) error
AttachPartitions - execute ATTACH command for specific table
func (*ClickHouse) Connect ¶
func (ch *ClickHouse) Connect() error
Connect - establish connection to ClickHouse
func (*ClickHouse) CreateDatabase ¶
func (ch *ClickHouse) CreateDatabase(database, cluster string) error
CreateDatabase - create ClickHouse database
func (*ClickHouse) CreateDatabaseFromQuery ¶ added in v1.0.0
func (ch *ClickHouse) CreateDatabaseFromQuery(query, cluster string) error
func (*ClickHouse) CreateDatabaseWithEngine ¶ added in v1.0.0
func (ch *ClickHouse) CreateDatabaseWithEngine(database, engine, cluster string) error
func (*ClickHouse) CreateTable ¶
func (ch *ClickHouse) CreateTable(table Table, query string, dropTable bool, onCluster string, version int) error
CreateTable - create ClickHouse table
func (*ClickHouse) CreateUserDefinedFunction ¶ added in v1.4.0
func (ch *ClickHouse) CreateUserDefinedFunction(name string, query string) error
func (*ClickHouse) FreezeTable ¶
func (ch *ClickHouse) FreezeTable(table *Table, name string) error
FreezeTable - freeze all partitions for table This way available for ClickHouse since v19.1
func (*ClickHouse) FreezeTableOldWay ¶
func (ch *ClickHouse) FreezeTableOldWay(table *Table, name string) error
FreezeTableOldWay - freeze all partitions in table one by one This way using for ClickHouse below v19.1
func (*ClickHouse) GetAccessManagementPath ¶ added in v1.0.14
func (ch *ClickHouse) GetAccessManagementPath(disks []Disk) (string, error)
GetAccessManagementPath @todo think about how to properly extract access_management_path from /etc/clickhouse-server/
func (*ClickHouse) GetBackupTablesLegacy ¶ added in v1.0.0
func (ch *ClickHouse) GetBackupTablesLegacy(backupName string, disks []Disk) ([]metadata.TableMetadata, error)
GetBackupTablesLegacy - return list of backups of tables that can be restored
func (*ClickHouse) GetConn ¶
func (ch *ClickHouse) GetConn() *sqlx.DB
GetConn - return current connection
func (*ClickHouse) GetDatabases ¶ added in v1.0.0
func (ch *ClickHouse) GetDatabases() ([]Database, error)
GetDatabases - return slice of all non system databases for backup
func (*ClickHouse) GetDefaultPath ¶ added in v1.0.0
func (ch *ClickHouse) GetDefaultPath(disks []Disk) (string, error)
func (*ClickHouse) GetDisks ¶ added in v1.0.0
func (ch *ClickHouse) GetDisks() ([]Disk, error)
GetDisks - return data from system.disks table
func (*ClickHouse) GetPartitions ¶
GetPartitions - return slice of all partitions for a table
func (*ClickHouse) GetTables ¶
func (ch *ClickHouse) GetTables(tablePattern string) ([]Table, error)
GetTables - return slice of all tables suitable for backup, MySQL and PorstgreSQL database engine shall be skipped
func (*ClickHouse) GetUserDefinedFunctions ¶ added in v1.4.0
func (ch *ClickHouse) GetUserDefinedFunctions() ([]Function, error)
func (*ClickHouse) GetVersion ¶
func (ch *ClickHouse) GetVersion() (int, error)
GetVersion - returned ClickHouse version in number format Example value: 19001005
func (*ClickHouse) GetVersionDescribe ¶ added in v1.0.0
func (ch *ClickHouse) GetVersionDescribe() string
func (*ClickHouse) IsAtomic ¶ added in v1.0.0
func (ch *ClickHouse) IsAtomic(database string) (bool, error)
func (*ClickHouse) LogQuery ¶ added in v1.0.0
func (ch *ClickHouse) LogQuery(query string) string
func (*ClickHouse) Query ¶ added in v1.0.0
func (ch *ClickHouse) Query(query string, args ...interface{}) (sql.Result, error)
func (*ClickHouse) Queryx ¶ added in v1.0.0
func (ch *ClickHouse) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
func (*ClickHouse) Select ¶ added in v1.0.0
func (ch *ClickHouse) Select(dest interface{}, query string, args ...interface{}) error
func (*ClickHouse) ShowCreateTable ¶ added in v1.0.0
func (ch *ClickHouse) ShowCreateTable(database, name string) string
func (*ClickHouse) SoftSelect ¶ added in v1.3.0
func (ch *ClickHouse) SoftSelect(dest interface{}, query string) error
type Database ¶ added in v1.0.0
type Database struct { Name string `db:"name"` Engine string `db:"engine"` Query string `db:"query"` }
Database - Clickhouse system.databases struct
type IsSystemTablesFieldPresent ¶ added in v1.2.1
type IsSystemTablesFieldPresent struct { IsDataPathPresent int `db:"is_data_path_present"` IsDataPathsPresent int `db:"is_data_paths_present"` IsUUIDPresent int `db:"is_uuid_present"` IsCreateTableQueryPresent int `db:"is_create_table_query_present"` IsTotalBytesPresent int `db:"is_total_bytes_present"` }
IsSystemTablesFieldPresent - ClickHouse `system.tables` varius field flags
type Table ¶
type Table struct { // common fields for all `clickhouse-server` versions Database string `db:"database"` Name string `db:"name"` Engine string `db:"engine"` // fields depends on `clickhouse-server` version DataPath string `db:"data_path,omitempty"` // For legacy support DataPaths []string `db:"data_paths,omitempty"` UUID string `db:"uuid,omitempty"` CreateTableQuery string `db:"create_table_query,omitempty"` TotalBytes uint64 `db:"total_bytes,omitempty"` Skip bool }
Table - ClickHouse table struct