|
|
|
|
|
by astockwell
3607 days ago
|
|
The code is typically identical/reusable, it's all using the same stdlib database package. The only two lines that would change would be the import (import a mysql or postgres driver instead of sqlite) and the database handle - `db, err := sql.Open("sqlite3", "./newtask.db")` would become something like `db, err := sql.Open("postgres", "user=pqgotest dbname=pqgotest sslmode=verify-full")`. One of the many bright spots of Go. |
|
For example the Result type's LastInsertId() method doesnt work in a few cases for postgres that it does for others.