Skip to content

Commit a3947b4

Browse files
authored
feat: delete user (#15)
Signed-off-by: Ben <ben@tickets.bot>
1 parent 999472e commit a3947b4

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

cache/pgcache.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ var (
4848
queryGetUser string
4949
//go:embed sql/get_users.sql
5050
queryGetUsers string
51+
//go:embed sql/delete_user.sql
52+
queryDeleteUser string
5153

5254
//go:embed sql/insert_guild.sql
5355
queryInsertGuild string
@@ -230,6 +232,11 @@ func (c *PgCache) GetUsers(ctx context.Context, ids []uint64) (map[uint64]user.U
230232
return users, nil
231233
}
232234

235+
func (c *PgCache) DeleteUser(ctx context.Context, userId uint64) error {
236+
_, err := c.Exec(ctx, queryDeleteUser, userId)
237+
return err
238+
}
239+
233240
func (c *PgCache) StoreGuilds(ctx context.Context, guilds []guild.Guild) error {
234241
if !c.options.Guilds {
235242
return nil

cache/sql/delete_user.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DELETE FROM users WHERE "user_id" = $1;

0 commit comments

Comments
 (0)