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

Provide parameter control Number data type as String

Open travelliu opened this issue 3 years ago • 0 comments

Looking at the code, it is found that the conversion of Number to int64 or float64 will be automatically judged according to the type. Is it possible to provide a parameter to control whether Number is a float,Or provide a type to reduce the overhead of conversion from float to string

Can you refer to godror to provide parameters at the statement layer?

func FetchRowCount(rowCount int) Option { return FetchArraySize(rowCount) }
// NumberAsString is an option to return numbers a string, not Number.
func NumberAsString() Option { return func(o *stmtOptions) { o.numberAsString = true } }

  sql := `SELECT last_name
          FROM employees
          ORDER BY last_name
          OFFSET :offset ROWS FETCH NEXT :maxnumrows ROWS ONLY`
  rows, err := db.Query(sql, myoffset, mymaxnumrows,
      godror.PrefetchCount(mymaxnumrows+1), godror.FetchArraySize(mymaxnumrows))

https://github.com/godror/godror/blob/main/stmt.go

travelliu avatar Sep 10 '22 20:09 travelliu