File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -34,13 +34,18 @@ type Enum struct {
34
34
}
35
35
36
36
type pyType struct {
37
- InnerType string
38
- IsArray bool
39
- IsNull bool
37
+ InnerType string
38
+ IsArray bool
39
+ IsNull bool
40
+ HasCheckConstraints bool
40
41
}
41
42
42
43
func (t pyType ) Annotation (isFuncSignature bool ) * pyast.Node {
43
- ann := poet .Name (t .InnerType )
44
+ typ := t .InnerType
45
+ if t .HasCheckConstraints {
46
+ typ = MODELS_FILENAME + "." + t .InnerType
47
+ }
48
+ ann := poet .Name (typ )
44
49
if t .IsArray {
45
50
ann = subscriptNode ("List" , ann )
46
51
}
@@ -255,9 +260,10 @@ func (q Query) ArgDictNode() *pyast.Node {
255
260
func makePyType (req * plugin.GenerateRequest , col * plugin.Column ) pyType {
256
261
typ := pyInnerType (req , col )
257
262
return pyType {
258
- InnerType : typ ,
259
- IsArray : col .IsArray ,
260
- IsNull : ! col .NotNull ,
263
+ InnerType : typ ,
264
+ IsArray : col .IsArray ,
265
+ IsNull : ! col .NotNull ,
266
+ HasCheckConstraints : len (col .CheckConstraints ) > 0 ,
261
267
}
262
268
}
263
269
You can’t perform that action at this time.
0 commit comments