MCPcopy Create free account
hub / github.com/bytebase/bytebase / GetIssueOrders

Function GetIssueOrders

backend/store/issue.go:112–136  ·  view source on GitHub ↗

GetIssueOrders parses the order_by string and returns the corresponding OrderByKeys.

(orderBy string)

Source from the content-addressed store, hash-verified

110
111// GetIssueOrders parses the order_by string and returns the corresponding OrderByKeys.
112func GetIssueOrders(orderBy string) ([]*OrderByKey, error) {
113 keys, err := parseOrderBy(orderBy)
114 if err != nil {
115 return nil, err
116 }
117
118 orderByKeys := []*OrderByKey{}
119 for _, key := range keys {
120 switch key.Key {
121 case "create_time":
122 orderByKeys = append(orderByKeys, &OrderByKey{
123 Key: "issue.created_at",
124 SortOrder: key.SortOrder,
125 })
126 case "update_time":
127 orderByKeys = append(orderByKeys, &OrderByKey{
128 Key: "issue.updated_at",
129 SortOrder: key.SortOrder,
130 })
131 default:
132 return nil, errors.Errorf(`invalid order key "%v"`, key.Key)
133 }
134 }
135 return orderByKeys, nil
136}
137
138// GetIssue gets issue by issue UID.
139func (s *Store) GetIssue(ctx context.Context, find *FindIssueMessage) (*IssueMessage, error) {

Callers 2

ListIssuesMethod · 0.92
SearchIssuesMethod · 0.92

Calls 2

parseOrderByFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected