Skip to content

Latest commit

 

History

History
77 lines (54 loc) · 1.99 KB

README.md

File metadata and controls

77 lines (54 loc) · 1.99 KB

Hyperscale Filter Last release Documentation

Go Report Card

Branch Status Coverage
master Build Status Coveralls

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{}

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

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.