![]() ![]() Menu.Action(func(opts wmenu.Opt) error )Īnd add the parameter to our function func handleFunc(opts wmenu. Menu := wmenu.NewMenu("What would you like to do?") ![]() Let’s create a main.go that looks like this: package main Install the WMenu package: go get /dixonwille/wmenu We won’t focus too heavily on the menu system itself because the intent of this article is to show you how to utilize SQLite.įirst, we’ll create a Go module and work with main.go to start. We’ll use this menu and a scanner to accept input to interact with our database. I’m going to use The WMenu package from Dixonwille for this, so we have an interface for our data. We will build a CLI application that accesses a SQLite database. sqlite3 provides a SQL-like interface to read, query, and write SQL databases from. So let’s get started! Creating the menu system SQL commands / syntax that we used in the SQLite lesson. We’ll start by creating a menu, then building out methods for each operation, and in the end, you’ll have an application that looks like this: It has a database full of people with their first name, last name, email address, and IP address. I’ll start with pre-populated database you can download here. You can follow along and build this application or use this as a reference to build something of your own. ![]() We’ll build a CLI (command-line interface) application with Go and SQLite. So we’re going to combine these two technologies to show you how easy it is to marry the two. It’s ubiquitous in mobile phones and devices, and SQLite powers many websites today. In fact, you’re likely already using SQLite every day and you don’t know it. SQLite has been trending among developers for its ability to host small data very quickly, safely, and contained in a single file. Go is one of the hottest languages in development right now, known for its simple structure and blazing performance. By the time you finish this tutorial, you can build CRUD (Create Read Update Delete) applications with Go easily. Today we’re going to learn how to use SQLite with Go. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |