Documentation ¶
Overview ¶
Package statuscodes provides custom status types and helpers
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StatusCategory ¶
type StatusCategory int
const ( CategoryOK StatusCategory = 1 CategoryClientError StatusCategory = 2 CategoryServerError StatusCategory = 3 )
func (StatusCategory) String ¶
func (i StatusCategory) String() string
type StatusCode ¶
type StatusCode int
const ( OK StatusCode = 600 // Client-caused error responses BadRequest StatusCode = 700 Forbidden StatusCode = 702 NotFound StatusCode = 703 Conflict StatusCode = 704 RateLimited StatusCode = 705 // Server-caused error responses InternalServerError StatusCode = 800 NotImplemented StatusCode = 801 UnknownError StatusCode = 803 )
1. Keep OK not as zero so you know someone affirmatively picked it 2. Don't overlap with HTTP error codes so people know that these are different
func FromString ¶ added in v1.12.0
func FromString(s string) (StatusCode, bool)
func (StatusCode) Category ¶
func (re StatusCode) Category() StatusCategory
func (StatusCode) String ¶
func (i StatusCode) String() string
func (*StatusCode) UnmarshalText ¶ added in v1.12.0
func (re *StatusCode) UnmarshalText(text []byte) error
Click to show internal directories.
Click to hide internal directories.