Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBlacklistRecordNotFound = NewError("blacklist.record.not_found") ErrTokenNotFound = NewError("token.not_found") ErrInvalidLimit = NewError("query.invalid_limit") ErrInvalidOffset = NewError("query.invalid_offset") )
Functions ¶
func GenerateSecret ¶ added in v0.0.23
Types ¶
type AuthStatus ¶
type AuthStatus string
AuthStatus is status of authorization.
const ( // AuthStatusSucceed represents successful authorization. AuthStatusSucceed AuthStatus = "succeed" // AuthStatusFailed represents failed authorization. AuthStatusFailed AuthStatus = "failed" )
type Authorization ¶
type Authorization struct { Token Status AuthStatus `json:"status"` Error *string `json:"error,omitempty"` IP string `json:"ip"` Time time.Time `json:"timestamp"` }
Authorization represents authorization
type BlackListItem ¶
type BlackListItem struct { IPv4 string `json:"ipv4" db:"ipv4"` Enabled bool `json:"enabled" db:"enabled"` }
BlackListItem is a domain model of blacklisted iterms.
type Token ¶
type Token struct { ID string `json:"id" db:"id"` UserID string `json:"user_id" db:"user_id"` Secret string `json:"secret,omitempty" db:"secret"` Name string `json:"name" db:"name"` Enabled bool `json:"enabled" db:"enabled"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
Token is a domain model of token.
func (*Token) ClearSecret ¶ added in v0.0.23
func (t *Token) ClearSecret()
func (*Token) ResetSecret ¶
func (t *Token) ResetSecret()
type ValidationError ¶
func NewValidationError ¶
func NewValidationError(messages map[string][]string) ValidationError
func (*ValidationError) Append ¶
func (e *ValidationError) Append(field string, message ...string)
func (ValidationError) Error ¶
func (e ValidationError) Error() string
func (ValidationError) WithPrefix ¶
func (e ValidationError) WithPrefix(prefix string) ValidationError
Click to show internal directories.
Click to hide internal directories.