Skip to content

Commit 1a980ea

Browse files
authored
Merge pull request #39 from ahmetalpbalkan/docs-migration
Move github site to docs/
2 parents b1c935a + bfd640d commit 1a980ea

File tree

4 files changed

+377
-0
lines changed

4 files changed

+377
-0
lines changed

docs/css/main.css

+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
2+
body {
3+
margin: 0;
4+
padding: 0;
5+
background-color: #fbfcfc;
6+
7+
font-family: 'proxima-nova', sans-serif;
8+
font-weight: 300;
9+
}
10+
11+
h1, h2, h3, h4 {
12+
font-weight: 200;
13+
}
14+
15+
h1, h2, h3, h4 {
16+
font-family: 'museo', serif;
17+
}
18+
19+
p {
20+
line-height: 160%;
21+
font-weight: 200;
22+
font-size: 130%;
23+
}
24+
25+
header {
26+
text-align: center;
27+
padding: 2em 10em 5em 10em;
28+
29+
background-color: #355c7d;
30+
color: #fbfcfc;
31+
}
32+
33+
header > h1 {
34+
font-size: 420%;
35+
margin-bottom: 1em;
36+
}
37+
38+
header > h2 {
39+
margin-bottom: 1em;
40+
}
41+
42+
header a {
43+
color: #1abc9c;
44+
}
45+
header a:hover {
46+
color: #16a085;
47+
}
48+
49+
.promo {
50+
clear:both;
51+
text-align: center;
52+
margin-top: 3em;
53+
}
54+
.promo p {
55+
margin-top: 1em;
56+
font-size: 120%;
57+
}
58+
59+
body > section {
60+
text-align: center;
61+
padding: 1em 0 2em 0;
62+
color: white;
63+
}
64+
65+
section.features {
66+
background-color: #8e6e85;
67+
}
68+
69+
section.features .inner {
70+
width: 70%;
71+
margin: 0 auto;
72+
}
73+
74+
section.features h3 {
75+
font-size: 180%;
76+
margin-top: 2em;
77+
margin-bottom: 1.5em;
78+
}
79+
80+
section.features aside {
81+
text-align: center;
82+
padding: 0 2%;
83+
padding-bottom: 1em;
84+
}
85+
86+
section.demo {
87+
background-color: rgb(192,108,132);
88+
padding-bottom: 4em;
89+
}
90+
91+
section.demo .inner {
92+
width: 70%;
93+
margin: 0 auto;
94+
}
95+
96+
section.demo h2 {
97+
margin-top: 2em;
98+
}
99+
100+
table {
101+
margin-top: 2em;
102+
border: 0;
103+
width: 100%;
104+
}
105+
106+
table td {
107+
vertical-align: top;
108+
text-align: left;
109+
padding-bottom: .5em;
110+
}
111+
112+
td.docs {
113+
width: 40%;
114+
text-align: justify;
115+
padding-right: 2%;
116+
}
117+
118+
td.code {
119+
width: 60%;
120+
}
121+
122+
123+
124+
section.about {
125+
background-color: #16a085;
126+
padding: 4em 0 8em 0;
127+
color: #ecf0f1;
128+
}
129+
section.about .inner {
130+
width: 60%;
131+
}
132+
133+
section.about h2 {
134+
color: white;
135+
margin-bottom: 2em;
136+
}
137+
138+
section.about a:not(.btn) {
139+
color: #2c3e50;
140+
}
141+
section.about a:not(.btn):hover {
142+
color: #bdc3c7;
143+
}
144+
145+
section.about .inner {
146+
width: 60%;
147+
margin: 0 auto;
148+
}
149+
150+
footer {
151+
background-color: #16a085;
152+
color: #1abc9c;
153+
font-size: 80%;
154+
text-align: center;
155+
width: 100%;
156+
clear: both;
157+
padding-bottom: 1em;
158+
}

docs/img/ahmet.png

232 KB
Loading

docs/img/kalan.png

