diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-04-12 19:13:50 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-04-12 19:13:55 +0200 |
| commit | a23dd12a27237a5e0d6883cd30373408a2f28f6e (patch) | |
| tree | 633264b882173c21c93b0325a15f9c53398ba05b /store.go | |
| parent | 9b5b72a549643a9e611f55ae8154fa801c808e5b (diff) | |
| download | go-oblast-a23dd12a27237a5e0d6883cd30373408a2f28f6e.tar.gz | |
add initial sketches for Store.Insert, Store.Update
Currently extremely bad performance for some reason. Need to investigate.
Diffstat (limited to 'store.go')
| -rw-r--r-- | store.go | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/store.go b/store.go deleted file mode 100644 index 4ab0f4b..0000000 --- a/store.go +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net> -// SPDX-License-Identifier: Apache-2.0 - -package oblast - -import ( - "reflect" - - "go.xyrillian.de/oblast/internal" -) - -// Store is the main interface of this library. -// It holds information on how to read and write data into record type R, and can also be used to execute autogenerated queries if the respective [PlanOption]s were provided during [NewStore]. -type Store[R any] struct { - plan internal.Plan -} - -// NewStore initializes a store for record type R. -func NewStore[R any](dialect Dialect, opts ...PlanOption) (Store[R], error) { - var popts internal.PlanOpts - for _, opt := range opts { - opt(&popts) - } - plan, err := internal.BuildPlan(reflect.TypeFor[R](), dialect, popts) - return Store[R]{plan}, err -} - -// MustNewStore is like [NewStore], but panics on error. -func MustNewStore[R any](dialect Dialect, opts ...PlanOption) Store[R] { - store, err := NewStore[R](dialect, opts...) - if err != nil { - panic(err.Error()) - } - return store -} |
