Skip to content

Commit 165c4c3

Browse files
committed
docs: enhance n1ql documentation
Signed-off-by: Otavio Santana <[email protected]>
1 parent 08bd462 commit 165c4c3

File tree

1 file changed

+21
-2
lines changed
  • jnosql-couchbase/src/main/java/org/eclipse/jnosql/databases/couchbase/mapping

1 file changed

+21
-2
lines changed

jnosql-couchbase/src/main/java/org/eclipse/jnosql/databases/couchbase/mapping/N1QL.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,31 @@
1919
import java.lang.annotation.RetentionPolicy;
2020
import java.lang.annotation.Target;
2121

22+
2223
/**
23-
* To a dynamic query on CouchbaseRepository and CouchbaseRepositoryAsync interfaces.
24+
* Annotation used to define a dynamic N1QL query in {@link CouchbaseRepository}.
25+
* <p>
26+
* This annotation allows repository methods to be mapped to Couchbase N1QL queries.
27+
* Parameters can be provided using the {@link Param} annotation.
28+
* </p>
29+
*
30+
* <h2>Example Usage</h2>
31+
* <pre>{@code
32+
* @Repository
33+
* interface ProductRepository extends CouchbaseRepository<Product, String> {
34+
*
35+
* @N1QL("SELECT * FROM products WHERE category = $category")
36+
* List<Product> findByCategory(@Param("category") String category);
37+
* }
38+
* }</pre>
2439
*/
2540
@Retention(RetentionPolicy.RUNTIME)
2641
@Target(ElementType.METHOD)
2742
public @interface N1QL {
28-
43+
/**
44+
* The N1QL query string to be executed.
45+
*
46+
* @return the N1QL query
47+
*/
2948
String value();
3049
}

0 commit comments

Comments
 (0)