config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewFilter

func NewFilter(block *hcl.Block, fullName string) (modconfig.HclResource, hcl.Diagnostics)

func NewFormat

func NewFormat(block *hcl.Block, fullName string) (modconfig.HclResource, hcl.Diagnostics)

func NewPartition

func NewPartition(block *hcl.Block, fullName string) (modconfig.HclResource, hcl.Diagnostics)

func NewTable

func NewTable(block *hcl.Block, fullName string) (modconfig.HclResource, hcl.Diagnostics)

func NewTailpipeConnection

func NewTailpipeConnection(block *hcl.Block, fullName string) (modconfig.HclResource, hcl.Diagnostics)

func NewTailpipePlugin

func NewTailpipePlugin(block *hcl.Block, fullName string) (modconfig.HclResource, hcl.Diagnostics)

func ResourceHasSubtype

func ResourceHasSubtype(blockType string) bool

Types

type ColumnSchema

type ColumnSchema struct {
	Name   string  `hcl:"name,label" cty:"name"`
	Type   *string `hcl:"type" cty:"type"`
	Source *string `hcl:"source" cty:"source"`
}

type Filter

type Filter struct {
	modconfig.HclResourceImpl
	Where *string `hcl:"where"`
}

type Format

type Format struct {
	modconfig.HclResourceImpl

	Type   string    `cty:"type"`
	Config *HclBytes `cty:"config"`
}

func (*Format) GetSubType

func (f *Format) GetSubType() string

GetSubType returns the subtype for the format block (the type). The presence of this function indicates this resource supports 3 part names, which affects how it is stored in the eval context

func (*Format) SetConfigHcl

func (f *Format) SetConfigHcl(u *HclBytes)

func (*Format) ToProto

func (f *Format) ToProto() *proto.ConfigData

type HclBytes

type HclBytes struct {
	Hcl   []byte           `cty:"hcl"`
	Range hclhelpers.Range `cty:"range"`
}

func HclBytesForRange

func HclBytesForRange(sourceHcl []byte, r hcl.Range) *HclBytes

func (*HclBytes) Merge

func (h *HclBytes) Merge(other *HclBytes)

type Partition

type Partition struct {
	modconfig.HclResourceImpl

	// the name of the table this partition is for - this is the first label in the partition block
	TableName string

	// if the partition of for a custom table, this will be set to the custom table config
	CustomTable *Table `cty:"table"`

	// Plugin used for this partition
	Plugin *plugin.Plugin `cty:"-"`

	// Source of the data for this partition
	Source Source `cty:"source"`

	// any partition-type specific config data for the partition
	Config []byte `cty:"config"`
	// the config location
	ConfigRange hclhelpers.Range `cty:"config_range"`
	// an option filter in the format of a SQL where clause
	Filter string
}

func (*Partition) AddFilter

func (c *Partition) AddFilter(filter string)

func (*Partition) CollectionStatePath

func (c *Partition) CollectionStatePath(collectionDir string) string

func (*Partition) InferPluginName

func (c *Partition) InferPluginName() string

func (*Partition) SetConfigHcl

func (c *Partition) SetConfigHcl(u *HclBytes)

type Source

type Source struct {
	Type       string              `hcl:" type,label" cty:"type"`
	Connection *TailpipeConnection `hcl:"connection" cty:"connection"`
	// optional: the format (for custom tables)
	Format *Format `hcl:"format" cty:"format"`
	// the config hcl
	Config *HclBytes `cty:"config"`
}

func (*Source) SetConfigHcl

func (s *Source) SetConfigHcl(u *HclBytes)

func (*Source) ToProto

func (s *Source) ToProto() *proto.ConfigData

type Table

type Table struct {
	modconfig.HclResourceImpl

	// the default format for this table (todo make a map keyed by source name?)
	DefaultSourceFormat *Format `hcl:"format" cty:"format"`

	Columns []ColumnSchema `hcl:"column,block" cty:"columns"`

	// should we include ALL source fields in addition to any defined columns, or ONLY include the columns defined
	AutoMapSourceFields bool `hcl:"automap_source_fields,optional" cty:"automap_source_fields"`
	// should we exclude any source fields from the output (only applicable if automap_source_fields is true)
	ExcludeSourceFields []string `hcl:"exclude_source_fields,optional" cty:"exclude_source_fields"`
}

func (*Table) ToProto

func (t *Table) ToProto() *proto.Table

func (*Table) ToProtoSchema

func (t *Table) ToProtoSchema() *proto.Schema

type TailpipeConfig

type TailpipeConfig struct {
	// map of partitions, keyed by unqualified name (<partition_type>.<partition_name>)
	Partitions map[string]*Partition

	Connections map[string]*TailpipeConnection

	PluginVersions map[string]*versionfile.InstalledVersion
	CustomTables   map[string]*Table
	Formats        map[string]*Format
}
var GlobalConfig *TailpipeConfig

func NewTailpipeConfig

func NewTailpipeConfig() *TailpipeConfig

func (*TailpipeConfig) Add

func (c *TailpipeConfig) Add(resource modconfig.HclResource) error

func (*TailpipeConfig) InitPartitions

func (c *TailpipeConfig) InitPartitions()

func (*TailpipeConfig) Validate

func (c *TailpipeConfig) Validate() error

type TailpipeConnection

type TailpipeConnection struct {
	modconfig.HclResourceImpl
	Plugin string `cty:"plugin"`
	Hcl    []byte `cty:"hcl"`
	// the hcl range for the connection - use our version so we can sty serialise it
	HclRange hclhelpers.Range `cty:"hcl_range"`
}

func (*TailpipeConnection) GetSubType

func (c *TailpipeConnection) GetSubType() string

GetSubType returns the subtype for the connection (the plugin). The presence of this function indicates this resource supports 3 part names, which affects how it is stored in the eval context

func (*TailpipeConnection) ToProto

func (c *TailpipeConnection) ToProto() *proto.ConfigData

type TailpipePlugin

type TailpipePlugin struct {
	modconfig.HclResourceImpl
	Plugin  string `cty:"plugin"`
	Version string `cty:"version"`
}

TODO UNUSED AS YET - can we just use plugin.Plugin??? sort parsing

func (*TailpipePlugin) GetSubType

func (c *TailpipePlugin) GetSubType() string

GetSubType returns the subtype for the plug (the plugin). The presence of this function indicates this resource supports 3 part names, which affects how it is stored in the eval context

Jump to

Keyboard shortcuts

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