lujiajing1126 commented on a change in pull request #3:
URL: 
https://github.com/apache/skywalking-banyandb-java-client/pull/3#discussion_r739986757



##########
File path: README.md
##########
@@ -10,6 +10,95 @@ The client implement for SkyWalking BanyanDB in Java.
 
 [![CI/IT 
Tests](https://github.com/apache/skywalking-banyandb-java-client/workflows/CI%20AND%20IT/badge.svg?branch=main)](https://github.com/apache/skywalking-banyandb-java-client/actions?query=workflow%3ACI%2BAND%2BIT+event%3Aschedule+branch%main)
 
+# Usage
+
+## Create a client
+
+Create a `BanyanDBClient` with host, port and a user-specified group and then 
establish a connection.
+
+```java
+// use `default` group
+client = new BanyanDBClient("127.0.0.1", 17912, "default");
+// establish a connection
+client.connect(channel);
+```
+
+## Query
+
+Construct a `StreamQuery` instance with given time-range and other conditions.
+
+> Note: time-range is left-inclusive and right-exclusive.
+
+For example, 
+
+```java
+// [begin, end) = [ now - 15min, now )
+Instant end = Instant.now();
+Instant begin = end.minus(15, ChronoUnit.MINUTES);
+// with stream schema, group=default, name=sw
+StreamQuery query = new StreamQuery("sw",
+        new TimestampRange(begin.toEpochMilli(), end.toEpochMilli()),
+        // projection tags
+        Arrays.asList("state", "start_time", "duration", "trace_id"));
+// search for all states
+query.appendCondition(PairQueryCondition.LongQueryCondition.eq("searchable", 
"state" , 0L));
+// set order by condition
+query.setOrderBy(new StreamQuery.OrderBy("duration", 
StreamQuery.OrderBy.Type.DESC));
+// send the query request
+client.queryStreams(query);
+```
+
+After response is returned, `elements` can be fetched,
+
+```java
+StreamQueryResponse resp = client.queryStreams(query);
+List<RowEntity> entities = resp.getElements();
+```
+
+where `RowEntity` is similar to the `java.sql.ResultSet` but not iterable.

Review comment:
       Here I mean we can extract tag/field from this class with indexes...
   
   Emmm...It may not be a good metaphor, I could remove this.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to