2016-06-20 07:22:50 +02:00
|
|
|
{{- $varNameSingular := .Table.Name | singular | camelCase -}}
|
|
|
|
{{- $tableNameSingular := .Table.Name | singular | titleCase -}}
|
2016-06-20 01:29:59 +02:00
|
|
|
func (o {{$tableNameSingular}}) inPrimaryKeyArgs() []interface{} {
|
|
|
|
var args []interface{}
|
|
|
|
|
|
|
|
{{- range $key, $value := .Table.PKey.Columns }}
|
|
|
|
args = append(args, o.{{titleCase $value}})
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
return args
|
|
|
|
}
|
|
|
|
|
2016-07-16 16:15:14 +02:00
|
|
|
func (o {{$tableNameSingular}}Slice) inPrimaryKeyArgs() []interface{} {
|
2016-06-20 01:29:59 +02:00
|
|
|
var args []interface{}
|
|
|
|
|
|
|
|
for i := 0; i < len(o); i++ {
|
|
|
|
{{- range $key, $value := .Table.PKey.Columns }}
|
|
|
|
args = append(args, o[i].{{titleCase $value}})
|
|
|
|
{{ end -}}
|
|
|
|
}
|
|
|
|
|
|
|
|
return args
|
|
|
|
}
|