Пример #1
0
func (t *Table) setOnUpdateData(ctx context.Context, touched []bool, data []interface{}) error {
	ucols := column.FindOnUpdateCols(t.Cols())
	for _, c := range ucols {
		if !touched[c.Offset] {
			v, err := expression.GetTimeValue(ctx, expression.CurrentTimestamp, c.Tp, c.Decimal)
			if err != nil {
				return errors.Trace(err)
			}
			data[c.Offset] = v
			touched[c.Offset] = true
		}
	}
	return nil
}
Пример #2
0
func (t *Table) setOnUpdateData(ctx context.Context, touched map[int]bool, data []types.Datum) error {
	ucols := column.FindOnUpdateCols(t.writableCols())
	for _, col := range ucols {
		if !touched[col.Offset] {
			value, err := evaluator.GetTimeValue(ctx, evaluator.CurrentTimestamp, col.Tp, col.Decimal)
			if err != nil {
				return errors.Trace(err)
			}

			data[col.Offset] = types.NewDatum(value)
			touched[col.Offset] = true
		}
	}
	return nil
}