Skip to content

Comments

feat: add sorting to sql adapter#145

Open
Lutherwaves wants to merge 7 commits intomainfrom
fix/AddSortingSQLAdapter
Open

feat: add sorting to sql adapter#145
Lutherwaves wants to merge 7 commits intomainfrom
fix/AddSortingSQLAdapter

Conversation

@Lutherwaves
Copy link
Contributor

Adding sorting server-side for sql adapter following cosmosdb implementation

@Lutherwaves Lutherwaves self-assigned this Feb 17, 2026
@Lutherwaves
Copy link
Contributor Author

@ayashjorden Thanks for the review, available for re-review.

@@ -217,6 +218,7 @@ func (s *SQLAdapter) Delete(item any, filter map[string]any, params ...map[strin
func (s *SQLAdapter) executePaginatedQuery(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing godoc, specifically b/c the function has default behavior.
Also, I think that switch-case would be more appropriate than the current defaultValue-if clause

Comment on lines +343 to +353
func extractSortDirection(paramMap map[string]any) SortingDirection {
if dir, exists := paramMap[SortDirectionKey]; exists {
if dirStr, ok := dir.(string); ok {
switch SortingDirection(strings.ToUpper(dirStr)) {
case Descending:
return Descending
}
}
}
return Ascending
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, we should be explicit on what we match and return. and return an error otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, let me add this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants