metadata

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultWriter

func NewDefaultWriter(r Reader, opts ...WriterOption) func(db DB, w io.Writer) Writer

Types

type BasicReader

type BasicReader interface {
	SchemaReader
	TableReader
	ColumnReader
}

BasicReader of common database metadata like schemas, tables and columns.

type Bool

type Bool string
var (
	UNKNOWN Bool = ""
	YES     Bool = "YES"
	NO      Bool = "NO"
)

type Catalog

type Catalog struct {
	Catalog string
}

func (Catalog) GetCatalog

func (s Catalog) GetCatalog() Catalog

func (Catalog) Values

func (s Catalog) Values() []interface{}

type CatalogProvider

type CatalogProvider interface {
	GetCatalog() Catalog
}

type CatalogReader

type CatalogReader interface {
	Reader
	Catalogs(Filter) (*CatalogSet, error)
}

CatalogReader lists database schemas.

type CatalogSet

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

func NewCatalogSet

func NewCatalogSet(v []Catalog) *CatalogSet

func NewCatalogSetWithColumns

func NewCatalogSetWithColumns(v []Result, cols []string) *CatalogSet

func (CatalogSet) Close

func (r CatalogSet) Close() error

func (CatalogSet) Columns

func (r CatalogSet) Columns() ([]string, error)

func (CatalogSet) Err

func (r CatalogSet) Err() error

func (CatalogSet) Get

func (s CatalogSet) Get() Catalog

func (*CatalogSet) Len

func (r *CatalogSet) Len() int

func (*CatalogSet) Next

func (r *CatalogSet) Next() bool

func (CatalogSet) NextResultSet

func (r CatalogSet) NextResultSet() bool

func (*CatalogSet) Reset

func (r *CatalogSet) Reset()

func (CatalogSet) Scan

func (r CatalogSet) Scan(dest ...interface{}) error

func (*CatalogSet) SetColumns

func (r *CatalogSet) SetColumns(c []string)

func (*CatalogSet) SetFilter

func (r *CatalogSet) SetFilter(f func(Result) bool)

func (*CatalogSet) SetScanValues

func (r *CatalogSet) SetScanValues(s func(Result) []interface{})

type CloseFunc

type CloseFunc func()

CloseFunc should be called when result wont be processed anymore

type Column

type Column struct {
	Catalog         string
	Schema          string
	Table           string
	Name            string
	OrdinalPosition int
	DataType        string
	// ScanType        reflect.Type
	Default         string
	ColumnSize      int
	DecimalDigits   int
	NumPrecRadix    int
	CharOctetLength int
	IsNullable      Bool
}

func (Column) Values

func (c Column) Values() []interface{}

type ColumnPrivilege

type ColumnPrivilege struct {
	Column        string
	Grantee       string
	Grantor       string
	PrivilegeType string
	IsGrantable   bool
}

ColumnPrivilege represents a privilege granted on a column.

type ColumnPrivileges

type ColumnPrivileges []ColumnPrivilege

ColumnPrivileges represents privileges granted on a column. The privileges are assumed to be sorted. Otherwise the String() method will fail.

func (ColumnPrivileges) Len

func (p ColumnPrivileges) Len() int

func (ColumnPrivileges) Less

func (p ColumnPrivileges) Less(i, j int) bool

func (ColumnPrivileges) String

func (p ColumnPrivileges) String() string

String returns a string representation of ColumnPrivileges. Assumes the ColumnPrivileges to be sorted.

func (ColumnPrivileges) Swap

func (p ColumnPrivileges) Swap(i, j int)

type ColumnReader

type ColumnReader interface {
	Reader
	Columns(Filter) (*ColumnSet, error)
}

ColumnReader lists table columns.

type ColumnSet

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

func NewColumnSet

func NewColumnSet(v []Column) *ColumnSet

func (ColumnSet) Close

func (r ColumnSet) Close() error

func (ColumnSet) Columns

func (r ColumnSet) Columns() ([]string, error)

func (ColumnSet) Err

func (r ColumnSet) Err() error

func (ColumnSet) Get

func (c ColumnSet) Get() *Column

func (*ColumnSet) Len

