And unless you have very specific requirements, the performance is probably not a relevant concern in a real application either.
Ask HN: What Go framework for web API are you using in production?
31–40 of 65 posts
Re: Ask HN: What Go framework for web API are you using in production?
#32Using no frameworks at all, only https://github.com/julienschmidt/httprouter for routing.
How do you handle database schema migrations?
Re: Ask HN: What Go framework for web API are you using in production?
#33https://github.com/gin-gonic/gin
Re: Ask HN: What Go framework for web API are you using in production?
#34Earlier quoted context omitted.
How do you handle database schema migrations?
I use SQL migrations for this, works fine. Only migrate up, never down, and store the name of migrations already run in the db.
(1) https://www.npmjs.com/package/sql-migrations
Re: Ask HN: What Go framework for web API are you using in production?
#35Earlier quoted context omitted.
How do you handle database schema migrations?
Migrations are a minor pain point for me. The libraries I've used don't support running (all) pending migrations; only those with a timestamp more recent than the previous one. This means we have to finesse the timestamps manually as migrations get merged into the main branch and deployed to various environments. As such, the value offered by the migration library is pretty minimal compared to just remembering to pip…
Code for this here - it'd be pretty simple to put it in its own little tool or even a bash script or something, and there are surely some other tools that do something similar... This one psql only as it relies on the psql binary to load the sql, but hopefully gives you the idea. I haven't bothered developing it further to do things like run a single migration or down migrations as haven't required that so far.
https://github.com/fragmenta/fragmenta/blob/master/migrate.g...
Re: Ask HN: What Go framework for web API are you using in production?
#36Using no frameworks at all, only https://github.com/julienschmidt/httprouter for routing.
How do you handle database schema migrations?
Re: Ask HN: What Go framework for web API are you using in production?
#37Crazy fast and has worked fine under heavy load.
Re: Ask HN: What Go framework for web API are you using in production?
#38Earlier quoted context omitted.
I use SQL migrations for this, works fine. Only migrate up, never down, and store the name of migrations already run in the db.
Could you please clarify. Which one of these do you mean (first three results when googling SQL migrations): (1) https://www.npmjs.com/package/sql-migrations (2) https://flywaydb.org/documentation/migration/sql (3) https://github.com/rubenv/sql-migrate
I use something I wrote myself (see link in other comment). Nothing fancy and could be replicated easily - save sql files for migrations, run migration if not in db already, then store in the db the name of the migration run.
Re: Ask HN: What Go framework for web API are you using in production?
#39For building a REST API