Documentation
¶
Index ¶
- Variables
- func Batch(errs ...error) error
- type Str
- func (self *Str) Base64RawStdDecode(customError ...string) StrType
- func (self *Str) Base64RawStdEncode() StrType
- func (self *Str) Base64RawURLDecode(customError ...string) StrType
- func (self *Str) Base64RawURLEncode() StrType
- func (self *Str) Base64StdDecode(customError ...string) StrType
- func (self *Str) Base64StdEncode() StrType
- func (self *Str) Base64URLDecode(customError ...string) StrType
- func (self *Str) Base64URLEncode() StrType
- func (self *Str) Bool() (bool, error)
- func (self *Str) CamelCaseToSnakeCase() StrType
- func (self *Str) DefaultBool(def bool) bool
- func (self *Str) DefaultFloat32(def float32) float32
- func (self *Str) DefaultFloat64(def float64) float64
- func (self *Str) DefaultInt(def int) int
- func (self *Str) DefaultInt16(def int16) int16
- func (self *Str) DefaultInt32(def int32) int32
- func (self *Str) DefaultInt64(def int64) int64
- func (self *Str) DefaultInt8(def int8) int8
- func (self *Str) DefaultSliceBool(sep string, def []bool) []bool
- func (self *Str) DefaultSliceFloat32(sep string, def []float32) []float32
- func (self *Str) DefaultSliceFloat64(sep string, def []float64) []float64
- func (self *Str) DefaultSliceInt(sep string, def []int) []int
- func (self *Str) DefaultSliceInt16(sep string, def []int16) []int16
- func (self *Str) DefaultSliceInt32(sep string, def []int32) []int32
- func (self *Str) DefaultSliceInt64(sep string, def []int64) []int64
- func (self *Str) DefaultSliceInt8(sep string, def []int8) []int8
- func (self *Str) DefaultSliceString(sep string, def []string) []string
- func (self *Str) DefaultSliceUint(sep string, def []uint) []uint
- func (self *Str) DefaultSliceUint16(sep string, def []uint16) []uint16
- func (self *Str) DefaultSliceUint32(sep string, def []uint32) []uint32
- func (self *Str) DefaultSliceUint64(sep string, def []uint64) []uint64
- func (self *Str) DefaultSliceUint8(sep string, def []uint8) []uint8
- func (self *Str) DefaultString(def string) string
- func (self *Str) DefaultUint(def uint) uint
- func (self *Str) DefaultUint16(def uint16) uint16
- func (self *Str) DefaultUint32(def uint32) uint32
- func (self *Str) DefaultUint64(def uint64) uint64
- func (self *Str) DefaultUint8(def uint8) uint8
- func (self *Str) DenyFloat32(f []float32, customError ...string) StrType
- func (self *Str) DenyFloat64(f []float64, customError ...string) StrType
- func (self *Str) DenyInt(i []int, customError ...string) StrType
- func (self *Str) DenyInt16(i []int16, customError ...string) StrType
- func (self *Str) DenyInt32(i []int32, customError ...string) StrType
- func (self *Str) DenyInt64(i []int64, customError ...string) StrType
- func (self *Str) DenyInt8(i []int8, customError ...string) StrType
- func (self *Str) DenyString(slice []string, customError ...string) StrType
- func (self *Str) EnumFloat32(f []float32, customError ...string) StrType
- func (self *Str) EnumFloat64(f []float64, customError ...string) StrType
- func (self *Str) EnumInt(i []int, customError ...string) StrType
- func (self *Str) EnumInt16(i []int16, customError ...string) StrType
- func (self *Str) EnumInt32(i []int32, customError ...string) StrType
- func (self *Str) EnumInt64(i []int64, customError ...string) StrType
- func (self *Str) EnumInt8(i []int8, customError ...string) StrType
- func (self *Str) EnumSliceInt(sep string, slice []int, customError ...string) StrType
- func (self *Str) EnumSliceString(sep string, slice []string, customError ...string) StrType
- func (self *Str) EnumString(slice []string, customError ...string) StrType
- func (self *Str) Equal(str string, customError ...string) StrType
- func (self *Str) Error() error
- func (self *Str) Float32() (float32, error)
- func (self *Str) Float64() (float64, error)
- func (self *Str) HTMLEscape() StrType
- func (self *Str) HTMLUnescape() StrType
- func (self *Str) HasDigit(customError ...string) StrType
- func (self *Str) HasLetter(customError ...string) StrType
- func (self *Str) HasLower(customError ...string) StrType
- func (self *Str) HasPrefix(sub string, customError ...string) StrType
- func (self *Str) HasString(sub string, customError ...string) StrType
- func (self *Str) HasSuffix(sub string, customError ...string) StrType
- func (self *Str) HasSymbol(customError ...string) StrType
- func (self *Str) HasUpper(customError ...string) StrType
- func (self *Str) Int() (int, error)
- func (self *Str) Int16() (int16, error)
- func (self *Str) Int32() (int32, error)
- func (self *Str) Int64() (int64, error)
- func (self *Str) Int8() (int8, error)
- func (self *Str) IsBool(customError ...string) StrType
- func (self *Str) IsChinaIDNumber(customError ...string) StrType
- func (self *Str) IsChinaMobile(customError ...string) StrType
- func (self *Str) IsChinaTel(customError ...string) StrType
- func (self *Str) IsChinese(customError ...string) StrType
- func (self *Str) IsDigit(customError ...string) StrType
- func (self *Str) IsIP(customError ...string) StrType
- func (self *Str) IsJSON(customError ...string) StrType
- func (self *Str) IsLetter(customError ...string) StrType
- func (self *Str) IsLetterOrDigit(customError ...string) StrType
- func (self *Str) IsLower(customError ...string) StrType
- func (self *Str) IsLowerOrDigit(customError ...string) StrType
- func (self *Str) IsMAC(customError ...string) StrType
- func (self *Str) IsMail(customError ...string) StrType
- func (self *Str) IsSQLObject(customError ...string) StrType
- func (self *Str) IsSQLObjects(sep string, customError ...string) StrType
- func (self *Str) IsTCPAddr(customError ...string) StrType
- func (self *Str) IsURL(customError ...string) StrType
- func (self *Str) IsUUID(customError ...string) StrType
- func (self *Str) IsUpper(customError ...string) StrType
- func (self *Str) IsUpperOrDigit(customError ...string) StrType
- func (self *Str) JoinByte(values ...byte) StrType
- func (self *Str) JoinBytes(values ...[]byte) StrType
- func (self *Str) JoinRune(values ...rune) StrType
- func (self *Str) JoinStr(values ...string) StrType
- func (self *Str) MaxFloat(max float64, customError ...string) StrType
- func (self *Str) MaxInteger(max int64, customError ...string) StrType
- func (self *Str) MaxLength(max int, customError ...string) StrType
- func (self *Str) MaxUTF8Length(max int, customError ...string) StrType
- func (self *Str) MinFloat(min float64, customError ...string) StrType
- func (self *Str) MinInteger(min int64, customError ...string) StrType
- func (self *Str) MinLength(min int, customError ...string) StrType
- func (self *Str) MinUTF8Length(min int, customError ...string) StrType
- func (self *Str) RemoveSpace() StrType
- func (self *Str) Require(customError ...string) StrType
- func (self *Str) Set(target interface{}, customError ...string) error
- func (self *Str) SetSlice(target interface{}, sep string, customError ...string) error
- func (self *Str) SliceBool(sep string) (result []bool, err error)
- func (self *Str) SliceFloat32(sep string) (result []float32, err error)
- func (self *Str) SliceFloat64(sep string) (result []float64, err error)
- func (self *Str) SliceInt(sep string) (result []int, err error)
- func (self *Str) SliceInt16(sep string) (result []int16, err error)
- func (self *Str) SliceInt32(sep string) (result []int32, err error)
- func (self *Str) SliceInt64(sep string) (result []int64, err error)
- func (self *Str) SliceInt8(sep string) (result []int8, err error)
- func (self *Str) SliceString(sep string) ([]string, error)
- func (self *Str) SliceUint(sep string) (result []uint, err error)
- func (self *Str) SliceUint16(sep string) (result []uint16, err error)
- func (self *Str) SliceUint32(sep string) (result []uint32, err error)
- func (self *Str) SliceUint64(sep string) (result []uint64, err error)
- func (self *Str) SliceUint8(sep string) (result []uint8, err error)
- func (self *Str) SnakeCaseToCamelCase() StrType
- func (self *Str) SnakeCaseToPascalCase() StrType
- func (self *Str) String() (string, error)
- func (self *Str) ToLower() StrType
- func (self *Str) ToUpper() StrType
- func (self *Str) Trim(sub string) StrType
- func (self *Str) TrimLeft(sub string) StrType
- func (self *Str) TrimPrefix(sub string) StrType
- func (self *Str) TrimRight(sub string) StrType
- func (self *Str) TrimSpace() StrType
- func (self *Str) TrimSuffix(sub string) StrType
- func (self *Str) URLPathEscape() StrType
- func (self *Str) URLPathUnescape(customError ...string) StrType
- func (self *Str) URLQueryEscape() StrType
- func (self *Str) URLQueryUnescape(customError ...string) StrType
- func (self *Str) Uint() (uint, error)
- func (self *Str) Uint16() (uint16, error)
- func (self *Str) Uint32() (uint32, error)
- func (self *Str) Uint64() (uint64, error)
- func (self *Str) Uint8() (uint8, error)
- type StrType
Constants ¶
This section is empty.
Variables ¶
var DefaultErrorText = "数据处理失败"
默认的错误文本
Functions ¶
Types ¶
type Str ¶
type Str struct {
// contains filtered or unexported fields
}
func (*Str) Base64RawStdDecode ¶
base64 RawStd解码
func (*Str) Base64RawURLDecode ¶
base64 RawURL解码
func (*Str) Base64StdDecode ¶
base64 std解码
func (*Str) Base64URLDecode ¶
base64 URL解码
func (*Str) CamelCaseToSnakeCase ¶
CamelCaseToSnakeCase 驼峰(含帕斯卡)转蛇形 helloWorld/HelloWorld => hello_world
func (*Str) DefaultBool ¶
DefaultBool 转为bool类型,如果出错则只返回默认值
func (*Str) DefaultFloat32 ¶
DefaultFloat32 转为float32类型,如果出错则只返回默认值
func (*Str) DefaultFloat64 ¶
DefaultFloat64 转为float64类型,如果出错则只返回默认值
func (*Str) DefaultInt16 ¶
DefaultInt16 转为int16类型,如果出错则只返回默认值
func (*Str) DefaultInt32 ¶
DefaultInt32 转为int32类型,如果出错则只返回默认值
func (*Str) DefaultInt64 ¶
DefaultInt64 转为int64类型,如果出错则只返回默认值
func (*Str) DefaultInt8 ¶
DefaultInt8 转为int8类型,如果出错则只返回默认值
func (*Str) DefaultSliceBool ¶
DefaultSliceBool 转为[]bool类型
func (*Str) DefaultSliceFloat32 ¶
DefaultSliceFloat32 转为[]float32类型
func (*Str) DefaultSliceFloat64 ¶
DefaultSliceFloat64 转为[]float64类型
func (*Str) DefaultSliceInt ¶
DefaultSliceInt 转为[]int类型,出错则返回传入的默认值
func (*Str) DefaultSliceInt16 ¶
DefaultSliceInt16 转为[]int16类型
func (*Str) DefaultSliceInt32 ¶
DefaultSliceInt32 转为[]int8类型
func (*Str) DefaultSliceInt64 ¶
DefaultSliceInt64 转为[]int64类型,如果出错则只返回默认值
func (*Str) DefaultSliceInt8 ¶
DefaultSliceInt8 转为[]int8类型,如果出错则只返回默认值
func (*Str) DefaultSliceString ¶
DefaultSliceString 使用SetSeparator()设置的分隔符拆分成[]string类型,如果出错则只返回默认值
func (*Str) DefaultSliceUint ¶
DefaultSliceInt 转为[]int类型,出错则返回传入的默认值
func (*Str) DefaultSliceUint16 ¶
DefaultSliceUint16 转为[]uint16类型
func (*Str) DefaultSliceUint32 ¶
DefaultSliceUint32 转为[]uint8类型
func (*Str) DefaultSliceUint64 ¶
DefaultSliceUint64 转为[]uint64类型,如果出错则只返回默认值
func (*Str) DefaultSliceUint8 ¶
DefaultSliceUint8 转为[]uint8类型,如果出错则只返回默认值
func (*Str) DefaultString ¶
DefaultString 转为string类型,如果出错则只返回默认值
func (*Str) DefaultUint ¶
DefaultUint 转为uint类型,如果出错则只返回默认值
func (*Str) DefaultUint16 ¶
DefaultUint16 转为uint16类型,如果出错则只返回默认值
func (*Str) DefaultUint32 ¶
DefaultUint32 转为uint32类型,如果出错则只返回默认值
func (*Str) DefaultUint64 ¶
DefaultUint64 转为uint64类型,如果出错则只返回默认值
func (*Str) DefaultUint8 ¶
DefaultUint8 转为uint8类型,如果出错则只返回默认值
func (*Str) DenyFloat32 ¶
DenyFloat32 阻止[]float32中的值
func (*Str) DenyFloat64 ¶
DenyFloats64 阻止[]float64中的值
func (*Str) DenyString ¶
DenyString 阻止[]string中的值
func (*Str) EnumFloat32 ¶
EnumFloat32 仅允许[]float32中的值
func (*Str) EnumFloat64 ¶
EnumFloat64 仅允许[]float64中的值
func (*Str) EnumSliceInt ¶
EnumSliceInt 检查[]string中的元素,仅允许指潘秉衡[]int中的值
func (*Str) EnumSliceString ¶
EnumSliceString 检查[]string中的元素,仅允许指定[]string中的值
func (*Str) EnumString ¶
EnumString 仅允许[]string中的值
func (*Str) IsChinaIDNumber ¶
IsChinaIDNumber 中国身份证号码
func (*Str) IsChinaMobile ¶
nolint:gocyclo IsChinaMobile 中国手机号码
func (*Str) IsChinaTel ¶
IsChinaTel 中国固定电话号码
func (*Str) IsLetterOrDigit ¶
IsLetterOrDigit 字母或数字
func (*Str) IsLowerOrDigit ¶
IsLowerOrDigit 小写字母或数字
func (*Str) IsSQLObject ¶
IsSQLObject SQL对象(库名、表名、字段名)
func (*Str) IsSQLObjects ¶
IsSQLObjects SQL对象集合(库名、表名、字段名)
func (*Str) IsUpperOrDigit ¶
IsUpperOrDigit 大写字母或数字
func (*Str) MaxInteger ¶
MinInteger 最大整数值
func (*Str) MaxUTF8Length ¶
MaxUTF8Length UTF8编码最大长度
func (*Str) MinInteger ¶
MinInteger 最小整数值
func (*Str) MinUTF8Length ¶
MinUTF8Length UTF8编码最小长度
func (*Str) SliceFloat32 ¶
SliceFloat32 转为[]float32类型
func (*Str) SliceFloat64 ¶
SliceFloat64 转为[]float64类型
func (*Str) SliceInt16 ¶
SliceInt16 转为[]int16类型
func (*Str) SliceInt32 ¶
SliceInt32 转为[]int32类型
func (*Str) SliceInt64 ¶
SliceInt64 转为[]int64类型
func (*Str) SliceString ¶
SliceString 使用SetSeparator()设置的分隔符拆分成[]string类型
func (*Str) SliceUint16 ¶
SliceUint16 转为[]uint16类型
func (*Str) SliceUint32 ¶
SliceUint32 转为[]uint32类型
func (*Str) SliceUint64 ¶
SliceUint64 转为[]uint64类型
func (*Str) SliceUint8 ¶
SliceUint8 转为[]int8类型
func (*Str) SnakeCaseToCamelCase ¶
SnakeCaseToCamelCase 蛇形转驼峰: hello_world => helloWorld
func (*Str) SnakeCaseToPascalCase ¶
SnakeCaseToPascalCase 蛇形转帕斯卡: hello_world => HelloWorld
func (*Str) URLPathUnescape ¶
url.PathUnescape
func (*Str) URLQueryUnescape ¶
与url.QueryUnescape相同
type StrType ¶
type StrType interface { // 清理 Trim(string) StrType TrimSpace() StrType TrimLeft(string) StrType TrimRight(string) StrType TrimPrefix(string) StrType TrimSuffix(string) StrType RemoveSpace() StrType ToUpper() StrType ToLower() StrType SnakeCaseToCamelCase() StrType SnakeCaseToPascalCase() StrType CamelCaseToSnakeCase() StrType Base64StdEncode() StrType Base64StdDecode(...string) StrType Base64RawStdEncode() StrType Base64RawStdDecode(...string) StrType Base64URLEncode() StrType Base64URLDecode(...string) StrType Base64RawURLEncode() StrType Base64RawURLDecode(...string) StrType HTMLUnescape() StrType HTMLEscape() StrType URLPathUnescape(...string) StrType URLPathEscape() StrType URLQueryUnescape(...string) StrType URLQueryEscape() StrType JoinStr(...string) StrType JoinBytes(...[]byte) StrType JoinByte(...byte) StrType JoinRune(...rune) StrType // 校验 Require(...string) StrType Equal(string, ...string) StrType HasLetter(...string) StrType HasLower(...string) StrType HasUpper(...string) StrType HasDigit(...string) StrType HasSymbol(...string) StrType HasString(string, ...string) StrType HasPrefix(string, ...string) StrType HasSuffix(string, ...string) StrType IsBool(...string) StrType IsLower(...string) StrType IsUpper(...string) StrType IsLetter(...string) StrType IsDigit(...string) StrType IsLowerOrDigit(...string) StrType IsUpperOrDigit(...string) StrType IsLetterOrDigit(...string) StrType IsChinese(...string) StrType IsChinaTel(...string) StrType IsMail(...string) StrType IsIP(...string) StrType IsTCPAddr(...string) StrType IsMAC(...string) StrType IsJSON(...string) StrType IsChinaIDNumber(...string) StrType IsChinaMobile(...string) StrType IsSQLObject(...string) StrType IsSQLObjects(string, ...string) StrType IsURL(...string) StrType IsUUID(...string) StrType MinLength(int, ...string) StrType MinUTF8Length(int, ...string) StrType MaxLength(int, ...string) StrType MaxUTF8Length(int, ...string) StrType MinInteger(int64, ...string) StrType MaxInteger(int64, ...string) StrType MinFloat(float64, ...string) StrType MaxFloat(float64, ...string) StrType EnumString([]string, ...string) StrType EnumInt([]int, ...string) StrType EnumInt8([]int8, ...string) StrType EnumInt16([]int16, ...string) StrType EnumInt32([]int32, ...string) StrType EnumInt64([]int64, ...string) StrType EnumFloat32([]float32, ...string) StrType EnumFloat64([]float64, ...string) StrType EnumSliceString(string, []string, ...string) StrType EnumSliceInt(string, []int, ...string) StrType DenyString([]string, ...string) StrType DenyInt([]int, ...string) StrType DenyInt8([]int8, ...string) StrType DenyInt16([]int16, ...string) StrType DenyInt32([]int32, ...string) StrType DenyInt64([]int64, ...string) StrType DenyFloat32([]float32, ...string) StrType DenyFloat64([]float64, ...string) StrType // 输出 String() (string, error) DefaultString(string) string SliceString(string) ([]string, error) DefaultSliceString(string, []string) []string Int() (int, error) DefaultInt(int) int SliceInt(string) ([]int, error) DefaultSliceInt(string, []int) []int Uint() (uint, error) DefaultUint(uint) uint SliceUint(string) ([]uint, error) DefaultSliceUint(string, []uint) []uint Int8() (int8, error) DefaultInt8(int8) int8 SliceInt8(string) ([]int8, error) DefaultSliceInt8(string, []int8) []int8 Uint8() (uint8, error) DefaultUint8(uint8) uint8 SliceUint8(string) ([]uint8, error) DefaultSliceUint8(string, []uint8) []uint8 Int16() (int16, error) DefaultInt16(int16) int16 SliceInt16(string) ([]int16, error) DefaultSliceInt16(string, []int16) []int16 Uint16() (uint16, error) DefaultUint16(uint16) uint16 SliceUint16(string) ([]uint16, error) DefaultSliceUint16(string, []uint16) []uint16 Int32() (int32, error) DefaultInt32(int32) int32 SliceInt32(string) ([]int32, error) DefaultSliceInt32(string, []int32) []int32 Uint32() (uint32, error) DefaultUint32(uint32) uint32 SliceUint32(string) ([]uint32, error) DefaultSliceUint32(string, []uint32) []uint32 Int64() (int64, error) DefaultInt64(int64) int64 SliceInt64(string) ([]int64, error) DefaultSliceInt64(string, []int64) []int64 Uint64() (uint64, error) DefaultUint64(uint64) uint64 SliceUint64(string) ([]uint64, error) DefaultSliceUint64(string, []uint64) []uint64 Float32() (float32, error) DefaultFloat32(float32) float32 SliceFloat32(string) ([]float32, error) DefaultSliceFloat32(string, []float32) []float32 Float64() (float64, error) DefaultFloat64(float64) float64 SliceFloat64(string) ([]float64, error) DefaultSliceFloat64(string, []float64) []float64 Bool() (bool, error) DefaultBool(bool) bool SliceBool(string) ([]bool, error) DefaultSliceBool(string, []bool) []bool // 赋值到普通变量 Set(interface{}, ...string) error // 赋值到切片变量 SetSlice(interface{}, string, ...string) error // 结果 Error() error }