httputil

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: AGPL-3.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindData

func BindData(c *gin.Context, data interface{}) error

BindData binds the data from the request to the struct passed in the interface.

func GetBodyFields added in v0.30.2

func GetBodyFields(c *gin.Context, resource any) ([]any, error)

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 GetURLFields added in v0.30.2

func GetURLFields(url *url.URL, filter any) ([]any, []string)

GetURLFields checks which query parameters are set and which query parameters are set and can be used directly in a gorm query

queryFields contains all field names that can be used directly in a gorm Where statament as argument to specify the fields filtered on. As gorm uses interface{} as type for the Where statement, we cannot use a []string type here.

setFields returns a []string with all field names set in the query parameters. This can be useful to filter for zero values without defining them as pointer fields in gorm.

func OptionsDelete added in v0.40.0

func OptionsDelete(c *gin.Context)

func OptionsGet

func OptionsGet(c *gin.Context)

func OptionsGetDelete added in v0.43.0

func OptionsGetDelete(c *gin.Context)

func OptionsGetPatchDelete

func OptionsGetPatchDelete(c *gin.Context)

func OptionsGetPost

func OptionsGetPost(c *gin.Context)

func OptionsGetPostDelete added in v1.7.0

func OptionsGetPostDelete(c *gin.Context)

func OptionsGetPostPatchDelete added in v1.7.0

func OptionsGetPostPatchDelete(c *gin.Context)

func OptionsPost added in v1.6.0

func OptionsPost(c *gin.Context)

func UUIDFromString added in v0.26.0

func UUIDFromString(c *gin.Context, s string) (uuid.UUID, bool)

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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