-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathModels.cs
More file actions
43 lines (40 loc) · 1.5 KB
/
Models.cs
File metadata and controls
43 lines (40 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// auto-generated by sqlc - do not edit
using System;
using System.Collections.Generic;
using System.Linq;
namespace QuickStartPostgresDalGen;
public readonly record struct Author(long Id, string Name, string? Bio);
public readonly record struct Book(Guid Id, string Name, long AuthorId, string? Description);
public readonly record struct ExtendedBio(string AuthorName, string Name, ExtendedBioType? BioType);
public enum ExtendedBioType
{
Invalid = 0, // reserved for invalid enum value
Autobiography = 1,
Biography = 2,
Memoir = 3
}
public static class ExtendedBioTypeExtensions
{
private static readonly Dictionary<string, ExtendedBioType> StringToEnum = new Dictionary<string, ExtendedBioType>()
{
[string.Empty] = ExtendedBioType.Invalid,
["Autobiography"] = ExtendedBioType.Autobiography,
["Biography"] = ExtendedBioType.Biography,
["Memoir"] = ExtendedBioType.Memoir
};
public static ExtendedBioType ToExtendedBioType(this string me)
{
return StringToEnum[me];
}
private static readonly Dictionary<ExtendedBioType, string> EnumToString = new Dictionary<ExtendedBioType, string>()
{
[ExtendedBioType.Invalid] = string.Empty,
[ExtendedBioType.Autobiography] = "Autobiography",
[ExtendedBioType.Biography] = "Biography",
[ExtendedBioType.Memoir] = "Memoir"
};
public static string Stringify(this ExtendedBioType me)
{
return EnumToString[me];
}
}