INNER CODE UNIT · Go
WithAttachments
alibaba/sentinel-golang · api/api.go:121
func WithAttachments(data map[interface{}]interface{}) EntryOption {
return func(opts *EntryOptions) {
if opts.attachments == nil {
opts.attachments = make(map[interface{}]interface{}, len(data))
}
for key, value := range data {
opts.attachments[key] = value
}
}
}
// Entry is the basic API of Sentinel.
func Entry(resource string, opts ...EntryOption) (*base.SentinelEntry, *base.BlockError) {
options := entryOptsPool.Get().(*EntryOptions)
defer func() {
options.Reset()
entryOptsPool.Put(options)
}()