Documentation ¶
Overview ¶
Package jsondiff ...
Index ¶
- Constants
- type AbsentValue
- type Comparator
- type Config
- func (c *Config) IgnoreArrayOrder() *Config
- func (c *Config) IgnoreExtraItems() *Config
- func (c *Config) IgnorePath() *Config
- func (c *Config) IgnoreValue() *Config
- func (c *Config) Match(path string) MatchResult
- func (c *Config) SetComparator(comparator Comparator) *Config
- func (c *Config) TreatNullAsAbsent() *Config
- func (c *Config) UnquoteExpand() *Config
- type DiffItem
- type DiffResult
- type MatchResult
- type Strategy
- type UnquoteString
Constants ¶
View Source
const ( IgnorePath = Strategy(1 << 0) // 忽略匹配路径 IgnoreValue = Strategy(1 << 1) // 忽略路径的值 IgnoreArrayOrder = Strategy(1 << 2) // 忽略元素的顺序 IgnoreExtraItems = Strategy(1 << 3) // 忽略多余的元素 TreatNullAsAbsent = Strategy(1 << 4) // 将 null 视为字段缺失 UnquoteExpand = Strategy(1 << 5) // 解析引号里面的内容 )
View Source
const ( MatchNone = MatchResult(0) // 匹配失败 MatchPrefix = MatchResult(1) // 前缀匹配 MatchFull = MatchResult(2) // 全部匹配 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbsentValue ¶
type AbsentValue string
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) IgnoreArrayOrder ¶
func (*Config) IgnoreExtraItems ¶
func (*Config) IgnorePath ¶
func (*Config) IgnoreValue ¶
func (*Config) Match ¶
func (c *Config) Match(path string) MatchResult
func (*Config) SetComparator ¶
func (c *Config) SetComparator(comparator Comparator) *Config
func (*Config) TreatNullAsAbsent ¶
func (*Config) UnquoteExpand ¶
type DiffResult ¶
type DiffResult struct { Differs map[string]DiffItem Ignores map[string]DiffItem Equals map[string]DiffItem }
func Diff ¶
func Diff(a, b string, configs ...*Config) *DiffResult
Diff 比较 a,b 两个 JSON 字符串,返回它们异同之处。
type UnquoteString ¶
type UnquoteString string
Click to show internal directories.
Click to hide internal directories.