@@ -381,6 +381,7 @@ func (td *tableDiscovery) autoConfigureTables(tables map[string]map[string]colum
381381
382382func (td * tableDiscovery ) populateTableDefinitions (configuredTables map [string ]discoveredTable , databaseName string , cfg * config.QuesmaConfiguration ) {
383383
384+ instanceName := td .dbConnPool .InstanceName ()
384385 tableMap := NewTableMap ()
385386 for tableName , resTable := range configuredTables {
386387 var columnsMap = make (map [string ]* Column )
@@ -393,7 +394,7 @@ func (td *tableDiscovery) populateTableDefinitions(configuredTables map[string]d
393394 }
394395 }
395396
396- column := ResolveColumn (col , columnMeta .colType )
397+ column := ResolveColumn (col , columnMeta .colType , instanceName )
397398 if column != nil {
398399 column .Comment = columnMeta .comment
399400 column .Origin = columnMeta .origin
@@ -481,12 +482,13 @@ func (td *tableDiscovery) TableDefinitions() *TableMap {
481482 return td .tableDefinitions .Load ()
482483}
483484
484- func ResolveColumn (colName , colType string ) * Column {
485+ func ResolveColumn (colName , colType string , instanceName string ) * Column {
485486 isNullable := false
486487 if isNullableType (colType ) {
487488 isNullable = true
488489 colType = strings .TrimSuffix (strings .TrimPrefix (colType , "Nullable(" ), ")" )
489490 }
491+ r := GetTypeResolver (instanceName )
490492
491493 if isArrayType (colType ) {
492494 arrayType := strings .TrimSuffix (strings .TrimPrefix (colType , "Array(" ), ")" )
@@ -495,7 +497,7 @@ func ResolveColumn(colName, colType string) *Column {
495497 arrayType = strings .TrimSuffix (strings .TrimPrefix (arrayType , "Nullable(" ), ")" )
496498 }
497499 if isArrayType (arrayType ) {
498- innerColumn := ResolveColumn ("inner" , arrayType )
500+ innerColumn := ResolveColumn ("inner" , arrayType , instanceName )
499501 if innerColumn == nil {
500502 logger .Warn ().Msgf ("invalid inner array type for column %s, %s" , colName , colType )
501503 return nil
@@ -508,7 +510,7 @@ func ResolveColumn(colName, colType string) *Column {
508510 },
509511 }
510512 }
511- GoType := ResolveType (arrayType )
513+ GoType := r . ResolveType (arrayType )
512514 if GoType != nil {
513515 return & Column {
514516 Name : colName ,
@@ -518,7 +520,7 @@ func ResolveColumn(colName, colType string) *Column {
518520 },
519521 }
520522 } else if isTupleType (arrayType ) {
521- tupleColumn := ResolveColumn ("Tuple" , arrayType )
523+ tupleColumn := ResolveColumn ("Tuple" , arrayType , instanceName )
522524 if tupleColumn == nil {
523525 logger .Warn ().Msgf ("invalid tuple type for column %s, %s" , colName , colType )
524526 return nil
@@ -558,7 +560,7 @@ func ResolveColumn(colName, colType string) *Column {
558560 Name : colName ,
559561 Type : BaseType {
560562 Name : "Int32" ,
561- GoType : NewBaseType ("Int32" ).GoType ,
563+ GoType : NewBaseTypeWithInstanceName ("Int32" , instanceName ).GoType ,
562564 },
563565 }
564566 }
@@ -567,12 +569,12 @@ func ResolveColumn(colName, colType string) *Column {
567569 if strings .HasPrefix (colType , "DateTime" ) {
568570 colType = removePrecision (colType )
569571 }
570- if GoType := ResolveType (colType ); GoType != nil {
572+ if GoType := r . ResolveType (colType ); GoType != nil {
571573 return & Column {
572574 Name : colName ,
573575 Type : BaseType {
574576 Name : colType ,
575- GoType : NewBaseType (colType ).GoType ,
577+ GoType : NewBaseTypeWithInstanceName (colType , instanceName ).GoType ,
576578 Nullable : isNullable ,
577579 },
578580 }
@@ -583,7 +585,7 @@ func ResolveColumn(colName, colType string) *Column {
583585 Name : colName ,
584586 Type : BaseType {
585587 Name : typeName ,
586- GoType : NewBaseType ("Unknown" ).GoType ,
588+ GoType : NewBaseTypeWithInstanceName ("Unknown" , instanceName ).GoType ,
587589 Nullable : isNullable ,
588590 },
589591 }
0 commit comments