{"modulePath":"github.com/kptdev/kpt","version":"v1.0.0-beta.60","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package function\n\n## Constants\n\n```go\nconst CatalogV2 = \"__catalog_v2\"\n```\nCatalogV2 is the an invalid namespace used to build catalog function into the porch v1alpha1.function struct. This namespace distinguishes catalog function from porch functions. This will be trimmed before showing to users.\n\n## Functions\n\n```go\nfunc CatalogFunction(name string, keywords []string, fnTypes []v1alpha1.FunctionType) v1alpha1.Function\n```\nCatalogFunction converts catalog function into the porch v1alpha1.function struct.\n\n```go\nfunc GetNames(functions []v1alpha1.Function) []string\n```\nGetNames returns the list of function names. - Porch function name is \\\u003cPackageRepository\u003e:\\\u003cImageName\u003e:\\\u003cVersion\u003e. e.g. kpt-functions:set-annotations:latest - Catalog v2 function name is trimed to only contain \\\u003cImageName\u003e:\\\u003cVersion\u003e, and exclude ghcr.io/kptdev/krm-functions-catalog. e.g. set-annotations:latest\n\n```go\nfunc MatchFunctions(functions []v1alpha1.Function, matchers ...Matcher) []v1alpha1.Function\n```\n\n## Types\n\n```go\ntype KeywordsMatcher struct {\n\tKeywords []string\n}\n```\n\n```go\nfunc (m KeywordsMatcher) Match(function v1alpha1.Function) bool\n```\nMatch determines whether the \\`function\\` has keywords which match the matcher's \\`Keywords\\`. Experimental: This logic may change to only if all function keywords are found from  matcher's \\`Keywords\\`, can it claims a match (return true).\n\n```go\ntype Matcher interface {\n\tMatch(v1alpha1.Function) bool\n}\n```\n\n```go\ntype TypeMatcher struct {\n\tFnType string\n}\n```\n\n```go\nfunc (m TypeMatcher) Match(function v1alpha1.Function) bool\n```\nMatch determines whether the \\`function\\` (which can be multi-typed), belongs to the matcher's FnType. type value should only be \\`validator\\` or \\`mutator\\`.\n\n","path":"github.com/kptdev/kpt/internal/util/function","name":"function","synopsis":"","isRedistributable":true}
