reflectjuice

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Description: This package contains helper functions for working with the reflect package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplaceNilPointersFields

func ReplaceNilPointersFields(toUpdate, currentDocument interface{}) error

ReplaceNilPointersFields is a function designed to accept two pointers to structs of the same type.

It will replace any nil POINTER fields in the first struct (toUpdate) with the values from the second struct (currentDocument).

This is useful for updating a struct in a database without overwriting the fields with nil values.

Use this function to perform PATCH updates of a document in a database.

It returns an error if the types of toUpdate and currentDocument are not the same, or if they are not structs or pointers to structs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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