Skip to content

Commit 8da24e8

Browse files
elianddbclaude
andcommitted
Fix enum validateStrictMode method typo
During the charset validation fix, a typo was introduced in the enum.go file where 'validateScrictMode' was missing the 't' in 'Strict'. This commit fixes the typo to 'validateStrictMode' which is the correct spelling. This ensures that enum strict mode validation works properly when converting integer values to enum types. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 1d14da1 commit 8da24e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sql/types/enum.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func (t EnumType) Convert(ctx context.Context, v interface{}) (interface{}, sql.
166166
switch value := v.(type) {
167167
case int:
168168
// MySQL rejects 0 values in strict mode regardless of enum definition
169-
if value == 0 && t.validateScrictMode(ctx) {
169+
if value == 0 && t.validateStrictMode(ctx) {
170170
return nil, sql.OutOfRange, ErrConvertingToEnum.New(value)
171171
}
172172
if _, ok := t.At(value); ok {
@@ -215,8 +215,8 @@ func (t EnumType) Convert(ctx context.Context, v interface{}) (interface{}, sql.
215215
return nil, sql.InRange, ErrConvertingToEnum.New(v)
216216
}
217217

218-
// validateScrictMode checks if STRICT_TRANS_TABLES or STRICT_ALL_TABLES is enabled
219-
func (t EnumType) validateScrictMode(ctx context.Context) bool {
218+
// validateStrictMode checks if STRICT_TRANS_TABLES or STRICT_ALL_TABLES is enabled
219+
func (t EnumType) validateStrictMode(ctx context.Context) bool {
220220
if sqlCtx, ok := ctx.(*sql.Context); ok {
221221
sqlMode := sql.LoadSqlMode(sqlCtx)
222222
return sqlMode.ModeEnabled("STRICT_TRANS_TABLES") || sqlMode.ModeEnabled("STRICT_ALL_TABLES")

0 commit comments

Comments
 (0)