-
-
Notifications
You must be signed in to change notification settings - Fork 464
Closed
Description
this is the proposal for the following API
type Place struct {
Code string
}
type Segment struct {
Origin Place
}
type Helpers struct {
PlaceEq func(p Place, s string) bool
}
type Request struct {
Segments []*Segment
Helpers
}
code := `Segments[0].Origin == "MOW" && PlaceEq(Segments[0].Origin, "MOW")`
program, err := expr.Compile(code, expr.Env(&Request{}), expr.Operator("==", "PlaceEq"))
if err != nil {
fmt.Printf("%v", err)
return
}
this should pass the type checker and allow to compare Place and string using "==" opertator
Metadata
Metadata
Assignees
Labels
No labels