schema

package
v0.0.0-...-3a91a05 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Primary bool   // 是否主键
	Name    string // 字段
	Type    string // 类型
	Size    int    // 长度
	NotNull bool   // 不为Null
	Default string // 默认值
	Comment string // 注释
}

数据库表字段

type Driver

type Driver int

database driver type

const (
	Unknown Driver = iota
	MySQL
	PostgreSQL
	SQLite
	MongoDB
	MariaDB
	Oracle
	SQLServer
)

func DriverValue

func DriverValue(name string) Driver

get driver value by driver short name

func (Driver) Name

func (d Driver) Name() string

driver short name

func (Driver) String

func (d Driver) String() string

driver name

type Schema

type Schema interface {
	Tables() ([]Table, error)
	TypeMapping(string) Type
}

定义了代码生成器所依赖的数据库信息

type SchemaType

type SchemaType string

type Table

type Table struct {
	Name        string   // 表名
	Columns     []Column // 字段
	Comment     string   // 注释
	SpecialPack []string // 特殊类型的依赖包,如pg.Int64Array类型,须引用"github.com/lib/pg"
}

数据库表

type Type

type Type struct {
	// 类型名称
	//  如:int,string,time.Time,decimal.Decimal等
	Name string
	// 引用的包
	//  如:time,github.com/shopspring/decimal等
	Pack string
}

Go结构体字段类型

Jump to

Keyboard shortcuts

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