Skip to content

Create a NewTransaction function #6

@Smuzzy-waiii

Description

@Smuzzy-waiii

Currently all the functions of onyx take in a *badger.Txn as their final argument which lets the user pass in a transaction under which the graph operation should be executed. However, currently there is no way for users of Onyx to actually create a new *badger.Txn without calling graph.DB.NewTransaction(), which requires the DB field of the Graph struct to be publicly exposed, which is not ideal.

Create a function NewTransaction on the Graph struct which returns a *badger.Txn for the users to use. Note that NewTransaction should take in a boolean which tells it if a read-only txn or a read-write txn.

Remember to create a unit test for this function!

psst, remember to update the usage guide in the README too 👀

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions