mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
37 lines
1015 B
TypeScript
37 lines
1015 B
TypeScript
import { DateHelper } from '../types';
|
|
import { Knex } from 'knex';
|
|
|
|
export class DateHelperMySQL extends DateHelper {
|
|
year(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('YEAR(??.??)', [table, column]);
|
|
}
|
|
|
|
month(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('MONTH(??.??)', [table, column]);
|
|
}
|
|
|
|
week(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('WEEK(??.??)', [table, column]);
|
|
}
|
|
|
|
day(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('DAYOFMONTH(??.??)', [table, column]);
|
|
}
|
|
|
|
weekday(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('DAYOFWEEK(??.??)', [table, column]);
|
|
}
|
|
|
|
hour(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('HOUR(??.??)', [table, column]);
|
|
}
|
|
|
|
minute(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('MINUTE(??.??)', [table, column]);
|
|
}
|
|
|
|
second(table: string, column: string): Knex.Raw {
|
|
return this.knex.raw('SECOND(??.??)', [table, column]);
|
|
}
|
|
}
|