-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathModels.cs
More file actions
173 lines (165 loc) · 5.62 KB
/
Models.cs
File metadata and controls
173 lines (165 loc) · 5.62 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// auto-generated by sqlc - do not edit
using NodaTime;
using NodaTime.Extensions;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text.Json;
namespace MySqlConnectorDapperExampleGen;
public class Author
{
public required long Id { get; init; }
public required string Name { get; init; }
public string? Bio { get; init; }
};
public class Book
{
public required long Id { get; init; }
public required string Name { get; init; }
public required long AuthorId { get; init; }
public string? Description { get; init; }
};
public class MysqlNumericType
{
public bool? CBool { get; init; }
public bool? CBoolean { get; init; }
public short? CTinyint { get; init; }
public short? CSmallint { get; init; }
public int? CMediumint { get; init; }
public int? CInt { get; init; }
public int? CInteger { get; init; }
public long? CBigint { get; init; }
public double? CFloat { get; init; }
public decimal? CDecimal { get; init; }
public decimal? CDec { get; init; }
public decimal? CNumeric { get; init; }
public decimal? CFixed { get; init; }
public double? CDouble { get; init; }
public double? CDoublePrecision { get; init; }
};
public class MysqlStringType
{
public string? CChar { get; init; }
public string? CNchar { get; init; }
public string? CNationalChar { get; init; }
public string? CVarchar { get; init; }
public string? CTinytext { get; init; }
public string? CMediumtext { get; init; }
public string? CText { get; init; }
public string? CLongtext { get; init; }
public JsonElement? CJson { get; init; }
public JsonElement? CJsonStringOverride { get; init; }
public MysqlStringTypesCEnum? CEnum { get; init; }
public HashSet<MysqlStringTypesCSet>? CSet { get; init; }
};
public class MysqlDatetimeType
{
public short? CYear { get; init; }
public DateTime? CDate { get; init; }
public DateTime? CDatetime { get; init; }
public DateTime? CTimestamp { get; init; }
public TimeSpan? CTime { get; init; }
public DateTime? CTimestampNodaInstantOverride { get; init; }
};
public class MysqlBinaryType
{
public byte? CBit { get; init; }
public byte[]? CBinary { get; init; }
public byte[]? CVarbinary { get; init; }
public byte[]? CTinyblob { get; init; }
public byte[]? CBlob { get; init; }
public byte[]? CMediumblob { get; init; }
public byte[]? CLongblob { get; init; }
};
public class ExtendedBio
{
public string? AuthorName { get; init; }
public string? Name { get; init; }
public BiosBioType? BioType { get; init; }
public HashSet<BiosAuthorType>? AuthorType { get; init; }
};
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 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 HashSet<BiosAuthorType> ToBiosAuthorTypeSet(this string me)
{
return new HashSet<BiosAuthorType>(me.Split(',').ToList().Select(v => StringToEnum[v]));
}
}
public enum MysqlStringTypesCEnum
{
Invalid = 0, // reserved for invalid enum value
Small = 1,
Medium = 2,
Big = 3
}
public static class MysqlStringTypesCEnumExtensions
{
private static readonly Dictionary<string, MysqlStringTypesCEnum> StringToEnum = new Dictionary<string, MysqlStringTypesCEnum>()
{
[string.Empty] = MysqlStringTypesCEnum.Invalid,
["small"] = MysqlStringTypesCEnum.Small,
["medium"] = MysqlStringTypesCEnum.Medium,
["big"] = MysqlStringTypesCEnum.Big
};
public static HashSet<MysqlStringTypesCEnum> ToMysqlStringTypesCEnumSet(this string me)
{
return new HashSet<MysqlStringTypesCEnum>(me.Split(',').ToList().Select(v => StringToEnum[v]));
}
}
public enum MysqlStringTypesCSet
{
Invalid = 0, // reserved for invalid enum value
Tea = 1,
Coffee = 2,
Milk = 3
}
public static class MysqlStringTypesCSetExtensions
{
private static readonly Dictionary<string, MysqlStringTypesCSet> StringToEnum = new Dictionary<string, MysqlStringTypesCSet>()
{
[string.Empty] = MysqlStringTypesCSet.Invalid,
["tea"] = MysqlStringTypesCSet.Tea,
["coffee"] = MysqlStringTypesCSet.Coffee,
["milk"] = MysqlStringTypesCSet.Milk
};
public static HashSet<MysqlStringTypesCSet> ToMysqlStringTypesCSetSet(this string me)
{
return new HashSet<MysqlStringTypesCSet>(me.Split(',').ToList().Select(v => StringToEnum[v]));
}
}