Skip to content

Commit

Permalink
add the limit(1) for Operation.Get
Browse files Browse the repository at this point in the history
  • Loading branch information
xgfone committed May 29, 2024
1 parent d9f14e5 commit 102a0ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dml_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (o Operation[T]) Get(conds ...op.Condition) (obj T, ok bool, err error) {

// GetContext just queries a result.
func (o Operation[T]) GetContext(ctx context.Context, conds ...op.Condition) (obj T, ok bool, err error) {
err = o.SelectStruct(obj).Where(conds...).BindRowStructContext(ctx, &obj)
err = o.SelectStruct(obj).Where(conds...).Limit(1).BindRowStructContext(ctx, &obj)
ok, err = CheckErrNoRows(err)
return
}
Expand Down

0 comments on commit 102a0ce

Please sign in to comment.