Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToBytes ¶
ToBytes converts an object of type T, passed as a pointer P, into a byte slice. It uses reflection and unsafe package to achieve this conversion.
Type Parameters: - T: The type of the object. - P: The pointer type to the object (should be *T).
Parameters: - obj: The object to convert, passed as a pointer of type P.
Returns: - A byte slice representing the raw bytes of the object.
Panics: - If the object is not addressable (cannot take the address of the value).
Note:
- The object must be passed as a pointer, and it must be addressable.
- This function uses unsafe operations, which can lead to undefined behavior if not used carefully. Ensure that the object remains valid for the duration of the byte slice usage.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.