refavour

package
v0.0.131 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package refavour provides interface to work with tags of struct and several functions for working with reflect

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCanBeChanged

func CheckCanBeChanged(value interface{}) error

CheckCanBeChanged Check whether the data receiver can be changed

func CheckKind

func CheckKind(value interface{}, expectedKind reflect.Kind) error

CheckKind check is that interface{} equal expected Kind if equal then return nil else return ge.MismatchError

func CheckMap

func CheckMap(data interface{}) error

CheckMap check is that interface{} map if map then return nil else return ge.MismatchError

func CheckSlice

func CheckSlice(data interface{}) error

CheckSlice check is that interface{} slice if slice then return nil else return ge.MismatchError

func CheckStructure

func CheckStructure(data interface{}) error

CheckStructure check is that interface{} struct if struct then return nil else return ge.MismatchError

func GetReflectValue

func GetReflectValue(s interface{}) reflect.Value

GetReflectValue return reflect.Value of interface{}

Types

type FieldsInfo

type FieldsInfo map[string]interface{}

FieldsInfo Types of structure fields

func GetStructureFieldsTypes

func GetStructureFieldsTypes(value interface{}, tagProcessor TagProcessor) (FieldsInfo, error)

GetStructureFieldsTypes reads the structure from the interface and generates a list of field names and their types

type TagProcessor added in v0.0.14

type TagProcessor interface {
	GetFieldInfo(typeField reflect.StructField, valueField reflect.Value) (interface{}, error)
}

TagProcessor interface to provide parsing tags of struct

Jump to

Keyboard shortcuts

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