MCPcopy Create free account
hub / github.com/pingcap/tidb / EncodeValue

Function EncodeValue

pkg/tablecodec/tablecodec.go:344–354  ·  view source on GitHub ↗

EncodeValue encodes a go value to bytes. This function may return both a valid encoded bytes and an error (actually `"pingcap/errors".ErrorGroup`). If the caller expects to handle these errors according to `SQL_MODE` or other configuration, please refer to `pkg/errctx`.

(loc *time.Location, b []byte, raw types.Datum)

Source from the content-addressed store, hash-verified

342// This function may return both a valid encoded bytes and an error (actually `"pingcap/errors".ErrorGroup`). If the caller
343// expects to handle these errors according to `SQL_MODE` or other configuration, please refer to `pkg/errctx`.
344func EncodeValue(loc *time.Location, b []byte, raw types.Datum) ([]byte, error) {
345 var v types.Datum
346 err := flatten(loc, raw, &v)
347 if err != nil {
348 return nil, err
349 }
350
351 val, err := codec.EncodeValue(loc, b, v)
352
353 return val, err
354}
355
356// EncodeRow encode row data and column ids into a slice of byte.
357// valBuf and values pass by caller, for reducing EncodeRow allocates temporary bufs. If you pass valBuf and values as nil,

Callers 12

QueryValueFunction · 0.92
CollectMethod · 0.92
CollectColumnStatsMethod · 0.92
ExtractTopNMethod · 0.92
ProcessMethod · 0.92
SetPBColumnsDefaultValueFunction · 0.92
buildMemTableReaderFunction · 0.92
getColIDAndPkColIDsFunction · 0.92
TestVarintCompatibilityFunction · 0.92
rowcodec_test.goFile · 0.92
TestCutRowFunction · 0.70
BenchmarkEncodeValueFunction · 0.70

Calls 2

EncodeValueFunction · 0.92
flattenFunction · 0.70

Tested by 3

TestVarintCompatibilityFunction · 0.74
TestCutRowFunction · 0.56
BenchmarkEncodeValueFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…