-
Notifications
You must be signed in to change notification settings - Fork 284
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 support to the core and tuple packages for relationship expiration #2146
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments - will rereview after that.
@@ -73,7 +73,7 @@ func (ch *Changes[R, K]) AddRelationshipChange( | |||
return err | |||
} | |||
|
|||
key := tuple.StringWithoutCaveat(rel) | |||
key := tuple.StringWithoutCaveatOrExpiration(rel) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WithoutTraits
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to be explicit for now; if/when we add more traits, I plan to rename
for _, rel := range batch.Relationships { | ||
if rel.OptionalExpiresAt != nil { | ||
return nil, fmt.Errorf("expiration time is not currently supported") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this extra defensiveness for the current release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep!
@@ -71,6 +71,8 @@ func TestEqual(t *testing.T) { | |||
MustParse("document:foo#viewer@user:tom[somecaveat:{\"hi\":{\"yo\":123}}]"), | |||
MustParse("document:foo#viewer@user:tom[somecaveat:{\"hi\":{\"yo\":{\"hey\":true}}, \"hi2\":{\"yo2\":{\"hey2\":false}}}]"), | |||
MustParse("document:foo#viewer@user:tom[somecaveat:{\"hi\":{\"yo\":{\"hey\":true}}, \"hi2\":{\"yo2\":{\"hey2\":[1,2,3]}}}]"), | |||
MustParse("document:foo#viewer@user:tom[expiration:2020-01-01T00:00:00Z]"), | |||
MustParse("document:foo#viewer@user:tom[somecaveat:{\"hi\":\"there\"}][expiration:2020-01-01T00:00:00Z]"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we doing separate brackets for each trait? I'd be in favor of having them within the same set of brackets and comma-separated like in the first example from slack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I felt each bracket made it more readable (and makes it easier to parse)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
b670eaa
to
4ba2457
Compare
4ba2457
to
f3b5c44
Compare
No description provided.