diff --git a/handbook/browser/index.md b/handbook/browser/index.md new file mode 100644 index 0000000..aea5e89 --- /dev/null +++ b/handbook/browser/index.md @@ -0,0 +1,10 @@ +--- +menu: + main: + parent: "Databases" +title: "@browser" +weight: 2 +--- + +# @browser + diff --git a/handbook/databases.md b/handbook/databases.md index 9e22be8..ceb976b 100644 --- a/handbook/databases.md +++ b/handbook/databases.md @@ -1,14 +1,6 @@ ---- -menu: - main: - parent: "Core Language" -title: "Databases" -weight: 6 ---- - # Databases -databases contain records +Databases contain records ## Syntax @@ -29,17 +21,38 @@ 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](../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 -Display a message when the DOM is clicked +Display the element that was clicked in the DOM ```eve search @event @@ -49,6 +62,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 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 95% rename from handbook/events/click.md rename to handbook/event/click.md index 8a317ac..8b021a8 100644 --- a/handbook/events/click.md +++ b/handbook/event/click.md @@ -1,7 +1,7 @@ --- menu: main: - parent: "Events" + parent: "@event" title: "click" --- diff --git a/handbook/events/index.md b/handbook/event/index.md similarity index 54% rename from handbook/events/index.md rename to handbook/event/index.md index 477274f..5e8d2f6 100644 --- a/handbook/events/index.md +++ b/handbook/event/index.md @@ -1,10 +1,11 @@ --- menu: main: - parent: "Standard Library" -title: "Events" + parent: "Databases" +title: "@event" +weight: 3 --- -# Events +# @event [click](click) - a left-button mouse click event \ No newline at end of file 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 new file mode 100644 index 0000000..bcfb512 --- /dev/null +++ b/handbook/http/index.md @@ -0,0 +1,10 @@ +--- +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 474bf21..a935ad5 100644 --- a/handbook/standard-library.md +++ b/handbook/standard-library.md @@ -1,7 +1,18 @@ +--- +menu: + main: + parent: "Databases" +title: "Standard Library" +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 +