Skip to content

Commit a0bbeb0

Browse files
SNOW-14887010 Structured types read for json result format (#994)
1 parent f178614 commit a0bbeb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3092
-109
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace Snowflake.Data.Tests.Client
2+
{
3+
public class Address
4+
{
5+
public string city { get; set; }
6+
public string state { get; set; }
7+
public Zip zip { get; set; }
8+
9+
public Address()
10+
{
11+
}
12+
13+
public Address(string city, string state, Zip zip)
14+
{
15+
this.city = city;
16+
this.state = state;
17+
this.zip = zip;
18+
}
19+
}
20+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
public class AllNullableUnstructuredTypesClass
6+
{
7+
public string StringValue { get; set; }
8+
public char? CharValue { get; set; }
9+
public byte? ByteValue { get; set; }
10+
public sbyte? SByteValue { get; set; }
11+
public short? ShortValue { get; set; }
12+
public ushort? UShortValue { get; set; }
13+
public int? IntValue { get; set; }
14+
public int? UIntValue { get; set; }
15+
public long? LongValue { get; set; }
16+
public long? ULongValue { get; set; }
17+
public float? FloatValue { get; set; }
18+
public double? DoubleValue { get; set; }
19+
public decimal? DecimalValue { get; set; }
20+
public bool? BooleanValue { get; set; }
21+
public Guid? GuidValue { get; set; }
22+
public DateTime? DateTimeValue { get; set; }
23+
public DateTimeOffset? DateTimeOffsetValue { get; set; }
24+
public TimeSpan? TimeSpanValue { get; set; }
25+
public byte[] BinaryValue { get; set; }
26+
public string SemiStructuredValue { get; set; }
27+
}
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
public class AllUnstructuredTypesClass
6+
{
7+
public string StringValue { get; set; }
8+
public char CharValue { get; set; }
9+
public byte ByteValue { get; set; }
10+
public sbyte SByteValue { get; set; }
11+
public short ShortValue { get; set; }
12+
public ushort UShortValue { get; set; }
13+
public int IntValue { get; set; }
14+
public int UIntValue { get; set; }
15+
public long LongValue { get; set; }
16+
public long ULongValue { get; set; }
17+
public float FloatValue { get; set; }
18+
public double DoubleValue { get; set; }
19+
public decimal DecimalValue { get; set; }
20+
public bool BooleanValue { get; set; }
21+
public Guid GuidValue { get; set; }
22+
public DateTime DateTimeValue { get; set; }
23+
public DateTimeOffset DateTimeOffsetValue { get; set; }
24+
public TimeSpan TimeSpanValue { get; set; }
25+
public byte[] BinaryValue { get; set; }
26+
public string SemiStructuredValue { get; set; }
27+
}
28+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Snowflake.Data.Client;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
[SnowflakeObject(ConstructionMethod = SnowflakeObjectConstructionMethod.CONSTRUCTOR)]
6+
public class AnnotatedClassForConstructorConstruction
7+
{
8+
public string StringValue { get; set; }
9+
public int? IgnoredValue { get; set; }
10+
public int IntegerValue { get; set; }
11+
12+
public AnnotatedClassForConstructorConstruction()
13+
{
14+
}
15+
16+
public AnnotatedClassForConstructorConstruction(string stringValue, int integerValue)
17+
{
18+
StringValue = stringValue;
19+
IntegerValue = integerValue;
20+
}
21+
}
22+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Snowflake.Data.Client;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
[SnowflakeObject(ConstructionMethod = SnowflakeObjectConstructionMethod.PROPERTIES_NAMES)]
6+
public class AnnotatedClassForPropertiesNamesConstruction
7+
{
8+
[SnowflakeColumn(Name = "x")]
9+
public string StringValue { get; set; }
10+
public int? IgnoredValue { get; set; }
11+
public int IntegerValue { get; set; }
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Snowflake.Data.Client;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
[SnowflakeObject(ConstructionMethod = SnowflakeObjectConstructionMethod.PROPERTIES_ORDER)]
6+
public class AnnotatedClassForPropertiesOrderConstruction
7+
{
8+
public string StringValue { get; set; }
9+
[SnowflakeColumn(IgnoreForPropertyOrder = true)]
10+
public int? IgnoredValue { get; set; }
11+
public int IntegerValue { get; set; }
12+
}
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
public class DateTimeOffsetWrapper
6+
{
7+
public DateTimeOffset Value { get; set; }
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
public class DateTimeWrapper
6+
{
7+
public DateTime Value { get; set; }
8+
}
9+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System.Collections.Generic;
2+
3+
namespace Snowflake.Data.Tests.Client
4+
{
5+
public class Grades
6+
{
7+
public string[] Names { get; set; }
8+
9+
public Grades()
10+
{
11+
}
12+
13+
public Grades(string[] names)
14+
{
15+
Names = names;
16+
}
17+
}
18+
19+
public class GradesWithList
20+
{
21+
public List<string> Names { get; set; }
22+
23+
public GradesWithList()
24+
{
25+
}
26+
27+
public GradesWithList(List<string> names)
28+
{
29+
Names = names;
30+
}
31+
}
32+
33+
public class GradesWithMap
34+
{
35+
public Dictionary<string, string> Names { get; set; }
36+
37+
public GradesWithMap()
38+
{
39+
}
40+
41+
public GradesWithMap(Dictionary<string, string> names)
42+
{
43+
Names = names;
44+
}
45+
}
46+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace Snowflake.Data.Tests.Client
2+
{
3+
public class Identity
4+
{
5+
public string Name { get; set; }
6+
7+
public Identity()
8+
{
9+
}
10+
11+
public Identity(string name)
12+
{
13+
Name = name;
14+
}
15+
16+
protected bool Equals(Identity other)
17+
{
18+
return Name == other.Name;
19+
}
20+
21+
public override bool Equals(object obj)
22+
{
23+
if (ReferenceEquals(null, obj)) return false;
24+
if (ReferenceEquals(this, obj)) return true;
25+
if (obj.GetType() != this.GetType()) return false;
26+
return Equals((Identity)obj);
27+
}
28+
29+
public override int GetHashCode()
30+
{
31+
return (Name != null ? Name.GetHashCode() : 0);
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)