tianxiaoliang commented on a change in pull request #809:
URL: 
https://github.com/apache/servicecomb-service-center/pull/809#discussion_r553702746



##########
File path: datasource/mongo/account.go
##########
@@ -59,7 +59,7 @@ func (ds *DataSource) CreateAccount(ctx context.Context, a 
*rbacframe.Account) e
 
 func (ds *DataSource) AccountExist(ctx context.Context, key string) (bool, 
error) {
        filter := bson.M{
-               AccountName: key,
+               ColumnName: key,

Review comment:
       这个列名,似乎不易读了因为我会理解为:列名。而不是列-名

##########
File path: datasource/mongo/account.go
##########
@@ -85,15 +85,18 @@ func (ds *DataSource) GetAccount(ctx context.Context, key 
string) (*rbacframe.Ac
        var account rbacframe.Account
        err = result.Decode(&account)
        if err != nil {
-               log.Error("Decode account failed: ", err)
+               log.Error("decode account failed: ", err)
                return nil, err
        }
        return &account, nil
 }
 
 func (ds *DataSource) ListAccount(ctx context.Context, key string) 
([]*rbacframe.Account, int64, error) {
        filter := bson.M{
-               AccountName: bson.M{"$regex": key},
+               ColumnName: bson.M{"$regex": key},
+       }
+       if key == "" || len(key) == 0 {

Review comment:
       不需要2个条件,一个就够

##########
File path: datasource/mongo/account.go
##########
@@ -59,7 +59,7 @@ func (ds *DataSource) CreateAccount(ctx context.Context, a 
*rbacframe.Account) e
 
 func (ds *DataSource) AccountExist(ctx context.Context, key string) (bool, 
error) {
        filter := bson.M{
-               AccountName: key,
+               ColumnName: key,

Review comment:
       ColumnAccountName更佳

##########
File path: datasource/mongo/account.go
##########
@@ -129,11 +133,11 @@ func (ds *DataSource) DeleteAccount(ctx context.Context, 
key string) (bool, erro
 
 func (ds *DataSource) UpdateAccount(ctx context.Context, key string, account 
*rbacframe.Account) error {
        filter := bson.M{
-               AccountName: key,
+               ColumnName: key,
        }
        update := bson.M{
-               "$set": bson.M{AccountID: account.ID, AccountPassword: 
account.Name, AccountRole: account.Roles, AccountTokenExpirationTime: 
account.TokenExpirationTime,
-                       AccountCurrentPassword: account.CurrentPassword, 
AccountStatus: account.Status,
+               "$set": bson.M{ColumnID: account.ID, ColumnName: account.Name, 
ColumnPassword: account.Password, ColumnRole: account.Roles, 
ColumnTokenExpirationTime: account.TokenExpirationTime,

Review comment:
       不易读,折行




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to