codegen

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGetFunc

func GetGetFunc(in string) string

func GetTempalte

func GetTempalte(append bool, fileMeta FileMeta) (string, error)

func GetTypeName

func GetTypeName(in string) string

func ParseFile

func ParseFile(filePath string) (*ast.File, error)

Types

type Field

type Field struct {
	Name string
	Type string
}

type FileMeta

type FileMeta struct {
	Package string
	Structs []Struct
}

func ParseFileMeta

func ParseFileMeta(node *ast.File, structNames ...string) FileMeta

type Gender

type Gender int8
const (
	Male Gender = iota + 1
	Female
)

type Phone

type Phone string

type Struct

type Struct struct {
	Name   string
	Fields []Field
}

type User

type User struct {
	ID        int64
	Name      string
	Gender    Gender
	Phone     Phone
	Address   sql.NullString
	CreatedAt time.Time
	UpdatedAt sql.NullTime
	Price     decimal.Decimal
	Amount    decimal.NullDecimal
}

Jump to

Keyboard shortcuts

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