package orm import ( "fmt" "net/http" "path/filepath" "github.com/jinzhu/gorm" ) type File struct { gorm.Model Path string JobID uint } func (f *File) String() string { return filepath.Base(f.Path) } func (f *File) Create(args map[string]string, r *http.Request) (interface{}, error) { return nil, fmt.Errorf("Not implemented") } func (f *File) Read(args map[string]string, r *http.Request) (interface{}, error) { var file File if err := DB().First(&file, args["id"]).Error; err != nil { return nil, err } return map[string]string{"filename": file.Path}, nil } func (f *File) ReadAll(args map[string]string, r *http.Request) (interface{}, error) { return nil, fmt.Errorf("Not implemented") } func (f *File) Update(args map[string]string, r *http.Request) (interface{}, error) { return nil, fmt.Errorf("Not implemented") } func (f *File) Delete(args map[string]string, r *http.Request) (interface{}, error) { return nil, fmt.Errorf("Not implemented") }