Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activity ¶ added in v2.6.0
type Activity struct {
Stage string `json:"stage"`
Statement int64 `json:"statement,omitempty"`
Table string `json:"table,omitempty"`
FirstRow int `json:"firstRow,omitempty"`
Rows int `json:"rows,omitempty"`
StartedAt time.Time `json:"startedAt"`
Elapsed time.Duration `json:"elapsed"`
}
Activity describes a pipeline stage without SQL text, row values, templates, or error messages. Statement is a one-based framed statement number (including passthrough SQL and trailing trivia). FirstRow and Rows refer to an INSERT.
type PreparedColumnOp ¶ added in v2.3.0
type PreparedTableConfig ¶
type PreparedTableConfig struct {
Skip bool
ColumnOps map[string][]PreparedColumnOp
ColumnTemplates map[string][]*templates.Template
ColumnVariableTemplates map[string]*templates.Template
ColumnVariableDepsPerTemplate map[*templates.Template][]*templates.Template
GlobalVariables map[string]string
TableVariables map[string]string
RowVariableTemplates []*templates.Template
}
type Processor ¶
func NewProcessorWithConfig ¶
func (*Processor) Process ¶
func (p *Processor) Process(input io.Reader, output io.Writer, parent context.Context) (resultErr error)
Process transforms SQL in input order. Concurrent calls on the same Processor return an error. Streams remain open on success. On cancellation/error, Process closes streams implementing io.Closer to interrupt blocked I/O; output implementing Abort() is aborted instead, without flushing buffered data. Non-closable streams must be interruptible by their caller if they can block. Process joins all pipeline goroutines before returning. Failed output is partial.
func (*Processor) ProcessedTables ¶ added in v2.4.0
ProcessedTables returns a sorted list of all table names encountered in CREATE TABLE statements during the most recent Process() call. Must be called after Process() returns.
func (*Processor) Progress ¶ added in v2.6.0
Progress can be polled concurrently with Process, including while I/O or a template function is blocked. It never waits for those operations or calls user logging code. Before the first run State is idle; each accepted run resets all statistics. A rejected concurrent Process call leaves them alone. The returned snapshot is independent and may be modified by the caller.
type Progress ¶ added in v2.6.0
type Progress struct {
State string `json:"state"` // idle, running, stopping, completed, failed, canceled
StartedAt time.Time `json:"startedAt"`
FinishedAt time.Time `json:"finishedAt"`
Elapsed time.Duration `json:"elapsed"`
BytesRead int64 `json:"bytesRead"`
BytesWritten int64 `json:"bytesWritten"`
StatementsRead int64 `json:"statementsRead"`
StatementsCompleted int64 `json:"statementsCompleted"`
StatementsSkipped int64 `json:"statementsSkipped"`
RowsTransformed int64 `json:"rowsTransformed"`
LastTable string `json:"lastTable,omitempty"` // last identified table, not necessarily the current read
LastReadAt time.Time `json:"lastReadAt"`
LastWriteAt time.Time `json:"lastWriteAt"`
InFlightBytes int64 `json:"inFlightBytes"`
InFlightLimit int64 `json:"inFlightLimit"`
Reader Activity `json:"reader"`
Writer Activity `json:"writer"`
Workers []Activity `json:"workers"` // index is the worker ID
Failure *Activity `json:"failure,omitempty"`
}
Progress is a point-in-time view of a Process call. Counts include only bytes delivered by Read / accepted by Write; buffered or remote destinations may not have flushed, persisted, or imported them. RowsTransformed counts rows in successfully transformed INSERTs, even if a later output write fails. InFlightBytes is the charged raw-input budget, not heap usage or process RSS. Worker activities can overlap and their elapsed times must not be summed as wall time. Reading/writing means an I/O call is active, not proof of a stall.
type TableSchema ¶
type TableSchema struct {
Columns columnMap
Name string
}