6 Commits

Author SHA1 Message Date
Johan Fylling a179a24c48 v1 API
All packages, except for `cmd` and `internal`, have been moved into a new `v1` root package.

Old packages are kept for backwards-compatibility reasons. All contained code is replaced with simple type aliases and proxy functions to `v1` implementations.

Old packages default to the Rego v0 syntax, new `v1` packages default to the Rego v1 syntax.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:27:34 +01:00
Johan Fylling 7bb6dbe36b Preparing for v1 API
Moving (most) source to v1 root package to prepare for v0/v1 API separation.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:09:03 +01:00
occupyhabit d6c8c1b51b chore: remove repetitive words
Signed-off-by: occupyhabit <wangmengjiao@outlook.com>
2024-03-25 11:28:12 -07:00
Patrick East b48c534722 Run make fmt with new goimports cmd
Signed-off-by: Patrick East <east.patrick@gmail.com>
2019-09-27 09:55:11 -04:00
Torin Sandall 1ecb93ad3d Optimization: Remove copying of bindings
Instead of copying the bindings each time a binding is added, return an object
that can be used to undo the binding at the end of the proof.
2016-07-12 08:49:38 -07:00
Torin Sandall 2f99f291ce Add basic support for modules
- Basic compiler framework with a few steps to resolve references
- Extend runtime to support loading policies
- Update evaluation to deal with resolved references

    * Store calls (e.g., Patch, Get) expect paths. It's assumed that the path
    has had the "data" prefix removed.

    * The top level query interface expects paths so the "data" prefix is
    added before calling into the actual TopDown implementation.

    * The head of a reference can be used to determine whether it refers to a
    local variable or a document in the db.

    * Updates to misc. test helpers to preserve existing structure. Implicitly
    import top-level documents, rename local variables to avoid conflicts,
    etc.

- Refactor reference evaluation

    * Remove special casing around first reference term.

    This was what prevented embedded virtual doc references from working
    immediately. Previously, the code assumed that the first term in the
    reference identified the virtual doc/rule. This was an over simplification
    that worked while the initial implementation was in progress. Now that
    modules are supported, virtual docs/rules may be embedded at arbitrary
    depths, e.g., "data.a.b.c[i].d[j]" where "c" is the rule name and
    "a.b" is the package containing the rule.

    * Break up the reference valuation into smaller functions.
    * Reorder ref/path arguments
    * Rename path/ref to path/tail respectively

- Separate test case for embedded virtual docs.

Also, a few misc. changes:

- Fix Ref.String() in empty case.
- Refactor hashMap into separate package.
- Get rid of ad-hoc FNV implementation. Use the one from the stdlib!
- Refactored parsing helpers from eval into ast
2016-05-09 15:19:55 -07:00