branch: elpa/emacsql commit 027c5df94ec0d15345a455e444a3db8810af8363 Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
Organize all the keywords in the README. --- README.md | 101 +++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 54 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index a8c8ae6bd8..5519eabf10 100644 --- a/README.md +++ b/README.md @@ -169,11 +169,10 @@ function. Rather than the typical uppercase SQL keywords, keywords in a structured Emacsql statement are literally just that: lisp keywords. -When multiple keywords appear in sequence, Emacsql will generally -concatenate them with a dash, e.g. `CREATE TABLE` becomes -`:create-table`. -#### :create-table `<table>` `<schema|select>` +#### Table + +##### :create-table `<table>` `<schema|select>` Provides `CREATE TABLE`. A selection can be used in place of a schema, which will create a `CREATE TABLE ... AS` statement. @@ -184,7 +183,7 @@ which will create a `CREATE TABLE ... AS` statement. [:create-table names [:select name :from employees]] ``` -#### :drop-table `<table>` +##### :drop-table `<table>` Provides `DROP TABLE`. @@ -192,7 +191,25 @@ Provides `DROP TABLE`. [:drop-table employees] ``` -#### :select `<column-spec>|(:distinct <column-spec>)` +##### :alter-table `<table>`, :rename-to `<table>` + +Provides `ALTER TABLE` and `RENAME TO`. + +```el +[:alter-table prices :rename-to costs] +``` + +### :add-column `<column-spec>` + +Provides `ADD COLUMN`. + +```el +[:alter-table tags :add-column (rating integer :non-nil)] +``` + +#### Selection + +##### :select `<column-spec>|(:distinct <column-spec>)` Provides `SELECT`. `column-spec` can be a `*` symbol or a vector of column identifiers, optionally as expressions. @@ -203,7 +220,7 @@ column identifiers, optionally as expressions. [:select (:distinct [name age id]) ...] ``` -#### :from `<table>` +##### :from `<table>` Provides `FROM`. @@ -215,7 +232,7 @@ Provides `FROM`. [... :from [(as (:select ...) s1) (as (:select ...) s2)]] ``` -#### :join `<table>` +##### :join `<table>` Provides `JOIN`. @@ -224,7 +241,7 @@ Provides `JOIN`. [... :join (as players p) ...] ``` -#### :outer, :inner, :cross, :natural, :left, :right, :full +##### :outer, :inner, :cross, :natural, :left, :right, :full Provides `OUTER`, `INNER`, `CROSS`, `NATURAL`, `LEFT`, `RIGHT`, and `FULL`. @@ -234,7 +251,7 @@ Provides `OUTER`, `INNER`, `CROSS`, `NATURAL`, `LEFT`, `RIGHT`, and [... :left :outer :join ...] ``` -#### :on `<expr>` +##### :on `<expr>` Provides `ON`. @@ -242,7 +259,7 @@ Provides `ON`. [... :on (= entry-id other-id)] ``` -#### :using `<column>|[<columns>]` +##### :using `<column>|[<columns>]` Provides `USING`. @@ -251,7 +268,7 @@ Provides `USING`. [... :using [entry-id, feed-id]] ``` -#### :where `<expr>`, :having `<expr>` +##### :where `<expr>`, :having `<expr>` Provides `WHERE` and `HAVING`. @@ -260,7 +277,7 @@ Provides `WHERE` and `HAVING`. [... :having (= size 10)] ``` -#### :group-by `<expr>` +##### :group-by `<expr>` Provides `GROUP BY`. @@ -268,7 +285,7 @@ Provides `GROUP BY`. [... :group-by name] ``` -#### :order-by `<expr>|(<expr> <:asc|:desc>)|[<expr> ...]` +##### :order-by `<expr>|(<expr> <:asc|:desc>)|[<expr> ...]` Provides `ORDER BY`. @@ -278,7 +295,7 @@ Provides `ORDER BY`. [... :order-by [(width :asc) (- height)]] ``` -#### :limit `<limit>|[<offset> <limit>]` +##### :limit `<limit>|[<offset> <limit>]` Provides `LIMIT` and `OFFSET`. @@ -287,7 +304,17 @@ Provides `LIMIT` and `OFFSET`. [... :limit [150 50]] ``` -#### :insert, :replace +##### :union, :union-all, :difference, :except + +Provides `UNION`, `UNION ALL`, `DIFFERENCE`, and `EXCEPT`. + +```el +[:select * :from sales :union :select * :from accounting] +``` + +#### Manipulation + +##### :insert, :replace Provides `INSERT`, `REPLACE`. @@ -296,7 +323,7 @@ Provides `INSERT`, `REPLACE`. [:replace :into ...] ``` -#### :into `<table>` +##### :into `<table>` Provides `INTO`. @@ -305,7 +332,7 @@ Provides `INTO`. [:into (employees [id name]) ...] ``` -#### :delete +##### :delete Provides `DELETE`. @@ -313,14 +340,14 @@ Provides `DELETE`. [:delete :from employees :where ...] ``` -#### :values `<vector>|(<vector> ...)` +##### :values `<vector>|(<vector> ...)` ```el [:insert :into employees :values ["Jeff" 0]] [:insert :into employees :values (["Jeff" 0] ["Susan" 0])] ``` -#### :update `<table>` +##### :update `<table>` Provides `UPDATE`. @@ -328,7 +355,7 @@ Provides `UPDATE`. [:update people :set ...] ``` -#### :set `<assignment>|[<assignment> ...]` +##### :set `<assignment>|[<assignment> ...]` Provides `SET`. @@ -337,15 +364,9 @@ Provides `SET`. [:update people :set [(= name "Richy") (= salary 300000)] :where ...] ``` -#### :union, :union-all, :difference, :except +#### Transaction -Provides `UNION`, `UNION ALL`, `DIFFERENCE`, and `EXCEPT`. - -```el -[:select * :from sales :union :select * :from accounting] -``` - -#### :begin `<:transaction|:immediate|:deferred|:exclusive>` +##### :begin `<:transaction|:immediate|:deferred|:exclusive>` Provides `BEGIN`. Exactly one of these "arguments" must always be supplied. `:deferred` and `:transaction` are aliases. @@ -355,7 +376,7 @@ supplied. `:deferred` and `:transaction` are aliases. [:begin :immediate] ``` -#### :commit, :rollback +##### :commit, :rollback Provides `COMMIT` and `ROLLBACK`. @@ -364,23 +385,9 @@ Provides `COMMIT` and `ROLLBACK`. [:rollback] ``` -#### :alter-table `<table>`, :rename-to `<table>` - -Provides `ALTER TABLE` and `RENAME TO`. - -```el -[:alter-table prices :rename-to costs] -``` - -### :add-column `<column-spec>` - -Provides `ADD COLUMN`. - -```el -[:alter-table tags :add-column (rating integer :non-nil)] -``` +#### Meta -#### :pragma `<expr>` +##### :pragma `<expr>` Provides `PRAGMA`. @@ -388,7 +395,7 @@ Provides `PRAGMA`. (emacsql db [:pragma (= foreign_keys on)]) ``` -#### :vacuum +##### :vacuum Provides `VACUUM`.