Skip to the page
Najova

da

dataNaja Built in

A database built into Najova: write each table's shape once and save, find and change rows with nothing to set up.

By NylonLabs

Official Najova Extension

About dataNaja

Readme

dataNaja

dataNaja is a database built into Najova: there is nothing to install, set up or start, and it can't be removed.

Write each table's shape once in a .dnaj file beside your script:

$shape[users]
  name = text
  coins = number
$endshape

Rows are kept in .najdata/users.json and checked against the shape when they're saved. When you change a shape, the rows you already saved are moved over to it, and a copy of the old file is kept first.

See dataNaja in the reference for every function.

Packages

dataNaja is an extension like any other, so anyone can make packages for it.

Functions (6)

These come with Najova. Each one's full page, with a working example, is in the Functions reference.

$dataAdd

$dataAdd[table;row]

With $use[datanaja]: saves a new row, like $dataAdd[users;$table[name;Sam;age;30]], and gives its id.

$dataFind

$dataFind[table;test]
$dataFind[table;test;sort=field;order=down;limit=10]

With $use[datanaja]: a list of the rows that pass the test, like $dataFind[users;age >= 18;sort=name]; with no test, every row.

$dataGet

$dataGet[table;field;value]

With $use[datanaja]: the first row whose field has the value, like $dataGet[users;id;12] (nothing if there is none).

$dataChange

$dataChange[table;test;changes]

With $use[datanaja]: changes the rows that pass the test, like $dataChange[users;id == 12;$table[age;31]], and gives how many changed.

$dataRemove

$dataRemove[table;test]

With $use[datanaja]: removes the rows that pass the test, like $dataRemove[users;id == 12] (all removes every row), and gives how many.

$dataCount

$dataCount[table]
$dataCount[table;test]

With $use[datanaja]: how many rows there are, or how many pass the test.

Packages (0)

No packages yet. Anyone can make a package for dataNaja once the Najova 1.0 registry opens.

Changelog

dataNaja changes with Najova itself: see Updates.

Install

Built into Najova. There's nothing to install, and it can't be removed.

Version

Comes with Najova