fix(writer): update nullable type handling to use baselib

* change default nullable type from resolvespec to baselib
* update type mappings in tests to reflect new nullable types
* adjust comments for clarity on nullable type options
This commit is contained in:
2026-06-25 23:25:36 +02:00
parent e29c7e31c1
commit ab735d1f3a
8 changed files with 128 additions and 40 deletions
+7 -1
View File
@@ -24,12 +24,17 @@ type Writer interface {
// in code-generation writers (Bun, GORM).
const (
// NullableTypeResolveSpec uses github.com/bitechdev/ResolveSpec/pkg/spectypes
// (SqlString, SqlInt32, SqlVector, SqlStringArray, …). This is the default.
// (SqlString, SqlInt32, SqlVector, SqlStringArray, …).
NullableTypeResolveSpec = "resolvespec"
// NullableTypeStdlib uses the standard library database/sql nullable types
// (sql.NullString, sql.NullInt32, …) and plain Go slices for arrays.
NullableTypeStdlib = "stdlib"
// NullableTypeBaselib uses plain Go pointer types for nullable columns
// (*string, *int32, *time.Time, …) and plain Go slices for arrays.
// No external imports are required beyond the standard library. This is the default.
NullableTypeBaselib = "baselib"
)
// WriterOptions contains common options for writers
@@ -49,6 +54,7 @@ type WriterOptions struct {
// code-generation writers (bun, gorm). Accepted values:
// "resolvespec" (default) — github.com/bitechdev/ResolveSpec/pkg/spectypes
// "stdlib" — database/sql (sql.NullString, sql.NullInt32, …)
// "baselib" — plain Go pointer types (*string, *int32, …)
NullableTypes string
// Prisma7 enables Prisma 7-specific output for Prisma writers.