// Fetches a single key and tries to unmarshal the result to json and returns
// it. If the unmarshalling fails it's safe to assume the result it's just a
// string and returns it.
547495
func (c *Cepgo) Key(key string) (interface{}, error) {
	var result interface{}

	fetched, err := c.FetchRaw(key)
	if err != nil {
		return nil, err
	}

	err = json.Unmarshal(fetched, &result)
	if err != nil {
		return string(fetched), nil
	}
	return result, nil
}
945570
func (kv *KV) Get(key []byte) (value []byte) {
	value, _ = kv.db.Read(gkv.Btos(key))
	return
}
1257476
func (ds *DataScope) Get(key string) (value interface{}, err error) {
	var ok bool
	if value, ok = ds.Data[key]; !ok {
		return nil, fmt.Errorf("Unknow value for key %v", key)
	}
	return value, nil
}
306617
func (l *Language) Get(key string) interface{} {
	local := l.GetLocal(key)
	if local != nil {
		return local
	}
	return l.Cfg.Get(key)
}
204313
func (s Store) Get(key string) (KVPair, error) {
	s.RLock()
	kv, ok := s.m[key]
	s.RUnlock()
	if !ok {
		return kv, &KeyError{key, ErrNotExist}
	}
	return kv, nil
}
1121944
func (rkv *KeyValue) Get(key string) (string, error) {
	conn := rkv.pool.Get(rkv.dbindex)
	result, err := redis.String(conn.Do("GET", rkv.id+":"+key))
	if err != nil {
		return "", err
	}
	return result, nil
}
376723
func (c *Client) Get(key string) (string, error) {
	var s string
	err := c.command(&s,
		[]byte("GET"),
		[]byte(key),
	)
	return s, err
}
260824
func (s *Store) Get(key, result interface{}) error {
	return s.Bolt().View(func(tx *bolt.Tx) error {
		return s.TxGet(tx, key, result)
	})
}
727919
func (s *MerkleStoreImpl) fetch(m libkb.MetaContext, hash keybase1.MerkleStoreKitHash) (keybase1.MerkleStoreKit, error) {
	m.Debug("MerkleStore: fetching from server: %s", hash)
	var res merkleStoreServerRes
	err := m.G().API.GetDecode(m, libkb.APIArg{
		Endpoint:    s.endpoint,
		SessionType: libkb.APISessionTypeNONE,
		Args: libkb.HTTPArgs{
			"hash": libkb.S{Val: string(hash)},
		},
	}, &res)
	if err != nil {
		return "", NewMerkleStoreError(err.Error())
	}
	if res.KitJSON == "" {
		return "", NewMerkleStoreError("server returned empty kit for %s", s.tag)
	}
	if s.hash(res.KitJSON) != hash {
		m.Debug("%s hash mismatch: got:%s expected:%s", s.tag, s.hash(res.KitJSON), hash)
		return "", NewMerkleStoreError("server returned wrong kit for %s", s.tag)
	}
	return res.KitJSON, nil
}
1223953
func (c *Cache) Get(key uint32) (interface{}, bool) {
	shard := key & (shardSize - 1)
	return c.shards[shard].Get(key)
}
787717
func (rs *ResultsStruct) UnmarshalJSON(buff []byte) error {
	emptyRow := []map[string]string{}
	rs.Queries = make(map[string][]map[string]string)
	rs.Statuses = make(map[string]OsqueryInt)
	// Queries can be []map[string]string OR an empty string
	// so we need to deal with an interface to accomodate two types
	intermediate := struct {
		Queries  map[string]interface{} `json:"queries"`
		Statuses map[string]OsqueryInt  `json:"statuses"`
	}{}
	if err := json.Unmarshal(buff, &intermediate); err != nil {
		return err
	}
	for queryName, status := range intermediate.Statuses {
		rs.Statuses[queryName] = status
		// Sometimes we have a status but don't have a corresponding
		// result.
		queryResult, ok := intermediate.Queries[queryName]
		if !ok {
			rs.Queries[queryName] = emptyRow
			continue
		}
		// Deal with structurally inconsistent results, sometimes a query
		// without any results is just a name with an empty string.
		switch val := queryResult.(type) {
		case string:
			rs.Queries[queryName] = emptyRow
		case []interface{}:
			results, err := convertRows(val)
			if err != nil {
				return err
			}
			rs.Queries[queryName] = results
		default:
			return fmt.Errorf("results for %q unknown type", queryName)
		}
	}
	return nil
}
1231992
func (v *KeyValue_GetValue_Args) GetKey() (o string) {
	if v != nil && v.Key != nil {
		return *v.Key
	}

	return
}
76665
func (s *RedisKVStore) Get(key string) (string, error) {
	if !strings.HasPrefix(key, s.prefix) {
		key = s.prefix + key
	}
	result, err := s.client.Get(key).Result()
	if err == redis.Nil || result == "" {
		return "", errors.NewErrNotFound(key)
	}
	if err != nil {
		return "", err
	}
	return result, nil
}
803406
func (ks *Keys) UnmarshalJSON(data []byte) error {
	parsed := make(map[string]TUFKey)
	err := json.Unmarshal(data, &parsed)
	if err != nil {
		return err
	}
	final := make(map[string]PublicKey)
	for k, tk := range parsed {
		final[k] = typedPublicKey(tk)
	}
	*ks = final
	return nil
}
1292560
func (c *Client) Get(key string) (val string, flags uint32, cas uint64, err error) {
	// Variants: [R] Get [Q, K, KQ]
	// Request : MUST key; MUST NOT value, extras
	// Response: MAY key, value, extras ([0..3] flags)
	return c.getCAS(key, 0)
}
959307
func (r *Redis) Get(key string) (string, error) {
	return r.Client.Get(key).Result()
}
862576
func (v Map) Key(k string) Value {
	var result, ok = v[k]
	if !ok {
		return Undefined{}
	}
	return result
}