Documentation
¶
Index ¶
- Constants
- func AskPassword(question string) (password string, err error)
- func AskYes(question string, defaultYes bool) (isYes bool)
- func DefaultIfEmptyInt(v *int, defaultV int)
- func DefaultIfEmptyInt64(v *int64, defaultV int64)
- func DefaultIfEmptyStr(s *string, defaultS string)
- func DefaultIfEmptyUint32(v *uint32, defaultV uint32)
- func DefaultIfEmptyUint64(v *uint64, defaultV uint64)
- func DefaultIfEmptyUint8(v *uint8, defaultV uint8)
- func IsEmptyStr(s string) bool
- func IsEqStr(a, b string) bool
- func IsInt64(str string) (isInt bool, val int64)
- func IsPositiveInt64(str string) (isInt bool, val int64)
- func RandomString(alphabet string, length int) (s string, err error)
- func RandomStringL(l int) string
- type BigInt
Constants ¶
const (
// DefaultAlphabet default alphabet for string generation
DefaultAlphabet = "asdfghjklqwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890"
)
Variables ¶
This section is empty.
Functions ¶
func AskPassword ¶
AskPassword ask a password
func DefaultIfEmptyInt ¶
DefaultIfEmptyInt set the value of an int to a default if it is nulled (0)
func DefaultIfEmptyInt64 ¶
DefaultIfEmptyInt64 set the value of an int to a default if it is nulled (0)
func DefaultIfEmptyStr ¶
DefaultIfEmptyStr set a default for a string if it is nulled
func DefaultIfEmptyUint32 ¶
DefaultIfEmptyUint32 set the value of an int to a default if it is nulled (0)
func DefaultIfEmptyUint64 ¶
DefaultIfEmptyUint64 set the value of an int to a default if it is nulled (0)
func DefaultIfEmptyUint8 ¶
DefaultIfEmptyUint8 set the value of an int to a default if it is nulled (0)
func IsEqStr ¶
IsEqStr tells if two strings a and b are equals after trimming spaces and lowercasing
func IsPositiveInt64 ¶
IsPositiveInt64 check if a string is a positive integer
func RandomString ¶
RandomString generate a random string of required lenght an with requested alphabet
func RandomStringL ¶
RandomStringL generate a string that can be used as secrete api key
Types ¶
type BigInt ¶
BigInt is composed of a big.Int, but includes a Validate() method for swagger and other convenience functions. Once created, it can be used just like a big.Int.
func NewBigInt ¶
func NewBigInt() (i *BigInt)
NewBigInt returns a new BigInt with its Int struct field initialized
func NewBigIntFromString ¶
NewBigIntFromString returns a new BigInt from a string representation
func NewBigIntFromUint64 ¶
NewBigIntFromUint64 returns a new BigInt from a uint64 representation
func RequireBigIntFromString ¶
RequireBigIntFromString returns a new BigInt from a string representation or panics if NewBigIntFromString would have returned an error.
func (BigInt) LargerOrEqualToZero ¶
LargerOrEqualToZero checks that the number is >=0
func (BigInt) LargerThanZero ¶
LargerThanZero checks that the number is >=0