Feat: add cleaner cron
This commit is contained in:
		| @@ -104,3 +104,7 @@ func (p *RepoProvider) InitTx(ctx context.Context) (context.Context, *sqlx.Tx, e | ||||
| 	} | ||||
| 	return context.WithValue(ctx, "tx", tx), tx, nil | ||||
| } | ||||
|  | ||||
| func (p *RepoProvider) Close() { | ||||
| 	p.DB.Close() | ||||
| } | ||||
|   | ||||
| @@ -16,6 +16,7 @@ type PlayersRepo interface { | ||||
| 	PlayerExitRoom(ctx context.Context, username string) error | ||||
| 	PlayerListNames(ctx context.Context) ([]string, error) | ||||
| 	PlayerList(ctx context.Context, isBot bool) ([]models.Player, error) | ||||
| 	PlayerListByRoom(ctx context.Context, roomID string) ([]models.Player, error) | ||||
| } | ||||
|  | ||||
| func (p *RepoProvider) PlayerListNames(ctx context.Context) ([]string, error) { | ||||
| @@ -85,3 +86,12 @@ func (p *RepoProvider) PlayerList(ctx context.Context, isBot bool) ([]models.Pla | ||||
| 	} | ||||
| 	return players, nil | ||||
| } | ||||
|  | ||||
| func (p *RepoProvider) PlayerListByRoom(ctx context.Context, roomID string) ([]models.Player, error) { | ||||
| 	var players []models.Player | ||||
| 	err := sqlx.SelectContext(ctx, p.DB, &players, "SELECT id, room_id, username, team, role, is_bot FROM players WHERE room_id = ?", roomID) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	return players, nil | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Grail Finder
					Grail Finder