Extract sql.Database interface to external package #204

Closed
opened 2022-03-10 03:47:31 +00:00 by i-norden · 1 comment
Member

If we want to use this SQL database interface abstraction, which enables supporting multiple different SQL databases and/or drivers, in our other repos that don't already have a dependency on vulcanzie-geth it would be preferable to extract this interface out to a different repository.

The driver component of the interface is mostly generic with respect to database schema, except it does have the NodeInfo method which is meaningless outside of our ipld-eth-db context.

The tx, stats interfaces are schema agnostic.

The statements interface is not, as these methods are for returning INSERT statements specific to our database schema (the reason it is abstracted is because the same insert operation for the same table model can have different syntax depending on the SQL database and driver).

If we want to use [this](https://github.com/vulcanize/go-ethereum/blob/v1.10.16-statediff-v3/statediff/indexer/database/sql/interfaces.go#L26) SQL database interface abstraction, which enables supporting multiple different SQL databases and/or drivers, in our other repos that don't already have a dependency on vulcanzie-geth it would be preferable to extract this interface out to a different repository. The [driver](https://github.com/vulcanize/go-ethereum/blob/v1.10.16-statediff-v3/statediff/indexer/database/sql/interfaces.go#L32) component of the interface is *mostly* generic with respect to database schema, except it does have the `NodeInfo` method which is meaningless outside of our ipld-eth-db context. The [tx](https://github.com/vulcanize/go-ethereum/blob/v1.10.16-statediff-v3/statediff/indexer/database/sql/interfaces.go#L60), [stats](https://github.com/vulcanize/go-ethereum/blob/v1.10.16-statediff-v3/statediff/indexer/database/sql/interfaces.go#L78) interfaces are schema agnostic. The [statements](https://github.com/vulcanize/go-ethereum/blob/v1.10.16-statediff-v3/statediff/indexer/database/sql/interfaces.go#L45) interface is not, as these methods are for returning INSERT statements specific to our database schema (the reason it is abstracted is because the same insert operation for the same table model can have different syntax depending on the SQL database and driver).
Author
Member
Tracked in https://github.com/cerc-io/ipld-eth-utils/issues/1
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/go-ethereum#204
No description provided.