// QuerySingle returns a single result matching the built query
QuerySingle returns a single result matching the built query
// QuerySingle returns a single result matching the built query
func (s *Builder) QuerySingle(ctx context.Context) (map[string]*dynamodb.AttributeValue, error) {
	if s.err != nil {
		return nil, s.err
	}
	if s.client == nil {
		return nil, ErrClientNotSet
	}
	query, _ := s.ToQuery()
	query.Limit = aws.Int64(1)
	earlyExit := errors.New("early exit")
	var result map[string]*dynamodb.AttributeValue = nil
	err := s.client.QueryIterator(ctx, &query, func(output *dynamodb.QueryOutput) error {
		if len(output.Items) > 0 {
			result = output.Items[0]
			return earlyExit
		}
		return nil
	})
	if err == earlyExit {
		err = nil
	}
	return result, s.parseResult(result, err)
}
func ( s * Builder ) QuerySingle ( ctx context . Context ) ( map [ string ] * dynamodb . AttributeValue , error ) { if s . err != nil { return nil , s . err } if s . client == nil { return nil , ErrClientNotSet } query , _ := s . ToQuery ( ) query . Limit = aws . Int64 ( 1 ) earlyExit := errors . New ( " " ) var result map [ string ] * dynamodb . AttributeValue = nil err := s . client . QueryIterator ( ctx , & query , func ( output * dynamodb . QueryOutput ) error { if len ( output . Items ) > 0 { result = output . Items [ 0 ] return earlyExit } return nil } ) if err == earlyExit { err = nil } return result , s . parseResult ( result , err ) }
QuerySingle returns a single result matching the built query
QuerySingle returns a single result matching the built query