wispfnDocs
Function SDK

Tables of JSON rows — insert, put, get, update, delete, list, find and count.

import { table } from 'wisp';
const orders = table('orders');   // async methods
from wisp import table
orders = table("orders")          # synchronous methods

Guide: Tables. Table names: lowercase letters, digits and _.

#insert(row)

Adds a row with a new time-ordered id, createdAt and updatedAt. Returns the stored row.

const o = await orders.insert({ customer: 'ada@example.com', total: 42 });

#put(id, row)

Creates or replaces the row with your own id. Returns the stored row.

#get(id)

The row, or null / None.

#update(id, patch)

Merges patch into the row and returns it, or null / None when the row doesn't exist. Not atomic.

orders.update(o["id"], {"status": "paid"})

#delete(id)

Deletes the row.

#list(options?)

Rows in insertion order: { rows, cursor }.

const { rows, cursor } = await orders.list({ limit: 50 });
page = orders.list(limit=50, cursor=None)

#find(where?, options?)

Rows matching where — an object of fields to compare for equality, or a function that returns true for rows to keep.

Option (JS)PythonDescription
limitlimit=100Maximum rows
orderByorder_by=NoneField to sort by
descdesc=FalseSort descending
const big = await orders.find((o) => o.total > 100, { orderBy: 'total', desc: true, limit: 10 });
open_orders = orders.find({"status": "open"}, order_by="createdAt", desc=True)

#count(where?)

The number of matching rows.

#Limits

Rows up to 256 KB. find and count scan up to 10,000 rows.