ticket.go 670 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package ticket
  2. import (
  3. "github.com/ClickHouse/clickhouse-go/v2/lib/driver"
  4. "google.golang.org/protobuf/types/known/timestamppb"
  5. "time"
  6. )
  7. func (x *Ticket) Scan(row driver.Rows) error {
  8. var (
  9. from map[string]string
  10. createdAt time.Time
  11. updatedAt time.Time
  12. err error
  13. )
  14. if err = row.Scan(
  15. &x.TicketId,
  16. &x.ThreadId,
  17. &x.To,
  18. &from,
  19. &x.Flags,
  20. &x.Meta,
  21. &x.Tags,
  22. &createdAt,
  23. &updatedAt,
  24. &x.MessageIds,
  25. &x.Subjects,
  26. ); err != nil {
  27. return err
  28. }
  29. x.From = &EmailAddress{
  30. Address: from["address"],
  31. Name: from["name"],
  32. }
  33. x.CreatedAt = timestamppb.New(createdAt)
  34. x.UpdatedAt = timestamppb.New(updatedAt)
  35. return nil
  36. }