#[database]
Expand description
This attribute is placed on your database struct. It takes a list of the query groups that your database supports. The format looks like so:
ⓘ
#[salsa::database(MyQueryGroup1, MyQueryGroup2)]
struct MyDatabase {
runtime: salsa::Runtime<MyDatabase>, // <-- your database will need this field, too
}
Here, the struct MyDatabase
would support the two query groups
MyQueryGroup1
and MyQueryGroup2
. In addition to the database
attribute, the struct needs to have a runtime
field (of type
salsa::Runtime
) and to implement the salsa::Database
trait.
See the hello_world
example for more details.