shell

package
v0.0.0-...-04dc7ba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2024 License: ISC Imports: 10 Imported by: 0

Documentation

Overview

Package shell provides a minimal SQLite REPL, similar to the built-in one. This is useful for providing a REPL with custom functions.

Example

This is a small program that emulates the behavior of the sqlite3 CLI. A path to a database can be passed on the command-line.

package main

import (
	"fmt"
	"os"

	"zombiezen.com/go/sqlite"
	"zombiezen.com/go/sqlite/shell"
)

func main() {
	dbName := ":memory:"
	if len(os.Args) > 1 {
		dbName = os.Args[1]
	}
	conn, err := sqlite.OpenConn(dbName)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	shell.Run(conn)
	conn.Close()
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(conn *sqlite.Conn)

Run runs an interactive shell on the process's standard I/O.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL