Skip to content

Instantly share code, notes, and snippets.

View dxdinh's full-sized avatar
💭
Demo

DX DX dxdinh

💭
Demo
View GitHub Profile
@dxdinh
dxdinh / main.go
Created November 17, 2021 22:48 — forked from elliotforbes/main.go
package main
import (
"encoding/json"
"fmt"
"log"
"github.com/graphql-go/graphql"
)
@dxdinh
dxdinh / main.go
Created November 11, 2020 05:06 — forked from RafPe/main.go
SQS Polling with golang channels
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sqs"
"fmt"
)
@dxdinh
dxdinh / passwd_func.sql
Created September 1, 2020 01:45 — forked from Samuyi/passwd_func.sql
passwd function for my article
CREATE FUNCTION passwd_func()
RETURNS TRIGGER
AS $$
BEGIN
IF length(NEW.password) < 10 OR NEW.password IS NULL THEN
RAISE EXCEPTION 'password cannot be less than 10 characters';
END IF;
IF NEW.NAME IS NULL THEN
RAISE EXCEPTION 'Name cannot be NULL';
END IF;
@dxdinh
dxdinh / audit_trigger.sql
Created September 1, 2020 01:43 — forked from Samuyi/audit_trigger.sql
a stored function for a trigger
CREATE FUNCTION account_audit_func()
RETURNS TRIGGER
AS $$
BEGIN
IF TG_OP = 'INSERT' THEN
INSERT INTO account_audit (operation, account_id, account_name, debt, balance) VALUES
(TG_OP, NEW.*);
RETURN NEW;
ELSIF TG_OP = 'UPDATE' THEN
INSERT INTO account_audit (operation, account_id, account_name, debt, balance) VALUES
@dxdinh
dxdinh / links.md
Created January 9, 2020 03:11 — forked from gbritton1/links.md
PostgreSQL Functions Playbook