Popularity
1.3
Stable
Activity
0.0
Stable
9
3
0

Description

this is a rule engine that consists of functions, inputs, and outputs. its pattern consists of multiple rows of: condition | action[s]

it is very good for rule scripting inside a go project. it has serialization capabilities.

Programming language: Go
License: MIT License
Latest version: v0.0.4

mosalat alternatives and similar packages

Based on the "Embeddable Scripting Languages" category.
Alternatively, view mosalat alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of mosalat or a related project?

Add another 'Embeddable Scripting Languages' Package

README

Example:

 func now() int64 { return time.Now().Unix() }
 func days(count float64) float64 {
    return count * 24 * 60 * 60
 }

 func main() {
    funcMap := map[string]interface{}{
        "now":  now,
        "days": days,
    }
    inputMap := map[string]interface{}{
        "registered_date": time.Now().Unix(),
        "sales_amount":    2000000,
    }
    outputMap := map[string]interface{}{
        "plan_name": "premium_1",
    }
    output, err := mosalat.Run([]string{
        `now() > registered_date + days(14) && plan_name == "premium_1" | plan_name = "free"`,
        `plan_name == "premium_1" | plan_name = "free"`,
        `plan_name == "free" | feature_1 = true`,
    }, funcMap, inputMap, outputMap) // --> [plan_name: "free", feature_1: true]
 }