internal

package
v0.0.0-...-0ef1328 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher interface {
	Hash(userID string, url string) string
	Validate(short string) bool
}

type Redirect

type Redirect struct {
	Short     string
	URL       string
	UserID    string
	CreatedAt time.Time
}

type RedirectRepository

type RedirectRepository interface {
	List(ctx context.Context, userID string) ([]Redirect, error)
	GetRedirectByShort(ctx context.Context, short string, userID string) (Redirect, error)
	Save(ctx context.Context, redirect Redirect) error
	Expand(ctx context.Context, short string) (string, error)
	Delete(ctx context.Context, short string, userID string) error
}

type UrlShortenerService

type UrlShortenerService interface {
	List(ctx context.Context, userID string) ([]Redirect, error)
	GetRedirectByShort(ctx context.Context, short string, userID string) (Redirect, error)
	ShortenURL(ctx context.Context, url string, userID string) (Redirect, error)
	ExpandShortURL(ctx context.Context, short string) (string, error)
	DeleteShortURL(ctx context.Context, short string, userID string) error
}

type User

type User struct {
	ID       string
	Email    string
	GoogleID string
}

type UsersRepository

type UsersRepository interface {
	Save(ctx context.Context, user User) error
	GetByGoogleID(ctx context.Context, googleID string) (User, error)
}

type UsersService

type UsersService interface {
	CreateWithGoogleID(ctx context.Context, googleID string, email string) (User, error)
	GetOrCreateByGoogle(ctx context.Context, googleID string, email string) (User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL