withddl

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package withddl allows you to automatically ensure the tables against which you want to apply statements are up-to-date.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WithDDL

type WithDDL struct {
	// contains filtered or unexported fields
}

WithDDL allows you to execute statements against tables whose schema may not be up-to-date. If the tables don't exist or result in a schema error, it can apply a series of idempotent DDLs that will create or bring the tables to the desired state and retry.

func New

func New(ddls []string) *WithDDL

New creates a new WithDDL.

func (*WithDDL) DDLs added in v0.11.0

func (wd *WithDDL) DDLs() []string

DDLs returns a copy of the ddls

func (*WithDDL) Exec

func (wd *WithDDL) Exec(ctx context.Context, query string, f interface{}) (*sqltypes.Result, error)

Exec executes the query using the supplied function. If there are any schema errors, it applies the DDLs and retries. Funcs can be any of these types: func(query string) (*sqltypes.Result, error) func(query string, maxrows int) (*sqltypes.Result, error) func(query string, maxrows int, wantfields bool) (*sqltypes.Result, error) func(ctx context.Context, query string, maxrows int, wantfields bool) (*sqltypes.Result, error)

func (*WithDDL) ExecIgnore

func (wd *WithDDL) ExecIgnore(ctx context.Context, query string, f interface{}) (*sqltypes.Result, error)

ExecIgnore executes the query using the supplied function. If there are any schema errors, it returns an empty result.

Jump to

Keyboard shortcuts

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