mirror of https://github.com/aldy505/sql-dsl.git
fix: typings
This commit is contained in:
parent
e9c2153538
commit
8583fc7f48
|
@ -12,7 +12,6 @@ export default {
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
external: ['crypto', 'fs', 'path'],
|
|
||||||
plugins: [
|
plugins: [
|
||||||
ts(),
|
ts(),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export interface SqlObject {
|
export interface SqlObject {
|
||||||
sql: string
|
sql: string
|
||||||
values: TemplateStringsArray
|
values: any[]
|
||||||
formatQuestion?: () => SqlObject
|
formatQuestion?: () => SqlObject
|
||||||
formatColon?: () => SqlObject
|
formatColon?: () => SqlObject
|
||||||
formatAtP?: () => SqlObject
|
formatAtP?: () => SqlObject
|
||||||
|
@ -22,7 +22,7 @@ export interface SqlObject {
|
||||||
* const colon = query.formatColon()
|
* const colon = query.formatColon()
|
||||||
* // colon.sql = 'select * from users where email = :1'
|
* // colon.sql = 'select * from users where email = :1'
|
||||||
*/
|
*/
|
||||||
export function sql(string: string[], ...params: TemplateStringsArray): SqlObject {
|
export function sql(string: TemplateStringsArray, ...params: any[]): SqlObject {
|
||||||
const sql = string.map((v, i) => (string.length - 1 === i) ? v : `${v}$${i + 1}`).join('');
|
const sql = string.map((v, i) => (string.length - 1 === i) ? v : `${v}$${i + 1}`).join('');
|
||||||
|
|
||||||
function formatQuestion(): SqlObject {
|
function formatQuestion(): SqlObject {
|
||||||
|
|
Loading…
Reference in New Issue