Skip to content

Commit

Permalink
feat(sql): one-dimensional functions are added as parameters for insert
Browse files Browse the repository at this point in the history
  • Loading branch information
Aganivi committed Aug 14, 2023
1 parent 5956789 commit 7b644b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/sql/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ class SqlOperation {

insert = async function (table: string, values: SqlInsertValuesState) {
let res: string
const isDArray = Array.isArray(values[0])
if (this.insertValues.get(table) && this.insertValues.get(table).length < 100)
clearTimeout(this.timeoutId.get(table))
values = isDArray ? values : [values as Array<number | string>]
this.insertValues.set(table, this.insertValues.get(table) ? this.insertValues.get(table).concat(values) : values)

this.timeoutId.set(
Expand Down
2 changes: 1 addition & 1 deletion src/type/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ export interface CreateTableQueryState {
fields: string[]
}

export type SqlInsertValuesState = Array<Array<number | string>>
export type SqlInsertValuesState = Array<Array<number | string>> | Array<number | string>

0 comments on commit 7b644b4

Please sign in to comment.