Documentation ¶
Index ¶
- func BindData(c *gin.Context, data interface{}) httperrors.Error
- func BindDataHandleErrors(c *gin.Context, data interface{}) error
- func GetBodyFields(c *gin.Context, resource any) ([]any, httperrors.Error)
- func GetBodyFieldsHandleErrors(c *gin.Context, resource any) ([]any, error)
- func GetURLFields(url *url.URL, filter any) ([]any, []string)
- func OptionsDelete(c *gin.Context)
- func OptionsGet(c *gin.Context)
- func OptionsGetDelete(c *gin.Context)
- func OptionsGetPatch(c *gin.Context)
- func OptionsGetPatchDelete(c *gin.Context)
- func OptionsGetPost(c *gin.Context)
- func OptionsGetPostDelete(c *gin.Context)
- func OptionsGetPostPatchDelete(c *gin.Context)
- func OptionsPost(c *gin.Context)
- func UUIDFromString(s string) (uuid.UUID, httperrors.Error)
- func UUIDFromStringHandleErrors(c *gin.Context, s string) (uuid.UUID, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindData ¶
func BindData(c *gin.Context, data interface{}) httperrors.Error
BindData binds the data from the request to the struct passed in the interface.
func BindDataHandleErrors ¶ added in v3.6.0
BindDataHandleErrors binds the data from the request to the struct passed in the interface.
This function is deprecated. Use BindData(*gin.Context, any) httperrors.Error.
func GetBodyFields ¶
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 request body, it must always be called before any of gin's c.*Bind methods.
func GetBodyFieldsHandleErrors ¶ added in v3.8.0
GetBodyFieldsHandleErrors 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 request body, it must always be called before any of gin's c.*Bind methods.
This function is deprecated, use GetBodyFields(*gin.Context, any).
func GetURLFields ¶
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 ¶
func OptionsGet ¶
func OptionsGetDelete ¶
func OptionsGetPatch ¶ added in v3.17.0
func OptionsGetPatchDelete ¶
func OptionsGetPost ¶
func OptionsGetPostDelete ¶
func OptionsPost ¶
func UUIDFromString ¶
func UUIDFromString(s string) (uuid.UUID, httperrors.Error)
UUIDFromString binds a string to a UUID
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.
func UUIDFromStringHandleErrors ¶ added in v3.5.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.
This method is deprecated. Use UUIDFromString and handle errors in the calling method.
Types ¶
This section is empty.