Simple schema.
parent
2f2e7ba3ea
commit
f27200dd5b
1 changed files with 27 additions and 0 deletions
|
@ -49,3 +49,30 @@ await db.q(
|
||||||
[?page :page/visitedAt ?date]]`,
|
[?page :page/visitedAt ?date]]`,
|
||||||
{"limit": 2, "order-by": [["_max_date", "desc"]]});
|
{"limit": 2, "order-by": [["_max_date", "desc"]]});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Simple schema
|
||||||
|
|
||||||
|
Datomish's JS API exposes a simple schema interface through `db.ensureSchema`. This accepts input with simplified string keys and values, like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"name": "pages",
|
||||||
|
"attributes": [
|
||||||
|
{"name": "page/url",
|
||||||
|
"type": "string",
|
||||||
|
"cardinality": "one",
|
||||||
|
"unique": "identity",
|
||||||
|
"doc": "A page's URL."},
|
||||||
|
{"name": "page/title",
|
||||||
|
"type": "string",
|
||||||
|
"cardinality": "one",
|
||||||
|
"fulltext": true,
|
||||||
|
"doc": "A page's title."},
|
||||||
|
{"name": "page/content",
|
||||||
|
"type": "string",
|
||||||
|
"cardinality": "one",
|
||||||
|
"fulltext": true,
|
||||||
|
"doc": "A snapshot of the page's content. Should be plain text."},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in a new issue