vars.go 816 B

123456789101112131415
  1. package template
  2. import "fmt"
  3. // Vars defines a template for var block in model
  4. var Vars = fmt.Sprintf(`
  5. var (
  6. {{.lowerStartCamelObject}}FieldNames = builderx.RawFieldNames(&{{.upperStartCamelObject}}{})
  7. {{.lowerStartCamelObject}}Rows = strings.Join({{.lowerStartCamelObject}}FieldNames, ",")
  8. {{.lowerStartCamelObject}}RowsExpectAutoSet = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}",{{end}} "%screate_time%s", "%supdate_time%s"), ",")
  9. {{.lowerStartCamelObject}}RowsWithPlaceHolder = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", "%screate_time%s", "%supdate_time%s"), "=?,") + "=?"
  10. {{if .withCache}}{{.cacheKeys}}{{end}}
  11. )
  12. `, "`", "`", "`", "`", "`", "`", "`", "`")