Docs
API
Model

Model

Id

Branded Id Schema for any table Id. To create Id Schema for a specific table, use id. To create an Id value for a specific table, use createId.

id

A factory function to create Id Schema for a specific table. To create an Id value for a specific table, use createId.

Example

import * as Schema from "@effect/schema/Schema";
import * as Evolu from "evolu";
 
const TodoId = Evolu.id("Todo");
type TodoId = Schema.To<typeof TodoId>;
 
if (!Schema.is(TodoId)(value)) return;

createId

A factory function to create an Id value for a specific table.

Example

import * as Evolu from "evolu";
 
// const id: string & Brand<"Id"> & Brand<"Todo">
const id = Evolu.createId<"Todo">();

Mnemonic

Mnemonic is a password generated by Evolu in BIP39 format.

A mnemonic, also known as a "seed phrase," is a set of 12 words in a specific order chosen from a predefined list. The purpose of the BIP39 mnemonic is to provide a human-readable way of storing a private key.

OwnerId

The unique identifier of Owner safely derived from its Mnemonic.

Owner

Owner represents the Evolu database owner. Evolu auto-generates Owner on the first run. Owner can be reset on the current device and restored on a different one.

SqliteBoolean

SQLite doesn't support the boolean type, so Evolu uses SqliteBoolean instead. Use the cast helper to cast SqliteBoolean from boolean and back.

sqlite.org/quirks.html#no_separate_boolean_datatype (opens in a new tab)

SqliteDate

SQLite doesn't support the Date type, so Evolu uses SqliteDate instead. Use the cast helper to cast SqliteDate from Date and back.

https://www.sqlite.org/quirks.html#no_separate_datetime_datatype (opens in a new tab)

cast

A helper for casting types not supported by SQLite. SQLite doesn't support Date nor Boolean types, so Evolu emulates them with SqliteBoolean and SqliteDate.

Example

// isDeleted is SqliteBoolean
.where("isDeleted", "is not", cast(true))

String1000

A string with a maximum length of 1000 characters.

Example

import * as Schema from "@effect/schema/Schema";
import * as Evolu from "evolu";
 
if (!Schema.is(Evolu.String1000)(value)) return;
function foo(value: Evolu.String1000) {}

NonEmptyString1000

A nonempty string with a maximum length of 1000 characters.

Example

import * as Schema from "@effect/schema/Schema";
import * as Evolu from "evolu";
 
if (!Schema.is(Evolu.NonEmptyString1000)(value)) return;
function foo(value: Evolu.NonEmptyString1000) {}