go-crate
go-crate copied to clipboard
ColumnTypes() improvement.
it was impossible to extract column types with Rows.ColumnTypes() function.
but Crate's JSON response already contains column type information(col_types).
this commit contains implement col_types
.
Look for following example codes.
Example Code:
package main
import ( "fmt" "database/sql" _ "go-crate" )
func main() { db, _ := sql.Open("crate", "http://127.0.0.1:4200") rows, _ := db.Query("select col1, col2 from tbl") types, _ := rows.ColumnTypes() for i, l := 0, len(types); i < l; i++ { t := types[i] fmt.Println(t.Name(), ":", t.DatabaseTypeName()) } }
Hello, @nicetip! This is your first Pull Request that will be reviewed by Ebert, an automatic Code Review service. It will leave comments on this diff with potential issues and style violations found in the code as you push new commits. You can also see all the issues found on this Pull Request on its review page. Please check our documentation for more information.
Ebert has finished reviewing this Pull Request and has found:
- 2 possible new issues (including those that may have been commented here).
You can see more details about this review at https://ebertapp.io/github/herenow/go-crate/pulls/22.