@minatojs/sql-utils
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -45,3 +45,2 @@ import { Dict } from 'cosmokit'; | ||
protected transformers: Dict<Transformer>; | ||
protected readonly _timezone: string; | ||
constructor(driver: Driver, tables?: Dict<Model>); | ||
@@ -48,0 +47,0 @@ protected unescapeId(value: string): string; |
{ | ||
"name": "@minatojs/sql-utils", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "SQL Utilities for Minato", | ||
@@ -44,3 +44,3 @@ "type": "module", | ||
"peerDependencies": { | ||
"minato": "^3.1.0" | ||
"minato": "^3.2.0" | ||
}, | ||
@@ -47,0 +47,0 @@ "dependencies": { |
@@ -68,4 +68,2 @@ import { Dict, isNullable, mapValues } from 'cosmokit' | ||
protected readonly _timezone = `+${(new Date()).getTimezoneOffset() / -60}:00`.replace('+-', '-') | ||
constructor(protected driver: Driver, tables?: Dict<Model>) { | ||
@@ -171,9 +169,2 @@ this.state.tables = tables | ||
$literal: ([value, type]) => this.escape(value, type as any), | ||
$number: (arg) => { | ||
const value = this.parseEval(arg) | ||
const type = Type.fromTerm(arg) | ||
const res = type.type === 'time' ? `unix_timestamp(convert_tz(addtime('1970-01-01 00:00:00', ${value}), '${this._timezone}', '+0:00'))` | ||
: ['timestamp', 'date'].includes(type.type!) ? `unix_timestamp(convert_tz(${value}, '${this._timezone}', '+0:00'))` : `(0+${value})` | ||
return this.asEncoded(`ifnull(${res}, 0)`, false) | ||
}, | ||
@@ -180,0 +171,0 @@ // aggregation |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151930
2336