genIndexKeyStrs generates index content strings representation.
(colVals []types.Datum)
| 934 | |
| 935 | // genIndexKeyStrs generates index content strings representation. |
| 936 | func 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. |
| 954 | func (t *TableCommon) addIndices(sctx table.MutateContext, recordID kv.Handle, r []types.Datum, txn kv.Transaction, opt *table.CreateIdxOpt) (kv.Handle, error) { |
no test coverage detected