当前位置: 首页>>代码示例>>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;未经允许,请勿转载。