testdata.go 489 B

1234567891011121314151617181920212223
  1. package files
  2. import (
  3. "log"
  4. "git.mmnx.de/mmnx/cdn/module"
  5. )
  6. func createTestData() {
  7. storage := &Storage{AbsolutePath: "/go/src/app/dev/files/"}
  8. module.HandleError(module.ErrDatabase, db.Create(storage).Error)
  9. // storage := &Storage{}
  10. // db.First(&storage, "id = ?", storage.ID)
  11. log.Printf("%#v", storage)
  12. module.HandleError(module.ErrDatabase, db.Create(&File{
  13. RelativePath: "test.txt",
  14. FileType: filetype_text,
  15. StorageID: storage.ID,
  16. Storage: *storage,
  17. }).Error)
  18. }