Skip to content

Commit 6a3b9ee

Browse files
changes based on feedback during documentation
1 parent fe18671 commit 6a3b9ee

File tree

11 files changed

+522
-83
lines changed

11 files changed

+522
-83
lines changed

src/DataStax.AstraDB.DataApi/Core/Query/DocumentFindOptions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ namespace DataStax.AstraDB.DataApi.Core.Query;
2020

2121
public class DocumentFindOptions<T> : FindOptions<T, DocumentSortBuilder<T>>
2222
{
23+
/// <summary>
24+
/// The sort to apply when running the query.
25+
/// </summary>
2326
[JsonIgnore]
2427
public override DocumentSortBuilder<T> Sort { get; set; }
28+
2529
}

src/DataStax.AstraDB.DataApi/Core/Query/FindOptions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ public abstract class FindOptions<T, TSort> : IFindOptions<T, TSort> where TSort
2525
[JsonIgnore]
2626
public IProjectionBuilder Projection { get; set; }
2727

28-
internal bool? IncludeSimilarity { get; set; }
28+
/// <summary>
29+
/// Whether to include a similarity score in the results or not (when performing a vector sort).
30+
/// </summary>
31+
[JsonIgnore]
32+
public bool? IncludeSimilarity { get; set; }
2933

3034
protected bool? _includeSortVector;
3135

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright DataStax, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using DataStax.AstraDB.DataApi.Core.Query;
18+
using System.Collections.Generic;
19+
using System.Linq;
20+
using System.Text.Json.Serialization;
21+
22+
namespace DataStax.AstraDB.DataApi.Core;
23+
24+
/// <summary>
25+
/// Options for deleting a row from a table
26+
/// </summary>
27+
/// <typeparam name="T"></typeparam>
28+
public class TableDeleteOptions<T> where T : class
29+
{
30+
internal Filter<T> Filter { get; set; }
31+
32+
[JsonInclude]
33+
[JsonPropertyName("filter")]
34+
internal Dictionary<string, object> FilterMap => Filter == null ? new Dictionary<string, object>() : Filter.Serialize();
35+
}

src/DataStax.AstraDB.DataApi/DataStax.AstraDB.DataApi.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
1919
<PackageIcon>packageIcon.png</PackageIcon>
2020
<PackageReadmeFile>README.md</PackageReadmeFile>
21+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2122
</PropertyGroup>
2223

2324
<ItemGroup>

src/DataStax.AstraDB.DataApi/Tables/Column.cs

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,93 +21,183 @@
2121
namespace DataStax.AstraDB.DataApi.Tables;
2222

2323

24+
/// <summary>
25+
/// Represents a column in a table
26+
/// </summary>
2427
[JsonConverter(typeof(ColumnConverter))]
2528
public abstract class Column
2629
{
30+
/// <summary>
31+
/// The type of the column
32+
/// </summary>
2733
[JsonIgnore]
2834
public abstract string Type { get; }
2935
}
3036

37+
/// <summary>
38+
/// A column that holds text values
39+
/// </summary>
3140
public class TextColumn : Column
3241
{
42+
/// <summary>
43+
/// Defines the column as type text
44+
/// </summary>
3345
[JsonPropertyName("type")]
3446
public override string Type => "text";
3547
}
3648

49+
/// <summary>
50+
/// A column that holds UUID values
51+
/// </summary>
3752
public class GuidColumn : Column
3853
{
54+
/// <summary>
55+
/// Defines the column as type uuid
56+
/// </summary>
3957
[JsonPropertyName("type")]
4058
public override string Type => "uuid";
4159
}
4260

61+
/// <summary>
62+
/// A column that holds integer values
63+
/// </summary>
4364
public class IntColumn : Column
4465
{
66+
/// <summary>
67+
/// Defines the column as type int
68+
/// </summary>
4569
[JsonPropertyName("type")]
4670
public override string Type => "int";
4771
}
4872

