Documentation
¶
Index ¶
- Variables
- func NewTemplate[T any](title, content string, s T) (string, error)
- type AttrHtmlA
- type AttrHtmlAny
- type AttrHtmlBr
- type AttrHtmlNormal
- type AttrHtmlP
- type AttrHtmlTBody
- type AttrHtmlTHead
- type AttrHtmlTable
- type AttrHtmlTd
- type AttrHtmlTh
- type AttrHtmlTr
- type AttrHtmlUl
- type AttrMarkdownA
- type AttrMarkdownBr
- type AttrMarkdownNormal
- type AttrMarkdownOl
- type AttrMarkdownUl
- type AttrRegexpTargetError
- type AttrRegexpTargetString
- type AttrRegexpTargetsError
- type AttrRegexpTargetsString
- type Buffer
- func (my Buffer) Any(values ...any) Buffer
- func (my Buffer) B(values ...byte) Buffer
- func (my Buffer) Bytes() []byte
- func (my Buffer) Copy() Buffer
- func (Buffer) JoinAny(values ...any) string
- func (Buffer) JoinAnyLimit(limit string, values ...any) string
- func (Buffer) JoinString(strings ...string) string
- func (Buffer) JoinStringLimit(limit string, strings ...string) string
- func (Buffer) NewAny(data ...any) Buffer
- func (Buffer) NewBytes(original []byte) Buffer
- func (Buffer) NewRune(data ...rune) Buffer
- func (Buffer) NewString(data ...string) Buffer
- func (my Buffer) Ptr() *string
- func (my Buffer) R(values ...rune) Buffer
- func (my Buffer) S(values ...string) Buffer
- func (my Buffer) Sha256Sum256() string
- func (my Buffer) String() string
- func (my Buffer) URLPath(values ...string) Buffer
- func (my Buffer) URLQuery(values ...string) Buffer
- func (my Buffer) WhenB(condition bool, values ...byte) Buffer
- func (my Buffer) WhenR(condition bool, values ...rune) Buffer
- func (my Buffer) WhenS(condition bool, values ...string) Buffer
- type HTML
- type HtmlAttributer
- type HtmlProperty
- type Markdown
- type MarkdownAttributer
- type Rand
- func (my *Rand) B(n int) []byte
- func (my *Rand) D(min, max time.Duration) time.Duration
- func (my *Rand) GetDigits(n int) string
- func (my *Rand) GetLetters(n int) string
- func (my *Rand) GetString(s string, n int) string
- func (my *Rand) GetSymbols(n int) string
- func (my *Rand) Intn(max int) int
- func (my *Rand) Meet(num, total int) bool
- func (my *Rand) MeetProb(prob float32) bool
- func (my *Rand) N(min, max int) int
- func (*Rand) New() *Rand
- func (my *Rand) Perm(n int) []int
- func (my *Rand) S(n int, symbols ...bool) string
- type Regexp
- func (my Regexp) Contains() bool
- func (my Regexp) ContainsAll() bool
- func (my Regexp) MatchAll() []string
- func (my Regexp) MatchFirst() string
- func (Regexp) New(original string, attrs ...RegexpRegexpAttributer) Regexp
- func (my Regexp) ReplaceAllString(replace string) string
- func (my Regexp) Set(attrs ...RegexpRegexpAttributer) Regexp
- type RegexpRegexpAttributer
- type Str
- func (*Str) New(original string) *Str
- func (my *Str) PadLeft(length int, s string) string
- func (my *Str) PadLeftZeros(length int) (string, error)
- func (my *Str) PadRight(length int, s string) string
- func (my *Str) PadRightZeros(length int) (string, error)
- func (my *Str) ToLong(length int, ends ...string) string
- type Template
- type TerminalLog
- type TerminalLogColor
- type Transfer
- func (my *Transfer) BabelToPascal() string
- func (my *Transfer) BabelToSnake() string
- func (my *Transfer) CamelToBabel() string
- func (my *Transfer) CamelToPascal() string
- func (my *Transfer) CamelToSnake() string
- func (my *Transfer) KebabToCamel() string
- func (*Transfer) New(original string) *Transfer
- func (my *Transfer) PascalToBabel() string
- func (my *Transfer) PascalToCamel() string
- func (my *Transfer) PascalToSnake() string
- func (my *Transfer) Pluralize() string
- func (my *Transfer) SnakeToBabel() string
- func (my *Transfer) SnakeToCamel() string
- func (my *Transfer) SnakeToPascal() string
Constants ¶
This section is empty.
Variables ¶
var ( Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // 52 UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // 26 LowerLetters = "abcdefghijklmnopqrstuvwxyz" // 26 Symbols = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~" // 32 Digits = "0123456789" // 10 RandApp Rand )
var ( StrApp Str TerminalLogApp TerminalLog )
var APP struct { Buffer Buffer Rand Rand Regexp Regexp TerminalLog TerminalLog Str Str Transfer Transfer HTML HTML Markdown Markdown }
Functions ¶
Types ¶
type AttrHtmlA ¶
type AttrHtmlA struct {
// contains filtered or unexported fields
}
func HtmlA ¶
func HtmlA(name, href string, properties ...HtmlProperty) AttrHtmlA
type AttrHtmlAny ¶
type AttrHtmlAny struct {
// contains filtered or unexported fields
}
func HtmlAny ¶
func HtmlAny(tag, content string) AttrHtmlAny
func (AttrHtmlAny) AppendProperties ¶
func (my AttrHtmlAny) AppendProperties(properties ...HtmlProperty) AttrHtmlAny
func (AttrHtmlAny) Register ¶
func (my AttrHtmlAny) Register(html *HTML)
type AttrHtmlBr ¶
type AttrHtmlBr struct {
// contains filtered or unexported fields
}
func HtmlBr ¶
func HtmlBr() AttrHtmlBr
func (AttrHtmlBr) Register ¶
func (my AttrHtmlBr) Register(html *HTML)
type AttrHtmlNormal ¶
type AttrHtmlNormal struct {
// contains filtered or unexported fields
}
func HtmlNormal ¶
func HtmlNormal(content string) AttrHtmlNormal
func (AttrHtmlNormal) Register ¶
func (my AttrHtmlNormal) Register(html *HTML)
type AttrHtmlTBody ¶
type AttrHtmlTBody struct {
// contains filtered or unexported fields
}
func HtmlTBody ¶
func HtmlTBody(options ...HtmlAttributer) AttrHtmlTBody
func (AttrHtmlTBody) AppendProperties ¶
func (my AttrHtmlTBody) AppendProperties(properties ...HtmlProperty) AttrHtmlTBody
func (AttrHtmlTBody) Register ¶
func (my AttrHtmlTBody) Register(html *HTML)
type AttrHtmlTHead ¶
type AttrHtmlTHead struct {
// contains filtered or unexported fields
}
func HtmlTHead ¶
func HtmlTHead(options ...HtmlAttributer) AttrHtmlTHead
func (AttrHtmlTHead) AppendProperties ¶
func (my AttrHtmlTHead) AppendProperties(properties ...HtmlProperty) AttrHtmlTHead
func (AttrHtmlTHead) Register ¶
func (my AttrHtmlTHead) Register(html *HTML)
type AttrHtmlTable ¶
type AttrHtmlTable struct {
// contains filtered or unexported fields
}
func HtmlTable ¶
func HtmlTable(options ...HtmlAttributer) AttrHtmlTable
func (AttrHtmlTable) AppendProperties ¶
func (my AttrHtmlTable) AppendProperties(properties ...HtmlProperty) AttrHtmlTable
func (AttrHtmlTable) Register ¶
func (my AttrHtmlTable) Register(html *HTML)
type AttrHtmlTd ¶
type AttrHtmlTd struct {
// contains filtered or unexported fields
}
func HtmlTd ¶
func HtmlTd(content string) AttrHtmlTd
func (AttrHtmlTd) AppendProperties ¶
func (my AttrHtmlTd) AppendProperties(properties ...HtmlProperty) AttrHtmlTd
func (AttrHtmlTd) Register ¶
func (my AttrHtmlTd) Register(html *HTML)
type AttrHtmlTh ¶
type AttrHtmlTh struct {
// contains filtered or unexported fields
}
func HtmlTh ¶
func HtmlTh(content string) AttrHtmlTh
func (AttrHtmlTh) AppendProperties ¶
func (my AttrHtmlTh) AppendProperties(properties ...HtmlProperty) AttrHtmlTh
func (AttrHtmlTh) Register ¶
func (my AttrHtmlTh) Register(html *HTML)
type AttrHtmlTr ¶
type AttrHtmlTr struct {
// contains filtered or unexported fields
}
func HtmlTr ¶
func HtmlTr(options ...HtmlAttributer) AttrHtmlTr
func (AttrHtmlTr) AppendProperties ¶
func (my AttrHtmlTr) AppendProperties(properties ...HtmlProperty) AttrHtmlTr
func (AttrHtmlTr) Register ¶
func (my AttrHtmlTr) Register(html *HTML)
type AttrHtmlUl ¶
type AttrHtmlUl struct {
// contains filtered or unexported fields
}
func HtmlUl ¶
func HtmlUl(contents ...string) AttrHtmlUl
func (AttrHtmlUl) Register ¶
func (my AttrHtmlUl) Register(html *HTML)
type AttrMarkdownA ¶
type AttrMarkdownA struct {
// contains filtered or unexported fields
}
func MarkdownA ¶
func MarkdownA(name, href string) AttrMarkdownA
func (AttrMarkdownA) Register ¶
func (my AttrMarkdownA) Register(markdown *Markdown)
type AttrMarkdownBr ¶
type AttrMarkdownBr struct{}
func MarkdownBr ¶
func MarkdownBr() AttrMarkdownBr
func (AttrMarkdownBr) Register ¶
func (AttrMarkdownBr) Register(markdown *Markdown)
type AttrMarkdownNormal ¶
type AttrMarkdownNormal struct {
// contains filtered or unexported fields
}
func MarkdownNormal ¶
func MarkdownNormal(content string) AttrMarkdownNormal
func (AttrMarkdownNormal) Register ¶
func (my AttrMarkdownNormal) Register(markdown *Markdown)
type AttrMarkdownOl ¶
type AttrMarkdownOl struct {
// contains filtered or unexported fields
}
func MarkdownOl ¶
func MarkdownOl(contents ...string) AttrMarkdownOl
func (AttrMarkdownOl) Append ¶
func (my AttrMarkdownOl) Append(contents ...string) AttrMarkdownOl
func (AttrMarkdownOl) Register ¶
func (my AttrMarkdownOl) Register(markdown *Markdown)
type AttrMarkdownUl ¶
type AttrMarkdownUl struct {
// contains filtered or unexported fields
}
func MarkdownUl ¶
func MarkdownUl(contents ...string) AttrMarkdownUl
func (AttrMarkdownUl) Append ¶
func (my AttrMarkdownUl) Append(contents ...string) AttrMarkdownUl
func (AttrMarkdownUl) Register ¶
func (my AttrMarkdownUl) Register(markdown *Markdown)
type AttrRegexpTargetError ¶
type AttrRegexpTargetError struct {
// contains filtered or unexported fields
}
func RegexpTargetError ¶
func RegexpTargetError(target error) AttrRegexpTargetError
func (AttrRegexpTargetError) Register ¶
func (my AttrRegexpTargetError) Register(regexp *Regexp)
type AttrRegexpTargetString ¶
type AttrRegexpTargetString struct {
// contains filtered or unexported fields
}
func RegexpTargetString ¶
func RegexpTargetString(target string) AttrRegexpTargetString
func (AttrRegexpTargetString) Register ¶
func (my AttrRegexpTargetString) Register(regexp *Regexp)
type AttrRegexpTargetsError ¶
type AttrRegexpTargetsError struct {
// contains filtered or unexported fields
}
func RegexpTargetsError ¶
func RegexpTargetsError(targets ...error) AttrRegexpTargetsError
func (AttrRegexpTargetsError) Register ¶
func (my AttrRegexpTargetsError) Register(regexp *Regexp)
type AttrRegexpTargetsString ¶
type AttrRegexpTargetsString struct {
// contains filtered or unexported fields
}
func RegexpTargetsString ¶
func RegexpTargetsString(targets ...string) AttrRegexpTargetsString
func (AttrRegexpTargetsString) Register ¶
func (my AttrRegexpTargetsString) Register(regexp *Regexp)
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func (Buffer) JoinString ¶
func (Buffer) JoinStringLimit ¶
func (Buffer) Sha256Sum256 ¶
type HTML ¶ added in v1.53.5
type HTML struct {
// contains filtered or unexported fields
}
func (HTML) New ¶ added in v1.53.5
func (HTML) New(options ...HtmlAttributer) HTML
func (HTML) NewString ¶ added in v1.53.5
func (HTML) NewString(options ...HtmlAttributer) string
func (HTML) Set ¶ added in v1.53.5
func (my HTML) Set(options ...HtmlAttributer) HTML
type HtmlAttributer ¶
type HtmlAttributer interface{ Register(html *HTML) }
type HtmlProperty ¶
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
func (Markdown) New ¶
func (Markdown) New(options ...MarkdownAttributer) Markdown
func (Markdown) NewString ¶
func (Markdown) NewString(options ...MarkdownAttributer) string
func (Markdown) Set ¶
func (my Markdown) Set(options ...MarkdownAttributer) Markdown
type MarkdownAttributer ¶
type MarkdownAttributer interface {
Register(markdown *Markdown)
}
type Rand ¶
type Rand struct {
// contains filtered or unexported fields
}
func (*Rand) GetDigits ¶
GetDigits returns a random str which contains only digits, and its length is `n`.
func (*Rand) GetLetters ¶
GetLetters returns a random str which contains only letters, and its length is `n`.
func (*Rand) GetString ¶
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 ¶
GetSymbols returns a random str which contains only symbols, and its length is `n`.
func (*Rand) N ¶
N returns a random int between min and max: [min, max]. The `min` and `max` also support negative numbers.
type Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
var (
RegexpApp Regexp
)
func (Regexp) ReplaceAllString ¶
ReplaceAllString 替换所有匹配项
func (Regexp) Set ¶
func (my Regexp) Set(attrs ...RegexpRegexpAttributer) Regexp
type RegexpRegexpAttributer ¶
type RegexpRegexpAttributer interface{ Register(regexp *Regexp) }
type Str ¶
type Str struct {
// contains filtered or unexported fields
}
func (*Str) PadLeftZeros ¶
PadLeftZeros 前置补零
func (*Str) PadRightZeros ¶
PadRightZeros 后置补零
type TerminalLog ¶
type TerminalLog struct {
// contains filtered or unexported fields
}
type TerminalLogColor ¶
type TerminalLogColor string
const ( TerminalLogColorBlack TerminalLogColor = "\033[30m" TerminalLogColorRed TerminalLogColor = "\033[31m" TerminalLogColorGreen TerminalLogColor = "\033[32m" TerminalLogColorYellow TerminalLogColor = "\033[33m" TerminalLogColorBlue TerminalLogColor = "\033[34m" TerminalLogColorMagenta TerminalLogColor = "\033[35m" TerminalLogColorCyan TerminalLogColor = "\033[36m" TerminalLogColorWhite TerminalLogColor = "\033[37m" TerminalLogColorReset TerminalLogColor = "\033[0m" )
type Transfer ¶
type Transfer struct {
// contains filtered or unexported fields
}
var TransferApp Transfer
func (*Transfer) BabelToPascal ¶
BabelToPascal babel -> 大驼峰
func (*Transfer) CamelToPascal ¶
CamelToPascal 小驼峰 -> 大驼峰
func (*Transfer) PascalToBabel ¶
PascalToBabel 大驼峰 -> babel
func (*Transfer) PascalToCamel ¶
PascalToCamel 大驼峰 -> 小驼峰
func (*Transfer) PascalToSnake ¶
PascalToSnake 大驼峰 -> 下划线
func (*Transfer) SnakeToPascal ¶
SnakeToPascal 下划线 -> 大驼峰