ripreflect

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const MissingIDField = "<MISSING ID FIELD>"

Variables

This section is empty.

Functions

func FieldIDName

func FieldIDName(entity any) string

func FieldIDString

func FieldIDString(entity any) string

func FindEntityID

func FindEntityID(entity any) (value reflect.Value, fieldName string, err error)

FindEntityID will find a struct field named ID or a public struct field with the `rip:id` struct tag. If there are many `rip:id` struct tags in the struct, it will return the first one.

func GetID

func GetID(entity any) (string, error)

GetID gets the id of an entity. Make it use reflect for getting fields of `rip:"id"`.

func HasRIPIDField

func HasRIPIDField(f reflect.StructField) bool

func SetID

func SetID(entity any, uuid string) error

SetID set the ID of the entity. the entity must be passed by reference.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