structconv

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvByFieldName

func ConvByFieldName[F, T any](from F, to T)

ConvByFieldName use reflect to fill 'to' with from by name like to.Name = from.Name to must be a struct pointer

func ConvByFunc

func ConvByFunc[F, T any](from F, conv func(F) T) T

func ConvSliceByFieldName

func ConvSliceByFieldName[F, T any](from []F, to []T)

ConvSliceByFieldName use reflect to fill 'to' slice with from by name

func ConvSliceByFunc

func ConvSliceByFunc[F, T any](from []F, conv func(F) T) []T

func MakeSliceWithNew

func MakeSliceWithNew[F, T any](from []F) (to []*T)

MakeSliceWithNew 以from的长度新建to,并为元素分配内存 因为make([]*T, len(from))只会把元素都设为nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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