[breaking] Another breaking change datatypes -> spectypes

This commit is contained in:
Hein 2025-12-18 11:49:35 +02:00
parent 77f39af2f9
commit 7c861c708e
3 changed files with 13 additions and 13 deletions

View File

@ -4,15 +4,15 @@ import (
"testing" "testing"
"time" "time"
"github.com/bitechdev/ResolveSpec/pkg/datatypes"
"github.com/bitechdev/ResolveSpec/pkg/reflection" "github.com/bitechdev/ResolveSpec/pkg/reflection"
"github.com/bitechdev/ResolveSpec/pkg/spectypes"
) )
func TestMapToStruct_SqlJSONB_PreservesDriverValuer(t *testing.T) { func TestMapToStruct_SqlJSONB_PreservesDriverValuer(t *testing.T) {
// Test that SqlJSONB type preserves driver.Valuer interface // Test that SqlJSONB type preserves driver.Valuer interface
type TestModel struct { type TestModel struct {
ID int64 `bun:"id,pk" json:"id"` 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{}{ dataMap := map[string]interface{}{
@ -65,7 +65,7 @@ func TestMapToStruct_SqlJSONB_FromBytes(t *testing.T) {
// Test that SqlJSONB can be set from []byte directly // Test that SqlJSONB can be set from []byte directly
type TestModel struct { type TestModel struct {
ID int64 `bun:"id,pk" json:"id"` 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"}`) jsonBytes := []byte(`{"direct":"bytes"}`)
@ -103,11 +103,11 @@ func TestMapToStruct_AllSqlTypes(t *testing.T) {
type TestModel struct { type TestModel struct {
ID int64 `bun:"id,pk" json:"id"` ID int64 `bun:"id,pk" json:"id"`
Name string `bun:"name" json:"name"` Name string `bun:"name" json:"name"`
CreatedAt datatypes.SqlTimeStamp `bun:"created_at" json:"created_at"` CreatedAt spectypes.SqlTimeStamp `bun:"created_at" json:"created_at"`
BirthDate datatypes.SqlDate `bun:"birth_date" json:"birth_date"` BirthDate spectypes.SqlDate `bun:"birth_date" json:"birth_date"`
LoginTime datatypes.SqlTime `bun:"login_time" json:"login_time"` LoginTime spectypes.SqlTime `bun:"login_time" json:"login_time"`
Meta datatypes.SqlJSONB `bun:"meta" json:"meta"` Meta spectypes.SqlJSONB `bun:"meta" json:"meta"`
Tags datatypes.SqlJSONB `bun:"tags" json:"tags"` Tags spectypes.SqlJSONB `bun:"tags" json:"tags"`
} }
now := time.Now() now := time.Now()
@ -225,8 +225,8 @@ func TestMapToStruct_SqlNull_NilValues(t *testing.T) {
// Test that SqlNull types handle nil values correctly // Test that SqlNull types handle nil values correctly
type TestModel struct { type TestModel struct {
ID int64 `bun:"id,pk" json:"id"` ID int64 `bun:"id,pk" json:"id"`
UpdatedAt datatypes.SqlTimeStamp `bun:"updated_at" json:"updated_at"` UpdatedAt spectypes.SqlTimeStamp `bun:"updated_at" json:"updated_at"`
DeletedAt datatypes.SqlTimeStamp `bun:"deleted_at" json:"deleted_at"` DeletedAt spectypes.SqlTimeStamp `bun:"deleted_at" json:"deleted_at"`
} }
now := time.Now() now := time.Now()

View File

@ -1,5 +1,5 @@
// Package datatypes provides nullable SQL types with automatic casting and conversion methods. // Package spectypes provides nullable SQL types with automatic casting and conversion methods.
package datatypes package spectypes
import ( import (
"database/sql" "database/sql"

View File

@ -1,4 +1,4 @@
package datatypes package spectypes
import ( import (
"database/sql/driver" "database/sql/driver"