structset

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package structset implements helper functions that involves structs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CachedFieldIndexes added in v0.1.1

func CachedFieldIndexes(structType reflect.Type) map[string]int

CachedFieldIndexes is like fieldIndexes, but cached per struct type.

func ScanRow

func ScanRow(rows *sql.Rows, columns []string, indexes map[string]int, dest any) error

ScanRow is a cut-down version of the proposed Rows.ScanRow method. It currently only handles dest being a (pointer to) struct, and does not handle embedded fields. See https://github.com/golang/go/issues/61637

func StructFieldNames added in v0.2.0

func StructFieldNames(s interface{}) []string

StructFieldNames returns all fields in a given struct.

func StructFieldTagMap added in v0.2.0

func StructFieldTagMap(s interface{}, keyTag string, valueTag string) map[string]string

StructFieldTagMap returns a map of tags using keyTag as map key and valueTag as map value.

func StructFieldTagValues added in v0.2.0

func StructFieldTagValues(s interface{}, tag string) []string

StructFieldTagValues returns all tag names in a given struct for a given tag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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