Esempio n. 1
0
func ExampleStream_Pull_1() {
	stream, _ := stream.New("Users", config)
	user := User{"damian"}

	stream.Clean()

	stream.Push(user)
	stream.Push(user)
	stream.Push(user)
	stream.Push(user)

	for {
		_, err := stream.Pull()
		if err != nil {
			fmt.Printf("ERR: %s\n", err)
			break
		}
	}

	// Output:
	// ERR: redigo: nil returned
}
Esempio n. 2
0
func ExampleStream_Pull() {
	stream, _ := stream.New("Users", config)
	user := User{"damian"}

	stream.Clean()
	stream.Push(user)
	stream.Push(user)

	for i := 1; i <= 2; i++ {
		if _, err := stream.Pull(); err != nil {
			fmt.Printf("%s\n")
		}

		fmt.Printf("ok\n")
	}

	fmt.Printf("Size: %d", stream.Size())

	// Output:
	//
	// ok
	// ok
	// Size: 0
}