Documentation
¶
Index ¶
- Constants
- func AcceptContentType(r *http.Request) (string, error)
- func BoolPtr(v bool) *bool
- func DoubleQuote(str string) string
- func DurationPtr(v time.Duration) *time.Duration
- func Float64Ptr(v float64) *float64
- func Hash(data []byte) string
- func Int32Ptr(v int32) *int32
- func Int64Ptr(v int64) *int64
- 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 PtrBool(v *bool) bool
- func PtrDuration(v *time.Duration) time.Duration
- func PtrFloat64(v *float64) float64
- func PtrInt32(v *int32) int32
- func PtrInt64(v *int64) int64
- func PtrString(s *string) string
- func PtrTime(t *time.Time) time.Time
- func PtrUint64(v *uint64) uint64
- func Quote(str string) string
- func RequestContentType(r *http.Request) (string, error)
- func StringPtr(s string) *string
- func TimePtr(t time.Time) *time.Time
- func TrimStringPtr(s *string) *string
- func UUIDSplit(id string) []string
- func Uint64Ptr(v uint64) *uint64
- func Unquote(s string) string
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 ¶ added in v1.5.0
DoubleQuote returns a string with the input string quoted and escaped for
func DurationPtr ¶ added in v1.5.0
DurationPtr returns a pointer to a time.Duration
func Float64Ptr ¶ added in v1.5.6
Float64Ptr returns a pointer to a float64
func IsDoubleQuoted ¶ added in v1.5.0
IsDoubleQuoted checks if a string is double-quoted
func IsEmail ¶ added in v1.5.0
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 ¶ added in v1.5.0
IsSingleQuoted checks if a string is single-quoted
func IsUppercase ¶ added in v1.5.0
IsUppercase checks if a string is all in uppercase (A-Z)
func NormalisePath ¶ added in v1.5.0
Return path with a single '/' separator at the beginning and no trailing '/' separator
func ParseContentType ¶ added in v1.5.0
Parse a content type header to return the mimetype
func PtrDuration ¶ added in v1.5.5
PtrDuration returns a duration from a pointer
func PtrFloat64 ¶ added in v1.5.6
PtrFloat64 returns a float64 from a pointer
func TrimStringPtr ¶ added in v1.5.5
TrimStringPtr returns a pointer to a white-space trimmed string, or nil if the string is empty
func UUIDSplit ¶ added in v1.5.0
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.