Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor HandlerFunc to accept a params struct containing all values & functions instead of an instance of EchoVault interface #32

Merged
merged 6 commits into from
Apr 25, 2024

Conversation

kelvinmwinuka
Copy link
Collaborator

@kelvinmwinuka kelvinmwinuka commented Apr 25, 2024

This change refactors the HandlerFunc implementation to accept a HandlerFuncParams struct containing all the objects and functions invoked within the handler.

This removes the dependence on the echovault package within the modules' packages and has allowed the entire modules folder to be moved from /pkg to /internal. We no longer have to deal with unnecessary exports of anything in the modules folder.

This new parameter structure is also a prelude to incorporating .so plugin extensions and command extensions via the embedded API.

The exported EchoVault instance now only contains keyspace methods. All other methods are private and are passed to the commands handlers via the params struct.

…pass a struct of params containing all the variables and functions used within the handler function. This removes the modules' dependency on the echovault package. Moved string command and api tests to test/modules/string
…. Moved /modules from /pkg to /internal. Delted commands package: Commands will now be automatically loaded when an EchoVault instance is initialised.
…All other methods are private. Private methods are accessed using the reflect package in the test folder
@kelvinmwinuka kelvinmwinuka self-assigned this Apr 25, 2024
@kelvinmwinuka kelvinmwinuka merged commit 8be29f7 into main Apr 25, 2024
1 check passed
@kelvinmwinuka kelvinmwinuka deleted the refactor/handler-params branch June 15, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor command modules to use dependency injection of required parameters for command handlers
1 participant