aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/go/collection.md20
-rw-r--r--layouts/go/list.html29
-rw-r--r--layouts/go/partials/list.html24
3 files changed, 72 insertions, 1 deletions
diff --git a/content/go/collection.md b/content/go/collection.md
index 9375e05..560f88f 100644
--- a/content/go/collection.md
+++ b/content/go/collection.md
@@ -4,4 +4,22 @@ name = "collection"
repository = "https://git.neonxp.ru/collection.git"
description = "Генерики для коллекций"
gomod = true
-+++ \ No newline at end of file
++++
+
+Go >= 1.18 required.
+
+# Installation
+
+`go get neonxp.ru/go/collection@latest`
+
+# Methods
+
+|Method|Description|Example|
+|:-----|:----------|------:|
+|`Map`|Async map over slice|[example_map_test.go](./example_map_test.go)|
+|`MapSync`|Sync map over slice|[example_map_test.go](./example_map_test.go)|
+|`Each`|Async call cb over each element|[example_each_test.go](./example_each_test.go)|
+|`MapEach`|Sync call cb over each element|[example_each_test.go](./example_each_test.go)|
+|`Filter`|Returns filtered elements async|TODO|
+|`FilterSync`|Returns filtered elements|TODO|
+|`Reduce`|Produce one single result from a sequence of elements|TODO| \ No newline at end of file
diff --git a/layouts/go/list.html b/layouts/go/list.html
new file mode 100644
index 0000000..860fd5c
--- /dev/null
+++ b/layouts/go/list.html
@@ -0,0 +1,29 @@
+{{ define "main" }}
+<div class="row">
+ <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4 last-xs last-sm first-md first-lg sidebar">
+ <article>
+ <header>Навигатор</header>
+ {{ partial "menu.html" (dict "menuID" "sections" "page" .) }}
+ </article>
+ </div>
+ <div class="h-entry col-xs-12 col-sm-12 col-md-8 col-lg-8">
+ {{ if .Title }}
+ <article>
+ <header>
+ <div class="row between-xs">
+ <span class="p-name"> {{ .Title }} </span>
+ <a href="index.xml">{{ partial "icon.html" "rss" }}</a>
+ </div>
+ </header>
+ {{ .Content }}
+ </article>
+ {{ end }}
+ {{ $paginator := .Paginate .Pages 7 }}
+ {{ range $paginator.Pages }}
+ {{ partial "list.html" . }}
+ {{ end }}
+ <nav>{{ partial "pagination.html" . }}</nav>
+ </div>
+</div>
+
+{{ end }}
diff --git a/layouts/go/partials/list.html b/layouts/go/partials/list.html
new file mode 100644
index 0000000..bfdf13b
--- /dev/null
+++ b/layouts/go/partials/list.html
@@ -0,0 +1,24 @@
+<article>
+ <header>
+ <div class="row between-xs">
+ <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
+ <a href="https://godoc.neonxp.ru/neonxp.ru/go/{{ .Params.Name }}">
+ <img src="https://godoc.neonxp.ru/neonxp.ru/go/{{ .Params.Name }}?status.svg" />
+ </a>
+ </div>
+ </header>
+ {{ if .Params.Image }}
+ <img src="{{ .RelPermalink }}{{.Params.Image}}" />
+ {{ end }}
+ {{ if .Description }}
+ {{ .Description }}
+ {{ else }}
+ {{ .Summary }}
+ {{ if .Truncated }}
+ <a href="{{ .RelPermalink }}">Далее...</a>
+ {{ end }}
+ {{ end }}
+ <footer>
+ {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
+ </footer>
+</article> \ No newline at end of file