ast

package
v0.0.0-...-62db38d Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectTypeName

func DetectTypeName(n ast.Node) (str string, name string, isPtr bool, isArray bool, err error)

func MakeForeignKeyColumns

func MakeForeignKeyColumns(fields []*Field) (fks map[string]dialect.ForeignKey)

func MakeStructASTMap

func MakeStructASTMap(filename string, marker string) (map[string]*StructAST, error)

Types

type Field

type Field struct {
	Table         string
	Name          string
	GoType        string
	Type          string
	Column        string
	Comment       string
	RawIndexes    []string
	RawUniques    []string
	PrimaryKey    bool
	AutoIncrement bool
	Ignore        bool
	Default       string
	Extra         string
	Nullable      bool
	ForeignKey    *ForeignKey
}

func MakePrimaryKeyColumns

func MakePrimaryKeyColumns(fields []*Field) (pks []*Field)

func NewField

func NewField(
	marker string,
	d dialect.Dialect,
	tableName string,
	typeName string,
	fieldName *string,
	f *ast.Field,
	foreignKey *ForeignKey,
	primaryKey bool,
	autoIncrement bool,
) (*Field, error)

func (*Field) IsEmbedded

func (f *Field) IsEmbedded() bool

func (*Field) ToField

func (f *Field) ToField() dialect.Field

type ForeignKey

type ForeignKey struct {
	Table  string
	Column string
}

type StructAST

type StructAST struct {
	Name       string
	StructType *ast.StructType
	Annotation *annotation
}

type Table

type Table struct {
	Fields []*Field
	Option string
}

Jump to

Keyboard shortcuts

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