MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / DeleteUser

Method DeleteUser

internal/repository/user.go:124–143  ·  view source on GitHub ↗

DeleteUser 删除用户

(ctx context.Context, username string, uid int64)

Source from the content-addressed store, hash-verified

122
123// DeleteUser 删除用户
124func (ur *userRepository) DeleteUser(ctx context.Context, username string, uid int64) error {
125 err := ur.dao.DeleteUser(ctx, username, uid)
126 if err != nil {
127 ur.l.Error("删除用户失败", zap.Error(err))
128 return err
129 }
130
131 // 异步删除缓存
132 go func() {
133 ctx := context.Background()
134 du, err := ur.cache.Get(ctx, uid)
135 if err == nil {
136 if err := ur.cache.Set(ctx, domain.User{ID: du.ID, Deleted: true}); err != nil {
137 ur.l.Error("删除用户后更新缓存失败", zap.Error(err))
138 }
139 }
140 }()
141
142 return nil
143}
144
145// UpdateProfile 更新用户资料
146func (ur *userRepository) UpdateProfile(ctx context.Context, profile domain.Profile) error {

Callers

nothing calls this directly

Calls 3

DeleteUserMethod · 0.65
GetMethod · 0.65
SetMethod · 0.65

Tested by

no test coverage detected