Skip to content

Commit

Permalink
Initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Nov 21, 2013
0 parents commit 875a566
Show file tree
Hide file tree
Showing 59 changed files with 6,503 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Properties
bin
obj
*.suo
*.user
*.sublime*
node_modules
155 changes: 155 additions & 0 deletions Iridium.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A937B8F5-CB90-46AD-AB3C-1EBD8E827378}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Iridium</RootNamespace>
<AssemblyName>Iridium</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="index.js" />
<Content Include="nodelib\assert.js" />
<Content Include="nodelib\buffer.js" />
<Content Include="nodelib\child_process.js" />
<Content Include="nodelib\cluster.js" />
<Content Include="nodelib\console.js" />
<Content Include="nodelib\core.js" />
<Content Include="nodelib\crypto.js" />
<Content Include="nodelib\dgram.js" />
<Content Include="nodelib\dns.js" />
<Content Include="nodelib\domain.js" />
<Content Include="nodelib\events.js" />
<Content Include="nodelib\fs.js" />
<Content Include="nodelib\http.js" />
<Content Include="nodelib\https.js" />
<Content Include="nodelib\lodash.js" />
<Content Include="nodelib\mocha.js" />
<Content Include="nodelib\module.js" />
<Content Include="nodelib\net.js" />
<Content Include="nodelib\node.js" />
<Content Include="nodelib\os.js" />
<Content Include="nodelib\path.js" />
<Content Include="nodelib\process.js" />
<Content Include="nodelib\punycode.js" />
<Content Include="nodelib\querystring.js" />
<Content Include="nodelib\readline.js" />
<Content Include="nodelib\repl.js" />
<Content Include="nodelib\should.js" />
<Content Include="nodelib\stream.js" />
<Content Include="nodelib\stringdecoder.js" />
<Content Include="nodelib\superagent.js" />
<Content Include="nodelib\supertest.js" />
<Content Include="nodelib\tls.js" />
<Content Include="nodelib\tty.js" />
<Content Include="nodelib\url.js" />
<Content Include="nodelib\util.js" />
<Content Include="nodelib\vm.js" />
<Content Include="nodelib\zlib.js" />
<Content Include="package.json" />
<Content Include="README.md" />
<Content Include="tests\run.sh" />
</ItemGroup>
<ItemGroup>
<Content Include="example\User.js" />
<Content Include="lib\Database.js" />
<Content Include="lib\Instance.js" />
<Content Include="lib\Model.js" />
<Content Include="lib\utils\String.js" />
<Content Include="lib\utils\transforms.js" />
<Content Include="lib\utils\validation.js" />
<Content Include="tests\.gitignore" />
<Content Include="tests\common.js" />
<Content Include="tests\config.example.js" />
<Content Include="tests\config.js" />
<Content Include="tests\integration\orm.js" />
<Content Include="tests\integration\utils.js" />
<Content Include="tests\logging.js" />
<Content Include="tests\run.js" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>64607</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:64607/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
22 changes: 22 additions & 0 deletions Iridium.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Iridium", "Iridium.csproj", "{A937B8F5-CB90-46AD-AB3C-1EBD8E827378}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A937B8F5-CB90-46AD-AB3C-1EBD8E827378}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Iridium - A bare metal ORM for MongoDB
Iridium was designed to alleviate many of the issues often present in modern ORMs, especially those designed for NoSQL datastores like MongoDB. Namely, these include a high level of bloat and an excessive amount of documentation - vastly raising the barrier to entry. On the flip side of the coin, they also tend to abstract core database functionality away from the developer to the extent that they end up jumping through unnecessary hoops just to get the results they're looking for.

Iridium hopes to solve these issues by providing a bare bones ORM targeted at power users, and those looking for an exceptionally low overhead. It provides much of the indispensable functionality found in ORMs without the fluff.

## Features
- **Flexible Schema Validation**
MongoDB's greatest strength is its ability to support dynamic schemas, we think that's a great idea but sometimes it's necessary to be able to validate aspects of your models. That's where Iridium's validation framework comes in - with an intuitive schema design framework with support for optional and dynamic fields, you'll never find yourself stuck again.
- **Powerful Transforms**
Anyone familiar with MongoDB knows the headaches that ObjectID causes due to its custom datatype. We also know that sometimes custom datatypes are unavoidable, or preferable for storage - though not necessarily ideal for processing. Iridium allows you to define a set of up-down transforms which are applied to parts of your model so that your code doesn't need to worry about these inconsistencies, and you can get down to writing the code you want to.
- **IntelliSense Support**
We understand the value of an easy to use library, and having to go *documentation diving* every time you want to find out how to use a function is a pain we're all to familiar with. Iridium was designed from the ground up to include support for Visual Studio's IntelliSense engine - reducing the number of round trips between documentation and your code.
- **Express Support**
Everyone who has written code using Node.js knows about Express, to help make your life easier we've included support right out of the box for Express.
- **Powerful Models**
Iridium's models are designed to exist as individual files or modules within your application, this helps simplify management of your models and separates database design code from your application code. In addition to this, Iridium supports virtual properties, extension methods, transforms, client side property renaming and validations in an easy to understand and implement package.

## Example
```js
var iridium = require('iridium');

var database = new iridium({
database: 'demo'
});

database.register('User', new iridium.Model('user', {
firstname: String,
lastname: String,
since: Date,
clown: Boolean,
houses: [{
address: String,
colour: /Red|White|Blue|Green|Pink/
}]
}));

database.connect(function(err, db) {
if(err) throw err;

// at this point database == db

db.User.create({
firstname: 'Billy',
lastname: 'Bob',
since: new Date(),
clown: true,
houses: [
{ address: 'The middle of nowhere', colour: 'Red' }
]
}, function(err, user) {
if(err) throw err;

console.log(JSON.stringify(user));
});
});

```

## Core
The Iridium core (that sounds WAY cooler than I intended when I came up with the name) is where you create a database connection and register any models to be used by the database. Registration of models is optional, however it makes accessing them easier.

When using Iridium, you are required to instantiate a core with a settings object which describes the database server you want to connect to. This is done by calling the core's constructor and passing an object similar to the following.

```js
{
host: 'localhost', // Optional
port: 27018, // Optional
username: '', // Optional
password: '', // Optional
database: 'iridium'
}
```

Once you've got a core, you need to connect it to the database. This is done by calling the core's *connect* method and giving it a callback function.
TODO

## Models
TODO

## Instances
TODO
Loading

0 comments on commit 875a566

Please sign in to comment.