Skip to content

Commit 7f8daf0

Browse files
committed
Drop unused sliceType argument from bind
1 parent b5b94dd commit 7f8daf0

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

queries/reflect.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ func (q *Query) BindGP(ctx context.Context, obj any) {
115115
// For custom objects that want to use eager loading, please see the
116116
// loadRelationships function.
117117
func Bind(rows *sql.Rows, obj any) error {
118-
structType, sliceType, singular, err := bindChecks(obj)
118+
structType, _, singular, err := bindChecks(obj)
119119
if err != nil {
120120
return err
121121
}
122122

123-
return bind(rows, obj, structType, sliceType, singular)
123+
return bind(rows, obj, structType, singular)
124124
}
125125

126126
// Bind executes the query and inserts the
@@ -133,7 +133,7 @@ func Bind(rows *sql.Rows, obj any) error {
133133
//
134134
// Also see documentation for Bind()
135135
func (q *Query) Bind(ctx context.Context, exec boil.Executor, obj any) error {
136-
structType, sliceType, bkind, err := bindChecks(obj)
136+
structType, _, bkind, err := bindChecks(obj)
137137
if err != nil {
138138
return err
139139
}
@@ -147,7 +147,7 @@ func (q *Query) Bind(ctx context.Context, exec boil.Executor, obj any) error {
147147
if err != nil {
148148
return errors.Wrap(err, "bind failed to execute query")
149149
}
150-
if err = bind(rows, obj, structType, sliceType, bkind); err != nil {
150+
if err = bind(rows, obj, structType, bkind); err != nil {
151151
if innerErr := rows.Close(); innerErr != nil {
152152
return errors.Wrapf(err, "error on rows.Close after bind error: %+v", innerErr)
153153
}
@@ -223,7 +223,7 @@ func bindChecks(obj any) (structType reflect.Type, sliceType reflect.Type, bkind
223223
}
224224
}
225225

226-
func bind(rows *sql.Rows, obj any, structType, sliceType reflect.Type, bkind bindKind) error {
226+
func bind(rows *sql.Rows, obj any, structType reflect.Type, bkind bindKind) error {
227227
cols, err := rows.Columns()
228228
if err != nil {
229229
return errors.Wrap(err, "bind failed to get column names")
@@ -257,9 +257,6 @@ Rows:
257257
newStruct = makeStructPtr(structType)
258258
pointers = PtrsFromMapping(reflect.Indirect(newStruct), mapping)
259259
}
260-
if err != nil {
261-
return err
262-
}
263260

264261
if err := rows.Scan(pointers...); err != nil {
265262
return errors.Wrap(err, "failed to bind pointers to obj")

0 commit comments

Comments
 (0)