d2 icon indicating copy to clipboard operation
d2 copied to clipboard

0.6.0 globs

Open bo-ku-ra opened this issue 2 years ago • 4 comments

i confused

  • correct?

    • https://github.com/terrastruct/d2/issues/1487#issuecomment-1657459438
  • (lady* -> barbie)[*].style.stroke: pink https://d2lang.com/tour/globs/#glob-connections

    • what is '[ ]' on d2? ( [0]? [1]? ... [*]?)
  • ** is recursive?

    • "ex. zone-A.** -> load balancer"
    • image

bo-ku-ra avatar Jul 31 '23 06:07 bo-ku-ra

good to see you again @bo-ku-ra !

  1. Yes, correct for now, but it's temporary. Later this week we will change globs to apply to objects made after it. But right now it only applies to objects already made.
  2. It's the connection index. https://play.d2lang.com/?script=qlDQtVOo5IJSXBoQhma0Qawe2EdWCpkKibkKhggZQ1QZIy5AAAAA__8%3D&
  3. We have a note in the docs that the recursive doesn't get containers when used on connections. It's for practical reasons -- we couldn't think of a case where someone would want the behavior to also point containers to something.

alixander avatar Jul 31 '23 06:07 alixander

3.We have a note in the docs that the recursive doesn't get containers when used on connections. It's for practical reasons -- we couldn't think of a case where someone would want the behavior to also point containers to something.

'x', 'y', 'z' and 'bar' are same layer. https://play.d2lang.com/?l=&script=ZJHNTsMwEITvfoqhOQQsdVPlwMFIcOUdEEJ23DgWSTZyzE9J8-4oTisqevJ4P3nGq6mZFSYBfAvgIACjwzo4yc0GU_qmgu-02z9g2VmhiXEYVVHYstW9o4q7wneusOWbC3pofEXjp5uTT8o4djZdgAzP_iS3sCV2dE87-BEVc3uTyFEAy9sfMQtRMxsd0klSYvuI8yRbFBkdqGb-Awr9R9teUKPDFb09wwvHuxf5umJksNznEV8c3p_W7H8uA_s-IjJi40eYA3Ipc0ypG1rbUgh7O4vfAAAA__8%3D&

  1. i think '**' should apply to all.
  2. if i don't need them, i can delete them with 'null'.

this is simple. i can easily understand it.

bo-ku-ra avatar Jul 31 '23 07:07 bo-ku-ra

if svg is output by the auto-output program then i can not imagine the correct diagrams. (you can find out all the nests correctly, right?)

bo-ku-ra avatar Jul 31 '23 23:07 bo-ku-ra

@alixander https://github.com/terrastruct/d2/issues/1511#issuecomment-1657747186

We have a note in the docs that the recursive doesn't get containers when used on connections. It's for practical reasons -- we couldn't think of a case where someone would want the behavior to also point containers to something.

the situation has changed since v0.6.2 (the ELK layout engine will now route SQL diagrams to their exact columns.)

expect

  • a.g.h.i -> z
  • a.c.e -> z

result

vars: {
  d2-config: {
    layout-engine: elk
  }
}

a.b
a.c.d
a.c.e.f
a.g.h.i: {
      foobar: {
        shape: sql_table
        integer: int {constraint: [primary_key; unique]}
        text: char {constraint: foreign_key}
        json: jsonb {constraint: unique}
      }
}

** -> z

https://play.d2lang.com/?script=VE9BbsMwDLsbyB94LhAfdvSAfWQYCiVVHK2Z3MrOsKzI3wevW9tcKIoiCeiTLAdcGgccnto-6SDxbwcmWtJcWtYoygE8Hau-Nm5tXOPIdxV6f7gO9kMl0Y9ebhXAkFJH9iAAeaQTB-TztC_UTXy_iBaObKESXPqkuRiJloDXk8kH2bI_8vKMWeU889t6Txb-KgH9SLbNDclYotbYg_s9Jw2_2G3t1-Kb8__X3Q7tC77dTwAAAP__&

i think this specification is difficult to imagine and use.

bo-ku-ra avatar Aug 03 '24 21:08 bo-ku-ra