Documentation
¶
Overview ¶
Package schema provides types for representing SQLite database schemas.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QuoteIdentifier ¶ added in v0.2.0
QuoteIdentifier renders a SQLite identifier (table, column, index, ...) as a double-quoted identifier. Embedded double quotes are escaped by doubling them, as SQLite requires. Note that Go's %q verb cannot be used here: it produces backslash escapes such as "q\"t", which SQLite misparses.
Types ¶
type Column ¶
type Column struct {
Name string
Type string
NotNull bool
Default *string
PrimaryKey int // 0 = not PK, 1+ = PK position
Hidden int // 0 = normal, 2 = virtual/generated, 3 = stored
}
Column represents a table column (from PRAGMA table_info).
type Database ¶
type Database struct {
Tables map[string]*Table
Indexes map[string]*Index
Views map[string]*View
Triggers map[string]*Trigger
}
Database represents a complete SQLite database schema.
type Table ¶
type Table struct {
Name string
Columns []Column
SQL string // Original CREATE TABLE statement
// UniqueColumns lists columns that participate in a UNIQUE table
// constraint. SQLite does not expose this through PRAGMA table_info.
UniqueColumns []string
// ForeignKeyColumns lists columns that are the referencing side of a
// foreign key (column-level or table-level).
ForeignKeyColumns []string
}
Table represents a SQLite table.
func (*Table) ColumnNames ¶
ColumnNames returns the column names for a table.
Click to show internal directories.
Click to hide internal directories.