
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
github.com/yokomotod/go-zetasqlite
A database driver library that interprets ZetaSQL queries and runs them using SQLite3
go-zetasqlite
supports database/sql
driver interface.
So, you can use ZetaSQL queries just by importing github.com/goccy/go-zetasqlite
.
Also, go-zetasqlite uses SQLite3 as the database engine.
Since we are using go-sqlite3, we can use the options ( like :memory:
) supported by go-sqlite3
( see details ).
ZetaSQL functionality is provided by go-zetasql
go get github.com/goccy/go-zetasqlite
Since this library uses go-zetasql, the following environment variables must be enabled in order to build. See here for details.
CGO_ENABLED=1
CXX=clang++
You can pass ZetaSQL queries to Query/Exec function of database/sql package.
package main
import (
"database/sql"
"fmt"
_ "github.com/goccy/go-zetasqlite"
)
func main() {
db, err := sql.Open("zetasqlite", ":memory:")
if err != nil {
panic(err)
}
defer db.Close()
rows, err := db.Query(`SELECT * FROM UNNEST([?, ?, ?])`, 1, 2, 3)
if err != nil {
panic(err)
}
var ids []int64
for rows.Next() {
var id int64
if err := rows.Scan(&id); err != nil {
panic(err)
}
ids = append(ids, id)
}
fmt.Println(ids) // [1 2 3]
}
A list of ZetaSQL specifications and features supported by go-zetasqlite.
INT
, SMALLINT
, INTEGER
, BIGINT
, TINYINT
, BYTEINT
)DECIMAL
)BIGDECIMAL
)FLOAT
)BOOLEAN
)+
, -
, ~
)*
)/
)||
)+
)-
)<<
, >>
, &
, |
)=
, <
, >
, <=
, >=
, !=
, <>
)Not suported yet
MIT
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.