### Installing zombiezen.com/go/sqlite Package (Shell) Source: https://github.com/zombiezen/go-sqlite/blob/main/README.md This command uses the Go module system to download and install the `zombiezen.com/go/sqlite` package and its dependencies. It's the standard way to add the library to your Go project. Ensure your Go environment is properly set up before running. ```shell go get zombiezen.com/go/sqlite ``` -------------------------------- ### Installing zombiezen-sqlite-migrate Tool (Shell) Source: https://github.com/zombiezen/go-sqlite/blob/main/cmd/zombiezen-sqlite-migrate/README.md This command installs the `zombiezen-sqlite-migrate` command-line tool, which is designed to automate the migration of Go source code from `crawshaw.io/sqlite` to `zombiezen.com/go/sqlite`. It fetches the latest stable version of the tool from the Go module proxy, making it available in the user's `GOPATH/bin`. ```shell go install zombiezen.com/go/sqlite/cmd/zombiezen-sqlite-migrate@latest ``` -------------------------------- ### Previewing Migration Changes with zombiezen-sqlite-migrate (Shell) Source: https://github.com/zombiezen/go-sqlite/blob/main/cmd/zombiezen-sqlite-migrate/README.md This command executes the `zombiezen-sqlite-migrate` tool in a dry-run mode, allowing users to preview the changes it would make to their Go source files without actually modifying them. The `./...` argument instructs the tool to process all Go packages within the current directory and its subdirectories, providing a comprehensive overview of the migration. ```shell zombiezen-sqlite-migrate ./... ``` -------------------------------- ### Applying Migration Changes with zombiezen-sqlite-migrate (Shell) Source: https://github.com/zombiezen/go-sqlite/blob/main/cmd/zombiezen-sqlite-migrate/README.md This command applies the automated migration changes directly to the Go source files. The `-w` flag enables write mode, instructing the tool to modify the files in place, while `./...` ensures that all relevant Go packages are processed. This step should be performed after reviewing the previewed changes. ```shell zombiezen-sqlite-migrate -w ./... ``` -------------------------------- ### Opening In-Memory SQLite Database and Executing Query (Go) Source: https://github.com/zombiezen/go-sqlite/blob/main/README.md This Go snippet demonstrates how to open an in-memory SQLite database connection using `sqlite.OpenConn` and execute a simple `SELECT` query with `sqlitex.ExecuteTransient`. It shows how to handle errors, ensure the connection is closed with `defer conn.Close()`, and process query results using a `ResultFunc` to print the column text. ```go import ( "fmt" "zombiezen.com/go/sqlite" "zombiezen.com/go/sqlite/sqlitex" ) // ... // Open an in-memory database. conn, err := sqlite.OpenConn(":memory:", sqlite.OpenReadWrite) if err != nil { return err } defer conn.Close() // Execute a query. err = sqlitex.ExecuteTransient(conn, "SELECT 'hello, world';", &sqlitex.ExecOptions{ ResultFunc: func(stmt *sqlite.Stmt) error { fmt.Println(stmt.ColumnText(0)) return nil }, }) if err != nil { return err } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.