PaesslerAG / gval

Expression evaluation in golang
BSD 3-Clause "New" or "Revised" License
713 stars 83 forks source link

Add support for typed map and slices with method calls #88

Closed tw1nk closed 1 year ago

tw1nk commented 1 year ago

I noticed that gval didn't support expressions for typed maps and slice method call.

Example map:

type MyMap map[string][]int

func (m MyMap) Sum(key string) int {
    values, ok := m[key]
    if !ok {
        return -1
    }
    sum := 0
    for _, v := range values {
        sum += v
    }
    return sum
}
generikvault commented 1 year ago

thank you