func (db *Redis) GetAllLinks() (map[string]models.Link, error) {

	results := map[string]models.Link{}

	var cursor uint64

	for {
		keys, cursor, err := db.store.Scan(cursor, "*", 10).Result()
		if err != nil {
			return nil, err
		}

		for _, key := range keys {
			var storedLink models.Link

			linkRaw, err := db.store.Get(key).Bytes()
			if err != nil {
				return nil, err
			}

			err = json.Unmarshal(linkRaw, &storedLink)
			if err != nil {
				return nil, err
			}

			results[key] = storedLink
		}

		if cursor == 0 {
			break
		}
	}

	return results, nil
}
// GetAllLinks returns an unpaginated list of current links
GetAllLinks returns an unpaginated list of current links
// GetAllLinks returns an unpaginated list of current links
func (db *Redis) GetAllLinks() (map[string]models.Link, error) {
	results := map[string]models.Link{}
	var cursor uint64
	for {
		keys, cursor, err := db.store.Scan(cursor, "*", 10).Result()
		if err != nil {
			return nil, err
		}
		for _, key := range keys {
			var storedLink models.Link
			linkRaw, err := db.store.Get(key).Bytes()
			if err != nil {
				return nil, err
			}
			err = json.Unmarshal(linkRaw, &storedLink)
			if err != nil {
				return nil, err
			}
			results[key] = storedLink
		}
		if cursor == 0 {
			break
		}
	}
	return results, nil
}
func ( db * Redis ) GetAllLinks ( ) ( map [ string ] models . Link , error ) { results := map [ string ] models . Link { } var cursor uint64 for { keys , cursor , err := db . store . Scan ( cursor , " " , 10 ) . Result ( ) if err != nil { return nil , err } for _ , key := range keys { var storedLink models . Link linkRaw , err := db . store . Get ( key ) . Bytes ( ) if err != nil { return nil , err } err = json . Unmarshal ( linkRaw , & storedLink ) if err != nil { return nil , err } results [ key ] = storedLink } if cursor == 0 { break } } return results , nil }
GetAllLinks returns an unpaginated list of current links
GetAllLinks returns an unpaginated list of current links