From 1825c3040f5ee71ad26185a7a08f2657ede94df5 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Thu, 17 Sep 2026 16:51:17 +0200 Subject: rebase onto gg@v1.16.0/oblast --- errors.go | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 errors.go (limited to 'errors.go') diff --git a/errors.go b/errors.go deleted file mode 100644 index 0a58340..0000000 --- a/errors.go +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-FileCopyrightText: 2026 Stefan Majewsky -// SPDX-License-Identifier: Apache-2.0 - -package oblast - -import ( - "fmt" - "reflect" - "strings" -) - -// 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, ", ") -} -- cgit v1.3.1