diff --git a/.gitignore b/.gitignore index cdd126f..5820584 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,5 @@ node_modules vite.config.js.timestamp-* vite.config.ts.timestamp-* -src-tauri/libchdb.so +src-tauri/libchdb.so* src-tauri/chdb.h diff --git a/README.md b/README.md index 829f2d8..c8e5481 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # agx -**_agx_** is a desktop application built with Tauri and SvelteKit that provides a modern interface for exploring and querying data using ClickHouse's embedded database engine (chdb). +**_agx_** is a desktop application that lets you explore and query data through a modern interface. It's built with [Tauri](https://tauri.app/), [SvelteKit](https://kit.svelte.dev/) and [Plot](https://observablehq.com/@observablehq/plot), and can work in two ways: as a native desktop app using ClickHouse's embedded database ([chdb](https://github.com/chdb-io/chdb)), or as a web interface connected to a [Clickhouse](https://clickhouse.com/) server instance. ## Preview @@ -23,17 +23,20 @@ ## Getting Started -### → Live +### → Native ([chdb](https://github.com/chdb-io/chdb)) + +Get the latest release from [GitHub](https://github.com/agnosticeng/agx/releases). + +### → Live ([clickhouse](https://github.com/ClickHouse/ClickHouse)) https://agx.app -### → Local +### → Local ([clickhouse](https://github.com/ClickHouse/ClickHouse)) 1. Clone the repository: ```bash -git clone https://github.com/agnosticeng/agx -cd agx +git clone https://github.com/agnosticeng/agx && cd agx ``` 2. Run with docker compose: @@ -44,39 +47,6 @@ docker compose up 3. Access the application via http://localhost:8080 -### → Native - -1. Clone the repository: - -```bash -git clone https://github.com/agnosticeng/agx -cd agx -``` - -2. Download and setup chdb library: - -```bash -./src-tauri/update_libchdb.sh -``` - -3. Install dependencies: - -```bash -npm install -``` - -4. Run in development mode: - -```bash -npm run tauri dev -``` - -5. Build for production: - -```bash -npm run tauri build -``` - ## Project Structure ``` diff --git a/src-tauri/fix_dylib.sh b/src-tauri/fix_dylib.sh old mode 100644 new mode 100755 index 3962b6d..2ef0670 --- a/src-tauri/fix_dylib.sh +++ b/src-tauri/fix_dylib.sh @@ -1,4 +1,6 @@ #!/bin/bash -install_name_tool -change libchdb.so @executable_path/../Resources/libchdb.so src-tauri/target/release/agx -codesign --force --sign - src-tauri/target/release/agx +install_name_tool -change libchdb.so @executable_path/libchdb.so src-tauri/target/release/agx +codesign --force --timestamp --options runtime \ + --sign "Developer ID Application: Didier Franc (87KT93D5KK)" \ + src-tauri/target/release/libchdb.so diff --git a/src-tauri/src/chdb/bindings.rs b/src-tauri/src/chdb/bindings.rs index a304132..833081d 100644 --- a/src-tauri/src/chdb/bindings.rs +++ b/src-tauri/src/chdb/bindings.rs @@ -1,8 +1,5 @@ /* automatically generated by rust-bindgen 0.70.1 */ -pub const __bool_true_false_are_defined: u32 = 1; -pub const true_: u32 = 1; -pub const false_: u32 = 0; pub const __WORDSIZE: u32 = 64; pub const __has_safe_buffers: u32 = 1; pub const __DARWIN_ONLY_64_BIT_INO_T: u32 = 1; @@ -408,40 +405,4 @@ extern "C" { extern "C" { pub fn free_result_v2(result: *mut local_result_v2); } -#[doc = " Connection structure for chDB\n Contains server instance, connection state, and query processing queue"] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct chdb_conn { - pub server: *mut ::std::os::raw::c_void, - pub connected: bool, - pub queue: *mut ::std::os::raw::c_void, -} -#[allow(clippy::unnecessary_operation, clippy::identity_op)] -const _: () = { - ["Size of chdb_conn"][::std::mem::size_of::() - 24usize]; - ["Alignment of chdb_conn"][::std::mem::align_of::() - 8usize]; - ["Offset of field: chdb_conn::server"][::std::mem::offset_of!(chdb_conn, server) - 0usize]; - ["Offset of field: chdb_conn::connected"] - [::std::mem::offset_of!(chdb_conn, connected) - 8usize]; - ["Offset of field: chdb_conn::queue"][::std::mem::offset_of!(chdb_conn, queue) - 16usize]; -}; -extern "C" { - #[doc = " Creates a new chDB connection.\n Only one active connection is allowed per process.\n Creating a new connection with different path requires closing existing connection.\n\n @param argc Number of command-line arguments\n @param argv Command-line arguments array (--path= to specify database location)\n @return Pointer to connection pointer, or NULL on failure\n @note Default path is \":memory:\" if not specified"] - pub fn connect_chdb( - argc: ::std::os::raw::c_int, - argv: *mut *mut ::std::os::raw::c_char, - ) -> *mut *mut chdb_conn; -} -extern "C" { - #[doc = " Closes an existing chDB connection and cleans up resources.\n Thread-safe function that handles connection shutdown and cleanup.\n\n @param conn Pointer to connection pointer to close"] - pub fn close_conn(conn: *mut *mut chdb_conn); -} -extern "C" { - #[doc = " Executes a query on the given connection.\n Thread-safe function that handles query execution in a separate thread.\n\n @param conn Connection to execute query on\n @param query SQL query string to execute\n @param format Output format string (e.g., \"CSV\", default format)\n @return Query result structure containing output or error message\n @note Returns error result if connection is invalid or closed"] - pub fn query_conn( - conn: *mut chdb_conn, - query: *const ::std::os::raw::c_char, - format: *const ::std::os::raw::c_char, - ) -> *mut local_result_v2; -} pub type __builtin_va_list = *mut ::std::os::raw::c_char; diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 346a6a7..06a915a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -14,7 +14,7 @@ }, "active": true, "targets": "all", - "resources": [ + "externalBin": [ "libchdb.so" ], "icon": [