helpers

package
v0.0.0-...-4d260af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJWTTokenFromUser

func GetJWTTokenFromUser(user *database.User, jwtSecret string) (access string, refresh string, err error)

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, msg string)

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

func RespondWithOK

func RespondWithOK(w http.ResponseWriter)

Types

type PaginatedResult

type PaginatedResult struct {
	Total    int           `json:"total"`
	Page     int           `json:"page"`
	PageSize int           `json:"page_size"`
	Items    []interface{} `json:"items"`
}

func PaginateResult

func PaginateResult(items []interface{}, params PaginationParams) PaginatedResult

type PaginationParams

type PaginationParams struct {
	Page     int `json:"page"`
	PageSize int `json:"page_size"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL