Metadata-Version: 2.1
Name: FlashSQL
Version: 0.1.0
Summary: A lightweight key-value database using SQLite and APSW.
Home-page: https://github.com/superhexa/FlashSQL
Author: Hexa
Author-email: shexa.developer@gmail.com
Project-URL: Documentation, https://github.com/superhexa/FlashSQL#readme
Project-URL: Source, https://github.com/superhexa/FlashSQL
Project-URL: Tracker, https://github.com/superhexa/FlashSQL/issues
Keywords: database key-value sqlite apsw
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: apsw

# FlashSQL

**FlashSQL** is a lightweight key-value store built on top of SQLite. It is designed for simplicity and efficiency, providing a straightforward interface for storing, retrieving, and managing key-value pairs in an SQLite database.

## Features

- **SQLite-based**: Utilizes SQLite for persistent storage.
- **In-memory Option**: Supports in-memory databases for transient data.
- **Efficient Storage**: Optimized with PRAGMA settings for performance.
- **Flexible Key Management**: Supports basic CRUD operations (Create, Read, Update, Delete) for keys.
- **Pattern Matching**: Allows retrieval of keys based on patterns using SQL LIKE queries.
- **High Performance**: Designed for high performance with optimized SQLite settings.
- **Fast Access Times**: Provides quick access to stored values with efficient querying and indexing.

## Installation

You can install FlashSQL using pip:

```bash
pip install FlashSQL
```

## Usage

### Initialization

To initialize a new instance of FlashSQL Client, provide the file path to the SQLite database. Use `":memory:"` for an in-memory database.

```python
from FlashSQL import Client

# For a file-based database
db = Client('database.db')

# For an in-memory database
db = Client(':memory:')
```

### Storing Values

Use the `set` method to store a value under a specific key. If the key already exists, the value will be updated.

```python
db.set('key', 'value')
```

### Retrieving Values

Use the `get` method to retrieve the value associated with a key. If the key does not exist, `None` is returned.

```python
value = db.get('key')
print(value)  # Output: 'value'
```

### Deleting Values

Use the `delete` method to remove a key-value pair from the database.

```python
db.delete('key')
```

### Checking Key Existence

Use the `exists` method to check if a key is present in the database.

```python
exists = db.exists('key')
print(exists)  # Output: False (if the key has been deleted)
```

### Retrieving Keys

Use the `keys` method to retrieve a list of keys matching a specified pattern. 

```python
keys = db.keys('%')
print(keys) # Output: key
```

### Closing the Database

Use the `close` method to close the database connection.

```python
db.close()
```

## Full Example

```python
from FlashSQL import Client

# Initialize the database
db = from FlashSQL import Client
(':memory:')

# Store values
db.set('name', 'hexa')
db.set('age', 5)

# Retrieve values
print(db.get('name'))  # Output: 'hexa'
print(db.get('age'))   # Output: 5

# Check existence
print(db.exists('name'))  # Output: True
print(db.exists('address'))  # Output: False

# Retrieve keys with a pattern
print(db.keys('na%'))  # Output: ['name']

# Delete a key
db.delete('name')

# Close the database
db.close()
```

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributing

Contributions are welcome! Please submit pull requests or open issues to improve the functionality and performance of FlashSQL.
