This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type UniqueArray<T> = T extends readonly [infer X, ...infer Rest] | |
? InArray<Rest, X> extends true | |
? ['Encountered value with duplicates:', X] | |
: readonly [X, ...UniqueArray<Rest>] | readonly [...UniqueArray<Rest>] | |
: T; | |
type InArray<T, X> = T extends readonly [X, ...infer _Rest] | |
? true | |
: T extends readonly [X] | |
? true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.schemaname, | |
t.relname, | |
l.locktype, | |
l.page, | |
l.virtualtransaction, | |
l.pid, | |
l.mode, | |
l.granted | |
FROM pg_locks l | |
JOIN pg_stat_all_tables t ON l.relation = t.relid AND t.schemaname <> 'pg_catalog'::name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION trigger_set_timestamp() | |
RETURNS TRIGGER AS $$ | |
BEGIN | |
NEW.updated_at = NOW(); | |
RETURN NEW; | |
END; | |
$$ LANGUAGE plpgsql; | |
ALTER TABLE users ADD created_at TIMESTAMP NOT NULL DEFAULT NOW(); | |
ALTER TABLE users ADD updated_at TIMESTAMP NOT NULL DEFAULT NOW(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/node_modules | |
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATABASE_NAME= | |
DATABASE_USER= | |
DATABASE_PASSWORD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dotenv from 'dotenv'; | |
import { DeepPartial } from 'typeorm'; | |
type Join<K, P> = K extends string | number | |
? P extends string | number | |
? `${K}${'' extends P ? '' : '.'}${P}` | |
: never | |
: never; | |
type Prev = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...0[]]; | |
export type Paths<T, D extends number = 10> = [D] extends [never] |