@@ -59,7 +59,6 @@ import (
59
59
)
60
60
61
61
func TestScannerValuer (t * testing.T ) {
62
- t .Skip ()
63
62
DB .Migrator ().DropTable (& ScannerValuerStruct {})
64
63
if err := DB .Migrator ().AutoMigrate (& ScannerValuerStruct {}); err != nil {
65
64
t .Fatalf ("no error should happen when migrate scanner, valuer struct, got error %v" , err )
@@ -92,7 +91,7 @@ func TestScannerValuer(t *testing.T) {
92
91
93
92
var result ScannerValuerStruct
94
93
95
- if err := DB .Find (& result , "id = ?" , data .ID ).Error ; err != nil {
94
+ if err := DB .Find (& result , "\" id \" = ?" , data .ID ).Error ; err != nil {
96
95
t .Fatalf ("no error should happen when query scanner, valuer struct, but got %v" , err )
97
96
}
98
97
@@ -151,7 +150,6 @@ func TestScannerValuerWithFirstOrCreate(t *testing.T) {
151
150
}
152
151
153
152
func TestInvalidValuer (t * testing.T ) {
154
- t .Skip ()
155
153
DB .Migrator ().DropTable (& ScannerValuerStruct {})
156
154
if err := DB .Migrator ().AutoMigrate (& ScannerValuerStruct {}); err != nil {
157
155
t .Errorf ("no error should happen when migrate scanner, valuer struct" )
@@ -205,6 +203,24 @@ type ScannerValuerStruct struct {
205
203
ExampleStructPtr * ExampleStruct
206
204
}
207
205
206
+ func (StringsSlice ) GormDataType () string { return "CLOB" }
207
+ func (l StringsSlice ) GormValue (ctx context.Context , db * gorm.DB ) clause.Expr {
208
+ v , err := l .Value ()
209
+ if err != nil {
210
+ return gorm .Expr ("?" , err )
211
+ }
212
+ return gorm .Expr ("?" , v )
213
+ }
214
+
215
+ func (StructsSlice ) GormDataType () string { return "CLOB" }
216
+ func (l StructsSlice ) GormValue (ctx context.Context , db * gorm.DB ) clause.Expr {
217
+ v , err := l .Value ()
218
+ if err != nil {
219
+ return gorm .Expr ("?" , err )
220
+ }
221
+ return gorm .Expr ("?" , v )
222
+ }
223
+
208
224
type EncryptedData []byte
209
225
210
226
func (data * EncryptedData ) Scan (value interface {}) error {
0 commit comments