- 
                Notifications
    
You must be signed in to change notification settings  - Fork 15
 
Open
Description
Hi,
Using two selectors in comparison expression doesn't seem to work.
This works:
"value.nomad == test and value.consul == test",
This doesn't:
"value.nomad == value.consul",
The following code shows the problem:
package main
import (
	"fmt"
	"os"
	"github.com/hashicorp/go-bexpr"
	"github.com/hashicorp/go-bexpr/grammar"
)
type Example struct {
	Nomad  string `bexpr:"nomad"`
	Consul string `bexpr:"consul"`
}
func main() {
	value := map[string]Example{
		"value": {Nomad: "prueba", Consul: "prueba"},
	}
	expressions := []string{
		"value.nomad == prueba and value.consul == prueba",
		"value.nomad == value.consul",
	}
	for _, expression := range expressions {
		eval, err := bexpr.CreateEvaluator(expression)
		if err != nil {
			fmt.Printf("Failed to create evaluator for expression %q: %v\n", expression, err)
			continue
		}
		result, err := eval.Evaluate(value)
		if err != nil {
			fmt.Printf("Failed to run evaluation of expression %q: %v\n", expression, err)
			continue
		}
		fmt.Printf("Result of expression %q evaluation: %t\n", expression, result)
	}
}
I guess this is not implemented. Is there any way I can get this working? Thanks
Metadata
Metadata
Assignees
Labels
No labels