
Security News
pnpm 10.12 Introduces Global Virtual Store and Expanded Version Catalogs
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
mysql-with-kysely
Advanced tools
mysql-with-kysely
use mysql2 and kyselyIncorrect arguments to mysqld_stmt_execute
error safe!
Incorrect arguments to mysqld_stmt_execute
issue$ yarn add mysql-with-kysely
import { queryBuilder, WithSchema, SelectableSchema } from 'mysql-with-kysely'
import type { User } from './model'
// for query builder
type Database = {
user: WithSchema<User>
}
// for your code
type Schema = SelectableSchema<Database>
type InsertValueSchema = InsertableSchema<Database>
const { db, close } = connect<Database>({ uri: 'mysql://root:root@localhost:3306/test' });
// collect your metrics
db.subscribe(({ sql, normalizedSql, durationMs, occurredAt, parameters }) => {
})
// your query builder
const qb = queryBuilder<Database>()
// write your codes type safely
// type of users is `Array<Schema['user']>`
const users = await db.query(qb
.selectFrom('user')
.selectAll()
.orderBy('id', 'desc')
.limit(1),
)
// type of value is `InsertValueSchema['user']`
const value = { name: 'kanziw', email: 'kanziwoong@gmail.com' }
const { insertId } = await db.execute(qb
.insertInto('user')
.values(value),
)
// close MySQL connection
await close()
WithPkId
: for auto increment id
columnWithDataLifecycleTracker
created_at
: for DATETIME DEFAULT CURRENT_TIMESTAMP
updated_at
: for DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
WithSchema
: WithPkId
& WithDataLifecycleTracker
db:sync
script in package.jsonFAQs
Use MySQL with kysely
The npm package mysql-with-kysely receives a total of 13 weekly downloads. As such, mysql-with-kysely popularity was classified as not popular.
We found that mysql-with-kysely demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.
Security News
Amaro 1.0 lays the groundwork for stable TypeScript support in Node.js, bringing official .ts loading closer to reality.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.