Documentation
¶
Index ¶
- Constants
- Variables
- func AsBool(value interface{}) (bool, error)
- func AsFloat(value interface{}) (float64, error)
- func AsInt(value interface{}) (int, error)
- func AsString(value interface{}) (string, error)
- func AsTime(value interface{}) (time.Time, error)
- func FirstDayOfISOWeek(year int, week int, timezone *time.Location) time.Time
- func GetUID(name string) (string, error)
- func IsBitstring(str string) bool
- func IsDNSName(str string) bool
- func IsDialString(str string) bool
- func IsEmailFormat(str string) bool
- func IsFilePath(str string) (bool, int)
- func IsFloat(str string) bool
- func IsHexadecimal(str string) bool
- func IsIP(str string) bool
- func IsIPInRange(rangeIPs []string, checkIP string) bool
- func IsInt(str string) bool
- func IsNull(str string) bool
- func IsPhoneNumberFormat(str string) bool
- func IsPointer(obj interface{}) bool
- func IsPort(str string) bool
- func IsSimpleType(kind reflect.Kind) bool
- func IsTruthy(input string) bool
- func IsUIDHex(s string) bool
- func IsValidEmailHost(email string) bool
- func IsValidIP(ip string) bool
- func Matches(str, pattern string) bool
- func RandomString() string
- func RandomStringLen(length int) string
- func SplitEmailToAccountAndDomain(email string) (account, host string)
- func TimeAgo(datetime time.Time) string
- func ToStringSlice(list []int) []string
- func TrimAndLower(str string) string
- func Truthy(input string) bool
- func ValidUID(uid string) bool
- func WaitTermSignal() chan os.Signal
- func WorkingDays(startDate time.Time, endDate time.Time) int
- type ISO3166Entry
- type UID
- func (id *UID) DecodeText(ci *pgtype.ConnInfo, src []byte) error
- func (id UID) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)
- func (id UID) Equals(u UID) bool
- func (id UID) Hex() string
- func (id UID) MarshalJSON() ([]byte, error)
- func (id UID) MarshalText() ([]byte, error)
- func (id UID) String() string
- func (id UID) UUID() uuid.UUID
- func (id *UID) UnmarshalJSON(data []byte) error
- func (id *UID) UnmarshalText(data []byte) error
- func (id UID) Valid() bool
- type UIDsList
Constants ¶
const ( // Unknown is unresolved OS type UnknownFileType = iota // Win is Windows type WinFileType // Unix is *nix OS types UnixFileType )
Used by IsFilePath func
const ( // StdLen is the minimum string length required to achieve ~95 bits of entropy. StdLen = 16 // MaxLen is the maximum length possible for generated strings MaxLen = 1048576 )
Variables ¶
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
StdChars is a set of standard characters allowed in Base64 string.
Functions ¶
func FirstDayOfISOWeek ¶
FirstDayOfISOWeek returns the date of the Monday in the given week/year
func IsBitstring ¶
IsBitstring check if the string is a bit string.
func IsDialString ¶
IsDialString validates the given string for usage with the various Dial() functions
func IsEmailFormat ¶
IsEmailFormat checks if the string is a valid email address format
func IsFilePath ¶
IsFilePath check is a string is Win or Unix file path and returns it's type.
func IsHexadecimal ¶
IsHexadecimal check if the string is a hexadecimal number.
func IsIPInRange ¶
IsIPInRange returns true if checkIP is in any of the specified ips or cidr ranges from rangeIPs
func IsPhoneNumberFormat ¶
IsPhoneNumberFormat checks if the string is a valid phone number format
func IsPointer ¶
func IsPointer(obj interface{}) bool
IsPointer checks if given interface is a pointer
func IsSimpleType ¶
IsSimpleType checks if given t ype is a simple Go type
func IsValidEmailHost ¶
IsValidEmailHost tries to do a SMTP connection on the email host to validate if it's a valid email address or not
func Matches ¶
Matches check if string matches the pattern (pattern is regular expression) In case of error return false
func RandomString ¶
func RandomString() string
RandomString returns a new random string of the standard length, consisting of standard characters.
func RandomStringLen ¶
RandomStringLen returns a new random string of the provided length (0 < len < MaxLen), consisting of standard characters.
func SplitEmailToAccountAndDomain ¶
SplitEmailToAccountAndDomain splits an email address into account name and hostname
func TimeAgo ¶
TimeAgo takes a time input and returns a string representation of how much time elapsed since the given time
func ToStringSlice ¶
ToStringSlice converts the int slice to a string slice
func TrimAndLower ¶
TrimAndLower returns a lowercase representation of the input
func Truthy ¶
Truthy converts string values to their boolean representations. If input string is not found in the list of defined truthy values, false is returned.
FALSE values: NaN, undefined, null, "" (empty string), false, no, off, 0, untoggled, inactive TRUE values: true, yes, on, 1, toggled, active
func WaitTermSignal ¶
Types ¶
type ISO3166Entry ¶
type ISO3166Entry struct { EnglishShortName string FrenchShortName string Alpha2Code string Alpha3Code string Numeric string }
ISO3166Entry stores country codes
type UID ¶
type UID string
func (UID) MarshalJSON ¶
func (UID) MarshalText ¶
func (*UID) UnmarshalJSON ¶
func (*UID) UnmarshalText ¶
UnmarshalText turns *bson.ObjectId into an encoding.TextUnmarshaler.
Directories
¶
Path | Synopsis |
---|---|
Package structs contains various utilities functions to work with structs.
|
Package structs contains various utilities functions to work with structs. |
Package uuid provides RFC4122 UUIDs.
|
Package uuid provides RFC4122 UUIDs. |
Package version implements semantic version according to semver.org 2.0.0 specs.
|
Package version implements semantic version according to semver.org 2.0.0 specs. |