Install the SDK
Add the GoRules engine to your Go module.
go get github.com/gorules/zen-goLoad a Decision
Create an engine and load your decision graph from a JSON file.
package main
import (
"github.com/gorules/zen-go"
"os"
)
func main() {
engine := zen.NewEngine(zen.EngineConfig{})
graph, _ := os.ReadFile("./decision.json")
decision, _ := engine.CreateDecision(graph)
}Evaluate Rules
Pass your input data and receive the decision result.
result, _ := decision.Evaluate(map[string]any{
"customer": map[string]any{"tier": "premium", "country": "US"},
"cart": map[string]any{"total": 150, "items": 3},
})
fmt.Println(result.Result) // map[discount:15 freeShipping:true]Why Go?
Built for performance and developer experience
Native Go Implementation
Pure Go bindings with CGO for optimal integration. No external processes or HTTP overhead.
Concurrent Safe
Thread-safe engine designed for high-concurrency Go applications. Share one engine across goroutines.
Minimal Allocations
Optimized for low memory overhead and minimal GC pressure in hot paths.
About the Go SDK
GoRules provides a production-ready business rules engine for Go applications. The SDK offers native bindings through CGO, connecting your Go code directly to our high-performance Rust core.
Designed for Go's concurrency model, the engine is fully thread-safe and can be shared across goroutines. This makes it perfect for high-throughput web services, microservices, and data processing pipelines where rule evaluation happens on every request.
The SDK supports all GoRules features including decision tables, expressions, and complex rule graphs. Decision definitions created in the visual editor work directly with the Go SDK, enabling business users to modify rules without code changes.