func (m *ModuleModel) GetConfig(moduleID string, conn redis.Conn) (*string, error) {
	m.syncing.Wait()

	exists, err := redis.Bool(conn.Do("HEXISTS", "module:"+moduleID, "config"))

	if exists {
		item, err := conn.Do("HGET", "module:"+moduleID, "config")
		config, err := redis.String(item, err)
		return &config, err
	}

	return nil, err
}
Esempio n. 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
}
Esempio n. 3
0
func (m *baseModel) Exists(id string, conn redis.Conn) (bool, error) {
	return redis.Bool(conn.Do("EXISTS", m.idType+":"+id))
}