func (r *ColumnSet) Len() int

func (*ColumnSet) Next

func (r *ColumnSet) Next() bool

func (ColumnSet) NextResultSet

func (r ColumnSet) NextResultSet() bool

func (*ColumnSet) Reset

func (r *ColumnSet) Reset()

func (ColumnSet) Scan

func (r ColumnSet) Scan(dest ...interface{}) error

func (*ColumnSet) SetColumns

func (r *ColumnSet) SetColumns(c []string)

func (*ColumnSet) SetFilter

func (r *ColumnSet) SetFilter(f func(Result) bool)

func (*ColumnSet) SetScanValues

func (r *ColumnSet) SetScanValues(s func(Result) []interface{})

type ColumnStat

type ColumnStat struct {
	Catalog     string
	Schema      string
	Table       string
	Name        string
	AvgWidth    int
	NullFrac    float64
	NumDistinct int64
	Min         string
	Max         string
	Mean        string
	TopN        []string
	TopNFreqs   []float64
}

func (ColumnStat) Values

func (c ColumnStat) Values() []interface{}

type ColumnStatReader

type ColumnStatReader interface {
	Reader
	ColumnStats(Filter) (*ColumnStatSet, error)
}

ColumnStatsReader lists table column statistics.

type ColumnStatSet

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

func NewColumnStatSet

func NewColumnStatSet(v []ColumnStat) *ColumnStatSet

func (ColumnStatSet) Close

func (r ColumnStatSet) Close() error

func (ColumnStatSet) Columns

func (r ColumnStatSet) Columns() ([]string, error)

func (ColumnStatSet) Err

func (r ColumnStatSet) Err() error

func (ColumnStatSet) Get

func (c ColumnStatSet) Get() *ColumnStat

func (*ColumnStatSet) Len

func (r *ColumnStatSet) Len() int

func (*ColumnStatSet) Next

func (r *ColumnStatSet) Next() bool

func (ColumnStatSet) NextResultSet

func (r ColumnStatSet) NextResultSet() bool

func (*ColumnStatSet) Reset

func (r *ColumnStatSet) Reset()

func (ColumnStatSet) Scan

func (r ColumnStatSet) Scan(dest ...interface{}) error

func (*ColumnStatSet) SetColumns

func (r *ColumnStatSet) SetColumns(c []string)

func (*ColumnStatSet) SetFilter

func (r *ColumnStatSet) SetFilter(f func(Result) bool)

func (*ColumnStatSet) SetScanValues

func (r *ColumnStatSet) SetScanValues(s func(Result) []interface{})

type Constraint

type Constraint struct {
	Catalog string
	Schema  string
	Table   string
	Name    string
	Type    string

	IsDeferrable        Bool
	IsInitiallyDeferred Bool

	ForeignCatalog string
	ForeignSchema  string
	ForeignTable   string
	ForeignName    string
	MatchType      string
	UpdateRule     string
	DeleteRule     string

	CheckClause string
}

func (Constraint) Values

func (i Constraint) Values() []interface{}

type ConstraintColumn

type ConstraintColumn struct {
	Catalog         string
	Schema          string
	Table           string
	Constraint      string
	Name            string
	OrdinalPosition int

	ForeignCatalog    string
	ForeignSchema     string
	ForeignTable      string
	ForeignConstraint string
	ForeignName       string
}

func (ConstraintColumn) Values

func (c ConstraintColumn) Values() []interface{}

type ConstraintColumnReader

type ConstraintColumnReader interface {
	Reader
	ConstraintColumns(Filter) (*ConstraintColumnSet, error)
}

ConstraintColumnReader lists constraint columns.

type ConstraintColumnSet

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

func NewConstraintColumnSet

func NewConstraintColumnSet(v []ConstraintColumn) *ConstraintColumnSet

func (ConstraintColumnSet) Close

func (r ConstraintColumnSet) Close() error

func (ConstraintColumnSet) Columns

func (r ConstraintColumnSet) Columns() ([]string, error)

func (ConstraintColumnSet) Err

func (r ConstraintColumnSet) Err() error

func (ConstraintColumnSet) Get

func (*ConstraintColumnSet) Len

