Documentation ¶
Index ¶
- Variables
- type Rand
- func (r *Rand) B(n int) []byte
- func (r *Rand) D(min, max time.Duration) time.Duration
- func (r *Rand) GetDigits(n int) string
- func (r *Rand) GetLetters(n int) string
- func (r *Rand) GetString(s string, n int) string
- func (r *Rand) GetSymbols(n int) string
- func (r *Rand) Intn(max int) int
- func (r *Rand) Meet(num, total int) bool
- func (r *Rand) MeetProb(prob float32) bool
- func (r *Rand) N(min, max int) int
- func (r *Rand) Perm(n int) []int
- func (r *Rand) S(n int, symbols ...bool) string
- type Str
- type TerminalLog
- type Transfer
- func (r *Transfer) BabelToPascal() string
- func (r *Transfer) BabelToSnake() string
- func (r *Transfer) CamelToBabel() string
- func (r *Transfer) CamelToPascal() string
- func (r *Transfer) CamelToSnake() string
- func (r *Transfer) KebabToCamel() string
- func (r *Transfer) PascalToBabel() string
- func (r *Transfer) PascalToCamel() string
- func (r *Transfer) PascalToSnake() string
- func (r *Transfer) Pluralize() string
- func (r *Transfer) SnakeToBabel() string
- func (r *Transfer) SnakeToCamel() string
- func (r *Transfer) SnakeToPascal() string
Constants ¶
This section is empty.
Variables ¶
var ( Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // 52 UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // 26 LowerLetters = "abcdefghijklmnopqrstuvwxyz" // 26 Symbols = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" // 32 Digits = "0123456789" // 10 )
Functions ¶
This section is empty.
Types ¶
type Rand ¶ added in v2.19.0
type Rand struct {
// contains filtered or unexported fields
}
func (*Rand) GetDigits ¶ added in v2.19.0
GetDigits returns a random str which contains only digits, and its length is `n`.
func (*Rand) GetLetters ¶ added in v2.19.0
GetLetters returns a random str which contains only letters, and its length is `n`.
func (*Rand) GetString ¶ added in v2.19.0
GetString randomly picks and returns `n` count of chars from given str `s`. It also supports unicode str like Chinese/Russian/Japanese, etc.
func (*Rand) GetSymbols ¶ added in v2.19.0
GetSymbols returns a random str which contains only symbols, and its length is `n`.
func (*Rand) Meet ¶ added in v2.19.0
Meet randomly calculate whether the given probability `num`/`total` is met.
func (*Rand) MeetProb ¶ added in v2.19.0
MeetProb randomly calculate whether the given probability is met.
func (*Rand) N ¶ added in v2.19.0
N returns a random int between min and max: [min, max]. The `min` and `max` also support negative numbers.
type TerminalLog ¶ added in v2.18.0
type TerminalLog struct {
// contains filtered or unexported fields
}
func NewTerminalLog ¶ added in v2.18.0
func NewTerminalLog(format string) *TerminalLog
NewTerminalLog 实例化:控制台日志
type Transfer ¶ added in v2.18.0
type Transfer struct {
// contains filtered or unexported fields
}
func NewTransfer ¶ added in v2.18.0
func (*Transfer) BabelToPascal ¶ added in v2.18.0
BabelToPascal babel -> 大驼峰
func (*Transfer) BabelToSnake ¶ added in v2.18.0
BabelToSnake babel -> 下划线
func (*Transfer) CamelToBabel ¶ added in v2.18.0
CamelToSnake 小驼峰 -> babel
func (*Transfer) CamelToPascal ¶ added in v2.18.0
CamelToPascal 小驼峰 -> 大驼峰
func (*Transfer) CamelToSnake ¶ added in v2.18.0
CamelToSnake 小驼峰 -> 下划线
func (*Transfer) KebabToCamel ¶ added in v2.18.0
KebabToCamel babel -> 小驼峰
func (*Transfer) PascalToBabel ¶ added in v2.18.0
PascalToSnake 大驼峰 -> babel
func (*Transfer) PascalToCamel ¶ added in v2.18.0
PascalToCamel 大驼峰 -> 小驼峰
func (*Transfer) PascalToSnake ¶ added in v2.18.0
PascalToSnake 大驼峰 -> 下划线
func (*Transfer) SnakeToBabel ¶ added in v2.18.0
SnakeToBabel 下划线 -> babel
func (*Transfer) SnakeToCamel ¶ added in v2.18.0
SnakeToPascal 下划线 -> 小驼峰
func (*Transfer) SnakeToPascal ¶ added in v2.18.0
SnakeToPascal 下划线 -> 大驼峰