Skip to main content

sql_rs/
lib.rs

1// Copyright 2025 SQL-RS Contributors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15pub mod storage;
16pub mod vector;
17pub mod query;
18pub mod types;
19
20pub use storage::{Storage, StorageEngine};
21pub use types::{Value, Schema, Column, ColumnType};
22pub use vector::{VectorCollection, Vector, DistanceMetric, VectorStore};
23
24use thiserror::Error;
25
26#[derive(Error, Debug)]
27pub enum SqlRsError {
28    #[error("IO error: {0}")]
29    Io(#[from] std::io::Error),
30    
31    #[error("Serialization error: {0}")]
32    Serialization(String),
33    
34    #[error("Storage error: {0}")]
35    Storage(String),
36    
37    #[error("Query error: {0}")]
38    Query(String),
39    
40    #[error("Vector error: {0}")]
41    Vector(String),
42    
43    #[error("Not found: {0}")]
44    NotFound(String),
45    
46    #[error("Invalid operation: {0}")]
47    InvalidOperation(String),
48}
49
50pub type Result<T> = std::result::Result<T, SqlRsError>;