News for hackers. Stuff that matters.
Re:Back to basics: Writing an application using Go and Postg... by Ingon on Monday November 22, 2021 @08:54PM (#29313783)
Yes! I’ve been using sqlc both at work and on side projects and it works awesome. For me it strikes the right balance between “I want to work with sql/db abstractions” and “I don’t need orm, just automated mapping”. Has a few rough edges when advanced types needs to get mapped, but it’s getting there.
Re:Back to basics: Writing an application using Go and Postg... by iknowstuff on Monday November 22, 2021 @11:32PM (#29314621)
>I don’t need orm, just automated mapping”

Check out https://github.com/launchbadge/sqlx#sqlx-is-not-an-orm for an alternative approach.

    struct Country { country: String, count: i64 }
    
    let countries = sqlx::query_as!(Country, "SELECT country, count FROM countries WHERE organization = ?", organization)
       .fetch_all(&db_pool)
       .await?;