FindByUserID wraps a StorageBackend.FindByUserID.
(id uint)
| 50 | |
| 51 | // FindByUserID wraps a StorageBackend.FindByUserID. |
| 52 | func (s *Storage) FindByUserID(id uint) ([]*Link, error) { |
| 53 | links, err := s.back.FindByUserID(id) |
| 54 | |
| 55 | if err != nil { |
| 56 | return nil, err |
| 57 | } |
| 58 | |
| 59 | for i, link := range links { |
| 60 | if link.Expire != 0 && link.Expire <= time.Now().Unix() { |
| 61 | if err := s.Delete(link.Hash); err != nil { |
| 62 | return nil, err |
| 63 | } |
| 64 | links = append(links[:i], links[i+1:]...) |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | return links, nil |
| 69 | } |
| 70 | |
| 71 | // GetByHash wraps a StorageBackend.GetByHash. |
| 72 | func (s *Storage) GetByHash(hash string) (*Link, error) { |
nothing calls this directly
no test coverage detected