Created
April 16, 2024 20:00
-
-
Save lukewagner/e4bab34bbe73d4ce9cb6d8959bc69243 to your computer and use it in GitHub Desktop.
multi-db support
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package postgres:api { | |
interface connection { | |
query: func(...) -> ...; | |
execute: func(...) -> ...; | |
} | |
interface connections { | |
*: connection; | |
} | |
interface runtime-connections { | |
resource connection = resourceify(connection); | |
open: func(name: string) -> connection; | |
} | |
} | |
world my-single-db-world { | |
import postgres:api/connection; | |
} | |
world my-declarative-multi-db-world { | |
import postgres:api/connections; | |
} | |
world my-dynamic-db-world { | |
import postgres:api/runtime-connections; | |
} | |
world or-heck-maybe-i-do-both { | |
import postgres:api/connections; | |
import postgres:api/runtime-connections; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment