templates

package
v0.0.0-...-3223366 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteCommand

func ExecuteCommand(db *sql.DB, renderer Renderer) (sql.Result, error)

func PrefixColumn

func PrefixColumn(prefix, id string) string

PrefixColumn makes a safe column name containing the prefix, a ., and the current ID, inside []" PrefixColumn("Table", "[Key]") => "[Table.Key]"

func RenderChangeDetectionQuery

func RenderChangeDetectionQuery(args ChangeDetectionQueryArgs) (string, error)

func RenderReplicationTableCreationDDLArgs

func RenderReplicationTableCreationDDLArgs(args ReplicationTableCreationDDL) (string, error)

func RenderSchemaDataQuery

func RenderSchemaDataQuery(args SchemaDataQueryArgs) (string, error)

RenderSchemaDataQuery renders the query used to actually retrieve data from a schema.

func RenderSelfBridgeQuery

func RenderSelfBridgeQuery(args SelfBridgeQueryArgs) (string, error)

func UniquifySQLName

func UniquifySQLName(x string) string

Types

type BatchQueryArgs

type BatchQueryArgs struct {
	Columns       []*pub.Property
	Keys          []string
	SchemaQuery   string
	TrackedTables []BatchTrackedTable
}

type BatchTrackedTable

type BatchTrackedTable struct {
	ID           string
	SelectQuery  string
	ProjectQuery string
	Keys         []string
	NonKeys      []string
}

type ChangeDetectionQueryArgs

type ChangeDetectionQueryArgs struct {
	SchemaArgs     *meta.Schema
	DependencyArgs *meta.Schema
	BridgeQuery    string
	// Key which will be prefixed to the names of columns from
	// the change tracking results.
	ChangeKeyPrefix string
	// The column name to populate with SYS_CHANGE_OPERATION
	ChangeOperationColumnName string
}

type Renderer

type Renderer interface {
	Render() (string, error)
}

type ReplicationGoldenMerge

type ReplicationGoldenMerge struct {
	Schema          *meta.Schema
	Record          *pub.UnmarshalledRecord
	GroupIDColumn   string
	UpdatedAtColumn string
	CreatedAtColumn string
}

func (ReplicationGoldenMerge) Render

func (r ReplicationGoldenMerge) Render() (string, error)

func (ReplicationGoldenMerge) String

func (r ReplicationGoldenMerge) String() string

type ReplicationMetadataDDLArgs

type ReplicationMetadataDDLArgs struct {
	SQLSchema                  string
	ReplicationVersioningTable string
	ReplicationMetadataTable   string
}

func (ReplicationMetadataDDLArgs) Render

func (r ReplicationMetadataDDLArgs) Render() (string, error)

type ReplicationMetadataEntry

type ReplicationMetadataEntry struct {
	Kind string
	ID   string
	Name string
}

type ReplicationMetadataMerge

type ReplicationMetadataMerge struct {
	SQLSchema                  string
	Entries                    []ReplicationMetadataEntry
	ReplicationVersioningTable string
	ReplicationMetadataTable   string
}

func (ReplicationMetadataMerge) Render

func (r ReplicationMetadataMerge) Render() (string, error)

func (ReplicationMetadataMerge) String

func (r ReplicationMetadataMerge) String() string

type ReplicationTableCreationDDL

type ReplicationTableCreationDDL struct {
	Schema          *meta.Schema
	ParentTable     string
	GroupIDColumn   string
	UpdatedAtColumn string
	CreatedAtColumn string
}

func (ReplicationTableCreationDDL) String

type ReplicationVersionMerge

type ReplicationVersionMerge struct {
	Schema          *meta.Schema
	Record          *pub.UnmarshalledRecord
	GroupIDColumn   string
	UpdatedAtColumn string
	CreatedAtColumn string
	JobIDColumn     string
	RecordIDColumn  string
}

func (ReplicationVersionMerge) Render

func (r ReplicationVersionMerge) Render() (string, error)

func (ReplicationVersionMerge) String

func (r ReplicationVersionMerge) String() string

type SchemaDataQueryArgs

type SchemaDataQueryArgs struct {
	SchemaArgs       *meta.Schema
	DependencyTables []*meta.Schema
	// Keys to filter the schema records by.
	RowKeys []meta.RowKeys
	// Name which will be used for the column which contains 1 if the row has been deleted from the schema.
	DeletedFlagColumnName string
}

type SelfBridgeQueryArgs

type SelfBridgeQueryArgs struct {
	SchemaInfo *meta.Schema
}

Jump to

Keyboard shortcuts

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