Skip to content

Commit

Permalink
feat: implemented ExistsOboGraph method
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersiddhu committed Sep 12, 2018
1 parent 0327b9d commit 45a14e4
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions storage/arangodb/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,29 @@ func (a *arangoSource) SaveOboGraphInfo(g graph.OboGraph) error {
properties: dp,
},
}
_, err := a.graphc.CreateDocument(context.Background(), dg)
ctx := driver.WithSilent(context.Background())
_, err := a.graphc.CreateDocument(ctx, dg)
return err
}

func (a *arangoSource) ExistsOboGraph(g graph.OboGraph) bool {
panic("not implemented")
ctx := driver.WithQueryCount(context.Background())
query := `FOR d in @@collection
FILTER d.id == @identifier
RETURN d`
bindVars := map[string]interface{}{
"@collection": a.graphc.Name(),
"identifier": g.ID(),
}
cursor, err := a.database.Query(ctx, query, bindVars)
if err != nil {
return false
}
defer cursor.Close()
if cursor.Count() > 0 {
return true
}
return false
}

func (a *arangoSource) IsUpdatedOboGraph(g graph.OboGraph) bool {
Expand Down

0 comments on commit 45a14e4

Please sign in to comment.