aboutsummaryrefslogtreecommitdiff
path: root/plugin/metadata/provider.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2019-03-13 07:26:29 +0000
committerGravatar GitHub <noreply@github.com> 2019-03-13 07:26:29 +0000
commitd652f72fa794b6417d46b305f7654f474387b510 (patch)
tree7d98402fb4295b5b25823b777f7f08088cfe6ac4 /plugin/metadata/provider.go
parentd69f97be5ce9a3aae75c4a1e827f4729ea3c6b60 (diff)
downloadcoredns-d652f72fa794b6417d46b305f7654f474387b510.tar.gz
coredns-d652f72fa794b6417d46b305f7654f474387b510.tar.zst
coredns-d652f72fa794b6417d46b305f7654f474387b510.zip
plugin/metadata: tweak the docs a little (#2685)
Add a simpler example that returns a static string the for metadata. Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to '')
-rw-r--r--plugin/metadata/provider.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugin/metadata/provider.go b/plugin/metadata/provider.go
index 9f6978dd2..b22064200 100644
--- a/plugin/metadata/provider.go
+++ b/plugin/metadata/provider.go
@@ -6,7 +6,14 @@
//
// Basic example:
//
-// Implement the Provider interface for a plugin:
+// Implement the Provider interface for a plugin p:
+//
+// func (p P) Metadata(ctx context.Context, state request.Request) context.Context {
+// metadata.SetValueFunc(ctx, "test/something", func() string { return "myvalue" })
+// return ctx
+// }
+//
+// Basic example with caching:
//
// func (p P) Metadata(ctx context.Context, state request.Request) context.Context {
// cached := ""
@@ -21,7 +28,7 @@
// return ctx
// }
//
-// Check the metadata from another plugin:
+// If you need access to this metadata from another plugin:
//
// // ...
// valueFunc := metadata.ValueFunc(ctx, "test/something")