Struct ScanSelectCommand<TValue, TConverter>
- Namespace
- DynaSharp
- Assembly
- DynaSharp.dll
A Scan of one attribute, as Select<TValue, TConverter>(Attr<TValue, TConverter>) leaves it. Nothing can be added any more, which the type enforces, so Filter,
Limit, Segment and the other clauses come before Select: what is left is to send it, with the same methods as ScanCommand<T>. It charges what any scan charges.
public readonly ref struct ScanSelectCommand<TValue, TConverter> where TConverter : IDynamoDbConverter<TValue>
Type Parameters
TValueThe type of the attribute, nullable for a handle of a nullable property.
TConverterThe converter that reads it.
- Inherited Members
Remarks
An attribute that an item does not have follows the type of the handle: null for a nullable one, an empty set for a set, and otherwise a DynamoDbMappingException, which holds no key, because only the attribute came back.
Methods
PageAsync(ContinuationToken, CancellationToken)
Reads one page, as PageAsync(ContinuationToken, CancellationToken) does, with the values in Items.
public ValueTask<Page<TValue>> PageAsync(ContinuationToken after = default, CancellationToken cancellationToken = default)
Parameters
afterContinuationTokenThe position to continue from, or
defaultfor the first page. It must come from the same scan, and the same segment. AContinuationToken?passes asafter ?? default.cancellationTokenCancellationTokenCancels the call.
Returns
Exceptions
- InvalidOperationException
The command was already sent or rendered.
- ObjectDisposedException
The client is disposed.
- FormatException
afterdoes not fit what TokenSigner says: a client that signs gets a plain token that came as text, or one whose signature does not hold for this read; a client that does not sign gets a signed one. The message quotes nothing of the token, and no request goes out.- ValidationException
DynamoDB rejects the request, for example a position of another scan; the exception shows the expressions.
- ResourceNotFoundException
The table does not exist.
- DynamoDbMappingException
An item has no such attribute and the handle cannot be null, or its value cannot be read as
TValue.- DynamoDbException
DynamoDB returns any other error; a throttling or server error only after the last attempt.
PageAsync(CancellationToken)
Reads the first page, as PageAsync(ContinuationToken, CancellationToken) does at the default position, for a caller that has a token and no position yet.
public ValueTask<Page<TValue>> PageAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancels the call. It has no default, because
PageAsync()belongs to the overload with the position.
Returns
Exceptions
- InvalidOperationException
The command was already sent or rendered.
- ObjectDisposedException
The client is disposed.
- ValidationException
DynamoDB rejects the request; the exception shows the expressions.
- ResourceNotFoundException
The table does not exist.
- DynamoDbMappingException
An item has no such attribute and the handle cannot be null, or its value cannot be read as
TValue.- DynamoDbException
DynamoDB returns any other error; a throttling or server error only after the last attempt.
PagesAsync(CancellationToken)
Reads all pages as they come, as PagesAsync(CancellationToken) does, with the values in Items.
public IAsyncEnumerable<Page<TValue>> PagesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the read, as does
WithCancellationon the result.
Returns
- IAsyncEnumerable<Page<TValue>>
The pages, which can be enumerated once.
Exceptions
- InvalidOperationException
The command was already sent or rendered.
ToRequestJson()
Renders the body of the first page, as DynamoDB JSON, without sending it. It ends the command, and is meant for tests and debugging. It shows what goes out, and the text contains the values.
public string ToRequestJson()
Returns
- string
The request body.
Exceptions
- InvalidOperationException
The command was already sent or rendered.
ValuesAsync(CancellationToken)
Reads the attribute of all items of all pages as they come, as ItemsAsync(CancellationToken) reads the items.
public IAsyncEnumerable<TValue> ValuesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels the read, as does
WithCancellationon the result. It is looked at per page.
Returns
- IAsyncEnumerable<TValue>
The values, which can be enumerated once; a second enumeration throws InvalidOperationException, so build the command again to read again.
Exceptions
- InvalidOperationException
The command was already sent or rendered.