resourcetable

package
v1.0.36 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEngineParams added in v1.0.8

func GetEngineParams(engineFull string) []string

func GetOrderBy added in v1.0.8

func GetOrderBy(engineFull string) []string

func ResourceTable

func ResourceTable() *schema.Resource

func ValidateOnClusterEngine

func ValidateOnClusterEngine(inValue any, p hashicorpcty.Path) diag.Diagnostics

Types

type CHColumn

type CHColumn struct {
	Database          string `ch:"database"`
	Table             string `ch:"table"`
	Name              string `ch:"name"`
	Type              string `ch:"type"`
	Comment           string `ch:"comment"`
	DefaultKind       string `ch:"default_kind"`
	DefaultExpression string `ch:"default_expression"`
}

type CHIndex added in v1.0.8

type CHIndex struct {
	Name        string `ch:"name"`
	Expression  string `ch:"expr"`
	Type        string `ch:"type"`
	Granularity uint64 `ch:"granularity"`
}

type CHTable

type CHTable struct {
	Database   string     `ch:"database"`
	Name       string     `ch:"name"`
	EngineFull string     `ch:"engine_full"`
	Engine     string     `ch:"engine"`
	Comment    string     `ch:"comment"`
	Columns    []CHColumn `ch:"columns"`
	Indexes    []CHIndex  `ch:"indexes"`
}

-- begin DB read() types --

func (*CHTable) ColumnsToResource

func (t *CHTable) ColumnsToResource() []ColumnDefinition

func (*CHTable) IndexesToResource added in v1.0.8

func (t *CHTable) IndexesToResource() []IndexDefinition

func (*CHTable) ToResource

func (t *CHTable) ToResource() (*TableResource, error)

type CHTableService

type CHTableService struct {
	CHConnection *driver.Conn
}

func (*CHTableService) CreateTable

func (ts *CHTableService) CreateTable(ctx context.Context, tableResource TableResource) error

func (*CHTableService) DeleteTable

func (ts *CHTableService) DeleteTable(ctx context.Context, tableResource TableResource) error

func (*CHTableService) GetDBTables

func (ts *CHTableService) GetDBTables(ctx context.Context, database string) ([]CHTable, error)

func (*CHTableService) GetTable

func (ts *CHTableService) GetTable(ctx context.Context, database string, table string) (*CHTable, error)

func (*CHTableService) UpdateColumns added in v1.0.28

func (ts *CHTableService) UpdateColumns(ctx context.Context, addColumns []interface{}, dropColumns []interface{}) error

func (*CHTableService) UpdateTable added in v1.0.28

func (ts *CHTableService) UpdateTable(ctx context.Context, table TableResource, resourceData *schema.ResourceData) error

type ColumnDefinition added in v1.0.6

type ColumnDefinition struct {
	Name              string `json:"name"`
	Type              string `json:"type"`
	Comment           string `json:"comment"`
	DefaultKind       string `json:"default_kind"`
	DefaultExpression string `json:"default_expression"`
}

type IndexDefinition added in v1.0.8

type IndexDefinition struct {
	Name        string
	Expression  string
	Type        string
	Granularity uint64
}

type PartitionByResource

type PartitionByResource struct {
	By                string
	PartitionFunction string
	Mod               string
}

type TableResource

type TableResource struct {
	Database     string
	Name         string
	EngineFull   string
	Engine       string
	Cluster      string
	Comment      string
	EngineParams []string
	OrderBy      []string
	Columns      []ColumnDefinition
	PartitionBy  []PartitionByResource
	Indexes      []IndexDefinition
	Settings     map[string]string
}

-- built from DB read, and from tf definition code --

func (*TableResource) GetColumnsResourceList

func (t *TableResource) GetColumnsResourceList() []ColumnDefinition

func (*TableResource) HasColumn

func (t *TableResource) HasColumn(columnName string) bool

func (*TableResource) SetPartitionBy

func (t *TableResource) SetPartitionBy(partitionBy []interface{})

func (*TableResource) Validate

func (t *TableResource) Validate(diags diag.Diagnostics)

Jump to

Keyboard shortcuts

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