本文整理汇总了TypeScript中pouchdb.put函数的典型用法代码示例。如果您正苦于以下问题:TypeScript put函数的具体用法?TypeScript put怎么用?TypeScript put使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: testBasics
function testBasics() {
interface MyModel {
property: 'someProperty ';
}
let model: PouchDB.Core.Document<MyModel>;
const id = 'model';
let db = new PouchDB<MyModel>();
db = new PouchDB<MyModel>(null, {
adapter: 'fruitdown'
});
db = new PouchDB<MyModel>(null, {
adapter: 'http'
});
db = new PouchDB<MyModel>(null, {
adapter: 'idb'
});
db = new PouchDB<MyModel>(null, {
adapter: 'leveldb'
});
db = new PouchDB<MyModel>(null, {
adapter: 'localstorage'
});
db = new PouchDB<MyModel>(null, {
adapter: 'memory'
});
db = new PouchDB<MyModel>(null, {
adapter: 'websql'
});
db = new PouchDB<MyModel>(null, {
adapter: 'websql',
size: 100
});
db.post(model).then((result) => {
isString(result.id);
});
db.post(model, null, (error, response) => {
});
db.get(id).then((result) => model = result);
db.get(id, null, (error, result) => {
});
db.put(model).then((error) => {
});
db.put(model, null, (error) => {
});
db.info().then((info) => {
});
db.info((error, result) => {
});
db.viewCleanup().catch((error) => {
});
}
开发者ID:Crevil,项目名称:DefinitelyTyped,代码行数:57,代码来源:pouchdb-tests.ts
示例2: function
db.get(req.ip, function (err: any, doc: any) {
let store = configureStore(doc.store);
store.dispatch({ type: req.query.type });
let model = {
_id: doc._id,
_rev: doc._rev,
store: store.getState()
};
db.put(model, function (err: any, doc: any) {
console.log(model.store);
callback(req, res, model.store);
});
});
开发者ID:bensbigolbeard,项目名称:universal-todomvc,代码行数:14,代码来源:server-db.ts
示例3: testCouchDB
async function testCouchDB() {
const DATABASE_URL = 'http://52.62.108.14:5984/test'
const canGet = await fetch(DATABASE_URL)
console.log(canGet)
const pouchDB = new PouchDB(DATABASE_URL)
const doc = await pouchDB.get('myJam')
Object.assign(doc, { newKey: 'value', time: new Date().toISOString() })
const update = await pouchDB.put(doc)
console.log(doc, update)
}
开发者ID:Edward-Lombe,项目名称:elm-electron,代码行数:17,代码来源:main.ts
示例4: resolve
partialsDB.get('daily_'+data.uid).then(function(dayPower){
if( dayPower.dateBeginningOfDay != dateBeginningOfDay ){
let dailynew={
_id:'daily_'+data.uid+'_'+dayPower.dateforDay,
power:dayPower.power,
updatedAt:dayPower.dateBeginningOfDay
};
localDB.put(dailynew).then(function(doc){
console.log(doc)
dayPower.power=data.dailyEnergy;
dayPower.dateBeginningOfDay=dateBeginningOfDay;
dayPower.dateforDay=dateforDay;
partialsDB.destroy().then(function(){
let partialsDB=PouchDB(partialsdb+'_'+data.uid+'_day',{auto_compaction: true});
delete dayPower._rev;
partialsDB.put(dayPower).then(function(){
resolve(true);
}).catch(function(err){
console.log(err,"error","save daily");
reject(err);
});
});
}).catch(function(err){
reject(err);
});
} else{
dayPower.power=data.dailyEnergy;
dayPower.dateBeginningOfDay=dateBeginningOfDay;
dayPower.dateforDay=dateforDay;
partialsDB.destroy().then(function(){
let partialsDB=PouchDB(partialsdb+'_'+data.uid+'_day',{auto_compaction: true});
delete dayPower._rev;
partialsDB.put(dayPower).then(function(){
resolve(true);
}).catch(function(err){
console.log(err,"error","save daily partial");
reject(err);
});
});
}
}).catch(function(){
开发者ID:dottgonzo,项目名称:express-autoaurora,代码行数:61,代码来源:setpowerpartials.ts
示例5: setAsync
setAsync(obj:any):Promise<string> {
if (obj.id && !obj._id)
obj._id = this.name + "--" + obj.id
return db.put(obj).then((resp:any) => resp.rev)
}
开发者ID:YanLinAung,项目名称:kindscript,代码行数:5,代码来源:db.ts
示例6: addDocument
addDocument(message) {
this.db.put(message);
}
开发者ID:ujjwal996,项目名称:campChatIonic,代码行数:3,代码来源:data.ts
注:本文中的pouchdb.put函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论