modelutils

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: BSD-1-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DePtr

func DePtr(val any) reflect.Value

Convert a potential pointer to a value to a value

func DePtrType

func DePtrType(val any) reflect.Type

func GetField

func GetField(m any, field string, strict bool) (any, error)

func GetFieldNames added in v1.6.2

func GetFieldNames(m any) []string

func GetModelDisplay

func GetModelDisplay(mdl any, list bool) string

Get a default display for the given model.

If the model implements the DisplayableModel interface, the String() method will be called.

func GetNewModelSlice

func GetNewModelSlice(m any) any

Get a new slice of the given model.

func NewOf added in v1.6.2

func NewOf(m any, ptr bool) any

Get a new model from the given model.

If ptr is true, a pointer to the model will be returned.

func NewPtr

func NewPtr(val any) reflect.Value

Get a pointer to a new value of the same type as val

func SetField

func SetField(m any, field string, value any) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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