Skip to content

Commit 36a6226

Browse files
committed
Remove unneeded generics.
1 parent 33ea564 commit 36a6226

File tree

4 files changed

+6
-27
lines changed

4 files changed

+6
-27
lines changed

driver/driver.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ func (s *stmt) setupBindings(args []driver.NamedValue) (err error) {
546546
err = s.Stmt.BindTime(id, a, s.tmWrite)
547547
case util.JSON:
548548
err = s.Stmt.BindJSON(id, a.Value)
549-
case util.PointerUnwrap:
550-
err = s.Stmt.BindPointer(id, util.UnwrapPointer(a))
549+
case util.Pointer:
550+
err = s.Stmt.BindPointer(id, a.Value)
551551
case nil:
552552
err = s.Stmt.BindNull(id)
553553
default:
@@ -565,7 +565,7 @@ func (s *stmt) CheckNamedValue(arg *driver.NamedValue) error {
565565
switch arg.Value.(type) {
566566
case bool, int, int64, float64, string, []byte,
567567
time.Time, sqlite3.ZeroBlob,
568-
util.JSON, util.PointerUnwrap,
568+
util.JSON, util.Pointer,
569569
nil:
570570
return nil
571571
default:

internal/util/pointer.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
package util
22

3-
type Pointer[T any] struct{ Value T }
4-
5-
func (p Pointer[T]) unwrap() any { return p.Value }
6-
7-
type PointerUnwrap interface{ unwrap() any }
8-
9-
func UnwrapPointer(p PointerUnwrap) any {
10-
return p.unwrap()
11-
}
3+
type Pointer struct{ Value any }

internal/util/pointer_test.go

Lines changed: 0 additions & 13 deletions
This file was deleted.

pointer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ import "github.com/ncruces/go-sqlite3/internal/util"
88
// [Value.Pointer], or [Context.ResultPointer].
99
//
1010
// https://sqlite.org/bindptr.html
11-
func Pointer[T any](value T) any {
12-
return util.Pointer[T]{Value: value}
11+
func Pointer(value any) any {
12+
return util.Pointer{Value: value}
1313
}

0 commit comments

Comments
 (0)