Comparing version 0.0.1 to 0.0.2
@@ -37,3 +37,3 @@ { | ||
}, | ||
"version": "0.0.1" | ||
"version": "0.0.2" | ||
} |
@@ -26,3 +26,3 @@ febs db库用于连接数据库,目前仅支持mysql | ||
> `table`: 代表一个数据库表; 针对此的操作在这个对象中完成 | ||
> `table`: 代表一个数据库表; 针对表的操作在这个对象中完成 | ||
@@ -29,0 +29,0 @@ > `database_connection`: 表示一个连接对象, 在执行事务操作时, 需要使用database来向连接池中获取一个连接来进行. |
@@ -18,5 +18,5 @@ 'use strict'; | ||
// 数据表. | ||
class config extends table { | ||
class notify extends table { | ||
constructor(dbclient) { | ||
super(dbclient, 'config', 'id', | ||
super(dbclient, 'notify', 'id', | ||
{ | ||
@@ -45,10 +45,10 @@ id: {type: 'integer', size:8, key: true}, // the auto-incrementing primary key | ||
bigNumberStrings : false, // number -> string only when number overflow in js. | ||
host : 'www.citongs.com', | ||
host : '', | ||
port : 3306, | ||
user : 'brainpoint', | ||
password : '123456', | ||
database : 'xtls', | ||
user : '', | ||
password : '', | ||
database : '', | ||
}); | ||
// table. | ||
this.dbConfig = new config(this.db); | ||
this.dbNotify = new notify(this.db); | ||
} | ||
@@ -61,10 +61,14 @@ | ||
*queryExample() { | ||
let ret; | ||
ret = yield this.dbConfig.count(); | ||
console.log( ret ); | ||
ret = yield this.dbConfig.add({is_read:true, title:'test1'}); | ||
console.log( ret ); | ||
ret = yield this.dbConfig.isExist(1); | ||
console.log( ret ); | ||
tap.pass('ok'); | ||
try { | ||
let ret; | ||
ret = yield this.dbNotify.count(); | ||
console.log( ret ); | ||
ret = yield this.dbNotify.add({is_read:true, title:'test1'}); | ||
console.log( ret ); | ||
ret = yield this.dbNotify.isExist(1); | ||
console.log( ret ); | ||
tap.pass('ok'); | ||
} catch(e) { | ||
console.log(e); | ||
} | ||
} | ||
@@ -71,0 +75,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
140919
1939