Skip to content

ameykpatil/gorule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gorule

Rule engine in golang

package main

import "github.com/ameykpatil/gorule"

type A struct {
	ID string
	B  B
}

type B struct {
	C string
}

func main() {
	rule := gorule.Rule{
		Operator: And,
		Rules: []Rule{
			{
				Path:       "B.C",
				Comparator: Eq,
				Value:      "abc",
			},
			{
				Path:       "ID",
				Comparator: Eq,
				Value:      "id",
			},
		},
	}

	obj := A{
		ID: "id",
		B: B{
			C: "abc",
		},
	}

	fmt.Println(gorule.Apply(obj, rule))
}

About

Rule engine in golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages