-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: inject DB verb resources #2985
base: main
Are you sure you want to change the base?
Conversation
b246f09
to
9fb57a9
Compare
I can't review this fully at the moment, but is it possible for us to eliminate the string names now we're code-genning? They were only present because we needed them at runtime, but that is no longer the case and they are a source of errors. |
ie. we use the variable name as the name, similar to what we do with eg. verb function names. |
the pattern for these are type alias declarations, e.g. the limitation was that, afaik, using reflection at runtime we can't derive the alias name because unlike the pattern
|
I was more suggesting changing to this: var myDb = ftl.PostgresDatabase() We'd register the variable with the statically extracted name "myDb" removing the redundancy/confusion of having to do: var myDb = ftl.PostgresDatabase("myDb") |
using a type rather than a variable lets us pass the db decl into the verb signature like we're doing for the verb clients, e.g.
|
9810956
to
106bea5
Compare
We're going to need a solution to this sooner or later. At some point the databases are going to have configuration options, eg. to set the instance size. If we can't uniquely identify a database handle we won't be able to identify the configuration for that handle. ie. each database will be configurable with the RAM/CPU size |
67f0347
to
3959073
Compare
894663d
to
766ad72
Compare
3d0f32e
to
ff67e61
Compare
you can declare a DB by defining a type that implements
PostgresDatabaseConfig
(the only supported interface implementingDatabaseConfig
, at present):to avoid the verbosity of implementing
db()
andpgdb()
, you can instead embedftl.DefaultPostgresDatabaseConfig
.this will implement these "tag" methods but not any required methods, e.g.
Name()
which must be explicitly provided in the user code.you can then use the DB you've configured by injecting a handle around its config into a verb signature:
eventually we will extend
DatabaseConfig
with additional methods, e.g. RAM, disk, max connections, etc.