Tigris provides an easy-to-use and intuitive interface for Java combined with data modeling that is incorporated into your application code as Java classes.
The Tigris Java client libraries offer both asynchronous and synchronous clients.
<dependency>
<groupId>com.tigrisdata</groupId>
<artifactId>tigris-client</artifactId>
<version>${tigris.client.java.version}</version>
</dependency>
For latest version and for other dependency management or build tool you can refer to dependency snippet from here.
// configuration
TigrisConfiguration config =
TigrisConfiguration.newBuilder("localhost:8081")
.withNetwork(
TigrisConfiguration.NetworkConfig.newBuilder()
.usePlainText() // for dev env - plaintext communication
.build())
.build();
// construct client
TigrisClient client = StandardTigrisClient.getInstance(config);
// create or get db
TigrisDatabase helloDB = client.createDatabaseIfNotExists("hello_db");
// create or update collection(s)
helloDB.createOrUpdateCollections(User.class);
// get collection
TigrisCollection<User> users = helloDB.getCollection(User.class);
// insert
users.insert(new User(1, "Jania McGrory", 6045.7));
// read
User user1 = users.readOne(Filters.eq("id", 1)).get();
// update
users.update(
Filters.eq("id", 1),
UpdateFields.newBuilder().set("name", "Jania McGrover").build()
);
// delete
// delete - delete users with id 1 or 2
users.delete(
Filters.or(
Filters.eq("id", 1),
Filters.eq("id", 2)
)
);
// search - search for users with name "Jania"
users.search(
SearchRequest.newBuilder()
.withQuery("Jania")
.withSearchFields("name")
.build()
);
This software is licensed under the Apache 2.0.