Deno + PostgreSQL = DenoGres

Overview

DenoGres

Import Path: https://raw.githubusercontent.com/oslabs-beta/DenoGres/dev/mod.ts

To install CLI: deno install --allow-read --allow-write --allow-net --allow-env --name denogres https://raw.githubusercontent.com/oslabs-beta/DenoGres/dev/mod.ts Ensure deno is added to PATH

How to use DenoGres methods

Note: x represents a comparison operator (=, >, <, >=, <=, <>)

**INSERT INTO VALUES: add value(s) to column(s) in this table input: (column = value, ...) Model.prototype.add(...rows: string[])

**UPDATE SET: update existing records in database input: (column = value, ...) Model.prototype.update(...rows: string[])

**DELETE FROM: delete table input: none Model.prototype.delete()

**SELECT FROM: select column(s) from this table input: (column, ...) Model.prototype.filter(...columns: string[])

**WHERE: add condition(s) to query input: (column = value, AND/OR column = value, ...) Model.prototype.where(...condition: string[])

**LIMIT: limit number of output rows input: (limitNumber) Model.prototype.limit(limit: number)

**HAVING: add condition(s) involving aggregate functions to query input: (aggregateFn(column) x number); example: (COUNT(column) > 5) Model.prototype.having(...conditions: string[])

**JOIN: join two tables together input: (type, column1, column2, table2); type = inner, left, right, outer Model.prototype.join(type: string, column1: string, column2: string, table2: string)

**GROUP BY: group rows with same values into summary rows input: (column, ...) Model.prototype.group(...columns: string[])

**ORDER BY: sort column(s) by ascending/descending order input: for (order: string), order should be either ASC or DESC Model.prototype.order(order: string, ...column: string[])

**AVG-COUNT-SUM-MIN-MAX: calculate aggregate functions input: (aggregateFunction, column); aggregateFunction = average, count, sum, min, max Model.prototype.calculate(type: string, column: string)

**Execute query in database Model.prototype.query()

You might also like...

Very simple full-stack application using React, Java Spring Boot, and PostgreSQL

Very simple full-stack application using React, Java Spring Boot, and PostgreSQL. The API was built following the N-Tier architecture. The goal was to explore and learn more in-depth the development of APIs, the use of Docker and deploying with AWS.

Apr 23, 2022

Smart-face-detector - A face detector application made with React JS, Node JS, Express JS, and PostgreSQL.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Sep 24, 2022

Node.js TypeScript project demonstrating a Prisma integration with PostgreSQL

Prisma with PostgreSQL, TypeScript, Serverless and Parameter Store This project is the outcome of following the Prisma Getting Started guide. In addit

Aug 28, 2022

The Remix Stack for deploying to Fly with PostgreSQL, authentication, testing, linting, formatting, etc.

The Remix Stack for deploying to Fly with PostgreSQL, authentication, testing, linting, formatting, etc.

The Remix Stack for deploying to Fly with PostgreSQL, authentication, testing, linting, formatting, etc.

Jan 2, 2023

Here's a RESTful API that interacts with a PostgreSQL database written in NodeJS with Typescript, RESTify, and Sequelize ORM.

Here's a RESTful API that interacts with a PostgreSQL database written in NodeJS with Typescript, RESTify, and Sequelize ORM.

Basic description REST (Representational State Transfer) is a standard architecture for building and communicating with web services, It typically man

Jan 14, 2022

🐶 Puppies Rest Api built with NestJs, TypeOrm, PostgreSQL, Swagger

🚀 Quick start: Install node Install nest cli: `npm i -g @nestjs/cli` Initialize a nestjs project `nest new project-name` Swagger Docs swagger docs P

Oct 1, 2022

This is boilerplate of express, typescript and postgreSql with typeorm and docker based setup

express-typescript-postgres-typeorm-docker-swagger-boilerplate This is boilerplate of express, typescript and postgreSql with typeorm and docker based

Jun 2, 2022

🍉 Water is a micro-ORM + QueryBuilder designed to facilitate queries and operations on PostgreSQL databases designed to work in Melon

🍉 Water Water is a micro-ORM + QueryBuilder designed to facilitate queries and operations on PostgreSQL databases designed to work in MelonRuntime In

Aug 6, 2022

