utils

package
v0.0.0-...-604c761 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindJSON

func BindJSON(c *gin.Context, obj any) error

func BindJSONAllowEmptyBody

func BindJSONAllowEmptyBody(c *gin.Context, request any) error

BindJSONAllowEmptyBody should be used when a request is fully optional, and the request body is allowed to be completely empty. The correct usage of this, and DisallowEmptyBody prevents certain cases where errors are ambiguous and nonsensical.

func BindJSONtestc

func BindJSONtestc(c *gin.Context, request any) error

BindJSONDisallowEmptyBody should be a request is not fully optional, and the request body is never allowed to be completely empty. The correct usage of this, and AllowEmptyBody prevents certain cases where errors are ambiguous and nonsensical.

func ValidateUrl

func ValidateUrl(u string) (string, error)

validateUrl checks if the given string is a valid complete URL, and either returns a absolute url, or an error. If the input url is not an absolute url, but just a fully qualified domain, http:// will be prepended.

Types

type NullTime

type NullTime struct {
	sql.NullTime
}

NullTime is an alias for sql.NullTime with custom JSON unmarshaling

func (*NullTime) UnmarshalJSON

func (nt *NullTime) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a JSON string into NullTime

Jump to

Keyboard shortcuts

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