I don't know if this driver implements the LastInsertId method of the Result type of the database/sql package or not but when I tried to use it I got back a 0 but in Postgres I could see the last ID was 98.
The way that I tried it out is as follows:
result, err := db.Exec("insert into commands (command,slot) values ($1,$2)", incoming.Command, incoming.Slot)
if err != nil {
l.Printf("Error inserting into the commands table: %v\n", err)
return
}
id, _ := result.LastInsertId()
fmt.Println(id) //Prints 0
I don't know if this driver implements the LastInsertId method of the Result type of the database/sql package or not but when I tried to use it I got back a 0 but in Postgres I could see the last ID was 98.
The way that I tried it out is as follows: