From 1a2362f6ccd04c2a8e1791112aa2e5b66f0d54ed Mon Sep 17 00:00:00 2001 From: Eric Zhao Date: Wed, 2 Sep 2020 11:31:08 +0800 Subject: [PATCH] Add package-level document for api and adapter/micro package Signed-off-by: Eric Zhao --- adapter/micro/doc.go | 21 +++++++++++++++++++++ api/api.go | 1 + 2 files changed, 22 insertions(+) create mode 100644 adapter/micro/doc.go diff --git a/adapter/micro/doc.go b/adapter/micro/doc.go new file mode 100644 index 000000000..124957364 --- /dev/null +++ b/adapter/micro/doc.go @@ -0,0 +1,21 @@ +/* +This package provides Sentinel integration for go-micro. + +For server side, users may append a Sentinel handler wrapper to go-micro service, like: + + import ( + sentinelPlugin "github.com/alibaba/sentinel-golang/adapter/micro" + ) + + // Append a Sentinel handler wrapper. + micro.NewService(micro.WrapHandler(sentinelPlugin.NewHandlerWrapper())) + +The plugin extracts service method as the resource name by default. +Users may provide customized resource name extractor when creating new +Sentinel handler wrapper (via options). + +Fallback logic: the plugin will return the BlockError by default +if current request is blocked by Sentinel rules. Users may also +provide customized fallback logic via WithXxxBlockFallback(handler) options. +*/ +package micro diff --git a/api/api.go b/api/api.go index 55c8f2fae..569deb35c 100644 --- a/api/api.go +++ b/api/api.go @@ -1,3 +1,4 @@ +// Package api provides fundamental APIs of Sentinel. package api import (