introspect

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name string
	Type string
}

Column represents an introspected database table column.

type Database

type Database struct {
	Driver  string
	Schemas map[string]*Schema
}

Database represents an introspected database.

func Introspect

func Introspect(dbURL string, options *Options) (*Database, error)

Introspect takes a database URL and returns a Database struct representing the introspected database, based on the options provided.

type Introspector

type Introspector interface {
	Introspect() (*Database, error)
}

Introspector is an interface for database introspection. Each supported driver should implement this interface.

func NewPG

func NewPG(db *sql.DB, options *Options) Introspector

NewPG returns a new Introspector for PostgreSQL.

type Options

type Options struct {
	// Which schemas to introspect. If empty, the driver decide which schemas to introspect.
	Schemas []string
	// Which tables to ignore. If empty, the driver introspects all tables.
	IgnoredTables []string
	// Tables to include. If not empty, the driver only introspects the specified tables.
	Tables []string
}

Options represents the options for database introspection.

type Schema

type Schema struct {
	Tables map[string]*Table
}

Schema represents an introspected database schema.

type Table

type Table struct {
	Type    string
	Columns []*Column
}

Table represents an introspected database table.

Jump to

Keyboard shortcuts

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