You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
401 B
14 lines
401 B
4 months ago
|
/**
|
||
|
* 格式化SQL语句
|
||
|
* */
|
||
|
|
||
|
function formatSQL(tableStruct){
|
||
|
let field = ''
|
||
|
for(let i of tableStruct.field){
|
||
|
field += `${i.name} ${i.type} ${i.attribute.join(' ')} comment "${i.comment}",`
|
||
|
}
|
||
|
field = field.slice(0, field.length - 1)
|
||
|
return `Create Table If Not Exists ${tableStruct.tableName} (${field})comment = "${tableStruct.comment}";`
|
||
|
}
|
||
|
|
||
|
module.exports = formatSQL
|