本文整理汇总了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)
}