driver

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The database connection string
	Dsn string
	// The database schemas to generate models for
	Schemas pq.StringArray
	// The name of this schema will not be included in the generated models
	// a context value can then be used ot set the schema at runtime
	// useful for multi-tenant setups
	SharedSchema string
	// List of tables that will be included. Others are ignored
	Only map[string][]string
	// List of tables that will be should be ignored. Others are included
	Except map[string][]string
	// How many tables to fetch in parallel
	Concurrency int
	// Which UUID package to use (gofrs or google)
	UUIDPkg string `yaml:"uuid_pkg"`

	// The name of the folder to output the models package to
	Output string
	// The name you wish to assign to your generated models package
	Pkgname   string
	NoFactory bool `yaml:"no_factory"`
}

type DBInfo

type DBInfo = drivers.DBInfo[any]

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 (d *Driver) Assemble(ctx context.Context) (*DBInfo, error)

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

func (*Driver) Capabilities added in v0.15.0

func (d *Driver) Capabilities() drivers.Capabilities

func (*Driver) Constraints

func (*Driver) TableDetails added in v0.15.0

func (d *Driver) TableDetails(ctx context.Context, info drivers.TableInfo, colFilter drivers.ColumnFilter) (string, string, []drivers.Column, error)

Load details about a single table

func (*Driver) TablesInfo added in v0.15.0

func (d *Driver) TablesInfo(ctx context.Context, tableFilter drivers.Filter) (drivers.TablesInfo, 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.

type Enum

type Enum struct {
	Schema string
	Name   string
	Type   string
	Values pq.StringArray
}

type Interface

type Interface = drivers.Interface[any]

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