Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gen] Remove log.Fatal and return error in generated code #8

Closed
pingginp opened this issue Sep 15, 2018 · 0 comments
Closed

[gen] Remove log.Fatal and return error in generated code #8

pingginp opened this issue Sep 15, 2018 · 0 comments
Labels
comp/generator generate table defintion from live db schema comp/runtime cqlc runtime, the query builder
Milestone

Comments

@pingginp
Copy link
Owner

In code generated from schema, in some switch statement log.Fatal is used, should just return error

func Map{{$StructType}}(iter *gocql.Iter, callback func(t {{$StructType}}) (bool, error)) error {
        columns := iter.Columns()
        row := make([]interface{}, len(columns))

        for {
            t := {{$StructType}}{}

            for i := 0; i < len(columns); i++ {
                switch columns[i].Name {
                {{range $_, $col := $cf.Columns}}
                    case "{{$col.Name}}": row[i] = &t.{{snakeToCamel $col.Name}}
                {{end}}
                default:
                    log.Fatal("unhandled column: ", columns[i].Name)
                }
            }
    }
@pingginp pingginp added comp/runtime cqlc runtime, the query builder comp/generator generate table defintion from live db schema labels Sep 15, 2018
@pingginp pingginp added this to the 0.11.0 milestone Sep 15, 2018
pingginp added a commit that referenced this issue Sep 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp/generator generate table defintion from live db schema comp/runtime cqlc runtime, the query builder
Projects
None yet
Development

No branches or pull requests

1 participant