Hacker News new | ask | show | jobs
by bezzi 3607 days ago
Don't you think that teaching how to use it with mysql or postegres would be more useful than sqlite?
5 comments

Well, as others have pointed out, sqlite is simple and easy to use, that way we can work on the core functions of the app rather than having to worry about the database.

Also, as far as Go language is concerned, we do not really have to worry about the underlying database, the code, as others have rightly pointed out, is totally reusable

That seems a bit overkill. With telling a user how to use mysql/postgres/&c., there will also be questions about setting up these systems, so it seems that "just use sqlite" is a valid path if you're just wanting to go over basic usage.
totally agree. +1
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.
There are a few more use cases where it changes with postgres iirc and a few are not obvious.

For example the Result type's LastInsertId() method doesnt work in a few cases for postgres that it does for others.

I would second this. One big issue I faced with Go is the lack of fb connectors. Had to scrap one project because of no Teradata connectivity.
I would also think that BoltDB would be better than SQLite
Huh? Why? Sqlite is closer to postgres/MySQL is you're looking for a reference base and actually sqlite is a pretty awesome database. Bolt DB is much more niche.