Skip to content

Commit

Permalink
GetByQuery に Limit(1) をつける対応
Browse files Browse the repository at this point in the history
  • Loading branch information
simiraaaa committed May 11, 2022
1 parent 953bdf1 commit 8ed6a4f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cloudfirestore/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func GetMulti(ctx context.Context, client *firestore.Client, docRefs []*firestor

// GetByQuery ... クエリで単体取得する(tx対応)
func GetByQuery(ctx context.Context, query firestore.Query, dst interface{}) (bool, error) {
query = query.Limit(1)
var it *firestore.DocumentIterator
if tx := getContextTransaction(ctx); tx != nil {
it = tx.Documents(query)
Expand Down

0 comments on commit 8ed6a4f

Please sign in to comment.