- Introduction
- Installation
- Getting Started
- Supported Operations
- Usage
- Sample Plugin
- Additional Information
This documentation provides instructions for using the "Action Entity" class in your JavaScript project. "Action Entity" is a powerful utility for database/resource operations when coupled with a compatible plugin.
Before using "Action Entity," you need to include it in your project. You can install it via different methods.
Include the "Action Entity" library in your HTML file using a <script>
tag:
<script src="path/to/actionEntity.js"></script>
<script>
// To create an instance of Action Entity, you need to provide a compatible plugin.
// Example plugin initialization
const plugin = new ActionPlugin();
const ae = new ActionEntity(plugin);
</script>
- Import the module in your HTML file using a
<script type="module">
tag:
<script type="module">
import ActionEntity from "/path/to/actionEntity.js";
import ActionPlugin from "/path/to/actionPlugin.js";
// Create an instance of the Action Plugin
const plugin = new ActionPlugin();
// Create an instance of Action Entity with the plugin
const ae = new ActionEntity(plugin);
</script>
- Require the module in your JavaScript file:
const ActionEntity = require("action-entity");
const ActionPlugin = require("action-plugin");
- Ensure the plugin is correctly configured and available.
// Create an instance of the Action Plugin
const plugin = new ActionPlugin();
// Create an instance of Action Entity with the plugin
const ae = new ActionEntity(plugin);
Before you can use "Action Entity," you must configure and provide a compatible plugin.
"Action Entity" relies on a plugin for database/resource interaction. Ensure that the plugin is correctly configured and available. You can create an instance of the plugin and pass it to the "Action Entity" constructor, as shown in the usage examples.
The "Action Entity" class supports various database operations, including:
-
create
: Create a new record in the database/resource. -
insert
: Insert data into the database/resource. -
insertOne
: Insert one data item into the database/resource. -
get
: Retrieve data from the database/resource. -
getOne
: Retrieve one data item from the database/resource. -
update
: Update data in the database/resource. -
updateOne
: Update one data item in the database/resource. -
delete
: Delete data from the database/resource. -
deleteOne
: Delete one data item from the database/resource. -
append
: Append data to a resource.
These operations require a correctly configured and available plugin for database/resource interaction. Without the plugin, "Action Entity" will not function as expected.
Once you have imported the "Action Entity" class and created an instance with a plugin, you can start using it for various database operations. Here are four usage cases:
Include the "Action Entity" library using a <script>
tag and ensure the plugin is correctly configured and available.
<script src="path/to/actionEntity.js"></script>
<script src="path/to/actionPlugin.js"></script>
<script>
// Create an instance of the Action Plugin
const plugin = new ActionPlugin();
// Create an instance of Action Entity with the plugin
const ae = new ActionEntity(plugin);
</script>
- Import the module in your HTML file using a
<script type="module">
tag:
<script type="module">
import ActionEntity from "/path/to/actionEntity.js";
import ActionPlugin from "/path/to/actionPlugin.js";
// Create an instance of the Action Plugin
const plugin = new ActionPlugin();
// Create an instance of Action Entity with the plugin
const ae = new ActionEntity(plugin);
</script>
-
Require the module in your JavaScript file:
const ActionEntity = require("action-entity"); const ActionPlugin = require("action-plugin");
-
Ensure the plugin is correctly configured and available.
// Create an instance of the Action Plugin
const plugin = new ActionPlugin();
// Create an instance of Action Entity with the plugin
const ae = new ActionEntity(plugin);
import ActionEntity from "action-entity";
// Create an 'ae' instance without a plugin
const ae = new ActionEntity();
// The 'ae' instance will not work for database operations without a compatible plugin
You can create a custom plugin for your specific database/resource. Below is an example of a simple plugin:
class ActionPlugin {
constructor() {
// Your plugin initialization logic here
}
// Define your plugin methods for create, insert, get, update, and delete
}
module.exports = ActionPlugin;
For more information and detailed documentation, please refer to the official repository or documentation provided with the "Action Entity" library.
- Repository: Link to the Action Entity Repository
This project is licensed under the MIT License - see the LICENSE.md file for details.