Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions example/encrypt/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module encrypt

go 1.24.4

require github.com/tursodatabase/turso-go v0.1.0

replace github.com/tursodatabase/turso-go => ../../

require (
github.com/ebitengine/purego v0.10.0-alpha.2 // indirect
golang.org/x/sys v0.29.0 // indirect
)
16 changes: 16 additions & 0 deletions example/encrypt/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
github.com/ebitengine/purego v0.10.0-alpha.2 h1:aUB+wqQ6KpzMMOskWW4jOvxTfJEctVtFxSxUHv3md+8=
github.com/ebitengine/purego v0.10.0-alpha.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ=
gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8=
gorm.io/gorm v1.31.0 h1:0VlycGreVhK7RF/Bwt51Fk8v0xLiiiFdbGDPIZQ7mJY=
gorm.io/gorm v1.31.0/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
48 changes: 48 additions & 0 deletions example/encrypt/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package main

import (
"database/sql"
"fmt"
"log"

_ "github.com/tursodatabase/turso-go"
)

func main() {

key := "5d8a8f20e33bbe37a449b473f38469229d8772aa6250d6f32c5bb2587f46224f"
dbPath := fmt.Sprintf("file:gottem.db?cipher=aegis256&hexkey=%s", key)

db, err := sql.Open("turso", dbPath)
if err != nil {
log.Fatal(err)
}
defer db.Close()

_, err = db.Exec("create table if not exists t(x text);")
if err != nil {
log.Fatal(err)
}
_, err = db.Exec(`insert into t(x) values
('thick'), ('hugge'), ('bigger');`)
if err != nil {
log.Fatal(err)
}

rows, err := db.Query("select x from t;")
if err != nil {
log.Fatal(err)
}
defer rows.Close()

fmt.Println("In t we have:")
for rows.Next() {
var val string
if err := rows.Scan(&val); err != nil {
log.Println(err)
continue
}
fmt.Println("-", val)
}
}

2 changes: 1 addition & 1 deletion rs_src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub unsafe extern "C" fn db_open(path: *const c_char) -> *mut c_void {
let _ = init_tracing();
let indexes = true;
let mvcc = false;
let encryption = false;
let encryption = true;
let views = false;
let strict = false;
let custom_modules = false;
Expand Down
Loading