Skip to content

fix: enum generation if it does contain only equality-sign - #59

Open
dswistowski wants to merge 1 commit into
sqlc-dev:mainfrom
dswistowski:main
Open

fix: enum generation if it does contain only equality-sign#59
dswistowski wants to merge 1 commit into
sqlc-dev:mainfrom
dswistowski:main

Conversation

@dswistowski

@dswistowski dswistowski commented Nov 6, 2024

Copy link
Copy Markdown

in case of type like:

CREATE TYPE operator AS ENUM (
    '=',
    '>',
    '<',
    '>=',
    '<='
);

current plugin will generate wrong python code:

class Operator(str, enum.Enum):
    = "="
    = ">"
    = "<"
    = ">="
    = "<="

after this change plugin will generate valid enum:

class Operator(str, enum.Enum):
    EQ = "="
    GT = ">"
    LT = "<"
    GTEQ = ">="
    LTEQ = "<="

in case of tye 'CREATE TYPE operator AS ENUM (\'=\', \'>\' ...)' current name generation will generate python enum with empty enum values names
@dswistowski dswistowski changed the title fix enum generation if it does contain only equality-sign Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant