move ScanAll/ScanSingle in sq package

This commit is contained in:
2022-12-11 03:14:42 +01:00
parent 26cd1533b4
commit 98b1e8bd80
9 changed files with 21 additions and 61 deletions

View File

@@ -3,6 +3,7 @@ package models
import (
"github.com/jmoiron/sqlx"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"gogs.mikescher.com/BlackForestBytes/goext/sq"
"time"
)
@@ -61,7 +62,7 @@ func (s SubscriptionDB) Model() Subscription {
}
func DecodeSubscription(r *sqlx.Rows) (Subscription, error) {
data, err := scanSingle[SubscriptionDB](r)
data, err := sq.ScanSingle[SubscriptionDB](r, true)
if err != nil {
return Subscription{}, err
}
@@ -69,7 +70,7 @@ func DecodeSubscription(r *sqlx.Rows) (Subscription, error) {
}
func DecodeSubscriptions(r *sqlx.Rows) ([]Subscription, error) {
data, err := scanAll[SubscriptionDB](r)
data, err := sq.ScanAll[SubscriptionDB](r, true)
if err != nil {
return nil, err
}