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

Feat/Full text search #5

Closed
wants to merge 6 commits into from
Closed
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
56 changes: 53 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ WASQLITE_DEFINES = \
-DSQLITE_THREADSAFE=0 \
-DSQLITE_USE_ALLOCA \
-DSQLITE_ENABLE_BATCH_ATOMIC_WRITE \
-DSQLITE_ENABLE_FTS5 \
$(WASQLITE_EXTRA_DEFINES)

# directories
Expand All @@ -112,11 +113,11 @@ all: dist

.PHONY: clean
clean:
rm -rf dist dist-xl debug tmp
rm -rf dist debug tmp

.PHONY: spotless
spotless:
rm -rf dist dist-xl debug tmp deps cache
rm -rf dist debug tmp deps cache

## cache
.PHONY: clean-cache
Expand Down Expand Up @@ -194,6 +195,27 @@ debug/wa-sqlite-async.mjs: $(OBJ_FILES_DEBUG) $(RS_DEBUG_BC) $(EXPORTED_FUNCTION
$(RS_WASM_TGT_DIR)/debug/deps/*.bc \
$(OBJ_FILES_DEBUG) *.o -o $@

## Debug FTS builds
# .PHONY: debug
# debug: debug/wa-sqlite.mjs debug/wa-sqlite-async.mjs

# debug/wa-sqlite.mjs: $(OBJ_FILES_DEBUG_FTS) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
# mkdir -p debug
# $(EMCC) $(EMFLAGS_DEBUG) \
# $(EMFLAGS_INTERFACES) \
# $(EMFLAGS_LIBRARIES) \
# $(RS_WASM_TGT_DIR)/debug/deps/*.bc \
# $(OBJ_FILES_DEBUG_FTS) *.o -o $@

# debug/wa-sqlite-async.mjs: $(OBJ_FILES_DEBUG_FTS) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
# mkdir -p debug
# $(EMCC) $(EMFLAGS_DEBUG) \
# $(EMFLAGS_INTERFACES) \
# $(EMFLAGS_LIBRARIES) \
# $(EMFLAGS_ASYNCIFY_DEBUG) \
# $(RS_WASM_TGT_DIR)/debug/deps/*.bc \
# $(OBJ_FILES_DEBUG_FTS) *.o -o $@

## dist
.PHONY: clean-dist
clean-dist:
Expand All @@ -220,4 +242,32 @@ dist/wa-sqlite-async.mjs: $(OBJ_FILES_DIST) $(RS_RELEASE_BC) $(EXPORTED_FUNCTION
$(RS_WASM_TGT_DIR)/wasm/deps/*.bc \
$(OBJ_FILES_DIST) -o $@

FORCE: ;
FORCE: ;

# FTS builds
# .PHONY: clean-dist
# clean-dist:
# rm -rf dist

# .PHONY: dist
# dist: dist/wa-sqlite.mjs dist/wa-sqlite-async.mjs

# dist/wa-sqlite.mjs: $(OBJ_FILES_DIST_FTS) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
# mkdir -p dist
# $(EMCC) $(EMFLAGS_DIST) \
# $(EMFLAGS_INTERFACES) \
# $(EMFLAGS_LIBRARIES) \
# $(RS_WASM_TGT_DIR)/wasm/deps/*.bc \
# $(OBJ_FILES_DIST_FTS) -o $@

# dist/wa-sqlite-async.mjs: $(OBJ_FILES_DIST_FTS) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
# mkdir -p dist
# $(EMCC) $(EMFLAGS_DIST) \
# $(EMFLAGS_INTERFACES) \
# $(EMFLAGS_LIBRARIES) \
# $(EMFLAGS_ASYNCIFY_DIST) \
# $(CFLAGS_DIST) \
# $(RS_WASM_TGT_DIR)/wasm/deps/*.bc \
# $(OBJ_FILES_DIST_FTS) -o $@

# FORCE: ;
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ git submodule init
```

```bash
git submodule update --recursive
git submodule update --init --recursive
```

```bash
Expand Down
268 changes: 132 additions & 136 deletions dist/wa-sqlite-async.mjs

Large diffs are not rendered by default.

Binary file modified dist/wa-sqlite-async.wasm
Binary file not shown.
261 changes: 129 additions & 132 deletions dist/wa-sqlite.mjs

Large diffs are not rendered by default.

Binary file modified dist/wa-sqlite.wasm
Binary file not shown.
7 changes: 4 additions & 3 deletions scripts/docker-setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.bashrc
rustup component add rust-src --toolchain nightly-2023-08-28-aarch64-unknown-linux-gnu -y
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
. $HOME/.cargo/env && \
rustup toolchain install nightly-2023-08-28-aarch64-unknown-linux-gnu && \
rustup component add rust-src --toolchain nightly-2023-08-28-aarch64-unknown-linux-gnu

sudo apt-get update -y
sudo apt-get install -y tclsh
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1692,4 +1692,4 @@ declare module 'wa-sqlite/src/examples/tag.js' {
* @returns {function(TemplateStringsArray, ...any): Promise<object[]>}
*/
export function tag(sqlite3: any, db: number): (arg0: TemplateStringsArray, ...args: any[]) => Promise<object[]>;
}
}
Loading