Socket
Socket
Sign inDemoInstall

kysely

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kysely

Type safe SQL query builder


Version published
Weekly downloads
431K
increased by9.53%
Maintainers
1
Weekly downloads
 
Created

What is kysely?

Kysely is a type-safe SQL query builder for TypeScript. It allows developers to write SQL queries in a type-safe manner, ensuring that the queries are correct at compile time. Kysely supports various SQL databases and provides a fluent API for building complex queries.

What are kysely's main functionalities?

Type-safe Query Building

Kysely allows you to build SQL queries in a type-safe manner. The above code demonstrates a simple SELECT query that retrieves the 'id' and 'first_name' columns from the 'person' table where the 'id' is equal to 1.

const result = await db.selectFrom('person').select(['id', 'first_name']).where('id', '=', 1).execute();

Insert Queries

Kysely supports type-safe insert queries. The above code demonstrates how to insert a new row into the 'person' table with the specified values.

const result = await db.insertInto('person').values({ first_name: 'John', last_name: 'Doe' }).execute();

Update Queries

Kysely allows you to perform type-safe update queries. The above code demonstrates how to update the 'first_name' column of the 'person' table where the 'id' is equal to 1.

const result = await db.updateTable('person').set({ first_name: 'Jane' }).where('id', '=', 1).execute();

Delete Queries

Kysely supports type-safe delete queries. The above code demonstrates how to delete a row from the 'person' table where the 'id' is equal to 1.

const result = await db.deleteFrom('person').where('id', '=', 1).execute();

Joins

Kysely allows you to perform type-safe join operations. The above code demonstrates an inner join between the 'person' and 'address' tables, selecting the 'id' from the 'person' table and the 'city' from the 'address' table.

const result = await db.selectFrom('person').innerJoin('address', 'person.id', 'address.person_id').select(['person.id', 'address.city']).execute();

Other packages similar to kysely

FAQs

Package last updated on 29 May 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc