system

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DefaultSchemaColumnsCatalog = "def"

	InformationSchema        = "information_schema"
	InformationSchemaColumns = "COLUMNS"
	SchemaColumns            = InformationSchema + "." + InformationSchemaColumns
	SchemaColumnsCatalog     = "TABLE_CATALOG"
	SchemaColumnsSchema      = "TABLE_SCHEMA"
	SchemaColumnsTableName   = "TABLE_NAME"
	SchemaColumnsColumnName  = "COLUMN_NAME"
	SchemaColumnsDataType    = "DATA_TYPE"
	SchemaColumnsQuery       = "SELECT * FROM " + SchemaColumns
)

Variables

View Source
var ErrInvalid = errors.New("invalid")

ErrInvalid is returned when the value is invalid.

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when the value is not found.

Functions

func IsSchemaColumsQuery

func IsSchemaColumsQuery(stmt sql.Select) bool

IsSchemaColumsQuery returns true if the statement is a schema columns query.

func NewSchemaColumnsQueryFromTableNames

func NewSchemaColumnsQueryFromTableNames(tableNames []string) (sql.Select, error)

NewSchemaColumnsQueryFromTableNames returns a new schema columns query with table names.

func NewSchemaColumnsResultSetSchema

func NewSchemaColumnsResultSetSchema() (resultset.Schema, error)

SchemaColumnsResultSet represents a schema columns resultset.

Types

type ColumnOption

type ColumnOption func(*column) error

func WithColumnCatalog

func WithColumnCatalog(a any) ColumnOption

WithColumnCatalog returns a column option to set the catalog name.

func WithColumnConstraint

func WithColumnConstraint(v any) ColumnOption

WithColumnConstraint returns a column option to set the column constraint.

func WithColumnDataType

func WithColumnDataType(v any) ColumnOption

WithColumnDataType returns a column option to set the data type.

func WithColumnName

func WithColumnName(a any) ColumnOption

WithColumnName returns a column option to set the column name.

func WithColumnSchema

func WithColumnSchema(a any) ColumnOption

WithColumnSchema returns a column option to set the schema name.

func WithColumnTable

func WithColumnTable(a any) ColumnOption

WithColumnTable returns a column option to set the table name.

type Constraint

type Constraint = query.Constraint

Constraint represents a column constraint.

type DataType

type DataType = query.DataType

DataType represents a data type.

type ResultSet

type ResultSet = resultset.ResultSet

ResultSet represents a response resultset interface.

func NewSchemaColumnsResultSetFromSchemas

func NewSchemaColumnsResultSetFromSchemas(schemas []query.Schema) (ResultSet, error)

NewSchemaColumnsResultSetFromSchemas returns a new ResultSet instance from the specified schemas.

type SchemaColumn

type SchemaColumn interface {
	// Catalog returns the catalog name.
	Catalog() string
	// Schema returns the schema name.
	Schema() string
	// Table returns the table name.
	Table() string
	// Name returns the column name.
	Name() string
	// DataType returns the data type.
	DataType() DataType
	// Constraint returns the column constraint.
	Constraint() Constraint
}

SchemaColumn represents a schema column interface.

func NewColumn

func NewColumn(opts ...ColumnOption) (SchemaColumn, error)

NewColumn returns a new column.

type SchemaColumnOption

type SchemaColumnOption func(*rs)

NewSchemaColumns returns a new SchemaColumns instance.

func WithColumns

func WithColumns(columns []SchemaColumn) SchemaColumnOption

WithColumns returns a SchemaColumnOption that sets the columns.

type SchemaColumnsResultSet

type SchemaColumnsResultSet interface {
	// Columns returns the columns.
	Columns() []SchemaColumn
	// LookupColumn returns the column by name.
	LookupColumn(name string) (SchemaColumn, error)
}

SchemaColumnsResultSet represents a schema columns result set.

func NewSchemaColumns

func NewSchemaColumns(opts ...SchemaColumnOption) SchemaColumnsResultSet

NewSchemaColumns returns a new SchemaColumns instance.

func NewSchemaColumnsResultSetFromResultSet

func NewSchemaColumnsResultSetFromResultSet(rs ResultSet) (SchemaColumnsResultSet, error)

NewSchemaColumnsResultSetFromResultSet returns a new SchemaColumnsResultSet instance from the specified ResultSet.

type SchemaColumnsStatement

type SchemaColumnsStatement interface {
	// Statement returns the statement.
	Statement() sql.Select
	// DatabaseName returns the database name.
	DatabaseName() string
	// TableNames returns the table names.
	TableNames() []string
}

SchemaColumnsStatement represents a schema columns statement.

func NewSchemaColumnsStatement

func NewSchemaColumnsStatement(opts ...SchemaColumnsStatementOption) (SchemaColumnsStatement, error)

NewSchemaColumnsStatement returns a new SchemaColumnsStatement.

type SchemaColumnsStatementOption

type SchemaColumnsStatementOption func(*schemaColumnsStatement)

SchemaColumnsStatement represents a schema columns statement.

func WithSchemaColumnsStatementDatabaseName

func WithSchemaColumnsStatementDatabaseName(db string) SchemaColumnsStatementOption

With SchemaColumnsStatementDatabaseName sets the database name.

func WithSchemaColumnsStatementSelect

func WithSchemaColumnsStatementSelect(sel sql.Select) SchemaColumnsStatementOption

WithSchemaColumnsStatementSelect sets the select statement.

func WithSchemaColumnsStatementTableNames

func WithSchemaColumnsStatementTableNames(tables []string) SchemaColumnsStatementOption

WithSchemaColumnsStatementTableName sets the table name.

Jump to

Keyboard shortcuts

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