dev run command
npx nodemon -e go,tmpl --exec go run "cmd/web/*.go" --signal SIGTERM
or
go run cmd/web/*.go
go test -v ./cmd/web
-- Snippets
CREATE TABLE snippets (
id SERIAL NOT NULL PRIMARY KEY,
title VARCHAR(100) NOT NULL,
content TEXT NOT NULL,
created TIMESTAMP NOT NULL,
expires TIMESTAMP NOT NULL
);
CREATE INDEX idx_snippets_created ON snippets(created);
-- Users
CREATE TABLE users (
id SERIAL NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
hashed_password CHAR(60) NOT NULL,
created TIMESTAMP NOT NULL,
active BOOLEAN NOT NULL DEFAULT TRUE
);
ALTER TABLE users ADD CONSTRAINT users_uc_email UNIQUE (email);