From 743a9f457b1682ee6a2883753102f5cf579ea9ae Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Mon, 18 May 2026 23:09:08 +0200 Subject: replace Wrap with NewDB/NewConn/NewTx --- oblast.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'oblast.go') diff --git a/oblast.go b/oblast.go index 5adb33e..78b498f 100644 --- a/oblast.go +++ b/oblast.go @@ -24,9 +24,7 @@ // // Then use it many times to perform load and store operations: // -// func doStuff(db *sql.DB) error { -// dbh := oblast.Wrap(db) -// +// func doStuff(db *oblast.DB) error { // newEntry := LogEntry{ // CreatedAt: time.Now(), // Message: "Hello World.", @@ -44,6 +42,10 @@ // fmt.Printf("there are %d log entries so far", len(allEntries)) // } // +// In this example, "oblast.DB" is a thin wrapper around [*sql.DB], which can be obtained with the [NewDB] function. +// A [*DB] can be used in the same way as an [*sql.DB], but if Oblast is only to be used for specific functions, +// then individual [*sql.Conn] or [*sql.Tx] instances can also be wrapped with the [NewConn] and [NewTx] functions. +// // # Mapping rules for record types // // If the database column has a different name (or casing, e.g. "id" vs. "ID") than the field name, provide it in the field tag "db". @@ -133,9 +135,7 @@ func StructTagKeyIs(key string) PlanOption { return func(opts *planOpts) { opts.StructTagKey = key } } -// Store is the main interface of this library. -// -// It holds information on how to read and write data into record type R, +// 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 { dialect Dialect -- cgit v1.2.3