-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
load extensions during compile time using go build tags (#350)
* load extensions during compile time using go build tags * remove scalar values and Extension struct for local extensions
- Loading branch information
1 parent
037543a
commit 1262229
Showing
15 changed files
with
518 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package extensions | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
) | ||
|
||
type Extension interface { | ||
Name() string | ||
Initialize(ctx context.Context, metadata map[string]string) (map[string]string, error) | ||
Execute(ctx context.Context, metadata map[string]string, method string, args ...any) ([]any, error) | ||
} | ||
|
||
var registeredExtensions = make(map[string]Extension) | ||
|
||
func RegisterExtension(name string, ext Extension) error { | ||
name = strings.ToLower(name) | ||
if _, ok := registeredExtensions[name]; ok { | ||
panic("extension of same name already registered: " + name) | ||
} | ||
|
||
registeredExtensions[name] = ext | ||
return nil | ||
} | ||
|
||
func RegisteredExtensions() map[string]Extension { | ||
return registeredExtensions | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.