Documentation ¶
Index ¶
- Constants
- func CompareHash(hashed, plain string) bool
- func ContainsString(s []string, v string) bool
- func ContainsStrings(s []string, v []string) bool
- func DefaultIfNil(value interface{}, defaultValue interface{}) interface{}
- func FilterRead(data interface{}, scopesAllowed []string)
- func FirstNonNil(values ...interface{}) interface{}
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(s int) (string, error)
- func GetHash(pwd string) (string, error)
- func IfThen(condition bool, a interface{}) interface{}
- func IfThenElse(condition bool, a interface{}, b interface{}) interface{}
- func MatchScopes(scopeA, scopeB string) bool
- func ScanToStruct(dest interface{}, value interface{}) error
- func ScopeInAllowed(scope string, allowedScopes []string) bool
- func StringToDate(s string) (time.Time, error)
- func ToBool(i interface{}) bool
- func ToBoolE(i interface{}) (bool, error)
- func ToBoolSlice(i interface{}) []bool
- func ToBoolSliceE(i interface{}) ([]bool, error)
- func ToDuration(i interface{}) time.Duration
- func ToDurationE(i interface{}) (d time.Duration, err error)
- func ToDurationSlice(i interface{}) []time.Duration
- func ToDurationSliceE(i interface{}) ([]time.Duration, error)
- func ToFloat32(i interface{}) float32
- func ToFloat32E(i interface{}) (float32, error)
- func ToFloat64(i interface{}) float64
- func ToFloat64E(i interface{}) (float64, error)
- func ToInt(i interface{}) int
- func ToInt16(i interface{}) int16
- func ToInt16E(i interface{}) (int16, error)
- func ToInt32(i interface{}) int32
- func ToInt32E(i interface{}) (int32, error)
- func ToInt64(i interface{}) int64
- func ToInt64E(i interface{}) (int64, error)
- func ToInt8(i interface{}) int8
- func ToInt8E(i interface{}) (int8, error)
- func ToIntE(i interface{}) (int, error)
- func ToIntSlice(i interface{}) []int
- func ToIntSliceE(i interface{}) ([]int, error)
- func ToSlice(i interface{}) []interface{}
- func ToSliceE(i interface{}) ([]interface{}, error)
- func ToString(i interface{}) string
- func ToStringE(i interface{}) (string, error)
- func ToStringMap(i interface{}) map[string]interface{}
- func ToStringMapBool(i interface{}) map[string]bool
- func ToStringMapBoolE(i interface{}) (map[string]bool, error)
- func ToStringMapE(i interface{}) (map[string]interface{}, error)
- func ToStringMapInt(i interface{}) map[string]int
- func ToStringMapInt64(i interface{}) map[string]int64
- func ToStringMapInt64E(i interface{}) (map[string]int64, error)
- func ToStringMapIntE(i interface{}) (map[string]int, error)
- func ToStringMapString(i interface{}) map[string]string
- func ToStringMapStringE(i interface{}) (map[string]string, error)
- func ToStringMapStringSlice(i interface{}) map[string][]string
- func ToStringMapStringSliceE(i interface{}) (map[string][]string, error)
- func ToStringSlice(i interface{}) []string
- func ToStringSliceE(i interface{}) ([]string, error)
- func ToTime(i interface{}) time.Time
- func ToTimeE(i interface{}) (tim time.Time, err error)
- func ToUint(i interface{}) uint
- func ToUint16(i interface{}) uint16
- func ToUint16E(i interface{}) (uint16, error)
- func ToUint32(i interface{}) uint32
- func ToUint32E(i interface{}) (uint32, error)
- func ToUint64(i interface{}) uint64
- func ToUint64E(i interface{}) (uint64, error)
- func ToUint8(i interface{}) uint8
- func ToUint8E(i interface{}) (uint8, error)
- func ToUintE(i interface{}) (uint, error)
- func ValueOfStruct(dest interface{}) (driver.Value, error)
- type NullString
Constants ¶
const ( //READ is used to address read operation READ = "read" //WRITE is is used to address write operation WRITE = "write" )
Variables ¶
This section is empty.
Functions ¶
func CompareHash ¶
CompareHash and return error if not equil
func ContainsString ¶
ContainsString returns true if a string is present in a iteratee.
func ContainsStrings ¶
ContainsStrings returns true if a strings is present in a iteratee. noinspection GoUnusedExportedFunction
func DefaultIfNil ¶
func DefaultIfNil(value interface{}, defaultValue interface{}) interface{}
DefaultIfNil checks if the value is nil, if true returns the default value otherwise the original
func FilterRead ¶ added in v1.1.0
func FilterRead(data interface{}, scopesAllowed []string)
FilterRead is used to filter output to onlly output what client can see based on scopes
func FirstNonNil ¶
func FirstNonNil(values ...interface{}) interface{}
FirstNonNil returns the first non nil parameter
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.
func IfThen ¶
func IfThen(condition bool, a interface{}) interface{}
IfThen evaluates a condition, if true returns the parameters otherwise nil
func IfThenElse ¶
func IfThenElse(condition bool, a interface{}, b interface{}) interface{}
IfThenElse evaluates a condition, if true returns the first parameter otherwise the second
func MatchScopes ¶ added in v1.1.0
MatchScopes matches two scopes using Wildcard Scope Matching Strategy (asymetric)
func ScanToStruct ¶
func ScanToStruct(dest interface{}, value interface{}) error
Make the Attrs struct implement the sql.Scanner interface. This method simply decodes a JSON-encoded value into the struct fields.
func ScopeInAllowed ¶ added in v1.1.0
ScopeInAllowed is used to check if scope is allowed based on allowed scopes list
func StringToDate ¶
StringToDate attempts to parse a string into a time.Time type using a predefined list of formats. If no suitable format is found, an error is returned.
func ToBoolSlice ¶
func ToBoolSlice(i interface{}) []bool
ToBoolSlice casts an interface to a []bool type.
func ToBoolSliceE ¶
ToBoolSliceE casts an interface to a []bool type.
func ToDuration ¶
ToDuration casts an interface to a time.Duration type.
func ToDurationE ¶
ToDurationE casts an interface to a time.Duration type.
func ToDurationSlice ¶
ToDurationSlice casts an interface to a []time.Duration type.
func ToDurationSliceE ¶
ToDurationSliceE casts an interface to a []time.Duration type.
func ToFloat32 ¶
func ToFloat32(i interface{}) float32
ToFloat32 casts an interface to a float32 type.
func ToFloat32E ¶
ToFloat32E casts an interface to a float32 type.
func ToFloat64 ¶
func ToFloat64(i interface{}) float64
ToFloat64 casts an interface to a float64 type.
func ToFloat64E ¶
ToFloat64E casts an interface to a float64 type.
func ToIntSlice ¶
func ToIntSlice(i interface{}) []int
ToIntSlice casts an interface to a []int type.
func ToIntSliceE ¶
ToIntSliceE casts an interface to a []int type.
func ToSlice ¶
func ToSlice(i interface{}) []interface{}
ToSlice casts an interface to a []interface{} type.
func ToSliceE ¶
func ToSliceE(i interface{}) ([]interface{}, error)
ToSliceE casts an interface to a []interface{} type.
func ToStringMap ¶
func ToStringMap(i interface{}) map[string]interface{}
ToStringMap casts an interface to a map[string]interface{} type.
func ToStringMapBool ¶
ToStringMapBool casts an interface to a map[string]bool type.
func ToStringMapBoolE ¶
ToStringMapBoolE casts an interface to a map[string]bool type.
func ToStringMapE ¶
ToStringMapE casts an interface to a map[string]interface{} type.
func ToStringMapInt ¶
ToStringMapInt casts an interface to a map[string]int type.
func ToStringMapInt64 ¶
ToStringMapInt64 casts an interface to a map[string]int64 type.
func ToStringMapInt64E ¶
ToStringMapInt64E casts an interface to a map[string]int64{} type.
func ToStringMapIntE ¶
ToStringMapIntE casts an interface to a map[string]int{} type.
func ToStringMapString ¶
ToStringMapString casts an interface to a map[string]string type.
func ToStringMapStringE ¶
ToStringMapStringE casts an interface to a map[string]string type.
func ToStringMapStringSlice ¶
ToStringMapStringSlice casts an interface to a map[string][]string type.
func ToStringMapStringSliceE ¶
ToStringMapStringSliceE casts an interface to a map[string][]string type.
func ToStringSlice ¶
func ToStringSlice(i interface{}) []string
ToStringSlice casts an interface to a []string type.
func ToStringSliceE ¶
ToStringSliceE casts an interface to a []string type.
func ValueOfStruct ¶
Types ¶
type NullString ¶
type NullString struct {
sql.NullString
}
func (NullString) MarshalJSON ¶
func (v NullString) MarshalJSON() ([]byte, error)
func (*NullString) UnmarshalJSON ¶
func (v *NullString) UnmarshalJSON(data []byte) error