[PoC] Add TypedDocument for supporting flat collection writes#261
Open
suddendust wants to merge 1 commit intohypertrace:mainfrom
Open
[PoC] Add TypedDocument for supporting flat collection writes#261suddendust wants to merge 1 commit intohypertrace:mainfrom
suddendust wants to merge 1 commit intohypertrace:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #261 +/- ##
============================================
- Coverage 80.41% 80.15% -0.27%
Complexity 1337 1337
============================================
Files 231 232 +1
Lines 6060 6197 +137
Branches 545 568 +23
============================================
+ Hits 4873 4967 +94
- Misses 813 849 +36
- Partials 374 381 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| return fields; | ||
| } | ||
|
|
||
| /** Returns a specific field by name, or null if not present. */ |
Contributor
There was a problem hiding this comment.
Instead of returning null, it'd be safer to return Optional.
| public enum FieldKind { | ||
| SCALAR, | ||
| ARRAY, | ||
| JSONB |
Contributor
There was a problem hiding this comment.
JSONB is specific to Postgres. Can we call it NESTED or something like that?
| * @param value the value (typically a Map or object that can be serialized to JSON) | ||
| * @return this builder | ||
| */ | ||
| public Builder jsonbField(String name, Object value) { |
| } | ||
|
|
||
| @Override | ||
| public String toJson() { |
There was a problem hiding this comment.
how does this behave for existing Document implementations?
| } | ||
|
|
||
| /** Returns the DataType for scalar fields, or the element type for array fields. */ | ||
| public DataType getDataType() { |
There was a problem hiding this comment.
how would this behave for jsonb?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently, write methods accept a
Documentwhich is just a JSON string with no type info. This works for Mongo because of its schemaless nature, but for Postgres, we need the type info for these fields. This PR introduces aTypedDocumentwhich contains this info.