aboutsummaryrefslogtreecommitdiff
path: root/plan_test.go
blob: 0cf5afa54a2881f67922646200eec81019d9a89b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net>
// 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)
	}
}