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)
| 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`. |
| 344 | func 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, |
searching dependent graphs…