Update README.md

Some initial documentation of `dataType` usage.
This commit is contained in:
dgsan 2013-06-06 12:25:20 -06:00
parent d086d0c845
commit 87bf863a0a
1 changed files with 40 additions and 0 deletions

View File

@ -32,6 +32,46 @@ To use it you need `jugglingdb@0.2.x`.
## Running tests
npm test
## Using the `dataType` field/column option with MySQL
The jugglingdb MySQL adapter now supports using the `dataType` column/property attribute to specify what MySQL column type is used for many jugglingdb types.
The following type-dataType combinations are supported (incomplete):
* Number
* integer types
* tinyint
* smallint
* mediumint
* int
* bigint
* use the 'limit' option to alter the display width
* example:
`{ count : { type: Number, dataType: 'smallInt' }}`
* floating point types
* float
* double
* use the `precision` and `scale` options to specify custom precision. Default is (16,8).
* example:
`{ average : { type: Number, dataType: 'float', precision: 20, scale: 4 }}`
* fixed-point exact value types
* decimal
* numeric
* use the `precision` and `scale` options to specify custom precision. Default is (9,2).
* these aren't likely to function as true fixed-point.
* example:
`{ stdDev : { type: Number, dataType: 'decimal', precision: 12, scale: 8 }}`
* String / Schema.Text / Schema.JSON
* varchar
* char
* text
* mediumtext
* tinytext
* longtext
* Date
* datetime
* timestamp
## MIT License