Documentation ¶
Index ¶
Constants ¶
const ( SPQR_UNEXPECTED = "SPQRU" SPQR_NO_DATASHARD = "SPQRD" SPQR_SKIP = "SPQRE" SPQR_COMPLEX_QUERY = "SPQRC" SPQR_FAILED_MATCH = "SPQRF" SPQR_SKIP_COLUMN = "SPQRS" SPQR_MISS_SHARDING_KEY = "SPQRM" SPQR_CROSS_SHARD_QUERY = "SPQRX" SPQR_ROUTING_ERROR = "SPQRR" SPQR_CONNECTION_ERROR = "SPQRO" SPQR_KEYRANGE_ERROR = "SPQRK" SPQR_SHARDING_RULE_ERROR = "SPQRH" SPQR_TRANSFER_ERROR = "SPQRT" SPQR_NO_DISTRIBUTION = "SPQRN" SPQR_NOT_IMPLEMENTED = "SPQRI" SPQR_ROUTER_ERROR = "SPQRL" SPQR_METADATA_CORRUPTION = "SPQRZ" SPQR_INVALID_REQUEST = "SPQRJ" SPQR_CONFIG_ERROR = "SPQRM" )
Variables ¶
var ShardingRulesRemoved = New(SPQR_INVALID_REQUEST, "sharding rules are removed from SPQR, see https://github.com/pg-sharding/spqr/blob/master/docs/Syntax.md")
Functions ¶
func GetMessageByCode ¶
GetMessageByCode returns the error message associated with the provided error code. If the error code is not found in the existingErrorCodeMap, the function returns "Unexpected error".
Parameters:
- errorCode: The error code for which to retrieve the error message.
Returns:
- string: The error message associated with the provided error code.
Types ¶
type SpqrError ¶
func New ¶
New creates a new SpqrError with the given error code and error message. It returns a pointer to the created SpqrError.
Parameters:
- errorCode: The error code for the error.
- errorMsg: The error message for the error.
Returns:
- *SpqrError: The created SpqrError.
func NewByCode ¶
NewByCode creates a new SpqrError instance based on the provided error code. It returns a pointer to the created SpqrError.
Parameters:
- errorCode: The error code for the error.
Returns:
- *SpqrError: The created SpqrError.
func Newf ¶
Newf creates a new SpqrError with the given error code and formatted error message. It uses the fmt.Errorf function to format the error message using the provided format and arguments. The error code is used to identify the specific type of error.
Parameters:
- errorCode: The error code for the error.
- format: The format string for the error message.
- a: The arguments to be used in the format string.
Returns:
- *SpqrError: The created SpqrError.