Fix empty string comparison issues in the codebase (#16686)

Automatic Merge
Этот коммит содержится в:
Madhav Hugar
2021-01-25 11:15:17 +01:00
коммит произвёл GitHub
родитель 200a56fa5a
Коммит 94c24eea20
107 изменённых файлов: 368 добавлений и 368 удалений

Просмотреть файл

@@ -623,7 +623,7 @@ func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1
}
func (s SqlChannelStore) saveChannelT(transaction *gorp.Transaction, channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) {
if len(channel.Id) > 0 {
if channel.Id != "" {
return nil, store.NewErrInvalidInput("Channel", "Id", channel.Id)
}
@@ -1031,7 +1031,7 @@ func (s SqlChannelStore) getAllChannelsQuery(opts store.ChannelSearchOpts, forCo
query = query.Where(sq.Eq{"c.DeleteAt": int(0)})
}
if len(opts.NotAssociatedToGroup) > 0 {
if opts.NotAssociatedToGroup != "" {
query = query.Where("c.Id NOT IN (SELECT ChannelId FROM GroupChannels WHERE GroupChannels.GroupId = ? AND GroupChannels.DeleteAt = 0)", opts.NotAssociatedToGroup)
}
@@ -1142,7 +1142,7 @@ func (s SqlChannelStore) GetPublicChannelsByIdsForTeam(teamId string, channelIds
idQuery := ""
for index, channelId := range channelIds {
if len(idQuery) > 0 {
if idQuery != "" {
idQuery += ", "
}
@@ -2335,7 +2335,7 @@ func (s SqlChannelStore) GetForPost(postId string) (*model.Channel, error) {
func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) (int64, error) {
query := "SELECT COUNT(Id) AS Value FROM Channels WHERE Type = :ChannelType"
if len(teamId) > 0 {
if teamId != "" {
query += " AND TeamId = :TeamId"
}
@@ -2349,7 +2349,7 @@ func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) (
func (s SqlChannelStore) AnalyticsDeletedTypeCount(teamId string, channelType string) (int64, error) {
query := "SELECT COUNT(Id) AS Value FROM Channels WHERE Type = :ChannelType AND DeleteAt > 0"
if len(teamId) > 0 {
if teamId != "" {
query += " AND TeamId = :TeamId"
}
@@ -2681,7 +2681,7 @@ func (s SqlChannelStore) channelSearchQuery(term string, opts store.ChannelSearc
query = query.Where(sq.NotEq{"c.Name": opts.ExcludeChannelNames})
}
if len(opts.NotAssociatedToGroup) > 0 {
if opts.NotAssociatedToGroup != "" {
query = query.Where("c.Id NOT IN (SELECT ChannelId FROM GroupChannels WHERE GroupChannels.GroupId = ? AND GroupChannels.DeleteAt = 0)", opts.NotAssociatedToGroup)
}

Просмотреть файл

@@ -54,7 +54,7 @@ func (s SqlCommandStore) createIndexesIfNotExists() {
}
func (s SqlCommandStore) Save(command *model.Command) (*model.Command, error) {
if len(command.Id) > 0 {
if command.Id != "" {
return nil, store.NewErrInvalidInput("Command", "CommandId", command.Id)
}
@@ -193,7 +193,7 @@ func (s SqlCommandStore) AnalyticsCommandCount(teamId string) (int64, error) {
From("Commands").
Where(sq.Eq{"DeleteAt": 0})
if len(teamId) > 0 {
if teamId != "" {
query = query.Where(sq.Eq{"TeamId": teamId})
}

Просмотреть файл

@@ -39,7 +39,7 @@ func (s SqlCommandWebhookStore) createIndexesIfNotExists() {
}
func (s SqlCommandWebhookStore) Save(webhook *model.CommandWebhook) (*model.CommandWebhook, error) {
if len(webhook.Id) > 0 {
if webhook.Id != "" {
return nil, store.NewErrInvalidInput("CommandWebhook", "id", webhook.Id)
}

Просмотреть файл

@@ -476,31 +476,31 @@ func (fs SqlFileInfoStore) Search(paramsList []*model.SearchParams, userId, team
}
// handle after: before: on: filters
if len(params.OnDate) > 0 {
if params.OnDate != "" {
onDateStart, onDateEnd := params.GetOnDateMillis()
query = query.Where(sq.Expr("FI.CreateAt BETWEEN ? AND ?", strconv.FormatInt(onDateStart, 10), strconv.FormatInt(onDateEnd, 10)))
} else {
if len(params.ExcludedDate) > 0 {
if params.ExcludedDate != "" {
excludedDateStart, excludedDateEnd := params.GetExcludedDateMillis()
query = query.Where(sq.Expr("FI.CreateAt NOT BETWEEN ? AND ?", strconv.FormatInt(excludedDateStart, 10), strconv.FormatInt(excludedDateEnd, 10)))
}
if len(params.AfterDate) > 0 {
if params.AfterDate != "" {
afterDate := params.GetAfterDateMillis()
query = query.Where(sq.GtOrEq{"FI.CreateAt": strconv.FormatInt(afterDate, 10)})
}
if len(params.BeforeDate) > 0 {
if params.BeforeDate != "" {
beforeDate := params.GetBeforeDateMillis()
query = query.Where(sq.LtOrEq{"FI.CreateAt": strconv.FormatInt(beforeDate, 10)})
}
if len(params.ExcludedAfterDate) > 0 {
if params.ExcludedAfterDate != "" {
afterDate := params.GetExcludedAfterDateMillis()
query = query.Where(sq.Lt{"FI.CreateAt": strconv.FormatInt(afterDate, 10)})
}
if len(params.ExcludedBeforeDate) > 0 {
if params.ExcludedBeforeDate != "" {
beforeDate := params.GetExcludedBeforeDateMillis()
query = query.Where(sq.Gt{"FI.CreateAt": strconv.FormatInt(beforeDate, 10)})
}

Просмотреть файл

@@ -986,7 +986,7 @@ func (s *SqlGroupStore) groupsBySyncableBaseQuery(st model.GroupSyncableType, t
query = query.Where("ug.AllowReference = true")
}
if len(opts.Q) > 0 {
if opts.Q != "" {
pattern := fmt.Sprintf("%%%s%%", sanitizeSearchTerm(opts.Q, "\\"))
operatorKeyword := "ILIKE"
if s.DriverName() == model.DATABASE_DRIVER_MYSQL {
@@ -1051,7 +1051,7 @@ func (s *SqlGroupStore) getGroupsAssociatedToChannelsByTeam(st model.GroupSyncab
query = query.Where("ug.AllowReference = true")
}
if len(opts.Q) > 0 {
if opts.Q != "" {
pattern := fmt.Sprintf("%%%s%%", sanitizeSearchTerm(opts.Q, "\\"))
operatorKeyword := "ILIKE"
if s.DriverName() == model.DATABASE_DRIVER_MYSQL {
@@ -1171,7 +1171,7 @@ func (s *SqlGroupStore) GetGroups(page, perPage int, opts model.GroupSearchOpts)
groupsQuery = groupsQuery.Where("g.AllowReference = true")
}
if len(opts.Q) > 0 {
if opts.Q != "" {
pattern := fmt.Sprintf("%%%s%%", sanitizeSearchTerm(opts.Q, "\\"))
operatorKeyword := "ILIKE"
if s.DriverName() == model.DATABASE_DRIVER_MYSQL {

Просмотреть файл

@@ -62,7 +62,7 @@ func (as SqlOAuthStore) createIndexesIfNotExists() {
}
func (as SqlOAuthStore) SaveApp(app *model.OAuthApp) (*model.OAuthApp, error) {
if len(app.Id) > 0 {
if app.Id != "" {
return nil, store.NewErrInvalidInput("OAuthApp", "Id", app.Id)
}

Просмотреть файл

@@ -114,7 +114,7 @@ func (s *SqlPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, er
rootIds := make(map[string]int)
maxDateRootIds := make(map[string]int64)
for idx, post := range posts {
if len(post.Id) > 0 {
if post.Id != "" {
return nil, idx, store.NewErrInvalidInput("Post", "id", post.Id)
}
post.PreSave()
@@ -140,7 +140,7 @@ func (s *SqlPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, er
}
}
if len(post.RootId) == 0 {
if post.RootId == "" {
continue
}
@@ -199,7 +199,7 @@ func (s *SqlPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, er
unknownRepliesPosts := []*model.Post{}
for _, post := range posts {
if len(post.RootId) == 0 {
if post.RootId == "" {
count, ok := rootIds[post.Id]
if ok {
post.ReplyCount += int64(count)
@@ -285,7 +285,7 @@ func (s *SqlPostStore) Update(newPost *model.Post, oldPost *model.Post) (*model.
time := model.GetMillis()
s.GetMaster().Exec("UPDATE Channels SET LastPostAt = :LastPostAt WHERE Id = :ChannelId AND LastPostAt < :LastPostAt", map[string]interface{}{"LastPostAt": time, "ChannelId": newPost.ChannelId})
if len(newPost.RootId) > 0 {
if newPost.RootId != "" {
s.GetMaster().Exec("UPDATE Posts SET UpdateAt = :UpdateAt WHERE Id = :RootId AND UpdateAt < :UpdateAt", map[string]interface{}{"UpdateAt": time, "RootId": newPost.RootId})
s.GetMaster().Exec("UPDATE Threads SET LastReplyAt = :UpdateAt WHERE PostId = :RootId", map[string]interface{}{"UpdateAt": time, "RootId": newPost.RootId})
}
@@ -319,7 +319,7 @@ func (s *SqlPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, in
return nil, idx, errors.Wrap(err, "failed to update Post")
}
if len(post.RootId) > 0 {
if post.RootId != "" {
tx.Exec("UPDATE Threads SET LastReplyAt = :UpdateAt WHERE PostId = :RootId", map[string]interface{}{"UpdateAt": updateAt, "RootId": post.Id})
}
}
@@ -425,7 +425,7 @@ func (s *SqlPostStore) GetFlaggedPostsForChannel(userId, channelId string, offse
return pl, nil
}
func (s *SqlPostStore) getPostWithCollapsedThreads(id string, extended bool) (*model.PostList, error) {
if len(id) == 0 {
if id == "" {
return nil, store.NewErrInvalidInput("Post", "id", id)
}
@@ -460,7 +460,7 @@ func (s *SqlPostStore) Get(id string, skipFetchThreads, collapsedThreads, collap
}
pl := model.NewPostList()
if len(id) == 0 {
if id == "" {
return nil, store.NewErrInvalidInput("Post", "id", id)
}
@@ -483,7 +483,7 @@ func (s *SqlPostStore) Get(id string, skipFetchThreads, collapsedThreads, collap
rootId = post.Id
}
if len(rootId) == 0 {
if rootId == "" {
return nil, errors.Wrapf(err, "invalid rootId with value=%s", rootId)
}
@@ -1247,7 +1247,7 @@ var specialSearchChar = []string{
func (s *SqlPostStore) buildCreateDateFilterClause(params *model.SearchParams, queryParams map[string]interface{}) (string, map[string]interface{}) {
searchQuery := ""
// handle after: before: on: filters
if len(params.OnDate) > 0 {
if params.OnDate != "" {
onDateStart, onDateEnd := params.GetOnDateMillis()
queryParams["OnDateStart"] = strconv.FormatInt(onDateStart, 10)
queryParams["OnDateEnd"] = strconv.FormatInt(onDateEnd, 10)
@@ -1256,7 +1256,7 @@ func (s *SqlPostStore) buildCreateDateFilterClause(params *model.SearchParams, q
searchQuery += "AND CreateAt BETWEEN :OnDateStart AND :OnDateEnd "
} else {
if len(params.ExcludedDate) > 0 {
if params.ExcludedDate != "" {
excludedDateStart, excludedDateEnd := params.GetExcludedDateMillis()
queryParams["ExcludedDateStart"] = strconv.FormatInt(excludedDateStart, 10)
queryParams["ExcludedDateEnd"] = strconv.FormatInt(excludedDateEnd, 10)
@@ -1264,7 +1264,7 @@ func (s *SqlPostStore) buildCreateDateFilterClause(params *model.SearchParams, q
searchQuery += "AND CreateAt NOT BETWEEN :ExcludedDateStart AND :ExcludedDateEnd "
}
if len(params.AfterDate) > 0 {
if params.AfterDate != "" {
afterDate := params.GetAfterDateMillis()
queryParams["AfterDate"] = strconv.FormatInt(afterDate, 10)
@@ -1272,7 +1272,7 @@ func (s *SqlPostStore) buildCreateDateFilterClause(params *model.SearchParams, q
searchQuery += "AND CreateAt >= :AfterDate "
}
if len(params.BeforeDate) > 0 {
if params.BeforeDate != "" {
beforeDate := params.GetBeforeDateMillis()
queryParams["BeforeDate"] = strconv.FormatInt(beforeDate, 10)
@@ -1280,14 +1280,14 @@ func (s *SqlPostStore) buildCreateDateFilterClause(params *model.SearchParams, q
searchQuery += "AND CreateAt <= :BeforeDate "
}
if len(params.ExcludedAfterDate) > 0 {
if params.ExcludedAfterDate != "" {
afterDate := params.GetExcludedAfterDateMillis()
queryParams["ExcludedAfterDate"] = strconv.FormatInt(afterDate, 10)
searchQuery += "AND CreateAt < :ExcludedAfterDate "
}
if len(params.ExcludedBeforeDate) > 0 {
if params.ExcludedBeforeDate != "" {
beforeDate := params.GetExcludedBeforeDateMillis()
queryParams["ExcludedBeforeDate"] = strconv.FormatInt(beforeDate, 10)
@@ -1387,7 +1387,7 @@ func (s *SqlPostStore) search(teamId string, userId string, params *model.Search
if params.Terms == "" && params.ExcludedTerms == "" &&
len(params.InChannels) == 0 && len(params.ExcludedChannels) == 0 &&
len(params.FromUsers) == 0 && len(params.ExcludedUsers) == 0 &&
len(params.OnDate) == 0 && len(params.AfterDate) == 0 && len(params.BeforeDate) == 0 {
params.OnDate == "" && params.AfterDate == "" && params.BeforeDate == "" {
return list, nil
}
@@ -1576,7 +1576,7 @@ func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.A
COUNT(DISTINCT Posts.UserId) AS Value
FROM Posts`
if len(teamId) > 0 {
if teamId != "" {
query += " INNER JOIN Channels ON Posts.ChannelId = Channels.Id AND Channels.TeamId = :TeamId AND"
} else {
query += " WHERE"
@@ -1593,7 +1593,7 @@ func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.A
TO_CHAR(DATE(TO_TIMESTAMP(Posts.CreateAt / 1000)), 'YYYY-MM-DD') AS Name, COUNT(DISTINCT Posts.UserId) AS Value
FROM Posts`
if len(teamId) > 0 {
if teamId != "" {
query += " INNER JOIN Channels ON Posts.ChannelId = Channels.Id AND Channels.TeamId = :TeamId AND"
} else {
query += " WHERE"
@@ -1631,7 +1631,7 @@ func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCoun
query += " INNER JOIN Bots ON Posts.UserId = Bots.Userid"
}
if len(options.TeamId) > 0 {
if options.TeamId != "" {
query += " INNER JOIN Channels ON Posts.ChannelId = Channels.Id AND Channels.TeamId = :TeamId AND"
} else {
query += " WHERE"
@@ -1653,7 +1653,7 @@ func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCoun
query += " INNER JOIN Bots ON Posts.UserId = Bots.Userid"
}
if len(options.TeamId) > 0 {
if options.TeamId != "" {
query += " INNER JOIN Channels ON Posts.ChannelId = Channels.Id AND Channels.TeamId = :TeamId AND"
} else {
query += " WHERE"
@@ -1688,7 +1688,7 @@ func (s *SqlPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, must
Select("COUNT(p.Id) AS Value").
From("Posts p")
if len(teamId) > 0 {
if teamId != "" {
query = query.
Join("Channels c ON (c.Id = p.ChannelId)").
Where(sq.Eq{"c.TeamId": teamId})
@@ -2103,7 +2103,7 @@ func (s *SqlPostStore) cleanupThreads(postId, rootId, userId string, permanent b
}
return nil
}
if len(rootId) > 0 {
if rootId != "" {
thread, err := s.Thread().Get(rootId)
if err != nil {
if err != sql.ErrNoRows {
@@ -2125,7 +2125,7 @@ func (s *SqlPostStore) updateThreadsFromPosts(transaction *gorp.Transaction, pos
var rootIds []string
for _, post := range posts {
// skip if post is not a part of a thread
if len(post.RootId) == 0 {
if post.RootId == "" {
continue
}
rootIds = append(rootIds, post.RootId)

Просмотреть файл

@@ -102,7 +102,7 @@ func (s *SqlRoleStore) Save(role *model.Role) (*model.Role, error) {
return nil, store.NewErrInvalidInput("Role", "<any>", fmt.Sprintf("%v", role))
}
if len(role.Id) == 0 {
if role.Id == "" {
transaction, err := s.GetMaster().Begin()
if err != nil {
return nil, errors.Wrap(err, "begin_transaction")

Просмотреть файл

@@ -47,7 +47,7 @@ func (s SqlSchemeStore) createIndexesIfNotExists() {
}
func (s *SqlSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error) {
if len(scheme.Id) == 0 {
if scheme.Id == "" {
transaction, err := s.GetMaster().Begin()
if err != nil {
return nil, errors.Wrap(err, "begin_transaction")
@@ -213,7 +213,7 @@ func (s *SqlSchemeStore) createScheme(scheme *model.Scheme, transaction *gorp.Tr
}
scheme.Id = model.NewId()
if len(scheme.Name) == 0 {
if scheme.Name == "" {
scheme.Name = model.NewId()
}
scheme.CreateAt = model.GetMillis()
@@ -332,7 +332,7 @@ func (s *SqlSchemeStore) GetAllPage(scope string, offset int, limit int) ([]*mod
var schemes []*model.Scheme
scopeClause := ""
if len(scope) > 0 {
if scope != "" {
scopeClause = " AND Scope=:Scope "
}

Просмотреть файл

@@ -49,7 +49,7 @@ func (me SqlSessionStore) createIndexesIfNotExists() {
}
func (me SqlSessionStore) Save(session *model.Session) (*model.Session, error) {
if len(session.Id) > 0 {
if session.Id != "" {
return nil, store.NewErrInvalidInput("Session", "id", session.Id)
}
session.PreSave()

Просмотреть файл

@@ -424,7 +424,7 @@ func (ss *SqlStore) MarkSystemRanUnitTests() {
}
unitTests := props[model.SYSTEM_RAN_UNIT_TESTS]
if len(unitTests) == 0 {
if unitTests == "" {
systemTests := &model.System{Name: model.SYSTEM_RAN_UNIT_TESTS, Value: "1"}
ss.System().Save(systemTests)
}

Просмотреть файл

@@ -250,7 +250,7 @@ func (s SqlTeamStore) createIndexesIfNotExists() {
// Save adds the team to the database if a team with the same name does not already
// exist in the database. It returns the team added if the operation is successful.
func (s SqlTeamStore) Save(team *model.Team) (*model.Team, error) {
if len(team.Id) > 0 {
if team.Id != "" {
return nil, store.NewErrInvalidInput("Team", "id", team.Id)
}
@@ -335,7 +335,7 @@ func (s SqlTeamStore) GetByInviteId(inviteId string) (*model.Team, error) {
return nil, store.NewErrNotFound("Team", fmt.Sprintf("inviteId=%s", inviteId))
}
if len(inviteId) == 0 || team.InviteId != inviteId {
if inviteId == "" || team.InviteId != inviteId {
return nil, store.NewErrNotFound("Team", fmt.Sprintf("inviteId=%s", inviteId))
}
return &team, nil
@@ -405,7 +405,7 @@ func (s SqlTeamStore) teamSearchQuery(term string, opts *model.TeamSearch, count
}
}
if len(term) > 0 {
if term != "" {
term = sanitizeSearchTerm(term, "\\")
term = wildcardSearchTerm(term)

Просмотреть файл

@@ -35,7 +35,7 @@ func (s SqlTermsOfServiceStore) createIndexesIfNotExists() {
}
func (s SqlTermsOfServiceStore) Save(termsOfService *model.TermsOfService) (*model.TermsOfService, error) {
if len(termsOfService.Id) > 0 {
if termsOfService.Id != "" {
return nil, store.NewErrInvalidInput("TermsOfService", "Id", termsOfService.Id)
}

Просмотреть файл

@@ -99,7 +99,7 @@ func (us SqlUserStore) createIndexesIfNotExists() {
}
func (us SqlUserStore) Save(user *model.User) (*model.User, error) {
if len(user.Id) > 0 {
if user.Id != "" {
return nil, store.NewErrInvalidInput("User", "id", user.Id)
}

Просмотреть файл

@@ -77,7 +77,7 @@ func (s SqlWebhookStore) InvalidateWebhookCache(webhookId string) {
func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) {
if len(webhook.Id) > 0 {
if webhook.Id != "" {
return nil, store.NewErrInvalidInput("IncomingWebhook", "id", webhook.Id)
}
@@ -154,7 +154,7 @@ func (s SqlWebhookStore) GetIncomingListByUser(userId string, offset, limit int)
From("IncomingWebhooks").
Where(sq.Eq{"DeleteAt": int(0)}).Limit(uint64(limit)).Offset(uint64(offset))
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"UserId": userId})
}
@@ -182,7 +182,7 @@ func (s SqlWebhookStore) GetIncomingByTeamByUser(teamId string, userId string, o
sq.Eq{"DeleteAt": int(0)},
}).Limit(uint64(limit)).Offset(uint64(offset))
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"UserId": userId})
}
@@ -213,7 +213,7 @@ func (s SqlWebhookStore) GetIncomingByChannel(channelId string) ([]*model.Incomi
}
func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) {
if len(webhook.Id) > 0 {
if webhook.Id != "" {
return nil, store.NewErrInvalidInput("OutgoingWebhook", "id", webhook.Id)
}
@@ -254,7 +254,7 @@ func (s SqlWebhookStore) GetOutgoingListByUser(userId string, offset, limit int)
sq.Eq{"DeleteAt": int(0)},
}).Limit(uint64(limit)).Offset(uint64(offset))
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"CreatorId": userId})
}
@@ -286,7 +286,7 @@ func (s SqlWebhookStore) GetOutgoingByChannelByUser(channelId string, userId str
sq.Eq{"DeleteAt": int(0)},
})
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"CreatorId": userId})
}
if limit >= 0 && offset >= 0 {
@@ -320,7 +320,7 @@ func (s SqlWebhookStore) GetOutgoingByTeamByUser(teamId string, userId string, o
sq.Eq{"DeleteAt": int(0)},
})
if len(userId) > 0 {
if userId != "" {
query = query.Where(sq.Eq{"CreatorId": userId})
}
if limit >= 0 && offset >= 0 {
@@ -391,7 +391,7 @@ func (s SqlWebhookStore) AnalyticsIncomingCount(teamId string) (int64, error) {
WHERE
DeleteAt = 0`
if len(teamId) > 0 {
if teamId != "" {
query += " AND TeamId = :TeamId"
}
@@ -412,7 +412,7 @@ func (s SqlWebhookStore) AnalyticsOutgoingCount(teamId string) (int64, error) {
WHERE
DeleteAt = 0`
if len(teamId) > 0 {
if teamId != "" {
query += " AND TeamId = :TeamId"
}