https://github.com/hyperscale-stack/filter
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.
https://github.com/hyperscale-stack/filter
filter filters golang golang-library golang-module input-filter
Last synced: 23 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/hyperscale-stack/filter
- Owner: hyperscale-stack
- License: mit
- Created: 2020-09-11T11:39:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-08-25T06:36:14.000Z (6 months ago)
- Last Synced: 2025-08-25T09:23:02.799Z (6 months ago)
- Topics: filter, filters, golang, golang-library, golang-module, input-filter
- Language: Go
- Homepage:
- Size: 84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Hyperscale Filter [](https://github.com/hyperscale-stack/filter/releases/latest) [](https://godoc.org/github.com/hyperscale-stack/filter)
====================
[](https://goreportcard.com/report/github.com/hyperscale-stack/filter)
| Branch | Status | Coverage |
|---------|--------|----------|
| master | [](https://github.com/hyperscale-stack/filter/actions?query=workflow%3AGo) | [](https://coveralls.io/github/hyperscale-stack/filter?branch=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.
## Example
Filter by `map[string]interface{}`
```go
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": "STEVE@APPLE.COM",
})
// return
// map[string]interface{}{
// "email": "steve@apple.com",
// }
}
```
Filter by `url.Values`
```go
package main
import (
"fmt"
"github.com/hyperscale-stack/filter"
)
func main() {
i := NewInputFilter(map[string][]Filter{
"email": {
NewStringToLowerFilter(),
},
})
values := url.Values{}
values.Set("email", "STEVE@APPLE.COM")
value, err := i.FilterValues(values)
// return
// url.Values{
// "email": []string{"steve@apple.com"},
// }
}
```
## License
Hyperscale Filter is licensed under [the MIT license](LICENSE.md).