user

package
v0.0.0-...-38b1c69 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InsertNewUser = "INSERT INTO profile (username, password, email) VALUES ($1, $2, $3);"

	SelectAuthByUsername         = "SELECT id, password, email FROM profile WHERE username = $1;"
	SelectUsernameAndAvatar      = "SELECT username, avatar FROM profile WHERE id = $1;"
	SelectUserDataExceptPassword = "SELECT username, email, avatar, name, surname, about_me FROM profile WHERE id = $1;"

	UpdateAvatarProfile    = "UPDATE profile SET avatar = $1 WHERE id = $2;"
	SelectUserIdByUsername = "SELECT id FROM profile WHERE username = $1;"
	SelectLastUserID       = "SELECT id FROM profile ORDER BY id DESC LIMIT 1;"
	CheckUserExistence     = "SELECT username FROM profile WHERE id = $1 AND deleted_at IS NULL;"
	GetUserInfo            = `` /* 573-byte string literal not displayed */

	GetProfileInfo = `` /* 307-byte string literal not displayed */

)

Functions

func NewUserRepoPG

func NewUserRepoPG(db pgtype.PgxPoolIface) *userRepoPG

Types

type ErrNonExistingUser

type ErrNonExistingUser struct{}

func (*ErrNonExistingUser) Error

func (e *ErrNonExistingUser) Error() string

func (*ErrNonExistingUser) Type

func (e *ErrNonExistingUser) Type() errPkg.Type

type Repository

type Repository interface {
	AddNewUser(ctx context.Context, user *user.User) error
	GetUserByUsername(ctx context.Context, username string) (*user.User, error)
	GetUsernameAndAvatarByID(ctx context.Context, userID int) (username string, avatar string, err error)
	GetUserIdByUsername(ctx context.Context, username string) (int, error)
	GetUserData(ctx context.Context, userID, currUserID int) (user_ *user.User, isSubscribed bool, subsCount int, err error)
	GetProfileData(ctx context.Context, userID int) (user_ *user.User, subsCount int, err error)
	CheckUserExistence(ctx context.Context, userID int) error
	EditUserAvatar(ctx context.Context, userID int, avatar string) error
	GetAllUserData(ctx context.Context, userID int) (*user.User, error)
	EditUserInfo(ctx context.Context, userID int, updateFields S) error
}

type S

type S map[string]any

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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