toentity

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const FileTmpl = `package generate

import "time"

`
View Source
const TagTmpl = "`json:\"%s\" explain:\"%s\"`"
View Source
const Tmpl = `package entity
import "time"

type Example struct{
A int` + "`json:\"a\" explain:\"模板\"`" + `
B string
C time.Time
}
`

Variables

This section is empty.

Functions

func AddStruct

func AddStruct(name string) []byte

func Convert

func Convert(c ConvertInterface, filename string)

func ConvertByTable

func ConvertByTable(c ConvertInterface, tableName string)

func GetDecl

func GetDecl() *ast.GenDecl

func NewLine

func NewLine() byte

func StructEnd

func StructEnd(name string) []byte

func TwoLine

func TwoLine() []byte

Types

type ConvertInterface

type ConvertInterface interface {
	Tables() []string
	Fields(tableName string) []*Field
	TypeToGoTYpe(typ string) string
}

type Field

type Field struct {
	Field   string
	Type    string
	Comment string
	GoTYpe  string
}

func (*Field) Generate

func (f *Field) Generate() *ast.Field

Jump to

Keyboard shortcuts

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