utils

package
v0.0.0-...-bd77e7c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package util is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileLineFromPC

func FileLineFromPC(fn interface{}) (file string, line int, fnName string)

FileLineFromPC returns a function's name, file name and line number.

func HasReceiver

func HasReceiver(t reflect.Type, receiver reflect.Value) bool

HasReceiver returns whether the function has a receiver.

func Indirect

func Indirect(t reflect.Type) reflect.Type

Indirect returns its element type when t is a pointer type.

func IsBeanReceiver

func IsBeanReceiver(t reflect.Type) bool

IsBeanReceiver returns whether the `t` is a bean receiver, a bean receiver can be a bean, a map or slice whose elements are beans.

func IsBeanType

func IsBeanType(t reflect.Type) bool

IsBeanType returns whether `t` is a bean type.

func IsConstructor

func IsConstructor(t reflect.Type) bool

IsConstructor returns whether `t` is a constructor type. What is a constructor? It should be a function first, has any number of inputs and supports the option pattern input, has one or two outputs and the second output should be an error.

func IsContextType

func IsContextType(t reflect.Type) bool

IsContextType returns whether `t` is context.Context type.

func IsConverter

func IsConverter(t reflect.Type) bool

IsConverter returns whether `t` is a converter type.

func IsErrorType

func IsErrorType(t reflect.Type) bool

IsErrorType returns whether `t` is error type.

func IsFuncType

func IsFuncType(t reflect.Type) bool

IsFuncType returns whether `t` is func type.

func IsPrimitiveValueType

func IsPrimitiveValueType(t reflect.Type) bool

IsPrimitiveValueType returns whether `t` is the primitive value type which only is int, unit, float, bool, string and complex.

func IsStructPtr

func IsStructPtr(t reflect.Type) bool

IsStructPtr returns whether it is the pointer type of structure.

func IsValueType

func IsValueType(t reflect.Type) bool

IsValueType returns whether the input type is the primitive value type and their composite type including array, slice, map and struct, such as []int, [3]string, []string, map[int]int, map[string]string, etc.

func Keys

func Keys(i interface{}) []string

Keys returns the keys of the map m in indeterminate order.

func PatchValue

func PatchValue(v reflect.Value) reflect.Value

PatchValue makes an unexported field can be assignable.

func ReturnNothing

func ReturnNothing(t reflect.Type) bool

ReturnNothing returns whether the function has no return value.

func ReturnOnlyError

func ReturnOnlyError(t reflect.Type) bool

ReturnOnlyError returns whether the function returns only error value.

func SortedKeys

func SortedKeys(i interface{}) []string

SortedKeys returns the keys of the map m in sorted order.

func TypeName

func TypeName(i interface{}) string

TypeName returns a fully qualified name consisting of package path and type name.

Types

type BeanDefinition

type BeanDefinition interface {
	Type() reflect.Type
	Value() reflect.Value
	Interface() interface{}
	ID() string
	BeanName() string
	TypeName() string
	Created() bool
	Wired() bool
}

A BeanDefinition describes a bean whose lifecycle is managed by IoC container.

type BeanSelector

type BeanSelector interface{}

A BeanSelector can be the ID of a bean, a `reflect.Type`, a pointer such as `(*error)(nil)`, or a BeanDefinition value.

type Converter

type Converter interface{}

Converter converts string value into user-defined value. It should be function type, and its prototype is func(string)(type,error).

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

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBeanDefinition) ID

func (m *MockBeanDefinition) ID() string

ID mocks base method.

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

Created indicates an expected call of Created.

func (*MockBeanDefinitionMockRecorder) ID

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

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

Value indicates an expected call of Value.

func (*MockBeanDefinitionMockRecorder) Wired

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

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 MockConverter

type MockConverter struct {
	// contains filtered or unexported fields
}

MockConverter is a mock of Converter interface.

func NewMockConverter

func NewMockConverter(ctrl *gomock.Controller) *MockConverter

NewMockConverter creates a new mock instance.

func (*MockConverter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockConverterMockRecorder

type MockConverterMockRecorder struct {
	// contains filtered or unexported fields
}

MockConverterMockRecorder is the mock recorder for MockConverter.

type PanicCond

type PanicCond struct {
	// contains filtered or unexported fields
}

PanicCond panic condition.

func NewPanicCond

func NewPanicCond(fn func() interface{}) *PanicCond

NewPanicCond returns a panic condition.

func Panic

func Panic(err interface{}) *PanicCond

Panic returns a panic condition that throws an error.

func Panicf

func Panicf(format string, a ...interface{}) *PanicCond

Panicf returns a panic condition that throws a formatted error.

func (*PanicCond) When

func (p *PanicCond) When(isPanic bool)

When throws a panic when `isPanic` is true.

Directories

Path Synopsis
Package assert provides some useful assertion methods.
Package assert provides some useful assertion methods.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL