Jim
591ec476e7
refactor: Update internal/db and oplog to use go-dbw package for database operations. ( #1785 )
...
* chore: Add new dbw dependency
* refactor: Convert to use dbw.DB
* refactor (db): Change GetTicket(...) signature
* feature (db tests): Added TestDeleteWhere(...)
Adding this allows us to eliminate a leak of the gorm library
* refactor: Add ctx to ScanRows(...) signature
This is required to refactor all the deprecated errors pkg calls.
This refactor required adding a context to quite a few call chains
and in particular the job scheduler bits
* feature (db/tests): Add support for test opt: WithTestLogLevel(...)
This test only option allows callers to specify a log level for the
underlying db package (where supported/applicable) when calling
TestSetup(...)
* refactor (db): Simplify Db type
Only store the underlying *DB and create the *RW on demand when
needed.
* refactor (oplog): Port to using dbw pkg for db operations
* refactor (db): Remove gormDB(...) func
* tests (db): Add unit tests for TestDeleteWhere(...)
* chore: make fmt changes to formatting
2022-01-05 14:38:38 -05:00
Jim
1b6c9a25c8
Add more opts when using Create + WithOnConflict ( #1706 )
2021-11-14 09:52:18 -05:00
Jim
1ac151100e
docs (internal/db): Add docs Update/Delete operations using WithWhere ( #1687 )
2021-11-11 16:13:44 -05:00
Jim
c047c4d89d
refactor (db): Remove the internal/db test tables from the migrations ( #1675 )
2021-11-09 11:58:57 -05:00
Jim
4df3b40def
feature (db): Add support for multi-column PKs ( #1658 )
2021-11-03 14:04:47 -04:00
Jim
1ce9a71b53
feature (db): Add on conflict support to db.Create(...) ( #1612 )
2021-10-21 11:11:56 -04:00
Jim
8d6dee09a9
refact: Add db.DB wrapper and refact all test fixtures to use it. ( #1535 )
...
* refact: Changes required for gorm v2
* refact: Add db.DB wrapper and refact all test fixtures to use it
Stop leaking the gorm abstraction within our unit tests.
* refact: Migrate direct calls to pq to pgx driver
The refactor will remove the remaining direct dependencies on
the pq driver which has been deprecated in favor of the pgx
driver.
It includes the addition of common.SqlOpen which is a wrapper around
sql.Open, which is needed to deal with the driver name changing from
"postgres" to "pgx" but in our code base the dialect and driver are
synonyms.
2021-09-30 09:17:27 -04:00
Jim
136ac00b49
refact: Changes required for gorm v2 ( #1528 )
2021-09-30 08:47:34 -04:00
s-christoff and Jim
6b78108ecf
Update primary error functions to take a context, deprecate old functions ( #1358 )
...
* add new error funcs which take a ctx and deprecate existing funcs
* use context where available when writing error events
* remove circular internal/errors pkg dep
* suppress some chatty errors using errors.WithoutEvent()
* convert auth oidc funcs to take context where needed to write events
Co-authored-by: Jim <jlambert@hashicorp.com >
2021-07-29 20:52:56 -04:00
Jeff Mitchell
140c54e319
Repoint base62 import
2021-07-14 17:31:58 -07:00
Jeff Mitchell
2cbcf9a563
Update usage of shared-secure-libs ( #1393 )
2021-07-12 21:06:22 -04:00
Louis Ruch
054549d81e
Allow where without args in searchWhere ( #1333 )
...
* Allow where without args in searchWhere
2021-06-20 16:16:51 -07:00
Jeff Mitchell
6f34da8923
Add cleanup of dead connections no longer reported by a worker ( #1220 )
2021-05-14 13:23:12 -04:00
Louis Ruch
84656dbfea
ICU-747,ICU-748/refactor internal/oplog and internal/perms to use domain errors ( #854 )
...
* Refactor internal/oplog to domain errors
* Refactor internal/perms
* Update changelog
2021-01-13 15:50:07 -08:00
Louis Ruch
8151b30ce9
ICU-743/Domain errors internal/kms refactor ( #848 )
...
* Domain errors internal/kms refactor
* Update changelog
* Update internal/host error op
* Incorrect error returned in read_writer
2021-01-12 08:50:19 -08:00
Michael Gaffney and Jeff Mitchell
94cb79bbdd
See how Boundary would look with gofumpt applied ( #853 )
...
* See how Boundary would look with https://github.com/mvdan/gofumpt applied
Results of running `gofumpt -w -s .`
* Update tools file and Makefile for gofumpt
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com >
2021-01-07 10:02:32 -05:00
Louis Ruch
4e31fdb10e
Swap assert.Eqaul actual/expected ( #849 )
2021-01-05 17:34:04 -08:00
Louis Ruch
bfbb179741
ICU-738/Refactor internal/db to domain errors ( #815 )
...
* Refactor internal/db to domain errors
2020-12-21 10:07:34 -08:00
Jim
af6ef1b687
Refactor existing sentinel errors ( #774 )
2020-11-05 16:54:03 -05:00
Jim
09b43e5569
deprecate/remove LookupByName ( #530 )
2020-10-05 12:45:27 -04:00
Jim
1e71c55920
deprecate access to underlying *sql.DB via internal/db.DB() ( #506 )
2020-09-30 18:11:59 -04:00
Jim
21ca0b6388
SetAssociatedAccounts, DisassociateAccounts, AssociateAccounts with support for multiple accounts. ( #439 )
2020-09-25 13:35:32 -04:00
Jim
611288bdc7
basic sessions ( #337 )
2020-09-16 12:02:02 -04:00
Michael Gaffney
de162c5533
Replace and remove ErrNilParameter with ErrInvalidParameter ( #295 )
2020-08-25 12:18:14 -04:00
Jim
9570897032
basic keys mgmt repo ( #264 )
2020-08-19 16:47:18 -04:00
Jeff Mitchell
6661117d4c
The name. The name. The name!
2020-08-10 17:15:02 -04:00
Jim
1c836c430b
support for associating/disassociating an auth account with a user ( #233 )
2020-08-10 15:17:15 -04:00
Todd Knight
b7bf76a9ba
Auth Method API Handler for CRUDL (not updating password specific fields)( #239 )
2020-08-06 12:50:20 -07:00
Michael Gaffney
5e8179c6fb
Allow lookupAfterWrite for resources with Private Ids ( #229 )
2020-07-30 13:44:14 -04:00
Jim
1bebe7a261
Convert option db.WithVersion to *uint32 ( #195 )
2020-07-15 13:12:15 -04:00
bcdcaffa6f
Port over 162 and 165 to master ( #176 )
...
Co-authored-by: Jim Lambert <jlambert@hashicorp.com >
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com >
2020-07-10 15:46:26 -04:00
Todd Knight
bb4a185412
Pushing test db cleanup up to where the database objects are created using t.Cleanup. ( #166 )
2020-07-06 10:15:01 -07:00
Jim
d0a846823a
support for NewOplogMsgs() option when calling CreateItems and DeleteItems ( #158 )
2020-07-01 05:40:02 -04:00
Jim
8d8bb42418
add CreateItems and DeleteItems to writer interface ( #156 )
2020-06-29 19:28:15 -04:00
Jim
3e3144117e
iam and auth integration ( #144 )
2020-06-29 08:18:57 -04:00
Jim
9a87df38c7
add CreateItems() and DeleteItems() ( #146 )
2020-06-29 06:31:23 -04:00
Michael Gaffney
d69588131c
Fix for panic in db.setFieldsToNil ( #155 )
2020-06-28 16:55:57 -04:00
Jim
6641244734
add support for WithVersion option to updates ( #126 )
2020-06-24 12:33:49 -04:00
Todd Knight
0c8385b423
Updating TxHandler to accept a reader as well in order to support reads inside the same transactions as writes. ( #139 )
2020-06-22 13:27:26 -07:00
Jim
d9073a03d5
listing users ( #118 )
2020-06-16 18:59:30 -04:00
Jim
2d18177c9d
oplog support for null field updates ( #107 )
2020-06-10 06:56:46 -04:00
Jim
c70847fbac
refactor delete test to be table driven. ( #102 )
2020-06-09 21:22:15 -04:00
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