emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/emacsql 53b2e98515 131/427: Fill out README for new schema


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 53b2e98515 131/427: Fill out README for new schema table constraints.
Date: Tue, 13 Dec 2022 02:59:35 -0500 (EST)

branch: elpa/emacsql
commit 53b2e98515284c17f13cf30cfa273ec847e48bbf
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Fill out README for new schema table constraints.
---
 README.md | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index c3f7a0267b..e3beb5d452 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,8 @@ requests are synchronous.
 Any [readable lisp value][readable] can be stored as a value in
 Emacsql, including numbers, strings, symbols, lists, vectors, and
 closures. Emacsql has no concept of "TEXT" values; it's all just lisp
-objects.
+objects. The lisp object `nil` corresponds 1:1 with `NULL` in the
+database.
 
 Requires Emacs 24 or later and SQLite 3.7.15 or later.
 
@@ -52,21 +53,29 @@ shouldn't impact normal use of the database.
 
 ## Schema
 
-A table schema is a vector of column specification. A column
-identifier is a symbol and a specification can either be just this
-symbol or it can include constraints, such as type and uniqueness.
-Because Emacsql stores entire lisp objects as values, the only
-relevant types are `integer`, `float`, and `object` (default).
+A table schema is a vector of column specifications, or a list
+containing a vector of column specifications followed by table
+specifications. A column identifier is a symbol and a specification
+can either be just this symbol or it can include constraints. Because
+Emacsql stores entire lisp objects as values, the only relevant (and
+allowed) types are `integer`, `float`, and `object` (default).
 
-Additional columns constraints include `:primary` (aka `PRIMARY KEY`),
-`:unique`, `:non-nil` (aka `NOT NULL`), `:default`, and `:check`.
+Columns constraints include `:primary` (aka `PRIMARY KEY`), `:unique`,
+`:non-nil` (aka `NOT NULL`), `:default`, and `:check`.
+
+Table constraints can be `:primary`, `:unique`, and `:check`.
 
 ```el
-;; Example schema:
-[name (badge-no integer :primary :unique) address]
-```
+;; No constraints schema with four columns:
+[name id building room]
 
-The lisp object `nil` corresponds 1:1 with `NULL` in the database.
+;; Add some column constraints:
+[(name :unique) (id integer :primary) building room]
+
+;; Add some table constraints:
+([(name :unique) (id integer :primary) building room]
+ :unique [building room] :check ())
+```
 
 ## Operators
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]