{"modulePath":"github.com/bitsbuster/utils/v2","version":"v2.1.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Constants\n\n```go\nconst (\n\tErrorNilEntityValue     = \"ERROR_NIL_ENTITY_VALUE\"\n\tErrorEmptySqlResult     = \"ERROR_EMPTY_SQL_RESULT\"\n\tErrorDatabaseDuplicated = \"ERROR_DUPLICATED_ENTRY\"\n\tErrorNoRowsAffected     = \"ERROR_SQL_NO_ROWS_AFFECTED\"\n\tErrorGeneratingRsa      = \"ERROR_GENERATING_RSA\"\n)\n```\n\n## Functions\n\n```go\nfunc Code(e error) string\n```\nReturns the CommonsError code\n\nIf e is not type of CommonsError returns an empty string\n\n```go\nfunc Message(e error) string\n```\nReturns the CommonsError message\n\nIf e is not type of CommonsError returns an empty string\n\n```go\nfunc New(code string, text string) error\n```\nNew returns an error that formats as the given code and text (the message). Each call to New returns a distinct error value even if the text is identical.\n\n```go\nfunc NewErrorDatabaseDuplicated(text string) error\n```\n\n```go\nfunc NewErrorEmptySqlResult(text string) error\n```\n\n```go\nfunc NewErrorNilEntityValue(text string) error\n```\n\n```go\nfunc NewErrorNoRowsAffected(text string) error\n```\n\n## Types\n\n```go\ntype CommonsError struct {\n\tCode    string\n\tMessage string\n}\n```\nCommonsError is a trivial implementation of error.\n\n```go\nfunc GetCommonsError(err error) *CommonsError\n```\n\n```go\nfunc (e CommonsError) Error() string\n```\n\n```go\nfunc (e CommonsError) MarshalJSON() ([]byte, error)\n```\nImplements the json.Marshaler interface to control JSON serialization.\n\n```go\nfunc (e *CommonsError) Scan(value interface{}) error\n```\nImplements the sql.Scanner interface to be able to read it from MySQL\n\n```go\nfunc (e *CommonsError) String() string\n```\n\n```go\nfunc (e CommonsError) Value() (driver.Value, error)\n```\nImplements the driver.Valuer interface to be able to insert it into MySQL\n\n","path":"github.com/bitsbuster/utils/v2/errors","name":"errors","synopsis":"","isRedistributable":true}
