Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix readme examples by using the right interface #9

Merged
merged 3 commits into from
Oct 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ func main() {
// buffer can hold up to 5 items
buffer.WithSize(5),
// call this function when the buffer needs flushing
buffer.WithFlusher(func(items []interface{}) {
buffer.WithFlusher(buffer.FlusherFunc(func(items []interface{}) {
for _, item := range items {
println(item.(string))
}
}),
})),
)
// ensure the buffer
defer buff.Close()
Expand All @@ -54,7 +54,7 @@ func main() {
buff.Push("item 5")

// block the current goroutine
time.Sleep(3*time.Second)
time.Sleep(3 * time.Second)

println("done")
}
Expand All @@ -79,11 +79,11 @@ func main() {
// how many items were pushed
buffer.WithFlushInterval(time.Second),
// call this function when the buffer needs flushing
buffer.WithFlusher(func(items []interface{}) {
buffer.WithFlusher(buffer.FlusherFunc(func(items []interface{}) {
for _, item := range items {
println(item.(string))
}
}),
})),
)
defer buff.Close()

Expand All @@ -92,7 +92,7 @@ func main() {
buff.Push("item 3")

// block the current goroutine
time.Sleep(3*time.Second)
time.Sleep(3 * time.Second)

println("done")
}
Expand All @@ -114,11 +114,11 @@ func main() {
// buffer can hold up to 5 items
buffer.WithSize(5),
// call this function when the buffer needs flushing
buffer.WithFlusher(func(items []interface{}) {
buffer.WithFlusher(buffer.FlusherFunc(func(items []interface{}) {
for _, item := range items {
println(item.(string))
}
}),
})),
)
defer buff.Close()

Expand Down
Loading