refactor

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandAll

func ExpandAll(ctx Context, expanders ...Expander) ([]string, error)

Types

type ChangeLog

type ChangeLog struct {
	TableName     NullString
	LockTableName NullString

	Variables *vars.Variables

	ChangeSets []*ChangeSet
}

func NewChangeLogFile

func NewChangeLogFile(path string) (*ChangeLog, error)

type ChangeSet

type ChangeSet struct {
	Id string

	Name   NullString
	Author NullString

	Tags []string

	Changers []Changer
}

func (*ChangeSet) Sha256Sum

func (c *ChangeSet) Sha256Sum() ([]byte, error)

type Changer

type Changer interface {
	Up(ctx Context) ([]*Stmt, error)
	Down(ctx Context) ([]*Stmt, error)

	DTO() (dto.Changer, error)
}

type Column

type Column struct {
	Name string
	Type string

	IsNullable NullBool

	Default NullString

	Constraint *Constraint
}

type Constraint

type Constraint struct {
	IsUnique   NullBool
	UniqueName NullString

	IsPrimaryKey   NullBool
	PrimaryKeyName NullString
}

type Context

type Context interface {
	Expand(string) (string, error)
}

type CreateTable

type CreateTable struct {
	Name string

	IfNotExists NullBool

	Columns []*Column
}

type Expander

type Expander interface {
	Expand(Context) (string, error)
}

type ExpanderFunc

type ExpanderFunc func(Context) (string, error)

func (ExpanderFunc) Expand

func (ef ExpanderFunc) Expand(ctx Context) (string, error)

type NullBool

type NullBool struct {
	Raw   string
	Bool  bool
	Valid bool
}

func (*NullBool) DefaultExpander

func (nb *NullBool) DefaultExpander(def bool) Expander

type NullString

type NullString struct {
	String string
	Valid  bool
}

func NewNullString

func NewNullString(s *string) NullString

func (*NullString) DefaultExpander

func (ns *NullString) DefaultExpander(def string) Expander

type RawSql

type RawSql struct {
	UpStmts   []*Stmt
	DownStmts []*Stmt
	// contains filtered or unexported fields
}

func (*RawSql) DTO

func (r *RawSql) DTO() (dto.Changer, error)

func (*RawSql) Down

func (r *RawSql) Down(_ Context) ([]*Stmt, error)

func (*RawSql) Up

func (r *RawSql) Up(_ Context) ([]*Stmt, error)

type Stmt

type Stmt struct {
	Raw  string
	Args []interface{}
}

func CollectChangersDown

func CollectChangersDown(ctx Context, changers ...Changer) ([]*Stmt, error)

func CollectChangersUp

func CollectChangersUp(ctx Context, changers ...Changer) ([]*Stmt, error)

type UnknownDTOChangerError

type UnknownDTOChangerError struct {
	dto.Changer
}

func (*UnknownDTOChangerError) Error

func (e *UnknownDTOChangerError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL