mirror of https://github.com/tikv/client-go.git
Export TTL field (#71)
* add ttl support Signed-off-by: Connor <zbk602423539@gmail.com> * fix typo Signed-off-by: Connor <zbk602423539@gmail.com> * add get ttl api Signed-off-by: Connor <zbk602423539@gmail.com> * export put option field Signed-off-by: Connor <zbk602423539@gmail.com> * rename Signed-off-by: Connor <zbk602423539@gmail.com>
This commit is contained in:
parent
c3fd2ee373
commit
d52d5aff79
|
|
@ -40,7 +40,7 @@ type ScanOption struct {
|
|||
|
||||
// PutOptions is used to provide additional information for put operation.
|
||||
type PutOption struct {
|
||||
ttl uint64
|
||||
TTL uint64
|
||||
}
|
||||
|
||||
func DefaultScanOption() ScanOption {
|
||||
|
|
@ -187,7 +187,7 @@ func (c *Client) Put(ctx context.Context, key, value []byte, options ...PutOptio
|
|||
|
||||
var ttl uint64 = 0
|
||||
if options != nil && len(options) > 0 {
|
||||
ttl = options[0].ttl
|
||||
ttl = options[0].TTL
|
||||
}
|
||||
|
||||
req := &rpc.Request{
|
||||
|
|
@ -219,7 +219,7 @@ func (c *Client) BatchPut(ctx context.Context, keys, values [][]byte, options ..
|
|||
|
||||
var ttl uint64 = 0
|
||||
if options != nil && len(options) > 0 {
|
||||
ttl = options[0].ttl
|
||||
ttl = options[0].TTL
|
||||
}
|
||||
|
||||
if len(keys) != len(values) {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ func (s *testRawKVSuite) mustPut(c *C, key, value []byte) {
|
|||
}
|
||||
|
||||
func (s *testRawKVSuite) mustPutTTL(c *C, key, value []byte, ttl uint64) {
|
||||
err := s.client.Put(context.TODO(), key, value, PutOption{ ttl: ttl })
|
||||
err := s.client.Put(context.TODO(), key, value, PutOption{ TTL: ttl })
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue