Compare commits

...

3 Commits

Author SHA1 Message Date
295a098eb4 v0.0.377 fix sq.ConverterBoolToBit
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m12s
2024-01-14 17:06:42 +01:00
b69a082bb1 v0.0.376
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m22s
2024-01-14 01:52:52 +01:00
a4a8c83d17 v0.0.375
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m25s
2024-01-14 01:50:48 +01:00
5 changed files with 11 additions and 9 deletions

2
go.mod
View File

@@ -23,7 +23,7 @@ require (
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.16.0 // indirect
github.com/go-playground/validator/v10 v10.17.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.5.0 // indirect

2
go.sum
View File

@@ -31,6 +31,8 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE=
github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-playground/validator/v10 v10.17.0 h1:SmVVlfAOtlZncTxRuinDPomC2DkXJ4E5T9gDA0AIH74=
github.com/go-playground/validator/v10 v10.17.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=

View File

@@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.374"
const GoextVersion = "0.0.377"
const GoextVersionTimestamp = "2024-01-14T01:37:38+0100"
const GoextVersionTimestamp = "2024-01-14T17:06:42+0100"

View File

@@ -96,7 +96,7 @@ func BuildInsertStatement(q Queryable, tableName string, obj any) (string, PP, e
if rsfield.Type.Kind() == reflect.Ptr && rvfield.IsNil() {
fields = append(fields, columnName)
values = append(fields, "NULL")
values = append(values, "NULL")
} else {
@@ -106,7 +106,7 @@ func BuildInsertStatement(q Queryable, tableName string, obj any) (string, PP, e
}
fields = append(fields, columnName)
values = append(fields, ":"+params.Add(val))
values = append(values, ":"+params.Add(val))
}
}
@@ -116,5 +116,5 @@ func BuildInsertStatement(q Queryable, tableName string, obj any) (string, PP, e
}
//goland:noinspection SqlNoDataSourceInspection
return fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)", tableName, strings.Join(fields, ", "), values), params, nil
return fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)", tableName, strings.Join(fields, ", "), strings.Join(values, ", ")), params, nil
}

View File

@@ -18,9 +18,9 @@ type DBTypeConverter interface {
DBToModel(v any) (any, error)
}
var ConverterBoolToBit = NewDBTypeConverter[bool, int](func(v bool) (int, error) {
return langext.Conditional(v, 1, 0), nil
}, func(v int) (bool, error) {
var ConverterBoolToBit = NewDBTypeConverter[bool, int64](func(v bool) (int64, error) {
return langext.Conditional(v, int64(1), int64(0)), nil
}, func(v int64) (bool, error) {
if v == 0 {
return false, nil
}