Esempio n. 1
0
func validateValue(col *schema.TableColumn, value sqltypes.Value) error {
	if value.IsNull() {
		return nil
	}
	switch col.Category {
	case schema.CAT_NUMBER:
		if !value.IsNumeric() {
			return NewTabletError(FAIL, "type mismatch, expecting numeric type for %v", value)
		}
	case schema.CAT_VARBINARY:
		if !value.IsString() {
			return NewTabletError(FAIL, "type mismatch, expecting string type for %v", value)
		}
	}
	return nil
}