func GetRangeFilter(op, fName string) (func(a, b uint64) bool, error) {
	if op == "==" {
		return func(a, b uint64) bool {
			return a == b
		}, nil
	} else if op == "!=" {
		return func(a, b uint64) bool {
			return a != b
		}, nil
	} else if op == "<=" {
		return func(a, b uint64) bool {
			return a <= b
		}, nil
	} else if op == ">=" {
		return func(a, b uint64) bool {
			return a >= b
		}, nil
	} else if op == "<" {
		return func(a, b uint64) bool {
			return a < b
		}, nil
	} else if op == ">" {
		return func(a, b uint64) bool {
			return a > b
		}, nil
	} else {
		return nil, fmt.Errorf("Op: " + op + " is not supported for '" + fName + "' filtering")
	}
}
Some standard filtering functions.
package rpc
import (
	"fmt"
	"math"
	"strconv"
	"strings"
)
type Filter interface {
	Match(v interface{}) bool
}
type ConfigurableFilter interface {
	Filter
	Configure(*FilterData) error
}
type FilterData struct {
	Field string `json:"field"`
	Op    string `json:"op"`
	Value string `json:"value"`
}
type CompositeFilter struct {
	filters []Filter
}
func (cf *CompositeFilter) SetData(filters []Filter) {
	cf.filters = filters
}
func (cf *CompositeFilter) Match(v interface{}) bool {
	for _, f := range cf.filters {
		if !f.Match(v) {
			return false
		}
	}
	return true
}
type MatchAllFilter struct{}
func (maf *MatchAllFilter) Match(v interface{}) bool { return true }
func ParseNumberValue(value string) (uint64, error) {
	var val uint64
	if value == "min" {
		val = 0
	} else if value == "max" {
		val = math.MaxUint64
	} else {
		tv, err := strconv.ParseUint(value, 10, 64)
		if err != nil {
			return 0, fmt.Errorf("Wrong value type.")
		}
		val = tv
	}
	return val, nil
}