Skip to content

Commit

Permalink
[Tables] change Query to List (#15099)
Browse files Browse the repository at this point in the history
* adding List methods

* moving helper to zt file

* improving docstrings

* changing all query methods to list

* updating docstrings
  • Loading branch information
seankane-msft authored Jul 26, 2021
1 parent e224444 commit f905d11
Show file tree
Hide file tree
Showing 17 changed files with 2,119 additions and 42 deletions.
4 changes: 2 additions & 2 deletions sdk/tables/aztable/entity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func (s *tableClientLiveTests) TestAddBasicEntity() {
require.Equal(receivedEntity.RowKey, "rk001")

queryString := "PartitionKey eq 'pk001'"
queryOptions := QueryOptions{Filter: &queryString}
pager := client.Query(&queryOptions)
listOptions := ListOptions{Filter: &queryString}
pager := client.List(&listOptions)
count := 0
for pager.NextPage(ctx) {
resp := pager.PageResponse()
Expand Down
29 changes: 29 additions & 0 deletions sdk/tables/aztable/models.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package aztable

// QueryOptions contains a group of parameters for the Table.Query method.
type ListOptions struct {
// OData filter expression.
Filter *string
// Specifies the media type for the response.
Format *OdataMetadataFormat
// Select expression using OData notation. Limits the columns on each record to just those requested, e.g. "$select=PolicyAssignmentId, ResourceId".
Select *string
// Maximum number of records to return.
Top *int32
}

func (l *ListOptions) toQueryOptions() *QueryOptions {
if l == nil {
return &QueryOptions{}
}

return &QueryOptions{
Filter: l.Filter,
Format: l.Format,
Select: l.Select,
Top: l.Top,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
COSMOS_TABLES_ENDPOINT_SUFFIX: cosmos.azure.com
TABLES_COSMOS_ACCOUNT_NAME: seankaneprim
TABLES_PRIMARY_COSMOS_ACCOUNT_KEY: Kg==
randomSeed: "1626796896"
Loading

0 comments on commit f905d11

Please sign in to comment.