You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+81Lines changed: 81 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -134,6 +134,87 @@ default:
134
134
135
135
`Matched` is true when a specific rule (or a policy-level default) triggered. If all policies fall back to the document default, `Matched` remains false but `Effect` still reflects the decision (`ALLOW` or `DENY`).
136
136
137
+
### User-defined actions (custom effects)
138
+
139
+
The engine ships with two built-in effects (`ALLOW` and `DENY`) but accepts any non-empty string as an effect. `DENY` always short-circuits evaluation; every other effect is treated equally—first match wins. This lets you model domain-specific outcomes without forking or wrapping the engine:
fmt.Println("auto-approved — no manual review needed")
208
+
case EffectFlagReview:
209
+
fmt.Println("flagged for manual review")
210
+
case policy.EffectAllow:
211
+
fmt.Println("allowed — requires standard approval")
212
+
}
213
+
}
214
+
```
215
+
216
+
Because the caller defines what each effect means, you can extend the decision space (e.g., `RATE_LIMIT`, `QUARANTINE`, `NOTIFY_COMPLIANCE`) without changing the engine.
217
+
137
218
### Mapping snake_case JSON to expr fields
138
219
139
220
Use the `expr` struct tag to expose snake_case JSON fields with the same name inside expressions:
0 commit comments