mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-01 07:48:17 +08:00
fixed 修复tag字段支持更多类型
This commit is contained in:
@@ -11,11 +11,15 @@ namespace SqlSugar.TDengine
|
||||
if (csharpTypeName == UtilConstants.ByteArrayType.Name)
|
||||
return "bytea";
|
||||
if (csharpTypeName.ToLower() == "int32")
|
||||
csharpTypeName = "int";
|
||||
csharpTypeName = "int";
|
||||
if (csharpTypeName.ToLower() == "uint32")
|
||||
csharpTypeName = "uint";
|
||||
if (csharpTypeName.ToLower() == "int16")
|
||||
csharpTypeName = "short";
|
||||
if (csharpTypeName.ToLower() == "int64")
|
||||
csharpTypeName = "long";
|
||||
if (csharpTypeName.ToLower() == "uint64")
|
||||
csharpTypeName = "ulong";
|
||||
if (csharpTypeName.ToLower().IsIn("boolean", "bool"))
|
||||
csharpTypeName = "bool";
|
||||
if (csharpTypeName == "DateTimeOffset")
|
||||
@@ -121,16 +125,14 @@ namespace SqlSugar.TDengine
|
||||
public static List<KeyValuePair<string, CSharpDataType>> MappingTypesConst = new List<KeyValuePair<string, CSharpDataType>>(){
|
||||
|
||||
new KeyValuePair<string, CSharpDataType>("BOOL",CSharpDataType.@bool),
|
||||
new KeyValuePair<string, CSharpDataType>("TINYINT",CSharpDataType.@byte),
|
||||
new KeyValuePair<string, CSharpDataType>("TINYINT",CSharpDataType.@int),
|
||||
new KeyValuePair<string, CSharpDataType>("TINYINT",CSharpDataType.@sbyte),
|
||||
new KeyValuePair<string, CSharpDataType>("SMALLINT",CSharpDataType.@short),
|
||||
new KeyValuePair<string, CSharpDataType>("INT",CSharpDataType.@int),
|
||||
new KeyValuePair<string, CSharpDataType>("BIGINT",CSharpDataType.@long),
|
||||
new KeyValuePair<string, CSharpDataType>("TINYINT UNSIGNED",CSharpDataType.@byte),
|
||||
new KeyValuePair<string, CSharpDataType>("TINYINT UNSIGNED",CSharpDataType.@int),
|
||||
new KeyValuePair<string, CSharpDataType>("SMALLINT UNSIGNED",CSharpDataType.@short),
|
||||
new KeyValuePair<string, CSharpDataType>("INT UNSIGNED",CSharpDataType.@int),
|
||||
new KeyValuePair<string, CSharpDataType>("BIGINT UNSIGNED",CSharpDataType.@long),
|
||||
new KeyValuePair<string, CSharpDataType>("SMALLINT UNSIGNED",CSharpDataType.@ushort),
|
||||
new KeyValuePair<string, CSharpDataType>("INT UNSIGNED",CSharpDataType.@uint),
|
||||
new KeyValuePair<string, CSharpDataType>("BIGINT UNSIGNED",CSharpDataType.@ulong),
|
||||
new KeyValuePair<string, CSharpDataType>("FLOAT",CSharpDataType.Single),
|
||||
new KeyValuePair<string, CSharpDataType>("DOUBLE",CSharpDataType.@double),
|
||||
new KeyValuePair<string, CSharpDataType>("float8",CSharpDataType.@double),
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace SqlSugar
|
||||
public enum CSharpDataType
|
||||
{
|
||||
@int,
|
||||
@uint,
|
||||
@bool,
|
||||
@string,
|
||||
@DateTime,
|
||||
@@ -18,7 +19,9 @@ namespace SqlSugar
|
||||
@sbyte,
|
||||
@enum,
|
||||
@short,
|
||||
@ushort,
|
||||
@long,
|
||||
@ulong,
|
||||
@object,
|
||||
@other,
|
||||
@byteArray,
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace TDengineTest
|
||||
/// Account have permission to create database
|
||||
/// 用有建库权限的数据库账号
|
||||
/// </summary>
|
||||
public static string ConnectionString = "Host=localhost;Port=6030;Username=root;Password=taosdata;Database=test";
|
||||
public static string ConnectionString = "Host=dikong.chengdan.com;Port=6030;Username=root;Password=taosdata;Database=test";
|
||||
/// <summary>
|
||||
/// Account have permission to create database
|
||||
/// 用有建库权限的数据库账号
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace TDengineTest
|
||||
db.Insertable(new CodeFirst0311()
|
||||
{
|
||||
Ts = DateTime.Now,
|
||||
DeviceType = 1,
|
||||
Boolean = true,
|
||||
Char = 'a',
|
||||
Decimal = Convert.ToDecimal(18.2),
|
||||
@@ -39,16 +40,16 @@ namespace TDengineTest
|
||||
Int32 = 32,
|
||||
Int64 = 64,
|
||||
String = "string",
|
||||
SByte=3,
|
||||
SByte = 3,
|
||||
Byte = 2,
|
||||
Decimal2 = Convert.ToDecimal(18.3),
|
||||
Double = Convert.ToDouble(18.44),
|
||||
Float = Convert.ToSingle(18.45),
|
||||
String2 = "2",
|
||||
UInt16=116,
|
||||
UInt32=332,
|
||||
UInt64=664
|
||||
}).ExecuteCommand();
|
||||
UInt16 = 116,
|
||||
UInt32 = 332,
|
||||
UInt64 = 664
|
||||
}).SetTDengineChildTableName((stableName, it) => $"mytbname_{it.DeviceType}").ExecuteCommand();
|
||||
var dt = db.Ado.GetDataTable("select * from CodeFirst0311 ");
|
||||
var list3 = db.Queryable<CodeFirst0311>().ToList();
|
||||
}
|
||||
|
||||
@@ -6,11 +6,15 @@ using System.Text;
|
||||
|
||||
namespace TDengineTest
|
||||
{
|
||||
|
||||
[STableAttribute(STableName= "CodeFirst0311", Tag1 =nameof(DeviceType))]
|
||||
|
||||
public class CodeFirst0311 : STable
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
public DateTime Ts { get; set; }
|
||||
|
||||
[SqlSugar.SugarColumn(ColumnDataType = "INT UNSIGNED",IsOnlyIgnoreInsert =true,IsOnlyIgnoreUpdate =true)]
|
||||
public uint DeviceType { get; set; }
|
||||
public bool Boolean { get; set; }
|
||||
public byte Byte { get; set; }
|
||||
public sbyte SByte { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user