Skip to content

Commit

Permalink
[#17] enable full text search module (#18)
Browse files Browse the repository at this point in the history
* [#17] enable full text search module

* [#17] build for windows

* [#17] add tests
  • Loading branch information
lispyclouds authored Aug 30, 2024
1 parent 30d944d commit fa111e7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- pod-babashka-go-sqlite3-{{ checksum "go.sum" }}-{{ checksum ".circleci/config.yml" }}
- run:
name: Build binary
command: go build -o pod-babashka-go-sqlite3 main.go
command: go build -tags "fts5" -o pod-babashka-go-sqlite3 main.go
- run:
name: Install bb for test
command: |
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
CGO_ENABLED: "1"
GOOS: linux
GOARCH: arm64
command: go build -o pod-babashka-go-sqlite3 main.go
command: go build -tags "fts5" -o pod-babashka-go-sqlite3 main.go
- run:
name: Install bb for test
command: |
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
name: Build binary
command: |
source /Users/$(whoami)/.bashrc
go build -o pod-babashka-go-sqlite3 main.go
go build -tags "fts5" -o pod-babashka-go-sqlite3 main.go
- run:
name: Install bb for test
command: |
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build_script:
set PATH=C:\msys64\mingw64\bin;%PATH%
go build -o pod-babashka-go-sqlite3.exe main.go
go build -tags "fts5" -o pod-babashka-go-sqlite3.exe main.go
set /P VERSION=< resources\POD_BABASHKA_GO_SQLITE3_VERSION
Expand Down
2 changes: 1 addition & 1 deletion script/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

go build -o pod-babashka-go-sqlite3 main.go && test/script.clj
go build -tags "fts5" -o pod-babashka-go-sqlite3 main.go && test/script.clj
7 changes: 7 additions & 0 deletions test/script.clj
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,12 @@
Exception #"the sqlite connection must be a string"
(sqlite/query nil "select * from foo order by the_int asc"))))

(deftest fts50-test
(sqlite/execute! "/tmp/foo.db" ["CREATE VIRTUAL TABLE email USING fts5(sender, title, body)"])
(sqlite/execute! "/tmp/foo.db" ["INSERT INTO email VALUES('foo', 'bar', 'baz')"])
(is (= [{:sender "foo" :title "bar" :body "baz"}]
(sqlite/query "/tmp/foo.db"
["SELECT * FROM email WHERE email MATCH 'baz';"]))))

(let [{:keys [:fail :error]} (t/run-tests)]
(System/exit (+ fail error)))

0 comments on commit fa111e7

Please sign in to comment.