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.
Click to show internal directories.
Click to hide internal directories.