73+
/// <summary>
74+
/// A column that holds long integer values
75+
/// </summary>
4976
public class LongColumn : Column
5077
{
78+
/// <summary>
79+
/// Defines the column as type bigint
80+
/// </summary>
5181
[JsonPropertyName("type")]
5282
public override string Type => "bigint";
5383
}
5484

85+
/// <summary>
86+
/// A column that holds decimal values
87+
/// </summary>
5588
public class DecimalColumn : Column
5689
{
90+
/// <summary>
91+
/// Defines the column as type decimal
92+
/// </summary>
5793
[JsonPropertyName("type")]
5894
public override string Type => "decimal";
5995
}
6096

97+
/// <summary>
98+
/// A column that holds float values
99+
/// </summary>
61100
public class FloatColumn : Column
62101
{
102+
/// <summary>
103+
/// Defines the column as type float
104+
/// </summary>
63105
[JsonPropertyName("type")]
64106
public override string Type => "float";
65107
}
66108

109+
/// <summary>
110+
/// A column that holds double values
111+
/// </summary>
67112
public class DoubleColumn : Column
68113
{
114+
/// <summary>
115+
/// Defines the column as type double
116+
/// </summary>
69117
[JsonPropertyName("type")]
70118
public override string Type => "double";
71119
}
72120

121+
/// <summary>
122+
/// A column that holds boolean values
123+
/// </summary>
73124
public class BooleanColumn : Column
74125
{
126+
/// <summary>
127+
/// Defines the column as type boolean
128+
/// </summary>
75129
[JsonPropertyName("type")]
76130
public override string Type => "boolean";
77131
}
78132

133+
/// <summary>
134+
/// A column that holds date/time values
135+
/// </summary>
79136
public class DateTimeColumn : Column
80137
{
138+
/// <summary>
139+
/// Defines the column as type timestamp
140+
/// </summary>
81141
[JsonPropertyName("type")]
82142
public override string Type => "timestamp";
83143
}
84144

145+
/// <summary>
146+
/// A column that holds binary values
147+
/// </summary>
85148
public class BlobColumn : Column
86149
{
150+
/// <summary>
151+
/// Defines the column as type blob
152+
/// </summary>
87153
[JsonPropertyName("type")]
88154
public override string Type => "blob";
89155
}
90156

157+
/// <summary>
158+
/// A column that holds IP address values
159+
/// </summary>
91160
public class IPAddressColumn : Column
92161
{
162+
/// <summary>
163+
/// Defines the column as type inet
164+
/// </summary>
93165
[JsonPropertyName("type")]
94166
public override string Type => "inet";
95167
}
96168

169+
/// <summary>
170+
/// A column that holds duration values
171+
/// </summary>
97172
public class DurationColumn : Column
98173
{
174+
/// <summary>
175+
/// Defines the column as type duration
176+
/// </summary>
99177
[JsonPropertyName("type")]
100178
public override string Type => "duration";
101179
}
102180

181+
/// <summary>
182+
/// A column that holds dictionary/map values
183+
/// </summary>
103184
public class DictionaryColumn : Column
104185
{
186+
/// <summary>
187+
/// Defines the column as type map
188+
/// </summary>
105189
[JsonPropertyName("type")]
106190
public override string Type => "map";
107191

192+
/// <summary>
193+
/// The type of the keys in the dictionary
194+
/// </summary>
108195
[JsonPropertyName("keyType")]
109196
public string KeyType { get; set; }
110197

198+
/// <summary>
199+
/// The type of the values in the dictionary
200+
/// </summary>
111201
[JsonPropertyName("valueType")]
112202
public string ValueType { get; set; }
113203

@@ -117,14 +207,26 @@ internal DictionaryColumn(string keyType, string valueType)
117207
ValueType = valueType;
118208
}
119209

