mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
add console & example
This commit is contained in:
@@ -65,5 +65,6 @@ func (m *{{.upperStartCamelObject}}Model) FindOneBy{{.upperField}}({{.in}}) (*{{
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}{{end}}
|
||||
}
|
||||
}{{end}}
|
||||
`
|
||||
|
||||
@@ -2,9 +2,9 @@ package template
|
||||
|
||||
var Imports = `
|
||||
import (
|
||||
"database/sql"{{if .withCache}}
|
||||
"fmt"
|
||||
{{end}}"strings"
|
||||
{{if .withCache}}"database/sql"
|
||||
"fmt"{{end}}
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/tal-tech/go-zero/core/stores/cache"
|
||||
|
||||
@@ -7,8 +7,6 @@ var (
|
||||
{{.lowerStartCamelObject}}RowsExpectAutoSet = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, {{if .autoIncrement}}"{{.originalPrimaryKey}}",{{end}} "create_time", "update_time"), ",")
|
||||
{{.lowerStartCamelObject}}RowsWithPlaceHolder = strings.Join(stringx.Remove({{.lowerStartCamelObject}}FieldNames, "{{.originalPrimaryKey}}", "create_time", "update_time"), "=?,") + "=?"
|
||||
|
||||
{{.cacheKeys}}
|
||||
|
||||
ErrNotFound = sqlx.ErrNotFound
|
||||
{{if .withCache}}{{.cacheKeys}}{{end}}
|
||||
)
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user