go-crate icon indicating copy to clipboard operation
go-crate copied to clipboard

ColumnTypes() improvement.

Open nicetip opened this issue 7 years ago • 2 comments

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()) } }

nicetip avatar Oct 31 '17 06:10 nicetip

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.

sourcelevel-bot[bot] avatar Oct 31 '17 06:10 sourcelevel-bot[bot]

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.

sourcelevel-bot[bot] avatar Oct 31 '17 06:10 sourcelevel-bot[bot]