Simple REST API using Express with TypeScript, PostgreSQL, and MySQL to practice the Clean Architecture by Uncle Bob.

Clean-Architecture Simple REST API using Express with TypeScript, PostgreSQL, and MySQL to practice the Clean Architecture by Uncle Bob. About This RE

Oct 16, 2022
Comments
  • Can't sync to a fresh database

    Can't sync to a fresh database

    Following the docs, I'm unable to sync my models to my DB.

    I'm starting with a brand new DB, with no tables so I ran denogres --init to bootstrap models in my project. I created models/UserModel.ts with the following:

    export interface User {
      id: string;
      email: string;
      name: string;
      passwordHash: string;
      passwordSalt: string;
    }
    
    export class UserModel extends Model {
      static table = 'users';
      static columns = {
        id: { type: 'text', primaryKey: true },
        email: { type: 'text', notNull: true },
        name: { type: 'text' },
        passwordHash: { type: 'text', notNull: true },
        passwordSalt: { type: 'text', notNull: true, length: 32 },
      }
    }
    

    and then re-export that model in models/model.ts:

    export { UserModel } from './UserModel.ts';
    

    Finally, I run denogres --db-sync to create the users table with all the appropriate columns, but I simply get the following error:

    > denogres --db-sync
    To avoid all potential prompts, please consider running your command with the -x flag.
    Sending fatal alert BadCertificate
    TLS connection failed with message: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
    Defaulting to non-encrypted connection
    error: Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'application_name')
            tableListObj[el.table_name][el.column_name] = {
                                                       ^
        at https://deno.land/x/[email protected]/src/functions/introspect.ts:153:52
        at Array.forEach (<anonymous>)
        at introspect (https://deno.land/x/[email protected]/src/functions/introspect.ts:144:14)
        at async sync (https://deno.land/x/[email protected]/src/functions/sync.ts:30:22)
    

    I'm importing from https://deno.land/x/[email protected]/mod.ts, and deno --version prints the following:

    > deno --version
    deno 1.23.4 (release, x86_64-pc-windows-msvc)
    v8 10.4.132.8
    typescript 4.7.4
    
    opened by akatechis 1
Releases(v3.0.0-beta)
Owner
OSLabs Beta
OSLabs Beta
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
A Deno ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud

A Deno ORM for MySQL, SQLite, PostgreSQL, MongoDB, GitHub and serverless service like Deta, InspireCloud, CloudBase, LeanCloud.

ʀᴀʏ 5 Dec 15, 2022
Postgres.js - The Fastest full featured PostgreSQL client for Node.js and Deno

?? Fastest full-featured node & deno client ?? ES6 Tagged Template Strings at the core ??‍♀️ Simple surface API ??️ Dynamic query support ?? Chat and

Rasmus Porsager 4.3k Jan 1, 2023
This is a simple boilerplate for a Deno website, deployed with Deno Deploy.

Simple Deno Website Boilerplate This is a simple website boilerplate built using Deno and deployed using Deno Deploy. Demo at simple-deno-website-boil

Bruno Bernardino 15 Dec 3, 2022
TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Erfan Safari 20 Dec 26, 2022
Deno bindings for yoga, using Deno FFI.

deno_yoga Deno bindings for yoga, using Deno FFI. Usage flags: --allow-ffi: Requires ffi access to "yogacore.dll", "libyogacore.so", "libyogacore.dyli

迷渡 6 Feb 11, 2022
🛣️ A tiny and fast http request router designed for use with deno and deno deploy

Rutt Rutt is a tiny http router designed for use with deno and deno deploy. It is written in about 200 lines of code and is pretty fast, using an exte

Denosaurs 26 Dec 10, 2022
A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Jakub Neander 69 Dec 12, 2022
deno-ja (Deno Japanese community) showcase

Showcase Deno本家よりも気軽に作ったものを公開できるようなShowcaseです。 スクリーンショットの撮影方法 短めのidを決めていただいて、下記のようにスクリプトを実行してください。 deno task screenshot [url] [id] ※エラーが出る場合は、下記を実行してみ

deno-ja 17 Oct 28, 2022
A command-line tool to manage Deno scripts installed via deno install

??️ nublar nublar is a command-line tool to manage your scripts installed via deno install. ??️ Installation deno install --allow-read --allow-write -

Shun Ueda 16 Dec 26, 2022