Documentation
¶
Index ¶
Constants ¶
View Source
const (
// IDLength is the length of IDs.
IDLength = 16
)
Variables ¶
This section is empty.
Functions ¶
func LooksLikeID ¶
Types ¶
type Short ¶
type Short struct {
// ID is the unique identifier of the short.
ID string `json:"id"`
// Name is the shortened name of the URL.
Name string `json:"name,omitempty"`
// URL is the URL that is shortened.
URL string `json:"url"`
// CreatedAt is the time the short was created.
CreatedAt time.Time `json:"createdAt,omitempty"`
// UserID of the user that created the short.
UserID *string `json:"-"`
}
type ShortLog ¶
type ShortLog struct {
// ID is the unique identifier of the short log.
ID string `json:"id"`
// ShortID is the ID of the short that was accessed.
ShortID string `json:"shortID"` //nolint:tagliatelle // This is the correct spelling.
// IPAddress is the IP address of the client that accessed the short.
IPAddress string `json:"ipAddress"`
// UserAgent is the User-Agent of the client that accessed the short.
UserAgent string `json:"userAgent"`
// Referer is the referer of the client that accessed the short.
Referer string `json:"referer"`
// CreatedAt is the time the short was accessed.
CreatedAt time.Time `json:"createdAt,omitempty"`
}
type Token ¶
type Token struct {
// ID is the unique identifier of the token
ID string `json:"id"`
// Name is the user-friendly name of the token.
Name string `json:"name"`
// Value is the actual token.
Value string `json:"value"`
// CreatedAt is when the token was created (initialized by the storage)
CreatedAt time.Time `json:"createdAt"`
// UserID of the user that created the token.
UserID *string `json:"-"`
}
type User ¶
type User struct {
// ID is the user's ID.
ID string `json:"id"`
// Username is the user's username.
Username string `json:"username"`
// CreatedAt is the time the user was created.
CreatedAt time.Time `json:"createdAt,omitempty"`
// contains filtered or unexported fields
}
func NewAuthenticatableUser ¶
NewAuthenticatableUser is a elper function for storages that takes a public user and adds a hashed password to it.
func (*User) GetPasswordHash ¶
GetPasswordHash Returns the password hash to be saved in a storage.
func (*User) SetNoLoginPassword ¶ added in v1.8.0
func (u *User) SetNoLoginPassword()
SetNoLoginPassword sets the user's password to a no-login password.
func (*User) SetPassword ¶
func (u *User) SetPassword(hasher passwords.PasswordHasher, pass string) error
SetPassword sets a password.
Click to show internal directories.
Click to hide internal directories.