-
Notifications
You must be signed in to change notification settings - Fork 7
/
SQLG.Types.pas
58 lines (40 loc) · 1.1 KB
/
SQLG.Types.pas
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
unit SQLG.Types;
interface
uses
System.Rtti, SQLG.Condition;
type
TCustomAttributeValue<T> = class(TCustomAttribute)
private
FValue: T;
public
constructor Create(const Value: T);
property Value: T read FValue;
end;
FieldNameAttribute = class(TCustomAttributeValue<string>);
TableNameAttribute = class(TCustomAttributeValue<string>);
DEFAULTAttribute = class(TCustomAttribute)
private
FValue: TValue;
public
constructor Create(const Value: Variant);
property Value: TValue read FValue;
end;
UNIQUEAttribute = class(TCustomAttribute);
NOTNULLAttribute = class(TCustomAttribute);
PRIMARYKEYAttribute = class(TCustomAttribute);
CHECKAttribute = class(TCustomAttributeValue<TSQLCondition>);
LENGTHAttribute = class(TCustomAttributeValue<Integer>);
implementation
{ TCustomAttributeValue<T> }
constructor TCustomAttributeValue<T>.Create(const Value: T);
begin
inherited Create;
FValue := Value;
end;
{ DEFAULTAttribute }
constructor DEFAULTAttribute.Create(const Value: Variant);
begin
inherited Create;
FValue := TValue.From(Value);
end;
end.