Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module www.velocidex.com/golang/vfilter

require (
github.com/Velocidex/ordereddict v0.0.0-20230909174157-2aa49cc5d11d
github.com/Velocidex/ordereddict v0.0.0-20250821063524-02dc06e46238
github.com/alecthomas/assert v1.0.0
github.com/alecthomas/participle v0.7.1
github.com/alecthomas/repr v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/Velocidex/json v0.0.0-20220224052537-92f3c0326e5a h1:AeXPUzhU0yhID/v5JJEIkjaE85ASe+Vh4Kuv1RSLL+4=
github.com/Velocidex/json v0.0.0-20220224052537-92f3c0326e5a/go.mod h1:ukJBuruT9b24pdgZwWDvOaCYHeS03B7oQPCUWh25bwM=
github.com/Velocidex/ordereddict v0.0.0-20230909174157-2aa49cc5d11d h1:fn372EqKyazBxYUP5HPpBi3jId4MXuppEypEALGfvEk=
github.com/Velocidex/ordereddict v0.0.0-20230909174157-2aa49cc5d11d/go.mod h1:+MqO5UMBemyFSm+yRXslbpFTwPUDhFHUf7HPV92twg4=
github.com/Velocidex/ordereddict v0.0.0-20250821063524-02dc06e46238 h1:Q2DFf1f4fiz1/V4cu2wojDKF6/DfjIY7QmfVAr/UnJY=
github.com/Velocidex/ordereddict v0.0.0-20250821063524-02dc06e46238/go.mod h1:+MqO5UMBemyFSm+yRXslbpFTwPUDhFHUf7HPV92twg4=
github.com/Velocidex/yaml/v2 v2.2.8 h1:GUrSy4SBJ6RjGt43k6MeBKtw2z/27gh4A3hfFmFY3No=
github.com/Velocidex/yaml/v2 v2.2.8/go.mod h1:PlXIg/Pxmoja48C1vMHo7C5pauAZvLq/UEPOQ3DsjS4=
github.com/alecthomas/assert v1.0.0 h1:3XmGh/PSuLzDbK3W2gUbRXwgW5lqPkuqvRgeQ30FI5o=
Expand Down
17 changes: 17 additions & 0 deletions protocols/protocol_associative.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ import (
"www.velocidex.com/golang/vfilter/utils"
)

var (
exportedDictMethods = map[string]bool{
"Items": true,
"Keys": true,
"Values": true,
"Len": true,
"ToMap": true,
"String": true,
}
)

// Associative protocol.
type AssociativeProtocol interface {
Applicable(a types.Any, b types.Any) bool
Expand Down Expand Up @@ -68,6 +79,12 @@ func (self *AssociativeDispatcher) Associative(
return result, true

case *ordereddict.Dict:
// Support common dict methods
if exportedDictMethods[b_str] {
res, pres := DefaultAssociative{}.Associative(scope, a, b)
return res, pres
}

res, pres := t.Get(b_str)
if !pres {
default_value := t.GetDefault()
Expand Down