Skip to content

Commit

Permalink
make it even more clear that table interfaces are not row types
Browse files Browse the repository at this point in the history
  • Loading branch information
koskimas committed Mar 24, 2024
1 parent ecbcaf8 commit 9485b44
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions site/docs/getting-started/_types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export interface Database {
pet: PetTable
}

// This interface describes the `person` table to Kysely. Table
// interfaces should only be used in the `Database` type above
// and never as a result type of a query!. See the `Person`,
// `NewPerson` and `PersonUpdate` types below.
export interface PersonTable {
// Columns that are generated by the database should be marked
// using the `Generated` type. This way they are automatically
Expand Down Expand Up @@ -57,6 +61,9 @@ export interface PersonTable {
// You should not use the table schema interfaces directly. Instead, you should
// use the `Selectable`, `Insertable` and `Updateable` wrappers. These wrappers
// make sure that the correct types are used in each operation.
//
// Most of the time you should trust the type inference and not use explicit
// types at all. These types can be useful when typing function arguments.
export type Person = Selectable<PersonTable>
export type NewPerson = Insertable<PersonTable>
export type PersonUpdate = Updateable<PersonTable>
Expand Down

0 comments on commit 9485b44

Please sign in to comment.