cache

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache is structs' cache.

func New

func New(tagName string) *Cache

New creates structs Cache.

func (*Cache) Get

func (c *Cache) Get(i interface{}) Struct

Get returns struct fields info.

func (*Cache) GetByType

func (c *Cache) GetByType(t reflect.Type) Struct

GetByType returns struct fields info.

type Field

type Field struct {
	Type       reflect.Type
	Name       string
	Anonymous  bool
	Offset     uintptr
	ParentName string
}

Field info.

type Struct

type Struct struct {
	Fields []Field
	Names  map[string]Field
}

Struct fields info.

func NewStruct

func NewStruct(t reflect.Type, tagName string) Struct

NewStruct inits the new struct info.

func (Struct) Field

func (s Struct) Field(i int) Field

Field returns a struct type's i'th field. It panics if i is not in the range [0, NumField()).

func (Struct) FieldByName

func (s Struct) FieldByName(name string) (Field, bool)

FieldByName returns the struct field with the given name and a boolean indicating if the field was found.

func (Struct) NumField

func (s Struct) NumField() int

NumField returns a struct type's field count. It panics if the type's Kind is not Struct.

Jump to

Keyboard shortcuts

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