From bce3df549ff4ccc8895697a3222269bd14fc22a4 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Fri, 10 Apr 2026 14:55:26 +0200 Subject: start reflecting on types to build a query plan --- plan_test.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 plan_test.go (limited to 'plan_test.go') diff --git a/plan_test.go b/plan_test.go new file mode 100644 index 0000000..0cf5afa --- /dev/null +++ b/plan_test.go @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2026 Stefan Majewsky +// SPDX-License-Identifier: Apache-2.0 + +package oblast_test + +import ( + "testing" + "time" + + "go.xyrillian.de/oblast" +) + +func TestPlan(t *testing.T) { + type Log struct { + oblast.TableInfo `db:"log_entries"` + oblast.PrimaryKeyInfo `db:"id"` + ID int64 `db:"id,auto"` + CreatedAt time.Time `db:"created_at"` + Message string `db:"message"` + private1 bool `db:"private1"` + } + + type record struct { + Log + Keks bool `db:"keks"` + private2 bool `db:"private2"` + } + + db := oblast.NewDB(nil, oblast.PostgresDialect()) + err := oblast.Keks[record](t.Context(), db) + if err != nil { + t.Error(err) + } + err = oblast.Keks[Log](t.Context(), db) + if err != nil { + t.Error(err) + } +} -- cgit v1.2.3