Documentation
¶
Index ¶
Constants ¶
View Source
const DEFAULT_DELIMITER = "::"
View Source
const DEFAULT_KEY_DELIMITER = "-"
Variables ¶
View Source
var ErrKeyNotHaveNamespace = errors.New("key没有命名空间")
ErrKeyNotHaveNamespace key没有命名空间
View Source
var ErrKeyParserNamespaceNumberNot2 = errors.New("key分隔出的元素不是2个")
ErrKeyParserNamespaceNumberNot2 key分隔出的元素不是2个
View Source
var ErrParamDelimiterLengthMustLessThan2 = errors.New("不定长参数delimiter长度必须小于2")
ErrParamDelimiterLengthMustLessThan2 不定长参数delimiter长度必须小于2
View Source
var ErrrParamDelimiterCannotEmpty = errors.New("参数delimiter不能为空字符串")
ErrrParamDelimiterCannotEmpty 参数delimiter不能为空字符串
View Source
var ErrrParamEndpointCannotEmpty = errors.New("参数endpoints的元素不能为空字符串")
ErrrParamEndpointCannotEmpty 参数endpoints的元素不能为空字符串
Functions ¶
This section is empty.
Types ¶
type DelimiterOpt ¶
type DelimiterOpt struct { NamespaceDelimiter string NamespaceEndpointsDelimiter string EndpointsDelimiter string }
DelimiterOpt 自定义间隔符的设置
type NameSpcae ¶
type NameSpcae []string
NameSpcae 带命名空间的键
func FromKeyStr ¶
func FromKeyStr(key string, opts ...*DelimiterOpt) (NameSpcae, string, error)
FromKeyStr 从key字符串中解析出命名空间和终点key
func (*NameSpcae) Key ¶
Key 在命名空间基础上创建一个key @params endpoints ...string key的终点字段 如果endpoints长度为0,则将命名空间作为key 如果endpoints长度>=1,则将命名空间使用`::`连接,命名空间和endpoints间使用`::`连接,endpoints间使用`-`分隔
func (*NameSpcae) KeyWithDelimiter ¶
func (n *NameSpcae) KeyWithDelimiter(opt *DelimiterOpt, endpoints ...string) (string, error)
KeyWithDelimiter 在命名空间基础上创建一个key,可以自定义与命名空间间的间隔和endpoints间的空格 @params opt *DelimiterOpt NamespaceDelimiter,NamespaceEndpointsDelimiter,EndpointsDelimiter如果为空字符串则使用默认值
Click to show internal directories.
Click to hide internal directories.