Documentation ¶
Overview ¶
Package sql2code provides for generating code for different purposes according to sql, support generating json, gorm model, update parameter, request parameter code, sql can be obtained from parameter, file, db three ways, priority from high to low.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateOne ¶
GenerateOne generate gorm code from sql, which can be obtained from parameters, files and db, with priority from highest to lowest
Types ¶
type Args ¶
type Args struct { SQL string // DDL sql DDLFile string // DDL file DBDriver string // db driver name, such as mysql, mongodb, postgresql, tidb, sqlite, default is mysql DBDsn string // connecting to mysql's dsn, if DBDriver is sqlite, DBDsn is local db file DBTable string // table name Package string // specify the package name (only valid for model types) GormType bool // whether to display the gorm type name (only valid for model type codes) JSONTag bool // does it include a json tag JSONNamedType int // json field naming type, 0: snake case such as my_field_name, 1: camel sase, such as myFieldName IsEmbed bool // is gorm.Model embedded IsWebProto bool // proto file type, true: include router path and swagger info, false: normal proto file without router and swagger CodeType string // specify the different types of code to be generated, namely model (default), json, dao, handler, proto ForceTableName bool Charset string Collation string TablePrefix string ColumnPrefix string NoNullType bool NullStyle string IsExtendedAPI bool // true: generate extended api (9 api), false: generate basic api (5 api) // contains filtered or unexported fields }
Args generate code arguments
Click to show internal directories.
Click to hide internal directories.