types

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

View Source
const (
	SchemeSecure            = "https"
	SchemeInsecure          = "http"
	ContentTypeHeader       = "Content-Type"
	ContentAcceptHeader     = "Accept"
	ContentLengthHeader     = "Content-Length"
	ContentDispositonHeader = "Content-Disposition"
	ContentModifiedHeader   = "Last-Modified"
)
View Source
const (
	ContentTypeJSON      = "application/json"
	ContentTypeXML       = "application/xml"
	ContentTypeRSS       = "application/rss+xml"
	ContentTypeBinary    = "application/octet-stream"
	ContentTypeCSV       = "text/csv"
	ContentTypeTextXml   = "text/xml"
	ContentTypeTextPlain = "text/plain"
	ContentTypeAny       = "*/*"
)
View Source
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 AcceptContentType added in v1.5.0

func AcceptContentType(r *http.Request) (string, error)

func BoolPtr added in v1.5.0

func BoolPtr(v bool) *bool

BoolPtr returns a pointer to a bool

func DoubleQuote added in v1.5.0

func DoubleQuote(str string) string

DoubleQuote returns a string with the input string quoted and escaped for

func DurationPtr added in v1.5.0

func DurationPtr(v time.Duration) *time.Duration

DurationPtr returns a pointer to a time.Duration

func IsDoubleQuoted added in v1.5.0

func IsDoubleQuoted(s string) bool

IsDoubleQuoted checks if a string is double-quoted

func IsEmail added in v1.5.0

func IsEmail(addr string, name, email *string) bool

Parse an email address into a name and address parts, and return true if the email address is valid

func IsIdentifier

func IsIdentifier(s string) bool

Return true if the string is a valid identifier

func IsNumeric added in v1.5.0

func IsNumeric(s string) bool

IsNumeric checks if a string consists only of digits

func IsSingleQuoted added in v1.5.0

func IsSingleQuoted(s string) bool

IsSingleQuoted checks if a string is single-quoted

func IsUUID added in v1.5.0

func IsUUID(id string) bool

Return true if the string is a valid UUID

func IsUppercase added in v1.5.0

func IsUppercase(s string) bool

IsUppercase checks if a string is all in uppercase (A-Z)

func JoinPath added in v1.5.0

func JoinPath(prefix, path string) string

Return a normalised joined path

func NormalisePath added in v1.5.0

func NormalisePath(path string) string

Return path with a single '/' separator at the beginning and no trailing '/' separator

func ParseContentType added in v1.5.0

func ParseContentType(header string) (string, error)

Parse a content type header to return the mimetype

func PtrBool added in v1.5.0

func PtrBool(v *bool) bool

PtrBool returns a bool from a pointer

func PtrString added in v1.5.0

func PtrString(s *string) string

PtrString returns a string from a pointer

func PtrTime added in v1.5.0

func PtrTime(t *time.Time) time.Time

PtrTime returns a time.Time from a pointer

func PtrUint64 added in v1.5.0

func PtrUint64(v *uint64) uint64

PtrUint64 returns a uint64 from a pointer

func Quote added in v1.5.0

func Quote(str string) string

Quote returns a string with the input string quoted and escaped for

func RequestContentType added in v1.5.0

func RequestContentType(r *http.Request) (string, error)

func StringPtr added in v1.5.0

func StringPtr(s string) *string

StringPtr returns a pointer to a string

func UUIDSplit added in v1.5.0

func UUIDSplit(id string) []string

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.

func Uint64Ptr added in v1.5.0

func Uint64Ptr(v uint64) *uint64

Uint64Ptr returns a pointer to a uint64

Types

This section is empty.

Jump to

Keyboard shortcuts

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