Skip to content

Commit a5fe0c2

Browse files
author
Joseph Schultz
committed
Initial Commit
0 parents  commit a5fe0c2

38 files changed

+1735
-0
lines changed

Diff for: .github/postgrest-csharp.png

105 KB
Loading

Diff for: .gitignore

+405
Large diffs are not rendered by default.

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Joseph Schultz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: Postgrest/Attributes/BooleanAttribute.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Postgrest.Attributes
5+
{
6+
[AttributeUsage(AttributeTargets.Property)]
7+
public class BooleanAttribute : Attribute
8+
{
9+
public Type CoerceInto { get => typeof(bool); }
10+
public string PropertyName { get; set; }
11+
12+
public BooleanAttribute([CallerMemberName] string propertyName = null)
13+
{
14+
PropertyName = propertyName;
15+
}
16+
}
17+
}

Diff for: Postgrest/Attributes/FloatAttribute.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Postgrest.Attributes
5+
{
6+
[AttributeUsage(AttributeTargets.Property)]
7+
public class FloatAttribute : Attribute
8+
{
9+
public Type CoerceInto { get => typeof(float); }
10+
public string PropertyName { get; set; }
11+
12+
public FloatAttribute([CallerMemberName] string propertyName = null)
13+
{
14+
PropertyName = propertyName;
15+
}
16+
}
17+
}

Diff for: Postgrest/Attributes/IntegerAttribute.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Postgrest.Attributes
5+
{
6+
public class IntegerAttribute
7+
{
8+
public Type CoerceInto { get => typeof(int); }
9+
public string PropertyName { get; set; }
10+
11+
public IntegerAttribute([CallerMemberName] string propertyName = null)
12+
{
13+
PropertyName = propertyName;
14+
}
15+
}
16+
}

Diff for: Postgrest/Attributes/MapToAttribute.cs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Reflection;
3+
4+
namespace Postgrest.Attributes
5+
{
6+
[AttributeUsage(AttributeTargets.Field)]
7+
public class MapToAttribute : Attribute
8+
{
9+
public string Mapping { get; set; }
10+
public string Formatter { get; set; }
11+
12+
public MapToAttribute(string mapping, string formatter = null)
13+
{
14+
Mapping = mapping;
15+
Formatter = formatter;
16+
}
17+
}
18+
}

Diff for: Postgrest/Attributes/PrimaryKeyAttribute.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Postgrest.Attributes
5+
{
6+
[AttributeUsage(AttributeTargets.Property)]
7+
public class PrimaryKeyAttribute : Attribute
8+
{
9+
public string PropertyName { get; set; }
10+
11+
public PrimaryKeyAttribute([CallerMemberName] string propertyName = null)
12+
{
13+
PropertyName = propertyName;
14+
}
15+
}
16+
}

Diff for: Postgrest/Attributes/StringAttribute.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Postgrest.Attributes
5+
{
6+
[AttributeUsage(AttributeTargets.Property)]
7+
public class StringAttribute : Attribute
8+
{
9+
public Type CoerceInto { get => typeof(string); }
10+
public string PropertyName { get; set; }
11+
12+
public StringAttribute([CallerMemberName] string propertyName = null)
13+
{
14+
PropertyName = propertyName;
15+
}
16+
}
17+
}

Diff for: Postgrest/Attributes/TableAttribute.cs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
namespace Postgrest.Attributes
3+
{
4+
[AttributeUsage(AttributeTargets.Class)]
5+
public class TableAttribute : Attribute
6+
{
7+
public string Name { get; set; }
8+
9+
public TableAttribute(string tableName)
10+
{
11+
Name = tableName;
12+
}
13+
}
14+
}

Diff for: Postgrest/Attributes/TimestampAttribute.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Postgrest.Attributes
5+
{
6+
[AttributeUsage(AttributeTargets.Property)]
7+
public class TimestampAttribute : Attribute
8+
{
9+
public Type CoerceInto { get => typeof(DateTime); }
10+
public string PropertyName { get; set; }
11+
12+
public TimestampAttribute([CallerMemberName] string propertyName = null)
13+
{
14+
PropertyName = propertyName;
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)