public static string ToString(string columnName, ClickHouseValueType valueType, bool isNullable = false, bool isLowCardinality = false , bool isArray = false, int?fixedStringLength = null, string defaultExpression = null) { string typeName; if (valueType == ClickHouseValueType.String) { typeName = isLowCardinality ? $"LowCardinality({valueType})" : valueType.ToString(); } else if (valueType == ClickHouseValueType.FixedString) { if (fixedStringLength == null) { throw new ArgumentNullException(nameof(fixedStringLength)); } typeName = $"{valueType}({fixedStringLength})"; } else { typeName = valueType.ToString(); } if (isNullable) { typeName = $"Nullable({typeName})"; } if (isArray) { typeName = $"Array({typeName})"; } return($"{columnName} {typeName}" + (!string.IsNullOrWhiteSpace(defaultExpression) ? $" DEFAULT {defaultExpression}" : "")); }
public ClickHouseColumn(string name, ClickHouseValueType valueType, bool isNullable = false, bool isArray = false, int?fixedStringLength = null, ColumnMappingSide mappingSide = ColumnMappingSide.Both) { Name = name; ValueType = valueType; IsNullable = isNullable; IsArray = isArray; FixedStringLength = fixedStringLength; MappingSide = mappingSide; }
public static string dictGetOrDefault(string dictName, string attrName, string id, object defaultValue, ClickHouseValueType valueType) => $"dictGet{valueType}OrDefault('{dictName}','{attrName}',{id},{defaultValue.AsClickValue()})";
public static string dictGet(string dictName, string attrName, string idExpr, ClickHouseValueType valueType) => $"dictGet{valueType}('{dictName}','{attrName}',{idExpr})";