Skip to content

A simple package that encapsulates database operations.

License

Notifications You must be signed in to change notification settings

hashicorp/go-dbw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

dbw package

Go Reference Go Report Card Go Coverage

dbw is a database wrapper that supports connecting and using any database with a GORM driver.

dbw is intended to completely encapsulate an application's access to its database with the exception of migrations. dbw is intentionally not an ORM and it removes typical ORM abstractions like "advanced query building", associations and migrations.

Of course you can use dbw for complicated queries, it's just that dbw doesn't try to reinvent SQL by providing some sort of pattern for building them with functions. Of course, dbw also provides lookup/search functions when you simply need to read resources from the database.

dbw strives to make CRUD for database resources fairly trivial for common use cases. It also supports an WithOnConflict(...) option for its RW.Create(...) function for complex scenarios. dbw also allows you to opt out of its CRUD functions and use exec, query and scan rows directly. You may want to carefully weigh when it's appropriate to use exec and query directly, since it's likely that each time you use them you're leaking a bit of your database layer schema into your application's domain.