@@ -339,11 +339,16 @@ func (rz *Randomizer) GenFakeData(colConfs *[]DBFakeColumnConf, WithAutoInc bool
339339 var preGenerated map [string ]interface {}
340340 for _ , plugin := range rz .plugins {
341341 for _ , c := range * colConfs {
342- if exists , value := plugin .GenCommonFakeValue (c .ColumnType , rz , c .Cardinality ); exists {
343- if preGenerated == nil {
344- preGenerated = make (map [string ]interface {})
342+ if shouldStop , value := plugin .GenCommonFakeValue (c .ColumnType , rz , c .Cardinality ); ! shouldStop {
343+ if value != nil {
344+ if preGenerated == nil {
345+ preGenerated = make (map [string ]interface {})
346+ }
347+ preGenerated [c .ColumnType ] = value
345348 }
346- preGenerated [c .ColumnType ] = value
349+ } else {
350+ // End of generation
351+ return nil , nil , nil
347352 }
348353 }
349354 }
@@ -372,11 +377,16 @@ func (rz *Randomizer) GenFakeDataAsMap(colConfs *[]DBFakeColumnConf, WithAutoInc
372377 var preGenerated map [string ]interface {}
373378 for _ , plugin := range rz .plugins {
374379 for _ , c := range * colConfs {
375- if exists , value := plugin .GenCommonFakeValue (c .ColumnType , rz , c .Cardinality ); exists {
376- if preGenerated == nil {
377- preGenerated = make (map [string ]interface {})
380+ if shouldStop , value := plugin .GenCommonFakeValue (c .ColumnType , rz , c .Cardinality ); ! shouldStop {
381+ if value != nil {
382+ if preGenerated == nil {
383+ preGenerated = make (map [string ]interface {})
384+ }
385+ preGenerated [c .ColumnType ] = value
378386 }
379- preGenerated [c .ColumnType ] = value
387+ } else {
388+ // End of generation
389+ return nil , nil
380390 }
381391 }
382392 }
0 commit comments