Documentation
¶
Index ¶
- func AppErrorInit(t goi18n.TranslateFunc)
- func AuthErrorInit(t goi18n.TranslateFunc)
- func RegisterConstraint(name, message string)
- type AppError
- type ApplicationError
- func (err *ApplicationError) Error() string
- func (err *ApplicationError) GetDetailedError() string
- func (err *ApplicationError) GetId() string
- func (err *ApplicationError) GetRequestId() string
- func (err *ApplicationError) GetStatusCode() int
- func (err *ApplicationError) GetTranslationParams() map[string]any
- func (err *ApplicationError) SetDetailedError(details string)
- func (err *ApplicationError) SetRequestId(id string)
- func (err *ApplicationError) SetStatusCode(code int) AppError
- func (err *ApplicationError) SetTranslationParams(params map[string]any) AppError
- func (err *ApplicationError) String() string
- func (err *ApplicationError) SystemMessage(T goi18n.TranslateFunc) string
- func (err *ApplicationError) ToJson() string
- func (err *ApplicationError) Translate(T goi18n.TranslateFunc)
- type AuthError
- type AuthorizationError
- func (err *AuthorizationError) Error() string
- func (err *AuthorizationError) GetDetailedError() string
- func (err *AuthorizationError) GetId() string
- func (err *AuthorizationError) GetRequestId() string
- func (err *AuthorizationError) GetStatusCode() int
- func (err *AuthorizationError) GetTranslationParams() map[string]any
- func (err *AuthorizationError) SetDetailedError(details string)
- func (err *AuthorizationError) SetRequestId(id string)
- func (err *AuthorizationError) SetStatusCode(code int) AuthError
- func (err *AuthorizationError) SetTranslationParams(params map[string]any) AuthError
- func (err *AuthorizationError) String() string
- func (err *AuthorizationError) SystemMessage(T goi18n.TranslateFunc) string
- func (err *AuthorizationError) ToJson() string
- func (err *AuthorizationError) Translate(T goi18n.TranslateFunc)
- type DBCheckViolationError
- type DBConflictError
- type DBEntityConflictError
- type DBError
- type DBForbiddenError
- type DBForeignKeyViolationError
- type DBInternalError
- type DBNoRowsError
- type DBNotFoundError
- type DBNotNullViolationError
- type DBUniqueViolationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppErrorInit ¶
func AppErrorInit(t goi18n.TranslateFunc)
func AuthErrorInit ¶
func AuthErrorInit(t goi18n.TranslateFunc)
func RegisterConstraint ¶
func RegisterConstraint(name, message string)
RegisterConstraint registers custom database check constraints with a custom message.
Types ¶
type AppError ¶
type AppError interface { SetTranslationParams(map[string]any) AppError GetTranslationParams() map[string]any SetStatusCode(int) AppError GetStatusCode() int SetDetailedError(string) GetDetailedError() string SetRequestId(string) GetRequestId() string GetId() string Error() string Translate(goi18n.TranslateFunc) SystemMessage(goi18n.TranslateFunc) string ToJson() string String() string }
func NewBadRequestError ¶
func NewForbiddenError ¶
func NewInternalError ¶
Error constructors
func NewNotFoundError ¶
type ApplicationError ¶
type ApplicationError struct { Id string `json:"id"` Where string `json:"where,omitempty"` Status string `json:"status"` DetailedError string `json:"detail"` RequestId string `json:"request_id,omitempty"` StatusCode int `json:"code,omitempty"` // contains filtered or unexported fields }
func (*ApplicationError) Error ¶
func (err *ApplicationError) Error() string
func (*ApplicationError) GetDetailedError ¶
func (err *ApplicationError) GetDetailedError() string
func (*ApplicationError) GetId ¶
func (err *ApplicationError) GetId() string
func (*ApplicationError) GetRequestId ¶
func (err *ApplicationError) GetRequestId() string
func (*ApplicationError) GetStatusCode ¶
func (err *ApplicationError) GetStatusCode() int
func (*ApplicationError) GetTranslationParams ¶
func (err *ApplicationError) GetTranslationParams() map[string]any
func (*ApplicationError) SetDetailedError ¶
func (err *ApplicationError) SetDetailedError(details string)
func (*ApplicationError) SetRequestId ¶
func (err *ApplicationError) SetRequestId(id string)
func (*ApplicationError) SetStatusCode ¶
func (err *ApplicationError) SetStatusCode(code int) AppError
func (*ApplicationError) SetTranslationParams ¶
func (err *ApplicationError) SetTranslationParams(params map[string]any) AppError
func (*ApplicationError) String ¶
func (err *ApplicationError) String() string
func (*ApplicationError) SystemMessage ¶
func (err *ApplicationError) SystemMessage(T goi18n.TranslateFunc) string
func (*ApplicationError) ToJson ¶
func (err *ApplicationError) ToJson() string
func (*ApplicationError) Translate ¶
func (err *ApplicationError) Translate(T goi18n.TranslateFunc)
type AuthError ¶
type AuthError interface { SetTranslationParams(map[string]any) AuthError GetTranslationParams() map[string]any SetStatusCode(int) AuthError GetStatusCode() int SetDetailedError(string) GetDetailedError() string SetRequestId(string) GetRequestId() string GetId() string Error() string Translate(goi18n.TranslateFunc) SystemMessage(goi18n.TranslateFunc) string ToJson() string String() string }
func NewExpiredTokenError ¶
Example: AuthError for expired token
func NewInvalidTokenError ¶
Example: AuthError for invalid token
func NewUnauthorizedError ¶
type AuthorizationError ¶
type AuthorizationError struct { Id string `json:"id"` Where string `json:"where,omitempty"` Status string `json:"status"` DetailedError string `json:"detail"` RequestId string `json:"request_id,omitempty"` StatusCode int `json:"code,omitempty"` // contains filtered or unexported fields }
func (*AuthorizationError) Error ¶
func (err *AuthorizationError) Error() string
func (*AuthorizationError) GetDetailedError ¶
func (err *AuthorizationError) GetDetailedError() string
func (*AuthorizationError) GetId ¶
func (err *AuthorizationError) GetId() string
func (*AuthorizationError) GetRequestId ¶
func (err *AuthorizationError) GetRequestId() string
func (*AuthorizationError) GetStatusCode ¶
func (err *AuthorizationError) GetStatusCode() int
func (*AuthorizationError) GetTranslationParams ¶
func (err *AuthorizationError) GetTranslationParams() map[string]any
func (*AuthorizationError) SetDetailedError ¶
func (err *AuthorizationError) SetDetailedError(details string)
func (*AuthorizationError) SetRequestId ¶
func (err *AuthorizationError) SetRequestId(id string)
func (*AuthorizationError) SetStatusCode ¶
func (err *AuthorizationError) SetStatusCode(code int) AuthError
func (*AuthorizationError) SetTranslationParams ¶
func (err *AuthorizationError) SetTranslationParams(params map[string]any) AuthError
func (*AuthorizationError) String ¶
func (err *AuthorizationError) String() string
func (*AuthorizationError) SystemMessage ¶
func (err *AuthorizationError) SystemMessage(T goi18n.TranslateFunc) string
func (*AuthorizationError) ToJson ¶
func (err *AuthorizationError) ToJson() string
func (*AuthorizationError) Translate ¶
func (err *AuthorizationError) Translate(T goi18n.TranslateFunc)
type DBCheckViolationError ¶
DBCheckViolationError indicates a check constraint violation.
func NewDBCheckViolationError ¶
func NewDBCheckViolationError(id, check string) *DBCheckViolationError
type DBConflictError ¶
type DBConflictError struct {
DBError
}
DBConflictError indicates a conflict in the database operation (e.g., version mismatch).
func NewDBConflictError ¶
func NewDBConflictError(id, message string) *DBConflictError
NewDBConflictError creates a new DBConflictError with the specified ID and message.
type DBEntityConflictError ¶
type DBEntityConflictError struct {
DBError
}
DBEntityConflictError indicates a conflict in entity requests.
func NewDBEntityConflictError ¶
func NewDBEntityConflictError(id string) *DBEntityConflictError
type DBError ¶
DBError represents a generic database error.
func NewDBError ¶
NewDBError creates a new DBError with the specified ID and message.
type DBForbiddenError ¶
type DBForbiddenError struct {
DBError
}
DBForbiddenError indicates that the user is forbidden from performing an action.
func NewDBForbiddenError ¶
func NewDBForbiddenError(id, message string) *DBForbiddenError
NewDBForbiddenError creates a new DBForbiddenError with the specified ID and message.
type DBForeignKeyViolationError ¶
type DBForeignKeyViolationError struct { DBError Column string Value string ForeignKeyTable string }
DBForeignKeyViolationError indicates a foreign key constraint violation.
func NewDBForeignKeyViolationError ¶
func NewDBForeignKeyViolationError(id, column, value, foreignKey string) *DBForeignKeyViolationError
type DBInternalError ¶
DBInternalError indicates an internal database error.
func NewDBInternalError ¶
func NewDBInternalError(id string, reason error) *DBInternalError
func (*DBInternalError) Error ¶
func (d *DBInternalError) Error() string
Error implements the error interface for DBInternalError.
type DBNoRowsError ¶
type DBNoRowsError struct {
DBError
}
DBNoRowsError indicates that no rows were found for a query.
func NewDBNoRowsError ¶
func NewDBNoRowsError(id string) *DBNoRowsError
type DBNotFoundError ¶
type DBNotFoundError struct {
DBError
}
DBNotFoundError indicates that a specific entity was not found.
func NewDBNotFoundError ¶
func NewDBNotFoundError(id, message string) *DBNotFoundError
NewDBNotFoundError creates a new DBNotFoundError with the specified ID and message.
type DBNotNullViolationError ¶
DBNotNullViolationError indicates a not-null constraint violation.
func NewDBNotNullViolationError ¶
func NewDBNotNullViolationError(id, table, column string) *DBNotNullViolationError
type DBUniqueViolationError ¶
DBUniqueViolationError indicates a unique constraint violation.
func NewDBUniqueViolationError ¶
func NewDBUniqueViolationError(id, column, value string) *DBUniqueViolationError