ํ•™์Šต ๋ชฉํ‘œ

  • graphviz ๋ฌธ๋ฒ•์„ ์ดํ•ดํ•˜๊ณ , dot ํ˜•์‹์„ ์ง€์›ํ•˜๋Š” ๊ทธ๋ž˜ํ”„ ์ƒ์„ฑ ๋„๊ตฌ๋ฅผ ์ง์œผ๋กœ ํ•จ๊ป˜ ์„ค๊ณ„ํ•˜๋Š” ๊ฒƒ์ด ๋ชฉํ‘œ๋‹ค.

  • ์ฝ”๋“œ๋ฅผ ๊ตฌํ˜„ํ•˜๊ธฐ ์ „์— ๋ฌด์—‡์„ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๋Š”๊ฐ€ ์ดํ•ด๋„๋ฅผ ๋†’์ด๊ณ  ํ•ด๊ฒฐํ•˜๋ ค๋Š” ๊ฒƒ์— ์ง‘์ค‘ํ•œ๋‹ค.

์‚ฌ์ „์ง€์‹

  • ์—†์Œ.

๊ธฐ๋Šฅ์š”๊ตฌ์‚ฌํ•ญ

๋‹ค ๊ฐ™์ด graphviz ์˜คํ”ˆ์†Œ์Šค์™€ ์ง€์›ํ•˜๋Š” ๋ฌธ๋ฒ• ํ˜•์‹์— ๋Œ€ํ•ด ์กฐ์‚ฌํ•œ๋‹ค.

graphviz ์˜ˆ์‹œ

#SAMPLE for Boostcamp Basic
digraph FamilyTree {
    // ๋…ธ๋“œ ์ •์˜
    John [label="John", shape=circle, color=blue];
    Jane [label="Jane", shape=circle, color=blue];
    Mary [label="Mary", shape=circle, color=pink];
    Bill [label="Bill", shape=circle, color=green];
 
    // ์—์ง€ ์ •์˜
    John -> Mary [label="mother"];
    Jane -> Mary [label="mother"];
    John -> Bill [label="father"];
    Jane -> Bill [label="father"];
}
  • ์ตœ์†Œ 2๋ช… ์ด์ƒ์ด ํ•˜๋‚˜์˜ ํ˜•์‹์— ๋Œ€ํ•ด ๋„์ „ํ•˜๊ณ  ๊ฐ™์ด ํ•™์Šตํ•˜๊ณ  ์„ค๊ณ„ํ•œ๋‹ค.
  • ์–ด๋–ค ํ˜•์‹์„ ๊ธฐ์ค€์œผ๋กœ ํ•  ๊ฒƒ์ธ์ง€ 2๋ช… ์ด์ƒ์ด ํ•จ๊ป˜ ๊ฒฐ์ •ํ•œ๋‹ค.
  • ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์š”๊ตฌ์‚ฌํ•ญ์„ ๋งŒ์กฑํ•˜๋Š” ๊ทธ๋ž˜ํ”„ ์ƒ์„ฑ ๋„๊ตฌ๋ฅผ ์„ค๊ณ„ํ•œ๋‹ค.
  • ์˜ˆ์‹œ์— ์žˆ๋Š” ๊ตฌ์กฐ์™€ ์†์„ฑ, ์ด๋ฆ„ ๋“ฑ์ด ๋ฐ”๋€Œ์–ด๋„ ๋™์ž‘ํ•˜๋„๋ก ์„ค๊ณ„ํ•œ๋‹ค.
  • ์ „๋‹ฌํ•  ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ๋ฅผ ์–ด๋–ป๊ฒŒ ํ‘œํ˜„ํ•  ๊ฒƒ์ธ๊ฐ€ ๊ฒฐ์ •ํ•œ๋‹ค.
  • ์„ค๊ณ„ ํ›„์— ๊ตฌํ˜„์„ ํ•ด๋„ ๋ฌด๋ฐฉํ•˜์ง€๋งŒ ๊ตฌํ˜„๋งŒ ํ•ด์„œ๋Š” ์•ˆ๋œ๋‹ค.
  • ๊ตฌํ˜„ํ•˜๋Š” ๊ฒฝ์šฐ์— ์„ค๊ณ„ ๊ฒฐ๊ณผ๋ฌผ์ด ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ฒฐ๊ณผ๋ฌผ๋งŒํผ ์ƒ์„ธํ•˜๊ฑฐ๋‚˜ ๋งŽ์•„์•ผ ํ•œ๋‹ค.

