-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path03_user_structs_to_stream.go
More file actions
52 lines (46 loc) · 1.13 KB
/
03_user_structs_to_stream.go
File metadata and controls
52 lines (46 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Seriál "Programovací jazyk Go"
// https://www.root.cz/serialy/programovaci-jazyk-go/
//
// Dvacátá osmá část
// Datové struktury s líným vyhodnocováním v programovacím jazyce Go
// https://www.root.cz/clanky/datove-struktury-s-linym-vyhodnocovanim-v-programovacim-jazyce-go/
//
// Repositář:
// https://github.com/tisnik/go-root/
//
// Seznam demonstračních příkladů z dvacáté osmé části:
// https://github.com/tisnik/go-root/blob/master/article_28/README.md
//
// Demonstrační příklad číslo 3:
// Struktury konvertované do streamů.
package main
import (
"fmt"
"github.com/wesovilabs/koazee"
)
// User data type represents an user in (some) information system
type User struct {
id uint32
name string
surname string
}
func main() {
var users = []User{
{
id: 1,
name: "Pepek",
surname: "Vyskoč"},
{
id: 2,
name: "Pepek",
surname: "Vyskoč"},
{
id: 3,
name: "Josef",
surname: "Vyskočil"},
}
fmt.Println(users)
fmt.Printf("input: %v\n", users)
stream := koazee.StreamOf(users)
fmt.Printf("stream: %v\n", stream.Out().Val())
}