Skip to content

Commit cda0a19

Browse files
committed
Add docs
Signed-off-by: Adam Reese <[email protected]>
1 parent 59773dd commit cda0a19

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

v3/sqlite/doc.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Package sqlite provides an interface to sqlite database stores within Spin
2+
// components.
3+
//
4+
// This package is implemented as a driver that conforms to the built-in
5+
// database/sql interface.
6+
//
7+
// db := sqlite.Open("default")
8+
// defer db.Close()
9+
//
10+
// s, err := db.Prepare("REPLACE INTO pets VALUES (4, 'Maya', ?, false);")
11+
// // if err != nil { ... }
12+
//
13+
// _, err = s.Query("bananas")
14+
// // if err != nil { ... }
15+
//
16+
// rows, err := db.Query("SELECT * FROM pets")
17+
// // if err != nil { ... }
18+
//
19+
// var pets []*Pet
20+
// for rows.Next() {
21+
// var pet Pet
22+
// if err := rows.Scan(&pet.ID, &pet.Name, &pet.Prey, &pet.IsFinicky); err != nil {
23+
// ...
24+
// }
25+
// pets = append(pets, &pet)
26+
// }
27+
package sqlite

0 commit comments

Comments
 (0)