add arangodb integration
This commit is contained in:
parent
1b6eb426c6
commit
8996200d8d
|
@ -53,10 +53,10 @@ class ArangoDBIntegration {
|
||||||
try {
|
try {
|
||||||
const result = await this.client.query(query.sql)
|
const result = await this.client.query(query.sql)
|
||||||
let rl = []
|
let rl = []
|
||||||
await result.forEach((r)=> rl.push(r))
|
await result.forEach(r => rl.push(r))
|
||||||
return rl
|
return rl
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error querying arangodb",err.message)
|
console.error("Error querying arangodb", err.message)
|
||||||
throw err
|
throw err
|
||||||
} finally {
|
} finally {
|
||||||
this.client.close()
|
this.client.close()
|
||||||
|
@ -66,12 +66,14 @@ class ArangoDBIntegration {
|
||||||
async create(query) {
|
async create(query) {
|
||||||
const clc = this.client.collection(this.config.collection)
|
const clc = this.client.collection(this.config.collection)
|
||||||
try {
|
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 = []
|
let rl = []
|
||||||
await result.forEach((r)=> rl.push(r))
|
await result.forEach(r => rl.push(r))
|
||||||
return rl
|
return rl
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error querying arangodb",err.message)
|
console.error("Error querying arangodb", err.message)
|
||||||
throw err
|
throw err
|
||||||
} finally {
|
} finally {
|
||||||
this.client.close()
|
this.client.close()
|
||||||
|
|
Loading…
Reference in New Issue