Skip to content

rahmanfadhil/cotton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

28a88a7 Β· Dec 29, 2020
Dec 29, 2020
Nov 20, 2020
Nov 29, 2020
Jul 17, 2020
Jul 25, 2020
Aug 13, 2020
Dec 29, 2020
May 26, 2020
Oct 4, 2020
Oct 14, 2020
Dec 29, 2020
Jul 24, 2020
Oct 14, 2020
Aug 8, 2020
Aug 9, 2020
Oct 20, 2020
Jun 23, 2020
Jul 17, 2020

Repository files navigation

Cotton

ci GitHub release (latest by date)

SQL Database Toolkit for Deno.

  • Well-tested
  • Type-safe
  • Supports MySQL, SQLite, and PostgreSQL
  • Semantic versioning

Documentation

Getting Started

Here's an example of a Deno project that uses Cotton.

import { connect } from "https://deno.land/x/[email protected]/mod.ts";

const db = await connect({
  type: "sqlite",
  database: "db.sqlite3",
});

To use Cotton in your project, you can import cotton package from deno.land/x in your file. We highly recommend you to use semantic versioning by explicitly tell Deno which version you want to use in the import URL.

Typically, the first thing you want to do is to create a connection to a database. Here, we're using connect and pass our database configuration. You can read more about connection here.

Once our database is connected, do anything with it such as performing an SQL query.

const users = await db.query("SELECT * FROM users");

for (const user of users) {
  console.log(user); // { email: 'a@b.com', age: 16, ... }
}

You can learn more about Cotton through these links. Have fun! πŸ˜ƒ