parser

package
v0.0.0-...-4050dc3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyMapTmplRaw     string
	KeyMapTmpl        *template.Template
	KeyMapTmplFileRaw string
	KeyMapFileTmpl    *template.Template
)
View Source
var (
	FindByIdTmplRaw string

	FindPkTmpl *template.Template
)

Functions

func AllTables

func AllTables(dsn string) ([]string, error)

func ConfigureAcronym

func ConfigureAcronym(words []string)

func CreateKeyMapCode

func CreateKeyMapCode(path string)

func GetCreateTableFromDB

func GetCreateTableFromDB(dsn, tableName string) (string, error)

func ParseSqlToWrite

func ParseSqlToWrite(sql string, writer io.Writer, options ...Option) error

Types

type FindByPkCodes

type FindByPkCodes struct {
	TstructName string
	PkName      string
}

type KeyMapCode

type KeyMapCode struct {
	Table1  string
	Col1Raw string
	Col1    string
	Table2  string
	Col2    string
}

type KeyMapCodeCodes

type KeyMapCodeCodes struct {
	Package        string
	ImportPath     []string
	KeyMapCodeData []string
}

type ModelCodes

type ModelCodes struct {
	Package    string
	ImportPath []string
	StructCode []string
	EmunData   []string
	Pkcode     []string
}

func ParseSql

func ParseSql(sql string, options ...Option) (ModelCodes, error)

func ParseSqlFromDB

func ParseSqlFromDB(dsn, tableName string, options ...Option) (ModelCodes, error)

type NullStyle

type NullStyle int
const (
	NullDisable NullStyle = iota
	NullInSql
	NullInPointer
)

type Option

type Option func(*options)

func WithCharset

func WithCharset(charset string) Option

func WithCollation

func WithCollation(collation string) Option

func WithColumnPrefix

func WithColumnPrefix(p string) Option

func WithForceTableName

func WithForceTableName() Option

func WithGormType

func WithGormType() Option

WithGormType will write type in gorm tag

func WithJsonTag

func WithJsonTag() Option

func WithNoNullType

func WithNoNullType() Option

func WithNullStyle

func WithNullStyle(s NullStyle) Option

func WithPackage

func WithPackage(pkg string) Option

func WithTablePrefix

func WithTablePrefix(p string) Option

Jump to

Keyboard shortcuts

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