Skip to content

Commit 8d4e6d2

Browse files
committed
initial version
1 parent 388a86e commit 8d4e6d2

18 files changed

Lines changed: 4433 additions & 163 deletions

Ugar.dpk

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ requires
3232
rtl;
3333

3434
contains
35-
Ugar in 'src\Ugar.pas';
35+
Ugar in 'src\Ugar.pas',
36+
ugar.db.mongo.Protocol in 'src\ugar.db.mongo.Protocol.pas',
37+
ugar.connection.Imp in 'src\ugar.connection.Imp.pas',
38+
ugar.db.Mongo in 'src\ugar.db.Mongo.pas',
39+
ugar.db.mongo.Imp in 'src\ugar.db.mongo.Imp.pas',
40+
ugar.db.mongo.Enum in 'src\ugar.db.mongo.Enum.pas',
41+
ugar.db.mongo.Func in 'src\ugar.db.mongo.Func.pas',
42+
ugar.db.mongo.internals in 'src\ugar.db.mongo.internals.pas',
43+
ugar.db.mongo.Query in 'src\ugar.db.mongo.Query.pas',
44+
ugar.db.mongo.protocol.Types in 'src\ugar.db.mongo.protocol.Types.pas';
3645

3746
end.
47+

Ugar.dproj

Lines changed: 88 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<PropertyGroup>
33
<ProjectGuid>{32B6930D-95E9-4A01-80C9-0E9F138965C0}</ProjectGuid>
44
<MainSource>Ugar.dpk</MainSource>
5-
<ProjectVersion>18.4</ProjectVersion>
6-
<FrameworkType>None</FrameworkType>
5+
<ProjectVersion>18.6</ProjectVersion>
6+
<FrameworkType>VCL</FrameworkType>
77
<Base>True</Base>
88
<Config Condition="'$(Config)'==''">Debug</Config>
99
<Platform Condition="'$(Platform)'==''">Win32</Platform>
@@ -49,11 +49,12 @@
4949
<DCC_K>false</DCC_K>
5050
<GenDll>true</GenDll>
5151
<GenPackage>true</GenPackage>
52-
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
52+
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
5353
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
5454
<SanitizedProjectName>Ugar</SanitizedProjectName>
5555
<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
56-
<DCC_UnitSearchPath>;modules\TMongoWire\demo\example1;modules\TMongoWire\demo\example2;modules\TMongoWire\demo\example2;modules\TMongoWire</DCC_UnitSearchPath></PropertyGroup>
56+
<DCC_UnitSearchPath>modules\TMongoWire\demo\example2;modules\TMongoWire;$(DCC_UnitSearchPath);$(DCC_UnitSearchPath);modules\GrijjyFoundation;modules\GrijjyFoundation\UnitTests\Tests;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
57+
</PropertyGroup>
5758
<PropertyGroup Condition="'$(Base_Android)'!=''">
5859
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>
5960
<EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-gcm-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar</EnabledSysJars>
@@ -88,8 +89,17 @@
8889
<DelphiCompile Include="$(MainSource)">
8990
<MainSource>MainSource</MainSource>
9091
</DelphiCompile>
91-
<DCCReference Include="rtl.dcp"></DCCReference>
92-
<DCCReference Include="src\Ugar.pas"></DCCReference>
92+
<DCCReference Include="rtl.dcp"/>
93+
<DCCReference Include="src\Ugar.pas"/>
94+
<DCCReference Include="src\ugar.db.mongo.Protocol.pas"/>
95+
<DCCReference Include="src\ugar.connection.Imp.pas"/>
96+
<DCCReference Include="src\ugar.db.Mongo.pas"/>
97+
<DCCReference Include="src\ugar.db.mongo.Imp.pas"/>
98+
<DCCReference Include="src\ugar.db.mongo.Enum.pas"/>
99+
<DCCReference Include="src\ugar.db.mongo.Func.pas"/>
100+
<DCCReference Include="src\ugar.db.mongo.internals.pas"/>
101+
<DCCReference Include="src\ugar.db.mongo.Query.pas"/>
102+
<DCCReference Include="src\ugar.db.mongo.protocol.Types.pas"/>
93103
<BuildConfiguration Include="Release">
94104
<Key>Cfg_2</Key>
95105
<CfgParent>Base</CfgParent>
@@ -116,17 +126,33 @@
116126
</Excluded_Packages>
117127
</Delphi.Personality>
118128
<Deployment Version="3">
129+
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl\Ugar.bpl" Configuration="Debug" Class="ProjectOutput">
130+
<Platform Name="Win32">
131+
<RemoteName>Ugar.bpl</RemoteName>
132+
<Overwrite>true</Overwrite>
133+
</Platform>
134+
</DeployFile>
119135
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
120136
<Platform Name="OSX32">
121137
<Overwrite>true</Overwrite>
122138
</Platform>
123139
</DeployFile>
140+
<DeployFile LocalName="$(BDS)\Redist\osx64\libcgsqlite3.dylib" Class="DependencyModule">
141+
<Platform Name="OSX64">
142+
<Overwrite>true</Overwrite>
143+
</Platform>
144+
</DeployFile>
145+
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
146+
<Platform Name="iOSSimulator">
147+
<Overwrite>true</Overwrite>
148+
</Platform>
149+
</DeployFile>
124150
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
125151
<Platform Name="iOSSimulator">
126152
<Overwrite>true</Overwrite>
127153
</Platform>
128154
</DeployFile>
129-
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
155+
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule">
130156
<Platform Name="iOSSimulator">
131157
<Overwrite>true</Overwrite>
132158
</Platform>
@@ -136,9 +162,9 @@
136162
<Overwrite>true</Overwrite>
137163
</Platform>
138164
</DeployFile>
139-
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\Ugar.bpl" Configuration="Debug" Class="ProjectOutput">
140-
<Platform Name="Win32">
141-
<RemoteName>Ugar.bpl</RemoteName>
165+
<DeployFile LocalName="C:\Users\Public\Documents\Embarcadero\Studio\20.0\Bpl\Linux64\bplUgar.so" Configuration="Debug" Class="ProjectOutput">
166+
<Platform Name="Linux64">
167+
<RemoteName>bplUgar.so</RemoteName>
142168
<Overwrite>true</Overwrite>
143169
</Platform>
144170
</DeployFile>
@@ -147,7 +173,6 @@
147173
<Operation>1</Operation>
148174
</Platform>
149175
<Platform Name="Win32">
150-
<RemoteDir>Contents\MacOS</RemoteDir>
151176
<Operation>0</Operation>
152177
</Platform>
153178
</DeployClass>
@@ -157,6 +182,12 @@
157182
<Operation>1</Operation>
158183
</Platform>
159184
</DeployClass>
185+
<DeployClass Name="AndroidFileProvider">
186+
<Platform Name="Android">
187+
<RemoteDir>res\xml</RemoteDir>
188+
<Operation>1</Operation>
189+
</Platform>
190+
</DeployClass>
160191
<DeployClass Name="AndroidGDBServer">
161192
<Platform Name="Android">
162193
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
@@ -193,6 +224,12 @@
193224
<Operation>1</Operation>
194225
</Platform>
195226
</DeployClass>
227+
<DeployClass Name="AndroidSplashStylesV21">
228+
<Platform Name="Android">
229+
<RemoteDir>res\values-v21</RemoteDir>
230+
<Operation>1</Operation>
231+
</Platform>
232+
</DeployClass>
196233
<DeployClass Name="Android_DefaultAppIcon">
197234
<Platform Name="Android">
198235
<RemoteDir>res\drawable</RemoteDir>
@@ -269,6 +306,10 @@
269306
<Operation>1</Operation>
270307
<Extensions>.framework</Extensions>
271308
</Platform>
309+
<Platform Name="OSX64">
310+
<Operation>1</Operation>
311+
<Extensions>.framework</Extensions>
312+
</Platform>
272313
<Platform Name="Win32">
273314
<Operation>0</Operation>
274315
</Platform>
@@ -278,6 +319,10 @@
278319
<Operation>1</Operation>
279320
<Extensions>.dylib</Extensions>
280321
</Platform>
322+
<Platform Name="OSX64">
323+
<Operation>1</Operation>
324+
<Extensions>.dylib</Extensions>
325+
</Platform>
281326
<Platform Name="Win32">
282327
<Operation>0</Operation>
283328
<Extensions>.dll;.bpl</Extensions>
@@ -300,6 +345,10 @@
300345
<Operation>1</Operation>
301346
<Extensions>.dylib</Extensions>
302347
</Platform>
348+
<Platform Name="OSX64">
349+
<Operation>1</Operation>
350+
<Extensions>.dylib</Extensions>
351+
</Platform>
303352
<Platform Name="Win32">
304353
<Operation>0</Operation>
305354
<Extensions>.bpl</Extensions>
@@ -321,6 +370,9 @@
321370
<Platform Name="OSX32">
322371
<Operation>0</Operation>
323372
</Platform>
373+
<Platform Name="OSX64">
374+
<Operation>0</Operation>
375+
</Platform>
324376
<Platform Name="Win32">
325377
<Operation>0</Operation>
326378
</Platform>
@@ -417,9 +469,9 @@
417469
<Operation>1</Operation>
418470
</Platform>
419471
</DeployClass>
420-
<DeployClass Name="ProjectiOSDeviceResourceRules"></DeployClass>
421-
<DeployClass Name="ProjectiOSEntitlements"></DeployClass>
422-
<DeployClass Name="ProjectiOSInfoPList"></DeployClass>
472+
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
473+
<DeployClass Name="ProjectiOSEntitlements"/>
474+
<DeployClass Name="ProjectiOSInfoPList"/>
423475
<DeployClass Name="ProjectiOSResource">
424476
<Platform Name="iOSDevice32">
425477
<Operation>1</Operation>
@@ -431,13 +483,18 @@
431483
<Operation>1</Operation>
432484
</Platform>
433485
</DeployClass>
434-
<DeployClass Name="ProjectOSXEntitlements"></DeployClass>
435-
<DeployClass Name="ProjectOSXInfoPList"></DeployClass>
486+
<DeployClass Name="ProjectOSXDebug"/>
487+
<DeployClass Name="ProjectOSXEntitlements"/>
488+
<DeployClass Name="ProjectOSXInfoPList"/>
436489
<DeployClass Name="ProjectOSXResource">
437490
<Platform Name="OSX32">
438491
<RemoteDir>Contents\Resources</RemoteDir>
439492
<Operation>1</Operation>
440493
</Platform>
494+
<Platform Name="OSX64">
495+
<RemoteDir>Contents\Resources</RemoteDir>
496+
<Operation>1</Operation>
497+
</Platform>
441498
</DeployClass>
442499
<DeployClass Required="true" Name="ProjectOutput">
443500
<Platform Name="Android">
@@ -459,6 +516,9 @@
459516
<Platform Name="OSX32">
460517
<Operation>1</Operation>
461518
</Platform>
519+
<Platform Name="OSX64">
520+
<Operation>1</Operation>
521+
</Platform>
462522
<Platform Name="Win32">
463523
<Operation>0</Operation>
464524
</Platform>
@@ -491,14 +551,15 @@
491551
<Operation>1</Operation>
492552
</Platform>
493553
</DeployClass>
494-
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"></ProjectRoot>
495-
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"></ProjectRoot>
496-
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"></ProjectRoot>
497-
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"></ProjectRoot>
498-
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"></ProjectRoot>
499-
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"></ProjectRoot>
500-
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"></ProjectRoot>
501-
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"></ProjectRoot>
554+
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
555+
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
556+
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
557+
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
558+
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
559+
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
560+
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
561+
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME)"/>
562+
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
502563
</Deployment>
503564
<Platforms>
504565
<Platform value="Android">False</Platform>
@@ -509,7 +570,7 @@
509570
</BorlandProject>
510571
<ProjectFileVersion>12</ProjectFileVersion>
511572
</ProjectExtensions>
512-
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"></Import>
513-
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"></Import>
514-
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"></Import>
573+
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
574+
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
575+
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
515576
</Project>

