GithubHelp home page GithubHelp logo

Comments (4)

stfnmllr avatar stfnmllr commented on July 21, 2024

As the error says
'Scan error on column index 3, name "O_TOTALPRICE": unsupported Scan, storing driver.Value type []uint8 into type *main.Decimal'
*main.Decimal type is used to store the decimal. It should be driver.Decimal. So,

  • can you please share the definition of main.Decimal and
  • can you please share the definition of 'orders'
    for any further investigation of the issue?

from go-hdb.

chrislinan avatar chrislinan commented on July 21, 2024

Hi, dear
Here is the definition of main.Decimal and orders:

type Decimal big.Rat

type orders struct {
	o_orderkey      int64
	o_custkey       int64
	o_orderstatus   string
	o_totalprice    Decimal
	o_orderdate     string
	o_orderpriority string
	o_clerk         string
	o_shippriority  int64
	o_comment       string
}

Thanks a lot.

from go-hdb.

stfnmllr avatar stfnmllr commented on July 21, 2024

Hi,
the definition should like like follows:

// type Decimal big.Rat // not needed and big.Rat will not work - this is the root cause for the error

type orders struct {
	o_orderkey      int64
	o_custkey       int64
	o_orderstatus   string
       // you need to use the driver.Decimal type for doing the db - go conversion magic
	o_totalprice    driver.Decimal // <-- change type
	o_orderdate     string
	o_orderpriority string
	o_clerk         string
	o_shippriority  int64
	o_comment       string
}

Best regards

from go-hdb.

chrislinan avatar chrislinan commented on July 21, 2024

Hi, dear
driver.Decimal works for me. Thanks a lot.
Best regards!

from go-hdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.