timbray / quamina

Home of Quamina, a fast pattern-matching library in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Patterns support - `IN` and array overlapping

yosiat opened this issue Β· comments

Hi!

Thanks for this beautiful amazing library πŸš€ I have built internally a simple pattern matching library (using inverted indices and simple counting) which lacks some features that Quamina have and I want to explore Quamina to see if I can replace my own library in terms of correctness & performance.

To do that I need to support 4 operators which two of them already exists (Equality, Exists) but IN and array overlapping doesn't.

Examples:

IN

Event:

{
    "event": "machine:created"
}

Pattern:

{
     "event": ["machine:created", "machine:deleted", "machine:updated"]
}

So any event which is one of the above will yield a match

Array overlapping

Event:

{
    "customers": ["a", "b", "c", "f"]
}

Pattern:

{
     "customers": ["c", "d", "a", "y"]
}

In this case we will have a match since we have overlapping (with c, d and a)

Is it possible to support those operators? I am still reading the code and trying to figure that out on my own.. If it's possible to support and some guidance will be given I will try to implement this on my own.

Opened the issue too fast, looks like what I need is already supported.

Sorry for that.