Documentation
¶
Overview ¶
Package responses contains helper functions to create response that can be returned by the application
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfiniteScrollLinks ¶
type InfiniteScrollLinks struct {
Next string `json:"next" example:"http://localhost:8080?cursor=2021-08-01&limit=10"`
}
type InfiniteScrollMeta ¶
type InfiniteScrollMeta struct {
Total int `json:"total" example:"100"`
}
type InfiniteScrollResponse ¶
type InfiniteScrollResponse[T any] struct { Code int `json:"code" example:"123"` Message string `json:"message"` Links InfiniteScrollLinks `json:"links"` Meta InfiniteScrollMeta `json:"meta"` Data []T `json:"data"` }
InfiniteScrollResponse is a struct that contains the response of infinite scroll
This response can be used to return the result of infinite scroll by using the following code:
var result InfiniteScrollResult[User] ctx.JSON(result.GetInfiniteScrollResponse(urlConfig, limit))
type InfiniteScrollResult ¶
InfiniteScrollResult is a struct that contains the result of infinite scroll from the database using query object
func (*InfiniteScrollResult[T]) GetInfiniteScrollResponse ¶
func (r *InfiniteScrollResult[T]) GetInfiniteScrollResponse(urlConfig UrlConfig, limit int) InfiniteScrollResponse[T]
GetInfiniteScrollResponse is a function to create InfiniteScrollResponse from InfiniteScrollResult
type TableAdvancedLinks ¶
type TableAdvancedMeta ¶
type TableAdvancedResponse ¶
type TableAdvancedResponse[T any] struct { Code int `json:"code" example:"123"` Message string `json:"message"` Links TableAdvancedLinks `json:"links"` Meta TableAdvancedMeta `json:"meta"` Data []T `json:"data"` }
TableAdvancedResponse is a struct that contains the response of table advanced
This response can be used to return the result of table advanced by using the following code:
var result TableAdvancedResult[User] ctx.JSON(result.GetTableAdvancedResponse(urlConfig, limit, currentPage))
type TableAdvancedResult ¶
type TableAdvancedResult[T any] struct { StartAfter string EndBefore string Data []T Total int ItemCount int }
TableAdvancedResult is a struct that contains the result of table advanced from the database using query object
func (*TableAdvancedResult[T]) GetTableAdvancedResponse ¶
func (r *TableAdvancedResult[T]) GetTableAdvancedResponse(urlConfig UrlConfig, limit int, currentPage int) TableAdvancedResponse[T]