-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-14887010 Structured types read for json result format (#994)
- Loading branch information
1 parent
f178614
commit a0bbeb0
Showing
45 changed files
with
3,092 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class Address | ||
{ | ||
public string city { get; set; } | ||
public string state { get; set; } | ||
public Zip zip { get; set; } | ||
|
||
public Address() | ||
{ | ||
} | ||
|
||
public Address(string city, string state, Zip zip) | ||
{ | ||
this.city = city; | ||
this.state = state; | ||
this.zip = zip; | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Snowflake.Data.Tests/Client/AllNullableUnstructuredTypesClass.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class AllNullableUnstructuredTypesClass | ||
{ | ||
public string StringValue { get; set; } | ||
public char? CharValue { get; set; } | ||
public byte? ByteValue { get; set; } | ||
public sbyte? SByteValue { get; set; } | ||
public short? ShortValue { get; set; } | ||
public ushort? UShortValue { get; set; } | ||
public int? IntValue { get; set; } | ||
public int? UIntValue { get; set; } | ||
public long? LongValue { get; set; } | ||
public long? ULongValue { get; set; } | ||
public float? FloatValue { get; set; } | ||
public double? DoubleValue { get; set; } | ||
public decimal? DecimalValue { get; set; } | ||
public bool? BooleanValue { get; set; } | ||
public Guid? GuidValue { get; set; } | ||
public DateTime? DateTimeValue { get; set; } | ||
public DateTimeOffset? DateTimeOffsetValue { get; set; } | ||
public TimeSpan? TimeSpanValue { get; set; } | ||
public byte[] BinaryValue { get; set; } | ||
public string SemiStructuredValue { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class AllUnstructuredTypesClass | ||
{ | ||
public string StringValue { get; set; } | ||
public char CharValue { get; set; } | ||
public byte ByteValue { get; set; } | ||
public sbyte SByteValue { get; set; } | ||
public short ShortValue { get; set; } | ||
public ushort UShortValue { get; set; } | ||
public int IntValue { get; set; } | ||
public int UIntValue { get; set; } | ||
public long LongValue { get; set; } | ||
public long ULongValue { get; set; } | ||
public float FloatValue { get; set; } | ||
public double DoubleValue { get; set; } | ||
public decimal DecimalValue { get; set; } | ||
public bool BooleanValue { get; set; } | ||
public Guid GuidValue { get; set; } | ||
public DateTime DateTimeValue { get; set; } | ||
public DateTimeOffset DateTimeOffsetValue { get; set; } | ||
public TimeSpan TimeSpanValue { get; set; } | ||
public byte[] BinaryValue { get; set; } | ||
public string SemiStructuredValue { get; set; } | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Snowflake.Data.Tests/Client/AnnotatedClassForConstructorConstruction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Snowflake.Data.Client; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
[SnowflakeObject(ConstructionMethod = SnowflakeObjectConstructionMethod.CONSTRUCTOR)] | ||
public class AnnotatedClassForConstructorConstruction | ||
{ | ||
public string StringValue { get; set; } | ||
public int? IgnoredValue { get; set; } | ||
public int IntegerValue { get; set; } | ||
|
||
public AnnotatedClassForConstructorConstruction() | ||
{ | ||
} | ||
|
||
public AnnotatedClassForConstructorConstruction(string stringValue, int integerValue) | ||
{ | ||
StringValue = stringValue; | ||
IntegerValue = integerValue; | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Snowflake.Data.Tests/Client/AnnotatedClassForPropertiesNamesConstruction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Snowflake.Data.Client; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
[SnowflakeObject(ConstructionMethod = SnowflakeObjectConstructionMethod.PROPERTIES_NAMES)] | ||
public class AnnotatedClassForPropertiesNamesConstruction | ||
{ | ||
[SnowflakeColumn(Name = "x")] | ||
public string StringValue { get; set; } | ||
public int? IgnoredValue { get; set; } | ||
public int IntegerValue { get; set; } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
Snowflake.Data.Tests/Client/AnnotatedClassForPropertiesOrderConstruction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Snowflake.Data.Client; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
[SnowflakeObject(ConstructionMethod = SnowflakeObjectConstructionMethod.PROPERTIES_ORDER)] | ||
public class AnnotatedClassForPropertiesOrderConstruction | ||
{ | ||
public string StringValue { get; set; } | ||
[SnowflakeColumn(IgnoreForPropertyOrder = true)] | ||
public int? IgnoredValue { get; set; } | ||
public int IntegerValue { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class DateTimeOffsetWrapper | ||
{ | ||
public DateTimeOffset Value { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class DateTimeWrapper | ||
{ | ||
public DateTime Value { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class Grades | ||
{ | ||
public string[] Names { get; set; } | ||
|
||
public Grades() | ||
{ | ||
} | ||
|
||
public Grades(string[] names) | ||
{ | ||
Names = names; | ||
} | ||
} | ||
|
||
public class GradesWithList | ||
{ | ||
public List<string> Names { get; set; } | ||
|
||
public GradesWithList() | ||
{ | ||
} | ||
|
||
public GradesWithList(List<string> names) | ||
{ | ||
Names = names; | ||
} | ||
} | ||
|
||
public class GradesWithMap | ||
{ | ||
public Dictionary<string, string> Names { get; set; } | ||
|
||
public GradesWithMap() | ||
{ | ||
} | ||
|
||
public GradesWithMap(Dictionary<string, string> names) | ||
{ | ||
Names = names; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class Identity | ||
{ | ||
public string Name { get; set; } | ||
|
||
public Identity() | ||
{ | ||
} | ||
|
||
public Identity(string name) | ||
{ | ||
Name = name; | ||
} | ||
|
||
protected bool Equals(Identity other) | ||
{ | ||
return Name == other.Name; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((Identity)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return (Name != null ? Name.GetHashCode() : 0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class ObjectArrayMapWrapper | ||
{ | ||
public Identity ObjectValue { get; set; } | ||
public List<string> ListValue { get; set; } | ||
public string[] ArrayValue { get; set; } | ||
public IList<string> IListValue { get; set; } | ||
public Dictionary<int, int> MapValue { get; set; } | ||
public IDictionary<int, int> IMapValue { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class StringWrapper | ||
{ | ||
public string Value { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Snowflake.Data.Tests.Client | ||
{ | ||
public class Zip | ||
{ | ||
public string prefix { get; set; } | ||
public string postfix { get; set; } | ||
|
||
public Zip() | ||
{ | ||
} | ||
|
||
public Zip(string prefix, string postfix) | ||
{ | ||
this.prefix = prefix; | ||
this.postfix = postfix; | ||
} | ||
|
||
protected bool Equals(Zip other) | ||
{ | ||
return prefix == other.prefix && postfix == other.postfix; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((Zip)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
#if NETFRAMEWORK | ||
return prefix.GetHashCode() * 177 + postfix.GetHashCode(); | ||
#else | ||
return System.HashCode.Combine(prefix, postfix); | ||
#endif | ||
} | ||
} | ||
} |
Oops, something went wrong.