Ugar.res

616 Bytes
Binary file not shown.

boss.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "ugar",
3-
"description": "MongoDb connector like mongoose\r",
4-
"version": "0.0.2\r",
3+
"description": "MongoDb connector like mongoose",
4+
"version": "0.0.2",
55
"private": false,
66
"homepage": "",
77
"mainsrc": "src/",
88
"supported": "xe+",
99
"dprojFile": "",
1010
"dependencies": {
11-
"github.com/snakeice/TMongoWire": "^1.0.2"
11+
"github.com/snakeice/GrijjyFoundation": "^1.02"
1212
}
1313
}

docker-compose.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
3+
services:
4+
mongodb:
5+
image: mongo
6+
ports:
7+
- "27017:27017"
8+
volumes:
9+
- mongodata:/data/db
10+
11+
volumes:
12+
mongodata:

src/Ugar.pas

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,77 @@
22

33
interface
44

5+
uses
6+
System.Generics.Collections, ugar.db.mongo.Enum, ugar.db.mongo.Query, System.JSON, ugar.db.Mongo;
7+
58
type
6-
TUgar = class
9+
10+
TUgarBsonValue = ugar.db.mongo.Enum.TUgarBsonValue;
11+
TUgarBsonDocument = ugar.db.mongo.Enum.TUgarBsonDocument;
12+
TUgarDatabase = TUgarDatabaseFunction;
13+
UgarQuery = ugar.db.mongo.Query.TUgarTextSearchOption;
14+
TUgarTextSearchOptions = ugar.db.mongo.Query.TUgarTextSearchOptions;
15+
UgarFilter = ugar.db.mongo.Query.TUgarFilter;
16+
Projection = ugar.db.mongo.Query.TUgarProjection;
17+
TUgarSortDirection = ugar.db.mongo.Query.TUgarSortDirection;
18+
UgarSort = ugar.db.mongo.Query.TUgarSort;
19+
TUgarCurrentDateType = ugar.db.mongo.Query.TUgarCurrentDateType;
20+
UgarUpdate = ugar.db.mongo.Query.TUgarUpdate;
721

