func (db *Bolt) GetLink(id string) (models.Link, error) {

	storedLink := models.Link{}

	err := db.store.View(func(tx *bolt.Tx) error {
		linksBucket := tx.Bucket([]byte(storage.LinksBucket))

		linkRaw := linksBucket.Get([]byte(id))
		if linkRaw == nil {
			return utilErrors.ErrNotFound
		}

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

		return nil
	})
	if err != nil {
		return models.Link{}, err
	}

	return storedLink, nil
}
// GetLink returns a link by short name
GetLink returns a link by short name
// GetLink returns a link by short name
func (db *Bolt) GetLink(id string) (models.Link, error) {
	storedLink := models.Link{}
	err := db.store.View(func(tx *bolt.Tx) error {
		linksBucket := tx.Bucket([]byte(storage.LinksBucket))
		linkRaw := linksBucket.Get([]byte(id))
		if linkRaw == nil {
			return utilErrors.ErrNotFound
		}
		err := json.Unmarshal(linkRaw, &storedLink)
		if err != nil {
			return err
		}
		return nil
	})
	if err != nil {
		return models.Link{}, err
	}
	return storedLink, nil
}
func ( db * Bolt ) GetLink ( id string ) ( models . Link , error ) { storedLink := models . Link { } err := db . store . View ( func ( tx * bolt . Tx ) error { linksBucket := tx . Bucket ( [ ] byte ( storage . LinksBucket ) ) linkRaw := linksBucket . Get ( [ ] byte ( id ) ) if linkRaw == nil { return utilErrors . ErrNotFound } err := json . Unmarshal ( linkRaw , & storedLink ) if err != nil { return err } return nil } ) if err != nil { return models . Link { } , err } return storedLink , nil }
GetLink returns a link by short name
GetLink returns a link by short name