diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-04-17 14:53:52 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-04-17 14:53:55 +0200 |
| commit | 52f44287216b47149da9eb3f038408447f0e5981 (patch) | |
| tree | 8b81794b83d11b26e6753f65d65641b34336995c /oblast.go | |
| parent | e73aee05956d7917e7d76ab793d5e2291ace6416 (diff) | |
| download | go-oblast-52f44287216b47149da9eb3f038408447f0e5981.tar.gz | |
improve test coverage, error reporting for Select()
Diffstat (limited to 'oblast.go')
| -rw-r--r-- | oblast.go | 19 |
1 files changed, 0 insertions, 19 deletions
@@ -100,7 +100,6 @@ import ( "database/sql/driver" "fmt" "reflect" - "strings" ) var ( @@ -171,21 +170,3 @@ func MustNewStore[R any](dialect Dialect, opts ...PlanOption) Store[R] { } return store } - -// MissingRecordError is returned by [Store.Update] if one of the rows to be updated does not exist in the DB. -type MissingRecordError[R any] struct { - // The record that was provided to [Store.Update], - // but for which no row with the same primary key values could be located. - Record R - plan plan -} - -// Error implements the builtin/error interface. -func (e MissingRecordError[R]) Error() string { - keyDescs := make([]string, len(e.plan.PrimaryKeyColumnNames)) - v := reflect.ValueOf(e.Record) - for idx, columnName := range e.plan.PrimaryKeyColumnNames { - keyDescs[idx] = fmt.Sprintf("%s = %#v", columnName, v.FieldByIndex(e.plan.IndexByColumnName[columnName])) - } - return "could not UPDATE record that does not exist in the database: " + strings.Join(keyDescs, ", ") -} |
