Skip to content

Commit 7080e64

Browse files
committed
init update
1 parent e00b7d7 commit 7080e64

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

go.mod

+2
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ require (
6767
google.golang.org/grpc v1.27.1 // indirect
6868
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
6969
)
70+
71+
replace github.com/c4pt0r/kvql => ../kvql

query/query_txn.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"bytes"
55
"context"
66

7-
"github.com/c4pt0r/tcli"
87
"github.com/c4pt0r/kvql"
8+
"github.com/c4pt0r/tcli"
99
"github.com/c4pt0r/tcli/client"
1010
"github.com/c4pt0r/tcli/utils"
1111
"github.com/magiconair/properties"
@@ -41,10 +41,26 @@ func (t *queryTxn) Put(key []byte, value []byte) error {
4141
return t.client.Put(context.TODO(), client.KV{K: key, V: value})
4242
}
4343

44+
func (t *queryTxn) BatchPut(kvs []kvql.KVPair) error {
45+
tkvs := make([]client.KV, len(kvs))
46+
for i, kv := range kvs {
47+
tkvs[i] = client.KV{K: kv.Key, V: kv.Value}
48+
}
49+
return t.client.BatchPut(context.TODO(), tkvs)
50+
}
51+
4452
func (t *queryTxn) Delete(key []byte) error {
4553
return t.client.Delete(context.TODO(), key)
4654
}
4755

56+
func (t *queryTxn) BatchDelete(keys [][]byte) error {
57+
tkvs := make([]client.KV, len(keys))
58+
for i, key := range keys {
59+
tkvs[i] = client.KV{K: key}
60+
}
61+
return t.client.BatchDelete(context.TODO(), tkvs)
62+
}
63+
4864
func (t *queryTxn) Cursor() (kvql.Cursor, error) {
4965
return &queryCursor{
5066
txn: t,

0 commit comments

Comments
 (0)