Jeff Mitchell
5333482ff8
Fix gorm newlines issue ( #108 )
...
Even if you made a custom formatter for gorm, it would blithely println
anything returned, including nils, resulting in lots of new lines when
we were ignoring output. This also creates a custom logger that doesn't
do anything when newlines are found.
2020-06-08 21:12:00 -04:00
Jim and Jim Lambert
e3fdb493b8
prevent primary key updates ( #95 )
...
* prevent primary key updates
* better error to return
Co-authored-by: Jim Lambert <jimlambrt@Jims-MBP-3.home >
2020-06-03 09:51:34 -04:00
Jeff Mitchell
c175fcde8d
Add a gorm log formatter to adapt to hclog ( #93 )
...
This is also added in a test that otherwise output to stdout, which
validates functionality.
2020-06-01 17:32:48 -04:00
Michael Gaffney
5bdd8a46ea
Extract timestamp scanners into reusable package ( #91 )
...
* Refactor: move Timestamp from static/store to db/timestamp
* Refactor: convert remaining Timestamps to timestamp.Timestamp
* Use new db timestamp
2020-06-01 11:46:50 -04:00
Jim
ef6edbd515
Null updates ( #78 )
2020-05-31 19:55:56 -04:00
Jim
b75feb957d
require fieldMaskPaths in Update and refactor errors ( #71 )
2020-05-21 09:24:37 -04:00
Jim
ee46266893
ErrRecordNotFound from LookupWhere() when no rows found ( #59 )
2020-05-18 12:57:45 -04:00
2aca5fff03
fix transaction rollbacks in DoTx ( #55 )
...
* fix transaction rollbacks in DoTx
* better assertion
* Update internal/db/read_writer_test.go
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com >
Co-authored-by: Jim Lambert <jimlambrt@Jims-MBP-3.home >
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com >
2020-05-15 08:38:36 -04:00
Michael Gaffney
8d7f24268c
Return url of test database ( #48 )
...
It is helpful to connect to a database when tests have failed.
2020-05-12 15:49:37 -04:00
Jim
c04c73453f
refactor Update/Delete to return the number of rows affected. ( #46 )
2020-05-12 11:57:28 -04:00
Jim
61ca88dac9
refactor to use db.New() and clean up error msgs ( #45 )
2020-05-12 06:51:02 -04:00
Jeff Mitchell
ad8d4e9c80
Rename Db's Tx to underlying
2020-05-11 21:05:11 -04:00
Jeff Mitchell
670abaed88
Rename GormReadWriter -> Db
2020-05-11 16:54:05 -04:00
Jim
ee4a0d3f45
refactor lookups so we can easily check for not found and do the "right" thing in the repos ( #42 )
2020-05-11 16:21:09 -04:00
Jeff Mitchell
7f2aa5ca8f
Add httpfs DB migrations and generate the input ( #35 )
2020-05-11 12:42:10 -04:00
Jim
725a777baf
refactor friendly name to just be name ( #29 )
2020-05-05 16:35:24 -04:00
Jim
27b4d7a034
basic internal db interfaces and Gorm implementation
...
* db reader and writer interfaces which should allow us to encapsulate the vast majority of database code in this package.
* GormReadWriter implementation of the Reader and Writer interfaces
2020-05-05 13:29:47 -04:00