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 collection element types #307
Conversation
a62cde5
to
18a0a0c
Compare
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.
Left some comments on documentation. Haven't reviewed the rest yet.
README.md
Outdated
@@ -202,6 +206,31 @@ class Document | |||
end | |||
``` | |||
|
|||
Some type declaration have options like `store_as_string` for `datetime` | |||
or `serializer` for `serializable`. It's possible to specify them for elements type: |
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 do not understand this statement:
It's possible to specify them for elements type:
Does it mean this,
It's possible to specify a type declaration for each field:
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.
@pboling Hm, no.
I meant user can declare usual field options when declares set
elements type e.g. set of datetime and store datetime in numeric or string format.
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'm not sure how to improve it then. I still don't fully understand. Maybe add a few more fields to complete the example?
README.md
Outdated
``` | ||
|
||
As far as DynamoDB doesn't allow storing empty strings in Set | ||
when `Dynamoid` saves a document it removes all empty strings in `set` fields. |
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.
Improving grammar for clarity:
DynamoDB doesn't allow empty strings in fields configured as
set
.
Abiding by this restriction, whenDynamoid
saves a document it removes all empty strings inset
fields.
README.md
Outdated
|
||
#### Note on array type | ||
|
||
`array` field declaration supports `of` option as well: |
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 there any guidance we can add relative to why or when one should use a set
and when one should use an array
, aside from the element type restrictions? This may not be the right place for that sort of thing.
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.
The guidance could be found in DynamoDB's documentation as far as Dynamoid's types are mapped straightforward to DynamoDB's - array on List and set on Set.
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.
As far as I can tell, the mapping you refer to is not in the README anywhere. Might be in some wiki, but it would be helpful to clarify in the README. Most Rubyists are not familiar with Ruby's Set class:
Amazon DynamoBD | Dynamoid gem |
---|---|
List | Array |
Set | Set |
@pboling Updated Readme. Please check new wording. |
@pboling ping Did you have a chance to look at new wording here? Have I missed anything? |
@andrykonchin The latest documentation looks great! |
Updates:
:of
option in field declaration forset
field:of
option forarray
fieldof
option now supports all scalar types (exceptboolean
) likeinteger
,number
,date
,datetime
,serializable
and custom types.Example:
Some type declarations have options like
store_as_string
orserializer
. It's possible to specify them for elements type:Related Issue #272