Use dedicated type for each order field
Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
@@ -39,8 +39,13 @@ type (
|
||||
Organizations []*Organization
|
||||
)
|
||||
|
||||
func (o Organization) CursorKey(orderBy page.OrderField) page.CursorKey {
|
||||
return page.NewCursorKey(o.ID, o.CreatedAt)
|
||||
func (o Organization) CursorKey(orderBy OrganizationOrderField) page.CursorKey {
|
||||
switch orderBy {
|
||||
case OrganizationOrderFieldCreatedAt:
|
||||
return page.NewCursorKey(o.ID, o.CreatedAt)
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (o *Organization) LoadByID(
|
||||
|
||||
Reference in New Issue
Block a user