Data Types next

This commit is contained in:
Michael Schimmel
2025-08-25 14:01:22 +02:00
parent 27f1cc5486
commit ce653c83b1
12 changed files with 728 additions and 878 deletions
+73
View File
@@ -0,0 +1,73 @@
unit Myc.Data.Types.Timestamp;
interface
uses
System.SysUtils,
Myc.Data.Types;
type
TImplDataTimestampType = class(TInterfacedObject, IDataType, IDataTimestampType)
strict private
class var
FSingleton: IDataTimestampType;
class constructor CreateClass;
public
function GetName: String;
function GetKind: TDataKind;
function CreateValue(const AValue: TDateTime): IDataTimestampValue;
class property Singleton: IDataTimestampType read FSingleton;
end;
TImplDataTimestampValue = class(TInterfacedObject, IDataValue, IDataTimestampValue)
private
FValue: TDateTime;
function GetDataType: IDataType;
function GetValue: TDateTime;
public
constructor Create(const AValue: TDateTime);
end;
implementation
{ TImplDataTimestampType }
class constructor TImplDataTimestampType.CreateClass;
begin
FSingleton := TImplDataTimestampType.Create;
end;
function TImplDataTimestampType.CreateValue(const AValue: TDateTime): IDataTimestampValue;
begin
Result := TImplDataTimestampValue.Create(AValue);
end;
function TImplDataTimestampType.GetName: String;
begin
Result := 'Timestamp';
end;
function TImplDataTimestampType.GetKind: TDataKind;
begin
Result := dkTimestamp;
end;
{ TImplDataTimestampValue }
constructor TImplDataTimestampValue.Create(const AValue: TDateTime);
begin
inherited Create;
FValue := AValue;
end;
function TImplDataTimestampValue.GetDataType: IDataType;
begin
Result := TImplDataTimestampType.Singleton;
end;
function TImplDataTimestampValue.GetValue: TDateTime;
begin
Result := FValue;
end;
end.