Skip to content

Commit

Permalink
patched generator
Browse files Browse the repository at this point in the history
  • Loading branch information
klarysz committed Jul 14, 2022
1 parent 0141cbe commit e8d30ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions cmd/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func updateView(options *Options, table *Table, aView *view.View) error {
func updateColumnsConfig(table *Table, aView *view.View) error {
query, err := parser.ParseQuery(table.SQL)
if err != nil {
return err
return nil
}

aView.ColumnsConfig = map[string]*view.ColumnConfig{}
Expand Down Expand Up @@ -190,7 +190,10 @@ func updateColumnsConfig(table *Table, aView *view.View) error {
func updateTableColumnTypes(options *Options, table *Table) {
//TODO read all column per alias from main and join table
table.ColumnTypes = map[string]string{}
db, _ := options.Connector.New().Db()
db, err := options.Connector.New().Db()
if err != nil {
fmt.Printf(err.Error())
}
SQL := "SELECT * FROM " + table.Name + " WHERE 1 = 0"
if strings.Contains(strings.ToUpper(table.InnerSQL), "JOIN") {
SQL = table.InnerSQL
Expand Down Expand Up @@ -218,7 +221,6 @@ func updateTableColumnTypes(options *Options, table *Table) {
}
}
}
fmt.Printf("ColumnTypes: %v\n", table.ColumnTypes)
}

func createAndEvalauteTemplate(meta *ast.ViewMeta) (string, error) {
Expand Down
1 change: 0 additions & 1 deletion cmd/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ func buildExcludeColumn(xTable *Table, aView *view.View, viewRoute *router.Route
func detectCaseFormat(xTable *Table) view.CaseFormat {
var result = "lc"
if len(xTable.Inner) > 0 {
result = view.DetectCase(xTable.Inner[0].Name)
for _, candidate := range xTable.Inner {
if len(candidate.Name) > 3 {
result = view.DetectCase(xTable.Inner[0].Name)
Expand Down

0 comments on commit e8d30ac

Please sign in to comment.