Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default limit 100 queries #625

Merged
merged 4 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/src/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ subcommands:
value_name: SQL_QUERY
help: >-
(Optional) Search query to execute (Default is "SELECT *
FROM c"). To see all available query options, please check
FROM c LIMIT 100"). To see all available query options, please check
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
https://docs.microsoft.com/en-us/azure/cosmos-db/sql-query-select
takes_value: true
- insert-item:
Expand Down Expand Up @@ -305,7 +305,7 @@ subcommands:
value_name: SQL query
help: |
The SQL query to search the registry.
Default value is "SELECT c.data, c.id, c.type FROM c".
Default value is "SELECT c.data, c.id, c.type FROM c LIMIT 100".
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
takes_value: true
required: true
- check-issuer:
Expand Down
4 changes: 2 additions & 2 deletions cli/src/parser/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ fn list(args: &ArgMatches) -> Result<TemplateCommand, Error> {
Ok(TemplateCommand::List(ListTemplatesArgs {
query: args
.value_of("query")
.map_or("SELECT * FROM c".to_string(), |x| x.to_string()),
.map_or("SELECT * FROM c LIMIT 100".to_string(), |x| x.to_string()),
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
continuation_token: args
.value_of("continuation-token")
.map_or(String::default(), |x| x.to_string()),
Expand All @@ -167,7 +167,7 @@ fn search(args: &ArgMatches) -> Result<TemplateCommand, Error> {
Ok(TemplateCommand::Search(SearchTemplatesArgs {
query: args
.value_of("query")
.map_or("SELECT * FROM c".to_string(), |x| x.to_string()),
.map_or("SELECT * FROM c LIMIT 100".to_string(), |x| x.to_string()),
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
continuation_token: args
.value_of("continuation-token")
.map_or(String::default(), |x| x.to_string()),
Expand Down
2 changes: 1 addition & 1 deletion cli/src/services/trustregistry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async fn search(args: &SearchArgs, config: &CliConfig) -> Result<Output, Error>
let query = args
.query
.as_ref()
.map_or("SELECT * FROM c".to_string(), |q| q.to_owned());
.map_or("SELECT * FROM c LIMIT 100".to_string(), |q| q.to_owned());
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

let mut client = grpc_client_with_auth!(TrustRegistryClient<Channel>, config.to_owned());

Expand Down
2 changes: 1 addition & 1 deletion cli/src/services/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub(crate) fn execute(args: &Command, config: CliConfig) -> Result<Output, Error
async fn search(args: &SearchArgs, config: CliConfig) -> Result<Output, Error> {
let query = args
.query
.map_or("SELECT c.data, c.id, c.type FROM c".to_string(), |q| {
.map_or("SELECT c.data, c.id, c.type FROM c LIMIT 100".to_string(), |q| {
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
q.to_string()
});

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/services/template-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Template searching works very similarly to Wallet searching. Please refer to [Wa

### Basic Search

The default query used in the commands below returns a full wallet result set. The query is `SELECT * FROM c`.
The default query used in the commands below returns the first 100 items in the template result set. The query is `SELECT * FROM c LIMIT 100`.
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

=== "Trinsic CLI"
```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/services/wallet-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ This approach allows us to give developers full control over how data is retriev

### Basic Search

The default query used in the commands below returns a full wallet result set. The query is `SELECT * FROM c`.
The default query used in the commands below returns the first 100 items in the wallet result set. The query is `SELECT * FROM c LIMIT 100`.
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

=== "Trinsic CLI"
```bash
Expand Down
4 changes: 2 additions & 2 deletions dotnet/Trinsic/TrustRegistryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ internal TrustRegistryService(ITokenProvider tokenProvider, IOptions<ServiceOpti
/// <returns></returns>
public async Task<SearchRegistryResponse> SearchRegistryAsync(SearchRegistryRequest request) {
if (String.IsNullOrWhiteSpace(request.Query))
request.Query = "SELECT * FROM c";
request.Query = "SELECT * FROM c LIMIT 100";
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

var response = await Client.SearchRegistryAsync(request, await BuildMetadataAsync(request));
return response;
}

public SearchRegistryResponse SearchRegistry(SearchRegistryRequest request) {
if (String.IsNullOrWhiteSpace(request.Query))
request.Query = "SELECT * FROM c";
request.Query = "SELECT * FROM c LIMIT 100";
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

return Client.SearchRegistry(request, BuildMetadata(request));
}
Expand Down
4 changes: 2 additions & 2 deletions dotnet/Trinsic/WalletService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal WalletService(ITokenProvider tokenProvider, IOptions<ServiceOptions> op
/// <returns></returns>
public async Task<SearchResponse> SearchAsync(SearchRequest request) {
if (string.IsNullOrWhiteSpace(request.Query))
request.Query = "SELECT c.id, c.type, c.data FROM c";
request.Query = "SELECT c.id, c.type, c.data FROM c LIMIT 100";
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

var response = await Client.SearchAsync(request, await BuildMetadataAsync(request));
return response;
Expand All @@ -51,7 +51,7 @@ internal WalletService(ITokenProvider tokenProvider, IOptions<ServiceOptions> op
/// <returns></returns>
public SearchResponse Search(SearchRequest request) {
if (string.IsNullOrWhiteSpace(request.Query))
request.Query = "SELECT c.id, c.type, c.data FROM c";
request.Query = "SELECT c.id, c.type, c.data FROM c LIMIT 100";
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

var response = Client.Search(request, BuildMetadata(request));
return response;
Expand Down
2 changes: 1 addition & 1 deletion go/services/trustregistry_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (t *trustRegistryBase) SearchRegistry(userContext context.Context, request
}

if request.Query == "" {
request.Query = "SELECT * FROM c"
request.Query = "SELECT * FROM c LIMIT 100"
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
}

md, err := t.GetMetadataContext(userContext, request)
Expand Down
2 changes: 1 addition & 1 deletion go/services/wallet_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (w *walletBase) Search(userContext context.Context, request *sdk.SearchRequ
}

if len(request.Query) == 0 {
request.Query = "SELECT c.id, c.type, c.data FROM c"
request.Query = "SELECT c.id, c.type, c.data FROM c LIMIT 100"
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
}

md, err := w.GetMetadataContext(userContext, request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public ListenableFuture<TrustRegistryOuterClass.SearchRegistryResponse> searchRe
}

public ListenableFuture<TrustRegistryOuterClass.SearchRegistryResponse> searchRegistry(TrustRegistryOuterClass.SearchRegistryRequest request) throws InvalidProtocolBufferException, DidException {
if (request.getQuery().isBlank()) request = TrustRegistryOuterClass.SearchRegistryRequest.newBuilder(request).setQuery("SELECT * FROM c").build();
if (request.getQuery().isBlank()) request = TrustRegistryOuterClass.SearchRegistryRequest.newBuilder(request).setQuery("SELECT * FROM c LIMIT 100").build();
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
return withMetadata(stub, request).searchRegistry(request);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class TrustRegistryServiceKt(
suspend fun searchRegistry(request: SearchRegistryRequest): SearchRegistryResponse {
var request = request
if (request.query.isBlank()) request =
SearchRegistryRequest.newBuilder(request).setQuery("SELECT * FROM c").build()
SearchRegistryRequest.newBuilder(request).setQuery("SELECT * FROM c LIMIT 100").build()
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
return withMetadata(stub, request).searchRegistry(request)
}

Expand Down
2 changes: 1 addition & 1 deletion java/src/main/java/trinsic/services/WalletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public WalletService(Options.ServiceOptions options) {
}

public ListenableFuture<UniversalWalletOuterClass.SearchResponse> search(UniversalWalletOuterClass.SearchRequest request) throws InvalidProtocolBufferException, DidException {
if (request.getQuery().isBlank()) request = UniversalWalletOuterClass.SearchRequest.newBuilder(request).setQuery("SELECT c.id, c.type, c.data FROM c").build();
if (request.getQuery().isBlank()) request = UniversalWalletOuterClass.SearchRequest.newBuilder(request).setQuery("SELECT c.id, c.type, c.data FROM c LIMIT 100").build();
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved

return withMetadata(stub, request).search(request);
}
Expand Down
2 changes: 1 addition & 1 deletion java/src/main/java/trinsic/services/WalletServiceKt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class WalletServiceKt(
@Throws(InvalidProtocolBufferException::class, DidException::class)
suspend fun search(request: SearchRequest): SearchResponse {
var request = request
if (request.query.isBlank()) request = SearchRequest.newBuilder(request).setQuery("SELECT c.id, c.type, c.data FROM c").build()
if (request.query.isBlank()) request = SearchRequest.newBuilder(request).setQuery("SELECT c.id, c.type, c.data FROM c LIMIT 100").build()
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
return withMetadata(stub, request).search(request)
}

Expand Down
2 changes: 1 addition & 1 deletion python/trinsic/credentialtemplates_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def list(
async def search(
self, *, request: SearchCredentialTemplatesRequest
) -> SearchCredentialTemplatesResponse:
request.query = request.query or "SELECT * from c"
request.query = request.query or "SELECT * from c LIMIT 100"
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
return await self.client.search(search_credential_templates_request=request)

async def delete(
Expand Down
2 changes: 1 addition & 1 deletion python/trinsic/trustregistry_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async def search_registry(
[SearchRegistryResponse](/reference/proto/#searchregistryresponse)
"""
request = request or SearchRegistryRequest()
request.query = request.query or "SELECT * FROM c"
request.query = request.query or "SELECT * FROM c LIMIT 100"
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
return await self.client.search_registry(search_registry_request=request)

async def fetch_data(
Expand Down
2 changes: 1 addition & 1 deletion python/trinsic/wallet_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async def search(self, *, request: SearchRequest = None) -> SearchResponse:
The search response object information
"""
request = request or SearchRequest()
request.query = request.query or "SELECT c.id, c.type, c.data FROM c"
request.query = request.query or "SELECT c.id, c.type, c.data FROM c LIMIT 100"
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
return await self.client.search(search_request=request)

async def insert_item(self, *, request: InsertItemRequest) -> InsertItemResponse:
Expand Down
2 changes: 1 addition & 1 deletion ruby/lib/services/trust_registry_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def check_verifier_status(request)
def search_registry(request = nil)
# request = TrustRegistry_V1::SearchRegistryRequest.new(query: query)
request ||= TrustRegistry_V1::SearchRegistryRequest.new
request.query = request.query.empty? ? "SELECT * FROM c" : request.query
request.query = request.query.empty? ? "SELECT * FROM c LIMIT 100" : request.query
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
@client.search_registry(request, metadata: metadata(request))
# JSON.parse(response.items_json)
end
Expand Down
2 changes: 1 addition & 1 deletion ruby/lib/services/wallet_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def initialize(service_options = nil)
def search(request = nil)
# request = Wallet_V1::SearchRequest.new(query: query)
request = request || Wallet_V1::SearchRequest.new
request.query = request.query.empty? ? "SELECT c.id, c.type, c.data FROM c" : request.query
request.query = request.query.empty? ? "SELECT c.id, c.type, c.data FROM c LIMIT 100" : request.query
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
@client.search(request, metadata: metadata(request))
end

Expand Down
2 changes: 1 addition & 1 deletion web/src/TrustRegistryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class TrustRegistryService extends ServiceBase {
}

public async searchRegistry(
request: SearchRegistryRequest = SearchRegistryRequest.fromPartial({query: "SELECT * FROM c"})
request: SearchRegistryRequest = SearchRegistryRequest.fromPartial({query: "SELECT * FROM c LIMIT 100"})
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
): Promise<SearchRegistryResponse> {
return this.client.searchRegistry(request, {
metadata: await this.getMetadata(
Expand Down
2 changes: 1 addition & 1 deletion web/src/WalletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class WalletService extends ServiceBase {

public async search(
request: SearchRequest = SearchRequest.fromPartial({
query: "SELECT * FROM c",
query: "SELECT c.id, c.type, c.data FROM c LIMIT 100",
fundthmcalculus marked this conversation as resolved.
Show resolved Hide resolved
})
): Promise<SearchResponse> {
return this.client.search(request, {
Expand Down