https://github.com/l004p/3005-assignment-03
COMP 3005 assignment 3 (question 1)
https://github.com/l004p/3005-assignment-03
cobra go postgresql sqlc
Last synced: 22 days ago
JSON representation
COMP 3005 assignment 3 (question 1)
- Host: GitHub
- URL: https://github.com/l004p/3005-assignment-03
- Owner: l004p
- Created: 2024-03-05T21:25:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-19T01:21:08.000Z (about 2 years ago)
- Last Synced: 2025-03-18T14:47:04.385Z (about 1 year ago)
- Topics: cobra, go, postgresql, sqlc
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 3005 Assignment 3 Question 1
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](https://go.dev), [Cobra](https://github.com/spf13/cobra), and [sqlc](https://github.com/sqlc-dev/sqlc).
Watch the video demo [here](https://youtu.be/6IBSIobI0Og)
## About the folders
**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.
## Running the code
(This assumes you have Go setup)
1. Create a `.env` file at the root of the directory. Put your own postgres URI into this .env with `DATABASE_URL="your-uri"`
2. Run `go mod tidy` to install dependencies.
3. Run `go run main.go [command] [args]` to compile and run the code in one step, or compile the code seperately with `go build`