crawshaw / sqlite

Go SQLite3 driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No way to check column type by column name

nussjustin opened this issue · comments

When writing functions that want to check the type of a column (via (*Stmt).ColumnType) users need to know the index of the column since there is no way to get the index for a column by its name. This is inconvenient and error prone since column indexes depend on the order of columns in a query and can easily be forgotten when changing a query.

Possible solutions:

  1. Add a variant of ColumnType that takes a column name
  2. Add a method to return the index for a column by its name