// FetchByHash will retrieve all keys for the given account
FetchByHash will retrieve all keys for the given account
// FetchByHash will retrieve all keys for the given account
func (r mockRepo) FetchByHash(h string, v interface{}) (interface{}, error) {
	rv := reflect.ValueOf(v)
	if rv.Kind() != reflect.Ptr {
		return nil, errNeedsPointerValue
	}
	items, ok := r.addr[h]
	if !ok {
		return nil, errKeyNotFound
	}
	var keys []interface{}
	ve := reflect.TypeOf(v).Elem()
	for item := range items {
		newItem := reflect.New(ve).Interface()
		err := r.Fetch(item, &newItem)
		if err != nil {
			continue
		}
		keys = append(keys, newItem)
	}
	return keys, nil
}
func ( r mockRepo ) FetchByHash ( h string , v interface { } ) ( interface { } , error ) { rv := reflect . ValueOf ( v ) if rv . Kind ( ) != reflect . Ptr { return nil , errNeedsPointerValue } items , ok := r . addr [ h ] if ! ok { return nil , errKeyNotFound } var keys [ ] interface { } ve := reflect . TypeOf ( v ) . Elem ( ) for item := range items { newItem := reflect . New ( ve ) . Interface ( ) err := r . Fetch ( item , & newItem ) if err != nil { continue } keys = append ( keys , newItem ) } return keys , nil }
FetchByHash will retrieve all keys for the given account
FetchByHash will retrieve all keys for the given account
// Create a new item based on the structure of v