column-type.vala 867 B

1234567891011121314151617181920212223242526
  1. namespace InvercargillSql.Orm {
  2. public enum ColumnType {
  3. INT_32,
  4. INT_64,
  5. TEXT,
  6. BOOLEAN,
  7. DECIMAL,
  8. DATETIME,
  9. BINARY,
  10. UUID;
  11. public static ColumnType? from_gtype(Type type) {
  12. if (type == typeof(int)) return INT_32;
  13. if (type == typeof(int64)) return INT_64;
  14. if (type == typeof(int64?)) return INT_64;
  15. if (type == typeof(string)) return TEXT;
  16. if (type == typeof(bool)) return BOOLEAN;
  17. if (type == typeof(double) || type == typeof(float)) return DECIMAL;
  18. if (type == typeof(double?) || type == typeof(float?)) return DECIMAL;
  19. if (type == typeof(DateTime)) return DATETIME;
  20. if (type == typeof(Invercargill.BinaryData)) return BINARY;
  21. return null;
  22. }
  23. }
  24. }