@@ -60,7 +60,7 @@ func QueryValueOrDefault[T any](ctx context.Context, query string, args ...any)
60
60
}
61
61
62
62
// QueryRowStruct queries a row and scans it as struct.
63
- func QueryRowStruct [S ~ struct {} ](ctx context.Context , query string , args ... any ) (row * S , err error ) {
63
+ func QueryRowStruct [S any ](ctx context.Context , query string , args ... any ) (row * S , err error ) {
64
64
err = Conn (ctx ).QueryRow (query , args ... ).ScanStruct (& row )
65
65
if err != nil {
66
66
return nil , err
@@ -70,7 +70,7 @@ func QueryRowStruct[S ~struct{}](ctx context.Context, query string, args ...any)
70
70
71
71
// QueryRowStructOrNil queries a row and scans it as struct
72
72
// or returns nil in case of sql.ErrNoRows.
73
- func QueryRowStructOrNil [S ~ struct {} ](ctx context.Context , query string , args ... any ) (row * S , err error ) {
73
+ func QueryRowStructOrNil [S any ](ctx context.Context , query string , args ... any ) (row * S , err error ) {
74
74
err = Conn (ctx ).QueryRow (query , args ... ).ScanStruct (& row )
75
75
if err != nil {
76
76
if errors .Is (err , sql .ErrNoRows ) {
@@ -85,7 +85,7 @@ func QueryRowStructOrNil[S ~struct{}](ctx context.Context, query string, args ..
85
85
// and scan it into a struct of type S that must have tagged fields
86
86
// with primary key flags to identify the primary key column names
87
87
// for the passed pkValue+pkValues and a table name.
88
- func GetRow [S ~ struct {} ](ctx context.Context , pkValue any , pkValues ... any ) (row * S , err error ) {
88
+ func GetRow [S any ](ctx context.Context , pkValue any , pkValues ... any ) (row * S , err error ) {
89
89
// Using explicit first pkValue value
90
90
// to not be able to compile without any value
91
91
pkValues = append ([]any {pkValue }, pkValues ... )
@@ -119,7 +119,7 @@ func GetRow[S ~struct{}](ctx context.Context, pkValue any, pkValues ...any) (row
119
119
// for the passed pkValue+pkValues and a table name.
120
120
// Returns nil as row and error if no row could be found with the
121
121
// passed pkValue+pkValues.
122
- func GetRowOrNil [S ~ struct {} ](ctx context.Context , pkValue any , pkValues ... any ) (row * S , err error ) {
122
+ func GetRowOrNil [S any ](ctx context.Context , pkValue any , pkValues ... any ) (row * S , err error ) {
123
123
row , err = GetRow [S ](ctx , pkValue , pkValues ... )
124
124
if err != nil {
125
125
if errors .Is (err , sql .ErrNoRows ) {
0 commit comments