Update data properties to return ArrayBuffers
As a convenience, the setters will take typed Arrays (e.g. Uint8Array) since that is a common representation of data in JS (as they are "views" of ArrayBuffer objects). The tests have been updated to reflect this new behavior.
This commit is contained in:
parent
85286b8807
commit
9d373e630a
|
@ -62,6 +62,8 @@ namespace realm {
|
||||||
static ValueType from_double(ContextType, double);
|
static ValueType from_double(ContextType, double);
|
||||||
static std::string to_string(ContextType, ValueType &);
|
static std::string to_string(ContextType, ValueType &);
|
||||||
static ValueType from_string(ContextType, StringData);
|
static ValueType from_string(ContextType, StringData);
|
||||||
|
static std::string to_binary(ContextType, ValueType &);
|
||||||
|
static ValueType from_binary(ContextType, BinaryData);
|
||||||
static DateTime to_datetime(ContextType, ValueType &);
|
static DateTime to_datetime(ContextType, ValueType &);
|
||||||
static ValueType from_datetime(ContextType, DateTime);
|
static ValueType from_datetime(ContextType, DateTime);
|
||||||
|
|
||||||
|
@ -164,7 +166,7 @@ namespace realm {
|
||||||
m_row.set_string(column, Accessor::to_string(ctx, value));
|
m_row.set_string(column, Accessor::to_string(ctx, value));
|
||||||
break;
|
break;
|
||||||
case PropertyTypeData:
|
case PropertyTypeData:
|
||||||
m_row.set_binary(column, BinaryData(Accessor::to_string(ctx, value)));
|
m_row.set_binary(column, BinaryData(Accessor::to_binary(ctx, value)));
|
||||||
break;
|
break;
|
||||||
case PropertyTypeAny:
|
case PropertyTypeAny:
|
||||||
m_row.set_mixed(column, Accessor::to_mixed(ctx, value));
|
m_row.set_mixed(column, Accessor::to_mixed(ctx, value));
|
||||||
|
@ -216,7 +218,7 @@ namespace realm {
|
||||||
case PropertyTypeString:
|
case PropertyTypeString:
|
||||||
return Accessor::from_string(ctx, m_row.get_string(column));
|
return Accessor::from_string(ctx, m_row.get_string(column));
|
||||||
case PropertyTypeData:
|
case PropertyTypeData:
|
||||||
return Accessor::from_string(ctx, (std::string)m_row.get_binary(column));
|
return Accessor::from_binary(ctx, m_row.get_binary(column));
|
||||||
case PropertyTypeAny:
|
case PropertyTypeAny:
|
||||||
throw "Any not supported";
|
throw "Any not supported";
|
||||||
case PropertyTypeDate:
|
case PropertyTypeDate:
|
||||||
|
|
Loading…
Reference in New Issue