diff --git a/content/posts/raw-dogging-postgresql-with-pgx-and-sqlc-in-go/index.en.md b/content/posts/raw-dogging-postgresql-with-pgx-and-sqlc-in-go/index.en.md
index dc0d6c4..559da64 100644
--- a/content/posts/raw-dogging-postgresql-with-pgx-and-sqlc-in-go/index.en.md
+++ b/content/posts/raw-dogging-postgresql-with-pgx-and-sqlc-in-go/index.en.md
@@ -15,10 +15,10 @@ tags:
## What is pgx and sqlc?
- [pgx](https://github.com/jackc/pgx): a robust toolkit and PostgreSQL driver
- for Golang. This module provide plenty of great APIs for handling complex
+ for Golang. This module also provides some useful tool for handling complex
queries easier and less error-prone.
- [sqlc](https://github.com/sqlc-dev/sqlc): a code generator tool that turns
- your SQL querie in `.sql` files into Go code with type-safe for both query
+ your SQL queries in `.sql` files into Go code with type-safe for both query
params and query result. Check out an example here: [sqlc
playground](https://play.sqlc.dev/). sqlc also supports pgx out of the
box, which makes this a great combination for your database's need.
@@ -31,7 +31,7 @@ an easy choice to implement and use, plus you don't have to write SQL. Sounds
too good to be true... but here's the catch:
Based on my experience, almost all `ORM` I have ever used only perform well in
-easy scenarios (eg `CRUD operation`). The more complex your query get, the
+easy scenarios (eg `CRUD operation`). The more complex your query gets, the
harder to implement properly in these `ORM` sometime it's even harder than
writing raw SQL query manually, to the point you have to pull out the big
gun... yes, you grab the database driver under the wrapper and start
@@ -39,14 +39,14 @@ raw-dogging query, map the types manually and questioning yourself why you chose
to use an ORM in the first place. {{< emoji "beat_shot" >}}
Another foot gun of `ORM` is that you generally can't control the `SQL query`
-they produces, they may do dumb things and write terrible queries. Here's a funny
+they produce, they may do dumb things and write terrible queries. Here's a funny
story about `Prisma ORM` in javascript world: [video](https://youtu.be/jqhHXe746Ns)
A balance spot between `error-prone, untyped raw query` and `ORM` is `query
builder`. They provide some sort of type safety and the flexibility to build
and optimize complex query.
-### The purpose of sqlc
+### Usage of sqlc
`sqlc` is not exactly a query builder but a code-generation tool that reads
your queries and schema in `.sql` files and turns it into type-safe code for both
@@ -59,7 +59,7 @@ SELECT * FROM authors
WHERE id = $1 LIMIT 1;
```
-In to this type-safe Go code:
+In to this type-safe Go code, ready to use:
```go
const createAuthor = `-- name: CreateAuthor :one
INSERT INTO authors (
@@ -83,13 +83,14 @@ func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Aut
}
```
-So I should provide a similar experience of using `query builder`: You can write
-things that's close to SQL query and have the types mapped automatically
+So it should provide a similar experience to using a `query builder`: You can
+write things that are close to SQL queries and have the types mapped
+automatically
-### The purpose of pgx
+### Usage of pgx
There's even more complex query that neither `query builder` nor `sqlc` can
-handle it. This is where you can use `pgx` to handle these specific complex
+handle. This is where you can use `pgx` to handle these specific complex
query.
`pgx` also comes with plenty of useful tools which made it easier to
@@ -237,7 +238,7 @@ type Database struct {
func NewDatabase(connStr string) *Database {
// this only create pgxpool struct, you may need to ping the database to
- // initialize a connection and check availability
+ // grab a connection and check availability
pool, err := pgxpool.New(context.Background(), connStr)
if err != nil {
log.Fatal(err)
diff --git a/content/posts/some-great-golang-book-im-reading/100-mistakes.jpg b/content/posts/some-great-golang-book-im-reading/100-mistakes.jpg
new file mode 100644
index 0000000..c2d43a4
Binary files /dev/null and b/content/posts/some-great-golang-book-im-reading/100-mistakes.jpg differ
diff --git a/content/posts/some-great-golang-book-im-reading/concurrency.jpg b/content/posts/some-great-golang-book-im-reading/concurrency.jpg
new file mode 100644
index 0000000..c59177c
Binary files /dev/null and b/content/posts/some-great-golang-book-im-reading/concurrency.jpg differ
diff --git a/content/posts/some-great-golang-book-im-reading/go-books-feature.webp b/content/posts/some-great-golang-book-im-reading/go-books-feature.webp
new file mode 100644
index 0000000..2e74a98
Binary files /dev/null and b/content/posts/some-great-golang-book-im-reading/go-books-feature.webp differ
diff --git a/content/posts/some-great-golang-book-im-reading/index.en.md b/content/posts/some-great-golang-book-im-reading/index.en.md
new file mode 100644
index 0000000..3564985
--- /dev/null
+++ b/content/posts/some-great-golang-book-im-reading/index.en.md
@@ -0,0 +1,25 @@
+---
+title: Some great Golang book that I'm reading
+date: "2024-09-26T04:06:09+07:00"
+draft: false
+showComments: true
+description: "Some great Golang book that I'm reading"
+tags:
+- golang
+- random
+- book
+---
+
+[Let's Go by Alex Edwards](https://lets-go.alexedwards.net/)
+[
](https://lets-go.alexedwards.net/)
+
+[Let's Go Further by Alex Edwards](https://lets-go-further.alexedwards.net/)
+[
](https://lets-go-further.alexedwards.net/)
+
+[100 Go Mistakes and How to Avoid Them by teivah](https://100go.co/book/)
+[
](https://100go.co/book/)
+
+[Concurrency in Go by Cox-Buday](https://www.oreilly.com/library/view/concurrency-in-go/9781491941294/)
+[
](https://www.oreilly.com/library/view/concurrency-in-go/9781491941294/)
+
+
diff --git a/content/posts/some-great-golang-book-im-reading/lets-go-further.jpg b/content/posts/some-great-golang-book-im-reading/lets-go-further.jpg
new file mode 100644
index 0000000..d20e61f
Binary files /dev/null and b/content/posts/some-great-golang-book-im-reading/lets-go-further.jpg differ
diff --git a/content/posts/some-great-golang-book-im-reading/lets-go.jpg b/content/posts/some-great-golang-book-im-reading/lets-go.jpg
new file mode 100644
index 0000000..64b7989
Binary files /dev/null and b/content/posts/some-great-golang-book-im-reading/lets-go.jpg differ