aboutsummaryrefslogtreecommitdiffstats
path: root/notes/golang.txt
blob: 404741e864ac1b5374103bee4afcd0f45b4a6e0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

## Database Schema / ORM / Generation

start simple, with pg (or sqlx if we wanted to be DB-agnostic):
- pq: basic postgres driver and ORM (similar to sqlalchemy?)
- sqlx: small extensions to builtin sql; row to struct mapping

debug postgres with gocmdpev

later, if code is too duplicated, look in to sqlboiler (first) or xo (second):
- https://github.com/xo/xo
- https://github.com/volatiletech/sqlboiler

later, to do migrations, use goose, or consider alembic (python) for
auto-generation
- https://github.com/steinbacher/goose
- possibly auto-generate with python alembic

for identifiers, consider either built-in postgres UUID, or:
- https://github.com/rs/xid
- https://github.com/oklog/ulid
  like a UUID, but base32 and "sortable" (timestamp + random)

## API In General

Hope to use Kong for authentication.

start with oauth2... orcid?

## OpenAPI/Swagger

go-swagger (OpenAPI 2.0):
- generate initial API server skeleton from a yaml definition
- export updated yaml from code after changes
- web UI for documentation
- templating/references
- auto-generate client (in golang)

also look at ReDoc as a UI; all in-brower generated from JSON (react)

## Non-API stuff

- logrus structured logging (or zap?)
- testify tests (and assert?)
- viper config