user_repo

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound     = errors.New("user not found")
	ErrInvalidPassword  = errors.New("invalid password")
	ErrInvalidUserInput = errors.New("invalid user input")
)

Functions

This section is empty.

Types

type UserRepository

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

UserRepository handles user database operations

func NewUserRepository

func NewUserRepository(db *ent.Client) *UserRepository

NewUserRepository creates a new repository

func (*UserRepository) Authenticate

func (self *UserRepository) Authenticate(ctx context.Context, email, password string) (*ent.User, error)

Authenticate verifies a user's credentials and returns the user if successful

func (*UserRepository) GetByEmail

func (self *UserRepository) GetByEmail(ctx context.Context, email string) (*ent.User, error)

func (*UserRepository) GetByID

func (self *UserRepository) GetByID(ctx context.Context, id uuid.UUID) (*ent.User, error)

func (*UserRepository) GetGroups

func (self *UserRepository) GetGroups(ctx context.Context, userID uuid.UUID) ([]*ent.Group, error)

func (*UserRepository) GetOrCreate

func (self *UserRepository) GetOrCreate(ctx context.Context, email string) (*ent.User, error)

type UserRepositoryInterface

type UserRepositoryInterface interface {
	GetByID(ctx context.Context, id uuid.UUID) (*ent.User, error)
	GetOrCreate(ctx context.Context, email string) (*ent.User, error)
	GetByEmail(ctx context.Context, email string) (*ent.User, error)
	// Authenticate verifies a user's credentials and returns the user if successful
	Authenticate(ctx context.Context, email, password string) (*ent.User, error)
	GetGroups(ctx context.Context, userID uuid.UUID) ([]*ent.Group, error)
}

UserRepositoryInterface ...

Jump to

Keyboard shortcuts

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