Fix inconsistencies in variable names for struct methods (#13561)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d8ac09b302
Коммит
092e53ace2
@@ -48,12 +48,12 @@ func (s SqlComplianceStore) Save(compliance *model.Compliance) (*model.Complianc
|
||||
return compliance, nil
|
||||
}
|
||||
|
||||
func (us SqlComplianceStore) Update(compliance *model.Compliance) (*model.Compliance, *model.AppError) {
|
||||
func (s SqlComplianceStore) Update(compliance *model.Compliance) (*model.Compliance, *model.AppError) {
|
||||
if err := compliance.IsValid(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if _, err := us.GetMaster().Update(compliance); err != nil {
|
||||
if _, err := s.GetMaster().Update(compliance); err != nil {
|
||||
return nil, model.NewAppError("SqlComplianceStore.Update", "store.sql_compliance.save.saving.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return compliance, nil
|
||||
@@ -69,8 +69,8 @@ func (s SqlComplianceStore) GetAll(offset, limit int) (model.Compliances, *model
|
||||
return compliances, nil
|
||||
}
|
||||
|
||||
func (us SqlComplianceStore) Get(id string) (*model.Compliance, *model.AppError) {
|
||||
obj, err := us.GetReplica().Get(model.Compliance{}, id)
|
||||
func (s SqlComplianceStore) Get(id string) (*model.Compliance, *model.AppError) {
|
||||
obj, err := s.GetReplica().Get(model.Compliance{}, id)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("SqlComplianceStore.Get", "store.sql_compliance.get.finding.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
@@ -254,15 +254,15 @@ func (fs SqlFileInfoStore) PermanentDelete(fileId string) *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s SqlFileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
func (fs SqlFileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, *model.AppError) {
|
||||
var query string
|
||||
if s.DriverName() == "postgres" {
|
||||
if fs.DriverName() == "postgres" {
|
||||
query = "DELETE from FileInfo WHERE Id = any (array (SELECT Id FROM FileInfo WHERE CreateAt < :EndTime LIMIT :Limit))"
|
||||
} else {
|
||||
query = "DELETE from FileInfo WHERE CreateAt < :EndTime LIMIT :Limit"
|
||||
}
|
||||
|
||||
sqlResult, err := s.GetMaster().Exec(query, map[string]interface{}{"EndTime": endTime, "Limit": limit})
|
||||
sqlResult, err := fs.GetMaster().Exec(query, map[string]interface{}{"EndTime": endTime, "Limit": limit})
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlFileInfoStore.PermanentDeleteBatch", "store.sql_file_info.permanent_delete_batch.app_error", nil, ""+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
@@ -275,10 +275,10 @@ func (s SqlFileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) (int6
|
||||
return rowsAffected, nil
|
||||
}
|
||||
|
||||
func (s SqlFileInfoStore) PermanentDeleteByUser(userId string) (int64, *model.AppError) {
|
||||
func (fs SqlFileInfoStore) PermanentDeleteByUser(userId string) (int64, *model.AppError) {
|
||||
query := "DELETE from FileInfo WHERE CreatorId = :CreatorId"
|
||||
|
||||
sqlResult, err := s.GetMaster().Exec(query, map[string]interface{}{"CreatorId": userId})
|
||||
sqlResult, err := fs.GetMaster().Exec(query, map[string]interface{}{"CreatorId": userId})
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("SqlFileInfoStore.PermanentDeleteByUser", "store.sql_file_info.PermanentDeleteByUser.app_error", nil, ""+err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
@@ -263,20 +263,20 @@ func setupConnection(con_type string, dataSource string, settings *model.SqlSett
|
||||
return dbmap
|
||||
}
|
||||
|
||||
func (s *SqlSupplier) initConnection() {
|
||||
s.master = setupConnection("master", *s.settings.DataSource, s.settings)
|
||||
func (ss *SqlSupplier) initConnection() {
|
||||
ss.master = setupConnection("master", *ss.settings.DataSource, ss.settings)
|
||||
|
||||
if len(s.settings.DataSourceReplicas) > 0 {
|
||||
s.replicas = make([]*gorp.DbMap, len(s.settings.DataSourceReplicas))
|
||||
for i, replica := range s.settings.DataSourceReplicas {
|
||||
s.replicas[i] = setupConnection(fmt.Sprintf("replica-%v", i), replica, s.settings)
|
||||
if len(ss.settings.DataSourceReplicas) > 0 {
|
||||
ss.replicas = make([]*gorp.DbMap, len(ss.settings.DataSourceReplicas))
|
||||
for i, replica := range ss.settings.DataSourceReplicas {
|
||||
ss.replicas[i] = setupConnection(fmt.Sprintf("replica-%v", i), replica, ss.settings)
|
||||
}
|
||||
}
|
||||
|
||||
if len(s.settings.DataSourceSearchReplicas) > 0 {
|
||||
s.searchReplicas = make([]*gorp.DbMap, len(s.settings.DataSourceSearchReplicas))
|
||||
for i, replica := range s.settings.DataSourceSearchReplicas {
|
||||
s.searchReplicas[i] = setupConnection(fmt.Sprintf("search-replica-%v", i), replica, s.settings)
|
||||
if len(ss.settings.DataSourceSearchReplicas) > 0 {
|
||||
ss.searchReplicas = make([]*gorp.DbMap, len(ss.settings.DataSourceSearchReplicas))
|
||||
for i, replica := range ss.settings.DataSourceSearchReplicas {
|
||||
ss.searchReplicas[i] = setupConnection(fmt.Sprintf("search-replica-%v", i), replica, ss.settings)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,8 +834,8 @@ func (s SqlTeamStore) RemoveAllMembersByUser(userId string) *model.AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (us SqlTeamStore) UpdateLastTeamIconUpdate(teamId string, curTime int64) *model.AppError {
|
||||
if _, err := us.GetMaster().Exec("UPDATE Teams SET LastTeamIconUpdate = :Time, UpdateAt = :Time WHERE Id = :teamId", map[string]interface{}{"Time": curTime, "teamId": teamId}); err != nil {
|
||||
func (s SqlTeamStore) UpdateLastTeamIconUpdate(teamId string, curTime int64) *model.AppError {
|
||||
if _, err := s.GetMaster().Exec("UPDATE Teams SET LastTeamIconUpdate = :Time, UpdateAt = :Time WHERE Id = :teamId", map[string]interface{}{"Time": curTime, "teamId": teamId}); err != nil {
|
||||
return model.NewAppError("SqlTeamStore.UpdateLastTeamIconUpdate", "store.sql_team.update_last_team_icon_update.app_error", nil, "team_id="+teamId, http.StatusInternalServerError)
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -490,8 +490,8 @@ func applyTeamGroupConstrainedFilter(query sq.SelectBuilder, teamId string) sq.S
|
||||
)`, teamId)
|
||||
}
|
||||
|
||||
func (s SqlUserStore) GetEtagForProfiles(teamId string) string {
|
||||
updateAt, err := s.GetReplica().SelectInt("SELECT UpdateAt FROM Users, TeamMembers WHERE TeamMembers.TeamId = :TeamId AND Users.Id = TeamMembers.UserId ORDER BY UpdateAt DESC LIMIT 1", map[string]interface{}{"TeamId": teamId})
|
||||
func (us SqlUserStore) GetEtagForProfiles(teamId string) string {
|
||||
updateAt, err := us.GetReplica().SelectInt("SELECT UpdateAt FROM Users, TeamMembers WHERE TeamMembers.TeamId = :TeamId AND Users.Id = TeamMembers.UserId ORDER BY UpdateAt DESC LIMIT 1", map[string]interface{}{"TeamId": teamId})
|
||||
if err != nil {
|
||||
return fmt.Sprintf("%v.%v", model.CurrentVersion, model.GetMillis())
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user