Documentation
¶
Index ¶
- Variables
- func Close()
- func Connection(ctx context.Context, key catalogKey) *sql.Conn
- func Execute(ctx context.Context, id string, sn int, query string, stdin io.Reader, ...) error
- func ExecuteTask(id string, priority int, reqs []string, query, message string, logArgs ...any) dispatch.Task
- func Forget(ctx context.Context, key catalogKey) context.Context
- func SetupExecution(f Executer)
- func WaitReleased()
- func WithConnection(ctx context.Context, key catalogKey) (context.Context, error)
- type Executer
Constants ¶
This section is empty.
Variables ¶
var ( Source = catalogKey("source") Target = catalogKey("target") )
var ( SourceConnect int TargetConnect int )
Functions ¶
func Connection ¶
Connection return SQL connection from context
panics if context does not have a connection.
func Execute ¶
func Execute(ctx context.Context, id string, sn int, query string, stdin io.Reader, msg string, logArgs ...any) error
Execute immediatly a query
Uses query executor to send query to stdout, files or Postgres.
func ExecuteTask ¶
func ExecuteTask(id string, priority int, reqs []string, query, message string, logArgs ...any) dispatch.Task
ExecuteTask instanciate a dispatch task for a single query
func Forget ¶ added in v0.28.0
Forget hides connection from context.
Use WithConnection to create a new connection in returned context.
func WithConnection ¶
WithConnection ensure context has a db connection
Connection is released when context is done. You should defer cancel() func before adding connexion to context.
Use Connection() to get connection on success.
Types ¶
type Executer ¶
type Executer interface {
// contains filtered or unexported methods
}
func FileExecutor ¶
FileExecutor writes queries to files.
File order depends on scheduling. Creates directory if not exists. Does not clean directory.
func PostgresExecutor ¶
func PostgresExecutor() Executer
PostgresExecutor sends queries to Postgres.
Requires a Target connection in context as set by WithConnection.
func StreamExecutor ¶
StreamExecutor writes queries to stream. Prevents concurrent writes.