go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

monc cache is bug

Open yasin-wu opened this issue 2 years ago • 1 comments

Describe the bug data.id.hex is nil

  1. The code is

func (m *defaultUserModel) FindOne(ctx context.Context, id string) (*User, error) { oid, err := primitive.ObjectIDFromHex(id) if err != nil { return nil, ErrInvalidObjectId }

var data User
key := prefixUserCacheKey + data.ID.Hex()
err = m.conn.FindOne(ctx, key, &data, bson.M{"_id": oid})
switch err {
case nil:
	return &data, nil
case monc.ErrNotFound:
	return nil, ErrNotFound
default:
	return nil, err
}

}


- OS: [e.g. Mac]
- go-zero version [e.g. 1.3.4]
- goctl version [e.g. 1.3.8, optional]

**More description**
Add any other context about the problem here.

yasin-wu avatar Jul 01 '22 01:07 yasin-wu

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jul 31 '22 02:07 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Aug 14 '22 02:08 github-actions[bot]