-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(drivers): create the interface for the driver and how it's used
- Loading branch information
1 parent
ca0a935
commit dc018a5
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package drivers | ||
|
||
// NB. In this file, the interfaces refer to "table", as per a SQL | ||
// type database. This naming convention may differ, such as "collection" | ||
// in a MongoDB instance. However, the functionality will remain the | ||
// same from an interface point of view. | ||
|
||
type Driver interface { | ||
// Authorize the connection to the database | ||
Auth() error | ||
|
||
// Close the database connection and free up resources | ||
Close() error | ||
|
||
// Insert data in bulk | ||
InsertBulk(table string, data []map[string]interface{}) (inserted int, err error) | ||
|
||
// Remove all the data from the table | ||
Truncate(table string) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package gobblr | ||
|
||
import "github.com/mrsimonemms/gobblr/pkg/drivers" | ||
|
||
func Execute(dataPath string, driver drivers.Driver) (map[string]int, error) { | ||
inserted := make(map[string]int, 0) | ||
|
||
return inserted, nil | ||
} |