util

package module
v0.0.0-...-27a5818 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2016 License: MIT Imports: 10 Imported by: 3

README

util

basic utility for golang

Documentation

Index

Constants

View Source
const (
	Lifecycle_Singleton = 0
	Lifecycle_Transient = 1
)

Variables

View Source
var ObjectContainer = objectContainer{/* contains filtered or unexported fields */}

对象容器

View Source
var TypeContainer = typeContainer{/* contains filtered or unexported fields */}

类型容器

Functions

func FromPtrType

func FromPtrType(typ reflect.Type) reflect.Type

获取真实类型,而非指针

func FromPtrTypeOf

func FromPtrTypeOf(obj interface{}) reflect.Type

获取真实类型,而非指针

func FromPtrValue

func FromPtrValue(val reflect.Value) reflect.Value

获取真实值,而非指针

func FromPtrValueOf

func FromPtrValueOf(obj interface{}) reflect.Value

获取真实值,而非指针

func GetExecDirPath

func GetExecDirPath() string

获取当前文件执行的路径

func GetExecFilePath

func GetExecFilePath() string

获取当前文件执行的路径

func InvokeOverloadMethod

func InvokeOverloadMethod(obj interface{}, methodName string, params ...interface{}) []reflect.Value

调用重载方法 重载方法的命名规则:MethodNameParamType1_ParamType2

func MarshalObj

func MarshalObj(obj interface{}) ([]byte, error)

序列化 Object

func UnmarshalObj

func UnmarshalObj(data []byte) (interface{}, error)

反序列化 Object

Types

type Initializer

type Initializer interface {
	InitFunc() interface{}
}

构造函数

type TypeInfo

type TypeInfo struct {
	TypeName        string
	TypeMemberInfos []TypeMemberInfo
}

类型信息

func GetTypeInfo

func GetTypeInfo(typ reflect.Type) TypeInfo

获取类型的类型信息

func GetTypeInfoOf

func GetTypeInfoOf(obj interface{}) TypeInfo

获取对象的类型信息

func (TypeInfo) HashCode

func (t TypeInfo) HashCode() uuid.UUID

func (TypeInfo) String

func (self TypeInfo) String() string

type TypeMemberInfo

type TypeMemberInfo struct {
	TypeMemberName     string
	TypeMemberTypeName string
}

类型成员信息

func (TypeMemberInfo) String

func (self TypeMemberInfo) String() string

Jump to

Keyboard shortcuts

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