Example #1
0
        public static object Convert(string value, DataType dataType)
        {
            switch (dataType)
            {
            case DataType.Varchar:
            case DataType.Text:
            case DataType.Timestamp:
            case DataType.Date:
            case DataType.Time:
                return(value);

            case DataType.Int4:
            case DataType.Int8:
                return(ConvertUtil.ConToInt(value));

            case DataType.Numeric:
                return(ConvertUtil.ConToDecimal(value));

            case DataType.Jsonb:
            case DataType.Json:
                return(value);

            case DataType.Boolean:
                return(ConvertUtil.ConToBoolean(value));

            default:
                throw new NotSupportedException("类型不支持");
            }
        }