Documentation
¶
Index ¶
- func BindData(c *gin.Context, data interface{}) error
- func ErrorHandler(c *gin.Context, err error)
- func ErrorInvalidQueryString(c *gin.Context)
- func ErrorInvalidUUID(c *gin.Context)
- func GetBodyFields(c *gin.Context, resource any) ([]any, error)
- func GetURLFields(url *url.URL, filter any) []any
- func NewError(c *gin.Context, status int, err error)
- func OptionsGet(c *gin.Context)
- func OptionsGetPatchDelete(c *gin.Context)
- func OptionsGetPost(c *gin.Context)
- func RequestHost(c *gin.Context) string
- func RequestPathV1(c *gin.Context) string
- func RequestURL(c *gin.Context) string
- func UUIDFromString(c *gin.Context, s string) (uuid.UUID, error)
- type HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶ added in v0.30.2
ErrorHandler handles errors for fetching data from the database.
func ErrorInvalidQueryString ¶ added in v0.26.0
func ErrorInvalidUUID ¶
func GetBodyFields ¶ added in v0.30.2
GetBodyFields returns a slice of strings with the field names of the resource passed in. Only names of fields which are set in the body are contained in that slice.
This function reads and copies the reuqest body, it must always be called before any of gin's c.*Bind methods.
func OptionsGet ¶
func OptionsGetPatchDelete ¶
func OptionsGetPost ¶
func RequestHost ¶
The scheme defaults to https and only falls back to http if the x-forwarded-proto header is set to "http".
func RequestPathV1 ¶
RequestPathV1 returns the URL with the prefix for API v1.
func UUIDFromString ¶ added in v0.26.0
This is needed because gin does not support form binding to uuid.UUID currently. Follow https://github.com/gin-gonic/gin/pull/3045 to see when this gets resolved.