github.com/tobgu/qframe@v0.4.0/internal/fcolumn/filters.go (about) 1 package fcolumn 2 3 import ( 4 "math" 5 6 "github.com/tobgu/qframe/filter" 7 "github.com/tobgu/qframe/internal/index" 8 ) 9 10 var filterFuncs0 = map[string]func(index.Int, []float64, index.Bool){ 11 filter.IsNull: isNull, 12 filter.IsNotNull: isNotNull, 13 } 14 15 var filterFuncs1 = map[string]func(index.Int, []float64, float64, index.Bool){ 16 filter.Gt: gt, 17 filter.Gte: gte, 18 filter.Lt: lt, 19 filter.Lte: lte, 20 filter.Eq: eq, 21 filter.Neq: neq, 22 } 23 24 var filterFuncs2 = map[string]func(index.Int, []float64, []float64, index.Bool){ 25 filter.Gt: gt2, 26 filter.Gte: gte2, 27 filter.Lt: lt2, 28 filter.Lte: lte2, 29 filter.Eq: eq2, 30 filter.Neq: neq2, 31 } 32 33 func isNull(index index.Int, column []float64, bIndex index.Bool) { 34 for i, x := range bIndex { 35 if !x { 36 bIndex[i] = math.IsNaN(column[index[i]]) 37 } 38 } 39 } 40 41 func isNotNull(index index.Int, column []float64, bIndex index.Bool) { 42 for i, x := range bIndex { 43 if !x { 44 bIndex[i] = !math.IsNaN(column[index[i]]) 45 } 46 } 47 }