修复结构体生成的BUG
This commit is contained in:
		@ -90,21 +90,22 @@ func (e *execute) List(ctx context.Context, inputParam *define.Api2SqlParam) (an
 | 
				
			|||||||
	st := wrapper.NewDynamic()
 | 
						st := wrapper.NewDynamic()
 | 
				
			||||||
	for _, columnConfig := range inputParam.ColumnList {
 | 
						for _, columnConfig := range inputParam.ColumnList {
 | 
				
			||||||
		tag := fmt.Sprintf(`gorm:%v json:%v`, columnConfig.Column, columnConfig.Alias)
 | 
							tag := fmt.Sprintf(`gorm:%v json:%v`, columnConfig.Column, columnConfig.Alias)
 | 
				
			||||||
 | 
							column := wrapper.String(columnConfig.Column).SnakeCaseToCamel()
 | 
				
			||||||
		switch columnConfig.Type {
 | 
							switch columnConfig.Type {
 | 
				
			||||||
		case "int", "int8", "int16", "int32", "int64":
 | 
							case "int", "int8", "int16", "int32", "int64":
 | 
				
			||||||
			st.AddInt(columnConfig.Column, tag, "")
 | 
								st.AddInt(column, tag, "")
 | 
				
			||||||
		case "uint", "uint8", "uint16", "uint32", "uint64":
 | 
							case "uint", "uint8", "uint16", "uint32", "uint64":
 | 
				
			||||||
			st.AddUint(columnConfig.Column, tag, "")
 | 
								st.AddUint(column, tag, "")
 | 
				
			||||||
		case "bool":
 | 
							case "bool":
 | 
				
			||||||
			st.AddBool(columnConfig.Column, tag, "")
 | 
								st.AddBool(column, tag, "")
 | 
				
			||||||
		case "float":
 | 
							case "float":
 | 
				
			||||||
			st.AddBool(columnConfig.Column, tag, "")
 | 
								st.AddBool(column, tag, "")
 | 
				
			||||||
		case "string":
 | 
							case "string":
 | 
				
			||||||
			st.AddString(columnConfig.Column, tag, "")
 | 
								st.AddString(column, tag, "")
 | 
				
			||||||
		case "map":
 | 
							case "map":
 | 
				
			||||||
			st.AddMap(columnConfig.Column, tag, "")
 | 
								st.AddMap(column, tag, "")
 | 
				
			||||||
		case "slice":
 | 
							case "slice":
 | 
				
			||||||
			st.AddSlice(columnConfig.Column, tag, "")
 | 
								st.AddSlice(column, tag, "")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	val := st.ToStructDefaultSliceValue()
 | 
						val := st.ToStructDefaultSliceValue()
 | 
				
			||||||
 | 
				
			|||||||
@ -43,13 +43,19 @@ func Test_execute_Run(t *testing.T) {
 | 
				
			|||||||
	})
 | 
						})
 | 
				
			||||||
	Exec.SetDatabaseClientManager(clientManager)
 | 
						Exec.SetDatabaseClientManager(clientManager)
 | 
				
			||||||
	res, err := Exec.List(context.Background(), &define.Api2SqlParam{
 | 
						res, err := Exec.List(context.Background(), &define.Api2SqlParam{
 | 
				
			||||||
		DatabaseFlag:      "TEST_DATABASE",
 | 
							DatabaseFlag:     "TEST_DATABASE",
 | 
				
			||||||
		Table:             "project",
 | 
							Table:            "project",
 | 
				
			||||||
		ForceMaster:       false,
 | 
							ForceMaster:      false,
 | 
				
			||||||
		InputSql:          "",
 | 
							InputSql:         "",
 | 
				
			||||||
		TableSplitConfig:  define.TableSplitConfig{},
 | 
							TableSplitConfig: define.TableSplitConfig{},
 | 
				
			||||||
		SqlType:           consts.SqlTypeList,
 | 
							SqlType:          consts.SqlTypeList,
 | 
				
			||||||
		ColumnList:        nil,
 | 
							ColumnList: []*define.ColumnConfig{
 | 
				
			||||||
 | 
								&define.ColumnConfig{
 | 
				
			||||||
 | 
									Column: "flag",
 | 
				
			||||||
 | 
									Alias:  "project_flag",
 | 
				
			||||||
 | 
									Type:   "string",
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		Limit:             0,
 | 
							Limit:             0,
 | 
				
			||||||
		Offset:            0,
 | 
							Offset:            0,
 | 
				
			||||||
		ForceNoLimit:      false,
 | 
							ForceNoLimit:      false,
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user