// GetByUsername returns one user by username.
GetByUsername returns one user by username.
// GetByUsername returns one user by username .
func (ur *UserRepository) GetByUsername(ctx context.Context, username string) (user.User, error) {
	q := `
	SELECT id, first_name, last_name, username, email, picture,
		password, created_at, updated_at
		FROM users WHERE username = $1;
	`
	row := ur.Data.DB.QueryRowContext(ctx, q, username)
	var u user.User
	err := row.Scan(&u.ID, &u.FirstName, &u.LastName, &u.Username,
		&u.Email, &u.Picture, &u.PasswordHash, &u.CreatedAt, &u.UpdatedAt)
	if err != nil {
		return user.User{}, err
	}
	return u, nil
}
func ( ur * UserRepository ) GetByUsername ( ctx context . Context , username string ) ( user . User , error ) { q := `
	SELECT id, first_name, last_name, username, email, picture,
		password, created_at, updated_at
		FROM users WHERE username = $1;
	` row := ur . Data . DB . QueryRowContext ( ctx , q , username ) var u user . User err := row . Scan ( & u . ID , & u . FirstName , & u . LastName , & u . Username , & u . Email , & u . Picture , & u . PasswordHash , & u . CreatedAt , & u . UpdatedAt ) if err != nil { return user . User { } , err } return u , nil }
GetByUsername returns one user by username.
GetByUsername returns one user by username .