timeid 0.0.1

A simple crate to generate unique, timestamp-based IDs with memo/tag support stored in local SQLite
Documentation
# timeid

A compact, time-based unique ID generator with SQLite tracking.
Each ID encodes the current Unix timestamp using a custom base character set and ensures uniqueness by storing used IDs in a local SQLite database (`~/.timeid.sqlite` by default).

---

## ๐Ÿ“ฆ Features

- ๐Ÿ”’ Guarantees uniqueness by checking past IDs in a local database.
- ๐Ÿ“† Easily decodes IDs back to human-readable timestamps.
- ๐Ÿ“ Optional memo and tag can be saved with each ID.
- ๐Ÿ’พ Uses SQLite under the hood for lightweight local persistence.

---

## ๐Ÿ”ง Usage

Add to your `Cargo.toml`:

```toml
[dependencies]
timeid = "0.0.1"
```

Then use in your code:

```rust
use timeid::TimeId;

fn main() -> rusqlite::Result<()> {
    let id = TimeId::gen()?;                   // Generate a new ID
    println!("Generated ID: {}", id);

    let readable = TimeId::parse(&id);         // Parse ID back to datetime
    println!("Parsed: {}", readable);

    let count = TimeId::status()?;             // Check total generated
    println!("Stored rows: {}", count);

    Ok(())
}
```

---

## ๐Ÿ” Resetting the Database

You can reset the SQLite database:

```rust
TimeId::reset(None)?;
```

This deletes and recreates the default `~/.timeid.sqlite`.

---

## ๐Ÿงช Testing

To test:

```bash
cargo test -- --nocapture
```

---

## ๐Ÿ“ Storage Path

By default, the SQLite file is stored at:

- macOS/Linux: `~/.timeid.sqlite`
- Windows: `%USERPROFILE%/.timeid.sqlite`

You can override the path by passing a custom one to `reset()` or modifying the internal `init()` function.

---

## ๐Ÿ“œ License

MIT License

---

## โœจ Author

Nick ([@loyoming](mailto:loyoming@gmail.com))