schemer

package
v0.4.54 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 9 Imported by: 0

README

Schemer

Provide schema information about databases

Implemented DB drivers

Help wanted

We would happily accept pull requests with schemer implementations for:

  • MySQL
  • Oracle
  • PostgreSQL
  • Spanner
  • Tarantool

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	TableRef
	models.TableColumn
}

Column defines column

type ColumnsProvider

type ColumnsProvider interface {
	GetColumns(c context.Context, db *sql.DB, catalog, schemaName, tableName string) (ColumnsReader, error)
}

ColumnsProvider reads columns info

type ColumnsReader

type ColumnsReader interface {
	// NextColumn returns next column
	NextColumn() (Column, error)
}

ColumnsReader provides columns

type Constraint

type Constraint struct {
	TableRef
	ColumnName                                                            string
	UniqueConstraintCatalog, UniqueConstraintSchema, UniqueConstraintName sql.NullString
	MatchOption, UpdateRule, DeleteRule                                   sql.NullString
	RefTableCatalog, RefTableSchema, RefTableName, RefColName             sql.NullString
	*models.Constraint
}

Constraint defines a constraint

type ConstraintsProvider

type ConstraintsProvider interface {
	// GetConstraints returns constrains
	GetConstraints(c context.Context, db *sql.DB, catalog, schema, table string) (ConstraintsReader, error)
}

ConstraintsProvider provides constraints

type ConstraintsReader

type ConstraintsReader interface {
	NextConstraint() (*Constraint, error)
}

ConstraintsReader reads constraint

type Index

type Index struct {
	TableRef
	*models.Index
}

Index defines index

type IndexColumn

type IndexColumn struct {
	TableRef
	IndexName string
	*models.IndexColumn
}

IndexColumn defines index column

type IndexColumnsProvider

type IndexColumnsProvider interface {
	// GetIndexColumns returns index columns
	GetIndexColumns(c context.Context, db *sql.DB, catalog, schema, table, index string) (IndexColumnsReader, error)
}

IndexColumnsProvider provides index columns

type IndexColumnsReader

type IndexColumnsReader interface {
	// NextIndexColumn returns index column
	NextIndexColumn() (*IndexColumn, error)
}

IndexColumnsReader provides index columns

type IndexesProvider

type IndexesProvider interface {
	// GetIndexes returns next index
	GetIndexes(c context.Context, db *sql.DB, catalog, schema, table string) (IndexesReader, error)
}

IndexesProvider provides indexes

type IndexesReader

type IndexesReader interface {
	// NextIndex returns next index
	NextIndex() (*Index, error)
}

IndexesReader provides indexes

type InformationSchema

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

InformationSchema provides API to retrieve information about a database

func NewInformationSchema

func NewInformationSchema(server models.ServerReference, db *sql.DB) InformationSchema

NewInformationSchema creates new InformationSchema

func (InformationSchema) GetDatabase

func (s InformationSchema) GetDatabase(name string) (database *models.DbCatalog, err error)

GetDatabase returns complete information about a database

type RecordsCountProvider

type RecordsCountProvider interface {
	RecordsCount(c context.Context, db *sql.DB, catalog, schema, table string) (*int, error)
}

RecordsCountProvider provides count for a recordset

type Scanner

type Scanner interface {
	ScanCatalog(c context.Context, db *sql.DB, name string) (database *models.DbCatalog, err error)
}

Scanner defines scanner

func NewScanner

func NewScanner(schemaProvider SchemaProvider) Scanner

NewScanner creates new scanner

type SchemaProvider

SchemaProvider provides schema info

type TablePropsReader

type TablePropsReader struct {
	Table string
	Rows  *sql.Rows
}

TablePropsReader reads table props

type TableRef

type TableRef struct {
	SchemaName string
	TableName  string
	TableType  string
}

TableRef defines a reference to a table

type TablesProvider

type TablesProvider interface {
	// GetTables returns tables
	GetTables(c context.Context, db *sql.DB, catalog, schema string) (TablesReader, error)
}

TablesProvider provides tables

type TablesReader

type TablesReader interface {
	NextTable() (*models.Table, error)
}

TablesReader reads table info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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