Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias authored Jun 10, 2024
1 parent cecc9f1 commit dd0c20b
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions examples/golang-api-with-postgres-and-sqlc/README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
# Go API with Docker Compose
# 🚀 Go API with Docker Compose 🌟

This project containerizes a Go API and a PostgreSQL database using Docker Compose.
This project showcases a powerful and scalable Go API containerized with PostgreSQL using Docker Compose. Perfect for modern developers looking to leverage cutting-edge technology!

## Motivation for Using `sqlc`
## 🎯 Why Use `sqlc`?

Incorporating `sqlc` into a Go project provides numerous advantages:
Integrating `sqlc` into your Go project brings a host of benefits:

- **Strong Type Safety**: Compile-time checks ensure that type errors are caught early in the development process, reducing runtime errors and increasing code reliability.
- **Enhanced Developer Productivity**: By automating the generation of SQL queries and their corresponding Go code, `sqlc` allows developers to concentrate on building application features instead of writing boilerplate database interaction code.
- **Improved Readability and Maintainability**: Using native SQL queries directly in the codebase makes the queries more transparent and easier to understand, debug, and optimize. This approach aligns well with the principles of clean code and maintainability.
- **Optimized Performance**: `sqlc` enables developers to write and fine-tune raw SQL queries, providing greater control over database interactions compared to ORM-based solutions. This can lead to more efficient query execution and better overall performance.
- **🔒 Strong Type Safety**: Catch type errors early in the development process with compile-time checks, reducing runtime errors and boosting code reliability.
- **Enhanced Developer Productivity**: Automate the generation of SQL queries and corresponding Go code, freeing up time to focus on building amazing features.
- **📖 Improved Readability and Maintainability**: Use native SQL queries directly in your codebase for clearer, easier-to-understand queries that are simple to debug and optimize.
- **🚀 Optimized Performance**: Write and fine-tune raw SQL queries for superior control over database interactions, leading to more efficient query execution and better performance compared to ORM-based solutions.

## Prerequisites
## 🛠 Prerequisites

- Docker
- Docker Compose
- `sqlc`

## Setup
## 📝 Setup Instructions

1. **Clone the Repository**:
1. **🔗 Clone the Repository**:

```bash
git clone https://github.com/nanlabs/backend-reference
```

2. **Navigate to the Project Directory**:
2. **📂 Navigate to the Project Directory**:

```bash
cd backend-reference/examples/golang-api-with-postgres-and-sqlc
```

3. **Generate SQL Queries and Models with `sqlc`**:
3. **⚙️ Generate SQL Queries and Models with `sqlc`**:

```bash
sqlc generate
```

4. **Build and Run the Docker Containers**:
4. **🐳 Build and Run the Docker Containers**:

```bash
docker-compose build
docker-compose up
```

The Go API will be accessible at `localhost:8080`.
🎉 Your Go API will be live at `localhost:8080`.

## Stopping the Application
## Stopping the Application

To stop the application and remove the containers, networks, and volumes defined in `docker-compose.yml`, run:
To gracefully stop the application and remove all containers, networks, and volumes defined in `docker-compose.yml`, run:

```bash
docker-compose down
Expand Down

0 comments on commit dd0c20b

Please sign in to comment.