From 2331b33d1cd1d4aa9e2bbb603315567dfb1e4232 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20=C3=81vila?= Date: Wed, 4 Dec 2024 11:23:42 -0300 Subject: [PATCH] Add more sql supported types to safe string builders --- src/safe-string.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/safe-string.ts b/src/safe-string.ts index 5d9587d..658a136 100644 --- a/src/safe-string.ts +++ b/src/safe-string.ts @@ -44,100 +44,98 @@ export class SafeString { /** * @since 2.0.8 */ - equals(other: SafeString | null | number | string): SafeString { + equals(other: SqlSupportedTypes): SafeString { return dsql`(${this} = ${other})`; } /** * @since 2.0.8 */ - different(other: SafeString | null | number | string): SafeString { + different(other: SqlSupportedTypes): SafeString { return dsql`(${this} != ${other})`; } /** * @since 2.0.8 */ - greaterThan(other: SafeString | null | number | string): SafeString { + greaterThan(other: SqlSupportedTypes): SafeString { return dsql`(${this} > ${other})`; } /** * @since 2.0.8 */ - greaterThanOrEqual(other: SafeString | null | number | string): SafeString { + greaterThanOrEqual(other: SqlSupportedTypes): SafeString { return dsql`(${this} >= ${other})`; } /** * @since 2.0.8 */ - lessThan(other: SafeString | null | number | string): SafeString { + lessThan(other: SqlSupportedTypes): SafeString { return dsql`(${this} < ${other})`; } /** * @since 2.0.8 */ - lessThanOrEqual(other: SafeString | null | number | string): SafeString { + lessThanOrEqual(other: SqlSupportedTypes): SafeString { return dsql`(${this} <= ${other})`; } /** * @since 2.0.8 */ - and(other: SafeString | null | number | string): SafeString { + and(other: SqlSupportedTypes): SafeString { return dsql`(${this} AND ${other})`; } /** * @since 2.0.8 */ - or(other: SafeString | null | number | string): SafeString { + or(other: SqlSupportedTypes): SafeString { return dsql`(${this} OR ${other})`; } /** * @since 2.0.8 */ - add(other: SafeString | null | number | string): SafeString { + add(other: SqlSupportedTypes): SafeString { return dsql`(${this} + ${other})`; } /** * @since 2.0.8 */ - subtract(other: SafeString | null | number | string): SafeString { + subtract(other: SqlSupportedTypes): SafeString { return dsql`(${this} - ${other})`; } /** * @since 2.0.8 */ - multiply(other: SafeString | null | number | string): SafeString { + multiply(other: SqlSupportedTypes): SafeString { return dsql`(${this} * ${other})`; } /** * @since 2.0.8 */ - divide(other: SafeString | null | number | string): SafeString { + divide(other: SqlSupportedTypes): SafeString { return dsql`(${this} / ${other})`; } /** * @since 2.0.8 */ - in(other: SafeString | null | number | string | SafeString[]): SafeString { + in(other: SqlSupportedTypes): SafeString { return dsql`(${this} IN (${other}))`; } /** * @since 2.0.8 */ - notIn( - other: SafeString | null | number | string | SafeString[] - ): SafeString { + notIn(other: SqlSupportedTypes): SafeString { return dsql`(${this} NOT IN (${other}))`; } }