-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5670e2
commit b2c6186
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {type a,b} from './types' | ||
|
||
type asd= a.TestUser | ||
|
||
const c = b.C |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { ColumnType } from "kysely"; | ||
|
||
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> | ||
? ColumnType<S, I | undefined, U> | ||
: ColumnType<T, T | undefined, T>; | ||
export type Timestamp = ColumnType<Date, Date | string, Date | string>; | ||
|
||
export type Eagle = { | ||
id: number; | ||
name: string; | ||
}; | ||
export type Elephant = { | ||
id: number; | ||
name: string; | ||
}; | ||
export type DB = { | ||
"birds.eagles": Eagle; | ||
"mammals.elephants": Elephant; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { ColumnType } from "kysely"; | ||
|
||
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> | ||
? ColumnType<S, I | undefined, U> | ||
: ColumnType<T, T | undefined, T>; | ||
export type Timestamp = ColumnType<Date, Date | string, Date | string>; | ||
|
||
export const Ability = { | ||
FLY: "FLY", | ||
WALK: "WALK", | ||
} as const; | ||
export type Ability = (typeof Ability)[keyof typeof Ability]; | ||
export const Color = { | ||
GRAY: "GRAY", | ||
PINK: "PINK", | ||
} as const; | ||
export type Color = (typeof Color)[keyof typeof Color]; | ||
export type Eagle = { | ||
id: number; | ||
name: string; | ||
ability: Generated<Ability>; | ||
}; | ||
export type Elephant = { | ||
id: number; | ||
name: string; | ||
ability: Generated<Ability>; | ||
color: Color; | ||
}; | ||
export type DB = { | ||
"birds.eagles": Eagle; | ||
"mammals.elephants": Elephant; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
generator kysely { | ||
provider = "node ./dist/bin.js" | ||
previewFeatures = ["multiSchema"] | ||
} | ||
|
||
datasource db { | ||
provider = "postgresql" | ||
schemas = ["mammals", "birds", "world"] | ||
url = env("TEST_DATABASE_URL") | ||
} | ||
|
||
model Elephant { | ||
id Int @id | ||
name String | ||
ability Ability @default(WALK) | ||
color Color | ||
@@map("elephants") | ||
@@schema("mammals") | ||
} | ||
|
||
model Eagle { | ||
id Int @id | ||
name String | ||
ability Ability @default(FLY) | ||
@@map("eagles") | ||
@@schema("birds") | ||
} | ||
|
||
enum Ability { | ||
FLY | ||
WALK | ||
@@schema("world") | ||
} | ||
|
||
enum Color { | ||
GRAY | ||
PINK | ||
@@schema("mammals") | ||
} |
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