reflect

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fields

func Fields(m any) (mp map[string]any)

Fields returns a map of fields. Used for: - db.Updates()

func HasFields

func HasFields(m any, in ...string) (out []string, err error)

HasFields returns the validated field names. Used for: - db.Omit() - db.Select()

func NameOf

func NameOf(m any) (name string)

NameOf returns the name of a model.

func Omit

func Omit(in *gorm.DB, m any, fields ...string) (out *gorm.DB)

Omit returns DB.Omit() with validated fields.

func Select

func Select(in *gorm.DB, m any, fields ...string) (out *gorm.DB)

Select returns DB.Select() with validated fields.

Types

type FieldNotValid

type FieldNotValid struct {
	Kind string
	Name string
}

FieldNotValid report field not valid.

func (*FieldNotValid) Error

func (e *FieldNotValid) Error() string

func (*FieldNotValid) Is

func (e *FieldNotValid) Is(err error) (matched bool)

Jump to

Keyboard shortcuts

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