MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / Args

Struct Args

pkg/sql2code/sql2code.go:18–45  ·  view source on GitHub ↗

Args generate code arguments

Source from the content-addressed store, hash-verified

16
17// Args generate code arguments
18type Args struct {
19 SQL string // DDL sql
20
21 DDLFile string // DDL file
22
23 DBDriver string // db driver name, such as mysql, mongodb, postgresql, sqlite, default is mysql
24 DBDsn string // connecting to mysql's dsn, if DBDriver is sqlite, DBDsn is local db file
25 DBTable string // table name
26 fieldTypes map[string]string // field name:type
27
28 Package string // specify the package name (only valid for model types)
29 GormType bool // whether to display the gorm type name (only valid for model type codes)
30 JSONTag bool // does it include a json tag
31 JSONNamedType int // json field naming type, 0: snake case such as my_field_name, 1: camel sase, such as myFieldName
32 IsEmbed bool // is gorm.Model embedded
33 IsWebProto bool // proto file type, true: include router path and swagger info, false: normal proto file without router and swagger
34 CodeType string // specify the different types of code to be generated, namely model (default), json, dao, handler, proto
35 ForceTableName bool
36 Charset string
37 Collation string
38 TablePrefix string
39 ColumnPrefix string
40 NoNullType bool
41 NullStyle string
42 IsExtendedAPI bool // true: generate extended api (9 api), false: generate basic api (5 api)
43
44 IsCustomTemplate bool // whether to use custom template, default is false
45}
46
47func (a *Args) checkValid() error {
48 if a.SQL == "" && a.DDLFile == "" && (a.DBDsn == "" && a.DBTable == "") {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected