本文整理匯總了TypeScript中cradle.Connection類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Connection類的具體用法?TypeScript Connection怎麽用?TypeScript Connection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Connection類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: require
//
// Feb/09/2016
// ---------------------------------------------------------------
declare function require(x: string): any;
declare var process:any;
var cradle = require ('cradle')
// ---------------------------------------------------------------
console.log ("*** 開始 ***")
var key_in: string=process.argv[2]
console.log (key_in)
var name = 'nagano'
var cc = new (cradle.Connection)
var db = cc.database (name)
db.get (key_in,function (err,unit_aa)
{
if (unit_aa)
{
console.log (unit_aa)
db.remove (key_in,unit_aa._rev,function (err, res)
{
console.log (res)
})
}
else
示例2: require
// ---------------------------------------------------------------
// couch_create.ts
//
// Feb/09/2016
//
// ---------------------------------------------------------------
declare function require(x: string): any;
declare var process:any;
var cradle = require ('cradle')
var text_manipulate = require('/var/www/data_base/common/node_common/text_manipulate')
// ---------------------------------------------------------------
console.log ("*** 開始 ***")
//
var db_name: string = 'nagano'
var cc = new (cradle.Connection)
var db = cc.database (db_name)
db.exists (function (err, res_exists)
{
if (err)
{
console.log('error', err)
}
else
{
if (res_exists)
{
db.destroy ()
console.log ("*** db is destroyed ***")