Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sqlcipher Integration #1306

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion _example/custom_driver_name/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ endif
all : $(TARGET)

$(TARGET) : main.go
go build -ldflags="-X 'github.com/mattn/go-sqlite3.driverName=my-sqlite3'"
go build -ldflags="-X 'github.com/fhir-fli/go-sqlite3-sqlcipher.driverName=my-sqlite3'"

clean :
rm -f $(TARGET)
2 changes: 1 addition & 1 deletion _example/custom_driver_name/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"database/sql"

_ "github.com/mattn/go-sqlite3"
_ "github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _example/custom_func/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"math"
"math/rand"

sqlite "github.com/mattn/go-sqlite3"
sqlite "github.com/fhir-fli/go-sqlite3-sqlcipher"
)

// Computes x^y
Expand Down
2 changes: 1 addition & 1 deletion _example/fuzz/fuzz_openexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"database/sql"
"io/ioutil"

_ "github.com/mattn/go-sqlite3"
_ "github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func FuzzOpenExec(data []byte) int {
Expand Down
2 changes: 1 addition & 1 deletion _example/hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"os"

"github.com/mattn/go-sqlite3"
"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
Expand Down
3 changes: 2 additions & 1 deletion _example/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"database/sql/driver"
"encoding/json"
"fmt"
_ "github.com/mattn/go-sqlite3"
"log"
"os"

_ "github.com/fhir-fli/go-sqlite3-sqlcipher"
)

type Tag struct {
Expand Down
2 changes: 1 addition & 1 deletion _example/limit/limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"strings"

"github.com/mattn/go-sqlite3"
"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func createBulkInsertQuery(n int, start int) (query string, args []any) {
Expand Down
3 changes: 2 additions & 1 deletion _example/mod_regexp/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package main
import (
"database/sql"
"fmt"
"github.com/mattn/go-sqlite3"
"log"

"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _example/mod_vtable/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"

"github.com/mattn/go-sqlite3"
"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _example/simple/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ COPY . /workspace/
RUN \
cd _example/simple && \
go mod init github.com/mattn/sample && \
go mod edit -replace=github.com/mattn/go-sqlite3=../.. && \
go mod edit -replace=github.com/fhir-fli/go-sqlite3-sqlcipher=../.. && \
go mod tidy && \
go install -ldflags='-s -w -extldflags "-static"' ./simple.go

Expand Down
3 changes: 2 additions & 1 deletion _example/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package main
import (
"database/sql"
"fmt"
_ "github.com/mattn/go-sqlite3"
"log"
"os"

_ "github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _example/trace/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"os"

sqlite3 "github.com/mattn/go-sqlite3"
sqlite3 "github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func traceCallback(info sqlite3.TraceInfo) int {
Expand Down
2 changes: 1 addition & 1 deletion _example/vtable/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"

"github.com/mattn/go-sqlite3"
"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _example/vtable/vtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io/ioutil"
"net/http"

"github.com/mattn/go-sqlite3"
"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

type githubRepo struct {
Expand Down
2 changes: 1 addition & 1 deletion _example/vtable_eponymous_only/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"

"github.com/mattn/go-sqlite3"
"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion _example/vtable_eponymous_only/vtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/mattn/go-sqlite3"
"github.com/fhir-fli/go-sqlite3-sqlcipher"
)

type seriesModule struct{}
Expand Down
6 changes: 2 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/mattn/go-sqlite3
module github.com/fhir-fli/go-sqlite3-sqlcipher

go 1.19

retract (
[v2.0.0+incompatible, v2.0.6+incompatible] // Accidental; no major changes or features.
)
retract [v2.0.0+incompatible, v2.0.6+incompatible] // Accidental; no major changes or features.
25 changes: 25 additions & 0 deletions main/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"database/sql"
"log"

_ "github.com/fhir-fli/go-sqlite3-sqlcipher"
)

func main() {
// Open database connection
db, err := sql.Open("sqlite3", "file:test_encrypted.db?mode=rwc&_pragma_key=test_secret")
if err != nil {
log.Fatalf("Failed to open database: %v", err)
}
defer db.Close()

// Create a table to test
_, err = db.Exec("CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, value TEXT);")
if err != nil {
log.Fatalf("Failed to create table: %v", err)
}

log.Println("Database created and encrypted successfully!")
}
Loading