spqrerror

package
v0.0.0-...-7a0127b Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: PostgreSQL Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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

func GetMessageByCode(errorCode string) string

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

type SpqrError struct {
	Err error

	ErrorCode string
}

func New

func New(errorCode string, errorMsg string) *SpqrError

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

func NewByCode(errorCode string) *SpqrError

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

func Newf(errorCode string, format string, a ...any) *SpqrError

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.

func (*SpqrError) Error

func (er *SpqrError) Error() string

Error returns the error message associated with the SpqrError. It formats the error message using the underlying error's Error method.

Returns:

  • string: The formatted error message.

Jump to

Keyboard shortcuts

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