You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
504 B
Smarty
10 lines
504 B
Smarty
3 years ago
|
|
||
|
func (m *default{{.upperStartCamelObject}}Model) formatPrimary(primary interface{}) string {
|
||
|
return fmt.Sprintf("%s%v", {{.primaryKeyLeft}}, primary)
|
||
|
}
|
||
|
|
||
|
func (m *default{{.upperStartCamelObject}}Model) queryPrimary(ctx context.Context, conn sqlx.SqlConn, v, primary interface{}) error {
|
||
|
query := fmt.Sprintf("select %s from %s where {{.originalPrimaryField}} = {{if .postgreSql}}$1{{else}}?{{end}} limit 1", {{.lowerStartCamelObject}}Rows, m.table )
|
||
|
return conn.QueryRowCtx(ctx, v, query, primary)
|
||
|
}
|