A PostgreSQL extension for Deno: run Typescript in PostgreSQL functions and triggers

pldeno

PL Deno

A PostgreSQL extension for Deno: run Typescript in PostgreSQL functions and triggers.

About

This is a PostgreSQL extension for Deno. It is still a proof of concept. This will theoritically allow users to create database functions and triggers in TypeScript.

Status

Still a Proof of concept! We’re developing in public.

  • [x] POC: this is a concept. We’re testing to see if it’s even possible.
  • [ ] Alpha: Under heavy development.
  • [ ] Beta: Ready for use. But go easy on us, there may be a few kinks.
  • [ ] 1.0: Use in production!

FAQ’s

What is Deno?

Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. It was created by Ryan Dahl, original creator of Node.js, and is focused on productivity.

Why use this over plv8?

plv8 requires you to install node packages on your server. Deno can import modules from any location on the web, like GitHub, or a CDN like Skypack or jspm.io.

Credits

Logo derived from the orignal Deno icon and an icon made by Freepik.

Download Details:

Author: supabase

Source Code: https://github.com/supabase/pldeno

#deno #nodejs #node #javascript

What is GEEK

Buddha Community

A PostgreSQL extension for Deno: run Typescript in PostgreSQL functions and triggers

A PostgreSQL extension for Deno: run Typescript in PostgreSQL functions and triggers

pldeno

PL Deno

A PostgreSQL extension for Deno: run Typescript in PostgreSQL functions and triggers.

About

This is a PostgreSQL extension for Deno. It is still a proof of concept. This will theoritically allow users to create database functions and triggers in TypeScript.

Status

Still a Proof of concept! We’re developing in public.

  • [x] POC: this is a concept. We’re testing to see if it’s even possible.
  • [ ] Alpha: Under heavy development.
  • [ ] Beta: Ready for use. But go easy on us, there may be a few kinks.
  • [ ] 1.0: Use in production!

FAQ’s

What is Deno?

Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. It was created by Ryan Dahl, original creator of Node.js, and is focused on productivity.

Why use this over plv8?

plv8 requires you to install node packages on your server. Deno can import modules from any location on the web, like GitHub, or a CDN like Skypack or jspm.io.

Credits

Logo derived from the orignal Deno icon and an icon made by Freepik.

Download Details:

Author: supabase

Source Code: https://github.com/supabase/pldeno

#deno #nodejs #node #javascript

Charity  Ferry

Charity Ferry

1620272986

A Complete Guide to SQL Triggers in PostgreSQL

SQL Triggers, also called Database Triggers, allow you to tell your SQL engine (for these examples, Postgres) to run a piece of code when an event happens, or even before the event.

Advantages of using SQL Triggers

  • Maintaining data integrity
  • Separating business logic
  • Atomic transactions

#postgresql #postgresql trigger #trigger #sql

Charity  Ferry

Charity Ferry

1620811310

Interesting 5 Functions and 5 Triggers With PostgreSQL

Once the DVD becomes available for rent, a rental record should be added to the rental table and the reservation record should be removed form the reservation table.

Example 1 : I would like to create a trigger that will delete a customer’s reservation record once the customer’s rents the DVD. In this case, I will create a trigger on the **rental ** table (ON rental) that will be triggered when a row gets inserted (AFTER INSERT) in the rental  table. The trigger will execute delete_reserve() ** function. The delete_reserve() ** function will be responsible of deleting the reservation record once the customer has rented the reserved DVD (EXECUTE PROCEDURE delete_reserve()).

#posgresql #trigger #function #interesting triggers

Vincent Lab

Vincent Lab

1605017502

The Difference Between Regular Functions and Arrow Functions in JavaScript

Other then the syntactical differences. The main difference is the way the this keyword behaves? In an arrow function, the this keyword remains the same throughout the life-cycle of the function and is always bound to the value of this in the closest non-arrow parent function. Arrow functions can never be constructor functions so they can never be invoked with the new keyword. And they can never have duplicate named parameters like a regular function not using strict mode.

Here are a few code examples to show you some of the differences
this.name = "Bob";

const person = {
name: “Jon”,

<span style="color: #008000">// Regular function</span>
func1: <span style="color: #0000ff">function</span> () {
    console.log(<span style="color: #0000ff">this</span>);
},

<span style="color: #008000">// Arrow function</span>
func2: () =&gt; {
    console.log(<span style="color: #0000ff">this</span>);
}

}

person.func1(); // Call the Regular function
// Output: {name:“Jon”, func1:[Function: func1], func2:[Function: func2]}

person.func2(); // Call the Arrow function
// Output: {name:“Bob”}

The new keyword with an arrow function
const person = (name) => console.log("Your name is " + name);
const bob = new person("Bob");
// Uncaught TypeError: person is not a constructor

If you want to see a visual presentation on the differences, then you can see the video below:

#arrow functions #javascript #regular functions #arrow functions vs normal functions #difference between functions and arrow functions

Tia  Gottlieb

Tia Gottlieb

1596645240

Parenthesis Balancing using Monoids in TypeScript

The Parenthesis Balancing problem is a classic problem that says :

Given an expression string exp, write a program to examine whether the pairs and the orders of “(“, “)” are correct in exp.

so this (()()()())is balanced but this one ())) is not

in this article we are going to solve this in a functional manner using Typescript and the monoids from the previous article.

Monoids in TypeScript

“Alternatively, the fundamental notion of category theory is that of a Monoid”

medium.com

we are going to define a simple balance type that will hold the number of the left end right values.

this amazingly forms a monoid. Since we can concatenate two Balance objects and get a new balance.

#typescript #functional-programming #functional #javascript #monoids #function