mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-24 16:43:17 +01:00
Mastodon connection helper tweaks (#13)
This commit is contained in:
parent
80bae5652b
commit
47a3e4acd4
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ launchSettings.json
|
||||
.DS_Store
|
||||
data/
|
||||
output/
|
||||
*.DotSettings.user
|
@ -6,16 +6,16 @@ public static class MastodonConnectionHelper
|
||||
{
|
||||
public static async Task<List<string>> GetFollowedTagsAsync()
|
||||
{
|
||||
var res = new List<string>();
|
||||
|
||||
if (Config.Instance == null)
|
||||
if (Config.Instance == null) throw new Exception("Config object is not initialized");
|
||||
if (Config.Instance.MastodonPostgresConnectionString.IsNullOrEmpty())
|
||||
{
|
||||
throw new Exception("Config object is not initialized");
|
||||
throw new Exception("Missing mastodon postgres connection string");
|
||||
}
|
||||
|
||||
await using var conn = new NpgsqlConnection(Config.Instance.MastodonPostgresConnectionString);
|
||||
await conn.OpenAsync();
|
||||
|
||||
var res = new List<string>();
|
||||
await using var cmd = new NpgsqlCommand("SELECT DISTINCT tags.name FROM tag_follows JOIN tags ON tag_id = tags.id ORDER BY tags.name ASC;", conn);
|
||||
await using var reader = await cmd.ExecuteReaderAsync();
|
||||
while (await reader.ReadAsync())
|
||||
|
Loading…
Reference in New Issue
Block a user