mirror of
https://github.com/knex/knex.git
synced 2025-09-01 20:36:55 +00:00
adding a simple logo, trying to git gh pages back up
This commit is contained in:
parent
9928af4682
commit
e5fd8df44a
@ -95,6 +95,36 @@ exports.schemaGrammar = {
|
|||||||
// Compile a drop table (if exists) command.
|
// Compile a drop table (if exists) command.
|
||||||
compileDropTableIfExists: function(blueprint, command) {
|
compileDropTableIfExists: function(blueprint, command) {
|
||||||
return 'drop table if exists ' + this.wrapTable(blueprint);
|
return 'drop table if exists ' + this.wrapTable(blueprint);
|
||||||
|
},
|
||||||
|
|
||||||
|
// Compile a drop index command.
|
||||||
|
compileDropIndex: function(blueprint, command) {
|
||||||
|
return 'drop index ' + command.index;
|
||||||
|
},
|
||||||
|
|
||||||
|
// Create the column definition for a tiny integer type.
|
||||||
|
typeTinyInteger: function() {
|
||||||
|
return 'tinyint';
|
||||||
|
},
|
||||||
|
|
||||||
|
// Create the column definition for a time type.
|
||||||
|
typeTime: function(column) {
|
||||||
|
return 'time';
|
||||||
|
},
|
||||||
|
|
||||||
|
// Create the column definition for a date type.
|
||||||
|
typeDate: function(column) {
|
||||||
|
return 'date';
|
||||||
|
},
|
||||||
|
|
||||||
|
// Create the column definition for a binary type.
|
||||||
|
typeBinary: function(column) {
|
||||||
|
return 'blob';
|
||||||
|
},
|
||||||
|
|
||||||
|
// Get the SQL for a nullable column modifier.
|
||||||
|
modifyNullable: function(blueprint, column) {
|
||||||
|
return column.isNullable ? ' null' : ' not null';
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -175,11 +175,6 @@ MysqlClient.schemaGrammar = _.extend({}, base.schemaGrammar, MysqlClient.grammar
|
|||||||
return 'int(' + column.length + ')';
|
return 'int(' + column.length + ')';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a tiny integer type.
|
|
||||||
typeTinyInteger: function() {
|
|
||||||
return 'tinyint';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a float type.
|
// Create the column definition for a float type.
|
||||||
typeFloat: function(column) {
|
typeFloat: function(column) {
|
||||||
return 'float(' + column.total + ',' + column.places + ')';
|
return 'float(' + column.total + ',' + column.places + ')';
|
||||||
@ -200,21 +195,11 @@ MysqlClient.schemaGrammar = _.extend({}, base.schemaGrammar, MysqlClient.grammar
|
|||||||
return "enum('" + column.allowed.join("', '") + "')";
|
return "enum('" + column.allowed.join("', '") + "')";
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a date type.
|
|
||||||
typeDate: function(column) {
|
|
||||||
return 'date';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a date-time type.
|
// Create the column definition for a date-time type.
|
||||||
typeDateTime: function(column) {
|
typeDateTime: function(column) {
|
||||||
return 'datetime';
|
return 'datetime';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a time type.
|
|
||||||
typeTime: function(column) {
|
|
||||||
return 'time';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a timestamp type.
|
// Create the column definition for a timestamp type.
|
||||||
typeTimestamp: function(column) {
|
typeTimestamp: function(column) {
|
||||||
return 'timestamp default 0';
|
return 'timestamp default 0';
|
||||||
@ -225,21 +210,11 @@ MysqlClient.schemaGrammar = _.extend({}, base.schemaGrammar, MysqlClient.grammar
|
|||||||
return column.length !== false ? 'bit(' + column.length + ')' : 'bit';
|
return column.length !== false ? 'bit(' + column.length + ')' : 'bit';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a binary type.
|
|
||||||
typeBinary: function(column) {
|
|
||||||
return 'blob';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Get the SQL for an unsigned column modifier.
|
// Get the SQL for an unsigned column modifier.
|
||||||
modifyUnsigned: function(blueprint, column) {
|
modifyUnsigned: function(blueprint, column) {
|
||||||
if (column.isUnsigned) return ' unsigned';
|
if (column.isUnsigned) return ' unsigned';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get the SQL for a nullable column modifier.
|
|
||||||
modifyNullable: function(blueprint, column) {
|
|
||||||
return column.isNullable ? ' null' : ' not null';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Get the SQL for a default column modifier.
|
// Get the SQL for a default column modifier.
|
||||||
modifyDefault: function(blueprint, column) {
|
modifyDefault: function(blueprint, column) {
|
||||||
// TODO - no default on blob/text
|
// TODO - no default on blob/text
|
||||||
|
@ -157,11 +157,6 @@ PostgresClient.schemaGrammar = _.extend({}, base.schemaGrammar, PostgresClient.g
|
|||||||
return "alter table " + table + " drop constraint " + command.index;
|
return "alter table " + table + " drop constraint " + command.index;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Compile a drop index command.
|
|
||||||
compileDropIndex: function(blueprint, command) {
|
|
||||||
return "drop index " + command.index;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Compile a drop foreign key command.
|
// Compile a drop foreign key command.
|
||||||
compileDropForeign: function(blueprint, command) {
|
compileDropForeign: function(blueprint, command) {
|
||||||
var table = this.wrapTable(blueprint);
|
var table = this.wrapTable(blueprint);
|
||||||
@ -213,21 +208,11 @@ PostgresClient.schemaGrammar = _.extend({}, base.schemaGrammar, PostgresClient.g
|
|||||||
return "enum('" + column.allowed.join("', '") + "')";
|
return "enum('" + column.allowed.join("', '") + "')";
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a date type.
|
|
||||||
typeDate: function(column) {
|
|
||||||
return 'date';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a date-time type.
|
// Create the column definition for a date-time type.
|
||||||
typeDateTime: function(column) {
|
typeDateTime: function(column) {
|
||||||
return 'timestamp';
|
return 'timestamp';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a time type.
|
|
||||||
typeTime: function(column) {
|
|
||||||
return 'time';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a timestamp type.
|
// Create the column definition for a timestamp type.
|
||||||
typeTimestamp: function(column) {
|
typeTimestamp: function(column) {
|
||||||
return 'timestamp';
|
return 'timestamp';
|
||||||
@ -243,11 +228,6 @@ PostgresClient.schemaGrammar = _.extend({}, base.schemaGrammar, PostgresClient.g
|
|||||||
return 'bytea';
|
return 'bytea';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get the SQL for a nullable column modifier.
|
|
||||||
modifyNullable: function(blueprint, column) {
|
|
||||||
return column.isNullable ? ' null' : ' not null';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Get the SQL for a default column modifier.
|
// Get the SQL for a default column modifier.
|
||||||
modifyDefault: function(blueprint, column) {
|
modifyDefault: function(blueprint, column) {
|
||||||
if (column.defaultValue) {
|
if (column.defaultValue) {
|
||||||
|
@ -240,11 +240,6 @@ Sqlite3Client.schemaGrammar = _.extend({}, base.schemaGrammar, Sqlite3Client.gra
|
|||||||
return 'drop index ' + command.index;
|
return 'drop index ' + command.index;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Compile a drop index command.
|
|
||||||
compileDropIndex: function(blueprint, command) {
|
|
||||||
return 'drop index ' + command.index;
|
|
||||||
},
|
|
||||||
|
|
||||||
// Compile a rename table command.
|
// Compile a rename table command.
|
||||||
compileRenameTable: function(blueprint, command) {
|
compileRenameTable: function(blueprint, command) {
|
||||||
return 'alter table ' + this.wrapTable(blueprint) + ' rename to ' + this.wrapTable(command.to);
|
return 'alter table ' + this.wrapTable(blueprint) + ' rename to ' + this.wrapTable(command.to);
|
||||||
@ -280,43 +275,23 @@ Sqlite3Client.schemaGrammar = _.extend({}, base.schemaGrammar, Sqlite3Client.gra
|
|||||||
return 'tinyint';
|
return 'tinyint';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a tinyint type.
|
|
||||||
typeTinyInteger: function() {
|
|
||||||
return 'tinyint';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a enum type.
|
// Create the column definition for a enum type.
|
||||||
typeEnum: function(column) {
|
typeEnum: function(column) {
|
||||||
return 'varchar';
|
return 'varchar';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a date type.
|
|
||||||
typeDate: function(column) {
|
|
||||||
return 'date';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a date-time type.
|
// Create the column definition for a date-time type.
|
||||||
typeDateTime: function(column) {
|
typeDateTime: function(column) {
|
||||||
return 'datetime';
|
return 'datetime';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a time type.
|
|
||||||
typeTime: function(column) {
|
|
||||||
return 'time';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Create the column definition for a timestamp type.
|
// Create the column definition for a timestamp type.
|
||||||
typeTimestamp: function(column) {
|
typeTimestamp: function(column) {
|
||||||
return 'datetime';
|
return 'datetime';
|
||||||
},
|
},
|
||||||
|
|
||||||
// Create the column definition for a binary type.
|
|
||||||
typeBinary: function(column) {
|
|
||||||
return 'blob';
|
|
||||||
},
|
|
||||||
|
|
||||||
// Get the SQL for a nullable column modifier.
|
// Get the SQL for a nullable column modifier.
|
||||||
modifyNullable: function(blueprint, column) {
|
modifyNullable: function(blueprint) {
|
||||||
return ' null';
|
return ' null';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
BIN
docs/images/knex.png
Normal file
BIN
docs/images/knex.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 KiB |
@ -111,8 +111,10 @@ used to generate the sql in one form or another.</p>
|
|||||||
|
|
||||||
_debug: <span class="literal">false</span>,
|
_debug: <span class="literal">false</span>,
|
||||||
|
|
||||||
debug: <span class="keyword">function</span>(val) {
|
_promise: <span class="literal">null</span>,
|
||||||
<span class="keyword">this</span>._debug = val;
|
|
||||||
|
debug: <span class="keyword">function</span>() {
|
||||||
|
<span class="keyword">this</span>._debug = <span class="literal">true</span>;
|
||||||
<span class="keyword">return</span> <span class="keyword">this</span>;
|
<span class="keyword">return</span> <span class="keyword">this</span>;
|
||||||
},</pre></div></div>
|
},</pre></div></div>
|
||||||
|
|
||||||
@ -125,13 +127,15 @@ used to generate the sql in one form or another.</p>
|
|||||||
<div class="pilwrap ">
|
<div class="pilwrap ">
|
||||||
<a class="pilcrow" href="#section-6">¶</a>
|
<a class="pilcrow" href="#section-6">¶</a>
|
||||||
</div>
|
</div>
|
||||||
<p>For those who dislike promise interfaces.</p>
|
<p>For those who dislike promise interfaces.
|
||||||
|
Multiple calls to <code>exec</code> will resolve with the same value
|
||||||
|
if called more than once.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content"><div class='highlight'><pre> exec: <span class="keyword">function</span>(callback) {
|
<div class="content"><div class='highlight'><pre> exec: <span class="keyword">function</span>(callback) {
|
||||||
<span class="keyword">var</span> run = <span class="keyword">this</span>.runQuery();
|
<span class="keyword">this</span>._promise || (<span class="keyword">this</span>._promise = <span class="keyword">this</span>.runQuery());
|
||||||
<span class="keyword">return</span> run.then(<span class="keyword">function</span>(resp) {
|
<span class="keyword">return</span> <span class="keyword">this</span>._promise.then(<span class="keyword">function</span>(resp) {
|
||||||
callback(<span class="literal">null</span>, resp);
|
callback(<span class="literal">null</span>, resp);
|
||||||
}, <span class="keyword">function</span>(err) {
|
}, <span class="keyword">function</span>(err) {
|
||||||
callback(err, <span class="literal">null</span>);
|
callback(err, <span class="literal">null</span>);
|
||||||
@ -152,8 +156,8 @@ used to generate the sql in one form or another.</p>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content"><div class='highlight'><pre> then: <span class="keyword">function</span>(onFulfilled, onRejected) {
|
<div class="content"><div class='highlight'><pre> then: <span class="keyword">function</span>(onFulfilled, onRejected) {
|
||||||
<span class="keyword">var</span> run = <span class="keyword">this</span>.runQuery();
|
<span class="keyword">this</span>._promise || (<span class="keyword">this</span>._promise = <span class="keyword">this</span>.runQuery());
|
||||||
<span class="keyword">return</span> run.then(onFulfilled, onRejected);
|
<span class="keyword">return</span> <span class="keyword">this</span>._promise.then(onFulfilled, onRejected);
|
||||||
},</pre></div></div>
|
},</pre></div></div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
@ -345,9 +349,7 @@ and have it come out fine.</p>
|
|||||||
<span class="string">'orders'</span>, <span class="string">'limit'</span>, <span class="string">'offset'</span>, <span class="string">'unions'</span>
|
<span class="string">'orders'</span>, <span class="string">'limit'</span>, <span class="string">'offset'</span>, <span class="string">'unions'</span>
|
||||||
];
|
];
|
||||||
|
|
||||||
Knex.Grammar = {
|
Knex.Grammar = {</pre></div></div>
|
||||||
|
|
||||||
dateFormat: <span class="string">'Y-m-d H:i:s'</span>,</pre></div></div>
|
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@ -1214,13 +1216,12 @@ where key = value. </p>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content"><div class='highlight'><pre> where: <span class="keyword">function</span>(column, operator, value, bool) {
|
<div class="content"><div class='highlight'><pre> where: <span class="keyword">function</span>(column, operator, value, bool) {
|
||||||
<span class="keyword">var</span> key;
|
|
||||||
bool || (bool = <span class="string">'and'</span>);
|
bool || (bool = <span class="string">'and'</span>);
|
||||||
<span class="keyword">if</span> (_.isFunction(column)) {
|
<span class="keyword">if</span> (_.isFunction(column)) {
|
||||||
<span class="keyword">return</span> <span class="keyword">this</span>._whereNested(column, bool);
|
<span class="keyword">return</span> <span class="keyword">this</span>._whereNested(column, bool);
|
||||||
}
|
}
|
||||||
<span class="keyword">if</span> (_.isObject(column)) {
|
<span class="keyword">if</span> (_.isObject(column)) {
|
||||||
<span class="keyword">for</span> (key <span class="keyword">in</span> column) {
|
<span class="keyword">for</span> (<span class="keyword">var</span> key <span class="keyword">in</span> column) {
|
||||||
value = column[key];
|
value = column[key];
|
||||||
<span class="keyword">this</span>[bool + <span class="string">'Where'</span>](key, <span class="string">'='</span>, value);
|
<span class="keyword">this</span>[bool + <span class="string">'Where'</span>](key, <span class="string">'='</span>, value);
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,7 @@
|
|||||||
margin: 40px 0 50px 260px;
|
margin: 40px 0 50px 260px;
|
||||||
}
|
}
|
||||||
img#logo {
|
img#logo {
|
||||||
width: 396px;
|
width: 450px;
|
||||||
height: 69px;
|
|
||||||
}
|
}
|
||||||
div.warning {
|
div.warning {
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
@ -275,7 +274,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<h1>Knex.js</h1>
|
<img id="logo" src="docs/images/knex.png" alt="Knex.js">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user