Home

WEPR -- a where - clause parser and compiler

Wepr allows you to:

  • Generate an abstract representation of a given WHERE clause
  • Walk its nodes using either functional fold or object-oriented Visitor pattern
  • Compile it into the delegate and execute over an argument

Features

  • Logical AND/and and OR/or between simple conditions
  • Equality operators (=, <>, !=, <, <=, >, >=)
  • String functions (Contains, StartsWith, EndsWith)
  • In function (can be applied to string and int lists)
  • Parentheses
  • Chained field/properties access (e.g.: User.Name.FirstName = 'John')
  • IEnumerable and IQueryable extensions allowing to dynamically compile queries

Usage samples

  • F#
type MyString(s:string) =
    member this.Value with get () = s
    override this.ToString () = sprintf "(MyString '%s')" s

let where = "Value.Length = 3 AND Value.Length in (1, 2, 3) and Value in ('abc', 'bca')"
let arg = MyString "abc"
let res = Wepr.Exec where arg
// res will be evaluated to true
  • C#
string[] strings = new string[] { "1", "123", "12", "12ab", "a", "ab", "abc" };
var res = strings.Where("Length >= 3"); // the predicate will be generated automatically

PS: You can find a better project description in Russian here.

Updated

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.