Documentation ¶
Index ¶
- Constants
- Variables
- func IsEquals(left URL, right URL, excludes ...string) bool
- func ServiceKey(intf string, group string, version string) string
- 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 AsyncCallback
- type AsyncCallbackService
- type CallbackResponse
- type MethodType
- type Node
- 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) EncodedServiceKey() 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) 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) GetParamInt(key string, d int64) int64
- 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) 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" )
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 IsEquals ¶ added in v1.5.3
IsEquals compares if two URLs equals with each other. Excludes are all parameter keys which should ignored.
func WithLocation ¶ added in v1.2.0
func WithLocation(location string) option
WithLocation sets location for url
func WithParamsValue ¶
func WithParamsValue(key, val string) option
WithParamsValue sets params field for url
Types ¶
type AsyncCallback ¶ added in v1.3.0
type AsyncCallback func(response CallbackResponse)
AsyncCallback async callback method
type AsyncCallbackService ¶ added in v1.3.0
type AsyncCallbackService interface { // Callback: callback CallBack(response CallbackResponse) }
AsyncCallbackService callback interface for async
type CallbackResponse ¶ added in v1.3.0
type CallbackResponse interface{}
CallbackResponse for different protocol
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 tranfers @ctx to reflect.Value type or get it from @m.ctxType.
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.UserProvider3 Username string Password string Methods []string // special for registry SubURL *URL // contains filtered or unexported fields }
URL is not thread-safe. 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 ¶
func NewURLWithOptions(opts ...option) *URL
NewURLWithOptions will create a new url with options
func (*URL) AddParam ¶
AddParam will add the key-value pair Not thread-safe think twice before using it.
func (*URL) AddParamAvoidNil ¶ added in v1.5.3
AddParamAvoidNil will add key-value pair Not thread-safe think twice before using it.
func (*URL) CloneExceptParams ¶ added in v1.5.0
func (*URL) CloneWithParams ¶ added in v1.5.0
Copy url based on the reserved parameter's keys.
func (*URL) ColonSeparatedKey ¶ added in v1.4.0
ColonSeparatedKey The format is "{interface}:[version]:[group]"
func (*URL) EncodedServiceKey ¶ added in v1.2.0
EncodedServiceKey encode the service key
func (URL) GetMethodParam ¶
GetMethodParam gets method param
func (URL) GetMethodParamBool ¶ added in v1.3.0
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) GetParamAndDecoded ¶
GetParamAndDecoded gets values and decode
func (URL) GetParamBool ¶
GetParamBool judge whether @key exists or not
func (URL) GetParamInt ¶
GetParamInt gets int value by @key
func (*URL) RangeParams ¶ added in v1.2.0
RangeParams will iterate the params it's not thread-safe
func (*URL) SetParam ¶ added in v1.2.0
SetParam will put the key-value pair into url it's not thread safe. think twice before you want to use this method usually it should only be invoked when you want to initialized an url