// Trim the name in case it is longer than db can store
logger.Warn("Skipping updating display_name: value received from Google longer than max length of 255 chars.",zap.String("display_name",displayName))
displayName=dbDisplayName.String
vardisplayNamestring
iflen(googleProfile.Name)<=255{
displayName=googleProfile.Name
}else{
logger.Warn("Skipping updating display_name: value received from Google longer than max length of 255 chars.",zap.String("display_name",googleProfile.Name))
}
avatarUrl:=googleProfile.Picture
iflen(avatarUrl)>512||avatarUrl==""{
// Ignore the url in case it is longer than db can store
varavatarUrlstring
iflen(googleProfile.Picture)<=512{
avatarUrl=googleProfile.Picture
}else{
logger.Warn("Skipping updating avatar_url: value received from Google longer than max length of 512 chars.",zap.String("avatar_url",avatarUrl))
if_,err=db.ExecContext(ctx,"UPDATE users SET "+strings.Join(statements,", ")+", update_time = now() WHERE id = $1",params...);err!=nil{
// Failure to update does not interrupt the execution. Just log the error and continue.
logger.Error("Error in updating google profile details",zap.Error(err),zap.String("googleId",googleProfile.Sub),zap.String("display_name",googleProfile.Name),zap.String("display_name",googleProfile.Picture))
// Do no return error. Failure to update the display_name / avatar_url should not
// interrupt the execution. Ignore the result and the error, just log the error.