Skip to content

Commit 29a8855

Browse files
authored
mysql: Fix blob tests (#1949)
* mysql: Return []byte for blob types * mysql: Generate correct types for non-null blobs Keep nullable blobs as NullString
1 parent 6639c13 commit 29a8855

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

internal/codegen/golang/mysql_type.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ func mysqlType(req *plugin.CodeGenRequest, col *plugin.Column) string {
4646
return "sql.NullInt64"
4747

4848
case "blob", "binary", "varbinary", "tinyblob", "mediumblob", "longblob":
49-
return "[]byte"
49+
if notNull {
50+
return "[]byte"
51+
}
52+
return "sql.NullString"
5053

5154
case "double", "double precision", "real":
5255
if notNull {

internal/endtoend/testdata/datatype/mysql/go/models.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)