Skip to content
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

globs: filter connection src/dst #2363

Closed
the42 opened this issue Feb 20, 2025 · 4 comments · Fixed by #2395
Closed

globs: filter connection src/dst #2363

the42 opened this issue Feb 20, 2025 · 4 comments · Fixed by #2395

Comments

@the42
Copy link

the42 commented Feb 20, 2025

As D2 gained support for globs an declarative formatting, what is an easy way to sepcifiy that in the case of

sql_tableA -> sql_tableB

the links should render as

source-arrowhead: 1
target-arrowhead: * {
shape: diamond
}

only if sql_tableA AND sql_tableB are of shape: sql_table

Is there a mechanism where globs could be easily attached like a naming scheme (here sql_*) or a class attribute?

@cyborg-ts cyborg-ts added this to D2 Feb 20, 2025
@alixander alixander changed the title declarativelly style er diagrams globs: filter connection src/dst Feb 20, 2025
@alixander
Copy link
Collaborator

That's a good point, we should be able to filter by connection src and dst

TODO

sql_tableA -> sql_tableB
a -> b

(** -> **)[*]: {
  &src.shape: sql_table
  &dst.shape: sql_table
  source-arrowhead: 1
  target-arrowhead: * {
    shape: diamond
  }
}

@bo-ku-ra
Copy link
Contributor

bo-ku-ra commented Feb 21, 2025

#2363 (comment) or

sql_tableA -> sql_tableB {name: foo}
a -> b
a {name: bar}


(** -> **)[*]: {
  &name: foo
  source-arrowhead: 1
  target-arrowhead: * {
    shape: diamond
  }
}

**:{
  &name: bar
  style.fill: mistyrose;
}

i think this is more versatile.

globs is better.

&name: foo*

@bo-ku-ra
Copy link
Contributor

i don't know why I thought it should be separate from the 'class'.
maybe I was sleepwalking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants