1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-10 05:46:46 +01:00
immich/server/src/infra/infra.util.ts

28 lines
1 KiB
TypeScript
Raw Normal View History

import { SetMetadata } from '@nestjs/common';
export const GENERATE_SQL_KEY = 'generate-sql-key';
export interface GenerateSqlQueries {
name?: string;
params?: any[];
}
/** Decorator to enable versioning/tracking of generated Sql */
export const GenerateSql = (...options: GenerateSqlQueries[]) => SetMetadata(GENERATE_SQL_KEY, options);
export const DummyValue = {
UUID: '00000000-0000-4000-a000-000000000000',
PAGINATION: { take: 10, skip: 0 },
EMAIL: 'user@immich.app',
STRING: 'abcdefghi',
BUFFER: Buffer.from('abcdefghi'),
DATE: new Date(),
2024-01-04 05:32:52 +01:00
TIME_BUCKET: '2024-01-01T00:00:00.000Z',
};
// PostgreSQL uses a 16-bit integer to indicate the number of bound parameters. This means that the
// maximum number of parameters is 65535. Any query that tries to bind more than that (e.g. searching
// by a list of IDs) requires splitting the query into multiple chunks.
// We are rounding down this limit, as queries commonly include other filters and parameters.
export const DATABASE_PARAMETER_CHUNK_SIZE = 65500;