mongo

package
v0.0.0-...-c3818ae Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, conf config.Mongo) (*mongo.Client, error)

Types

type Repository

type Repository struct {
	URL  domain.URLRepository
	User domain.UserRepository
}

func NewRepository

func NewRepository(cli *mongo.Client) *Repository

type URLRepository

type URLRepository struct {
	// contains filtered or unexported fields
}

func NewURLRepository

func NewURLRepository(coll *mongo.Collection) *URLRepository

func (*URLRepository) CreateURL

func (r *URLRepository) CreateURL(ctx context.Context, url domain.URL) (interface{}, error)

func (*URLRepository) GetURLByHash

func (r *URLRepository) GetURLByHash(ctx context.Context, hash string) (domain.URL, error)

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

func NewUserRepository

func NewUserRepository(coll *mongo.Collection) *UserRepository

func (*UserRepository) Create

func (r *UserRepository) Create(ctx context.Context, user domain.User) (interface{}, error)

func (*UserRepository) Delete

func (r *UserRepository) Delete(ctx context.Context, username, password string) error

func (*UserRepository) Get

func (r *UserRepository) Get(ctx context.Context, username, password string) (domain.User, error)

func (*UserRepository) Update

func (r *UserRepository) Update(ctx context.Context, user domain.User) error

func (*UserRepository) UsernameExists

func (r *UserRepository) UsernameExists(ctx context.Context, username string) (bool, error)

Jump to

Keyboard shortcuts

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