Collection Schema

Hyperbase is implementing schema-based database. This will ensure that the data to be inserted has the correct field, type, and comply with some rules based on the options applied.

Data Types

Hyperbase supports multiple data types. The data types defined on the schema are then converted to the native types supported by the database used by Hyperbase. Below is the data type equivalence table.

HyperbaseScyllaDBPostgreSQLMySQLSQLiteRust Type
BooleanBooleanBoolBoolBooleanbool
TinyintTinyintCharTinyintIntegeri8
SmallintSmallintSmallintSmallintIntegeri16
IntIntIntegerIntIntegeri32
BigintBigintBigintBigintBiginti64
VarintVarintNumericBlobBlobBigInt (crate: num_bigint)
FloatFloatRealFloatRealf32
DoubleDoubleDouble PrecisionDoubleRealf64
DecimalDecimalNumericBlobBlobBigDecimal (crate: bigdecimal)
StringTextVarcharVarchar(255)TextString
BinaryBlobByteaBlobBlobVec
UUIDUUIDUUIDBinary(16)BlobUuid (crate: uuid)
DateDateDateDateDateNaiveDate (crate: chrono)
TimeTimeTimeTimeTimeNaiveTime (crate: chrono)
TimestampTimestampTimestamptz(6)Timestamp(6)TimestampDateTime (crate: chrono)
JSONBlobJsonbJsonBlobString

Supported data types

Field Options

Hyperbase also supports many options to apply to fields. Below is an explanation of those options.
Supported field options

  • Required
    Data in that field must be not null.
  • Indexed
    Field is indexed in the database.
  • Unique
    Enforce uniqueness for a field within a collection. This means that no two data in the collection can have the same values in the field.
  • Auth Field
    This option marks the field that will be allowed to be used as authentication fields in token-based signin.
  • Hashed
    This option marks the field so that its value will be hashed when inserting and updating data.
  • Hidden
    This option marks the field so that its value will never be sent to users with non-admin credentials.