cedar-policy / cedar-go

Apache License 2.0
62 stars 8 forks source link

feat: expose decimal and ipaddr constructors #9

Closed caiorcferreira closed 5 months ago

caiorcferreira commented 5 months ago

Closes #8

Description of changes:

Expose newDecimalValue and newIPAddr functions as public methods.

philhassey commented 5 months ago

@caiorcferreira Thanks for the PR! I see in the PR that this re-did all the indenting of a bunch of files. Can you set your indent settings to the same as this repo and update the PR? Thanks!

caiorcferreira commented 5 months ago

@philhassey I think now it has the original indenting.

philhassey commented 5 months ago

@caiorcferreira Thanks! Can you add a doc string to the two new functions?

caiorcferreira commented 5 months ago

@philhassey just added!

For curiosity, why represent decimals using int64? Cedar Rust also does it?

philhassey commented 5 months ago

@caiorcferreira Thanks for the docs, I suggested shortening them, I think that'll be easier to read.

I don't recall if int64 is the underlying type in Rust, but if you look at the docs: https://docs.cedarpolicy.com/policies/syntax-datatypes.html#datatype-decimal

It seems like that's the range that this was made for.

philhassey commented 5 months ago

Thanks @caiorcferreira !