How to create a registry
File Naming Conventions
{{registry_name}}.go
: This file defines the registry, including key components like structs, interfaces, constants, and variables.functions.go
: Contains the implementation of exported functions, making them accessible to other developers.functions_test.go
: Includes tests for the exported functions to ensure they function as expected.helpers.go
: Contains internal helper functions that support the registry but are not exposed for public use.helpers_test.go
: Holds tests for the helper functions to validate their reliability.
This structure ensures consistency and maintainability across different registries, making it easier for developers to contribute and collaborate effectively.
Creating a Registry
New Repository: You can start by creating a new repository on your GitHub account or organization. This will house your registry functions.
Contributing to Official Registry: To add your functions to the official registry, submit a pull request (PR). The official registries are organized under the
registry/
folder.
You can found an example of a registry under registry/_example
.
To start, in your {{registry_name}}.go
file, start by creating a struct that implements the Registry
interface. This struct will manage your custom functions and connect them to the handler.
After create your registry structure and implement the Registry
interface, you can start to define your functions in functions.go
, you can access all features of the handler through
Important: Make sure to write tests for your functions in functions_test.go
to validate their functionality.
Once your registry is defined and functions are implemented, you can start using it in your projects. 🎉
Last updated