Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/local/share/.cache/yarn/v6/npm-knex-2.4.0-integrity/node_modules/knex/lib/knex-builder/ drwxr-xr-x | |
| Viewing file: Select action/file-type: // FunctionHelper
// -------
// Used for adding functions from the builder
// Example usage: table.dateTime('datetime_to_date').notNull().defaultTo(knex.fn.now());
class FunctionHelper {
constructor(client) {
this.client = client;
}
now(precision) {
if (typeof precision === 'number') {
return this.client.raw(`CURRENT_TIMESTAMP(${precision})`);
}
return this.client.raw('CURRENT_TIMESTAMP');
}
uuidToBin(uuid, ordered = true) {
const buf = Buffer.from(uuid.replace(/-/g, ''), 'hex');
return ordered
? Buffer.concat([
buf.slice(6, 8),
buf.slice(4, 6),
buf.slice(0, 4),
buf.slice(8, 16),
])
: Buffer.concat([
buf.slice(0, 4),
buf.slice(4, 6),
buf.slice(6, 8),
buf.slice(8, 16),
]);
}
binToUuid(bin, ordered = true) {
const buf = Buffer.from(bin, 'hex');
return ordered
? [
buf.toString('hex', 4, 8),
buf.toString('hex', 2, 4),
buf.toString('hex', 0, 2),
buf.toString('hex', 8, 10),
buf.toString('hex', 10, 16),
].join('-')
: [
buf.toString('hex', 0, 4),
buf.toString('hex', 4, 6),
buf.toString('hex', 6, 8),
buf.toString('hex', 8, 10),
buf.toString('hex', 10, 16),
].join('-');
}
}
module.exports = FunctionHelper;
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0074 ]-- |