São José dos Campos / São Paulo
Linkedin: https://www.linkedin.com/in/frmichetti
GitHub: https://github.com/frmichetti
Email: [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
"github.com/gin-gonic/gin" | |
) | |
// album represents data about a record album. | |
type album struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
); |