API feedback wanted: lightweight PostgreSQL SQL generator for Go structs

Hi everyone.

I’m working on a small Go library called norm.

The idea is to reduce PostgreSQL boilerplate without becoming an ORM.

It does not execute queries, manage connections, track entities, or hide SQL. It only generates SQL and args from Go structs, so execution stays explicit with pgx or database/sql.

The main use case is when you like raw SQL control, but do not want to repeat:

  • column lists
  • $1, $2, $3 placeholders
  • INSERT / UPDATE field mapping
  • scan pointers
  • simple dynamic WHERE clauses

Small example:

type User struct {
    Id    int64  norm:"pk"
    Name  string norm:"notnull"
    Email string
}

m, _ := orm.M(&user)
sql, args, _ := m.Insert(norm.Exclude(“id”), norm.Returning(“Id”))

Repo:

Docs:

I would appreciate feedback specifically on the API:

  • Does this feel idiomatic for Go?
  • Is the package scope clear enough?
  • Is “not an ORM, just SQL generation” a useful distinction?
  • What would make this unsafe or inconvenient in real pgx/PostgreSQL projects?
1 Like