infra

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Drivers = make(map[string]Driver)

Drivers is a registry of drivers

View Source
var ErrClosed = errors.New("infra: connection is closed")

ErrClosed should be returned by Execute if the connection is closed

View Source
var ErrNotFound = errors.New("infra: not found")

ErrNotFound should be returned by InformationSchema.Lookup if no resource was found

Functions

func Register

func Register(name string, driver Driver)

Register registers a new driver

Types

type Column added in v0.11.0

type Column struct {
	Name     string
	Type     string
	Nullable bool
}

type Connection

type Connection interface {
	Execute(ctx context.Context, stmt *Statement) (*sqlx.Rows, error)
	Close() error
	InformationSchema() InformationSchema
}

type Driver

type Driver interface {
	Open(dsn string) (Connection, error)
}

type InformationSchema added in v0.11.0

type InformationSchema interface {
	All(ctx context.Context) ([]*Table, error)
	Lookup(ctx context.Context, name string) (*Table, error)
}

type Statement added in v0.10.0

type Statement struct {
	Query    string
	Args     []any
	DryRun   bool
	Priority int
}

type Table added in v0.11.0

type Table struct {
	Database string
	Schema   string
	Name     string
	Type     string
	Columns  []Column
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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