Skip to content

Commit 9e5f9c9

Browse files
Add vector example
1 parent f1f224e commit 9e5f9c9

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

Examples/Batch/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Batch
1+
# Vector
22

3-
This example demonstrates how to use libSQL to execute a batch of SQL statements.
3+
This example demonstrates how to use libSQL vector search with a local database.
44

55
## Running
66

77
Execute the example:
88

99
```bash
10-
swift run Batch
10+
swift run Vector
1111
```
1212

13-
This will setup a SQLite database, execute a batch of SQL statements, and then query the results.
13+
This will setup a local SQLite database, insert some data, and then query the results using the vector similarity search function.

Examples/Vector/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Remote
2+
3+
This example demonstrates how to use libSQL with a remote database.
4+
5+
## Running
6+
7+
Execute the example:
8+
9+
```bash
10+
TURSO_DATABASE_URL="..." TURSO_AUTH_TOKEN="..." swift run Remote
11+
```
12+
13+
This will connect to a remote SQLite database, insert some data, and then query the results.

Package.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ var package = Package(
1313
// Examples
1414
.executable(name: "Query", targets: ["Query"]),
1515
.executable(name: "Transaction", targets: ["Transaction"]),
16-
.executable(name: "Vector", targets: ["Vector"]),
1716
.executable(name: "Batch", targets: ["Batch"]),
1817
],
1918
targets: [
@@ -32,11 +31,6 @@ var package = Package(
3231
dependencies: ["Libsql"],
3332
path: "Examples/Transaction"
3433
),
35-
.executableTarget(
36-
name: "Vector",
37-
dependencies: ["Libsql"],
38-
path: "Examples/Vector"
39-
),
4034
.executableTarget(
4135
name: "Batch",
4236
dependencies: ["Libsql"],
@@ -73,5 +67,11 @@ var package = Package(
7367
path: "Examples/Transactions",
7468
exclude: ["README.md", "local.db"]
7569
),
70+
.executableTarget(
71+
name: "Vector",
72+
dependencies: ["Libsql"],
73+
path: "Examples/Vector",
74+
exclude: ["README.md"]
75+
),
7676
]
7777
)

0 commit comments

Comments
 (0)