feat: add universities and restaurants (#4)
Features: - Allow to search for individual resources by their name - Add new resources and their handler: Universities, Restaurants - Added new parameter to reverse output order Reviewed-on: #4 Co-authored-by: bdoerfchen <git@bissendorf.co> Co-committed-by: bdoerfchen <git@bissendorf.co>
This commit is contained in:
19
model/resources/university.go
Normal file
19
model/resources/university.go
Normal file
@ -0,0 +1,19 @@
|
||||
package resources
|
||||
|
||||
import "strings"
|
||||
|
||||
const ResourceUniversity = "university"
|
||||
|
||||
type University struct {
|
||||
Name string
|
||||
Restaurants []string
|
||||
}
|
||||
|
||||
func (u *University) Kind() string { return ResourceUniversity }
|
||||
func (u *University) ItemName() string { return u.Name }
|
||||
|
||||
// Table output
|
||||
func (u *University) ColumnNames() []string { return []string{"Restaurants"} }
|
||||
func (u *University) Columns() []any {
|
||||
return []any{strings.Join(u.Restaurants, "\r\n")}
|
||||
}
|
||||
Reference in New Issue
Block a user