Documentation
¶
Overview ¶
Package fetch queries source database for objects and data
Index ¶
- Variables
- func CollectAndAssociateContext[P associer[C, P], C any](ctx context.Context, n string, args any, parents []P, rowto rowToFunc[C]) ([]P, int, error)
- func CollectMapContext(ctx context.Context, n string) (map[string]any, error)
- func CollectObjectsContext[T any](ctx context.Context, n string, args any, rowto rowToFunc[T]) ([]T, error)
- func CopyTables(p *dispatch.Plan, tables []catalog.Table, srcModel any)
- func CopyTask(source any, target catalog.Table, reqs []string) dispatch.Task
- func ForEachContext(ctx context.Context, n string, args any, f func(*sql.Rows) error) (int, error)
- func ForEachItemAssociateContext[P associer[C, P], C any](ctx context.Context, parents []P, query func(P) string, rowto rowToFunc[C]) ([]P, int, error)
- func QueryRowContext(ctx context.Context, n string, args any) *sql.Row
- func Render(name string, o any) string
- func RestartIdentities(tables []catalog.Table, src any) dispatch.Task
- func RestartSequences(seqs []catalog.Sequence, src any) dispatch.Task
- func Setup(sqlFS fs.FS, f func(int) string, funcs template.FuncMap)
- func Value(path, from, to string) valueFactory
Constants ¶
This section is empty.
Variables ¶
var CopyRate = monitoring.NewRate(" rows")
var CopyThroughput = monitoring.NewIRate("B")
var TableCount int
Functions ¶
func CollectAndAssociateContext ¶
func CollectAndAssociateContext[P associer[C, P], C any](ctx context.Context, n string, args any, parents []P, rowto rowToFunc[C]) ([]P, int, error)
CollectAndAssociateContext queries child objects
Returns parents with associated components and the count of components.
If a component does not match an existing parent, skip to next component and search starting from last associated parent. Fails after 8 unassociated components.
Use this to query table columns, keys, etc.
func CollectMapContext ¶
func CollectObjectsContext ¶
func CollectObjectsContext[T any](ctx context.Context, n string, args any, rowto rowToFunc[T]) ([]T, error)
CollectObjectsContext accumulates rows
func CopyTables ¶
CopyTables instanciates COPY operations for a list of tables
func CopyTask ¶
CopyTask instanciates a COPY operation for a table
Task weight is source table row count. Generates a COPY statement for each batch of rows. Use SetupExecute to configure query output.
func ForEachContext ¶
func ForEachItemAssociateContext ¶
func ForEachItemAssociateContext[P associer[C, P], C any](ctx context.Context, parents []P, query func(P) string, rowto rowToFunc[C]) ([]P, int, error)
ForEachItemAssociateContext execute a query for each item
Use it to inspect extra information for item with per-item query like `SHOW CREATE`.
func QueryRowContext ¶
QueryRowContext executes a query that is expected to return a single row
Panics if connexion to database is not already established.
func RestartIdentities ¶
RestartIdentities fetches identities start from source and generates ALTER COLUMN.
Returns nil if no tables have identity column.
Requires source connection in context from database.WithConnection.
func RestartSequences ¶
RestartSequences fetches sequences start from source and generates ALTER SEQUENCE.
Returns nil if no sequences are given. Group sequence restart by schema.
Requires catalog.FilterSchemas to be set with schemas containing sequences. Requires source connection in context from database.WithConnection.
Types ¶
This section is empty.