Skip to content

Instantly share code, notes, and snippets.

View Massad's full-sized avatar
🚀
TestApp.io

Omar Masad Massad

🚀
TestApp.io
View GitHub Profile
@Massad
Massad / jsonb_set_deep.sql
Created February 6, 2017 23:23 — forked from villelahdenvuo/jsonb_set_deep.sql
PostgreSQL jsonb_set is nice, but it does't create missing objects so I made this little helper.
CREATE OR REPLACE FUNCTION jsonb_set_deep(target jsonb, path text[], val jsonb)
RETURNS jsonb AS $$
DECLARE
k text;
p text[];
BEGIN
-- Create missing objects in the path.
FOREACH k IN ARRAY path LOOP
p := p || k;
IF (target #> p IS NULL) THEN
@Massad
Massad / user.authentication.server.controller.js
Last active May 28, 2019 23:45
SEAN.JS user.authentication.server.controller.js for MySQL, MariaDB, SQLite and MSSQL
'use strict';
// User Authentication for MySQL, MariaDB, SQLite and MSSQL database dialects
/**
* File Path: /modules/users/server/controllers/users/user.authentication.server.controller.js
* File version: 0.1
*/
/**
@Massad
Massad / user.server.model.js
Last active May 28, 2019 23:41
SEAN.JS user.server.model.js for MySQL, MariaDB, SQLite and MSSQL
'use strict';
//User model for MySQL, MariaDB, SQLite and MSSQL database dialects
/**
* File Path: /modules/users/server/models/user.server.model.js
* File Version: 0.2
*/
/**