func (r *ConstraintColumnSet) Len() int

func (*ConstraintColumnSet) Next

func (r *ConstraintColumnSet) Next() bool

func (ConstraintColumnSet) NextResultSet

func (r ConstraintColumnSet) NextResultSet() bool

func (*ConstraintColumnSet) Reset

func (r *ConstraintColumnSet) Reset()

func (ConstraintColumnSet) Scan

func (r ConstraintColumnSet) Scan(dest ...interface{}) error

func (*ConstraintColumnSet) SetColumns

func (r *ConstraintColumnSet) SetColumns(c []string)

func (*ConstraintColumnSet) SetFilter

func (r *ConstraintColumnSet) SetFilter(f func(Result) bool)

func (*ConstraintColumnSet) SetScanValues

func (r *ConstraintColumnSet) SetScanValues(s func(Result) []interface{})

type ConstraintReader

type ConstraintReader interface {
	Reader
	Constraints(Filter) (*ConstraintSet, error)
}

ConstraintReader lists table constraints.

type ConstraintSet

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

func NewConstraintSet

func NewConstraintSet(v []Constraint) *ConstraintSet

func (ConstraintSet) Close

func (r ConstraintSet) Close() error

func (ConstraintSet) Columns

func (r ConstraintSet) Columns() ([]string, error)

func (ConstraintSet) Err

func (r ConstraintSet) Err() error

func (ConstraintSet) Get

func (i ConstraintSet) Get() *Constraint

func (*ConstraintSet) Len

func (r *ConstraintSet) Len() int

func (*ConstraintSet) Next

func (r *ConstraintSet) Next() bool

func (ConstraintSet) NextResultSet

func (r ConstraintSet) NextResultSet() bool

func (*ConstraintSet) Reset

func (r *ConstraintSet) Reset()

func (ConstraintSet) Scan

func (r ConstraintSet) Scan(dest ...interface{}) error

func (*ConstraintSet) SetColumns

func (r *ConstraintSet) SetColumns(c []string)

func (*ConstraintSet) SetFilter

func (r *ConstraintSet) SetFilter(f func(Result) bool)

func (*ConstraintSet) SetScanValues

func (r *ConstraintSet) SetScanValues(s func(Result) []interface{})

type DB

