scan.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package core
  2. import (
  3. "database/sql/driver"
  4. "fmt"
  5. "time"
  6. )
  7. type NullTime time.Time
  8. var (
  9. _ driver.Valuer = NullTime{}
  10. )
  11. func (ns *NullTime) Scan(value interface{}) error {
  12. if value == nil {
  13. return nil
  14. }
  15. return convertTime(ns, value)
  16. }
  17. // Value implements the driver Valuer interface.
  18. func (ns NullTime) Value() (driver.Value, error) {
  19. if (time.Time)(ns).IsZero() {
  20. return nil, nil
  21. }
  22. return (time.Time)(ns).Format("2006-01-02 15:04:05"), nil
  23. }
  24. func convertTime(dest *NullTime, src interface{}) error {
  25. // Common cases, without reflect.
  26. switch s := src.(type) {
  27. case string:
  28. t, err := time.Parse("2006-01-02 15:04:05", s)
  29. if err != nil {
  30. return err
  31. }
  32. *dest = NullTime(t)
  33. return nil
  34. case []uint8:
  35. t, err := time.Parse("2006-01-02 15:04:05", string(s))
  36. if err != nil {
  37. return err
  38. }
  39. *dest = NullTime(t)
  40. return nil
  41. case time.Time:
  42. *dest = NullTime(s)
  43. return nil
  44. case nil:
  45. default:
  46. return fmt.Errorf("unsupported driver -> Scan pair: %T -> %T", src, dest)
  47. }
  48. return nil
  49. }
PANIC: session(release): write data/sessions/9/c/9c872dcd26ff96a3: no space left on device

PANIC

session(release): write data/sessions/9/c/9c872dcd26ff96a3: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)