Documentation ¶
Overview ¶
Package schema is a separate package so it can be used by query parsing.
Index ¶
- Constants
- func CheckIndexes(table string, cols []string, idxs []Index)
- type Fkey
- type Index
- type Schema
- func (sc *Schema) Check()
- func (sc *Schema) Cksum() uint32
- func (sc *Schema) DumpString() string
- func (sc *Schema) FindIndex(cols []string) *Index
- func (sc *Schema) HasDeleted() bool
- func (sc *Schema) HasFkey() bool
- func (sc *Schema) HasFkeyToHere() bool
- func (sc *Schema) IIndex(cols []string) int
- func (sc *Schema) String() string
- func (sc *Schema) String2() string
Constants ¶
View Source
const ( Block = 0 CascadeUpdates = 1 CascadeDeletes = 2 Cascade = CascadeUpdates | CascadeDeletes )
Fkey mode bits
Variables ¶
This section is empty.
Functions ¶
func CheckIndexes ¶
Types ¶
type Index ¶
type Index struct { Ixspec ixkey.Spec Columns []string // BestKey is the key used to make indexes ('i' and 'u') unique. // A key used as BestKey must not be dropped. // BestKey must be persisted (unlike Primary and ConstainsKey) // because it affects the btrees and modifying the schema could change it. BestKey []string // FkToHere is other foreign keys that reference this index FkToHere []Fkey // filled in by meta Fk Fkey // Mode is 'k' for key, 'i' for index, 'u' for unique index Mode byte // Primary is true for keys ('k') that do not contain another key. // Only primary keys need duplicate checking. Primary bool // ContainsKey is true for indexes ('i' and 'u') that contain a key. // Unique indexes ('u') that contain a key do not need duplicate checking. ContainsKey bool }
type Schema ¶
type Schema struct { Table string // Columns are the physical fields in the records, in order Columns []string // Derived are the rules (capitalized) and _lower! Derived []string Indexes []Index }
func (*Schema) DumpString ¶
DumpString does not include fkToHere or deleted columns
func (*Schema) FindIndex ¶
FindIndex returns a pointer to the Index with the given columns or else nil if not found
func (*Schema) HasDeleted ¶
func (*Schema) HasFkeyToHere ¶
Click to show internal directories.
Click to hide internal directories.