forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating user agent and adding query annotation snippets to readme (A…
…zure#14998) * - Updating user agent as per the guidelines. - Adding query annotation snippets to readme. * readme changes
- Loading branch information
Showing
6 changed files
with
95 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../java/com/azure/spring/data/cosmos/AnnotatedQueriesUserReactiveRepositoryCodeSnippet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
package com.azure.spring.data.cosmos; | ||
|
||
import com.azure.spring.data.cosmos.repository.Query; | ||
import com.azure.spring.data.cosmos.repository.ReactiveCosmosRepository; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import org.springframework.data.repository.query.Param; | ||
import reactor.core.publisher.Flux; | ||
|
||
public interface AnnotatedQueriesUserReactiveRepositoryCodeSnippet extends ReactiveCosmosRepository<User, String> { | ||
@Query(value = "select * from c where c.firstName = @firstName and c.lastName = @lastName") | ||
Flux<User> getUsersByTitleAndValue(@Param("firstName") int firstName, @Param("lastName") String lastName); | ||
|
||
@Query(value = "select * from c offset @offset limit @limit") | ||
Flux<User> getUsersWithOffsetLimit(@Param("offset") int offset, @Param("limit") int limit); | ||
|
||
@Query(value = "select count(c.id) as num_ids, c.lastName from c group by c.lastName") | ||
Flux<ObjectNode> getCoursesGroupByDepartment(); | ||
} |
17 changes: 17 additions & 0 deletions
17
.../samples/java/com/azure/spring/data/cosmos/AnnotatedQueriesUserRepositoryCodeSnippet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
package com.azure.spring.data.cosmos; | ||
|
||
import com.azure.spring.data.cosmos.repository.CosmosRepository; | ||
import com.azure.spring.data.cosmos.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
import java.util.List; | ||
|
||
public interface AnnotatedQueriesUserRepositoryCodeSnippet extends CosmosRepository<User, String> { | ||
@Query(value = "select * from c where c.firstName = @firstName and c.lastName = @lastName") | ||
List<User> getUsersByTitleAndValue(@Param("firstName") int firstName, @Param("lastName") String lastName); | ||
|
||
@Query(value = "select * from c offset @offset limit @limit") | ||
List<User> getUsersWithOffsetLimit(@Param("offset") int offset, @Param("limit") int limit); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters