zapdb-cli

Crates.iozapdb-cli
lib.rszapdb-cli
version1.0.0
created_at2025-01-03 20:39:35.820257+00
updated_at2025-01-06 16:32:39.637765+00
descriptionZapdb shell interface
homepage
repositoryhttps://github.com/Smartlinuxcoder/zapdb-cli
max_upload_size
id1502854
size61,214
(Smartlinuxcoder)

documentation

README

ZapDB CLI

A shell for interacting with ZapDB, a simple in-memory database. This shell allows you to create tables, insert records, query data, and save the database to disk.

Installation

  1. Install with cargo install zapdb-cli
  2. Run with zapdb-cli

Usage

Start the CLI by running zapdb-cli. You'll be greeted with an interactive shell:

Available Commands

  • create_table <table_name> <column1:type> ...
    Create a new table with specified columns and their types.
    Types: string, int
    Example: create_table users name:string age:int

  • insert <table> <column1=value1> ...
    Insert a new record into a table.
    Example: insert users name=Alice age=25

  • select <table>
    Display all records from a table with color-coded value types:

    • INTEGER (green)
    • STRING (cyan)
    • FLOAT (magenta)
    • BOOLEAN (yellow)
    • NULL (red)
  • save <filename>
    Save the current database state to a file.
    Example: save johnDatabase.zap

  • load <filename>
    Load a previously saved database.
    Example: load dataThatIsSavedToDisk.zap

  • echo <text>
    Print text to the console

  • exit
    Exit the shell

Dependencies

  • colored (2.0) - For cooooolors
  • prettytable-rs (0.10) - For the goofy table lookin ahh select query
  • tokio (1.0) - Because async you know?
  • zapdb (1.0.4) - The underlying database

License

Project shared under the GNU GPL V3 License.

Commit count: 6

cargo fmt