Skip to content

MarkKlimenko/go-example-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-example-project

Create DB

docker run --name go-example-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres:15.2

docker start go-example-postgres
docker stop go-example-postgres
docker rm go-example-postgres

docker exec -it go-example-postgres bash
psql -U postgres

CREATE DATABASE greenlight;
\c greenlight
CREATE ROLE greenlight WITH LOGIN PASSWORD 'password';
CREATE SCHEMA greenlight authorization greenlight;


psql -U greenlight greenlight
create table mytable(id integer);
\dt

CREATE EXTENSION IF NOT EXISTS citext;

Setup Db

psql -U postgres -c 'SHOW config_file;'

Connect Db

postgres://greenlight:password@localhost/greenlight?sslmode=disable

Migrate

migrate -path=./migrations -database="postgres://greenlight:password@localhost/greenlight?sslmode=disable" up

Start application

go run ./cmd/api    

Stop application

pgrep -l api
pkill -SIGKILL api
pkill -SIGTERM api

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages