Giter VIP home page Giter VIP logo

fast-object-filter's Introduction

Fast Object Filter

Build and Test NuGet

This library is designed for a future version of DarkRift Networking to provide dynamic filtering in streams of objects.

Background

The Idea

Some DarkRift plugins will need to filter certain messages depending on rules that could be defined by a user at runtime or in configuration. Given the number of possibilities of these filters it is not easy to write custom logic to filter messages without limiting what combinations are possible.

Therefore this library provides compilation of custom filtering functions that can handle the speeds at which DarkRift needs without sacrificing the possibilities of those filters.

The filtering language is designed to look similar to C# or that use in Wireshark.

The Implementation

Fast Object Filter works by using Expressions to compile the filter string into a Func<bool, T>.

Usage

FastObjectFilter is available as a NuGet package!

A simple usage would look like:

var filter = new FastObjectFilterCompiler().Compile<DataObject>("Forename == \"Steve\"");

var data = new DataObject(Forename = "Steve", Surname = "Irwin", DOB = new DateTime(1962, 9, 22), LikesCats = true);

if (filter(data))
    Console.WriteLine("Match");
else
    Console.WriteLine("No match");

This would print out:

Match

Of course, this example is trivial, the real power of Fast Object Filter is found when a single filter string needs to be applied to thousands of different data objects.

fast-object-filter's People

Contributors

jamjar00 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.