NewCheckEngine creates a new CheckEngine instance for performing permission checks. It takes a key manager, schema reader, and relationship reader as parameters. Additionally, it allows for optional configuration through CheckOption function arguments.
(sr storage.SchemaReader, rr storage.DataReader, opts ...CheckOption)
| 36 | // It takes a key manager, schema reader, and relationship reader as parameters. |
| 37 | // Additionally, it allows for optional configuration through CheckOption function arguments. |
| 38 | func NewCheckEngine(sr storage.SchemaReader, rr storage.DataReader, opts ...CheckOption) *CheckEngine { |
| 39 | // Initialize a CheckEngine with default concurrency limit and provided parameters |
| 40 | engine := &CheckEngine{ |
| 41 | schemaReader: sr, |
| 42 | dataReader: rr, |
| 43 | concurrencyLimit: _defaultConcurrencyLimit, |
| 44 | } |
| 45 | |
| 46 | // Apply provided options to configure the CheckEngine |
| 47 | for _, opt := range opts { |
| 48 | opt(engine) |
| 49 | } |
| 50 | |
| 51 | return engine |
| 52 | } |
| 53 | |
| 54 | // SetInvoker sets the delegate for the CheckEngine. |
| 55 | func (engine *CheckEngine) SetInvoker(invoker invoke.Check) { |
no outgoing calls
no test coverage detected