This project was created for COMP 3005: Database Management Systems in order to work with connecting to PostgreSQL and implement basic CRUD commands.
It is created with Golang, Cobra, and sqlc.
Watch the video demo here
sql: Where the SQL lives. This includes the database schema, the provided information to populate the database, and the queries I wrote.
cmd: Where the commands live. Root is the root command. The other commands are the respective CRUD operations as outlined by the assignment specs.
db: I used sqlc to generate Go code from my hand written SQL queries. Any code generated with the tool lives here.
(This assumes you have Go setup)
-
Create a
.env
file at the root of the directory. Put your own postgres URI into this .env withDATABASE_URL="your-uri"
-
Run
go mod tidy
to install dependencies. -
Run
go run main.go [command] [args]
to compile and run the code in one step, or compile the code seperately withgo build