Skip to content

Float comes in as float32 or []uint8 #1720

@iamdlfl

Description

@iamdlfl

Version

1.13.0

What happened?

One query returns a column as []uint8 but the remaining 5 or 6 return it as a float. The generated field on the model struct is of type interface{}. It looks like the one query isn't converting from the []uint8 to float32 and the other ones are, why might that be? Is there an expected/predictable way this is dealt with?

Relevant log output

2022/07/01 15:13:08 handlers_print_jobs.go:180: float32
2022/07/01 15:13:09 handlers.go:29: 3
2022/07/01 15:13:09 handlers.go:37: [51]

2022/07/01 15:13:09 handlers_print_jobs.go:396: []uint8
2022/07/01 15:13:10 handlers.go:29: [51]
2022/07/01 15:13:10 handlers.go:37: [34 77 119 61 61 34]

Database schema

CREATE TABLE `print_job` (
  `print_job_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` varchar(8) DEFAULT NULL,
  `file_name` varchar(255) DEFAULT NULL,
  `print_queue_id` int(11) DEFAULT NULL,
  `print_datetime` datetime DEFAULT NULL,
  `pages` float DEFAULT NULL,
  `processed_datetime` datetime DEFAULT NULL,
  `charge_records_created` tinyint(1) DEFAULT NULL,
  `refund_requested` tinyint(1) DEFAULT NULL,
  `refunded` tinyint(1) DEFAULT NULL,
  `refund_ticket_number` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`print_job_id`),
  KEY `print_queue_id` (`print_queue_id`),
  CONSTRAINT `print_job_ibfk_1` FOREIGN KEY (`print_queue_id`) REFERENCES `print_queue` (`print_queue_id`)
);

SQL queries

No response

Configuration

No response

Playground URL

No response

What operating system are you using?

Linux

What database engines are you using?

MySQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions