sqlite

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sqlite provides an interface to sqlite database stores within Spin components.

This package is implemented as a driver that conforms to the built-in database/sql interface.

db := sqlite.Open("default")
defer db.Close()

s, err := db.Prepare("REPLACE INTO pets VALUES (4, 'Maya', ?, false);")
// if err != nil { ... }

_, err = s.Query("bananas")
// if err != nil { ... }

rows, err := db.Query("SELECT * FROM pets")
// if err != nil { ... }

var pets []*Pet
for rows.Next() {
	var pet Pet
	if err := rows.Scan(&pet.ID, &pet.Name, &pet.Prey, &pet.IsFinicky); err != nil {
		...
	}
	pets = append(pets, &pet)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(name string) *sql.DB

Open returns a new connection to the database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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