add arangodb integration

This commit is contained in:
sovlookup 2021-01-28 22:17:39 +08:00
parent 13aab3b809
commit 0e7e5920c6
1 changed files with 69 additions and 67 deletions

View File

@ -53,10 +53,10 @@ class ArangoDBIntegration {
try {
const result = await this.client.query(query.sql)
let rl = []
await result.forEach((r)=> rl.push(r))
await result.forEach(r => rl.push(r))
return rl
} catch (err) {
console.error("Error querying arangodb",err.message)
console.error("Error querying arangodb", err.message)
throw err
} finally {
this.client.close()
@ -66,12 +66,14 @@ class ArangoDBIntegration {
async create(query) {
const clc = this.client.collection(this.config.collection)
try {
const result = await this.client.query(aql`INSERT ${query.json} INTO ${clc} LET n = NEW RETURN NEW`)
const result = await this.client.query(
aql`INSERT ${query.json} INTO ${clc} LET n = NEW RETURN NEW`
)
let rl = []
await result.forEach((r)=> rl.push(r))
await result.forEach(r => rl.push(r))
return rl
} catch (err) {
console.error("Error querying arangodb",err.message)
console.error("Error querying arangodb", err.message)
throw err
} finally {
this.client.close()