typeencoding.go
typeencoding.go - Overview
This file provides functions for asserting the type of an object.
Detailed Documentation
Function: AssertTypeWithError
- Purpose: Checks if the given object type
te
matches the expected object typet
. - Parameters:
te
(ObjectType): The type of the object.t
(ObjectType): The expected type of the object.
- Returns:
error
: An error if the types do not match, otherwise nil.
Function: AssertType
- Purpose: Checks if the given object type
_type
matches theexpectedType
. If they don't match, it returns aWrongKeyTypeErr
error message as a byte slice. - Parameters:
_type
(ObjectType): The type of the object.expectedType
(ObjectType): The expected type of the object.
- Returns:
[]byte
: A byte slice containing theWrongKeyTypeErr
error message if the types do not match, otherwise nil.