parser

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TableName table name
	TableName = "__table_name__"
	// CodeTypeModel model code
	CodeTypeModel = "model"
	// CodeTypeJSON json code
	CodeTypeJSON = "json"
	// CodeTypeDAO update fields code
	CodeTypeDAO = "dao"
	// CodeTypeHandler handler request and respond code
	CodeTypeHandler = "handler"
)

Variables

This section is empty.

Functions

func ConfigureAcronym

func ConfigureAcronym(words []string)

ConfigureAcronym config acronym

func GetCreateTableFromDB

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

func ParseSql

func ParseSql(sql string, options ...Option) (map[string]string, error)

ParseSql 根据sql生成不用用途代码

Types

type Codes

type Codes struct {
	Model         []string // model code
	UpdateFields  []string // update fields code
	ModelJSON     []string // model json code
	HandlerStruct []string // handler request and respond code
}

Codes 生成的代码

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 WithEmbed

func WithEmbed() Option

WithEmbed is embed gorm.Model

func WithForceTableName

func WithForceTableName() Option

func WithGormType

func WithGormType() Option

WithGormType will write type in gorm tag

func WithJsonTag

func WithJsonTag(namedType int) Option

WithJsonTag json名称命名类型,0:表示默认,其他值表示驼峰

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