2f9c936c6a
* Added inflection to all templates * Fixed broken template code (for the most part)
14 lines
589 B
Smarty
14 lines
589 B
Smarty
{{- $tableNamePlural := titleCasePlural .Table -}}
|
|
// {{$tableNamePlural}}Select retrieves the specified columns for all records.
|
|
// Pass in a pointer to an object with `db` tags that match the column names you wish to retrieve.
|
|
// For example: friendName string `db:"friend_name"`
|
|
func {{$tableNamePlural}}Select(db boil.DB, results interface{}) error {
|
|
query := fmt.Sprintf(`SELECT %s FROM {{.Table}}`, boil.SelectNames(results))
|
|
err := db.Select(results, query)
|
|
|
|
if err != nil {
|
|
return fmt.Errorf("{{.PkgName}}: unable to select from {{.Table}}: %s", err)
|
|
}
|
|
|
|
return nil
|
|
}
|