mongo

package
v0.0.0-...-8edc08b Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	Config config.MongoConfig
	// contains filtered or unexported fields
}

func New

func New(cfg config.MongoConfig) (*Repo, error)

func (*Repo) CreateUser

func (r *Repo) CreateUser(ctx context.Context, user *entity.User) error
func (r *Repo) GetLink(ctx context.Context, shortURL string) (string, error)

func (*Repo) GetUserByUsername

func (r *Repo) GetUserByUsername(ctx context.Context, username string) (*entity.User, error)
func (r *Repo) UpdateUserLinks(ctx context.Context, user *entity.User) error

type User

type User struct {
	ID           primitive.ObjectID `bson:"_id,omitempty"`
	Username     string             `bson:"username"`
	PasswordHash string             `bson:"password_hash"`
	Links        map[string]string  `bson:"links,omitempty"`
}

func UserFromEntity

func UserFromEntity(item *entity.User) User

func (*User) ToEntity

func (u *User) ToEntity() entity.User

Jump to

Keyboard shortcuts

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