Skip to content

Commit

Permalink
Fix readme examples by using the right interface
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLopez01 authored Oct 21, 2023
1 parent 612b799 commit 9df2015
Showing 1 changed file with 8 additions and 8 deletions.
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

0 comments on commit 9df2015

Please sign in to comment.