391 KB
Loading

docs/index.html

+219
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7+
<title>go-linq: LINQ query functions over slices for Golang</title>
8+
<meta name="viewport" content="width=device-width">
9+
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
10+
<link rel="stylesheet" href="css/main.css">
11+
<link href='//fonts.googleapis.com/css?family=Roboto:300' rel='stylesheet' type='text/css'>
12+
<meta name="author" content="Ahmet Alp Balkan">
13+
14+
<script type="text/javascript" src="//use.typekit.net/wnk8juw.js"></script>
15+
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
16+
</head>
17+
18+
<body>
19+
<header>
20+
<h1>go-linq</h1>
21+
22+
<h2>.NET's Language Integrated Query (LINQ) library for Go</h2>
23+
24+
<p>
25+
Query and manipulate Go slices and collections using SQL-like methods.
26+
<br/>Written in pure Go with no dependencies, tested with 100% code coverage.
27+
</p>
28+
29+
<div class='promo'>
30+
<p>
31+
<iframe src="http://ghbtns.com/github-btn.html?user=ahmetalpbalkan&repo=go-linq&type=watch&count=true&size=large" allowtransparency="true"
32+
frameborder="0" scrolling="0" width="142px" height="30px" style='margin-left:30px'></iframe>
33+
</p>
34+
35+
<p>
36+
<a class='btn btn-default btn-lg' href='https://github.com/ahmetalpbalkan/go-linq'>Fork it!</a>
37+
<a class='btn btn-default btn-lg' href='http://godoc.org/github.com/ahmetalpbalkan/go-linq'>GoDoc</a>
38+
</p>
39+
40+
</header>
41+
42+
<section class='features'>
43+
<div class='inner row'>
44+
<aside class='col-md-4'>
45+
<h3>Bring your type</h3>
46+
<p>
47+
There are no generics in Go, but
48+
<nobr>go-linq</nobr> supports arrays, slices, maps, strings and channels out-of-the-box, or any collection
49+
that implements <code>.Comparable</code>.
50+
</p>
51+
</aside>
52+
53+
<aside class='col-md-4'>
54+
<h3>Method syntax</h3>
55+
<p style='text-align: center;'>
56+
<code>From(slice)</code> <code>.Where(predicate)</code> <code>.Select(selector)</code> <code>.ToSlice(&result)</code>
57+
<br/> Easy as that. Just keep writing your queries.
58+
</p>
59+
</aside>
60+
61+
<aside class='col-md-4'>
62+
<h3>Concurrency</h3>
63+
<p>
64+
Your queries can share data between goroutines by calling <code>.FromChannel()</code> and <code>.ToChannel()</code> methods.
65+
</p>
66+
</aside>
67+
</div>
68+
</section>
69+
70+
<section class='demo hidden-xs'>
71+
<h2>Basic</h2>
72+
<p>Find average age of students over 20.</p>
73+
<div class='inner row'>
74+
<table>
75+
<tr>
76+
<td class='docs'>
77+
Import your <code>[]Student</code>.
78+
</td>
79+
80+
<td class='code'><code>
81+
results := From(students).
82+
</code></td>
83+
</tr>
84+
85+
<tr>
86+
<td class='docs'>
87+
Find those over 20.<br/> So we make type assertion to our input type.
88+
</td>
89+
90+
<td class='code'><code>
91+
Where(func (s interface{}) bool {<br/>
92+
&nbsp;&nbsp;&nbsp;&nbsp;return s.(Student).age >= 20<br/>
93+
}).
94+
</code></td>
95+
</tr>
96+
97+
<tr>
98+
<td class='docs'>
99+
Select their ages.
100+
</td>
101+
102+
<td class='code'><code>
103+
Select(func (s interface{}) interface{} {<br/>
104+
&nbsp;&nbsp;&nbsp;&nbsp;return s.(Student).age<br/>
105+
}).
106+
</code></td>
107+
</tr>
108+
<tr>
109+
<td class='docs'>
110+
Find the average.
111+
</td>
112+
113+
<td class='code'><code>
114+
Average()
115+
</code></td>
116+
</tr>
117+
</table>
118+
</div>
119+
120+
<h2>Concurrent</h2>
121+
<div class='inner row'>
122+
<p>Count websites that have a favicon.ico.</p>
123+
<table>
124+
<tr>
125+
<td class='docs'>
126+
&nbsp;
127+
</td>
128+
129+
<td class='code'><code>
130+
urls := make(chan interface{})<br/>
131+
results := make(chan interface{})
132+
</code></td>
133+
</tr>
134+
135+
<tr>
136+
<td class='docs'>
137+
Convert domain names to full URLs.
138+
</td>
139+
140+
<td class='code'><code>
141+
go func(domains []string) {<br/>
142+
&nbsp;&nbsp;&nbsp;&nbsp;From(domains).Select(func(d interface{}) interface{} {</br>
143+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return fmt.Sprintf("http://%s/favicon.ico", d)</br>
144+
&nbsp;&nbsp;&nbsp;&nbsp;}).ToChannel(urls)</br>
145+
}(domains)
146+
</code></td>
147+
</tr>
148+
149+
<tr>
150+
<td class='docs'>
151+
Let's run the following in parallel.<br/>Request favicon for each domain.
152+
</td>
153+
154+
<td class='code'><code>
155+
go func() {<br/>
156+
&nbsp;&nbsp;&nbsp;&nbsp;defer close(results)</br>
157+
&nbsp;&nbsp;&nbsp;&nbsp;var wg sync.WaitGroup</br>
158+
&nbsp;&nbsp;&nbsp;&nbsp;for url := range urls {</br>
159+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wg.Add(1)</br>
160+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;go func(url string) {</br>
161+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;defer wg.Done()</br>
162+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resp, _ := http.Get(url)</br>
163+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;results <- resp.StatusCode</br>
164+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}(url.(string))</br>
165+
&nbsp;&nbsp;&nbsp;&nbsp;}</br>
166+
&nbsp;&nbsp;&nbsp;&nbsp;wg.Wait()</br>
167+
}()
168+
</code></td>
169+
</tr>
170+
171+
<tr>
172+
<td class='docs'>
173+
Count websites.
174+
</td>
175+
176+
<td class='code'><code>
177+
FromChannel(results).CountWith(func(r interface{}) bool {<br/>
178+
&nbsp;&nbsp;&nbsp;&nbsp;return r.(int) == 200<br/>
179+
})
180+
</code></td>
181+
</tr>
182+
</table>
183+
</section>
184+
185+
<section class='about'>
186+
187+
<h2>About</h2>
188+
<div class='inner'>
189+
<p>
190+
If you have suggestions or improvements, feel free to contact or submit a pull request. All contributions are welcomed.
191+
</p>
192+
193+
<p>
194+
This library is brought you by <a href='http://kalan.rocks/'>Alexander (kalan) Kalankhodzhaev</a>
195+
and <a href='https://twitter.com/ahmetalpbalkan'>@ahmetalpbalkan</a>.
196+
</p>
197+
<p>
198+
<a href='http://kalan.rocks/'><img src='img/kalan.png' width='150' height='150' alt="Alexander (kalan) Kalankhodzhaev, 2016" /></a>
199+
<a href='http://ahmetalpbalkan.com'><img src='img/ahmet.png' width='150' height='150' alt="Ahmet Alp Balkan, 2013" /></a>
200+
</p>
201+
202+
</div>
203+
</section>
204+
205+
<footer>
206+
Lovingly made in Moscow and Seattle.
207+
</footer>
208+
209+
<script>
210+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
211+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
212+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
213+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
214+
ga('create', 'UA-45321252-3', 'ahmetalpbalkan.github.io');
215+
ga('send', 'pageview');
216+
</script>
217+
</body>
218+
219+
</html>

0 commit comments

Comments
 (0)