Branch | Status | Coverage |
---|---|---|
master |
The Hyperscale Filter library provides a set of commonly needed data filters. It also provides a simple filter chaining mechanism by which multiple filters may be applied to a single datum in a user-defined order.
Filter by map[string]interface{}
package main
import (
"fmt"
"github.com/hyperscale-stack/filter"
)
func main() {
i := NewInputFilter(map[string][]Filter{
"email": {
NewStringToLowerFilter(),
},
})
value, err := i.FilterMap(map[string]interface{}{
"email": "[email protected]",
})
// return
// map[string]interface{}{
// "email": "[email protected]",
// }
}
Filter by url.Values
package main
import (
"fmt"
"github.com/hyperscale-stack/filter"
)
func main() {
i := NewInputFilter(map[string][]Filter{
"email": {
NewStringToLowerFilter(),
},
})
values := url.Values{}
values.Set("email", "[email protected]")
value, err := i.FilterValues(values)
// return
// url.Values{
// "email": []string{"[email protected]"},
// }
}
Hyperscale Filter is licensed under the MIT license.