mcsimps2 / redpanda Goto Github PK
View Code? Open in Web Editor NEWAn Object Document Mapper (ODM) for Firestore
License: MIT License
An Object Document Mapper (ODM) for Firestore
License: MIT License
You can currently set it as <doc>.id = <ObjectID>
and then do <doc>.save()
. You may also be able to set in in the constructor. This behavior should be documented.
This will make the codebase more lightweight. Lodash is only used a couple times and is not necessary.
Instead of “await obj.foreignRef”, instead have “obj.foreignRef.fetch()” return the promise, and load this class with just the id so you can do “obj.foreignRef.id” without having to do a fetch.
Right now, only collections are supported.
This code doesn't look like it'll allow null values
if (schema[property.toString()].describe()['type'] === 'dbref') {
if (typeof value === 'string') {
return Reflect.set(target, '__id__' + property.toString(), value)
&& Reflect.set(target, '__obj__' + property.toString(), null);
}
else if (value instanceof Document) {
return Reflect.set(target, '__id__' + property.toString(), value.id)
&& Reflect.set(target, '__obj__' + property.toString(), value);
}
else {
throw new Error("Can only set a foreign reference with an id or Document subclass instance")
}
}
For example, a dictionary field that maps to IDs. Right now, support is only for individual fields and arrays of foreign references.
Load should have the option of maxDepth for recursive loading.
Instead of making the collection using .toLowerCase(), the collection should be separated by underscores.
Need to find a way to support the Firestore function .runTransaction() in an ODM like manner
Add support to recursively save/update/reload documents. (And document ability to reload).
Probably want to do it as so when specifying a schema
{
first_name: RedPanda.types.string().required(),
street_address: {
default: "",
type: RedPanda.types.string().required()
}
}
There is support for non-RedPanda types.
For example, when specifying a schema, it is possible to do
{
business: RedPanda.types.dbref().collection('business')
}
instead of {
business: RedPanda.types.dbref().collection(BusinessDocument)
}
because we may not have created a BusinessDocument type (perhaps we are migrated to RedPanda ODM). In this case, a snapshot is returned instead of a BusinessDocument. Add documentation about this.
Also add documentation about the ability to access the underlying doc reference, snapshot, collection, etc...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.