Comments (4)
I fixed the getting started guide.
from kysely.
Hey 👋
This is a documentation issue - PR's welcome.
findPersonById
should acceptbigint
or evennumber | bigint
.- Since we're in MySQL context -
insertId
is notundefined
, you can add a non-null assertion as follows:return await findPersonById(insertId!)
from kysely.
Okay, but then person is defined as
export interface PersonTable {
// Columns that are generated by the database should be marked
// using the `Generated` type. This way they are automatically
// made optional in inserts and updates.
id: Generated<number>
...
and the Person
interface doesn't accept bigint
in other parts of the examples. I can change everything to bigint
, but shouldn't the executeTakeFirstOrThrow()
function return insertId
typed based on the interface (number
)? and not bigint
?
from kysely.
We don't know which property is the auto incrementing primary key. All Kysely sees is the table interface and there's no indication of the primary key. Some tables don't even have it or they have a composite primary key.
Bigint is used because it can hold any integer value, unlike number
.
You can easily cast the type using Number(insertId!)
from kysely.
Related Issues (20)
- typescript error when using output on insertInto HOT 2
- Improvement of lateral support HOT 1
- Postgres capitalized tables HOT 2
- Referencing a nested JSON property with `DynamicModule.ref` HOT 6
- Reusing Join and Select with different Where HOT 2
- TypeError: Cannot read properties of undefined (reading '#props') if destructuring SelectQueryBuilder HOT 2
- ColumnType<Date, Date, never> doesn't detect functions HOT 2
- TraversedJSONPathBuilder.$castTo and .$notNull should return TraversedJSONPathBuilder instead of JSONPathBuilder? HOT 1
- Support "returning" functionality for MySQL dialect HOT 1
- ? Character is not escaped in `sql` function HOT 1
- Typing for QueryResult.rows HOT 1
- Parameter Types Not Passed in SQL template (sql` `) Inside of Expression Builder
- Is it possible to throw a type error when list could possibly be empty in "where... in" clauses HOT 1
- Kysely `insertInto` not triggering compiler error when there are missing required values HOT 1
- Incorrect selectAll typing on CTE with same tablename HOT 1
- Use kyse.link in kysely.dev homepage instead of the outdated playground it now has HOT 3
- Count returns undefined HOT 1
- use ParseJSONResultsPlugin for BIGINT field HOT 1
- Can't use "begin immediate" in Sqlite HOT 1
- Feature Request (for MariaDB/MySQL): On duplicate key update values()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kysely.