fizz: Index | Files | Directories

package fizz

import ""

Package fizz is a common DSL for writing SQL migrations


Package Files

bubbler.go columns.go fizz.go foreign_keys.go index.go raw_sql.go tables.go translator.go version.go


const Version = "v1.0.15"

Version gives the current fizz version.


var CREATED_COL = Column{Name: "created_at", ColType: "timestamp", Options: Options{}}
var INT_ID_COL = Column{
    Name:    "id",
    Primary: true,
    ColType: "integer",
    Options: Options{},

Deprecated: Fizz won't force you to have an ID field now.

var UPDATED_COL = Column{Name: "updated_at", ColType: "timestamp", Options: Options{}}
var UUID_ID_COL = Column{
    Name:    "id",
    Primary: true,
    ColType: "uuid",
    Options: Options{},

Deprecated: Fizz won't force you to have an ID field now.

func AFile Uses

func AFile(f *os.File, t Translator) (string, error)

AFile reads a fizz file, and translates its contents to SQL.

func AString Uses

func AString(s string, t Translator) (string, error)

AString reads a fizz string, and translates its contents to SQL.

type BubbleType Uses

type BubbleType int

type Bubbler Uses

type Bubbler struct {
    // contains filtered or unexported fields

func NewBubbler Uses

func NewBubbler(t Translator) *Bubbler

func (*Bubbler) Bubble Uses

func (b *Bubbler) Bubble(s string) (string, error)

func (*Bubbler) String Uses

func (b *Bubbler) String() string

type Column Uses

type Column struct {
    Name    string
    ColType string
    Primary bool
    Options map[string]interface{}

func (Column) String Uses

func (c Column) String() string

type ForeignKey Uses

type ForeignKey struct {
    Name       string
    Column     string
    References ForeignKeyRef
    Options    Options

type ForeignKeyRef Uses

type ForeignKeyRef struct {
    Table   string
    Columns []string

type Index Uses

type Index struct {
    Name    string
    Columns []string
    Unique  bool
    Options Options

type Options Uses

type Options map[string]interface{}

type Table Uses

type Table struct {
    Name        string `db:"name"`
    Columns     []Column
    Indexes     []Index
    ForeignKeys []ForeignKey
    Options     map[string]interface{}

func (*Table) Column Uses

func (t *Table) Column(name string, colType string, options Options)

func (*Table) ColumnNames Uses

func (t *Table) ColumnNames() []string

func (*Table) DisableTimestamps Uses

func (t *Table) DisableTimestamps()

func (*Table) ForeignKey Uses

func (t *Table) ForeignKey(column string, refs interface{}, options Options) error

func (*Table) HasColumns Uses

func (t *Table) HasColumns(args ...string) bool

func (Table) String Uses

func (t Table) String() string

func (*Table) Timestamp Uses

func (t *Table) Timestamp(name string)

func (*Table) Timestamps Uses

func (t *Table) Timestamps()

type Translator Uses

type Translator interface {
    CreateTable(Table) (string, error)
    DropTable(Table) (string, error)
    RenameTable([]Table) (string, error)
    AddColumn(Table) (string, error)
    ChangeColumn(Table) (string, error)
    DropColumn(Table) (string, error)
    RenameColumn(Table) (string, error)
    AddIndex(Table) (string, error)
    DropIndex(Table) (string, error)
    RenameIndex(Table) (string, error)
    AddForeignKey(Table) (string, error)
    DropForeignKey(Table) (string, error)

Translator describes the common interface to define a fizz to SQL translator.



Package fizz imports 12 packages (graph) and is imported by 3 packages. Updated 2018-12-07. Refresh now. Tools for package owners.