File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ type structTransformer struct {
3030 pkFieldsFound []string
3131 pkComponentFields []string
3232 pkComponentFieldsFound []string
33+ skipPKValidationFields []string
34+ skipPKValidationFieldsFound []string
3335 jsonSchemaNameTransformer NameTransformer
3436
3537 maxJSONTypeSchemaDepth int
@@ -190,6 +192,13 @@ func (t *structTransformer) addColumnFromField(field reflect.StructField, parent
190192 }
191193 }
192194
195+ for _ , skipPK := range t .skipPKValidationFields {
196+ if skipPK == path {
197+ column .SkipPKValidation = true
198+ t .skipPKValidationFieldsFound = append (t .skipPKValidationFieldsFound , skipPK )
199+ }
200+ }
201+
193202 t .table .Columns = append (t .table .Columns , column )
194203
195204 return nil
@@ -244,6 +253,10 @@ func TransformWithStruct(st any, opts ...StructTransformerOption) schema.Transfo
244253 if diff := funk .SubtractString (t .pkComponentFields , t .pkComponentFieldsFound ); len (diff ) > 0 {
245254 return fmt .Errorf ("failed to find all of the desired primary key components: %v" , diff )
246255 }
256+
257+ if diff := funk .SubtractString (t .skipPKValidationFields , t .skipPKValidationFieldsFound ); len (diff ) > 0 {
258+ return fmt .Errorf ("failed to find all of the desired skip primary key validation fields: %v" , diff )
259+ }
247260 return nil
248261 }
249262}
You can’t perform that action at this time.
0 commit comments