sync: Report custom errors
This commit is contained in:
parent
08ea1bac0d
commit
c78545c18b
17 changed files with 510 additions and 137 deletions
|
|
@ -44,6 +44,20 @@ type EFile struct {
|
|||
Size int64 `json:"size"`
|
||||
}
|
||||
|
||||
// NewDummyFile creates an EFile, without any link to an actual Exercice File.
|
||||
// It is used to check the file validity
|
||||
func (e *Exercice) NewDummyFile(origin string, dest string, checksum []byte, size int64) *EFile {
|
||||
return &EFile{
|
||||
Id: 0,
|
||||
origin: origin,
|
||||
Path: dest,
|
||||
IdExercice: e.Id,
|
||||
Name: path.Base(origin),
|
||||
Checksum: checksum,
|
||||
Size: size,
|
||||
}
|
||||
}
|
||||
|
||||
// GetFiles returns a list of all files living in the database.
|
||||
func GetFiles() ([]*EFile, error) {
|
||||
if rows, err := DBQuery("SELECT id_file, id_exercice, origin, path, name, cksum, size FROM exercice_files"); err != nil {
|
||||
|
|
|
|||
Reference in a new issue