drift/docs/lib/snippets/modular/drift/example.drift

19 lines
513 B
Plaintext

CREATE TABLE todos (
id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
content TEXT NOT NULL,
category INTEGER REFERENCES categories(id)
);
CREATE TABLE categories (
id INT NOT NULL PRIMARY KEY AUTOINCREMENT,
description TEXT NOT NULL
) AS Category;
-- #docregion filterTodos
filterTodos: SELECT * FROM todos WHERE $predicate;
-- #enddocregion filterTodos
-- #docregion getTodos
getTodos ($predicate = TRUE): SELECT * FROM todos WHERE $predicate;
-- #enddocregion getTodos