[feature]Support for tinyInt1isBit
Flag to Handle TINYINT(1)
as Boolean
#299
Labels
enhancement
New feature or request
Milestone
Feature Request
Summary
Enable seamless mapping of
TINYINT(1)
toBoolean
in r2dbc-mysql by implementing thetinyInt1isBit
flag withtrue
as the default behavior. This enhancement aligns with the common MySQL convention of usingTINYINT(1)
for boolean values, simplifying development workflows and improving compatibility with existing schemas.Problem Statement
Currently,
r2dbc-mysql
does not treatTINYINT(1)
asBoolean
by default. This creates challenges for developers who rely on the widespread convention ofTINYINT(1)
being used for boolean fields in MySQL schemas. The following issues arise:BIT(1)
), which is often impractical for legacy systems.Given that
TINYINT(1)
is commonly treated as a boolean in many MySQL connectors (e.g., mysql-connector-j), r2dbc-mysql should adopt the same behavior by default to minimize friction and provide an intuitive developer experience.Proposed Solution
tinyInt1isBit
flag inr2dbc-mysql
.tinyInt1isBit
totrue
, ensuring that:TINYINT(1)
columns are automatically mapped toBoolean
fields in Java entities.TINYINT(1)
to be treated asInteger
.Example Configuration for Overriding Default Behavior:
Benefits
Seamless Integration:
Treating
TINYINT(1)
asBoolean
by default aligns with developer expectations and reduces the need for schema changes or custom logic.Compatibility with MySQL Ecosystem:
This change aligns
r2dbc-mysql
with other popular MySQL connectors (e.g., Hibernate, JDBC), which treatTINYINT(1)
as boolean by default.Flexibility:
Developers who require
TINYINT(1)
to be treated asInteger
can easily disable the feature by settingtinyInt1isBit=false
.References
The text was updated successfully, but these errors were encountered: