Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@devstein
Copy link
Collaborator

@devstein devstein commented Dec 16, 2024

Description

Add emit_str_enum config option to change generate enums to use enum.StrEnum, which implements __str__ and string comparison checks for users.

New Behavior

with emit_str_enum

class Status(enum.StrEnum):
    """Venues can be either open or closed"""
    OPEN = "op!en"
    CLOSED = "clo@sed"

without emit_str_enum (current behavior)

class Status(str, enum.Enum):
    """Venues can be either open or closed"""
    OPEN = "op!en"
    CLOSED = "clo@sed"

Todos

  • Add documentation
  • Add tests

@devstein devstein changed the title [WIP] feat: add emit_str_enum config option feat: add emit_str_enum config option Jan 4, 2025
@devstein devstein merged commit d89f61d into sqlc-dev:main Jan 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.