init.go

 1// Package embed embeds SQLite into your application.
 2//
 3// Importing package embed initializes the [sqlite3.Binary] variable
 4// with an appropriate build of SQLite:
 5//
 6//	import _ "github.com/ncruces/go-sqlite3/embed"
 7package embed
 8
 9import (
10	_ "embed"
11	"unsafe"
12
13	"github.com/ncruces/go-sqlite3"
14)
15
16//go:embed sqlite3.wasm
17var binary string
18
19func init() {
20	sqlite3.Binary = unsafe.Slice(unsafe.StringData(binary), len(binary))
21}