Skip to content

Instantly share code, notes, and snippets.

View frmichetti's full-sized avatar
💭
I may be slow to respond.

Felipe Rodrigues Michetti frmichetti

💭
I may be slow to respond.
View GitHub Profile
@frmichetti
frmichetti / main.go
Created November 20, 2022 16:35
Go lang Rest Api with Gin
package main
import (
"net/http"
"github.com/gin-gonic/gin"
)
// album represents data about a record album.
type album struct {
@frmichetti
frmichetti / pagination controller basic logic.ts
Created June 21, 2022 16:29
Logica do Controller de Paginação (Paginas a avançar e voltar)
const backPages = (page:number,limit:number) => {
const pages = []
for(let x = page ; x > 0; x--){
if (x == page) continue;
if (pages.length == limit) continue;
pages.push(x)
}
return pages;
}
@frmichetti
frmichetti / example_postgres.sql
Created June 9, 2022 21:24
Hierarchic Self-Referential Data (fixed)
create extension intarray ;
CREATE TABLE messages (
created_at timestamp DEFAULT now(),
reply_to int REFERENCES messages,
id int PRIMARY KEY
GENERATED BY DEFAULT AS IDENTITY,
content text,
CHECK (reply_to <> id)
);