Documentation ¶
Index ¶
- Constants
- func BuildPaginatedResult[T any](list T, skip int64, take int64, totalRecords int64) viewmodel.PaginatedResult[T]
- func GetAndValidateParam(c echo.Context, paramName string, errorMessage string) (paramValue string, err error)
- func GetContext(c echo.Context) (ctx context.Context)
- func GetPagingParams(c echo.Context, pageParameter, quantityParameter string) (take int64, skip int64)
- func GetTakeSkipFromPageQuantity(page, quantity int64) (take, skip int64)
- func HandleAPIError(c echo.Context, errorToHandle error) (err error)
- func ResponseAPIError(c echo.Context, status int, message string, err string, causes interface{}) error
- func ResponseAPIOk(c echo.Context, data interface{}) error
- func ResponseBadRequestError(c echo.Context, err error) error
- func ResponseCreated(c echo.Context) error
- func ResponseNoContent(c echo.Context) error
- func ResponseNotFoundError(c echo.Context, err error) error
- func ResponseUnauthorizedError(c echo.Context, err error) error
- type EchoGroups
- type IRoute
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func BuildPaginatedResult ¶
func BuildPaginatedResult[T any](list T, skip int64, take int64, totalRecords int64) viewmodel.PaginatedResult[T]
BuildPaginatedResult is a function that builds a paginated result based on the given parameters. It takes a list of type T, the number of records to skip, the number of records to take, and the total number of records available. It returns a PaginatedResult of type T, which contains the paginated list and pagination information.
func GetAndValidateParam ¶
func GetAndValidateParam(c echo.Context, paramName string, errorMessage string) (paramValue string, err error)
GetAndValidateParam gets the param value and validates it, returning a validation error in case it's invalid
func GetContext ¶
func GetPagingParams ¶
func GetPagingParams(c echo.Context, pageParameter, quantityParameter string) (take int64, skip int64)
GetPagingParams gets the standard paging params from the URL, returning how much data to take and skip
func HandleAPIError ¶
func ResponseAPIError ¶
func ResponseAPIOk ¶
func ResponseAPIOk(c echo.Context, data interface{}) error
func ResponseBadRequestError ¶
func ResponseCreated ¶
func ResponseCreated(c echo.Context) error
func ResponseNoContent ¶
func ResponseNoContent(c echo.Context) error
func ResponseNotFoundError ¶
Types ¶
type EchoGroups ¶
type EchoGroups struct { // AppGroup is the group for public routes AppGroup models.EchoGroup // PrivateGroup is the group for routes that need to be authenticated (login required) PrivateGroup models.EchoGroup }
EchoGroups is the struct that holds the echo groups for the routes
type IRoute ¶
type IRoute interface {
RegisterRoutes(groups *EchoGroups)
}
IRoute interface for register routes
Click to show internal directories.
Click to hide internal directories.