Skip to content

MySQL bool type generates int32 golang type #856

@bquenin

Description

@bquenin

The following MySQL source code:

CREATE TABLE example
(
    id         integer      NOT NULL AUTO_INCREMENT PRIMARY KEY,
    successful bool         NOT NULL
);

Generated the following model:

type Example struct {
	ID         int32     `json:"id"`
	Successful int32     `json:"successful"`
}

Actually, all the boolean types (bool, boolean and tinyint) are behaving in this way.

I'm currently using this workaround to force the correct type:

version: "1"

packages: [...]
overrides:
- column: "example.successful"
  go_type: "bool"

This has already been mentioned by @markschmid in #666 (comment)_

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions