GizStack
View .mdOpen in ChatGPTOpen in Claude

gizdb/app

a .giz app's records in a GizDB folder this process serves (gizdb/local). A .ts app (web/start.giz) and the JS a build makes never import it: they open their data with gizlang/sql, so they link no engine.

gizlang
import * as App from "gizdb/app";

Types

AppStore

gizlang
type AppStore = { db: Data.Db; engine: Option<Data.Engine>; stop: () => void; }

An app's store: its connection, and the engine of its GizDB folder when this process serves it (none: SQLite, PostgreSQL, or a folder another process serves). stop ends this process's serving (AppStore.close).

  • db: M131.Db
  • engine: _gizlang_sdk_core.Option<M127.Engine>
  • stop: () => void

Functions

store

gizlang
function store(path: string): AppStore throws Model.Rejection

The app's store: DATABASE_URL when set (postgres://…, a SQLite file that ends in .db, or a GizDB folder), else the GizDB folder path, which this process serves when no other does (gizdb/local serve) until AppStore.close.

Effects: fail, read, write, console, io, alloc.

app

gizlang
function app(site: () => Pages.Site effects {fail, alloc}, shapes: Vec<Model.Shape> = [], folder: string = "data", database: string = ""): Pages.Application

The app of site in folder (Pages.appOn) over store: its database is DATABASE_URL (a SQLite file, a GizDB folder, or a gizdb or PostgreSQL server), else database (the GizDB folder FOLDER/db when empty), which this process serves when no other does.

const app = Local.app(site, [Model.shape<Turn>()]); return app.listen(8080);

Effects: fail, read, write, console, io, alloc.

Methods

AppStore.dispose

gizlang
function AppStore.dispose(self: AppStore): void

Closes STORE's connection and ends the serving of its folder when this process serves it: another process may then serve it.

Effects: fail, read, write, console, io, alloc.