-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd4de0c
commit 0d82ea2
Showing
3 changed files
with
54 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package gossiper | ||
|
||
// FilterPaginationLengthEnum defines pagination length options. | ||
type FilterPaginationLengthEnum int | ||
|
||
// FilterSortByEnum defines sorting options. | ||
type FilterSortByEnum string | ||
|
||
// Sort defines the structure for sorting data based on a field and order. | ||
type Sort[T any] struct { | ||
By FilterSortByEnum `json:"by,omitempty"` // Sort order: ASC or DESC | ||
Field string `json:"field,omitempty"` // The field to sort by | ||
} | ||
|
||
// Paginated defines pagination properties for data requests. | ||
type Paginated struct { | ||
Length FilterPaginationLengthEnum `json:"length,omitempty"` // Number of items per page | ||
Page int `json:"page,omitempty"` // Current page number | ||
} | ||
|
||
// DefaultFilter defines a filter structure with search, sort, and pagination options. | ||
type DefaultFilter[T any] struct { | ||
Search string `json:"search,omitempty"` // Search query string | ||
Sort Sort[T] `json:"sort,omitempty"` // Sort parameters | ||
Pagination Paginated `json:"pagination,omitempty"` // Pagination parameters | ||
} |