Documentation ¶
Index ¶
- type Formatter
- func (this *Formatter) CheckJson(val bool) *Pattern
- func (this *Formatter) Exclude(path ...string) *Pattern
- func (this *Formatter) FindAllExprIndex(s string) [][]int
- func (this *Formatter) Format(expr string, provider ValueProvider) (string, error)
- func (this *Formatter) GetPattern() string
- func (this *Formatter) IsSimpleExpr(s string) bool
- func (this *Formatter) SetPattern(pattern string) error
- type Options
- type Pattern
- type ValueProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
func (*Formatter) FindAllExprIndex ¶
获取所有变量表达式的起止位置。
func (*Formatter) Format ¶
func (this *Formatter) Format(expr string, provider ValueProvider) (string, error)
替换 expr 中的表达式
func (*Formatter) GetPattern ¶
func (*Formatter) IsSimpleExpr ¶
判断指定的字符串是否是一个简单表达式(包含且只包含一个变量表达式) 例:
'$obj.name' 是一个简单表达式,因为整体个字符串都是变量表达式。 'abc{$obj.name}' 不是简单表达式,因为除了变量表达式之外,还包含了一个 abc 前缀。
func (*Formatter) SetPattern ¶
type ValueProvider ¶
Click to show internal directories.
Click to hide internal directories.