mirror of
https://github.com/g3rv4/GetMoarFediverse.git
synced 2024-11-21 23:23:09 +01:00
Mastodon connection helper tweaks (#13)
This commit is contained in:
parent
80bae5652b
commit
47a3e4acd4
3
.gitignore
vendored
3
.gitignore
vendored
@ -7,4 +7,5 @@ launchSettings.json
|
|||||||
.idea/
|
.idea/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
data/
|
data/
|
||||||
output/
|
output/
|
||||||
|
*.DotSettings.user
|
@ -6,16 +6,16 @@ public static class MastodonConnectionHelper
|
|||||||
{
|
{
|
||||||
public static async Task<List<string>> GetFollowedTagsAsync()
|
public static async Task<List<string>> GetFollowedTagsAsync()
|
||||||
{
|
{
|
||||||
var res = new List<string>();
|
if (Config.Instance == null) throw new Exception("Config object is not initialized");
|
||||||
|
if (Config.Instance.MastodonPostgresConnectionString.IsNullOrEmpty())
|
||||||
if (Config.Instance == null)
|
|
||||||
{
|
{
|
||||||
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 using var conn = new NpgsqlConnection(Config.Instance.MastodonPostgresConnectionString);
|
||||||
await conn.OpenAsync();
|
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 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();
|
await using var reader = await cmd.ExecuteReaderAsync();
|
||||||
while (await reader.ReadAsync())
|
while (await reader.ReadAsync())
|
||||||
|
Loading…
Reference in New Issue
Block a user