Skip to content

Commit

Permalink
feat: add NewDataSourceFromDb function
Browse files Browse the repository at this point in the history
  • Loading branch information
cybersiddhu committed Sep 16, 2021
1 parent b6678c6 commit 0499d23
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions storage/arangodb/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ func validateAll(ai ...interface{}) error {
return nil
}

func NewDataSourceFromDb(db *manager.Database, collP *CollectionParams) (storage.DataSource, error) {
if err := validateAll(collP); err != nil {
return &arangoSource{}, err
}
oc, err := CreateCollection(db, collP)
if err != nil {
return &arangoSource{}, err
}
return &arangoSource{
database: db,
termc: oc.Term,
relc: oc.Rel,
graphc: oc.Cv,
obog: oc.Obog,
}, nil
}

func NewDataSource(connP *ConnectParams, collP *CollectionParams) (storage.DataSource, error) {
var ds *arangoSource
if err := validateAll(connP, collP); err != nil {
Expand Down

0 comments on commit 0499d23

Please sign in to comment.