driver

package
v0.0.0-...-9f89ade Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Templates embed.FS

Functions

This section is empty.

Types

type Config

type Config struct {
	Dsn         string
	Schema      string
	Includes    []string
	Excludes    []string
	Concurrency int
}

type DBInfo

type DBInfo = drivers.DBInfo[Extra]

type Driver

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

Driver holds the database connection string and a handle to the database connection.

func (*Driver) Assemble

func (p *Driver) Assemble() (dbinfo *DBInfo, err error)

Assemble all the information we need to provide back to the driver

func (*Driver) Constraints

func (p *Driver) Constraints(_ drivers.ColumnFilter) (drivers.DBConstraints, error)

func (*Driver) Enums

func (p *Driver) Enums(schema string) ([]Enum, error)

func (*Driver) TableColumns

func (p *Driver) TableColumns(tableName string, colFilter drivers.ColumnFilter) ([]drivers.Column, error)

TableColumns takes a table name and attempts to retrieve the table information from the database information_schema.columns. It retrieves the column names and column types and returns those as a []Column after translateColumnType() converts the SQL types to Go types, for example: "varchar" to "string"

func (*Driver) TableNames

func (p *Driver) TableNames(tableFilter drivers.Filter) ([]string, error)

TableNames connects to the postgres database and retrieves all table names from the information_schema where the table schema is schema. It uses a whitelist and blacklist.

func (*Driver) ViewColumns

func (p *Driver) ViewColumns(tableName string, filter drivers.ColumnFilter) ([]drivers.Column, error)

func (*Driver) ViewNames

func (p *Driver) ViewNames(tableFilter drivers.Filter) ([]string, error)

ViewNames connects to the postgres database and retrieves all view names from the information_schema where the view schema is schema. It uses a whitelist and blacklist.

type Enum

type Enum struct {
	Name   string
	Type   string
	Values []string
}

type Extra

type Extra struct {
	Enums []Enum
}

type Interface

type Interface = drivers.Interface[Extra]

func New

func New(config Config) Interface

Jump to

Keyboard shortcuts

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