schema

package
v0.0.0-...-f7dc048 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Int = iota
	Int8
	Int16
	Int32
	Int64
	UInt
	UInt8
	UInt16
	UInt32
	UInt64
	String
	Float32
	Float64
	Decimal
	Time
	TimePtr
)

Variables

This section is empty.

Functions

func Migrate

func Migrate(path string)

func Unfold

func Unfold(path string) (res []string)

Types

type Attr

type Attr struct {
	Table        string
	Name         string
	Typ          uint
	Comment      string
	Length       int
	Enums        []string
	Default      bool
	DefaultValue interface{}
	Key          string
	Extra        string
	//Unique       bool
	Places   int
	Unsigned bool
	Nillable bool
	ID       bool
	Exist    bool
	Stat     bytes.Buffer
}

type Field

type Field struct {
	Attr
}

func (*Field) BuildSql

func (f *Field) BuildSql() string

func (*Field) Comment

func (f *Field) Comment(comment string) *Field

func (*Field) Default

func (f *Field) Default(value interface{}) *Field

func (*Field) GetSql

func (f *Field) GetSql() string

func (*Field) ID

func (f *Field) ID() *Field

func (*Field) Length

func (f *Field) Length(length int) *Field

func (*Field) Places

func (f *Field) Places(places int) *Field

func (*Field) Typ

func (f *Field) Typ(typ uint) *Field

func (*Field) Unsigned

func (f *Field) Unsigned() *Field

type Fields

type Fields struct {
	Name    string
	Comment string
}

type Schema

type Schema struct {
	DB   db.Dialect
	Conf *conf.DB
	Fields
	Originals  []*Field
	Attributes []*Field
	Test       string
}

func Make

func Make(spec interface{}, s *Schema, target string) *Schema

func Parser

func Parser(path string) (s []*Schema)

func (*Schema) Create

func (s *Schema) Create() (err error)

func (*Schema) Decimal

func (s *Schema) Decimal(name string) *Field

func (*Schema) Double

func (s *Schema) Double(name string) *Field

func (*Schema) Enum

func (s *Schema) Enum(name string) *Field

func (*Schema) Float

func (s *Schema) Float(name string) *Field

func (*Schema) ID

func (s *Schema) ID(name string) *Field

func (*Schema) Int

func (s *Schema) Int(name string) *Field

func (*Schema) Int16

func (s *Schema) Int16(name string) *Field

func (*Schema) Int32

func (s *Schema) Int32(name string) *Field

func (*Schema) Int64

func (s *Schema) Int64(name string) *Field

func (*Schema) Int8

func (s *Schema) Int8(name string) *Field

func (*Schema) Mutation

func (s *Schema) Mutation() (err error)

func (*Schema) Name

func (s *Schema) Name(name string) *Schema

func (*Schema) NewField

func (s *Schema) NewField(name string) *Field

func (*Schema) RefreshOriginals

func (s *Schema) RefreshOriginals() (err error)

func (*Schema) String

func (s *Schema) String(name string) *Field

func (*Schema) Uint

func (s *Schema) Uint(name string) *Field

func (*Schema) Uint16

func (s *Schema) Uint16(name string) *Field

func (*Schema) Uint32

func (s *Schema) Uint32(name string) *Field

func (*Schema) Uint64

func (s *Schema) Uint64(name string) *Field

func (*Schema) Uint8

func (s *Schema) Uint8(name string) *Field

Jump to

Keyboard shortcuts

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