210+
/// <summary>
211+
/// Creates a new instance of the <see cref="DictionaryColumn"/> class.
212+
/// </summary>
120213
public DictionaryColumn() { }
121214
}
122215

216+
/// <summary>
217+
/// A column that holds list/array values
218+
/// </summary>
123219
public class ListColumn : Column
124220
{
221+
/// <summary>
222+
/// Defines the column as type list
223+
/// </summary>
125224
[JsonPropertyName("type")]
126225
public override string Type => "list";
127226

227+
/// <summary>
228+
/// The type of the values in the list
229+
/// </summary>
128230
[JsonPropertyName("valueType")]
129231
public string ValueType { get; set; }
130232

@@ -133,14 +235,26 @@ internal ListColumn(string valueType)
133235
ValueType = valueType;
134236
}
135237

238+
/// <summary>
239+
/// Creates a new instance of the <see cref="ListColumn"/> class.
240+
/// </summary>
136241
public ListColumn() { }
137242
}
138243

244+
/// <summary>
245+
/// A column that holds set values
246+
/// </summary>
139247
public class SetColumn : Column
140248
{
249+
/// <summary>
250+
/// Defines the column as type set
251+
/// </summary>
141252
[JsonPropertyName("type")]
142253
public override string Type => "set";
143254

255+
/// <summary>
256+
/// The type of the values in the set
257+
/// </summary>
144258
[JsonPropertyName("valueType")]
145259
public string ValueType { get; set; }
146260

@@ -149,14 +263,26 @@ internal SetColumn(string valueType)
149263
ValueType = valueType;
150264
}
151265

266+
/// <summary>
267+
/// Creates a new instance of the <see cref="SetColumn"/> class.
268+
/// </summary>
152269
public SetColumn() { }
153270
}
154271

272+
/// <summary>
273+
/// A column that holds vector values
274+
/// </summary>
155275
public class VectorColumn : Column
156276
{
277+
/// <summary>
278+
/// Defines the column as type vector
279+
/// </summary>
157280
[JsonPropertyName("type")]
158281
public override string Type => "vector";
159282

283+
/// <summary>
284+
/// The dimension of the vector
285+
/// </summary>
160286
[JsonPropertyName("dimension")]
161287
public int Dimension { get; set; }
162288

@@ -165,18 +291,44 @@ internal VectorColumn(int dimension)
165291
Dimension = dimension;
166292
}
167293

294+
/// <summary>
295+
/// Creates a new instance of the <see cref="VectorColumn"/> class.
296+
/// </summary>
168297
public VectorColumn() { }
169298
}
170299

300+
/// <summary>
301+
/// A column that holds vector values that are generated by a vectorization service
302+
/// </summary>
171303
public class VectorizeColumn : VectorColumn
172304
{
305+
/// <summary>
306+
/// The vectorization service options
307+
/// </summary>
173308
[JsonPropertyName("service")]
174309
public VectorServiceOptions ServiceOptions { get; set; }
175310

311+
/// <summary>
312+
/// Creates a new instance of the <see cref="VectorizeColumn"/> class with the specified dimension and service options.
313+
/// </summary>
314+
/// <param name="dimension"></param>
315+
/// <param name="serviceOptions"></param>
176316
public VectorizeColumn(int dimension, VectorServiceOptions serviceOptions) : base(dimension)
177317
{
178318
ServiceOptions = serviceOptions;
179319
}
180320

321+
/// <summary>
322+
/// Creates a new instance of the <see cref="VectorizeColumn"/> class with the specified service options.
323+
/// </summary>
324+
/// <param name="serviceOptions"></param>
325+
public VectorizeColumn(VectorServiceOptions serviceOptions)
326+
{
327+
ServiceOptions = serviceOptions;
328+
}
329+
330+
/// <summary>
331+
/// Creates a new instance of the <see cref="VectorizeColumn"/> class.
332+
/// </summary>
181333
public VectorizeColumn() { }
182334
}

0 commit comments

Comments
 (0)