This commit is contained in:
parent
ed361c8e9e
commit
810583964c
6
go.mod
6
go.mod
@ -4,10 +4,10 @@ go 1.21
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/antchfx/xmlquery v1.3.18
|
github.com/antchfx/xmlquery v1.3.18
|
||||||
github.com/antchfx/xpath v1.2.4 // indirect
|
github.com/antchfx/xpath v1.2.5 // indirect
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
||||||
golang.org/x/net v0.15.0 // indirect
|
golang.org/x/net v0.20.0 // indirect
|
||||||
golang.org/x/text v0.13.0 // indirect
|
golang.org/x/text v0.14.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0
|
gopkg.in/ini.v1 v1.67.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
6
go.sum
6
go.sum
@ -9,6 +9,8 @@ github.com/antchfx/xpath v1.2.1/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwq
|
|||||||
github.com/antchfx/xpath v1.2.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
github.com/antchfx/xpath v1.2.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||||
github.com/antchfx/xpath v1.2.4 h1:dW1HB/JxKvGtJ9WyVGJ0sIoEcqftV3SqIstujI+B9XY=
|
github.com/antchfx/xpath v1.2.4 h1:dW1HB/JxKvGtJ9WyVGJ0sIoEcqftV3SqIstujI+B9XY=
|
||||||
github.com/antchfx/xpath v1.2.4/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
github.com/antchfx/xpath v1.2.4/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||||
|
github.com/antchfx/xpath v1.2.5 h1:hqZ+wtQ+KIOV/S3bGZcIhpgYC26um2bZYP2KVGcR7VY=
|
||||||
|
github.com/antchfx/xpath v1.2.5/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -40,6 +42,8 @@ golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
|||||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||||
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
|
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
|
||||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||||
|
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
|
||||||
|
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@ -67,6 +71,8 @@ golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
|||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
|
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||||
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
13
vendor/github.com/antchfx/xpath/README.md
generated
vendored
13
vendor/github.com/antchfx/xpath/README.md
generated
vendored
@ -49,7 +49,7 @@ Supported Features
|
|||||||
|
|
||||||
- `a/b` : For each node matching a, add the nodes matching b to the result.
|
- `a/b` : For each node matching a, add the nodes matching b to the result.
|
||||||
|
|
||||||
- `a//b` : For each node matching a, add the descendant nodes matching b to the result.
|
- `a//b` : For each node matching a, add the descendant nodes matching b to the result.
|
||||||
|
|
||||||
- `//b` : Returns elements in the entire document matching b.
|
- `//b` : Returns elements in the entire document matching b.
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ Supported Features
|
|||||||
|
|
||||||
- `(a/b)` : Selects all matches nodes as grouping set.
|
- `(a/b)` : Selects all matches nodes as grouping set.
|
||||||
|
|
||||||
#### Node Axes
|
#### Node Axes
|
||||||
|
|
||||||
- `child::*` : The child axis selects children of the current node.
|
- `child::*` : The child axis selects children of the current node.
|
||||||
|
|
||||||
@ -73,9 +73,9 @@ Supported Features
|
|||||||
|
|
||||||
- `preceding-sibling::*` : Selects nodes before the current node.
|
- `preceding-sibling::*` : Selects nodes before the current node.
|
||||||
|
|
||||||
- `following::*` : Selects the first matching node following in document order, excluding descendants.
|
- `following::*` : Selects the first matching node following in document order, excluding descendants.
|
||||||
|
|
||||||
- `preceding::*` : Selects the first matching node preceding in document order, excluding ancestors.
|
- `preceding::*` : Selects the first matching node preceding in document order, excluding ancestors.
|
||||||
|
|
||||||
- `parent::*` : Selects the parent if it matches. The '..' pattern from the core is equivalent to 'parent::node()'.
|
- `parent::*` : Selects the parent if it matches. The '..' pattern from the core is equivalent to 'parent::node()'.
|
||||||
|
|
||||||
@ -151,6 +151,7 @@ Supported Features
|
|||||||
`round()`| ✓ |
|
`round()`| ✓ |
|
||||||
`starts-with()`| ✓ |
|
`starts-with()`| ✓ |
|
||||||
`string()`| ✓ |
|
`string()`| ✓ |
|
||||||
|
`string-join()`[^1]| ✓ |
|
||||||
`string-length()`| ✓ |
|
`string-length()`| ✓ |
|
||||||
`substring()`| ✓ |
|
`substring()`| ✓ |
|
||||||
`substring-after()`| ✓ |
|
`substring-after()`| ✓ |
|
||||||
@ -159,4 +160,6 @@ Supported Features
|
|||||||
`system-property()`| ✗ |
|
`system-property()`| ✗ |
|
||||||
`translate()`| ✓ |
|
`translate()`| ✓ |
|
||||||
`true()`| ✓ |
|
`true()`| ✓ |
|
||||||
`unparsed-entity-url()` | ✗ |
|
`unparsed-entity-url()` | ✗ |
|
||||||
|
|
||||||
|
[^1]: XPath-2.0 expression
|
19
vendor/github.com/antchfx/xpath/build.go
generated
vendored
19
vendor/github.com/antchfx/xpath/build.go
generated
vendored
@ -218,6 +218,12 @@ func (b *builder) processFunctionNode(root *functionNode) (query, error) {
|
|||||||
if arg2, err = b.processNode(root.Args[1]); err != nil {
|
if arg2, err = b.processNode(root.Args[1]); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// Issue #92, testing the regular expression before.
|
||||||
|
if q, ok := arg2.(*constantQuery); ok {
|
||||||
|
if _, err = getRegexp(q.Val.(string)); err != nil {
|
||||||
|
return nil, fmt.Errorf("matches() got error. %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
qyOutput = &functionQuery{Input: b.firstInput, Func: matchesFunc(arg1, arg2)}
|
qyOutput = &functionQuery{Input: b.firstInput, Func: matchesFunc(arg1, arg2)}
|
||||||
case "substring":
|
case "substring":
|
||||||
//substring( string , start [, length] )
|
//substring( string , start [, length] )
|
||||||
@ -450,6 +456,19 @@ func (b *builder) processFunctionNode(root *functionNode) (query, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
qyOutput = &transformFunctionQuery{Input: argQuery, Func: reverseFunc}
|
qyOutput = &transformFunctionQuery{Input: argQuery, Func: reverseFunc}
|
||||||
|
case "string-join":
|
||||||
|
if len(root.Args) != 2 {
|
||||||
|
return nil, fmt.Errorf("xpath: string-join(node-sets, separator) function requires node-set and argument")
|
||||||
|
}
|
||||||
|
argQuery, err := b.processNode(root.Args[0])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
arg1, err := b.processNode(root.Args[1])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
qyOutput = &functionQuery{Input: argQuery, Func: stringJoinFunc(arg1)}
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("not yet support this function %s()", root.FuncName)
|
return nil, fmt.Errorf("not yet support this function %s()", root.FuncName)
|
||||||
}
|
}
|
||||||
|
31
vendor/github.com/antchfx/xpath/func.go
generated
vendored
31
vendor/github.com/antchfx/xpath/func.go
generated
vendored
@ -614,3 +614,34 @@ func reverseFunc(q query, t iterator) func() NodeNavigator {
|
|||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// string-join is a XPath Node Set functions string-join(node-set, separator).
|
||||||
|
func stringJoinFunc(arg1 query) func(query, iterator) interface{} {
|
||||||
|
return func(q query, t iterator) interface{} {
|
||||||
|
var separator string
|
||||||
|
switch v := functionArgs(arg1).Evaluate(t).(type) {
|
||||||
|
case string:
|
||||||
|
separator = v
|
||||||
|
case query:
|
||||||
|
node := v.Select(t)
|
||||||
|
if node != nil {
|
||||||
|
separator = node.Value()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
q = functionArgs(q)
|
||||||
|
test := predicate(q)
|
||||||
|
var parts []string
|
||||||
|
switch v := q.Evaluate(t).(type) {
|
||||||
|
case string:
|
||||||
|
return v
|
||||||
|
case query:
|
||||||
|
for node := v.Select(t); node != nil; node = v.Select(t) {
|
||||||
|
if test(node) {
|
||||||
|
parts = append(parts, node.Value())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return strings.Join(parts, separator)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
10
vendor/modules.txt
vendored
10
vendor/modules.txt
vendored
@ -1,7 +1,7 @@
|
|||||||
# github.com/antchfx/xmlquery v1.3.18
|
# github.com/antchfx/xmlquery v1.3.18
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
github.com/antchfx/xmlquery
|
github.com/antchfx/xmlquery
|
||||||
# github.com/antchfx/xpath v1.2.4
|
# github.com/antchfx/xpath v1.2.5
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
github.com/antchfx/xpath
|
github.com/antchfx/xpath
|
||||||
# github.com/davecgh/go-spew v1.1.1
|
# github.com/davecgh/go-spew v1.1.1
|
||||||
@ -16,13 +16,13 @@ github.com/influxdata/influxdb1-client/pkg/escape
|
|||||||
github.com/influxdata/influxdb1-client/v2
|
github.com/influxdata/influxdb1-client/v2
|
||||||
# github.com/stretchr/testify v1.7.0
|
# github.com/stretchr/testify v1.7.0
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
# golang.org/x/net v0.15.0
|
# golang.org/x/net v0.20.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.18
|
||||||
golang.org/x/net/html
|
golang.org/x/net/html
|
||||||
golang.org/x/net/html/atom
|
golang.org/x/net/html/atom
|
||||||
golang.org/x/net/html/charset
|
golang.org/x/net/html/charset
|
||||||
# golang.org/x/text v0.13.0
|
# golang.org/x/text v0.14.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.18
|
||||||
golang.org/x/text/encoding
|
golang.org/x/text/encoding
|
||||||
golang.org/x/text/encoding/charmap
|
golang.org/x/text/encoding/charmap
|
||||||
golang.org/x/text/encoding/htmlindex
|
golang.org/x/text/encoding/htmlindex
|
||||||
|
Loading…
Reference in New Issue
Block a user