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

Commit e417e0a8 by Sascha Depold

some documentation

1 parent f13e4e97
......@@ -137,13 +137,13 @@
<li class="arg">
<code class="optional">[password]</code>
<code class="optional">[password=null]</code>
</li>
<li class="arg">
<code class="optional">[options]</code>
<code class="optional">[options={}]</code>
</li>
......@@ -228,7 +228,7 @@
<li class="param">
<code class="param-name optional">[password]</code>
<code class="param-name optional">[password=null]</code>
<span class="type">String</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
......@@ -244,7 +244,7 @@
<li class="param">
<code class="param-name optional">[options]</code>
<code class="param-name optional">[options={}]</code>
<span class="type">Object</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
......@@ -256,6 +256,192 @@
</div>
<ul class="params-list">
<li class="param">
<code class="param-name optional">[dialect=&#x27;mysql&#x27;]</code>
<span class="type">String</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>The dialect of the relational database.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[host=&#x27;localhost&#x27;]</code>
<span class="type">String</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>The host of the relational database.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[port=3306]</code>
<span class="type">Integer</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>The port of the relational database.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[protocol=&#x27;tcp&#x27;]</code>
<span class="type">String</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>The protocol of the relational database.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[define={}]</code>
<span class="type">Object</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>Options, which shall be default for every model definition.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[query={}]</code>
<span class="type">Object</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>I have absolutely no idea.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[sync={}]</code>
<span class="type">Object</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>Options, which shall be default for every <code>sync</code> call.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[logging=console.log]</code>
<span class="type">Function</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>A function that gets executed everytime Sequelize would log something.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[omitNull=false]</code>
<span class="type">Boolean</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>A flag that defines if null values should be passed to SQL queries or not.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[queue=true]</code>
<span class="type">Boolean</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>I have absolutely no idea.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[native=false]</code>
<span class="type">Boolean</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>A flag that defines if native library shall be used or not.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[replication=false]</code>
<span class="type">Boolean</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>I have absolutely no idea.</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[pool={}]</code>
<span class="type">Object</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>Something.</p>
</div>
</li>
</ul>
</li>
</ul>
......@@ -294,6 +480,8 @@ var sequelize = new Sequelize('my_database', 'john', 'doe', {})
<li class="api-class-tab index"><a href="#index">Index</a></li>
<li class="api-class-tab methods"><a href="#methods">Methods</a></li>
......@@ -304,16 +492,242 @@ var sequelize = new Sequelize('my_database', 'john', 'doe', {})
<h2 class="off-left">Item Index</h2>
<div class="index-section methods">
<h3>Methods</h3>
<ul class="index-list methods">
<li class="index-item method">
<a href="#method_getMigrator">getMigrator</a>
</li>
<li class="index-item method">
<a href="#method_getQueryInterface">getQueryInterface</a>
</li>
</ul>
</div>
</div>
<div id="methods" class="api-class-tabpanel">
<h2 class="off-left">Methods</h2>
<div id="method_getMigrator" class="method item">
<h3 class="name"><code>getMigrator</code></h3>
<div class="args">
<span class="paren">(</span><ul class="args-list inline commas">
<li class="arg">
<code class="optional">[options={}]</code>
</li>
<li class="arg">
<code class="optional">[force=false]</code>
</li>
</ul><span class="paren">)</span>
</div>
<span class="returns-inline">
<span class="type">Migrator</span>
</span>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;lib_sequelize.js.html#l113"><code>lib&#x2F;sequelize.js:113</code></a>
</p>
</div>
<div class="description">
<p>Returns an instance (singleton) of Migrator.</p>
</div>
<div class="params">
<h4>Parameters:</h4>
<ul class="params-list">
<li class="param">
<code class="param-name optional">[options={}]</code>
<span class="type">Object</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>Some options</p>
</div>
</li>
<li class="param">
<code class="param-name optional">[force=false]</code>
<span class="type">Boolean</span>
<span class="flag optional" title="This parameter is optional.">optional</span>
<div class="param-description">
<p>A flag that defines if the migrator should get instantiated or not.</p>
</div>
</li>
</ul>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type">Migrator</span>:
An instance of Migrator.
</div>
</div>
</div>
<div id="method_getQueryInterface" class="method item">
<h3 class="name"><code>getQueryInterface</code></h3>
<span class="paren">()</span>
<span class="returns-inline">
<span class="type"><a href="../classes/QueryInterface.html" class="crosslink">QueryInterface</a></span>
</span>
<div class="meta">
<p>
Defined in
<a href="..&#x2F;files&#x2F;lib_sequelize.js.html#l102"><code>lib&#x2F;sequelize.js:102</code></a>
</p>
</div>
<div class="description">
<p>Returns an instance of QueryInterface.</p>
</div>
<div class="returns">
<h4>Returns:</h4>
<div class="returns-description">
<span class="type"><a href="../classes/QueryInterface.html" class="crosslink">QueryInterface</a></span>:
An instance (singleton) of QueryInterface.
</div>
</div>
</div>
</div>
......
......@@ -103,13 +103,108 @@
"name": "password",
"description": "The password which is used to authenticate against the database.",
"type": "String",
"optional": true
"optional": true,
"optdefault": "null"
},
{
"name": "options",
"description": "An object with options.",
"type": "Object",
"optional": true
"optional": true,
"optdefault": "{}",
"props": [
{
"name": "dialect",
"description": "The dialect of the relational database.",
"type": "String",
"optional": true,
"optdefault": "'mysql'"
},
{
"name": "host",
"description": "The host of the relational database.",
"type": "String",
"optional": true,
"optdefault": "'localhost'"
},
{
"name": "port",
"description": "The port of the relational database.",
"type": "Integer",
"optional": true,
"optdefault": "3306"
},
{
"name": "protocol",
"description": "The protocol of the relational database.",
"type": "String",
"optional": true,
"optdefault": "'tcp'"
},
{
"name": "define",
"description": "Options, which shall be default for every model definition.",
"type": "Object",
"optional": true,
"optdefault": "{}"
},
{
"name": "query",
"description": "I have absolutely no idea.",
"type": "Object",
"optional": true,
"optdefault": "{}"
},
{
"name": "sync",
"description": "Options, which shall be default for every `sync` call.",
"type": "Object",
"optional": true,
"optdefault": "{}"
},
{
"name": "logging",
"description": "A function that gets executed everytime Sequelize would log something.",
"type": "Function",
"optional": true,
"optdefault": "console.log"
},
{
"name": "omitNull",
"description": "A flag that defines if null values should be passed to SQL queries or not.",
"type": "Boolean",
"optional": true,
"optdefault": "false"
},
{
"name": "queue",
"description": "I have absolutely no idea.",
"type": "Boolean",
"optional": true,
"optdefault": "true"
},
{
"name": "native",
"description": "A flag that defines if native library shall be used or not.",
"type": "Boolean",
"optional": true,
"optdefault": "false"
},
{
"name": "replication",
"description": "I have absolutely no idea.",
"type": "Boolean",
"optional": true,
"optdefault": "false"
},
{
"name": "pool",
"description": "Something.",
"type": "Object",
"optional": true,
"optdefault": "{}"
}
]
}
],
"example": [
......@@ -359,9 +454,49 @@
},
{
"file": "lib/sequelize.js",
"line": 80,
"line": 93,
"description": "Reference to Utils",
"class": "Sequelize"
},
{
"file": "lib/sequelize.js",
"line": 102,
"description": "Returns an instance of QueryInterface.",
"itemtype": "method",
"name": "getQueryInterface",
"return": {
"description": "An instance (singleton) of QueryInterface.",
"type": "QueryInterface"
},
"class": "Sequelize"
},
{
"file": "lib/sequelize.js",
"line": 113,
"description": "Returns an instance (singleton) of Migrator.",
"itemtype": "method",
"name": "getMigrator",
"params": [
{
"name": "options",
"description": "Some options",
"type": "Object",
"optional": true,
"optdefault": "{}"
},
{
"name": "force",
"description": "A flag that defines if the migrator should get instantiated or not.",
"type": "Boolean",
"optional": true,
"optdefault": "false"
}
],
"return": {
"description": "An instance of Migrator.",
"type": "Migrator"
},
"class": "Sequelize"
}
],
"warnings": [
......@@ -419,7 +554,7 @@
},
{
"message": "Missing item type\nReference to Utils",
"line": " lib/sequelize.js:80"
"line": " lib/sequelize.js:93"
}
]
}
\ No newline at end of file
......@@ -106,8 +106,21 @@ module.exports = (function() {
@param {String} database The name of the database.
@param {String} username The username which is used to authenticate against the database.
@param {String} [password] The password which is used to authenticate against the database.
@param {Object} [options] An object with options.
@param {String} [password=null] The password which is used to authenticate against the database.
@param {Object} [options={}] An object with options.
@param {String} [options.dialect=&#x27;mysql&#x27;] The dialect of the relational database.
@param {String} [options.host=&#x27;localhost&#x27;] The host of the relational database.
@param {Integer} [options.port=3306] The port of the relational database.
@param {String} [options.protocol=&#x27;tcp&#x27;] The protocol of the relational database.
@param {Object} [options.define={}] Options, which shall be default for every model definition.
@param {Object} [options.query={}] I have absolutely no idea.
@param {Object} [options.sync={}] Options, which shall be default for every &#x60;sync&#x60; call.
@param {Function} [options.logging=console.log] A function that gets executed everytime Sequelize would log something.
@param {Boolean} [options.omitNull=false] A flag that defines if null values should be passed to SQL queries or not.
@param {Boolean} [options.queue=true] I have absolutely no idea.
@param {Boolean} [options.native=false] A flag that defines if native library shall be used or not.
@param {Boolean} [options.replication=false] I have absolutely no idea.
@param {Object} [options.pool={}] Something.
@example
&#x2F;&#x2F; without password and options
......@@ -178,13 +191,28 @@ module.exports = (function() {
Sequelize[dataType] = DataTypes[dataType]
}
&#x2F;**
Returns an instance of QueryInterface.
@method getQueryInterface
@return {QueryInterface} An instance (singleton) of QueryInterface.
*&#x2F;
Sequelize.prototype.getQueryInterface = function() {
this.queryInterface = this.queryInterface || new QueryInterface(this)
return this.queryInterface
}
&#x2F;**
Returns an instance (singleton) of Migrator.
@method getMigrator
@param {Object} [options={}] Some options
@param {Boolean} [force=false] A flag that defines if the migrator should get instantiated or not.
@return {Migrator} An instance of Migrator.
*&#x2F;
Sequelize.prototype.getMigrator = function(options, force) {
var Migrator = require(&quot;.&#x2F;migrator&quot;)
if (force) {
this.migrator = new Migrator(this, options)
} else {
......@@ -232,10 +260,9 @@ module.exports = (function() {
this.getMigrator().migrate(options)
}
Sequelize.prototype.query = function(sql, callee, options) {
Sequelize.prototype.query = function(sql, callee, options, replacements) {
if (arguments.length === 4) {
values.unshift(sql)
sql = Utils.format(values)
sql = Utils.format([sql].concat(replacements))
} else if (arguments.length === 3) {
options = options
} else if (arguments.length === 2) {
......
......@@ -14,8 +14,21 @@ module.exports = (function() {
@param {String} database The name of the database.
@param {String} username The username which is used to authenticate against the database.
@param {String} [password] The password which is used to authenticate against the database.
@param {Object} [options] An object with options.
@param {String} [password=null] The password which is used to authenticate against the database.
@param {Object} [options={}] An object with options.
@param {String} [options.dialect='mysql'] The dialect of the relational database.
@param {String} [options.host='localhost'] The host of the relational database.
@param {Integer} [options.port=3306] The port of the relational database.
@param {String} [options.protocol='tcp'] The protocol of the relational database.
@param {Object} [options.define={}] Options, which shall be default for every model definition.
@param {Object} [options.query={}] I have absolutely no idea.
@param {Object} [options.sync={}] Options, which shall be default for every `sync` call.
@param {Function} [options.logging=console.log] A function that gets executed everytime Sequelize would log something.
@param {Boolean} [options.omitNull=false] A flag that defines if null values should be passed to SQL queries or not.
@param {Boolean} [options.queue=true] I have absolutely no idea.
@param {Boolean} [options.native=false] A flag that defines if native library shall be used or not.
@param {Boolean} [options.replication=false] I have absolutely no idea.
@param {Object} [options.pool={}] Something.
@example
// without password and options
......@@ -86,13 +99,28 @@ module.exports = (function() {
Sequelize[dataType] = DataTypes[dataType]
}
/**
Returns an instance of QueryInterface.
@method getQueryInterface
@return {QueryInterface} An instance (singleton) of QueryInterface.
*/
Sequelize.prototype.getQueryInterface = function() {
this.queryInterface = this.queryInterface || new QueryInterface(this)
return this.queryInterface
}
/**
Returns an instance (singleton) of Migrator.
@method getMigrator
@param {Object} [options={}] Some options
@param {Boolean} [force=false] A flag that defines if the migrator should get instantiated or not.
@return {Migrator} An instance of Migrator.
*/
Sequelize.prototype.getMigrator = function(options, force) {
var Migrator = require("./migrator")
if (force) {
this.migrator = new Migrator(this, options)
} else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!