Skip to content

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.

License

Notifications You must be signed in to change notification settings

hyperscale-stack/filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published