Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type URL ¶
type URL struct { ID uuid.UUID `db:"id"` Owner uuid.UUID `db:"owner"` OriginalURL string `db:"original_url"` ShortenedURLParam string `db:"short_url_param"` VisitCount *int `db:"visit_count,omitempty"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
URL contains all the related info about the shortened url.
type URLStore ¶
type URLStore interface { NewURL(ctx context.Context, userID uuid.UUID, originalURL, shortenedURL string) (URL, error) GetURLByID(ctx context.Context, id uuid.UUID) (URL, error) GetURLByParam(ctx context.Context, param string) (URL, error) GetURLByLongStr(ctx context.Context, longURL string) (URL, error) }
URLStore is a url data store interface.
type User ¶
type User struct { ID uuid.UUID `db:"id,omitempty"` Email string `db:"email,omitempty"` Password string `db:"password"` APIKey *uuid.UUID `db:"api_key,omitempty"` ResetPasswordExpires *time.Time `db:"reset_password_expires,omitempty"` ResetPasswordToken *uuid.UUID `db:"reset_password_token,omitempty"` VerificationExpires time.Time `db:"verification_expires"` VerificationToken uuid.UUID `db:"verification_token,omitempty"` Verified bool `db:"verified,omitempty"` CreatedAt time.Time `db:"created_at,omitempty"` UpdatedAt time.Time `db:"updated_at,omitempty"` }
User represents an authenticated user.
func (*User) HashPassword ¶
HashPassword hashes the user password using bcrypt hash function
type UserStore ¶
type UserStore interface { NewUser(ctx context.Context, email, password string) (User, error) GetUserByID(ctx context.Context, id uuid.UUID) (User, error) GetUserByEmail(ctx context.Context, email string) (User, error) GetUserByVerificationToken(ctx context.Context, token uuid.UUID) (User, error) SetUserAPIKey(ctx context.Context, id, key uuid.UUID) error SetUserVerified(ctx context.Context, id uuid.UUID) error }
UserStore is a user data store interface.
Click to show internal directories.
Click to hide internal directories.