์„ค๊ณ„ ๊ฒฐ๊ณผ ์ œ์ถœ

  • ํ•ด๊ฒฐํ•˜๋ ค๋Š” ๋ฌธ์ œ์™€ ๋™์ž‘ ๋ฐฉ์‹์— ๋Œ€ํ•ด ์ดํ•ดํ•œ ๋‚ด์šฉ์„ ์š”์•ฝํ•œ๋‹ค.
  • ์„ค๊ณ„๋Š” ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ์™€ ๋ฐ์ดํ„ฐ ํ๋ฆ„์„ ๋ช…์‹œํ•œ ๊ทธ๋ฆผ์„ ์†์œผ๋กœ ๊ทธ๋ฆฐ๋‹ค.
  • ์†์œผ๋กœ ๊ทธ๋ฆฐ ๊ทธ๋ฆผ์„ ์บก์ฒ˜ํ•ด์„œ gist์— ์ฒจ๋ถ€ํ•œ๋‹ค.
  • gist์— README.md ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•˜๊ณ  ์„ค๊ณ„ ์˜๋„์™€ ๋ฐฉํ–ฅ์— ๋Œ€ํ•ด ๊ฐ„๋žตํ•˜๊ฒŒ ์„ค๋ช…์„ ๋ถ™์ธ๋‹ค.

ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์š”๊ตฌ์‚ฌํ•ญ

๋‹ค์Œ๊ณผ ๊ฐ™์ด ํŒจํ‚ค์ง€ > ํŒŒ์ผ > ํƒ€์ž… > ์†์„ฑ ๋‹จ๊ณ„๋ณ„๋กœ ๊ตฌ์„ฑ๋œ ๊ตฌ์กฐ๋ฅผ ๊ทธ๋ž˜ํ”„๋กœ ๋ฐ์ดํ„ฐ ๊ตฌ์กฐ๋ฅผ ๋„˜๊ธฐ๋ฉดย graphvizย ์ถœ๋ ฅ ํ˜•์‹ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•œ๋‹ค.

  • ํŒจํ‚ค์ง€๋Š” ์—ฌ๋Ÿฌ ํŒŒ์ผ์„ ํฌํ•จํ•œ๋‹ค.
  • ํŒŒ์ผ ํ•˜๋‚˜์—๋Š” ํƒ€์ž… ํ•˜๋‚˜๋ฅผ ํฌํ•จํ•œ๋‹ค.
  • ํƒ€์ž…์€ ๊ณ ์œ  ์ด๋ฆ„๊ณผ ์—ฌ๋Ÿฌ ์†์„ฑ์„ ๊ฐ€์ง„๋‹ค.
  • ์†์„ฑ๋งˆ๋‹ค ํŠน์ • ํƒ€์ž…์„ ์ฐธ์กฐํ•œ๋‹ค.
  • System ์•„๋ž˜์—๋Š” Integer, String ํƒ€์ž…์ด ์ด๋ฏธ ์กด์žฌํ•œ๋‹ค.

Service ํŒจํ‚ค์ง€

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-06-28 แ„‹แ…ฉแ„’แ…ฎ 11.42.25.png

1. Product ํƒ€์ž…
package Service
 
Type Product {
    sku : String
    price : Int
    title : String
}
2. Order ํƒ€์ž…
package Service

Type Order {
    orderId : String
    product : Product
}

์˜ˆ์ƒ๊ฒฐ๊ณผ ๋ฐ ๋™์ž‘์˜ˆ์‹œ

์™„๋ฒฝํ•˜๊ฒŒ ๋™์ผํ•  ํ•„์š”๋Š” ์—†๊ณ , ์Šคํƒ€์ผ์ด๋‚˜ ์ƒ‰์ƒ์„ ์ œ์™ธํ•˜๊ณ  ํ•„์ˆ˜ ํ•ญ๋ชฉ๋งŒ ๋น„์Šทํ•˜๊ฒŒ ์ฑ„์šฐ๋ฉด ๋œ๋‹ค. ํŒจํ‚ค์ง€ > ํŒŒ์ผ > ํƒ€์ž… ํฌํ•จ ๊ด€๊ณ„๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์œผ๋ฉด ์–ด๋–ค ํ˜•์‹์œผ๋กœ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.

digraph G {

   subgraph cluster_0 {
    style = tab;
    color=blue;
    label = "Service Package";
        subgraph cluster_1 {
            Product [shape=box style=filled color=cyan]
            sku;
            price;
            title;
            label = "Product.file";
            color=lightgrey;
        }
      
        subgraph cluster_2 {
            Order [shape=box style=filled color=cyan]
            orderId;
            product;
            label = "Order.file";
            color=lightgrey;
        }
    }
  
    subgraph cluster_9 {
        style = tab;
        label = "System Package";
        color=blue;
    
        subgraph cluster_10 {
            String [shape=box style=filled color=cyan]
            Int [shape=box style=filled color=cyan]
            label = "Source.file";
            color=lightgrey;
      }
    }
    
    sku -> String;
    price -> Int;
    title -> String;
    orderId -> String;
    product -> Product;
}

graphviz-service

์˜จ๋ผ์ธ ์ƒ˜ํ”Œ

์ƒ˜ํ”Œ ๋ฐ”๋กœ๊ฐ€๊ธฐ