瀏覽代碼

Initial data model.

Frederic G. MARAND 10 年之前
父節點
當前提交
84989d9ca0
共有 3 個文件被更改,包括 261 次插入4 次删除
  1. 8 4
      README.md
  2. 39 0
      doc/model.dot
  3. 214 0
      doc/model.svg

+ 8 - 4
README.md

@@ -1,11 +1,15 @@
-_Kurz_ is yet another URL shortener.
+_Kurz_ is yet another URL shortener/aliaser.
 
-  * built as a Go API
+  * built as a Go API, for internal site use as well as public use
   * web front end provided
-  * multiple shortening strategies. provided:
+  * multiple aliasing strategies. provided:
     * 32-bits hexa string, leading 0s omitted
     * base36
     * manual selection
-  * vanity domain support
+  * supporting
+    * vanity domains
+    * relative paths (API only, no Web UI), for use within web sites
+    * "slug"-type multipart aliasing for SEO
   * usage statistics
 
+It is currently available under the General Public License version 3 or later.

+ 39 - 0
doc/model.dot

@@ -0,0 +1,39 @@
+digraph kurz {
+  rankdir = LR;
+
+  node [ shape="record" ];
+
+  domain [ label="<k>Domain|<owner>owner|<strategy>strategy" ];
+  hit [ label="<k>Hit|<short>short|<origin>origin" ];
+  eventinfo [ label="<k>Event info|IP|ts" ];
+  language [ label="<k>Language|native name" ];
+  likings [ label="<k>Likings|<user>user|<long>longUrl|ts" ];
+  long [ label="<k>Long URL|value" ];
+  longmeta [ label="<k>Long metadata|<long>longUrl|mimeType|<language>language|imagePath|<info>origin" ];
+  session [ label="<k>Session|<user>user|<info>info" ];
+  short [ label="<k>Short URL|value|<long>shortFor|<domain>domain|<strategy>strategy|<user>submittedBy|submittedOn|isEnabled" ];
+  strategy [ label="<k>Strategy|name" ];
+  user [ label="<k>User|<language>language|<strategy>defaultStrategy" ];
+
+  edge [ color="red", label="is a" ];
+  domain:strategy -> strategy:k;
+  domain:owner -> user:k;
+
+  hit:origin -> eventinfo:k;
+  hit:short -> short:k;
+
+  longmeta:info -> eventinfo:k;
+  longmeta:language -> language:k;
+  longmeta:long -> long:k;
+
+  session:info -> eventinfo:k;
+  session:user -> user:k;  
+
+  short:domain -> domain:k;
+  short:long -> long:k;
+  short:user -> user:k;
+  short:strategy -> strategy:k;
+
+  user:language -> language:k;
+  user:strategy -> strategy:k;
+}

+ 214 - 0
doc/model.svg

