Skip to content

bytedeveloperr/flames

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flames

⚠️ This project is still at the early development stage. A lot of things are constantly changing. DO NOT USE !!!

Flames is a Deno ORM for SQL database. built to make database interactions super easy.

Getting started

To get started, First ensure that you have Deno installed on your machine.

Import the flames module from deno.land

import { flames, DataTypes } from "https://deno.land/x/flames/mod.ts"

You can now create a connection to your databases

NOTE: Only PostgreSQL is supported at the moment

const config = {
  dialect: "postgres",
  connection: {
    username: "username",
    password: "password",
    database: "dbname",
    host: "localhost",
    port: 5432,
    poolSize: 2,
  },
}

await flames.connect(config)

Now, you can define your database model

flames.define("User", {
  table: "users",
  columns: {
    id: {
      type: DataTypes.INTEGER,
      autoIncrement: true,
    },
    name: {
      type: DataTypes.STRING,
    },
  },
})

After defining your models, you can now sync them with your database

await flames.sync()

Add some data to your database table 😁

const user = await flames.user.create({ name: "Abdulrahman" })
console.log(user) // { id: 1, name: "Abdulrahman" }

About

An ORM for SQL databases in Deno

Resources

Stars

Watchers

Forks

Packages

No packages published