type DB interface {
	Exec(string, ...interface{}) (sql.Result, error)
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	Query(string, ...interface{}) (*sql.Rows, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRow(string, ...interface{}) *sql.Row
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
	Prepare(string) (*sql.Stmt, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
}

DB is the common interface for database operations, compatible with database/sql.DB and database/sql.Tx.

type DefaultWriter

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

DefaultWriter using an existing db introspector

func (DefaultWriter) DescribeFunctions

func (w DefaultWriter) DescribeFunctions(u *dburl.URL, funcTypes, pattern string, verbose, showSystem bool) error

DescribeFunctions matching pattern

func (DefaultWriter) DescribeTableDetails

func (w DefaultWriter) DescribeTableDetails(u *dburl.URL, pattern string, verbose, showSystem bool) error

DescribeTableDetails matching pattern

func (DefaultWriter) ListAllDbs

func (w DefaultWriter) ListAllDbs(u *dburl.URL, pattern string, verbose bool) error

ListAllDbs matching pattern

func (DefaultWriter) ListIndexes

func (w DefaultWriter) ListIndexes(u *dburl.URL, pattern string, verbose, showSystem bool) error

ListIndexes matching pattern

func (DefaultWriter) ListPrivilegeSummaries

func (w DefaultWriter) ListPrivilegeSummaries(u *dburl.URL, pattern string, showSystem bool) error

ListPrivilegeSummaries matching pattern

func (DefaultWriter) ListSchemas

func (w DefaultWriter) ListSchemas(u *dburl.URL, pattern string, verbose, showSystem bool) error

ListSchemas matching pattern

func (DefaultWriter) ListTables

func (w DefaultWriter) ListTables(u *dburl.URL, tableTypes, pattern string, verbose, showSystem bool) error

ListTables matching pattern

func (DefaultWriter) ShowStats

func (w DefaultWriter) ShowStats(u *dburl.URL, statTypes, pattern string, verbose bool, k int) error

ShowStats of columns for tables matching pattern

type Filter

type Filter struct {
	// Catalog name pattern that objects must belong to;
	// use Name to filter catalogs by name
	Catalog string
	// Schema name pattern that objects must belong to;
	// use Name to filter schemas by name
	Schema string
	// Parent name pattern that objects must belong to;
	// does not apply to schema and catalog containing matching objects
	Parent string
	// Reference name pattern of other objects referencing this one,
	Reference string
	// Name pattern that object name must match
	Name string
	// Types of the object
	Types []string
	// WithSystem objects
	WithSystem bool
	// OnlyVisible objects
	OnlyVisible bool
}

Filter objects returned by Readers

type Function

type Function struct {
	Catalog    string
	Schema     string
	Name       string
	ResultType string
	ArgTypes   string
	Type       string
	Volatility string
	Security   string
	Language   string
	Source     string

	SpecificName string
}

func (Function) Values

func (f Function) Values() []interface{}

type FunctionColumn

type FunctionColumn struct {
	Catalog         string
	Schema          string
	Table           string
	Name            string
	FunctionName    string
	OrdinalPosition int
	Type            string
	DataType        string
	// ScanType        reflect.Type
	ColumnSize      int
	DecimalDigits   int
	NumPrecRadix    int
	CharOctetLength int
}

func (FunctionColumn) Values

func (c FunctionColumn) Values() []interface{}

type FunctionColumnReader

type FunctionColumnReader interface {
	Reader
	FunctionColumns(Filter) (*FunctionColumnSet, error)
}

FunctionColumnReader lists function parameters.

type FunctionColumnSet

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

func NewFunctionColumnSet

func NewFunctionColumnSet(v []FunctionColumn) *FunctionColumnSet

func (FunctionColumnSet) Close

func (r FunctionColumnSet) Close() error

func (FunctionColumnSet) Columns

func (r FunctionColumnSet) Columns() ([]string, error)

func (FunctionColumnSet) Err

func (r FunctionColumnSet) Err() error

func (FunctionColumnSet) Get

func (*FunctionColumnSet) Len

func (r *FunctionColumnSet) Len() int

func (*FunctionColumnSet) Next

func (r *FunctionColumnSet) Next() bool

func (FunctionColumnSet) NextResultSet

func (r FunctionColumnSet) NextResultSet() bool

func (*FunctionColumnSet) Reset

func (r *FunctionColumnSet) Reset()

func (FunctionColumnSet) Scan

func (r FunctionColumnSet) Scan(dest ...interface{}) error

func (*FunctionColumnSet) SetColumns

func (r *FunctionColumnSet) SetColumns(c []string)

func (*FunctionColumnSet) SetFilter

func (r *FunctionColumnSet) SetFilter(f func(Result) bool)

func (*FunctionColumnSet) SetScanValues

func (r *FunctionColumnSet) SetScanValues(s func(Result) []interface{})

type FunctionReader

type FunctionReader interface {
	Reader
	Functions(Filter) (*FunctionSet, error)
}

FunctionReader lists database functions.

type FunctionSet

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

func NewFunctionSet

func NewFunctionSet(v []Function) *FunctionSet

func (FunctionSet) Close

func (r FunctionSet) Close() error

func (FunctionSet) Columns

func (r FunctionSet) Columns() ([]string, error)

func (FunctionSet) Err

func (r FunctionSet) Err() error

func (FunctionSet) Get

func (f FunctionSet) Get() *Function

func (*FunctionSet) Len

func (r *FunctionSet) Len() int

func (*FunctionSet) Next

func (r *FunctionSet) Next() bool

func (FunctionSet) NextResultSet

func (r FunctionSet) NextResultSet() bool

func (*FunctionSet) Reset

func (r *FunctionSet) Reset()

func (FunctionSet) Scan

func (r FunctionSet) Scan(dest ...interface{}) error

func (*FunctionSet) SetColumns

func (r *FunctionSet) SetColumns(c []string)

func (*FunctionSet) SetFilter

func (r *FunctionSet) SetFilter(f func(Result) bool)

func (*FunctionSet) SetScanValues

func (r *FunctionSet) SetScanValues(s func(Result) []interface{})

type Index

type Index struct {
	Catalog   string
	Schema    string
	Table     string
	Name      string
	IsPrimary Bool
	IsUnique  Bool
	Type      string
	Columns   string
}

func (Index) Values

func (i Index) Values() []interface{}

type IndexColumn

type IndexColumn struct {
	Catalog         string
	Schema          string
	Table           string
	IndexName       string
	Name            string
	DataType        string
	OrdinalPosition int
}

func (IndexColumn) Values

func (c IndexColumn) Values() []interface{}

type IndexColumnReader

type IndexColumnReader interface {
	Reader
	IndexColumns(Filter) (*IndexColumnSet, error)
}

IndexColumnReader lists index columns.

type IndexColumnSet

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

func NewIndexColumnSet

func NewIndexColumnSet(v []IndexColumn) *IndexColumnSet

func (IndexColumnSet) Close

func (r IndexColumnSet) Close() error

func (IndexColumnSet) Columns

func (r IndexColumnSet) Columns() ([]string, error)

func (IndexColumnSet) Err

func (r IndexColumnSet) Err() error

func (IndexColumnSet) Get

func (c IndexColumnSet) Get() *IndexColumn

func (*IndexColumnSet) Len

func (r *IndexColumnSet) Len() int

func (*IndexColumnSet) Next

func (r *IndexColumnSet) Next() bool

func (IndexColumnSet) NextResultSet

func (r IndexColumnSet) NextResultSet() bool

func (*IndexColumnSet) Reset

func (r *IndexColumnSet) Reset()

func (IndexColumnSet) Scan

func (r IndexColumnSet) Scan(dest ...interface{}) error

func (*IndexColumnSet) SetColumns

func (r *IndexColumnSet) SetColumns(c []string)

func (*IndexColumnSet) SetFilter

func (r *IndexColumnSet) SetFilter(f func(Result) bool)

func (*IndexColumnSet) SetScanValues

func (r *IndexColumnSet) SetScanValues(s func(Result) []interface{})

type IndexReader

type IndexReader interface {
	Reader
	Indexes(Filter) (*IndexSet, error)
}

IndexReader lists table indexes.

type IndexSet

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

func NewIndexSet

func NewIndexSet(v []Index) *IndexSet

func (IndexSet) Close

func (r IndexSet) Close() error

func (IndexSet) Columns

func (r IndexSet) Columns() ([]string, error)

func (IndexSet) Err

func (r IndexSet) Err() error

func (IndexSet) Get

func (i IndexSet) Get() *Index

func (*IndexSet) Len

func (r *IndexSet) Len() int

func (*IndexSet) Next

func (r *IndexSet) Next() bool

func (IndexSet) NextResultSet

func (r IndexSet) NextResultSet() bool

func (*IndexSet) Reset

func (r *IndexSet) Reset()

func (IndexSet) Scan

func (r IndexSet) Scan(dest ...interface{}) error

func (*IndexSet) SetColumns

func (r *IndexSet) SetColumns(c []string)

func (*IndexSet) SetFilter

func (r *IndexSet) SetFilter(f func(Result) bool)

func (*IndexSet) SetScanValues

func (r *IndexSet) SetScanValues(s func(Result) []interface{})

type LoggingReader

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

func NewLoggingReader

func NewLoggingReader(db DB, opts ...ReaderOption) LoggingReader

func (LoggingReader) Query

func (r LoggingReader) Query(q string, v ...interface{}) (*sql.Rows, CloseFunc, error)

type ObjectPrivilege

type ObjectPrivilege struct {
	Grantee       string
	Grantor       string
	PrivilegeType string
	IsGrantable   bool
}

ObjectPrivilege represents a privilege granted on a database object.

type ObjectPrivileges

type ObjectPrivileges []ObjectPrivilege

ObjectPrivileges represents privileges granted on a database object. The privileges are assumed to be sorted. Otherwise the String() method will fail.

func (ObjectPrivileges) Len

func (p ObjectPrivileges) Len() int

func (ObjectPrivileges) Less

func (p ObjectPrivileges) Less(i, j int) bool

func (ObjectPrivileges) String

func (p ObjectPrivileges) String() string

String returns a string representation of ObjectPrivileges. Assumes the ObjectPrivileges to be sorted.

func (ObjectPrivileges) Swap

func (p ObjectPrivileges) Swap(i, j int)

type PluginReader

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

PluginReader allows to be easily composed from other readers

func (PluginReader) Catalogs

func (p PluginReader) Catalogs(f Filter) (*CatalogSet, error)

func (PluginReader) ColumnStats

func (p PluginReader) ColumnStats(f Filter) (*ColumnStatSet, error)

func (PluginReader) Columns

func (p PluginReader) Columns(f Filter) (*ColumnSet, error)

func (PluginReader) ConstraintColumns

func (p PluginReader) ConstraintColumns(f Filter) (*ConstraintColumnSet, error)

func (PluginReader) Constraints

func (p PluginReader) Constraints(f Filter) (*ConstraintSet, error)

func (PluginReader) FunctionColumns

func (p PluginReader) FunctionColumns(f Filter) (*FunctionColumnSet, error)

func (PluginReader) Functions

func (p PluginReader) Functions(f Filter) (*FunctionSet, error)

func (PluginReader) IndexColumns

func (p PluginReader) IndexColumns(f Filter) (*IndexColumnSet, error)

func (PluginReader) Indexes

func (p PluginReader) Indexes(f Filter) (*IndexSet, error)

func (PluginReader) PrivilegeSummaries

func (p PluginReader) PrivilegeSummaries(f Filter) (*PrivilegeSummarySet, error)

func (PluginReader) Schemas

func (p PluginReader) Schemas(f Filter) (*SchemaSet, error)

func (PluginReader) Sequences

func (p PluginReader) Sequences(f Filter) (*SequenceSet, error)

func (PluginReader) Tables

func (p PluginReader) Tables(f Filter) (*TableSet, error)

func (PluginReader) Triggers

func (p PluginReader) Triggers(f Filter) (*TriggerSet, error)

type PrivilegeSummary

type PrivilegeSummary struct {
	Catalog          string
	Schema           string
	Name             string
	ObjectType       string
	ObjectPrivileges ObjectPrivileges
	ColumnPrivileges ColumnPrivileges
}

PrivilegeSummary summarizes the privileges granted on a database object

func (PrivilegeSummary) Values

func (s PrivilegeSummary) Values() []interface{}

type PrivilegeSummaryReader

type PrivilegeSummaryReader interface {
	Reader
	PrivilegeSummaries(Filter) (*PrivilegeSummarySet, error)
}

PrivilegeSummaryReader lists summaries of privileges granted on tables, views and sequences.

type PrivilegeSummarySet

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

func NewPrivilegeSummarySet

func NewPrivilegeSummarySet(v []PrivilegeSummary) *PrivilegeSummarySet

func (PrivilegeSummarySet) Close

func (r PrivilegeSummarySet) Close() error

func (PrivilegeSummarySet) Columns

func (r PrivilegeSummarySet) Columns() ([]string, error)

func (PrivilegeSummarySet) Err

func (r PrivilegeSummarySet) Err() error

func (PrivilegeSummarySet) Get

func (*PrivilegeSummarySet) Len

func (r *PrivilegeSummarySet) Len() int

func (*PrivilegeSummarySet) Next

func (r *PrivilegeSummarySet) Next() bool

func (PrivilegeSummarySet) NextResultSet

func (r PrivilegeSummarySet) NextResultSet() bool

func (*PrivilegeSummarySet) Reset

func (r *PrivilegeSummarySet) Reset()

func (PrivilegeSummarySet) Scan

func (r PrivilegeSummarySet) Scan(dest ...interface{}) error

func (*PrivilegeSummarySet) SetColumns

func (r *PrivilegeSummarySet) SetColumns(c []string)

func (*PrivilegeSummarySet) SetFilter

func (r *PrivilegeSummarySet) SetFilter(f func(Result) bool)

func (*PrivilegeSummarySet) SetScanValues

func (r *PrivilegeSummarySet) SetScanValues(s func(Result) []interface{})

type Reader

type Reader interface{}

Reader of any database metadata in a structured format.

func NewPluginReader

func NewPluginReader(readers ...Reader) Reader

NewPluginReader allows to be easily composed from other readers

type ReaderOption

type ReaderOption func(Reader)

ReaderOption to configure the reader

func WithDryRun

func WithDryRun(d bool) ReaderOption

WithDryRun allows to avoid running any queries

func WithLimit

func WithLimit(l int) ReaderOption

WithLimit for a single query, if the reader supports it

func WithLogger

func WithLogger(l logger) ReaderOption

WithLogger used to log queries before executing them

func WithTimeout

func WithTimeout(t time.Duration) ReaderOption

WithTimeout for a single query

type Result

type Result interface {
	Values() []interface{}
}

type Schema

type Schema struct {
	Schema  string
	Catalog string
}

func (Schema) Values

func (s Schema) Values() []interface{}

type SchemaReader

type SchemaReader interface {
	Reader
	Schemas(Filter) (*SchemaSet, error)
}

SchemaReader lists database schemas.

type SchemaSet

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

func NewSchemaSet

func NewSchemaSet(v []Schema) *SchemaSet

func (SchemaSet) Close

func (r SchemaSet) Close() error

func (SchemaSet) Columns

func (r SchemaSet) Columns() ([]string, error)

func (SchemaSet) Err

func (r SchemaSet) Err() error

func (SchemaSet) Get

func (s SchemaSet) Get() *Schema

func (*SchemaSet) Len

func (r *SchemaSet) Len() int

func (*SchemaSet) Next

func (r *SchemaSet) Next() bool

func (SchemaSet) NextResultSet

func (r SchemaSet) NextResultSet() bool

func (*SchemaSet) Reset

func (r *SchemaSet) Reset()

func (SchemaSet) Scan

func (r SchemaSet) Scan(dest ...interface{}) error

func (*SchemaSet) SetColumns

func (r *SchemaSet) SetColumns(c []string)

func (*SchemaSet) SetFilter

func (r *SchemaSet) SetFilter(f func(Result) bool)

func (*SchemaSet) SetScanValues

func (r *SchemaSet) SetScanValues(s func(Result) []interface{})

type Sequence

type Sequence struct {
	Catalog   string
	Schema    string
	Name      string
	DataType  string
	Start     string
	Min       string
	Max       string
	Increment string
	Cycles    Bool
}

func (Sequence) Values

func (s Sequence) Values() []interface{}

type SequenceReader

type SequenceReader interface {
	Reader
	Sequences(Filter) (*SequenceSet, error)
}

SequenceReader lists sequences.

type SequenceSet

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

func NewSequenceSet

func NewSequenceSet(v []Sequence) *SequenceSet

func (SequenceSet) Close

func (r SequenceSet) Close() error

func (SequenceSet) Columns

func (r SequenceSet) Columns() ([]string, error)

func (SequenceSet) Err

func (r SequenceSet) Err() error

func (SequenceSet) Get

func (s SequenceSet) Get() *Sequence

func (*SequenceSet) Len

func (r *SequenceSet) Len() int

func (*SequenceSet) Next

func (r *SequenceSet) Next() bool

func (SequenceSet) NextResultSet

func (r SequenceSet) NextResultSet() bool

func (*SequenceSet) Reset

func (r *SequenceSet) Reset()

func (SequenceSet) Scan

func (r SequenceSet) Scan(dest ...interface{}) error

func (*SequenceSet) SetColumns

func (r *SequenceSet) SetColumns(c []string)

func (*SequenceSet) SetFilter

func (r *SequenceSet) SetFilter(f func(Result) bool)

func (*SequenceSet) SetScanValues

func (r *SequenceSet) SetScanValues(s func(Result) []interface{})

type Table

type Table struct {
	Catalog string
	Schema  string
	Name    string
	Type    string
	Rows    int64
	Size    string
	Comment string
}

func (Table) Values

func (t Table) Values() []interface{}

type TableReader

type TableReader interface {
	Reader
	Tables(Filter) (*TableSet, error)
}

TableReader lists database tables.

type TableSet

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

func NewTableSet

func NewTableSet(v []Table) *TableSet

func (TableSet) Close

func (r TableSet) Close() error

func (TableSet) Columns

func (r TableSet) Columns() ([]string, error)

func (TableSet) Err

func (r TableSet) Err() error

func (TableSet) Get

func (t TableSet) Get() *Table

func (*TableSet) Len

func (r *TableSet) Len() int

func (*TableSet) Next

func (r *TableSet) Next() bool

func (TableSet) NextResultSet

func (r TableSet) NextResultSet() bool

func (*TableSet) Reset

func (r *TableSet) Reset()

func (TableSet) Scan

func (r TableSet) Scan(dest ...interface{}) error

func (*TableSet) SetColumns

func (r *TableSet) SetColumns(c []string)

func (*TableSet) SetFilter

func (r *TableSet) SetFilter(f func(Result) bool)

func (*TableSet) SetScanValues

func (r *TableSet) SetScanValues(s func(Result) []interface{})

type Trigger

type Trigger struct {
	Catalog    string
	Schema     string
	Table      string
	Name       string
	Definition string
}

func (Trigger) Values

func (t Trigger) Values() []interface{}

type TriggerReader

type TriggerReader interface {
	Reader
	Triggers(Filter) (*TriggerSet, error)
}

TriggerReader lists table triggers.

type TriggerSet

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

func NewTriggerSet

func NewTriggerSet(t []Trigger) *TriggerSet

func (TriggerSet) Close

func (r TriggerSet) Close() error

func (TriggerSet) Columns

func (r TriggerSet) Columns() ([]string, error)

func (TriggerSet) Err

func (r TriggerSet) Err() error

func (TriggerSet) Get

func (t TriggerSet) Get() *Trigger

func (*TriggerSet) Len

func (r *TriggerSet) Len() int

func (*TriggerSet) Next

func (r *TriggerSet) Next() bool

func (TriggerSet) NextResultSet

func (r TriggerSet) NextResultSet() bool

func (*TriggerSet) Reset

func (r *TriggerSet) Reset()

func (TriggerSet) Scan

func (r TriggerSet) Scan(dest ...interface{}) error

func (*TriggerSet) SetColumns

func (r *TriggerSet) SetColumns(c []string)

func (*TriggerSet) SetFilter

func (r *TriggerSet) SetFilter(f func(Result) bool)

func (*TriggerSet) SetScanValues

func (r *TriggerSet) SetScanValues(s func(Result) []interface{})

type Writer

type Writer interface {
	// DescribeFunctions \df, \dfa, \dfn, \dft, \dfw, etc.
	DescribeFunctions(*dburl.URL, string, string, bool, bool) error
	// DescribeTableDetails \d foo
	DescribeTableDetails(*dburl.URL, string, bool, bool) error
	// ListAllDbs \l
	ListAllDbs(*dburl.URL, string, bool) error
	// ListTables \dt, \dv, \dm, etc.
	ListTables(*dburl.URL, string, string, bool, bool) error
	// ListSchemas \dn
	ListSchemas(*dburl.URL, string, bool, bool) error
	// ListIndexes \di
	ListIndexes(*dburl.URL, string, bool, bool) error
	// ShowStats \ss
	ShowStats(*dburl.URL, string, string, bool, int) error
	// ListPrivilegeSummaries \dp
	ListPrivilegeSummaries(*dburl.URL, string, bool) error
}

Writer of database metadata in a human readable format.

type WriterOption

type WriterOption func(*DefaultWriter)

WriterOption to configure the DefaultWriter

func WithListAllDbs

func WithListAllDbs(f func(string, bool) error) WriterOption

WithListAllDbs that lists all catalogs

func WithSystemSchemas

func WithSystemSchemas(schemas []string) WriterOption

WithSystemSchemas that are ignored unless showSystem is true

Directories

Path Synopsis
Package informationschema provides metadata readers that query tables from the information_schema schema.
Package informationschema provides metadata readers that query tables from the information_schema schema.
Package oracle provides a metadata reader
Package oracle provides a metadata reader
Package postgres provides a metadata reader
Package postgres provides a metadata reader

Jump to

Keyboard shortcuts

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