From 7c861c708e5bb50836cda3b240e7d0da6d64072b Mon Sep 17 00:00:00 2001 From: Hein Date: Thu, 18 Dec 2025 11:49:35 +0200 Subject: [PATCH] [breaking] Another breaking change datatypes -> spectypes --- pkg/reflection/model_utils_sqltypes_test.go | 20 +++++++++---------- pkg/{datatypes => spectypes}/sql_types.go | 4 ++-- .../sql_types_test.go | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) rename pkg/{datatypes => spectypes}/sql_types.go (99%) rename pkg/{datatypes => spectypes}/sql_types_test.go (99%) diff --git a/pkg/reflection/model_utils_sqltypes_test.go b/pkg/reflection/model_utils_sqltypes_test.go index 4543aa4..0cec5f4 100644 --- a/pkg/reflection/model_utils_sqltypes_test.go +++ b/pkg/reflection/model_utils_sqltypes_test.go @@ -4,15 +4,15 @@ import ( "testing" "time" - "github.com/bitechdev/ResolveSpec/pkg/datatypes" "github.com/bitechdev/ResolveSpec/pkg/reflection" + "github.com/bitechdev/ResolveSpec/pkg/spectypes" ) func TestMapToStruct_SqlJSONB_PreservesDriverValuer(t *testing.T) { // Test that SqlJSONB type preserves driver.Valuer interface type TestModel struct { ID int64 `bun:"id,pk" json:"id"` - Meta datatypes.SqlJSONB `bun:"meta" json:"meta"` + Meta spectypes.SqlJSONB `bun:"meta" json:"meta"` } dataMap := map[string]interface{}{ @@ -65,7 +65,7 @@ func TestMapToStruct_SqlJSONB_FromBytes(t *testing.T) { // Test that SqlJSONB can be set from []byte directly type TestModel struct { ID int64 `bun:"id,pk" json:"id"` - Meta datatypes.SqlJSONB `bun:"meta" json:"meta"` + Meta spectypes.SqlJSONB `bun:"meta" json:"meta"` } jsonBytes := []byte(`{"direct":"bytes"}`) @@ -103,11 +103,11 @@ func TestMapToStruct_AllSqlTypes(t *testing.T) { type TestModel struct { ID int64 `bun:"id,pk" json:"id"` Name string `bun:"name" json:"name"` - CreatedAt datatypes.SqlTimeStamp `bun:"created_at" json:"created_at"` - BirthDate datatypes.SqlDate `bun:"birth_date" json:"birth_date"` - LoginTime datatypes.SqlTime `bun:"login_time" json:"login_time"` - Meta datatypes.SqlJSONB `bun:"meta" json:"meta"` - Tags datatypes.SqlJSONB `bun:"tags" json:"tags"` + CreatedAt spectypes.SqlTimeStamp `bun:"created_at" json:"created_at"` + BirthDate spectypes.SqlDate `bun:"birth_date" json:"birth_date"` + LoginTime spectypes.SqlTime `bun:"login_time" json:"login_time"` + Meta spectypes.SqlJSONB `bun:"meta" json:"meta"` + Tags spectypes.SqlJSONB `bun:"tags" json:"tags"` } now := time.Now() @@ -225,8 +225,8 @@ func TestMapToStruct_SqlNull_NilValues(t *testing.T) { // Test that SqlNull types handle nil values correctly type TestModel struct { ID int64 `bun:"id,pk" json:"id"` - UpdatedAt datatypes.SqlTimeStamp `bun:"updated_at" json:"updated_at"` - DeletedAt datatypes.SqlTimeStamp `bun:"deleted_at" json:"deleted_at"` + UpdatedAt spectypes.SqlTimeStamp `bun:"updated_at" json:"updated_at"` + DeletedAt spectypes.SqlTimeStamp `bun:"deleted_at" json:"deleted_at"` } now := time.Now() diff --git a/pkg/datatypes/sql_types.go b/pkg/spectypes/sql_types.go similarity index 99% rename from pkg/datatypes/sql_types.go rename to pkg/spectypes/sql_types.go index 8f802f6..68d3b26 100644 --- a/pkg/datatypes/sql_types.go +++ b/pkg/spectypes/sql_types.go @@ -1,5 +1,5 @@ -// Package datatypes provides nullable SQL types with automatic casting and conversion methods. -package datatypes +// Package spectypes provides nullable SQL types with automatic casting and conversion methods. +package spectypes import ( "database/sql" diff --git a/pkg/datatypes/sql_types_test.go b/pkg/spectypes/sql_types_test.go similarity index 99% rename from pkg/datatypes/sql_types_test.go rename to pkg/spectypes/sql_types_test.go index d8f29ad..8932ba5 100644 --- a/pkg/datatypes/sql_types_test.go +++ b/pkg/spectypes/sql_types_test.go @@ -1,4 +1,4 @@ -package datatypes +package spectypes import ( "database/sql/driver"