informationschema

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: 6 Imported by: 0

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

func WithCheckConstraints(con bool) metadata.ReaderOption

WithCheckConstraints when the `statistics` table exists

func WithColumnPrivileges

func WithColumnPrivileges(c bool) metadata.ReaderOption

WithColumnPrivileges when the `column_privileges` table exists

func WithConstraints

func WithConstraints(con bool) metadata.ReaderOption

WithConstraints when the `statistics` table exists

func WithCurrentSchema

func WithCurrentSchema(expr string) metadata.ReaderOption

WithCurrentSchema expression to filter by when OnlyVisible filter is true

func WithCustomClauses

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

WithCustomClauses to use different expressions for some columns

func WithDataTypeFormatter

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

func WithSystemSchemas(schemas []string) metadata.ReaderOption

WithSystemSchemas that are ignored unless WithSystem filter is true

func WithTablePrivileges

func WithTablePrivileges(t bool) metadata.ReaderOption

WithTablePrivileges when the `table_privileges` table exists

func WithUsagePrivileges

func WithUsagePrivileges(u bool) metadata.ReaderOption

WithUsagePrivileges when the `usage_privileges` table exists

Types

type ClauseName

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

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

func (InformationSchema) Constraints

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

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

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