From 2ae4b6f8d55f29086555c67b2aa84f08b88ea33e Mon Sep 17 00:00:00 2001 From: cmontella Date: Fri, 2 Dec 2016 16:16:12 -0800 Subject: [PATCH 1/4] Update databases doc --- handbook/databases.md | 72 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/handbook/databases.md b/handbook/databases.md index 9e22be8..0b3bc01 100644 --- a/handbook/databases.md +++ b/handbook/databases.md @@ -1,11 +1,3 @@ ---- -menu: - main: - parent: "Core Language" -title: "Databases" -weight: 6 ---- - # Databases databases contain records @@ -29,17 +21,36 @@ bind @database1, ..., @databaseN If no database is provided with an action, then that action is performed on the default `@session` database. -## Special Databases +## Creating and Searching Databases + +You can create databases on-demand by simply committing a record to one. e.g. + +``` +commit @my-database + [#my-record] +``` -- `@session` - the default database, stores any record not associated explicitly with a database +This block will create a new database called "my-database", which will contain the newly committed record. You can now search for this record in your new database: -- `@event` - holds records generated by user events in the DOM +``` +search @my-database + [#my-record] -- `@browser` - records stored in `@browser` are rendered as HTML by the browser +bind @browser + [#div text: "Found a record!"] +``` + +## Special Databases + +Eve has some built-in databases that have meaning to the runtime. + +- @session - the default database when no database is specified with an action. +- @event - contains events originating from the DOM +- @browser - Eve clients in the browser renders records in this database as HTML elements. ## Examples -Display a message when the DOM is clicked +Display the element that was clicked in the DOM ```eve search @event @@ -49,6 +60,41 @@ commit @browser [#div text: "{{element}} was clicked."] ``` +Commit some data in `@session`, and then display it on a button click. + +``` +commit + [#for-display text: "Hello"] +``` + +We are searching over three databases to complete this block. + +- the `#click` is in `@event` +- the `#button` is in `@browser` +- the text for display is in `@session`. This needs to be made explicit; since we are searching in other databases, `@session` is not searched implicitly. + +``` +search @event @browser @session + [#click element: [#button]] + [#for-display text] + +commit @browser + [#div text] +``` + +This block could have been written with two searches for the same effect: + +``` +search @event @browser + [#click element: [#button]] + +search + [#for-display text] + +commit @browser + [#div text] +``` + ## See Also [search](../search) | [bind](../bind) | [commit](../commit) \ No newline at end of file From 76dc39308ce8cbfcaf3116a99e0631dccd1a607e Mon Sep 17 00:00:00 2001 From: cmontella Date: Mon, 5 Dec 2016 18:13:35 -0800 Subject: [PATCH 2/4] Reorganize some stuff --- handbook/browser/index.md | 9 +++++++++ handbook/datetime/index.md | 2 +- handbook/events/click.md | 2 +- handbook/events/index.md | 6 +++--- handbook/http/index.md | 9 +++++++++ handbook/standard-library.md | 9 +++++++++ 6 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 handbook/browser/index.md create mode 100644 handbook/http/index.md diff --git a/handbook/browser/index.md b/handbook/browser/index.md new file mode 100644 index 0000000..776ebaa --- /dev/null +++ b/handbook/browser/index.md @@ -0,0 +1,9 @@ +--- +menu: + main: + parent: "Databases" +title: "@browser" +--- + +# @browser + diff --git a/handbook/datetime/index.md b/handbook/datetime/index.md index 98e4ca1..fb6efa0 100644 --- a/handbook/datetime/index.md +++ b/handbook/datetime/index.md @@ -7,4 +7,4 @@ title: "Date & Time" # Date & Time -- [time](time.md) - The current system time \ No newline at end of file +- [time](time) - The current system time \ No newline at end of file diff --git a/handbook/events/click.md b/handbook/events/click.md index 8a317ac..8b021a8 100644 --- a/handbook/events/click.md +++ b/handbook/events/click.md @@ -1,7 +1,7 @@ --- menu: main: - parent: "Events" + parent: "@event" title: "click" --- diff --git a/handbook/events/index.md b/handbook/events/index.md index 477274f..dc56c50 100644 --- a/handbook/events/index.md +++ b/handbook/events/index.md @@ -1,10 +1,10 @@ --- menu: main: - parent: "Standard Library" -title: "Events" + parent: "Databases" +title: "@event" --- -# Events +# @event [click](click) - a left-button mouse click event \ No newline at end of file diff --git a/handbook/http/index.md b/handbook/http/index.md new file mode 100644 index 0000000..2432a1f --- /dev/null +++ b/handbook/http/index.md @@ -0,0 +1,9 @@ +--- +menu: + main: + parent: "Databases" +title: "@http" +--- + +# @http + diff --git a/handbook/standard-library.md b/handbook/standard-library.md index 474bf21..51c6730 100644 --- a/handbook/standard-library.md +++ b/handbook/standard-library.md @@ -1,3 +1,12 @@ +--- +menu: + main: + parent: "Databases" +title: "Standard Library" +weight: 1 +--- + + # Standard Library ## Description From 8a97d6507d801fc920cd5676bca0d7d6e2ebfd68 Mon Sep 17 00:00:00 2001 From: cmontella Date: Wed, 7 Dec 2016 17:23:16 -0800 Subject: [PATCH 3/4] Added more databases, moved things around in the TOC --- handbook/browser/index.md | 1 + handbook/databases.md | 8 +++++--- handbook/datetime/index.md | 1 + handbook/{events => event}/click.md | 0 handbook/{events => event}/index.md | 1 + handbook/general/index.md | 1 + handbook/http/index.md | 1 + handbook/math/index.md | 4 +++- handbook/session/index.md | 10 ++++++++++ handbook/standard-library.md | 6 ++++-- handbook/statistics/index.md | 1 + handbook/strings/index.md | 8 +++----- handbook/view/index.md | 10 ++++++++++ 13 files changed, 41 insertions(+), 11 deletions(-) rename handbook/{events => event}/click.md (100%) rename handbook/{events => event}/index.md (92%) create mode 100644 handbook/session/index.md create mode 100644 handbook/view/index.md diff --git a/handbook/browser/index.md b/handbook/browser/index.md index 776ebaa..aea5e89 100644 --- a/handbook/browser/index.md +++ b/handbook/browser/index.md @@ -3,6 +3,7 @@ menu: main: parent: "Databases" title: "@browser" +weight: 2 --- # @browser diff --git a/handbook/databases.md b/handbook/databases.md index 0b3bc01..fb86f67 100644 --- a/handbook/databases.md +++ b/handbook/databases.md @@ -44,9 +44,11 @@ bind @browser Eve has some built-in databases that have meaning to the runtime. -- @session - the default database when no database is specified with an action. -- @event - contains events originating from the DOM -- @browser - Eve clients in the browser renders records in this database as HTML elements. +- [@session](../session) - the default database when no database is specified with an action. +- [@view](../view) - records committed to `@view` are used to visualize data. +- [@event](../event) - contains events originating from the DOM +- [@browser](../browser) - Eve clients running in the browser render applicable records in this `@browser` as HTML elements. +- [@http](../http) - Stores records representing HTTP requests and responses ## Examples diff --git a/handbook/datetime/index.md b/handbook/datetime/index.md index fb6efa0..7081433 100644 --- a/handbook/datetime/index.md +++ b/handbook/datetime/index.md @@ -3,6 +3,7 @@ menu: main: parent: "Standard Library" title: "Date & Time" +weight: 5 --- # Date & Time diff --git a/handbook/events/click.md b/handbook/event/click.md similarity index 100% rename from handbook/events/click.md rename to handbook/event/click.md diff --git a/handbook/events/index.md b/handbook/event/index.md similarity index 92% rename from handbook/events/index.md rename to handbook/event/index.md index dc56c50..5e8d2f6 100644 --- a/handbook/events/index.md +++ b/handbook/event/index.md @@ -3,6 +3,7 @@ menu: main: parent: "Databases" title: "@event" +weight: 3 --- # @event diff --git a/handbook/general/index.md b/handbook/general/index.md index b41953a..f98849f 100644 --- a/handbook/general/index.md +++ b/handbook/general/index.md @@ -3,6 +3,7 @@ menu: main: parent: "Standard Library" title: "General" +weight: 1 --- # General diff --git a/handbook/http/index.md b/handbook/http/index.md index 2432a1f..bcfb512 100644 --- a/handbook/http/index.md +++ b/handbook/http/index.md @@ -3,6 +3,7 @@ menu: main: parent: "Databases" title: "@http" +weight: 4 --- # @http diff --git a/handbook/math/index.md b/handbook/math/index.md index 3366256..9324df6 100644 --- a/handbook/math/index.md +++ b/handbook/math/index.md @@ -3,6 +3,7 @@ menu: main: parent: "Standard Library" title: "Math" +weight: 2 --- # Math @@ -17,9 +18,10 @@ title: "Math" ## General Math - [abs](abs) - Absolute value -- [ceil](ceil) - Round a number up +- [ceiling](ceiling) - Round a number up - [floor](floor) - Round a number down - [round](round) - Round a number +- [fix](fix) - Calculate the fix of a number - [mod](mod) - Modulo division - exp - The number `e` raised to a power - log - Calculate the logarithm of a number diff --git a/handbook/session/index.md b/handbook/session/index.md new file mode 100644 index 0000000..2e85bca --- /dev/null +++ b/handbook/session/index.md @@ -0,0 +1,10 @@ +--- +menu: + main: + parent: "Databases" +title: "@session" +weight: 1 +--- + +# @session + diff --git a/handbook/standard-library.md b/handbook/standard-library.md index 51c6730..a935ad5 100644 --- a/handbook/standard-library.md +++ b/handbook/standard-library.md @@ -3,14 +3,16 @@ menu: main: parent: "Databases" title: "Standard Library" -weight: 1 +weight: 0 --- - # Standard Library +The Eve standard library of functions is globally available, meaning you don't have to reference a specific database to use these functions. + ## Description +- [general](../general) - General functions - [math](../math) - General mathematical and trigonometric functions - [strings](../strings) - Functions that manipulate strings - [statistics](../statistics) - Functions that calculate statistical measures on values diff --git a/handbook/statistics/index.md b/handbook/statistics/index.md index 082017d..7e29a44 100644 --- a/handbook/statistics/index.md +++ b/handbook/statistics/index.md @@ -3,6 +3,7 @@ menu: main: parent: "Standard Library" title: "Statistics" +weight: 4 --- # Statistics diff --git a/handbook/strings/index.md b/handbook/strings/index.md index 62e0cc9..1ebe7c0 100644 --- a/handbook/strings/index.md +++ b/handbook/strings/index.md @@ -3,12 +3,10 @@ menu: main: parent: "Standard Library" title: "Strings" +weight: 3 --- # Strings -- [length](length) -- [concatenate](concat) -- [replace](replace) -- [split](split) -- [join](join) \ No newline at end of file +- [split](split) - split a string into tokens +- [join](join) - join tokens into a string \ No newline at end of file diff --git a/handbook/view/index.md b/handbook/view/index.md new file mode 100644 index 0000000..27cb468 --- /dev/null +++ b/handbook/view/index.md @@ -0,0 +1,10 @@ +--- +menu: + main: + parent: "Databases" +title: "@view" +weight: 5 +--- + +# @view + From cafabf75ae96439f264f8f02da56923ed73677c6 Mon Sep 17 00:00:00 2001 From: cmontella Date: Wed, 7 Dec 2016 17:38:35 -0800 Subject: [PATCH 4/4] fix --- handbook/databases.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handbook/databases.md b/handbook/databases.md index fb86f67..ceb976b 100644 --- a/handbook/databases.md +++ b/handbook/databases.md @@ -1,6 +1,6 @@ # Databases -databases contain records +Databases contain records ## Syntax