generator

package
v0.0.0-...-b93df9b Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	DbName        string
	GoName        string
	DbType        string
	GoType        string //may be NULL
	GoTypeReal    string
	Size          string
	AutoIncrement bool
	NotNull       bool
	Unsigned      bool
}

func (*Column) IsUniqueIndex

func (c *Column) IsUniqueIndex(t *Table) bool

type Generator

type Generator struct {
	Namespace string
	DbName    string
	TableList []*Table
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator() *Generator

func (*Generator) Gen

func (g *Generator) Gen(sql string, namespace string) (orm string, err error)

func (*Generator) P

func (g *Generator) P(format string, a ...interface{})

func (*Generator) Pn

func (g *Generator) Pn(format string, a ...interface{})

type Index

type Index struct {
	Name   string
	Column *Column
}

type Table

type Table struct {
	DbName               string
	GoName               string
	ColumnList           []*Column
	PrimaryColumn        *Column
	CreateTimeColumn     *Column
	UpdateTimeColumn     *Column
	UpdateVersionColumn  *Column
	IndexList            []*Index
	UniqueIndexList      []*Index
	UnionIndexList       []*UnionIndex
	UniqueUnionIndexList []*UnionIndex
}

func (*Table) AddColumn

func (t *Table) AddColumn(c *Column)

type UnionIndex

type UnionIndex struct {
	Name           string
	ColumnNameList []string
	ColumnList     []*Column
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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