GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - steadylearner/go-SQLite-example: Golang CLI example with SQLite.

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
models
models
 
 
refer
refer
 
 
repo
repo
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 
go.sh
go.sh
 
 
go.sum
go.sum
 
 
main.go
main.go
 
 
package.json
package.json
 
 
yarn-error.log
yarn-error.log
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

Test SQLite with Go

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.

How to prepare the project before you test it

First, help the models packages ready to work with main package.

$mv models && go build

How to setup SQLite database

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)")

How to test it

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

About

Golang CLI example with SQLite.

www.steadylearner.com/blog

Topics

gogo-cligo-cli-demogo-cli-examplegolanggolang-databasesqlitesteadylearner

Resources

Readme
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.