Documentation
¶
Index ¶
Constants ¶
View Source
const ( StatusDisabled = iota StatusPending StatusEnabled )
Variables ¶
View Source
var (
ErrIncorrectCreds = errors.New("username/password is incorrect")
)
Functions ¶
Types ¶
type AuthService ¶
func NewAuthServiceImpl ¶
func NewAuthServiceImpl(userRepository UserRepository) AuthService
NewAuthServiceImpl creates a new AuthServiceImpl instance.
type AuthServiceImpl ¶
type AuthServiceImpl struct {
// contains filtered or unexported fields
}
AuthServiceImpl represents the concrete implementation of AuthService.
func (*AuthServiceImpl) Authenticate ¶
func (s *AuthServiceImpl) Authenticate(username, password string) (models.UserLogin, error)
Authenticate authenticates a user with the given username and password.
type DataAccess ¶
type DataAccess interface { Exec(query string, args ...any) (sql.Result, error) QueryRow(query string, args ...any) *sqlx.Row Query(query string, args ...any) (*sqlx.Rows, error) }
DataAccess defines the interface for data access operations.
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository represents the repository for user data.
func NewUserRepository ¶
func NewUserRepository(db *sqlx.DB) *UserRepository
NewUserRepository creates a new UserRepository instance.
func (*UserRepository) CreateUser ¶
func (r *UserRepository) CreateUser(user models.User) (int64, error)
CreateUser inserts a new user record into the database.
func (*UserRepository) GetUserByID ¶
func (r *UserRepository) GetUserByID(userID int) (models.User, error)
GetUserByID retrieves a user record from the database by ID.
func (*UserRepository) GetUserLogin ¶
func (r *UserRepository) GetUserLogin(username string) (models.UserLogin, error)
GetUserLogin retrieves a user login record from the database by username.
Click to show internal directories.
Click to hide internal directories.