packages
The Louise packages, each released on its own
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#34 · main · 4 min 04 s
0Étoiles
0Forks
3Issues
| 1 | import event_store.{type NewEvent, NewEvent} |
| 2 | import event_store/postgres/schema |
| 3 | import postgres as pg |
| 4 | import sealing.{type DataKey} |
| 5 | import std/bytes |
| 6 | import std/os |
| 7 | import std/process.{type proc} |
| 8 | import std/random.{type random} |
| 9 | import std/result |
| 10 | import std/string |
| 11 | |
| 12 | pub fn event :: kind: String -> NewEvent |
| 13 | { |
| 14 | NewEvent(kind, bytes.from_string "payload of {kind}") |
| 15 | } |
| 16 | |
| 17 | pub fn data_key :: -> DataKey |
| 18 | { |
| 19 | sealing.derived (bytes.from_string (string.repeat "r" 32)) "test data" |
| 20 | } |
| 21 | |
| 22 | pub fn against_postgres :: |
| 23 | check: fn(pg.Pool) -> () / <io, proc, random> |
| 24 | -> () / <io, proc, random> |
| 25 | { |
| 26 | match os.env "LOUISE_PG_URL" |
| 27 | { None -> () |
| 28 | , Some(url) -> |
| 29 | { |
| 30 | let config = result.expect (pg.config url) "a database url" |
| 31 | let pool = result.expect (pg.start_pool config 4) "a pool" |
| 32 | result.expect (schema.migrate pool) "migrated" |
| 33 | check pool |
| 34 | } |
| 35 | } |
| 36 | } |