Versions in this module Expand all Collapse all v1 v1.2.0 Sep 23, 2023 Changes in this version + const ASCIISub + const BlowfishRounds + const DefaultRounds + const MaxRounds + const MinRounds + const SaltLen + var ConfirmNoRegex = regexp.MustCompile(`^(?i)no?$`) + var ConfirmRejection = "<warn>Please respond with \"y\" or \"n\"\n\n" + var ConfirmYesRegex = regexp.MustCompile(`^(?i)y(es)?$`) + var DefaultTrimChars = string([]byte{ ... }) + var Discard Transformer = discard + var ErrASCIIReplacement = RepertoireError(ASCIISub) + var ErrEndOfSpan = errors.New("transform: input and output are not identical") + var ErrInvalidUTF8 = errors.New("encoding: invalid UTF-8") + var ErrShortDst = errors.New("transform: short destination buffer") + var ErrShortSrc = errors.New("transform: short source buffer") + var InvalidRounds = errors.New("bcrypt: Invalid rounds parameter") + var InvalidSalt = errors.New("bcrypt: Invalid salt supplied") + var Nop SpanningTransformer = nop + var RenderChooseOption = func(key, value string, size int) string + var RenderChooseQuery = func() string + var RenderChooseQuestion = func(question string) string + var UTF8ValidatorTransformer = utf8Validator + func AesDe(encrypted string, k string) (string, error) + func AesEn(text string, k string) (string, error) + func Append(t Transformer, dst, src []byte) (result []byte, n int, err error) + func Ask(str string, check func(string) error) string + func Associate(collection []T, transform func(item T) (K, V)) map[K]V + func Authcode(text string, params ...interface{}) string + func Average(numbers ...T) T + func Base642Img(path, data string) (ps string) + func Base64Decode(s string, isurl bool) string + func Base64Encode(s string, isurl bool) (s1 string) + func Bytes(t Transformer, b []byte) (result []byte, n int, err error) + func Choose(question string, choices map[string]string) string + func Chunk(collection []T, size int) [][]T + func ChunkString(str T, size int) []T + func ColorHexToRGB(colorHex string) (red, green, blue int) + func ColorRGBToHex(red, green, blue int) string + func Compact(collection []T) []T + func Confirm(question string) bool + func Contain(slice []T, target T) bool + func ContainSubSlice(slice, subSlice []T) bool + func CopyFile(srcPath string, dstPath string) error + func CreateDir(absPath string) error + func CreateFile(path string) bool + func CurrentPath() string + func Date(format string, ts ...time.Time) string + func DownloadFile(filepath string, url string) error + func Drop(collection []T, n int) []T + func DropRight(collection []T, n int) []T + func DropRightWhile(collection []T, predicate func(item T) bool) []T + func DropWhile(collection []T, predicate func(item T) bool) []T + func Emoji(s string) (ss string) + func EmojiDecode(s string) string + func EmojiEncode(s string) string + func Empty() T + func EncodeUrl(urlStr string) (string, error) + func Err(err error) + func FileCount(sizes int64) string + func FileSize(path string) (int64, error) + func Filter(collection []V, predicate func(item V, index int) bool) []V + func FilterMap(m map[K]V, predicate func(key K, value V) bool) map[K]V + func Flatten(collection [][]T) []T + func ForEach(collection []T, iteratee func(item T, index int)) + func ForEachMap(m map[K]V, iteratee func(key K, value V)) + func Gbk2Utf8(gbkStr string) string + func Get(u string) string + func GetAppPath() string + func GetIp() string + func GetOsBits() int + func GetPinyin(s, sp string) (pinyin, shortpinyin string) + func GetWeekday(ri string) string + func HasKey(m map[K]V, key K) bool + func Hash(password string, salt ...string) (ps string, err error) + func HashBytes(password []byte, salt ...[]byte) (hash []byte, err error) + func HideString(origin string, start, end int, replaceChar string) string + func HideTel(phone string) (str string) + func HtmlDecode(s string) string + func HtmlEncode(s string) string + func Img2Base64(filename string) (s string) + func InsertAt(slice []T, index int, value any) []T + func Intersect(list1 []T, list2 []T) []T + func Invert(in map[K]V) map[V]K + func IsASCII(str string) bool + func IsAsc(slice []T) bool + func IsBase64(base64 string) bool + func IsChinese(s string) bool + func IsChineseIdNum(id string) bool + func IsDesc(slice []T) bool + func IsDir(path string) bool + func IsEmail(email string) bool + func IsEmpty(v T) bool + func IsExist(path string) bool + func IsFloat(v any) bool + func IsGBK(data []byte) bool + func IsInt(v any) bool + func IsIp(ipstr string) bool + func IsJSON(str string) bool + func IsLeapYear(year int) bool + func IsLinux() bool + func IsMac() bool + func IsMobile(mobileNum string) bool + func IsNumber(v any) bool + func IsSorted(slice []T) bool + func IsStrongPassword(password string, length int) bool + func IsUrl(str string) bool + func IsUtf8(s string) bool + func IsWeekend(t time.Time) bool + func IsWeixin(r *http.Request) bool + func IsWindows() bool + func IsZipFile(filepath string) bool + func Join(slice []T, separator string) string + func Keys(in map[K]V) []K + func Last(collection []T) (T, error) + func ListFile(path string) ([]string, error) + func MTime(filepath string) (int64, error) + func Map(slice []T, iteratee func(index int, item T) U) []U + func Map2Http(param map[string]any) string + func MapToSlice(in map[K]V, iteratee func(key K, value V) R) []R + func Match(password, hash string) bool + func MatchBytes(password []byte, hash []byte) bool + func Max(collection []T) T + func Md5(s string) string + func Merge(slices ...[]T) []T + func MergeMap(maps ...map[K]V) map[K]V + func MiMeType(file any) string + func MicroTime() float64 + func Min(collection []T) T + func NumberFormat(number float64, decimals int, decPoint, thousandsSep string) string + func Openurl(url string) + func PasswordHash(password string) (string, error) + func PasswordVerify(password, hash string) bool + func Percent(val, total float64, n int) float64 + func PointDistance(x1, y1, x2, y2 float64) float64 + func RandColor() string + func RandInt(min, max int) int + func RandomString(size int, charset []rune) string + func Range(start T, elementNum int) []T + func RangeWithStep(start, end, step T) []T + func ReadCsvFile(filepath string) ([][]string, error) + func ReadFile(path string) (string, error) + func ReadFileByLine(path string) ([]string, error) + func RemoveFile(path string) error + func Reverse(collection []T) []T + func RoundToFloat(x float64, n int) float64 + func RoundToString(x float64, n int) string + func RuneLength(str string) int + func Salt(rounds ...int) (string, error) + func SaltBytes(rounds ...int) (salt []byte, err error) + func Sample(collection []T) T + func Samples(collection []T, count int) []T + func SendEmail(from string, to1 string, subject string, body string, secret string, ...) (err error) + func Sha1(str string) string + func Sha256(str string) string + func Shuffle(collection []T) []T + func SliceToMap(collection []T, transform func(item T) (K, V)) map[K]V + func Sort(slice []T, sortOrder ...string) + func SplitStr(str, delimiter string, characterMask ...string) []string + func Str2Time(s string) int64 + func String(t Transformer, s string) (result string, n int, err error) + func StripTags(content string) string + func StructToMap(value any) map[string]any + func Substring(s string, offset int, length uint) string + func Sum(collection []T) T + func TableArr(s string) [][]string + func Ternary(condition bool, ifOutput T, elseOutput T) T + func TernaryF(condition bool, ifFunc func() T, elseFunc func() T) T + func Time() int64 + func TimeLine(t int64) string + func Timestr2Time(str string) time.Time + func ToBool(s string) (bool, error) + func ToBytes(value any) ([]byte, error) + func ToChar(s string) []string + func ToFloat(value any) (float64, error) + func ToInt(value any) (int64, error) + func ToInterface(v reflect.Value) (value interface{}, ok bool) + func ToJson(value any) (string, error) + func ToMap(array []T, iteratee func(T) (K, V)) map[K]V + func ToString(value any) string + func Trim(str string, characterMask ...string) string + func TruncRound(x float64, n int) float64 + func Typeof(a any) reflect.Type + func UUIdV4() (string, error) + func UnZip(zipFile string, destPath string) error + func Unicode2utf8(str string) string + func Union(slices ...[]T) []T + func Uniq(collection []T) []T + func Uniqid(prefix string) string + func Unix2Time(t int64) time.Time + func Utf2Gbk(str string) string + func Utf82unicode(str string) string + func Values(in map[K]V) []V + func WriteCsvFile(filepath string, records [][]string, append bool) error + func WriteFile(filepath string, content string, append bool) error + func Zip(path string, destPath string) error + func ZipAppendEntry(fpath string, destPath string) error + type Complex interface + type Decoder struct + func (d *Decoder) Bytes(b []byte) ([]byte, error) + func (d *Decoder) Reader(r io.Reader) io.Reader + func (d *Decoder) String(s string) (string, error) + type Encoder struct + func HTMLEscapeUnsupported(e *Encoder) *Encoder + func ReplaceUnsupported(e *Encoder) *Encoder + func (e *Encoder) Bytes(b []byte) ([]byte, error) + func (e *Encoder) String(s string) (string, error) + func (e *Encoder) Writer(w io.Writer) io.Writer + type Encoding interface + NewDecoder func() *Decoder + NewEncoder func() *Encoder + var GBK Encoding = &gbk + var Replacement Encoding = replacement{} + type Encoding1 struct + MIB MIB + Name string + func (e *Encoding1) ID() (mib MIB, other string) + func (e *Encoding1) String() string + type Float interface + type FuncEncoding struct + Decoder func() Transformer + Encoder func() Transformer + func (e FuncEncoding) NewDecoder() *Decoder + func (e FuncEncoding) NewEncoder() *Encoder + type Integer interface + type Interface interface + ID func() (mib MIB, other string) + type MIB uint16 + const Unofficial + type NopResetter struct + func (NopResetter) Reset() + type Ordered interface + type Reader struct + func NewReader(r io.Reader, t Transformer) *Reader + func (r *Reader) Read(p []byte) (int, error) + type RepertoireError byte + func (r RepertoireError) Error() string + func (r RepertoireError) Replacement() byte + type Signed interface + type SimpleEncoding struct + Decoder Transformer + Encoder Transformer + func (e *SimpleEncoding) NewDecoder() *Decoder + func (e *SimpleEncoding) NewEncoder() *Encoder + type SpanningTransformer interface + Span func(src []byte, atEOF bool) (n int, err error) + type Transformer interface + Reset func() + Transform func(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) + func Chain(t ...Transformer) Transformer + func RemoveFunc(f func(r rune) bool) Transformer + type Unsigned interface + type Writer struct + func NewWriter(w io.Writer, t Transformer) *Writer + func (w *Writer) Close() error + func (w *Writer) Write(data []byte) (n int, err error) Incompatible versions in this module v2.0.1+incompatible Sep 23, 2023