Documentation ¶
Index ¶
- Constants
- func AnyToBytesBuffer(i interface{}) (*bytes.Buffer, error)
- func GetHasMore(currentPage int, totalCount int, pageLimit int) bool
- func GetTotalPages(totalCount int, pageLimit int) int
- func StringToInt64(num string) (int64, error)
- func ValidateStruct(ctx context.Context, s interface{}) error
- type Query
- func (q *Query) GetLimit() int
- func (q *Query) GetOffset() int
- func (q *Query) GetPage() int
- func (q *Query) GetQueryString() string
- func (q *Query) GetSort() string
- func (q *Query) SetLimit(sizeQuery string) error
- func (q *Query) SetPage(pageQuery string) error
- func (q *Query) SetSort(sortQuery string)
Constants ¶
View Source
const ( DEFAULT_SIZE int = 10 MAX_SIZE int = 50 )
Variables ¶
This section is empty.
Functions ¶
func AnyToBytesBuffer ¶
func GetHasMore ¶
GetHasMore returns whether there is a next page
func GetTotalPages ¶
GetTotalPages calculates the total number of pages using totalCount and pageLimit
func StringToInt64 ¶
func ValidateStruct ¶
Validate struct fields
Types ¶
type Query ¶
type Query struct { Limit int `json:"limit,omitempty"` Page int `json:"page,omitempty"` Search string `json:"search,omitempty"` Sort string `json:"sort,omitempty"` }
func GetPaginationFromCtx ¶
GetPaginationFromCtx returns the query from the context
func (*Query) GetQueryString ¶
Click to show internal directories.
Click to hide internal directories.