func (db *Bolt) BumpHitCount(id string) error {
	storedLink := models.Link{}

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

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

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

		storedLink.Hits++

		encodedLink, err := json.Marshal(storedLink)
		if err != nil {
			return err
		}

		err = bucket.Put([]byte(id), encodedLink)
		if err != nil {
			return err
		}

		return nil
	})
	if err != nil {
		return err
	}

	return nil
}
// BumpHitCount updates the hit number on a certain link
BumpHitCount updates the hit number on a certain link
// BumpHitCount updates the hit number on a certain link
func (db *Bolt) BumpHitCount(id string) error {
	storedLink := models.Link{}
	err := db.store.Update(func(tx *bolt.Tx) error {
		bucket := tx.Bucket([]byte(storage.LinksBucket))
		linkRaw := bucket.Get([]byte(id))
		if linkRaw == nil {
			return utilErrors.ErrNotFound
		}
		err := json.Unmarshal(linkRaw, &storedLink)
		if err != nil {
			return err
		}
		storedLink.Hits++
		encodedLink, err := json.Marshal(storedLink)
		if err != nil {
			return err
		}
		err = bucket.Put([]byte(id), encodedLink)
		if err != nil {
			return err
		}
		return nil
	})
	if err != nil {
		return err
	}
	return nil
}
func ( db * Bolt ) BumpHitCount ( id string ) error { storedLink := models . Link { } err := db . store . Update ( func ( tx * bolt . Tx ) error { bucket := tx . Bucket ( [ ] byte ( storage . LinksBucket ) ) linkRaw := bucket . Get ( [ ] byte ( id ) ) if linkRaw == nil { return utilErrors . ErrNotFound } err := json . Unmarshal ( linkRaw , & storedLink ) if err != nil { return err } storedLink . Hits ++ encodedLink , err := json . Marshal ( storedLink ) if err != nil { return err } err = bucket . Put ( [ ] byte ( id ) , encodedLink ) if err != nil { return err } return nil } ) if err != nil { return err } return nil }
BumpHitCount updates the hit number on a certain link
BumpHitCount updates the hit number on a certain link