informationschema

package
v0.13.7 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: MIT Imports: 6 Imported by: 7

Documentation

Overview

Package informationschema provides metadata readers that query tables from the information_schema schema. It tries to be database agnostic, but there is a set of options to configure what tables and columns to expect.

Index

Constants

View Source
const (
	ColumnsDataType         = ClauseName("columns.data_type")
	ColumnsColumnSize       = ClauseName("columns.column_size")
	ColumnsNumericScale     = ClauseName("columns.numeric_scale")
	ColumnsNumericPrecRadix = ClauseName("columns.numeric_precision_radix")
	ColumnsCharOctetLength  = ClauseName("columns.character_octet_length")

	FunctionColumnsColumnSize       = ClauseName("function_columns.column_size")
	FunctionColumnsNumericScale     = ClauseName("function_columns.numeric_scale")
	FunctionColumnsNumericPrecRadix = ClauseName("function_columns.numeric_precision_radix")
	FunctionColumnsCharOctetLength  = ClauseName("function_columns.character_octet_length")

	FunctionsSecurityType = ClauseName("functions.security_type")

	ConstraintIsDeferrable      = ClauseName("constraint_columns.is_deferrable")
	ConstraintInitiallyDeferred = ClauseName("constraint_columns.initially_deferred")
	ConstraintJoinCond          = ClauseName("constraint_join.fk")

	SequenceColumnsIncrement = ClauseName("sequence_columns.increment")

	PrivilegesGrantor = ClauseName("privileges.grantor")
)

Variables

This section is empty.

Functions

func New

New InformationSchema reader

func WithCheckConstraints added in v0.9.0

func WithCheckConstraints(con bool) metadata.ReaderOption

WithCheckConstraints when the `statistics` table exists

func WithColumnPrivileges added in v0.12.1

func WithColumnPrivileges(c bool) metadata.ReaderOption

WithColumnPrivileges when the `column_privileges` table exists

func WithConstraints added in v0.9.0

func WithConstraints(con bool) metadata.ReaderOption

WithConstraints when the `statistics` table exists

func WithCurrentSchema added in v0.9.0

func WithCurrentSchema(expr string) metadata.ReaderOption

WithCurrentSchema expression to filter by when OnlyVisible filter is true

func WithCustomClauses added in v0.9.0

func WithCustomClauses(cols map[ClauseName]string) metadata.ReaderOption

WithCustomClauses to use different expressions for some columns

func WithDataTypeFormatter added in v0.11.1

func WithDataTypeFormatter(f func(metadata.Column) string) metadata.ReaderOption

WithDataTypeFormatter function to build updated string represenation of data type from Column

func WithFunctions

func WithFunctions(fun bool) metadata.ReaderOption

WithFunctions when the `routines` and `parameters` tables exists

func WithIndexes

func WithIndexes(ind bool) metadata.ReaderOption

WithIndexes when the `statistics` table exists

func WithPlaceholder

func WithPlaceholder(pf func(int) string) metadata.ReaderOption

WithPlaceholder generator function, that usually returns either `?` or `$n`, where `n` is the argument.

func WithSequences

func WithSequences(seq bool) metadata.ReaderOption

WithSequences when the `sequences` table exists

func WithSystemSchemas added in v0.9.0

func WithSystemSchemas(schemas []string) metadata.ReaderOption

WithSystemSchemas that are ignored unless WithSystem filter is true

func WithTablePrivileges added in v0.12.1

func WithTablePrivileges(t bool) metadata.ReaderOption

WithTablePrivileges when the `table_privileges` table exists

func WithUsagePrivileges added in v0.12.1

func WithUsagePrivileges(u bool) metadata.ReaderOption

WithUsagePrivileges when the `usage_privileges` table exists

Types

type ClauseName added in v0.9.0

type ClauseName string

type InformationSchema

type InformationSchema struct {
	metadata.LoggingReader
	// contains filtered or unexported fields
}

InformationSchema metadata reader

func (InformationSchema) Columns

Columns from selected catalog (or all, if empty), matching schemas and tables

func (InformationSchema) ConstraintColumns added in v0.9.0

ConstraintColumns from selected catalog (or all, if empty), matching schemas and constraints

func (InformationSchema) Constraints added in v0.9.0

Constraintes from selected catalog (or all, if empty), matching schemas and names

func (InformationSchema) FunctionColumns

FunctionColumns (arguments) from selected catalog (or all, if empty), matching schemas and functions

func (InformationSchema) Functions

Functions from selected catalog (or all, if empty), matching schemas, names and types

func (InformationSchema) IndexColumns

IndexColumns from selected catalog (or all, if empty), matching schemas and indexes

func (InformationSchema) Indexes

Indexes from selected catalog (or all, if empty), matching schemas and names

func (InformationSchema) PrivilegeSummaries added in v0.12.1

func (s InformationSchema) PrivilegeSummaries(f metadata.Filter) (*metadata.PrivilegeSummarySet, error)

PrivilegeSummaries of privileges on tables, views and sequences from selected catalog (or all, if empty), matching schemas and names

func (InformationSchema) Schemas

Schemas from selected catalog (or all, if empty), matching schemas and tables

func (InformationSchema) Sequences

Sequences from selected catalog (or all, if empty), matching schemas and names

func (*InformationSchema) SetLimit added in v0.9.0

func (s *InformationSchema) SetLimit(l int)

func (InformationSchema) Tables

Tables from selected catalog (or all, if empty), matching schemas, names and types

type Logger

type Logger interface {
	Println(...interface{})
}

Jump to

Keyboard shortcuts

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