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


TypeScript Client.end方法代碼示例

本文整理匯總了TypeScript中pg.Client.end方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Client.end方法的具體用法?TypeScript Client.end怎麽用?TypeScript Client.end使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pg.Client的用法示例。


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

示例1: resolve

 client.query('UPDATE places SET modified = LOCALTIMESTAMP WHERE description = \'' + input + '\'', (error, result) => {
     if(error) reject(error)
     if(result.rowCount) { 
         resolve('OK')
     } 
     client.end() 
 })
開發者ID:GaryGolf,項目名稱:radar,代碼行數:7,代碼來源:estate.ts

示例2: Client

export async function query<T>(config: ConnectionConfig, queryText: string, values: any[] = []) {
  const client = new Client(config)
  await client.connect()
  const result = await client.query(queryText, values)
  await client.end()
  return result as QueryResult<T>
}
開發者ID:chbrown,項目名稱:pg-meta,代碼行數:7,代碼來源:index.ts

示例3: reject

 await new Promise<void>((resolve, reject) => connection.end((err) => {
   if (err) {
     reject(err);
   } else {
     resolve();
   }
 }));
開發者ID:yruan,項目名稱:inceptum,代碼行數:7,代碼來源:PostgresClient.ts

示例4: NOW

 client.query("SELECT NOW() AS 'theTime'", (err, result) => {
     if (err) {
         return console.error("Error running query", err);
     }
     console.log(result.rows[0]["theTime"]);
     client.end();
     return null;
 });
開發者ID:0815fox,項目名稱:DefinitelyTyped,代碼行數:8,代碼來源:pg-tests.ts

示例5: async

const run = async () => {
    const dbCreate = new Client({})
    await dbCreate.connect()
    try {
        await dbCreate.query('drop database gandalf_test')
    } catch (err) {
        console.log('drop err', err.message)
    }
    await dbCreate.query('create database gandalf_test')
    await dbCreate.end()
    await client.connect()
    await createPersons()
        .then(createCompanies)
        .then(createProducts)
        .then(createOrders)
        .then(createViews)
    await client.end()
}
開發者ID:jakobrun,項目名稱:gandalf,代碼行數:18,代碼來源:generatePgData.ts

示例6: testSchema

async function testSchema(sql: string) {
  const client = new Client(connectionDetails)
  await client.connect()
  await client.query('DROP SCHEMA IF EXISTS DatabaseIntrospector cascade;')
  await client.query('CREATE SCHEMA DatabaseIntrospector;')
  await client.query('SET search_path TO DatabaseIntrospector;')
  await client.query(sql)

  expect(await introspect()).toMatchSnapshot()

  await client.end()
}
開發者ID:nunsie,項目名稱:prisma,代碼行數:12,代碼來源:relations.test.ts

示例7: http

	var request = (pokemon:number) => {
		if (pokemon <= maxPokemon) {
			http(endpoint + pokemon, (err, response, body) => {
				if (err) console.log(err);
				else if (body) {
					var pokemonData = JSON.parse(body);
					console.log(pokemonData.name);
					client.query(insertQuery.replace(/\?/g, (char:string, position:number, word:string) =>
							word.indexOf(char) === position ? pokemonData.national_id : pokemonData.name
					), (err, res) => {
						if (!err) request(++pokemon);
						else console.log(err);
					});
				}
			});
		} else {
			console.log("Finished querying");
			client.end();
		}
	};
開發者ID:Bonsanto,項目名稱:easy-db-dispatcher,代碼行數:20,代碼來源:main.ts

示例8:

client.query('SELECT $1::text as name', ['brianc'], (err, res) => {
  if (err) throw err;
  console.log(res);
  client.end();
});
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:5,代碼來源:pg-tests.ts

示例9: NOW

client.query('SELECT NOW()', (err, res) => {
  if (err) throw err;
  console.log(res);
  client.end();
});
開發者ID:AlexGalays,項目名稱:DefinitelyTyped,代碼行數:5,代碼來源:pg-tests.ts


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