Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Imports defines a import template for model in cache case Imports = `` /* 318-byte string literal not displayed */ // ImportsNoCache defines a import template for model in normal case ImportsNoCache = `` /* 268-byte string literal not displayed */ )
var Delete = `` /* 779-byte string literal not displayed */
Delete defines a delete template
var DeleteMethod = `Delete({{.lowerStartCamelPrimaryKey}} {{.dataType}}) error`
DeleteMethod defines a delete template for interface method
var Error = `package {{.pkg}}
import "github.com/zeromicro/go-zero/core/stores/sqlx"
var ErrNotFound = sqlx.ErrNotFound
`
Error defines an error template
var Field = `{{.name}} {{.type}} {{.tag}} {{if .hasComment}}// {{.comment}}{{end}}`
Field defines a filed template for types
var FindOne = `` /* 1075-byte string literal not displayed */
FindOne defines find row by id.
var FindOneByField = `` /* 1110-byte string literal not displayed */
FindOneByField defines find row by field.
var FindOneByFieldExtraMethod = `` /* 475-byte string literal not displayed */
FindOneByFieldExtraMethod defines find row by field with extras.
var FindOneByFieldMethod = `FindOneBy{{.upperField}}({{.in}}) (*{{.upperStartCamelObject}}, error) `
FindOneByFieldMethod defines find row by field method.
var FindOneMethod = `FindOne({{.lowerStartCamelPrimaryKey}} {{.dataType}}) (*{{.upperStartCamelObject}}, error)`
FindOneMethod defines find row method.
var Insert = `` /* 846-byte string literal not displayed */
Insert defines a template for insert code in model
var InsertMethod = `Insert(data *{{.upperStartCamelObject}}) (sql.Result,error)`
InsertMethod defines an interface method template for insert code in model
var Model = `package {{.pkg}}
{{.imports}}
{{.vars}}
{{.types}}
{{.new}}
{{.insert}}
{{.find}}
{{.update}}
{{.delete}}
{{.extraMethod}}
`
Model defines a template for model
var New = `` /* 295-byte string literal not displayed */
New defines an template for creating model instance
var Tag = "`db:\"{{.field}}\"`"
Tag defines a tag template text
var Types = `` /* 261-byte string literal not displayed */
Types defines a template for types in model
var Update = `` /* 689-byte string literal not displayed */
Update defines a template for generating update codes
var UpdateMethod = `Update(data *{{.upperStartCamelObject}}) error`
UpdateMethod defines an interface method template for generating update codes
var Vars = fmt.Sprintf(`
var (
{{.lowerStartCamelObject}}FieldNames = builder.RawFieldNames(&{{.upperStartCamelObject}}{}{{if .postgreSql}},true{{end}})
{{.lowerStartCamelObject}}Rows = strings.Join({{.lowerStartCamelObject}}FieldNames, ",")
{{.lowerStartCamelObject}}RowsExpectAutoSet = {{if .postgreSql}}strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}",{{end}} "%screate_time%s", "%supdate_time%s"), ","){{else}}strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}",{{end}} "%screate_time%s", "%supdate_time%s"), ","){{end}}
{{.lowerStartCamelObject}}RowsWithPlaceHolder = {{if .postgreSql}}builder.PostgreSqlJoin(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", "%screate_time%s", "%supdate_time%s")){{else}}strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", "%screate_time%s", "%supdate_time%s"), "=?,") + "=?"{{end}}
{{if .withCache}}{{.cacheKeys}}{{end}}
)
`, "", "", "", "",
"`", "`", "`", "`",
"", "", "", "",
"`", "`", "`", "`")
Vars defines a template for var block in model
Functions ¶
This section is empty.
Types ¶
This section is empty.