R
R
Roman Rakzin2015-08-01 00:32:15
MySQL
Roman Rakzin, 2015-08-01 00:32:15

How to find out about the success of the sql query in golang?

How to find out about the success of the sql query in golang? (DB-Mysql) The table has a unique index on one of the fields.
Let's say the user adds data, and this index already exists. You need to find out somehow that the Insert request did not work. How to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
index0h, 2015-08-01
@index0h

RTFM
https://github.com/go-sql-driver/mysql/wiki/Examples:

_, err = stmtIns.Exec(i, (i * i)) // Insert tuples (i, i^2)
if err != nil {
    panic(err.Error()) // proper error handling instead of panic in your app
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question