Documentation ¶
Index ¶
- Variables
- func FindInIntgArray(elem int64, a []int64) (e int64, found bool)
- func FindInStringArray(elem string, a []string) (e string, found bool)
- func GetNonNullFields(i interface{}, tagName string) (fields []string)
- func IsEmailAddress(str string) bool
- func MaskString(s string, noMaskLeft, noMaskRight int, maskChar string) (masked string)
- func Random(min, max int) int
- func RandomString(n int) string
- func UpdateStructFromMap(destination interface{}, source map[string]interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotStruct = errors.New("destination must by struct or a pointer to struct")
)
UpdateStructFields() errors
Functions ¶
func FindInIntgArray ¶
FindInIntgArray searches for the indicated element 'elem' in array 'a'
func FindInStringArray ¶
FindInStringArray searches for the indicated element 'elem' in array 'a'
func GetNonNullFields ¶
GetNonNullFields returns an array with all the fields that aren't nil in the structure's instance
func IsEmailAddress ¶
IsEmailAddress returns true if str seems to be an email address
func MaskString ¶
MaskString creates a mask with `maskChar` for the indicated string `s`. If noMaskLeft and noMaskRight equals -1, then all the string is masked.
func RandomString ¶
RandomString generates a random string of the specified length. Keep in mind that random seed must be initialized before. Example:
rand.Seed(time.Now().Unix())
func UpdateStructFromMap ¶
UpdateStructFromMap can be used to update the fields of a structure by sending the new field values in a map, wherer the key is the field name as in the struct and the value is the new value that will be set.
Only those values in the map will be evaluated and updated. Parameter destination must be a pointer, otherwise changes won't be reflected.
Types ¶
This section is empty.