More updates :)

This commit is contained in:
Henrique Dias
2017-08-20 08:49:09 +01:00
parent 5b619337df
commit 76de8e5940
4 changed files with 20 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package bolt
import (
"github.com/asdine/storm"
"github.com/asdine/storm/q"
fm "github.com/hacdias/filemanager"
)
@@ -19,6 +20,16 @@ func (s ShareStore) Get(hash string) (*fm.ShareLink, error) {
return v, err
}
func (s ShareStore) GetPermanent(path string) (*fm.ShareLink, error) {
var v *fm.ShareLink
err := s.DB.Select(q.Eq("Path", path), q.Eq("Expires", false)).First(&v)
if err == storm.ErrNotFound {
return v, fm.ErrNotExist
}
return v, err
}
func (s ShareStore) GetByPath(hash string) ([]*fm.ShareLink, error) {
var v []*fm.ShareLink
err := s.DB.Find("Path", hash, &v)