MCPcopy
hub / github.com/pingcap/tidb / genIndexKeyStrs

Function genIndexKeyStrs

pkg/table/tables/tables.go:936–951  ·  view source on GitHub ↗

genIndexKeyStrs generates index content strings representation.

(colVals []types.Datum)

Source from the content-addressed store, hash-verified

934
935// genIndexKeyStrs generates index content strings representation.
936func genIndexKeyStrs(colVals []types.Datum) ([]string, error) {
937 // Pass pre-composed error to txn.
938 strVals := make([]string, 0, len(colVals))
939 for _, cv := range colVals {
940 cvs := "NULL"
941 var err error
942 if !cv.IsNull() {
943 cvs, err = types.ToString(cv.GetValue())
944 if err != nil {
945 return nil, err
946 }
947 }
948 strVals = append(strVals, cvs)
949 }
950 return strVals, nil
951}
952
953// addIndices adds data into indices. If any key is duplicated, returns the original handle.
954func (t *TableCommon) addIndices(sctx table.MutateContext, recordID kv.Handle, r []types.Datum, txn kv.Transaction, opt *table.CreateIdxOpt) (kv.Handle, error) {

Callers 3

addIndicesMethod · 0.85
buildIndexForRowMethod · 0.85
getDuplicateErrorFunction · 0.85

Calls 3

ToStringFunction · 0.92
GetValueMethod · 0.65
IsNullMethod · 0.45

Tested by

no test coverage detected