directory
Version:
v2.0.0
Opens a new window with list of versions in this module.
Published: Jan 21, 2026
License: MIT
Opens a new window with license information.
README
ΒΆ
π Go Rules Engine Examples
This directory contains various examples to help you get started with the rules engine. Each example illustrates a specific feature of the engine.
π List of Examples
| Folder |
Description |
| basic |
Fundamental usage: simple age check with static facts. |
| advanced |
Advanced usage: dynamic facts, priorities, and complex logic. |
| json |
Loading rules and facts from JSON files or strings. |
| builder |
Using RuleBuilder to construct rules elegantly (fluent API). |
| audit-trace |
New: Extraction and JSON serialization of the full evaluation history (Audit Trace). |
| hot-reload |
New: Real-time rule updates via a remote source (HTTP). |
| parallel |
New: Parallel rule execution to optimize performance with slow facts. |
| metrics |
New: How to implement monitoring and observability (Prometheus). |
| api |
New: Wrapping the engine in a stateless REST API with net/http. |
| custom-operator |
How to extend the engine by adding your own custom operators. |
π How to run the examples
You can run any example using the go run command from the root of the project or directly within the example's folder.
From the root:
go run docs/examples/basic/main.go
From the example folder:
cd docs/examples/builder
go run main.go
π‘ Which example to choose?
- Beginner? Start with basic. It's the simplest way to understand the "Fact / Condition / Rule" workflow.
- Need to load configurations? Check out json or hot-reload for dynamic loading.
- Need performance or complex business logic? See advanced to discover dynamic facts (callbacks) and parallel for concurrent execution.
- Observability is a priority? Look at metrics to see how to connect Prometheus.
- Don't like writing JSON by hand? The builder is for you.
Directories
ΒΆ
Click to show internal directories.
Click to hide internal directories.