You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: TeamMember.go
    path of file: ./repos/mindoc/models
    
    the code of the file until where you have to start completion: package models

import (
	"errors"

	"github.com/beego/beego/v2/client/orm"
	"github.com/beego/beego/v2/core/logs"
	"github.com/beego/i18n"
	"github.com/mindoc-org/mindoc/con
    
func (m *TeamMember) FindToPager(teamId, pageIndex, pageSize int) (list []*TeamMember, totalCount int, err error) {
	if teamId <= 0 {
		err = ErrInvalidParameter
		return
	}
	offset := (pageIndex - 1) * pageSize

	o := orm.NewOrm()

	_, err = o.QueryTable(m.TableNameWithPrefix()).Filter("team_id", teamId).Offset(offset).Limit(pageSize).All(&list)

	if err != nil {
		if err != orm.ErrNoRows {
			logs.Error("查询团队成员失败 ->", err)
		}
		return
	}
	c, err := o.QueryTable(m.TableNameWithPrefix()).Filter("team_id", teamId).Count()

	if err != nil {
		return
	}
	totalCount = int(c)

	//将来优化
	for _, item := range list {
		item.Lang = m.Lang
		item.Include()
	}
	return
}