@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.26.3 (20100126.1600)
+ -->
+<!-- Title: kurz Pages: 1 -->
+<svg width="754pt" height="553pt"
+ viewBox="0.00 0.00 754.00 553.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph1" class="graph" transform="scale(1 1) rotate(0) translate(4 549)">
+<title>kurz</title>
+<polygon fill="white" stroke="white" points="-4,5 -4,-549 751,-549 751,5 -4,5"/>
+<!-- domain -->
+<g id="node1" class="node"><title>domain</title>
+<polygon fill="none" stroke="black" points="315,-461 315,-539 389,-539 389,-461 315,-461"/>
+<text text-anchor="middle" x="352" y="-522.4" font-family="Times Roman,serif" font-size="14.00">Domain</text>
+<polyline fill="none" stroke="black" points="315,-513 389,-513 "/>
+<text text-anchor="middle" x="352" y="-496.4" font-family="Times Roman,serif" font-size="14.00">owner</text>
+<polyline fill="none" stroke="black" points="315,-487 389,-487 "/>
+<text text-anchor="middle" x="352" y="-470.4" font-family="Times Roman,serif" font-size="14.00">strategy</text>
+</g>
+<!-- strategy -->
+<g id="node10" class="node"><title>strategy</title>
+<polygon fill="none" stroke="black" points="655.5,-389 655.5,-441 732.5,-441 732.5,-389 655.5,-389"/>
+<text text-anchor="middle" x="694" y="-424.4" font-family="Times Roman,serif" font-size="14.00">Strategy</text>
+<polyline fill="none" stroke="black" points="655.5,-415 732.5,-415 "/>
+<text text-anchor="middle" x="694" y="-398.4" font-family="Times Roman,serif" font-size="14.00">name</text>
+</g>
+<!-- domain&#45;&gt;strategy -->
+<g id="edge2" class="edge"><title>domain:strategy&#45;&gt;strategy:k</title>
+<path fill="none" stroke="red" d="M389,-474C494.408,-474 522.69,-471.106 624,-442 634.443,-439 638.079,-433.08 644.912,-429.987"/>
+<polygon fill="red" stroke="red" points="645.865,-433.367 655,-428 644.512,-426.499 645.865,-433.367"/>
+<text text-anchor="middle" x="519" y="-478.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- user -->
+<g id="node11" class="node"><title>user</title>
+<polygon fill="none" stroke="black" points="456.5,-247 456.5,-325 581.5,-325 581.5,-247 456.5,-247"/>
+<text text-anchor="middle" x="519" y="-308.4" font-family="Times Roman,serif" font-size="14.00">User</text>
+<polyline fill="none" stroke="black" points="456.5,-299 581.5,-299 "/>
+<text text-anchor="middle" x="519" y="-282.4" font-family="Times Roman,serif" font-size="14.00">language</text>
+<polyline fill="none" stroke="black" points="456.5,-273 581.5,-273 "/>
+<text text-anchor="middle" x="519" y="-256.4" font-family="Times Roman,serif" font-size="14.00">defaultStrategy</text>
+</g>
+<!-- domain&#45;&gt;user -->
+<g id="edge4" class="edge"><title>domain:owner&#45;&gt;user:k</title>
+<path fill="none" stroke="red" d="M389,-500C420.114,-500 424.396,-477.983 438,-450 449.831,-425.663 431.061,-338.259 446.902,-316.789"/>
+<polygon fill="red" stroke="red" points="448.781,-319.755 456,-312 445.521,-313.561 448.781,-319.755"/>
+<text text-anchor="middle" x="426" y="-496.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- hit -->
+<g id="node2" class="node"><title>hit</title>
+<polygon fill="none" stroke="black" points="5,-259 5,-337 61,-337 61,-259 5,-259"/>
+<text text-anchor="middle" x="33" y="-320.4" font-family="Times Roman,serif" font-size="14.00">Hit</text>
+<polyline fill="none" stroke="black" points="5,-311 61,-311 "/>
+<text text-anchor="middle" x="33" y="-294.4" font-family="Times Roman,serif" font-size="14.00">short</text>
+<polyline fill="none" stroke="black" points="5,-285 61,-285 "/>
+<text text-anchor="middle" x="33" y="-268.4" font-family="Times Roman,serif" font-size="14.00">origin</text>
+</g>
+<!-- eventinfo -->
+<g id="node3" class="node"><title>eventinfo</title>
+<polygon fill="none" stroke="black" points="308.5,-127 308.5,-205 395.5,-205 395.5,-127 308.5,-127"/>
+<text text-anchor="middle" x="352" y="-188.4" font-family="Times Roman,serif" font-size="14.00">Event info</text>
+<polyline fill="none" stroke="black" points="308.5,-179 395.5,-179 "/>
+<text text-anchor="middle" x="352" y="-162.4" font-family="Times Roman,serif" font-size="14.00">IP</text>
+<polyline fill="none" stroke="black" points="308.5,-153 395.5,-153 "/>
+<text text-anchor="middle" x="352" y="-136.4" font-family="Times Roman,serif" font-size="14.00">ts</text>
+</g>
+<!-- hit&#45;&gt;eventinfo -->
+<g id="edge6" class="edge"><title>hit:origin&#45;&gt;eventinfo:k</title>
+<path fill="none" stroke="red" d="M61,-272C103.782,-272 87.2826,-219.201 126,-201 196.143,-168.025 224.546,-189.923 297.847,-191.866"/>
+<polygon fill="red" stroke="red" points="297.955,-195.367 308,-192 298.047,-188.368 297.955,-195.367"/>
+<text text-anchor="middle" x="187" y="-206.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- short -->
+<g id="node9" class="node"><title>short</title>
+<polygon fill="none" stroke="black" points="134,-337 134,-545 240,-545 240,-337 134,-337"/>
+<text text-anchor="middle" x="187" y="-528.4" font-family="Times Roman,serif" font-size="14.00">Short URL</text>
+<polyline fill="none" stroke="black" points="134,-519 240,-519 "/>
+<text text-anchor="middle" x="187" y="-502.4" font-family="Times Roman,serif" font-size="14.00">value</text>
+<polyline fill="none" stroke="black" points="134,-493 240,-493 "/>
+<text text-anchor="middle" x="187" y="-476.4" font-family="Times Roman,serif" font-size="14.00">shortFor</text>
+<polyline fill="none" stroke="black" points="134,-467 240,-467 "/>
+<text text-anchor="middle" x="187" y="-450.4" font-family="Times Roman,serif" font-size="14.00">domain</text>
+<polyline fill="none" stroke="black" points="134,-441 240,-441 "/>
+<text text-anchor="middle" x="187" y="-424.4" font-family="Times Roman,serif" font-size="14.00">strategy</text>
+<polyline fill="none" stroke="black" points="134,-415 240,-415 "/>
+<text text-anchor="middle" x="187" y="-398.4" font-family="Times Roman,serif" font-size="14.00">submittedBy</text>
+<polyline fill="none" stroke="black" points="134,-389 240,-389 "/>
+<text text-anchor="middle" x="187" y="-372.4" font-family="Times Roman,serif" font-size="14.00">submittedOn</text>
+<polyline fill="none" stroke="black" points="134,-363 240,-363 "/>
+<text text-anchor="middle" x="187" y="-346.4" font-family="Times Roman,serif" font-size="14.00">isEnabled</text>
+</g>
+<!-- hit&#45;&gt;short -->
+<g id="edge8" class="edge"><title>hit:short&#45;&gt;short:k</title>
+<path fill="none" stroke="red" d="M61,-298C166.326,-298 34.3982,-516.719 123.969,-531.243"/>
+<polygon fill="red" stroke="red" points="123.765,-534.738 134,-532 124.292,-527.758 123.765,-534.738"/>
+<text text-anchor="middle" x="96" y="-527.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- language -->
+<g id="node4" class="node"><title>language</title>
+<polygon fill="none" stroke="black" points="642.5,-148 642.5,-200 745.5,-200 745.5,-148 642.5,-148"/>
+<text text-anchor="middle" x="694" y="-183.4" font-family="Times Roman,serif" font-size="14.00">Language</text>
+<polyline fill="none" stroke="black" points="642.5,-174 745.5,-174 "/>
+<text text-anchor="middle" x="694" y="-157.4" font-family="Times Roman,serif" font-size="14.00">native name</text>
+</g>
+<!-- likings -->
+<g id="node5" class="node"><title>likings</title>
+<polygon fill="none" stroke="black" points="0,-355 0,-459 66,-459 66,-355 0,-355"/>
+<text text-anchor="middle" x="33" y="-442.4" font-family="Times Roman,serif" font-size="14.00">Likings</text>
+<polyline fill="none" stroke="black" points="0,-433 66,-433 "/>
+<text text-anchor="middle" x="33" y="-416.4" font-family="Times Roman,serif" font-size="14.00">user</text>
+<polyline fill="none" stroke="black" points="0,-407 66,-407 "/>
+<text text-anchor="middle" x="33" y="-390.4" font-family="Times Roman,serif" font-size="14.00">longUrl</text>
+<polyline fill="none" stroke="black" points="0,-381 66,-381 "/>
+<text text-anchor="middle" x="33" y="-364.4" font-family="Times Roman,serif" font-size="14.00">ts</text>
+</g>
+<!-- long -->
+<g id="node6" class="node"><title>long</title>
+<polygon fill="none" stroke="black" points="310.5,-348 310.5,-400 393.5,-400 393.5,-348 310.5,-348"/>
+<text text-anchor="middle" x="352" y="-383.4" font-family="Times Roman,serif" font-size="14.00">Long URL</text>
+<polyline fill="none" stroke="black" points="310.5,-374 393.5,-374 "/>
+<text text-anchor="middle" x="352" y="-357.4" font-family="Times Roman,serif" font-size="14.00">value</text>
+</g>
+<!-- longmeta -->
+<g id="node7" class="node"><title>longmeta</title>
+<polygon fill="none" stroke="black" points="126.5,-0 126.5,-156 247.5,-156 247.5,-0 126.5,-0"/>
+<text text-anchor="middle" x="187" y="-139.4" font-family="Times Roman,serif" font-size="14.00">Long metadata</text>
+<polyline fill="none" stroke="black" points="126.5,-130 247.5,-130 "/>
+<text text-anchor="middle" x="187" y="-113.4" font-family="Times Roman,serif" font-size="14.00">longUrl</text>
+<polyline fill="none" stroke="black" points="126.5,-104 247.5,-104 "/>
+<text text-anchor="middle" x="187" y="-87.4" font-family="Times Roman,serif" font-size="14.00">mimeType</text>
+<polyline fill="none" stroke="black" points="126.5,-78 247.5,-78 "/>
+<text text-anchor="middle" x="187" y="-61.4" font-family="Times Roman,serif" font-size="14.00">language</text>
+<polyline fill="none" stroke="black" points="126.5,-52 247.5,-52 "/>
+<text text-anchor="middle" x="187" y="-35.4" font-family="Times Roman,serif" font-size="14.00">imagePath</text>
+<polyline fill="none" stroke="black" points="126.5,-26 247.5,-26 "/>
+<text text-anchor="middle" x="187" y="-9.4" font-family="Times Roman,serif" font-size="14.00">origin</text>
+</g>
+<!-- longmeta&#45;&gt;eventinfo -->
+<g id="edge10" class="edge"><title>longmeta:info&#45;&gt;eventinfo:k</title>
+<path fill="none" stroke="red" d="M248,-13C266.436,-13 282.61,-151.273 300.498,-184.761"/>
+<polygon fill="red" stroke="red" points="298.373,-187.575 308,-192 303.234,-182.538 298.373,-187.575"/>
+<text text-anchor="middle" x="278" y="-159.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- longmeta&#45;&gt;language -->
+<g id="edge12" class="edge"><title>longmeta:language&#45;&gt;language:k</title>
+<path fill="none" stroke="red" d="M248,-65C256.584,-65 257.89,-69.1873 266,-72 304.857,-85.4772 565.064,-175.498 631.873,-186.001"/>
+<polygon fill="red" stroke="red" points="631.705,-189.501 642,-187 632.392,-182.535 631.705,-189.501"/>
+<text text-anchor="middle" x="426" y="-135.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- longmeta&#45;&gt;long -->
+<g id="edge14" class="edge"><title>longmeta:long&#45;&gt;long:k</title>
+<path fill="none" stroke="red" d="M248,-117C276.504,-117 259.789,-216.181 266,-244 279.696,-305.349 247.395,-378.497 299.994,-386.314"/>
+<polygon fill="red" stroke="red" points="299.784,-389.808 310,-387 300.263,-382.824 299.784,-389.808"/>
+<text text-anchor="middle" x="278" y="-387.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- session -->
+<g id="node8" class="node"><title>session</title>
+<polygon fill="none" stroke="black" points="153,-228 153,-306 221,-306 221,-228 153,-228"/>
+<text text-anchor="middle" x="187" y="-289.4" font-family="Times Roman,serif" font-size="14.00">Session</text>
+<polyline fill="none" stroke="black" points="153,-280 221,-280 "/>
+<text text-anchor="middle" x="187" y="-263.4" font-family="Times Roman,serif" font-size="14.00">user</text>
+<polyline fill="none" stroke="black" points="153,-254 221,-254 "/>
+<text text-anchor="middle" x="187" y="-237.4" font-family="Times Roman,serif" font-size="14.00">info</text>
+</g>
+<!-- session&#45;&gt;eventinfo -->
+<g id="edge16" class="edge"><title>session:info&#45;&gt;eventinfo:k</title>
+<path fill="none" stroke="red" d="M221,-241C256.01,-241 259.722,-220.577 290,-203 294.054,-200.646 296.21,-197.896 298.525,-195.735"/>
+<polygon fill="red" stroke="red" points="299.98,-198.923 308,-192 297.413,-192.411 299.98,-198.923"/>
+<text text-anchor="middle" x="278" y="-227.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- session&#45;&gt;user -->
+<g id="edge18" class="edge"><title>session:user&#45;&gt;user:k</title>
+<path fill="none" stroke="red" d="M221,-267C298.81,-267 321.472,-249.643 396,-272 417.028,-278.308 419.976,-285.465 438,-298 442.42,-301.074 444.364,-304.833 446.734,-307.682"/>
+<polygon fill="red" stroke="red" points="445.457,-310.948 456,-312 448.414,-304.603 445.457,-310.948"/>
+<text text-anchor="middle" x="352" y="-277.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- short&#45;&gt;domain -->
+<g id="edge20" class="edge"><title>short:domain&#45;&gt;domain:k</title>
+<path fill="none" stroke="red" d="M240,-454C262.505,-454 272.48,-447.875 290,-462 310.245,-478.322 291.994,-513.256 304.988,-523.267"/>
+<polygon fill="red" stroke="red" points="304.431,-526.743 315,-526 306.275,-519.99 304.431,-526.743"/>
+<text text-anchor="middle" x="278" y="-467.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- short&#45;&gt;long -->
+<g id="edge22" class="edge"><title>short:long&#45;&gt;long:k</title>
+<path fill="none" stroke="red" d="M240,-480C262.222,-480 272.713,-493.964 290,-480 319.548,-456.131 278.019,-400.083 299.939,-388.944"/>
+<polygon fill="red" stroke="red" points="300.846,-392.334 310,-387 299.518,-385.461 300.846,-392.334"/>
+<text text-anchor="middle" x="278" y="-491.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- short&#45;&gt;strategy -->
+<g id="edge26" class="edge"><title>short:strategy&#45;&gt;strategy:k</title>
+<path fill="none" stroke="red" d="M240,-428C421.022,-428 468.797,-428 644.874,-428"/>
+<polygon fill="red" stroke="red" points="645,-431.5 655,-428 645,-424.5 645,-431.5"/>
+<text text-anchor="middle" x="426" y="-433.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- short&#45;&gt;user -->
+<g id="edge24" class="edge"><title>short:user&#45;&gt;user:k</title>
+<path fill="none" stroke="red" d="M240,-402C275.7,-402 238.237,-348.443 266,-326 278.962,-315.522 292.244,-312.145 445.689,-312.005"/>
+<polygon fill="red" stroke="red" points="446.002,-315.505 456,-312 445.998,-308.505 446.002,-315.505"/>
+<text text-anchor="middle" x="352" y="-319.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- user&#45;&gt;language -->
+<g id="edge28" class="edge"><title>user:language&#45;&gt;language:k</title>
+<path fill="none" stroke="red" d="M582,-286C601.676,-286 610.895,-286.677 624,-272 646.906,-246.346 612.658,-198.965 632.173,-188.907"/>
+<polygon fill="red" stroke="red" points="632.85,-192.341 642,-187 631.516,-185.47 632.85,-192.341"/>
+<text text-anchor="middle" x="612" y="-290.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+<!-- user&#45;&gt;strategy -->
+<g id="edge30" class="edge"><title>user:strategy&#45;&gt;strategy:k</title>
+<path fill="none" stroke="red" d="M582,-260C591.152,-260 591.141,-252.296 600,-250 610.326,-247.324 615.836,-243.135 624,-250 682.58,-299.259 584.704,-416.322 644.93,-427.188"/>
+<polygon fill="red" stroke="red" points="644.751,-430.685 655,-428 645.314,-423.708 644.751,-430.685"/>
+<text text-anchor="middle" x="612" y="-255.4" font-family="Times Roman,serif" font-size="14.00">is a</text>
+</g>
+</g>
+</svg>