Write Go interfaces, describe the raw SQL you want in comments, and let the CLI turn it into typed Go methods. Template variables expand into table names and parameters, while the generator binds values and inserts a context.Context where it is missing.
type Query[T any] interface { // SELECT * FROM @@table WHERE id=@id GetByID(id int) (T, error)
// SELECT * FROM @@table WHERE @@column=@value FilterWithColumn(column string, value string) (T, error)
// SQL: SELECT * FROM users WHERE id=123 user, err := generated.Query[User](db).GetByID(ctx, 123)
// SQL: SELECT * FROM users WHERE name="jinzhu" AND age=25 (appended to current builder) users, err := generated.Query[User](db).FilterByNameAndAge("jinzhu", 25).Find(ctx)
// SQL: UPDATE users SET name="jinzhu", age=20, is_adult=1 WHERE id=1 err := generated.Query[User](db).UpdateUser(ctx, User{Name: "jinzhu", Age: 20}, 1)