shroom

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

shroom

/GraphDB/Graph Database/
Shroom Library Documentation #
Constructors #

Shroom.create({String? name}):

Instantiates a new Shroom with an optional name. If provided, the instance is initialized with that name.


Shroom.get({String name, String id}):

Retrieves a Shroom instance by its ID or name. At least one parameter must be provided and not null. This constructor will throw an exception if no matching Shroom is found.



Static Methods #

initDB({String? path}):

Initializes the database at a specified path, or uses a default location if no path is provided. Essential for setting up the storage environment for Shroom instances.


deleteDB({String? path}):

Deletes the database located at a specified path or the default location. Typically used for resetting or cleaning up the database environment in testing scenarios.



Instance Methods #

upsert(String key, ShroomData data):

Inserts or updates a piece of data identified by the key within this Shroom instance. Allows for dynamic data management.


delete():

Deletes this Shroom instance from the database, removing all its stored data.


remove(String key):

Removes the data associated with the specified key from this Shroom instance, useful for deleting specific entries without affecting the entire dataset.



Usage Example #
Below is an example demonstrating the creation of a Shroom, updating data, removing a specific data entry, and general cleanup:
import 'package:shroom/shroom.dart';

void main() {
// Initialize the database
Shroom.initDB();

// Create a new Shroom instance
var shroom = Shroom.create(name: 'example');
shroom.upsert('description', ShroomData('string', 'A simple example of using Shroom'));
shroom.upsert('type', ShroomData('string', 'educational'));

// Retrieve the Shroom by name (assuming `name` is a unique identifier)
var retrievedShroom = Shroom.get(name: 'example');
print('Retrieved Shroom: ${retrievedShroom.data}');

// Remove the 'type' data entry
retrievedShroom.remove('type');
print('Updated Shroom data after removal: ${retrievedShroom.data}');

// Cleanup the instance
retrievedShroom.delete();

// Optionally, delete the database when done
Shroom.deleteDB();
}
copied to clipboard
Supported Data Types #
check ShroomData Dart File
and Schema SQL File

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator