Skip to content

Commit

Permalink
Add null value support
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubknejzlik committed Jan 10, 2024
1 parent 0380900 commit 5e2c807
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ const escapeValue = (value: ConditionValue): string => {
return `${value}`;
};
export const escapeColumn = (name: string): string => {
if (name === "NULL") {
return name;
}
const columnMatch = name.match(/^[\.a-zA-Z0-9_]+$/);
if (columnMatch) {
return `\`${name.replace(/`/g, "``").split(".").join("`.`")}\``;
Expand Down
3 changes: 3 additions & 0 deletions src/Function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export const Function = {
string: (value: string) => {
return `'${value}'`;
},
null: () => {
return `NULL`;
},
concat: (...values: string[]) => {
return `CONCAT(${values.join(",")})`;
},
Expand Down

0 comments on commit 5e2c807

Please sign in to comment.