當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript promise-mysql.IPool類代碼示例

本文整理匯總了TypeScript中promise-mysql.IPool的典型用法代碼示例。如果您正苦於以下問題:TypeScript IPool類的具體用法?TypeScript IPool怎麽用?TypeScript IPool使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IPool類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: setHost

 setHost(region: IRegion, host: IHost, port: number): Promise<IRegion> {
   let address: string = host ? host.address : '';
   return this.db.query('UPDATE regions SET httpPort=?, slaveAddress=? WHERE uuid=?', [port, address, region.uuid]).then(() => {
     region.node = address;
     return region;
   });
 }
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:7,代碼來源:Regions.ts

示例2: setXY

 setXY(region: IRegion, x: number, y: number): Promise<IRegion> {
   return this.db.query('UPDATE regions SET locX=?, locY=? WHERE uuid=?', [x, y, region.uuid]).then(() => {
     region.x = x;
     region.y = y;
     return region;
   });
 }
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:7,代碼來源:Regions.ts

示例3: Error

 getByID(id: number): Promise<IJob> {
   return this.db.query('SELECT * FROM jobs WHERE id=?', id).then((rows: job_row[]) => {
     if (rows.length !== 1)
       throw new Error('Job ' + id + ' does not exist');
     return rows[0];
   });
 }
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:7,代碼來源:Jobs.ts

示例4: Error

 getByName(name: string): Promise<IPendingUser> {
   return this.db.query('SELECT * FROM users WHERE name=?', name).then((rows: pending_user_row[]) => {
     if (rows.length !== 1)
       throw new Error('Pending User ' + name + ' does not exist');
     return rows[0];
   });
 }
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:7,代碼來源:PendingUsers.ts

示例5:

 return Promise.all(rows.map((r: inventoryItem) => {
   let v: inventoryItem = {
     assetID: r.assetType == 24 ? uuidMap[r.assetID] : r.assetID,  // type 24 is a link
     assetType: r.assetType,
     inventoryName: r.inventoryName,
     inventoryDescription: r.inventoryDescription,
     inventoryNextPermissions: r.inventoryNextPermissions,
     inventoryCurrentPermissions: r.inventoryCurrentPermissions,
     invType: r.invType,
     creatorID: r.creatorID,
     inventoryBasePermissions: r.inventoryBasePermissions,
     inventoryEveryOnePermissions: r.inventoryEveryOnePermissions,
     salePrice: r.salePrice,
     saleType: r.saleType,
     creationDate: r.creationDate,
     groupID: r.groupID,
     groupOwned: r.groupOwned,
     flags: r.flags,
     inventoryID: invMap[r.inventoryID],
     avatarID: target.UUID,
     parentFolderID: uuidMap[r.parentFolderID],
     inventoryGroupPermissions: r.inventoryGroupPermissions
   }
   return db.query('INSERT INTO inventoryitems SET ?', v);
 }))
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:25,代碼來源:Inventory.ts

示例6: Error

 getByAddress(address: string): Promise<IHost> {
   return this.db.query('SELECT * FROM hosts WHERE address=?', [address]).then((rows: hosts_row[]) => {
     if (rows.length == 0)
       throw new Error('Host ' + address + ' does not exist');
     return rows[0];
   });
 }
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:7,代碼來源:Hosts.ts

示例7: create

 create(address: string): Promise<IHost> {
   let host: hosts_row = {
     address: address,
     port: 0,
     name: '',
     slots: 0
   }
   return this.db.query('INSERT INTO hosts SET ?', host).then((result) => {
     host.id = result.insertId;
     return host;
   });
 }
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:12,代碼來源:Hosts.ts

示例8: create

 create(type: string, user: IUser, data: string): Promise<IJob> {
   let job: job_row = {
     timestamp: new Date(),
     type: type,
     user: user.UUID,
     data: data
   }
   return this.db.query('INSERT INTO jobs SET ?', job).then((result) => {
     job.id = result.insertId;
     return job;
   });
 }
開發者ID:M-O-S-E-S,項目名稱:mgm,代碼行數:12,代碼來源:Jobs.ts


注:本文中的promise-mysql.IPool類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。