sq
sqddl
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
sq
-
How to use prepared queries wisely - postgres & pgx & squirell
You can use my library sq which handles this exact use case with the PreparedQuery type. It allows you to build a query programmatically, prepare it and optionally rebind parameters by name.
-
How to Work with SQL Databases in Go
Have you seen my library https://github.com/bokwoon95/sq? You can use it like database/sql and write plain SQL strings, only needing to provide a function that maps an database row to a struct and generics returns a slice of those structs at the end.
-
DRY pgx / database/sql?
Also consider my library sq which handles dynamic query generation as well as data mapping. You may find it simpler than bun because it's a lot closer to database/sql (it doesn't require a special DB object, it uses a plain *sql.DB).
-
Ent: An Entity Framework for Go
> I didn't see anything to help me build back graphs
Hmm you've certainly given me something to think about. Thanks.
BTW joins are not challenging, but you made me realize I didn't show any joins in my basic examples. Here is UPDATE with JOIN example: https://bokwoon.neocities.org/sq.html#postgres-update-with-j....
-
scan rows into types powered by generics
How does it compare to https://github.com/bokwoon95/sq?
- Show HN: An SQL data mapper using Go generics
- A type-safe struct mapper and query builder for Go (using generics)
- A struct mapper, query builder and migration tool for Go.
sqddl
-
Advice needed for generating schema-struct diff
My CLI tool sqddl is exactly what you're asking for. Check out https://bokwoon.neocities.org/sqddl#automigrate.
-
Data Version Control?
https://github.com/bokwoon95/sqddl (However you need to install Go)
-
Golang Postgres Schema Builder?
Oh hey, do I have the package for you. My package (https://github.com/bokwoon95/sqddl) converts a slice of ddl.Table structs into working DDL. Check it out:
-
Golang equivalent of C# Entity framework?
Represent tables using structs: https://github.com/bokwoon95/sqddl/blob/main/ddl/testdata/tables.go.
- Generate SQL migrations for Go using table structs
-
A struct mapper, query builder and migration tool for Go.
Finally it comes with a migration tool, sqddl, that supports a code-first workflow where you define table structs in Go and the tool figures out the DDL statements required to reach that destination schema from a source schema. It's basically GORM's automigrate, except instead of passing in table structs one-by-one for reflection it parses all table structs on the level of Go source files so adding a new table is as simple as defining a new table struct in your Go code. You can view a runnable playground example here: https://go.dev/play/p/S0jptJmsn70 (N.B. you might need to hit run a second time if it times out).
What are some alternatives?
vlcn-orm - Develop with your data model anywhere. Query and load data reactively. Replicate between peers without a central server.
go_sql_benchmarks
scan - scan sql rows into any type powered by generics
kago - KaGo
korm - KORM, an elegant and lightning-fast ORM for all your concurrent and async needs. Inspired by the highly popular Django Framework, KORM offers similar functionality with the added bonus of performance
goqu - SQL builder and query library for golang
typed-graphql-builder - A fully type-safe graphql query builder, inspired by tql
ent - An entity framework for Go
node-sql - SQL generation for node.js
dolt - Dolt – Git for Data
Squirrel - Fluent SQL generation for golang