Add extension method for millis
This commit is contained in:
parent
743502055d
commit
c5e99d9d8d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
src/**/bin
|
src/**/bin
|
||||||
src/**/obj
|
src/**/obj
|
||||||
src/**/appsettings.*.json
|
src/**/appsettings.*.json
|
||||||
|
src/.vs
|
||||||
|
|
|
@ -20,8 +20,7 @@ namespace JobsJobsJobs.Server.Data
|
||||||
/// <returns>A populated citizen</returns>
|
/// <returns>A populated citizen</returns>
|
||||||
private static Citizen ToCitizen(NpgsqlDataReader rdr) =>
|
private static Citizen ToCitizen(NpgsqlDataReader rdr) =>
|
||||||
new Citizen(CitizenId.Parse(rdr.GetString("id")), rdr.GetString("na_user"), rdr.GetString("display_name"),
|
new Citizen(CitizenId.Parse(rdr.GetString("id")), rdr.GetString("na_user"), rdr.GetString("display_name"),
|
||||||
rdr.GetString("profile_url"), new Milliseconds(rdr.GetInt64("joined_on")),
|
rdr.GetString("profile_url"), rdr.GetMilliseconds("joined_on"), rdr.GetMilliseconds("last_seen_on"));
|
||||||
new Milliseconds(rdr.GetInt64("last_seen_on")));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve a citizen by their No Agenda Social user name
|
/// Retrieve a citizen by their No Agenda Social user name
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Npgsql;
|
using JobsJobsJobs.Shared;
|
||||||
|
using Npgsql;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -24,5 +25,13 @@ namespace JobsJobsJobs.Server.Data
|
||||||
/// <param name="name">The name of the field to be retrieved as a 64-bit integer</param>
|
/// <param name="name">The name of the field to be retrieved as a 64-bit integer</param>
|
||||||
/// <returns>The specified field as a 64-bit integer</returns>
|
/// <returns>The specified field as a 64-bit integer</returns>
|
||||||
public static long GetInt64(this NpgsqlDataReader rdr, string name) => rdr.GetInt64(rdr.GetOrdinal(name));
|
public static long GetInt64(this NpgsqlDataReader rdr, string name) => rdr.GetInt64(rdr.GetOrdinal(name));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get milliseconds by its name
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of the field to be retrieved as milliseconds</param>
|
||||||
|
/// <returns>The specified field as milliseconds</returns>
|
||||||
|
public static Milliseconds GetMilliseconds(this NpgsqlDataReader rdr, string name) =>
|
||||||
|
new Milliseconds(rdr.GetInt64(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user