goo

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: Apache-2.0 Imports: 9 Imported by: 4

README

GOO

Gopher Artwork

Go Report Card codecov Build Status Gitter

Goo is a reflection library written in Go, which provides an abstraction for built-in reflection api in GoLang. Thanks to the abstraction which is provided, it make reflection easier. Unlike built-in reflection api, it is easy to use and understand.

If you want to contribute to library or find a bug, please report.

Which projects uses

  • Procyon Framework written in Go uses it during development, which is a Http Web Framework

License

Goo Library is released under version 2.0 of the Apache License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array interface {
	Type
	Instantiable
	GetElementType() Type
	GetLength() int
}

type BitSize

type BitSize int
const (
	BitSize8   BitSize = 8
	BitSize16  BitSize = 16
	BitSize32  BitSize = 32
	BitSize64  BitSize = 64
	BitSize128 BitSize = 128
)

type Boolean

type Boolean interface {
	Type
	Instantiable
	ToBoolean(value string) bool
	ToString(value bool) string
}

type Complex

type Complex interface {
	Number
	GetImaginaryData(val interface{}) interface{}
	GetRealData(val interface{}) interface{}
}

type Exportable

type Exportable interface {
	IsExported() bool
}

type Field

type Field interface {
	Member
	Taggable
	IsAnonymous() bool
	GetType() Type
	CanSet() bool
	SetValue(instance interface{}, value interface{})
	GetValue(instance interface{}) interface{}
}

type Float

type Float interface {
	Number
}

type Function

type Function interface {
	Type
	GetFunctionParameterTypes() []Type
	GetFunctionParameterCount() int
	GetFunctionReturnTypes() []Type
	GetFunctionReturnTypeCount() int
	Call(args []interface{}) []interface{}
}

type Instantiable

type Instantiable interface {
	NewInstance() interface{}
}

type Integer

type Integer interface {
	Number
	IsSigned() bool
}

type Interface

type Interface interface {
	Type
	GetMethods() []Method
	GetMethodCount() int
}

type Invokable

type Invokable interface {
	Invoke(obj interface{}, args ...interface{}) []interface{}
}

type Map

type Map interface {
	Type
	Instantiable
	GetKeyType() Type
	GetValueType() Type
}

type Member

type Member interface {
	Exportable
	GetName() string
	String() string
}

type Method

type Method interface {
	Member
	Invokable
	GetMethodReturnTypeCount() int
	GetMethodReturnTypes() []Type
	GetMethodParameterCount() int
	GetMethodParameterTypes() []Type
}

type Number

type Number interface {
	Type
	Instantiable
	GetType() NumberType
	GetBitSize() BitSize
	Overflow(val interface{}) bool
	ToString(val interface{}) string
}

type NumberType

type NumberType int
const (
	IntegerType NumberType = iota
	FloatType
	ComplexType
)

type Slice

type Slice interface {
	Type
	Instantiable
	GetElementType() Type
}

type String

type String interface {
	Type
	Instantiable
	ToNumber(val string, number Number) (interface{}, error)
	ToInt(val string) int
	ToInt8(val string) int8
	ToInt16(val string) int16
	ToInt32(val string) int32
	ToInt64(val string) int64
	ToUint(val string) uint
	ToUint8(val string) uint8
	ToUint16(val string) uint16
	ToUint32(val string) uint32
	ToUint64(val string) uint64
	ToFloat32(val string) float32
	ToFloat64(val string) float64
}

type Struct

type Struct interface {
	Type
	Instantiable
	GetFields() []Field
	GetFieldCount() int
	GetExportedFields() []Field
	GetExportedFieldCount() int
	GetUnexportedFields() []Field
	GetUnexportedFieldCount() int
	GetAnonymousFields() []Field
	GetAnonymousFieldCount() int
	GetStructMethods() []Method
	GetStructMethodCount() int
	Implements(i Interface) bool
	EmbeddedStruct(candidate Struct) bool
}

type Tag

type Tag struct {
	Name  string
	Value string
}

func (Tag) String

func (tag Tag) String() string

type Taggable

type Taggable interface {
	GetTags() []Tag
	GetTagByName(name string) (Tag, error)
}

type Type

type Type interface {
	TypeConverter
	GetName() string
	GetFullName() string
	GetPackageName() string
	GetPackageFullName() string
	GetGoPointerType() reflect.Type
	GetGoPointerValue() reflect.Value
	GetGoType() reflect.Type
	GetGoValue() reflect.Value
	IsPointer() bool
	IsInstantiable() bool
	String() string
	Equals(anotherType Type) bool
}

func GetType

func GetType(obj interface{}) Type

type TypeConverter

type TypeConverter interface {
	IsBoolean() bool
	IsNumber() bool
	IsFunction() bool
	IsStruct() bool
	IsInterface() bool
	IsString() bool
	IsMap() bool
	IsArray() bool
	IsSlice() bool
	ToBooleanType() Boolean
	ToNumberType() Number
	ToFunctionType() Function
	ToStructType() Struct
	ToInterfaceType() Interface
	ToStringType() String
	ToMapType() Map
	ToArrayType() Array
	ToSliceType() Slice
}

Jump to

Keyboard shortcuts

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