Skip to content

Instantly share code, notes, and snippets.

@brfrn169
Created July 20, 2022 03:43
Show Gist options
  • Save brfrn169/c5db1f91498d262bcc253a14dd2c6e6d to your computer and use it in GitHub Desktop.
Save brfrn169/c5db1f91498d262bcc253a14dd2c6e6d to your computer and use it in GitHub Desktop.
Examples of operation builders in Scalar DB (Japanese)
// Getオペレーションの作成
Get get =
Get.newBuilder()
.namespace("ns")
.table("tbl")
.partitionKey(Key.ofInt("c1", 10))
.clusteringKey(Key.of("c2", "aaa", "c3", 100L))
.projections("c1", "c2", "c3", "c4")
.build();
// Scanオペレーションの作成
Scan scan =
Scan.newBuilder()
.namespace("ns")
.table("tbl")
.partitionKey(Key.ofInt("c1", 10))
.start(Key.of("c2", "aaa", "c3", 100L))
.end(Key.of("c2", "aaa", "c3", 300L))
.projections("c1", "c2", "c3", "c4")
.orderings(Scan.Ordering.desc("c2"), Scan.Ordering.asc("c3"))
.limit(10)
.build();
// Putオペレーションの作成
Put put =
Put.newBuilder()
.namespace("ns")
.table("tbl")
.partitionKey(Key.ofInt("c1", 10))
.clusteringKey(Key.of("c2", "aaa", "c3", 100L))
.floatValue("c4", 1.23F)
.doubleValue("c5", 4.56)
.build();
// Deleteオペレーションの作成
Delete delete =
Delete.newBuilder()
.namespace("ns")
.table("tbl")
.partitionKey(Key.ofInt("c1", 10))
.clusteringKey(Key.of("c2", "aaa", "c3", 100L))
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment