本文整理匯總了Golang中github.com/cockroachdb/cockroach/roachpb.Value.PrettyPrint方法的典型用法代碼示例。如果您正苦於以下問題:Golang Value.PrettyPrint方法的具體用法?Golang Value.PrettyPrint怎麽用?Golang Value.PrettyPrint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/roachpb.Value
的用法示例。
在下文中一共展示了Value.PrettyPrint方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: insertCPutFn
// insertCPutFn is used by insertRow when conflicts should be respected.
// logValue is used for pretty printing.
func insertCPutFn(b *client.Batch, key *roachpb.Key, value *roachpb.Value) {
// TODO(dan): We want do this V(2) log everywhere in sql. Consider making a
// client.Batch wrapper instead of inlining it everywhere.
if log.V(2) {
log.InfofDepth(1, "CPut %s -> %s", *key, value.PrettyPrint())
}
b.CPut(key, value, nil)
}
示例2: Import
// Import loads some data in sstables into the database. Only the keys between
// startKey and endKey are loaded.
func Import(
ctx context.Context,
sst engine.RocksDBSstFileReader,
txn *client.Txn,
startKey, endKey engine.MVCCKey,
) error {
var v roachpb.Value
importFunc := func(kv engine.MVCCKeyValue) (bool, error) {
v = roachpb.Value{RawBytes: kv.Value}
v.ClearChecksum()
if log.V(3) {
log.Infof(ctx, "Put %s %s\n", kv.Key.Key, v.PrettyPrint())
}
if err := txn.Put(kv.Key.Key, &v); err != nil {
return true, err
}
return false, nil
}
return sst.Iterate(startKey, endKey, importFunc)
}
示例3: insertPutFn
// insertPutFn is used by insertRow when conflicts should be ignored.
// logValue is used for pretty printing.
func insertPutFn(b *client.Batch, key *roachpb.Key, value *roachpb.Value) {
if log.V(2) {
log.InfofDepth(1, "Put %s -> %s", *key, value.PrettyPrint())
}
b.Put(key, value)
}