Skip to content

Commit

Permalink
Example #5: array conversion to stream
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Jul 10, 2020
1 parent ad0680d commit b90e4de
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions lesson7/lazy_streams/05_new_stream_from_array.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package main

import (
"fmt"
"github.com/wesovilabs/koazee/stream"
)

type User struct {
id uint32
name string
surname string
}

func main() {
var users = [3]User{
User{
id: 1,
name: "Pepek",
surname: "Vyskoč"},
User{
id: 2,
name: "Pepek",
surname: "Vyskoč"},
User{
id: 3,
name: "Josef",
surname: "Vyskočil"},
}
fmt.Println(users)

fmt.Printf("input: %v\n", users)

stream := stream.New(users)
fmt.Printf("stream: %v\n", stream.Out().Val())
}

0 comments on commit b90e4de

Please sign in to comment.