不要怂,就是干,撸起袖子干!

Commit ebd36605 by Sascha Depold

adjusted docs

1 parent a79773dc
...@@ -39,7 +39,7 @@ app.get("/background", function(req, res) { ...@@ -39,7 +39,7 @@ app.get("/background", function(req, res) {
app.get('/', function(req, res){ app.get('/', function(req, res){
var navigation = { var navigation = {
"installation": 'Installation', "installation": 'Installation',
"basic-mapping": 'Basic Mapping', "usage": 'Usage',
"sync-with-db": 'Synchronize with database', "sync-with-db": 'Synchronize with database',
"instances": "Creating and working with instances", "instances": "Creating and working with instances",
"expanding-models": "Expanding models", "expanding-models": "Expanding models",
......
...@@ -9,12 +9,4 @@ var sequelize = new Sequelize('database', 'username'[, null]) ...@@ -9,12 +9,4 @@ var sequelize = new Sequelize('database', 'username'[, null])
// Want no logging? Use that: // Want no logging? Use that:
var sequelize = new Sequelize('database', 'username', 'password', { var sequelize = new Sequelize('database', 'username', 'password', {
logging: false logging: false
}) })
\ No newline at end of file
// Since v0.4.3 you can disable the pluralization of table names:
var sequelize = new Sequelize('database', 'username', 'password', {
disableTableNameModification: true
})
sequelize.define('person', { /* ... */ })
// will result in a table called >person< if that option is specified
// will result in a table called >people< if that option is not specified
\ No newline at end of file
Sequelize will have a Kiwi package in future. For now, you can install it via NPM or just download You can install Sequelize via NPM or just download the code from the git repository and require it's entry file <i>index.js</i>:
the code from the git repository and require Sequelize.js:
<pre><%= partial("code/installation.ejs") %></pre> <pre><%= partial("code/installation.ejs") %></pre>
......
To get the ball rollin' you first have to create an instance of Sequelize. Use it the following way: To get the ball rollin' you first have to create an instance of Sequelize. Use it the following way:
<pre><%- koala(".js", "var sequelize = new Sequelize('database', 'username', 'password')") %></pre> <pre><%- koala(".js", "var sequelize = new Sequelize('database', 'username'[, 'password'])") %></pre>
This will save the passed database credentials and provide all further methods. Furthermore you can specify This will save the passed database credentials and provide all further methods. Furthermore you can specify
a non-default host or port and some options: a non-default host or port and some options:
<pre><%- koala(".js", partial("code/basic-mapping/advanced-instantiation.ejs")) %></pre> <pre><%- koala(".js", partial("code/usage/options.ejs")) %></pre>
To define mappings between a class (Stop telling me that JavaScript don't know classes. Name it however you want to!) To define mappings between a class and a table, use the define method (Stop telling me that JavaScript don't know classes. Name it however you want to!):
and a table, use the define method:
<pre><%- koala(".js", partial("code/basic-mapping/basic-mapping-1.ejs")) %></pre> <pre><%- koala(".js", partial("code/usage/basic-mapping.ejs")) %></pre>
Sequelize currently supports the following datatypes: Sequelize currently supports the following datatypes:
<pre><%= partial("code/basic-mapping/basic-mapping-2.ejs") %></pre> <pre><%= partial("code/usage/basic-mapping-2.ejs") %></pre>
You can also store your model definitions in a single file using the import method: You can also store your model definitions in a single file using the import method:
<pre><%- koala(".js", partial("code/basic-mapping/basic-mapping-3.ejs")) %></pre> <pre><%- koala(".js", partial("code/usage/basic-mapping-3.ejs")) %></pre>
Choose the name of the exported function the way you want. It doesn't matter at all. You can also specify multiple Choose the name of the exported function the way you want. It doesn't matter at all. You can also specify multiple
models in one file. The import method will return a hash, which stores the result of sequelize.define under the key <i>Project</i>. models in one file. The import method will return a hash, which stores the result of sequelize.define under the key <i>Project</i>.
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Sequelize &raquo; A MySQL Object-Relational-Mapper for NodeJS</title> <title>Sequelize &raquo; A MySQL Object-Relational-Mapper for NodeJS</title>
<link rel="stylesheet" href="/stylesheets/style.css"> <link rel="stylesheet" href="/stylesheets/style.css">
<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script> <!--<script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>-->
<script type="text/javascript"> <script type="text/javascript">
var _gaq = _gaq || []; var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9039631-4']); _gaq.push(['_setAccount', 'UA-9039631-4']);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!