Documentation
¶
Index ¶
- Constants
- func AcceptContentType(r *http.Request) (string, error)
- func BoolPtr(v bool) *booldeprecated
- func DoubleQuote(str string) string
- func DurationPtr(v time.Duration) *time.Durationdeprecated
- func Float64Ptr(v float64) *float64deprecated
- func Hash(data []byte) string
- func Int32Ptr(v int32) *int32deprecated
- func Int64Ptr(v int64) *int64deprecated
- func IsDoubleQuoted(s string) bool
- func IsEmail(addr string, name, email *string) bool
- func IsIdentifier(s string) bool
- func IsNumeric(s string) bool
- func IsSingleQuoted(s string) bool
- func IsUUID(id string) bool
- func IsUppercase(s string) bool
- func JoinPath(prefix, path string) string
- func NormalisePath(path string) string
- func ParseContentType(header string) (string, error)
- func Ptr[T any](v T) *T
- func PtrBool(v *bool) booldeprecated
- func PtrDuration(v *time.Duration) time.Durationdeprecated
- func PtrFloat64(v *float64) float64deprecated
- func PtrInt32(v *int32) int32deprecated
- func PtrInt64(v *int64) int64deprecated
- func PtrString(s *string) stringdeprecated
- func PtrTime(t *time.Time) time.Timedeprecated
- func PtrUint64(v *uint64) uint64deprecated
- func Quote(str string) string
- func RequestContentType(r *http.Request) (string, error)
- func StringPtr(s string) *stringdeprecated
- func Stringify[T any](v T) string
- func TimePtr(t time.Time) *time.Timedeprecated
- func TrimStringPtr(s *string) *string
- func UUIDSplit(id string) []string
- func Uint64Ptr(v uint64) *uint64deprecated
- func Unquote(s string) string
- func Value[T any](v *T) T
Constants ¶
const ( SchemeSecure = "https" SchemeInsecure = "http" ContentTypeHeader = "Content-Type" ContentAcceptHeader = "Accept" ContentLengthHeader = "Content-Length" ContentDispositonHeader = "Content-Disposition" ContentModifiedHeader = "Last-Modified" ContentHashHeader = "ETag" )
const ( ContentTypeJSON = "application/json" ContentTypeXML = "application/xml" ContentTypeRSS = "application/rss+xml" ContentTypeBinary = "application/octet-stream" ContentTypeCSV = "text/csv" ContentTypeTextXml = "text/xml" ContentTypeTextPlain = "text/plain" ContentTypeTextStream = "text/event-stream" ContentTypeFormData = "multipart/form-data" ContentTypeAny = "*/*" )
const ( // An identifier is a string which starts with a letter and is followed by // letters, numbers, underscores or hyphens. It must be between 1 and 64 characters ReIdentifier = `[a-zA-Z][a-zA-Z0-9_\-]{0,63}` )
Variables ¶
This section is empty.
Functions ¶
func DoubleQuote ¶
DoubleQuote returns a string with the input string quoted and escaped for
func Float64Ptr
deprecated
func IsDoubleQuoted ¶
IsDoubleQuoted checks if a string is double-quoted
func IsEmail ¶
Parse an email address into a name and address parts, and return true if the email address is valid
func IsIdentifier ¶
Return true if the string is a valid identifier
func IsSingleQuoted ¶
IsSingleQuoted checks if a string is single-quoted
func IsUppercase ¶
IsUppercase checks if a string is all in uppercase (A-Z)
func NormalisePath ¶
Return path with a single '/' separator at the beginning and no trailing '/' separator
func ParseContentType ¶
Parse a content type header to return the mimetype
func PtrFloat64
deprecated
func TrimStringPtr ¶
TrimStringPtr returns a pointer to a white-space trimmed string, or nil if the string is empty
func UUIDSplit ¶
Return two-byte parts of a UUID, or nil if the UUID is invalid. The function will always return eight sets if the UUID is valid.
Types ¶
This section is empty.