Documentation
¶
Overview ¶
Package sqlinspect provides reusable, read-only SQL catalog inspection.
Index ¶
- Constants
- func ListDatabases(ctx context.Context, db *sql.DB, driver string) (_ []string, returnErr error)
- func NormalizeDriver(driver string) string
- func ValidateDriver(driver string) error
- type Catalog
- type Column
- type ForeignKey
- type Index
- type Limits
- type Relation
- type Routine
- type RoutineParameter
- type Schema
- type Trigger
Constants ¶
View Source
const ( DefaultMaxRelations = 5000 DefaultMaxColumns = 50000 DefaultMaxMetadata = 50000 DefaultMaxRoutines = 2000 DefaultMaxDefinitionBytes = 4 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func ListDatabases ¶
ListDatabases returns databases accessible to the current connection user.
func NormalizeDriver ¶
NormalizeDriver resolves supported driver aliases to their catalog backend.
func ValidateDriver ¶
ValidateDriver rejects backends without catalog queries.
Types ¶
type Catalog ¶
type Catalog struct {
Driver string `json:"driver"`
Database string `json:"database,omitempty"`
Capabilities connection.BackendCapabilities `json:"capabilities"`
Databases []string `json:"databases,omitempty"`
DefaultSchema string `json:"defaultSchema,omitempty"`
Schemas []Schema `json:"schemas"`
Truncated bool `json:"truncated,omitempty"`
TruncateReason string `json:"truncateReason,omitempty"`
}
type Column ¶
type Column struct {
Name string `json:"name"`
DataType string `json:"dataType,omitempty"`
Ordinal int `json:"ordinal,omitempty"`
Nullable *bool `json:"nullable,omitempty"`
Default *string `json:"default,omitempty"`
Identity bool `json:"identity,omitempty"`
PrimaryKey bool `json:"primaryKey,omitempty"`
Unique bool `json:"unique,omitempty"`
MaxLength *int `json:"maxLength,omitempty"`
NumericPrecision *int `json:"numericPrecision,omitempty"`
NumericScale *int `json:"numericScale,omitempty"`
Comment *string `json:"comment,omitempty"`
EnumValues []string `json:"enumValues,omitempty"`
}
type ForeignKey ¶
type Limits ¶
type Limits struct {
MaxRelations int
MaxColumns int
MaxMetadata int
MaxRoutines int
MaxDefinitionBytes int
}
func (Limits) WithDefaults ¶
WithDefaults resolves zero catalog limits to the documented bounds.
type Relation ¶
type Relation struct {
Name string `json:"name"`
Type string `json:"type"`
ViewDef string `json:"viewDefinition,omitempty"`
Columns []Column `json:"columns"`
Indexes []Index `json:"indexes,omitempty"`
ForeignKeys []ForeignKey `json:"foreignKeys,omitempty"`
Triggers []Trigger `json:"triggers,omitempty"`
}
type RoutineParameter ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
catalog
|
|
|
sqlserver
Package mssqlcatalog reads SQL Server catalog views into plain row structs.
|
Package mssqlcatalog reads SQL Server catalog views into plain row structs. |
|
Package snapshot inspects complete SQL Server schemas for migration planning.
|
Package snapshot inspects complete SQL Server schemas for migration planning. |
Click to show internal directories.
Click to hide internal directories.