Add more things for file handling
This commit is contained in:
parent
c813c4784a
commit
1fcf47bffc
14 changed files with 284 additions and 59 deletions
17
media/fileInfo.go
Normal file
17
media/fileInfo.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package media
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
|
||||
"git.mstar.dev/mstar/linstrom/storage-new/dbgen"
|
||||
)
|
||||
|
||||
func (s *Server) FileExists(userid, filename string) (bool, error) {
|
||||
mm := dbgen.MediaMetadata
|
||||
c, err := mm.Where(mm.OwnedById.Eq(sql.NullString{Valid: true, String: userid}), mm.Name.Eq(filename)).
|
||||
Count()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return c > 0, nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue