有沒有任何ORM支持nodejs中的firestore?我特別喜歡Python中的ndb。ORM for firestore
1
A
回答
5
我們正在研究一個(我們的意思是Invertase/creators of react-native-firebase)。如果您之前在節點上使用過貓鼬或水線,那麼您會發現它過於熟悉,因爲這正是我們用來獲取靈感的地方。
這一切還是內部的,而是給你的API,這裏的車型之一的想法/用途例子中,我們內部有:
const User = model('User', {
// auto create/update date fields
autoCreatedAt: true,
autoUpdatedAt: true,
// auto created/updated by fields, uses current auth user or 'service-account'
autoUpdatedBy: true,
autoCreatedBy: true,
// toggle schema/less. If turned off, this will allow you to store arbitrary
// data in a record. If turned on, only attributes defined in the model's
// attributes object will be stored.
schema: true,
attributes: {
first_name: {
type: 'string',
required: true
},
last_name: {
type: 'string',
required: true
},
// virtual field support
full_name() {
return `${this.first_name} ${this.last_name}`;
},
age: {
type: 'integer'
},
email: {
type: 'email',
required: true
},
someBool: {
type: 'boolean',
defaultsTo: false
},
// association example- in this case a child collection of the users doc
// e.g /users/id/posts
posts: {
collection: 'posts',
}
}
});
// magic methods based on attributes
// findByX or findOneByX
User.findByAge(27).then((val) => {
// val = [] or [document object]
}).catch((error) => {
debugger;
});
// magic methods based on attributes
// findByX or findOneByX
User.findByName('mike').then((val) => {
// val = [] or [document object]
}).catch((error) => {
debugger;
});
// find a single document
User.findOne().then((val) => {
// val = undefined or document object
}).catch((error) => {
debugger;
});
// find multiple docs
User.find({
name: 'mike',
age: 27,
someBool: true,
}).then((val) => {
// val = [] or [document object]
}).catch((error) => {
debugger;
});
// find multiple docs with age between range
User.find({
someBool: true,
age: {
$gte: 27,
$lte: 35
}
}).then((val) => {
// val = [] or [document object]
}).catch((error) => {
debugger;
});
隨時留意我們的不和諧,Github org或twitter - 希望在幾天內擁有公共的alpha。
上面的例子並不展示我們計劃的一切,但我們計劃支持之類的東西paginations(跳躍,限制,頁),createOrUpdate,findOrCreate,訂閱() - 用於實時,多範圍過濾器(第一一個發送到公司的FireStore,剩下的做客戶端)等
更新:
在github here一對回購很早就已經公開。它通常有效,文檔仍然需要做,缺少代碼明智的一些東西 - 使用看到測試 - 它已經很好地測試(測試驅動開發),如果你想貢獻,然後請做:)我們暫停爲Firepit目前我們正在推出React Native Firebase版本。
相關問題
- 1. Emacs語法highlighing for PL/M
- 2. Firestore:加入vs Firestore定價
- 3. Firestore配置 - Firebase
- 4. M Wifi WifiManager for Android單元測試
- 5. .m文件爲MATLAB/Octave for Sublime Text
- 6. Firestore offline cache
- 7. Firestore安全規則
- 8. Firebase Firestore REST示例
- 9. 從Firestore導出json
- 10. 雲公司的FireStore
- 11. 用ngrx找出firestore
- 12. 沒有的FireStore從集合
- 13. 谷歌firestore - 得到DuplicateFileException
- 14. 如何在Google Firestore中進行分頁?
- 15. n!模m,a^p模m
- 16. angularfire2:雲Firestore API未啓用
- 17. M類:或M類():?
- 18. 如何導入雲端firestore?
- 19. Cloud Firestore交易限制
- 20. Google Cloud Firestore觸發器
- 21. Firestore中的多租戶
- 22. 未能解決:com.google.firebase:firebase-firestore:11.4.2
- 23. Firestore - batch.add不是函數
- 24. 在firestore中使用rxjs Observable
- 25. Firestore對象更新列表
- 26. 如何在公司的FireStore
- 27. Firestore文檔get()性能
- 28. Firebase Firestore - 或查詢替代
- 29. Cloud Firestore支持React Native
- 30. Google Firestore數據組織
到目前爲止我還沒有意識到(而且我們還沒有創建任何)。 –