Kinetica   C#   API  Version 7.2.3.1
KineticaColumnProperties.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 
4 namespace kinetica.SchemaBuilder;
5 
25  public sealed class KineticaColumnProperties
26  {
27  private readonly List<string> _properties;
28 
33  {
34  _properties = new List<string>();
35  }
36 
41  {
42  AddIfNotExists("primary_key");
43  return this;
44  }
45 
50  {
51  AddIfNotExists("shard_key");
52  return this;
53  }
54 
59  {
60  AddIfNotExists("nullable");
61  return this;
62  }
63 
68  {
69  AddIfNotExists("timestamp");
70  return this;
71  }
72 
77  {
78  AddIfNotExists("data");
79  return this;
80  }
81 
86  {
87  AddIfNotExists("ipv4");
88  return this;
89  }
90 
95  {
96  AddIfNotExists("wkt");
97  return this;
98  }
99 
105  {
106  var prop = n switch
107  {
108  1 => "char1",
109  2 => "char2",
110  4 => "char4",
111  8 => "char8",
112  16 => "char16",
113  32 => "char32",
114  64 => "char64",
115  128 => "char128",
116  256 => "char256",
117  _ => throw new ArgumentException($"Invalid char length: {n}. Must be 1, 2, 4, 8, 16, 32, 64, 128, or 256.", nameof(n))
118  };
119  AddIfNotExists(prop);
120  return this;
121  }
122 
127  {
128  AddIfNotExists("int8");
129  return this;
130  }
131 
136  {
137  AddIfNotExists("int16");
138  return this;
139  }
140 
145  {
146  AddIfNotExists("date");
147  return this;
148  }
149 
154  {
155  AddIfNotExists("time");
156  return this;
157  }
158 
163  {
164  AddIfNotExists("datetime");
165  return this;
166  }
167 
172  {
173  AddIfNotExists("decimal");
174  return this;
175  }
176 
181  {
182  AddIfNotExists("uuid");
183  return this;
184  }
185 
190  {
191  AddIfNotExists("ulong");
192  return this;
193  }
194 
199  {
200  AddIfNotExists("boolean");
201  return this;
202  }
203 
208  {
209  AddIfNotExists("json");
210  return this;
211  }
212 
217  {
218  AddIfNotExists("array");
219  return this;
220  }
221 
226  {
227  AddIfNotExists("vector");
228  return this;
229  }
230 
234  public KineticaColumnProperties Property(string property)
235  {
236  if (!string.IsNullOrEmpty(property))
237  AddIfNotExists(property);
238  return this;
239  }
240 
244  public IList<string> Build()
245  {
246  return new List<string>(_properties);
247  }
248 
249  private void AddIfNotExists(string property)
250  {
251  if (!_properties.Contains(property))
252  _properties.Add(property);
253  }
254  }
KineticaColumnProperties Decimal()
Marks the column as a decimal type.
KineticaColumnProperties Property(string property)
Adds a custom property.
KineticaColumnProperties Uuid()
Marks the column as a UUID type.
KineticaColumnProperties Nullable()
Marks the column as nullable.
KineticaColumnProperties Vector()
Marks the column as a vector type.
KineticaColumnProperties DateTime()
Marks the column as a datetime type.
KineticaColumnProperties Timestamp()
Marks the column as a timestamp type.
KineticaColumnProperties PrimaryKey()
Marks the column as a primary key.
KineticaColumnProperties CharN(int n)
Marks the column as a char(N) type.
KineticaColumnProperties ShardKey()
Marks the column as a shard key.
KineticaColumnProperties Wkt()
Marks the column as a WKT (Well-Known Text) geometry type.
KineticaColumnProperties Time()
Marks the column as a time type.
KineticaColumnProperties Json()
Marks the column as a JSON type.
KineticaColumnProperties Date()
Marks the column as a date type.
KineticaColumnProperties()
Creates a new KineticaColumnProperties builder.
Builder for Kinetica column properties.
KineticaColumnProperties Int8()
Marks the column as an int8 type.
KineticaColumnProperties Int16()
Marks the column as an int16 type.
IList< string > Build()
Builds the list of properties.
KineticaColumnProperties Ulong()
Marks the column as an unsigned long type.
KineticaColumnProperties Data()
Marks the column as a data column (text search enabled).
KineticaColumnProperties Array()
Marks the column as an array type.
KineticaColumnProperties Boolean()
Marks the column as a boolean type.
KineticaColumnProperties Ipv4()
Marks the column as an IPv4 type.