sqlparser

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum added in v0.41.0

type Enum struct {
	EnumName  string
	EnumValue string
}

type Field

type Field struct {
	Name    string
	Type    string
	Tag     string
	DBField string
	Comment string
	Enums   []Enum
}

type Option

type Option struct {
	StructNameMapper       func(string) string         // 名称映射
	IgnoreField            []string                    // 忽略字段
	FieldNameMapper        func(string) string         // 字段名称映射
	FieldTypeMapper        func(string) string         // 字段类型映射
	FieldTagMapper         func(string, string) string // 可根据名称和类型自行决定字段tag
	RandomFieldValueByType func(string) any            // 根据字段类型生成随机值
}

type Struct

type Struct struct {
	Name    string
	Comment string
	Fields  []Field
}

func ParseCreateSQL

func ParseCreateSQL(sql string) *Struct

func ParseCreateSQLBatch added in v0.24.0

func ParseCreateSQLBatch(sql string) []*Struct

func (*Struct) Enter

func (v *Struct) Enter(in ast.Node) (ast.Node, bool)

func (*Struct) Gen

func (s *Struct) Gen(w io.Writer, opt Option) error

func (*Struct) GenData added in v0.21.0

func (s *Struct) GenData(w io.Writer, n int64, opt Option) error

func (*Struct) Leave

func (v *Struct) Leave(in ast.Node) (ast.Node, bool)

Jump to

Keyboard shortcuts

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