Documentation ¶
Overview ¶
Package parser is a library that parses to go structures based on sql and generates the code needed based on the template.
Index ¶
- Constants
- func GetTableInfo(dsn, tableName string) (string, error)
- func ParseSQL(sql string, options ...Option) (map[string]string, error)
- type Codes
- type NullStyle
- type Option
- func WithCharset(charset string) Option
- func WithCollation(collation string) Option
- func WithColumnPrefix(p string) Option
- func WithEmbed() Option
- func WithForceTableName() Option
- func WithGormType() Option
- func WithJSONTag(namedType int) Option
- func WithNoNullType() Option
- func WithNullStyle(s NullStyle) Option
- func WithPackage(pkg string) Option
- func WithTablePrefix(p string) Option
- func WithWebProto() Option
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" // CodeTypeProto proto file code CodeTypeProto = "proto" // CodeTypeService grpc service code CodeTypeService = "service" )
Variables ¶
This section is empty.
Functions ¶
func GetTableInfo ¶
GetTableInfo get table info from mysql
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 content
type Option ¶
type Option func(*options)
Option function
func WithJSONTag ¶
WithJSONTag set json tag, 0 for underscore, other values for hump
Click to show internal directories.
Click to hide internal directories.