models.go 666 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Code generated by sqlc. DO NOT EDIT.
  2. package booktest
  3. import (
  4. "fmt"
  5. "time"
  6. )
  7. type BookType string
  8. const (
  9. BookTypeFICTION BookType = "FICTION"
  10. BookTypeNONFICTION BookType = "NONFICTION"
  11. )
  12. func (e *BookType) Scan(src interface{}) error {
  13. switch s := src.(type) {
  14. case []byte:
  15. *e = BookType(s)
  16. case string:
  17. *e = BookType(s)
  18. default:
  19. return fmt.Errorf("unsupported scan type for BookType: %T", src)
  20. }
  21. return nil
  22. }
  23. type Author struct {
  24. AuthorID int32
  25. Name string
  26. }
  27. type Book struct {
  28. BookID int32
  29. AuthorID int32
  30. Isbn string
  31. BookType BookType
  32. Title string
  33. Year int32
  34. Available time.Time
  35. Tags []string
  36. }