types

package
v1.5.13 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: Apache-2.0 Imports: 10 Imported by: 9 modules, 68 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

View Source
const (
	SchemeSecure            = "https"
	SchemeInsecure          = "http"
	ContentTypeHeader       = "Content-Type"
	ContentAcceptHeader     = "Accept"
	ContentLengthHeader     = "Content-Length"
	ContentDispositonHeader = "Content-Disposition"
	ContentModifiedHeader   = "Last-Modified"
	ContentHashHeader       = "ETag"
)
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"
	ContentTypeTextStream = "text/event-stream"
	ContentTypeFormData   = "multipart/form-data"
	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

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

func BoolPtr

func BoolPtr(v bool) *bool

BoolPtr returns a pointer to a bool

func DoubleQuote

func DoubleQuote(str string) string

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

func DurationPtr

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

DurationPtr returns a pointer to a time.Duration

func Float64Ptr

func Float64Ptr(v float64) *float64

Float64Ptr returns a pointer to a float64

func Hash

func Hash(data []byte) string

func Int32Ptr

func Int32Ptr(v int32) *int32

Int32Ptr returns a pointer to a int32

func Int64Ptr

func Int64Ptr(v int64) *int64

Int64Ptr returns a pointer to a int64

func IsDoubleQuoted

func IsDoubleQuoted(s string) bool

IsDoubleQuoted checks if a string is double-quoted

func IsEmail

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

func IsNumeric(s string) bool

IsNumeric checks if a string consists only of digits

func IsSingleQuoted

func IsSingleQuoted(s string) bool

IsSingleQuoted checks if a string is single-quoted

func IsUUID

func IsUUID(id string) bool

Return true if the string is a valid UUID

func IsUppercase

func IsUppercase(s string) bool

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

func JoinPath

func JoinPath(prefix, path string) string

Return a normalised joined path

func NormalisePath

func NormalisePath(path string) string

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

func ParseContentType

func ParseContentType(header string) (string, error)

Parse a content type header to return the mimetype

func PtrBool

func PtrBool(v *bool) bool

PtrBool returns a bool from a pointer

func PtrDuration

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

PtrDuration returns a duration from a pointer

func PtrFloat64

func PtrFloat64(v *float64) float64

PtrFloat64 returns a float64 from a pointer

func PtrInt32

func PtrInt32(v *int32) int32

PtrInt32 returns a int32 from a pointer

func PtrInt64

func PtrInt64(v *int64) int64

PtrInt64 returns a int64 from a pointer

func PtrString

func PtrString(s *string) string

PtrString returns a string from a pointer

func PtrTime

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

PtrTime returns a time.Time from a pointer

func PtrUint64

func PtrUint64(v *uint64) uint64

PtrUint64 returns a uint64 from a pointer

func Quote

func Quote(str string) string

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

func RequestContentType

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

func StringPtr

func StringPtr(s string) *string

StringPtr returns a pointer to a string

func TimePtr

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

PtrTime returns a pointer to a time.Time

func TrimStringPtr

func TrimStringPtr(s *string) *string

TrimStringPtr returns a pointer to a white-space trimmed string, or nil if the string is empty

func UUIDSplit

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

func Uint64Ptr(v uint64) *uint64

Uint64Ptr returns a pointer to a uint64

func Unquote

func Unquote(s string) string

Unquote returns a string with the input string unquoted

Types

This section is empty.

Jump to

Keyboard shortcuts

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