🌱
Sprout
Github
  • About
  • Roadmap to Sprout v1.0
  • Migration from Sprig
  • Introduction
    • Getting Started
    • Templating Conventions
  • Features
    • Loader System (Registry)
    • Loader System (Registry Group)
    • Function Aliases
    • Function Notices
    • Safe Functions
  • Registries
    • List of all registries
    • Backward
    • Checksum
    • Conversion
    • Crypto
    • Encoding
    • Env
    • Filesystem
    • Maps
    • Numeric
    • Network
    • Random
    • Reflect
    • Regexp
    • SemVer
    • Slices
    • Std
    • Strings
    • Time
    • Uniqueid
  • Groups
    • List of all registry groups
    • All
    • Hermetic
  • Advanced
    • How to create a handler
    • How to create a registry
    • How to create a registry group
  • Links
    • GitHub repository
Powered by GitBook
On this page
  • Introduction
  • How to use a registry group
  • How to create a registry group
Edit on GitHub
  1. Features

Loader System (Registry Group)

Managing multiple registries can be simplified with RegistryGroup feature.

Introduction

The RegistryGroup struct enables the grouping of multiple registries, simplifying their management and enhancing modularity within the Handler. This approach promotes cleaner code organization and facilitates the reuse of registry configurations across different projects.

Considerations

Using a RegistryGroup can help you manage multiple registries. But can lead to registering undesired functions if you are not careful. Be sure to review the functions in each registry to avoid conflicts or unexpected behavior.

How to use a registry group

If you have created a RegistryGroup or want to use a built-in group, you can add it to your handler using the AddGroups method:

err := handler.AddGroups(group1, group2)
if err != nil {
  // Handle error
}

You can also use the option to add registries when initializing the handler:

handler := sprout.New(
  sprout.WithGroups(group1, group2),
)

In this example, group1 and group2 are added to the handler, allowing all registries within these groups to be registered collectively.

How to create a registry group

To show how to create your own registry group, go to How to create a registry group

PreviousLoader System (Registry)NextFunction Aliases

Last updated 6 months ago