aboutsummaryrefslogtreecommitdiff
path: root/oblast.go
diff options
context:
space:
mode:
Diffstat (limited to 'oblast.go')
-rw-r--r--oblast.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/oblast.go b/oblast.go
index 588471b..837742d 100644
--- a/oblast.go
+++ b/oblast.go
@@ -144,6 +144,15 @@ func StructTagKeyIs(key string) PlanOption {
return func(opts *planOpts) { opts.StructTagKey = key }
}
+// ReadOnly is a PlanOption that disables all write operations for the resulting [Store] type
+// (i.e., [Store.Insert], [Store.Update], [Store.Upsert] and [Store.Delete]).
+// Besides read-only tables (i.e. tables where the current user lacks write permissions),
+// this is useful for record types that only model a few columns of a table and which,
+// when used in write operations, might result in incomplete records.
+func ReadOnly() PlanOption {
+ return func(opts *planOpts) { opts.ReadOnly = true }
+}
+
// Store 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] values were provided during [NewStore].
type Store[R any] struct {