Documentation ¶
Index ¶
- Constants
- Variables
- func FloatOrNull(n float64) sql.NullFloat64
- func FormatDate(timestamp *time.Time) string
- func FormatTime(timestamp *time.Time) string
- func GetCurrentURL(r *http.Request) string
- func IntOrNull(n int64) sql.NullInt64
- func NewSecure(isDevelopment bool) *secure.Secure
- func ParseBearerToken(r *http.Request) ([]byte, error)
- func ParseDate(timestamp string) (*time.Time, error)
- func ParseTimestamp(timestamp string) (*time.Time, error)
- func PositiveFloatOrNull(n float64) sql.NullFloat64
- func PositiveIntOrNull(n int64) sql.NullInt64
- func RegexExtractMatch(in, regularExpression, name string) (string, error)
- func RegexExtractMatches(in, regExp string, names ...string) (map[string]string, error)
- func SpaceDelimitedStringNotGreater(first, second string) bool
- func StringInSlice(a string, list []string) bool
- func StringOrNull(str string) sql.NullString
- func TimeOrNull(t *time.Time) pq.NullTime
- func ValidateEmail(email string) bool
Constants ¶
const ( // RFC3339Mili is a modification of RFC3339Nano to only include ms (3 decimal places) RFC3339Mili = "2006-01-02T15:04:05.999Z07:00" // DateFormat used for things such as date of birth (when time does not matter) DateFormat = "2006-01-02" )
Variables ¶
var ( // ErrNoMatchFound ... ErrNoMatchFound = errors.New("No match found") )
Functions ¶
func FloatOrNull ¶
func FloatOrNull(n float64) sql.NullFloat64
FloatOrNull returns properly configured sql.NullFloat64
func FormatDate ¶
FormatDate formats a time object to a date only format, e.g. 2006-01-02
func FormatTime ¶
FormatTime formats a time object to RFC3339 with ms precision
func GetCurrentURL ¶
GetCurrentURL returns the current request URL
func ParseBearerToken ¶
ParseBearerToken parses Bearer token from Authorization header
func ParseDate ¶
ParseDate parses a string representation of a date format and returns a time.Time instance
func ParseTimestamp ¶
ParseTimestamp parses a string representation of a timestamp in RFC3339 format and returns a time.Time instance
func PositiveFloatOrNull ¶
func PositiveFloatOrNull(n float64) sql.NullFloat64
PositiveFloatOrNull returns properly configured sql.NullFloat64 for a positive number
func PositiveIntOrNull ¶
PositiveIntOrNull returns properly configured sql.NullInt64 for a positive number
func RegexExtractMatch ¶
RegexExtractMatch extracts a named match from a string using regex
func RegexExtractMatches ¶
RegexExtractMatches extracts multiple named matches from a string using regex
func SpaceDelimitedStringNotGreater ¶
SpaceDelimitedStringNotGreater returns true if the first string is the same as the second string or does not contain any substring not contained in the second string (when split by space)
func StringInSlice ¶
StringInSlice is a function similar to "x in y" Python construct
func StringOrNull ¶
func StringOrNull(str string) sql.NullString
StringOrNull returns properly configured sql.NullString
func TimeOrNull ¶
TimeOrNull returns properly confiigured pq.TimeNull
func ValidateEmail ¶
ValidateEmail validates an email address based on a regular expression
Types ¶
This section is empty.