Sentinel
Extending Sentinel: Static Imports
Static imports allow you to write imports that use static data files. This can provide methods of consuming data in ways that are not available via modules or plugins.
Configuring a Static Import
The configuration page details how to configure static imports.
Usage
Using a static import is not that different to using a plugin or module. The import must first be introduced to the policy via an import statement.
import "people"
From here, the static data can be used throughout the policy as you would any normal Sentinel value.
admins = filter people as person {
person.role is "Admin"
}
One differentiator for static imports is that you can directly reference the import without the use of selectors. For example, to print the value;
print(people)
This is due to the static data being directly loaded and converted into a Sentinel value, ready for use. Static imports, like modules and plugins, cannot be assigned a new value.