-
Notifications
You must be signed in to change notification settings - Fork 3
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
Traits, basic documents, utility fields. #26
Merged
Merged
Conversation
This file contains 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
Codecov Report
@@ Coverage Diff @@
## develop #26 +/- ##
==========================================
- Coverage 99.91% 99.4% -0.51%
==========================================
Files 21 30 +9
Lines 1174 1522 +348
==========================================
+ Hits 1173 1513 +340
- Misses 1 9 +8
Continue to review full report at Codecov.
|
…s via class attribute access.
…mplementations and tests.
… tests, trait updates.
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.
Field Improvements
String
assignment.String
assignment.Utilities
utcnow
— generate a UTC timezone-awaredatetime
object representing now. (Saves on litteringdatetime
andpytz
imports all over the place; no need forpytz
at all.)New Fields
Markdown
— string storage which self-renders under the__html__
method protocol.Path
—PurePosixPath
storage.“Basic” Documents
VerifiedAddress
— an e-mail address with addition and verification dates.BaseLocation
— representing an address or geophysical location.Traits
Derived
A
Document
sub-class which has its own sub-classes; track in-DB which to instantiate when deserializing. May apply to anyDocument
sub-class utilized as a top-level record,Embed
, orReference
target. Note: serialization/deserialization and complex types need to be generally aware of the__type_store__
document attribute.cls
attribute.Expires
Document self-destructs at a certain point in time. Note: this changes the behaviour of deserialization such that the value
None
may appear in place of records that have been loaded, but are expired. Passexpired=True
to disable this check and load the record anyway, however, where not explicitly disabling the check be sure to validate the response and, if iterating a cursor, continue with the next record. Include a range comparison against the current time in UTC to exclude these from contention, however some may expire in the time it takes to iterate a cursor.TTL
field namedexpires
.is_expired
validation property.None
if expired; optionally bypass-able behaviour.Hierarchical
Document is a member of an acyclic directed graph, or tree, with slugs and paths. Order preservation is not implied beyond parent/child and ancestor/descendant relationships. Moved to own issue: Hierarchical and/or taxonomy model structure or trait mix-in. #29
Identified
A document utilizing this trait mix-in contains a MongoDB-side
_id
key accessible and queryable as theid
ObjectId field attribute. Provides a read-only attribute to retrieve the record creation time from theid
.Localized
Document contains localizable information.
Localized.Locale
) containing sufficient field definitions to satisfy MongoDB full-text indexing requirements for language identification.Owned
Document has the concept of a reference to an
owner
, and an index on such.Published
Document has explicit
creation
,modification
, and optionalpublication
andretraction
times. Additionally, indexes to facilitate conditional range querying ofpublication
andretraction
. If mixing withIdentified
, ensurePublished
comes later; it overrides the meaning ofcreation
.Stateful
Document maintains
state
described by a cyclic directed graph of allowable string tag-based state transitions. Moved to own issue: Stateful trait mix-in. #30Here's an example model utilizing these: