Skip to content

Commit

Permalink
feat: custom db name
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <danscode@selman.org>
  • Loading branch information
dselman committed Dec 12, 2023
1 parent b032a0c commit 6e1d423
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/graphmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ export class GraphModel {
}
}

async openSession(): Promise<Context> {
async openSession(database='neo4j'): Promise<Context> {
if (this.driver) {
const session = this.driver.session({ database: 'neo4j' })
const session = this.driver.session({ database })
return { session };
}
throw new Error('No neo4j driver!');
Expand Down Expand Up @@ -402,7 +402,6 @@ export class GraphModel {
if (result.getFullyQualifiedType() !== decl.getFullyQualifiedName()) {
throw new Error(`Deserialized ${result.getFullyQualifiedType()} but expected ${decl.getFullyQualifiedName()}`);
}

const keys = Object.keys(properties)
const newProperties = {};
for(let n=0; n < keys.length; n++) {
Expand Down Expand Up @@ -433,9 +432,11 @@ export class GraphModel {
}
else {
Object.keys(value).forEach( childKey => {
const childValue = value[childKey];
// TODO DCS - support map values that are objects...
newProperties[`${key}_${childKey}`] = childValue;
if(key !== '$class') {
const childValue = value[childKey];
// TODO DCS - support map values that are objects...
newProperties[`${key}_${childKey}`] = childValue;
}
});
}
}
Expand Down

0 comments on commit 6e1d423

Please sign in to comment.