This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
src/ServiceStack.OrmLite.PostgreSQL.Tests Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,11 @@ public class ModelWithJsonType
10
10
{
11
11
public int Id { get ; set ; }
12
12
13
- [ CustomField ( "json" ) ]
13
+ [ PgSqlJson ]
14
14
public ComplexType ComplexTypeJson { get ; set ; }
15
+
16
+ [ PgSqlJsonB ]
17
+ public ComplexType ComplexTypeJsonb { get ; set ; }
15
18
}
16
19
17
20
public class ComplexType
@@ -59,10 +62,10 @@ public void Can_save_complex_types_as_JSON()
59
62
{
60
63
Id = 2 , SubType = new SubType { Name = "SubType2" }
61
64
} ,
62
- // ComplexTypeJsonb = new ComplexType
63
- // {
64
- // Id = 3, SubType = new SubType { Name = "SubType3" }
65
- // },
65
+ ComplexTypeJsonb = new ComplexType
66
+ {
67
+ Id = 3 , SubType = new SubType { Name = "SubType3" }
68
+ } ,
66
69
} ;
67
70
68
71
db . Insert ( row ) ;
@@ -76,6 +79,12 @@ public void Can_save_complex_types_as_JSON()
76
79
Assert . That ( result [ 0 ] . Id , Is . EqualTo ( 1 ) ) ;
77
80
Assert . That ( result [ 0 ] . ComplexTypeJson . Id , Is . EqualTo ( 2 ) ) ;
78
81
Assert . That ( result [ 0 ] . ComplexTypeJson . SubType . Name , Is . EqualTo ( "SubType2" ) ) ;
82
+
83
+ result = db . Select < ModelWithJsonType > (
84
+ "complex_type_jsonb->'SubType'->>'Name' = 'SubType3'" ) ;
85
+
86
+ Assert . That ( result [ 0 ] . ComplexTypeJsonb . Id , Is . EqualTo ( 3 ) ) ;
87
+ Assert . That ( result [ 0 ] . ComplexTypeJsonb . SubType . Name , Is . EqualTo ( "SubType3" ) ) ;
79
88
}
80
89
}
81
90
You can’t perform that action at this time.
0 commit comments