-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from CleverStack/1.2.0
Moving logic into clever-orm and clever-odm modules
- Loading branch information
Showing
7 changed files
with
145 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
var Promise = require( 'bluebird' ) | ||
, path = require( 'path' ) | ||
, ejs = require( 'ejs' ) | ||
, appRoot = require( 'injector' ).getInstance( 'appRoot' ); | ||
var Promise = require( 'bluebird' ) | ||
, path = require( 'path' ) | ||
, ejs = require( 'ejs' ) | ||
, appRoot = require( 'injector' ).getInstance( 'appRoot' ); | ||
|
||
module.exports = function( template, data ) { | ||
module.exports = function( template, data ) { | ||
return new Promise( function( resolve, reject ) { | ||
ejs.renderFile( appRoot + path.sep + template, data, function( err, html ){ | ||
if ( err ) { | ||
reject( err ); | ||
return; | ||
} | ||
|
||
resolve(html); | ||
resolve( html ); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
var types = { | ||
ENUM: function() { | ||
return { | ||
type : this.ENUM, | ||
values : [].slice.call( arguments ), | ||
toString: function() { | ||
return this.type; | ||
} | ||
} | ||
}, | ||
TINYINT: function( length ) { | ||
return { | ||
type: this.TINYINT, | ||
length: length, | ||
toString: function() { | ||
return this.type; | ||
} | ||
} | ||
}, | ||
BIGINT: function( length ) { | ||
return { | ||
type: this.BIGINT, | ||
length: length, | ||
toString: function() { | ||
return this.type; | ||
} | ||
} | ||
}, | ||
FLOAT: function( length, decimals ) { | ||
var field = { | ||
type: this.FLOAT, | ||
length: length, | ||
toString: function() { | ||
return this.type; | ||
} | ||
} | ||
|
||
if ( decimals !== undefined ) { | ||
field.decimals = decimals; | ||
} | ||
|
||
return field; | ||
}, | ||
DECIMAL: function( precision, scale ) { | ||
var field = { | ||
type: this.DECIMAL, | ||
precision: precision, | ||
toString: function() { | ||
return this.type; | ||
} | ||
} | ||
|
||
if ( scale !== undefined ) { | ||
field.scale = scale; | ||
} | ||
|
||
return field; | ||
}, | ||
TEXT: function() { | ||
return { | ||
type: this.TEXT, | ||
toString: function() { | ||
return this.type; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
Object.keys( types ).forEach( function( type ) { | ||
types[ type ].toString = function() { | ||
return '' + type; | ||
} | ||
}); | ||
|
||
module.exports = types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters