package ticket import ( "github.com/ClickHouse/clickhouse-go/v2/lib/driver" "google.golang.org/protobuf/types/known/timestamppb" "time" ) func (x *Message) Scan(row driver.Rows) error { var ( typ int32 date time.Time aIds []string aFilenames []string aTypes []string aEncodings []string aBuckets []string aKeys []string err error ) if err = row.Scan( &x.MessageId, &x.TicketId, &x.Role, &typ, &x.Content, &date, &x.Raw, &x.Flags, &x.Headers, &x.Meta, &aIds, &aFilenames, &aTypes, &aEncodings, &aBuckets, &aKeys, ); err != nil { return err } x.Type = Message_Type(typ) x.Date = timestamppb.New(date) x.Attachments = make([]*Attachment, len(aIds)) for i := range aIds { x.Attachments[i] = &Attachment{ Id: aIds[i], Filename: aFilenames[i], ContentType: aTypes[i], ContentEncoding: aEncodings[i], Bucket: aBuckets[i], Key: aKeys[i], } } return nil }