1234567891011121314151617181920 |
- const pgp = require('pg-promise')();
- const fs = require('fs');
- // 连接到数据库
- import {pgClient} from "../../db/pg-instance"
- import {initDataSQL} from "../data/init-data.sql"
- // 执行SELECT语句并返回结果的函数
- export async function importData() {
- console.log("加载初始化数据")
- try {
- // 查询:数据库版本信息
- const data = await pgClient().any(initDataSQL);
- console.log(data)
- return data;
- } catch (error) {
- console.error('Error executing query:', error);
- return null;
- }
- }
|