Use this CLI example to learn how to use Golang with SQLite. Modify and reuse some parts of this to make a web app etc.
First, help the models packages ready to work with main package.
$mv models && go build
You can manually handle SQLite database. Refer to the documenation for the SQLite CLI.
$touch users.db && sqlite3 users.db
$CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL UNIQUE)
You can also uncomment the code similar to this in main.go
db.Exec("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL UNIQUE)")
Use one of commands below to test CRULD(Create, Read, Update, List, Delete) users.
$go run main.go -action=create
$go run main.go -action=get
$go run main.go -action=update
$go run main.go -action=list
$go run main.go -action=delete