Create custom object type in Golang #648
Replies: 1 comment 4 replies
-
I'm surprised it worked that far 😅 OPA isn't really buillt with user-extensible types in mind, from all I know. There may be some other things to explore, like a custom ref resolver that would tap into your system on demand, or custom module loaders, etc... but at the end of the day, those would all have to resolve to something known to OPA. One benefit would be that it'd be an on-demand thing instead of having to convert all of your types upfront. |
Beta Was this translation helpful? Give feedback.
-
Hi, i am trying to extend ast.Value interface to write my own custom object implementation.
the reason i am trying to do so is to achieve maximum performance without allocating external memory for my datastruct. I had unsuccessfully tried to implement my own type like this:
The reason i am doing it is because i already have a type that i manage internally and i want to perform policy evaluations on top of this type without allocating more memory or transforming it map and back.
However this samply policy evaluation fails,
allow := input.data.Name == "name"
it seems that the failure is originating from
only handling Object, Set and Array types. And it seems that Object cannot be externally extended.
Is there any way to create my own custom types in rego golang ?
Beta Was this translation helpful? Give feedback.
All reactions