0.1.8 • Published 9 years ago

mysql-types v0.1.8

Weekly downloads
-
License
MIT
Repository
-
Last release
9 years ago

Usage

var mysqlType = require('mysql-types');

Conversions

JS TypeMySQL Type
stringVARCHAR (automatically converted to TEXT when adding more characters)
numberSMALLINT
booleanTINYINT(1)
dateDATETIME
functiontries if function is constructor and uses type of instance else Error
objectError
arrayError

Examples

let string = mysqlType('string') // VARCHAR
let string = mysqlType(String) // VARCHAR

let number = mysqlType(123) // SMALLINT
let number = mysqlType(Number) // SMALLINT

let date = mysqlType(new Date()) // DATETIME
let date = mysqlType(Date) // DATETIME

let bool = mysqlType(true) // TINYINT(1)
let bool = mysqlType(Boolean) // TINYINT(1)
0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago