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 DBDsn string // connecting to mysql's dsn DBTable string 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 }
Args generate code arguments
Click to show internal directories.
Click to hide internal directories.