Documentation
¶
Overview ¶
Package internal is a generated GoMock package.
Index ¶
- func IsBeanReceiver(t reflect.Type) bool
- func IsBeanType(t reflect.Type) bool
- func TypeName(i interface{}) string
- func TypeOf(i interface{}) reflect.Type
- type BeanDefinition
- type BeanSelector
- type MockBeanDefinition
- func (m *MockBeanDefinition) BeanName() string
- func (m *MockBeanDefinition) Created() bool
- func (m *MockBeanDefinition) EXPECT() *MockBeanDefinitionMockRecorder
- func (m *MockBeanDefinition) ID() string
- func (m *MockBeanDefinition) Interface() interface{}
- func (m *MockBeanDefinition) Type() reflect.Type
- func (m *MockBeanDefinition) TypeName() string
- func (m *MockBeanDefinition) Value() reflect.Value
- func (m *MockBeanDefinition) Wired() bool
- type MockBeanDefinitionMockRecorder
- func (mr *MockBeanDefinitionMockRecorder) BeanName() *gomock.Call
- func (mr *MockBeanDefinitionMockRecorder) Created() *gomock.Call
- func (mr *MockBeanDefinitionMockRecorder) ID() *gomock.Call
- func (mr *MockBeanDefinitionMockRecorder) Interface() *gomock.Call
- func (mr *MockBeanDefinitionMockRecorder) Type() *gomock.Call
- func (mr *MockBeanDefinitionMockRecorder) TypeName() *gomock.Call
- func (mr *MockBeanDefinitionMockRecorder) Value() *gomock.Call
- func (mr *MockBeanDefinitionMockRecorder) Wired() *gomock.Call
- type MockBeanSelector
- type MockBeanSelectorMockRecorder
- type RefreshArg
- type RefreshOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBeanReceiver ¶
IsBeanReceiver 返回是否是合法的 bean receiver 类型。顾名思义,bean receiver 类型就是指可以保存 bean 地址的类型。除了 ptr、interface、chan、func 四种单体类 型可以承载对应的 bean 类型之外,它们的集合类型,即 map、slice、array 类型,也是 合法的 bean receiver 类型。它们应用于以单体方式注册 bean 然后以集合方式收集 bean 的场景。
func IsBeanType ¶
IsBeanType 返回是否是 bean 类型。在 go-spring 里,变量的类型分为三种: bean 类 型、value(值) 类型以及其他类型。如果一个变量赋值给另一个变量后二者指向相同的内存地 址,则称这个变量的类型为 bean 类型,反之则称为 value(值) 类型。根据这个定义,只有 ptr、interface、chan、func 这四种类型是 bean 类型。 可能有人会问,上述四种类型的集合类型如 []interface、map[string]*struct 等也是 bean 类型吗?根据 go-spring 的定义,它们不是合法的 bean 类型,但是它们是合法的 bean receiver 类型。那为什么没有把他们也定义为 bean 类型呢?因为如果是切片类型, 那么可以转换为注册切片的元素同时加上 order 排序,如果是 map 类型,那么很显然可以转 换为依次注册 map 的元素。 另外,ptr 一般指一层指针,因为多层指针在 web 开发中很少用到,甚至应该在纯业务代码中 禁止使用多层指针。
func TypeName ¶
func TypeName(i interface{}) string
TypeName 返回原始类型的全限定名,类型的全限定名用于严格区分相同名称的 bean 对象。 类型的全限定名是指包的全路径加上类型名称,例如,gs 包里面的 Container 类型,它的 类型全限定名是 github.com/go-spring/spring-core/gs/gs.Container。因为 go 语言允许在不同的路径下存在名称相同的包,所以有可能出现(简单)类型名称相同、实例名称 相同的但实际上类型不相同的 bean 对象,因此有类型的全限定名这样的概念,用以严格区分 同名的 bean 对象。
Types ¶
type BeanDefinition ¶
type BeanDefinition interface {
Type() reflect.Type // 类型
Value() reflect.Value // 值
Interface() interface{} // 源
ID() string // 返回 bean 的 ID
BeanName() string // 返回 bean 的名称
TypeName() string // 返回类型的全限定名
Created() bool // 返回是否已创建
Wired() bool // 返回是否已注入
}
BeanDefinition bean 元数据。
type BeanSelector ¶
type BeanSelector interface{}
BeanSelector bean 选择器,可以是 bean ID 字符串,可 以是 reflect.Type 对象,可以是形如 (*error)(nil) 的指针,还可以是 Definition 类型的对象。
type MockBeanDefinition ¶
type MockBeanDefinition struct {
// contains filtered or unexported fields
}
MockBeanDefinition is a mock of BeanDefinition interface.
func NewMockBeanDefinition ¶
func NewMockBeanDefinition(ctrl *gomock.Controller) *MockBeanDefinition
NewMockBeanDefinition creates a new mock instance.
func (*MockBeanDefinition) BeanName ¶
func (m *MockBeanDefinition) BeanName() string
BeanName mocks base method.
func (*MockBeanDefinition) Created ¶
func (m *MockBeanDefinition) Created() bool
Created mocks base method.
func (*MockBeanDefinition) EXPECT ¶
func (m *MockBeanDefinition) EXPECT() *MockBeanDefinitionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBeanDefinition) Interface ¶
func (m *MockBeanDefinition) Interface() interface{}
Interface mocks base method.
func (*MockBeanDefinition) Type ¶
func (m *MockBeanDefinition) Type() reflect.Type
Type mocks base method.
func (*MockBeanDefinition) TypeName ¶
func (m *MockBeanDefinition) TypeName() string
TypeName mocks base method.
func (*MockBeanDefinition) Value ¶
func (m *MockBeanDefinition) Value() reflect.Value
Value mocks base method.
func (*MockBeanDefinition) Wired ¶
func (m *MockBeanDefinition) Wired() bool
Wired mocks base method.
type MockBeanDefinitionMockRecorder ¶
type MockBeanDefinitionMockRecorder struct {
// contains filtered or unexported fields
}
MockBeanDefinitionMockRecorder is the mock recorder for MockBeanDefinition.
func (*MockBeanDefinitionMockRecorder) BeanName ¶
func (mr *MockBeanDefinitionMockRecorder) BeanName() *gomock.Call
BeanName indicates an expected call of BeanName.
func (*MockBeanDefinitionMockRecorder) Created ¶
func (mr *MockBeanDefinitionMockRecorder) Created() *gomock.Call
Created indicates an expected call of Created.
func (*MockBeanDefinitionMockRecorder) ID ¶
func (mr *MockBeanDefinitionMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockBeanDefinitionMockRecorder) Interface ¶
func (mr *MockBeanDefinitionMockRecorder) Interface() *gomock.Call
Interface indicates an expected call of Interface.
func (*MockBeanDefinitionMockRecorder) Type ¶
func (mr *MockBeanDefinitionMockRecorder) Type() *gomock.Call
Type indicates an expected call of Type.
func (*MockBeanDefinitionMockRecorder) TypeName ¶
func (mr *MockBeanDefinitionMockRecorder) TypeName() *gomock.Call
TypeName indicates an expected call of TypeName.
func (*MockBeanDefinitionMockRecorder) Value ¶
func (mr *MockBeanDefinitionMockRecorder) Value() *gomock.Call
Value indicates an expected call of Value.
func (*MockBeanDefinitionMockRecorder) Wired ¶
func (mr *MockBeanDefinitionMockRecorder) Wired() *gomock.Call
Wired indicates an expected call of Wired.
type MockBeanSelector ¶
type MockBeanSelector struct {
// contains filtered or unexported fields
}
MockBeanSelector is a mock of BeanSelector interface.
func NewMockBeanSelector ¶
func NewMockBeanSelector(ctrl *gomock.Controller) *MockBeanSelector
NewMockBeanSelector creates a new mock instance.
func (*MockBeanSelector) EXPECT ¶
func (m *MockBeanSelector) EXPECT() *MockBeanSelectorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockBeanSelectorMockRecorder ¶
type MockBeanSelectorMockRecorder struct {
// contains filtered or unexported fields
}
MockBeanSelectorMockRecorder is the mock recorder for MockBeanSelector.
type RefreshArg ¶
type RefreshArg struct {
AutoClear bool
}
type RefreshOption ¶
type RefreshOption func(arg *RefreshArg)
func AutoClear ¶
func AutoClear(enable bool) RefreshOption