From c3fe79b971d9873c2743a35b3fa94cf1283eb134 Mon Sep 17 00:00:00 2001 From: guregu Date: Wed, 18 Dec 2024 04:56:16 +0900 Subject: [PATCH] add some docs explaining ErrTooMany --- query.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/query.go b/query.go index 767a825..2231e07 100644 --- a/query.go +++ b/query.go @@ -208,6 +208,9 @@ func (q *Query) ConsumedCapacity(cc *ConsumedCapacity) *Query { // One executes this query and retrieves a single result, // unmarshaling the result to out. +// This uses the DynamoDB GetItem API when possible, otherwise Query. +// If the query returns more than one result, [ErrTooMany] may be returned. This is intended as a diagnostic for query mistakes. +// To avoid [ErrTooMany], set the [Query.Limit] to 1. func (q *Query) One(ctx context.Context, out interface{}) error { if q.err != nil { return q.err