Пример #1
0
// ComicInDatabase returns whether the given comic is already saved in the
// database
func ComicInDatabase(c Comic) bool {
	C := pool.Get()
	defer C.Close()

	exists, err := redis.Bool(C.Do("SISMEMBER", "strips", c.Page))
	if err != nil {
		return false
	}
	return exists
}
Пример #2
0
func ExampleBool() {
	c, err := dial()
	if err != nil {
		panic(err)
	}
	defer c.Close()

	c.Do("SET", "foo", 1)
	exists, _ := redis.Bool(c.Do("EXISTS", "foo"))
	fmt.Printf("%#v\n", exists)
	// Output:
	// true
}