Documentation
¶
Index ¶
- Constants
- Variables
- func GetLocalIp() string
- func IsEquals(left *URL, right *URL, excludes ...string) bool
- func ServiceKey(intf string, group string, version string) string
- func SetCompareURLEqualFunc(f CompareURLEqualFunc)
- type AsyncCallback
- type AsyncCallbackService
- type CallbackResponse
- type CompareURLEqualFunc
- type MethodType
- type Node
- type Option
- func WithIp(ip string) Option
- func WithLocation(location string) Option
- func WithMethods(methods []string) Option
- func WithParams(params url.Values) Option
- func WithParamsValue(key, val string) Option
- func WithPassword(pwd string) Option
- func WithPath(path string) Option
- func WithPort(port string) Option
- func WithProtocol(proto string) Option
- func WithToken(token string) Option
- func WithUsername(username string) Option
- type RPCService
- type RoleType
- type Service
- type URL
- func (c *URL) AddParam(key string, value string)
- func (c *URL) AddParamAvoidNil(key string, value string)
- func (c *URL) Clone() *URL
- func (c *URL) CloneExceptParams(excludeParams *gxset.HashSet) *URL
- func (c *URL) CloneWithParams(reserveParams []string) *URL
- func (c *URL) ColonSeparatedKey() string
- func (c *URL) Compare(comp cm.Comparator) int
- func (c *URL) DelParam(key string)
- func (c *URL) EncodedServiceKey() string
- func (c *URL) GetCacheInvokerMapKey() string
- func (c *URL) GetMethodParam(method string, key string, d string) string
- func (c *URL) GetMethodParamBool(method string, key string, d bool) bool
- func (c *URL) GetMethodParamInt(method string, key string, d int64) int64
- func (c *URL) GetMethodParamInt64(method string, key string, d int64) int64
- func (c *URL) GetMethodParamIntValue(method string, key string, d int) int
- func (c *URL) GetParam(s string, d string) string
- func (c *URL) GetParamAndDecoded(key string) (string, error)
- func (c *URL) GetParamBool(key string, d bool) bool
- func (c *URL) GetParamByIntValue(key string, d int) int
- func (c *URL) GetParamDuration(s string, d string) time.Duration
- func (c *URL) GetParamInt(key string, d int64) int64
- func (c *URL) GetParamInt32(key string, d int32) int32
- func (c *URL) GetParams() url.Values
- func (c *URL) GetRawParam(key string) string
- func (c *URL) Key() string
- func (c *URL) RangeParams(f func(key, value string) bool)
- func (c *URL) ReplaceParams(param url.Values)
- func (c *URL) Service() string
- func (c *URL) ServiceKey() string
- func (c *URL) SetParam(key string, value string)
- func (c *URL) SetParams(m url.Values)
- func (c *URL) String() string
- func (c *URL) ToMap() map[string]string
- func (c *URL) URLEqual(url *URL) bool
- type URLSlice
Constants ¶
const ( // CONSUMER is consumer role CONSUMER = iota // CONFIGURATOR is configurator role CONFIGURATOR // ROUTER is router role ROUTER // PROVIDER is provider role PROVIDER PROTOCOL = "protocol" )
/////////////////////////////// dubbo role type /////////////////////////////// role constant
const (
METHOD_MAPPER = "MethodMapper"
)
for lowercase func
func MethodMapper() map[string][string] { return map[string][string]{} }
Variables ¶
var ( // DubboNodes Dubbo service node DubboNodes = [...]string{"consumers", "configurators", "routers", "providers"} // DubboRole Dubbo service role DubboRole = [...]string{"consumer", "", "routers", "provider"} )
Functions ¶
func GetLocalIp ¶
func GetLocalIp() string
func IsEquals ¶
IsEquals compares if two URLs equals with each other. Excludes are all parameter keys which should ignored.
func SetCompareURLEqualFunc ¶
func SetCompareURLEqualFunc(f CompareURLEqualFunc)
Types ¶
type AsyncCallback ¶
type AsyncCallback func(response CallbackResponse)
AsyncCallback async callback method
type AsyncCallbackService ¶
type AsyncCallbackService interface { // Callback: callback CallBack(response CallbackResponse) }
AsyncCallbackService callback interface for async
type CompareURLEqualFunc ¶
func GetCompareURLEqualFunc ¶
func GetCompareURLEqualFunc() CompareURLEqualFunc
type MethodType ¶
type MethodType struct {
// contains filtered or unexported fields
}
MethodType is description of service method.
func (*MethodType) ArgsType ¶
func (m *MethodType) ArgsType() []reflect.Type
ArgsType gets @m.argsType.
func (*MethodType) ReplyType ¶
func (m *MethodType) ReplyType() reflect.Type
ReplyType gets @m.replyType.
func (*MethodType) SuiteContext ¶
func (m *MethodType) SuiteContext(ctx context.Context) reflect.Value
SuiteContext transfers @ctx to reflect.Value type or get it from @m.ctxType.
type Option ¶
type Option func(*URL)
Option accepts url Option will define a function of handling URL
func WithParamsValue ¶
WithParamsValue sets params field for url
type RPCService ¶
type RPCService interface { // Reference: // rpc service id or reference id Reference() string }
RPCService rpc service interface
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is description of service
type URL ¶
type URL struct { Path string // like /com.ikurento.dubbo.UserProvider Username string Password string Methods []string // special for registry SubURL *URL // contains filtered or unexported fields }
URL thread-safe. but this url should not be copied. we fail to define this struct to be immutable object. but, those method which will update the URL, including SetParam, SetParams are only allowed to be invoked in creating URL instance Please keep in mind that this struct is immutable after it has been created and initialized.
func MergeUrl ¶
MergeUrl will merge those two url the result is based on serviceUrl, and the key which si only contained in referenceUrl will be added into result. for example, if serviceUrl contains params (a1->v1, b1->v2) and referenceUrl contains params(a2->v3, b1 -> v4) the params of result will be (a1->v1, b1->v2, a2->v3). You should notice that the value of b1 is v2, not v4. due to URL is not thread-safe, so this method is not thread-safe
func NewURLWithOptions ¶
NewURLWithOptions will create a new url with options
func (*URL) AddParamAvoidNil ¶
AddParamAvoidNil will add key-value pair
func (*URL) CloneWithParams ¶
Copy url based on the reserved parameter's keys.
func (*URL) ColonSeparatedKey ¶
ColonSeparatedKey The format is "{interface}:[version]:[group]"
func (*URL) EncodedServiceKey ¶
EncodedServiceKey encode the service key
func (*URL) GetCacheInvokerMapKey ¶
GetCacheInvokerMapKey get directory cacheInvokerMap key
func (*URL) GetMethodParam ¶
GetMethodParam gets method param
func (*URL) GetMethodParamBool ¶
GetMethodParamBool judge whether @method param exists or not
func (*URL) GetMethodParamInt ¶
GetMethodParamInt gets int method param
func (*URL) GetMethodParamInt64 ¶
GetMethodParamInt64 gets int64 method param
func (*URL) GetMethodParamIntValue ¶
GetMethodParamIntValue gets int method param
func (*URL) GetParamAndDecoded ¶
GetParamAndDecoded gets values and decode
func (*URL) GetParamBool ¶
GetParamBool judge whether @key exists or not
func (*URL) GetParamByIntValue ¶
GetParamByIntValue gets int value by @key
func (*URL) GetParamDuration ¶
GetParamDuration get duration if param is invalid or missing will return 3s
func (*URL) GetParamInt ¶
GetParamInt gets int64 value by @key
func (*URL) GetParamInt32 ¶
GetParamInt32 gets int32 value by @key
func (*URL) RangeParams ¶
RangeParams will iterate the params
func (*URL) ReplaceParams ¶
ReplaceParams will replace the URL.params usually it should only be invoked when you want to modify an url, such as MergeURL
func (*URL) ServiceKey ¶
ServiceKey gets a unique key of a service.
func (*URL) SetParam ¶
SetParam will put the key-value pair into url usually it should only be invoked when you want to initialized an url