Skip to content

Commit

Permalink
Merge pull request #8 from rabee-inc/feature/refactor-get-by-query
Browse files Browse the repository at this point in the history
GetByQuery に Limit(1) をつける対応
  • Loading branch information
aikizoku authored Aug 24, 2022
2 parents 2bd6b79 + 8ed6a4f commit b08c1dc
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 b08c1dc

Please sign in to comment.