Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ForeignKey ¶
func (*ForeignKey) String ¶
func (f *ForeignKey) String() string
type GeneratedOption ¶
type GeneratedOption struct {
Stored bool
// contains filtered or unexported fields
}
func (*GeneratedOption) String ¶
func (g *GeneratedOption) String() string
type IndexOptions ¶
type IndexOptions struct {
Name string // Name of the index
Unique bool // Whether the index is unique
Where string // Conditional index (partial index)
Column string
}
func (*IndexOptions) String ¶
func (i *IndexOptions) String(table string) string
type SQLSchema ¶
type SQLSchema struct {
Tables []*SqlTable
}
func CreateSchema ¶
GenerateSchema generates SQL schema from structs
type SqlColumn ¶
type SqlColumn struct {
Name string
Tags *TagOptions
}
type SqlTable ¶
type SqlTable struct {
Name string
TableConfig *TableOptions
Columns []*SqlColumn
ForeignKeys []*ForeignKey
Indexes []*IndexOptions
}
type TableOptions ¶
type TableOptions struct {
IfNotExist bool
}
type TagOptions ¶
type TagOptions struct {
Type string
// Basic Constraints
PrimaryKey bool // PRIMARY KEY constraint
ForeignKey *ForeignKey // FOREIGN KEY constraint with reference
Unique bool // UNIQUE constraint
NotNull bool // NOT NULL constraint
AutoIncrement bool // AUTOINCREMENT (only for INTEGER PRIMARY KEY)
// Value Constraints
Default string // DEFAULT value
Check string // CHECK constraint
// Text-specific Attributes
Collate string // COLLATION type (BINARY, NOCASE, RTRIM)
// Generated Column
Generated *GeneratedOption // GENERATED ALWAYS AS expression
// Conflict Clause
OnConflict string // ON CONFLICT clause (ROLLBACK, ABORT, FAIL, IGNORE, REPLACE)
// Deferrable Constraints
Deferrable bool // DEFERRABLE
InitiallyDeferred bool // INITIALLY DEFERRED
// Index
Index *IndexOptions // Creates an index on this column
}
TagOptions represents all possible SQLite column constraints and attributes
func (*TagOptions) String ¶
func (t *TagOptions) String() string
func (*TagOptions) Validate ¶
func (t *TagOptions) Validate() error
Click to show internal directories.
Click to hide internal directories.