-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathModels.cs
More file actions
64 lines (58 loc) · 2.04 KB
/
Copy pathModels.cs
File metadata and controls
64 lines (58 loc) · 2.04 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// auto-generated by sqlc - do not edit
using System;
using System.Collections.Generic;
using System.Linq;
namespace QuickStartMySqlDalGen;
public readonly record struct Author(long Id, string Name, string? Bio);
public readonly record struct Book(long Id, string Name, long AuthorId, string? Description);
public readonly record struct ExtendedBio(string? AuthorName, string? Name, BiosBioType? BioType, HashSet<BiosAuthorType>? AuthorType);
public enum BiosBioType
{
Invalid = 0, // reserved for invalid enum value
Autobiography = 1,
Biography = 2,
Memoir = 3
}
public static class BiosBioTypeExtensions
{
private static readonly Dictionary<string, BiosBioType> StringToEnum = new Dictionary<string, BiosBioType>()
{
[string.Empty] = BiosBioType.Invalid,
["Autobiography"] = BiosBioType.Autobiography,
["Biography"] = BiosBioType.Biography,
["Memoir"] = BiosBioType.Memoir
};
public static BiosBioType ToBiosBioType(this string me)
{
return StringToEnum[me];
}
public static HashSet<BiosBioType> ToBiosBioTypeSet(this string me)
{
return new HashSet<BiosBioType>(me.Split(',').ToList().Select(v => StringToEnum[v]));
}
}
public enum BiosAuthorType
{
Invalid = 0, // reserved for invalid enum value
Author = 1,
Editor = 2,
Translator = 3
}
public static class BiosAuthorTypeExtensions
{
private static readonly Dictionary<string, BiosAuthorType> StringToEnum = new Dictionary<string, BiosAuthorType>()
{
[string.Empty] = BiosAuthorType.Invalid,
["Author"] = BiosAuthorType.Author,
["Editor"] = BiosAuthorType.Editor,
["Translator"] = BiosAuthorType.Translator
};
public static BiosAuthorType ToBiosAuthorType(this string me)
{
return StringToEnum[me];
}
public static HashSet<BiosAuthorType> ToBiosAuthorTypeSet(this string me)
{
return new HashSet<BiosAuthorType>(me.Split(',').ToList().Select(v => StringToEnum[v]));
}
}