domain

package
v0.0.0-...-25c43ee Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionURL = "urls"
View Source
const CollectionUsers = "users"

Variables

This section is empty.

Functions

This section is empty.

Types

type RegisterUsecase

type RegisterUsecase interface {
	Create(ctx context.Context, user *User) (*User, error)
	GetUserByEmail(ctx context.Context, email string) (*User, error)
	GetUserByUsername(ctx context.Context, username string) (*User, error)
}

type URL

type URL struct {
	ID       string     `db:"id"`
	Original string     `db:"original"`
	Expire   int64      `db:"expire"`
	UserID   *uuid.UUID `db:"user_id"`
}

type URLRepository

type URLRepository interface {
	Create(ctx context.Context, url *URL) (*URL, error)
	GetByID(ctx context.Context, id string) (*URL, error)
	GetAllByUserID(ctx context.Context, userID uuid.UUID) ([]*URL, error)
}

type URLUsecase

type URLUsecase interface {
	Create(ctx context.Context, url *URL) (*URL, error)
	GetByID(ctx context.Context, id string) (*URL, error)
	GetAllByUserID(ctx context.Context, userID uuid.UUID) ([]*URL, error)
}

type User

type User struct {
	ID       uuid.UUID `db:"id"`
	Username string    `db:"username"`
	Email    string    `db:"email"`
	Password string    `db:"password"`
}

type UserRepository

type UserRepository interface {
	Create(ctx context.Context, user *User) (*User, error)
	GetByID(ctx context.Context, id uuid.UUID) (*User, error)
	GetByUsername(ctx context.Context, username string) (*User, error)
	GetByEmail(ctx context.Context, email string) (*User, error)
	Update(ctx context.Context, user *User) (*User, error)
	GetByUsernameOrEmail(ctx context.Context, usernameOrEmail string) (*User, error)
}

Jump to

Keyboard shortcuts

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