go-zero/tools/goctl/model/sql/template/vars.go

15 lines
763 B
Go
Raw Normal View History

package template
2020-07-29 17:11:41 +08:00
import "fmt"
var Vars = fmt.Sprintf(`
2020-07-29 17:11:41 +08:00
var (
{{.lowerStartCamelObject}}FieldNames = builderx.FieldNames(&{{.upperStartCamelObject}}{})
{{.lowerStartCamelObject}}Rows = strings.Join({{.lowerStartCamelObject}}FieldNames, ",")
{{.lowerStartCamelObject}}RowsExpectAutoSet = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}",{{end}} "%screate_time%s", "%supdate_time%s"), ",")
{{.lowerStartCamelObject}}RowsWithPlaceHolder = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", "%screate_time%s", "%supdate_time%s"), "=?,") + "=?"
2020-07-29 17:11:41 +08:00
{{if .withCache}}{{.cacheKeys}}{{end}}
2020-07-29 17:11:41 +08:00
)
`, "`", "`", "`", "`", "`", "`", "`", "`")