While the documentation doesn't say that the in operator can be used on structs, it does actually work.
However it doesn't respect the expr tag and instead checks membership using the struct's go field names.
Example
With an environment built from:
type Outer struct {
Inner map[string]struct{} `expr:"bar"`
}
type Env struct {
Outer Outer `expr:"foo"`
}
in operator:
"bar" in foo => false
"Inner" in foo => true
Field access behaves the opposite:
foo.bar => map[]
foo.Inner => compilation error
Playground: https://go.dev/play/p/GqjjiidBOx0
While the documentation doesn't say that the
inoperator can be used on structs, it does actually work.However it doesn't respect the
exprtag and instead checks membership using the struct's go field names.Example
With an environment built from:
inoperator:"bar" in foo=> false"Inner" in foo=> trueField access behaves the opposite:
foo.bar=>map[]foo.Inner=> compilation errorPlayground: https://go.dev/play/p/GqjjiidBOx0