Diagram

Based on the hello world example:

#[salsa::query_group(HelloWorldStorage)]
trait HelloWorld: salsa::Database {
    // For each query, we give the name, some input keys (here, we
    // have one key, `()`) and the output type `Arc<String>`. We can
    // use attributes to give other configuration:
    //
    // - `salsa::input` indicates that this is an "input" to the system,
    //   which must be explicitly set. The `salsa::query_group` method
    //   will autogenerate a `set_input_string` method that can be
    //   used to set the input.
    #[salsa::input]
    fn input_string(&self, key: ()) -> Arc<String>;

    // This is a *derived query*, meaning its value is specified by
    // a function (see Step 2, below).
    fn length(&self, key: ()) -> usize;
}
#[salsa::database(HelloWorldStorage)]
#[derive(Default)]
struct DatabaseStruct {
    storage: salsa::Storage<Self>,
}

impl salsa::Database for DatabaseStruct {}
graph LR
    classDef diagramNode text-align:left;
    subgraph query group
        HelloWorldTrait["trait HelloWorld: Database + HasQueryGroup(HelloWorldStroage)"]
        HelloWorldImpl["impl(DB) HelloWorld for DB
where DB: HasQueryGroup(HelloWorldStorage)"] click HelloWorldImpl "http:query_groups.html#impl-of-the-hello-world-trait" "more info" HelloWorldStorage["struct HelloWorldStorage"] click HelloWorldStorage "http:query_groups.html#the-group-struct-and-querygroup-trait" "more info" QueryGroupImpl["impl QueryGroup for HelloWorldStorage
  type DynDb = dyn HelloWorld
  type Storage = HelloWorldGroupStorage__;"] click QueryGroupImpl "http:query_groups.html#the-group-struct-and-querygroup-trait" "more info" HelloWorldGroupStorage["struct HelloWorldGroupStorage__"] click HelloWorldGroupStorage "http:query_groups.html#group-storage" "more info" subgraph for each query... LengthQuery[struct LengthQuery] LengthQueryImpl["impl Query for LengthQuery
  type Key = ()
  type Value = usize
  type Storage = salsa::DerivedStorage(Self)
  type QueryGroup = HelloWorldStorage"] LengthQueryFunctionImpl["impl QueryFunction for LengthQuery
  fn execute(db: &dyn HelloWorld, key: ()) -> usize"] click LengthQuery "http:query_groups.html#for-each-query-a-query-struct" "more info" click LengthQueryImpl "http:query_groups.html#for-each-query-a-query-struct" "more info" click LengthQueryFunctionImpl "http:query_groups.html#for-each-query-a-query-struct" "more info" end class HelloWorldTrait,HelloWorldImpl,HelloWorldStorage,QueryGroupImpl,HelloWorldGroupStorage diagramNode; class LengthQuery,LengthQueryImpl,LengthQueryFunctionImpl diagramNode; end subgraph database DatabaseStruct["struct Database { .. storage: Storage(Self) .. }"] subgraph for each group... HasQueryGroup["impl plumbing::HasQueryGroup(HelloWorldStorage) for DatabaseStruct"] click HasQueryGroup "http:database.html#the-hasquerygroup-impl" "more info" end DatabaseStorageTypes["impl plumbing::DatabaseStorageTypes for DatabaseStruct
  type DatabaseStorage = __SalsaDatabaseStorage"] click DatabaseStorageTypes "http:database.html#the-databasestoragetypes-impl" "more info" DatabaseStorage["struct __SalsaDatabaseStorage"] click DatabaseStorage "http:database.html#the-database-storage-struct" "more info" DatabaseOps["impl plumbing::DatabaseOps for DatabaseStruct"] click DatabaseOps "http:database.html#the-databaseops-impl" "more info" class DatabaseStruct,DatabaseStorage,DatabaseStorageTypes,DatabaseOps,HasQueryGroup diagramNode; end subgraph salsa crate DerivedStorage["DerivedStorage"] class DerivedStorage diagramNode; end LengthQueryImpl --> DerivedStorage; DatabaseStruct --> HelloWorldImpl HasQueryGroup --> HelloWorldImpl