822

23+
24+
TUgar = class
25+
private
26+
FConnection: TDictionary<string, IUgarConnection>;
27+
28+
constructor Create;
929
public
10-
constructor Create();
30+
destructor Destroy; override;
31+
class function Init(AHost: string; APort: Integer; ADatabase: String): TUgarDatabase;
1132
end;
1233

1334
implementation
1435

36+
uses
37+
System.SysUtils, Ugar.Connection.Imp;
38+
39+
var
40+
_Instance: TUgar;
41+
42+
{ TUgar }
43+
44+
constructor TUgar.Create;
45+
begin
46+
FConnection := TDictionary<string, IUgarConnection>.Create;
47+
end;
48+
49+
destructor TUgar.Destroy;
50+
begin
51+
FConnection.DisposeOf;
52+
inherited;
53+
end;
54+
55+
class function TUgar.Init(AHost: string; APort: Integer; ADatabase: String): TUgarDatabase;
56+
var
57+
LConnection: IUgarConnection;
58+
LKey: string;
59+
begin
60+
Lkey := AHost + APort.ToString;
61+
if not _Instance.FConnection.TryGetValue(LKey, LConnection) then
62+
begin
63+
LConnection := TUgarConnection.Create(AHost, APort);
64+
_Instance.FConnection.Add(LKey, LConnection);
65+
end;
66+
Result := LConnection.Database[ADatabase];
67+
end;
68+
69+
70+
initialization
71+
72+
_Instance := TUgar.Create;
73+
74+
finalization
75+
76+
_Instance.DisposeOf;
77+
1578
end.

src/bson/ugar.bson.pas

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)