Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add array and map types #135

Open
Geal opened this issue Apr 25, 2023 · 1 comment
Open

Add array and map types #135

Geal opened this issue Apr 25, 2023 · 1 comment
Milestone

Comments

@Geal
Copy link
Contributor

Geal commented Apr 25, 2023

as policies get more complex, we will see the need for more structured data, that could be queried from datalog. In particular, arrays and maps would make policies more flexible.

A few issues here:

  • they require a list of operators supporting them
  • the current syntax already uses [ ] for sets, which would be the common syntax to expect for arrays
@divarvel divarvel added this to the Datalog update milestone Oct 10, 2023
@divarvel divarvel moved this to Todo in biscuit v5 Oct 10, 2023
@divarvel divarvel moved this from Todo to Design in biscuit v5 Oct 10, 2023
This was referenced Oct 10, 2023
@divarvel
Copy link
Collaborator

divarvel commented Oct 13, 2023

A few propositions:

Syntax

  • use [] for lists
  • use { <key>: <value> } for maps, where <key> and <value> can be an arbitrary datalog term
  • use {} for sets

Possible issues: syntax ambiguity between parameters and sets (eg: {true}). we could remove set literals and provide set operators on lists (and remove Set from datalog), or keep Set, but only allow constructing it through a .toSet() method on lists.

New operators

  • .get(<key>) on maps (where key can be any datalog term
  • .get(<index>) on arrays (where index has to be a positive integer)

.get() on a map would return null for a key that is not in the map.
.get() on an array would throw an error on a key that is not an integer, and null if they key is negative or not in the array

Lifting restrictions

  • lists and maps could be nested
  • lists and maps could contain variables? not sure, we should investigate

@divarvel divarvel mentioned this issue Oct 18, 2023
@divarvel divarvel moved this from Design to Implementation in biscuit v5 May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Implementation
Development

No branches or pull requests

2 participants