OstrichDB is a lightweight, document-based NoSQL JSON-esque database written in the Odin programming language. It focuses on simplicity and is designed for local data testing and manipulation, making it an ideal solution for developers looking for a straightforward database without the need for complex setups. With a flexible command structure, OstrichDB makes it easy to manage data using both single and multi-token commands.
OstrichDB organizes data into three levels:
In ObstrichDB, commands are broken into four types of tokens, called ATOMs, to improve readability and ensure clear instructions.
Note: Not all commands require all four tokens.
NEW
, ERASE
, RENAME
).CLUSTER
, RECORD
).foo
, bar
).TO
, OF_TYPE
).NEW CLUSTER foo.bar
Explanation:
NEW
: Create a new object (Action token).CLUSTER
: The type of object to be created (Target token).foo
: The parent object that the new cluster will be created in (Object token). bar
: The name of the new cluster (Object token).These commands perform simple tasks without needing additional arguments.
VERSION
: Displays the current version of OstrichDB.LOGOUT
: Logs out the current user.EXIT
: Ends the session and closes the database.RESTART
: Restarts the program. REBUILD
: Rebuilds the database and restarts the program.HELP
: Displays general help information or detailed help when chained with specific tokens.TREE
: Displays the entire data structure in a tree format.CLEAR
: Clears the console screen.HISTORY
: Shows the current users command history.These commands allow you to perform more complex operations.
NEW
: Create a new collection, cluster, record, or user.ERASE
: Delete a collection, cluster, or record.RENAME
: Rename an existing object.FETCH
: Retrieve data from a collection, cluster, or record.SET
: Assign a value to a record or configuration.BACKUP
: Create a backup of a specific collection.PURGE
: Removes all data from an object while maintining the object structure.COUNT
: Returns the number of objects within a scope. Paired with the plural form of the object type (e.g., RECORDS
, CLUSTERS
).SIZE_OF
: Returns the size in bytes of an object.Modifiers adjust the behavior of commands. The current supported modifiers are:
TO
: Used to assign a new value or name (e.g., renaming an object or setting a record's value).OF_TYPE
: Specifies the type of a new record (e.g., INT, STR).Examples:
NEW RECORD foo.bar.baz OF_TYPE INT
RENAME CLUSTER foo.bar TO foo.baz
SET CONFIG help TO verbose
Clone the Repository:
git clone https://github.com/Solitude-Software-Solutions/OstrichDB.git
Navigate to the OstrichDB Directory:
cd path/to/OstrichDB
Make the Build & Restart Scripts Executable:
chmod +x scripts/build.sh scripts/restart.sh
Run The Build Script:
./scripts/build.sh
# Create a new collection:
NEW COLLECTION staff
# Create a new cluster:
NEW CLUSTER staff.engineers
# Create a new record:
NEW RECORD staff.engineers.lead OF_TYPE STR
# Set a record value:
SET RECORD staff.engineers.lead TO "John Doe"
# Fetch the record value:
FETCH RECORD staff.engineers.lead
# Rename a cluster:
RENAME CLUSTER staff.engineers TO developers
# Get the size of a cluster:
SIZE_OF CLUSTER staff.developers
# Erase a record:
ERASE RECORD staff.developers.lead
# Get a count of all collections in the database:
COUNT COLLECTIONS
# Get help on a specific ATOM
HELP RECORD
# Get general help information
HELP
# Create a new user
NEW USER
SORT
: Sort records or clusters by fieldIMPORT
: Load data from external sources(JSON, CSV, etc.)EXPORT
: Export data to various formatsVALIDATE
: Check data integrityLOCK
: Prevent data modificationUNLOCK
: Allow data modificationRESTORE
: Undo recent changesMERGE
: Combine multiple collections or clusters into oneALL
: Perform operations on all objects within a scopePlease refer to the CONTRIBUTING.md for detailed guidelines on how to contribute.
OstrichDB is released under the Apache License 2.0. For the full license text, see Apache License 2.0.