Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUserNotFound = errors.New("user not found")
)
Error types for user operations
Functions ¶
func ValidateCreateUserRequest ¶
func ValidateCreateUserRequest(req *CreateUserRequest) error
ValidateCreateUserRequest validates a create user request
func ValidateEmail ¶
ValidateEmail validates an email address format
func ValidateUpdateUserRequest ¶
func ValidateUpdateUserRequest(req *UpdateUserRequest) error
ValidateUpdateUserRequest validates an update user request
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct {
Name string `json:"name"`
Email string `json:"email"`
Image *string `json:"image"`
}
CreateUserRequest represents a request to create a new user
type Repository ¶
type Repository interface {
// Create creates a new user
Create(user *User) error
// FindByID retrieves a user by ID
FindByID(id string) (*User, error)
// FindByEmail retrieves a user by email
FindByEmail(email string) (*User, error)
// Update updates an existing user
Update(user *User) error
// Delete deletes a user by ID
Delete(id string) error
// List lists users with pagination
List(limit int, offset int) ([]*User, error)
// Count returns the total number of users
Count() (int, error)
// ExistsByEmail checks if a user exists by email
ExistsByEmail(email string) (bool, error)
// ExistsByID checks if a user exists by ID
ExistsByID(id string) (bool, error)
}
Repository defines the interface for user data access
type UpdateUserRequest ¶
UpdateUserRequest represents a request to update an existing user
type User ¶
type User struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
EmailVerified bool `json:"email_verified"`
Image *string `json:"image"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
User represents an authenticated user in the system
Click to show internal directories.
Click to hide internal directories.