-
Notifications
You must be signed in to change notification settings - Fork 85
feat: Add string-based namespace support in Txns #262
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
base: main
Are you sure you want to change the base?
feat: Add string-based namespace support in Txns #262
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.
Pull Request Overview
This PR adds string‐based namespace support to transactions in the Txn class to simplify manual transaction management with the dgo client.
- Introduces NewTxnInNamespace and NewReadOnlyTxnInNamespace methods in txn.go.
- Adds comprehensive tests in v2_test.go and examples_test.go to verify namespace behavior.
- Updates docker-compose.yml to include non‐ACL service configurations for testing.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
v2_test.go | Adds tests for namespace creation, duplicate namespace error handling, and Txn usage. |
txn.go | Introduces new namespace field and helper methods for namespace-aware transactions. |
t/docker-compose.yml | Provides new docker services for a non‑ACL environment to support testing. |
examples_test.go | Adds functions to obtain dgo clients in non‑ACL mode and tests namespace support. |
Comments suppressed due to low confidence (1)
txn.go:67
- Correct the abbreviation 'Tnx' to 'Txn' for clarity in the comment.
// in the default namespace. Note that a Tnx created with this function will not complete successfully as the
Add tests; update test docker compose file
Co-authored-by: Copilot <[email protected]>
c7159b5
to
3f812cf
Compare
I think this would be a great improvement. With the V2 apis, namespaces are simple and a separate concept from ACL/auth, which is fantastic and exactly what I need. We have some graphs that update continuously, and others that are a monthly dump to be dropped and recreated in full. Namespaces gives me an easy way to acheive this data separation. I do not need different auth rules and user separation across the namespaces, as they are purely used by a single backend service. The missing parts are to enable namespace selection everywhere, without requiring different logins. So dgo transactions, graphQL admin requests (upload schema etc), graphQL queries and the Ratel/play UI. Happy to add additional info if it helps! See https://discuss.hypermode.com/t/v25-multitenency/19915/3 |
Now that I understand that apiv2 currently deprecates json-based mutatations this change is very important, as I can fall back to legacy apis for these, provided I have a way to set namespaces, which this PR provides. |
Description
This PR adds string-based namespace support to the Txn class. Managing transactions manually is something common in many repos that use the dgo client. This new functionality makes upgrading transaction-heavy code (that wants to use string-based namespaces) less cumbersome.
Checklist
CHANGELOG.md
file describing and linking tothis PR