var (
pHello predicate.P[string] = func(s string) bool {
return s == "hello"
}
pWorld predicate.P[string] = func(s string) bool {
return s == "world"
}
pAny predicate.P[string] = func(s string) bool {
return s != ""
}
)
fmt.Println("Or (true):", pHello.Or(pWorld)("hello"))
fmt.Println("Or (false):", pHello.Or(pWorld)("foo"))
fmt.Println("And (false):", pHello.And(pWorld)("hello"))
fmt.Println("And (true):", pHello.And(pAny)("hello"))
fmt.Println("Negate (false):", pHello.Negate()("hello"))
fmt.Println("Negate (true):", pHello.Negate()("world"))
fmt.Println("Chained (true):", pHello.And(pAny.Or(pWorld))("hello"))
fmt.Println("Chained (false):", pHello.And(pAny.Or(pWorld))("foo"))
generated from bep/golibtemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
A generic predicate func.
License
bep/predicate
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A generic predicate func.
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published