index.d 794 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. module app.model.index;
  2. version(USE_ENTITY):
  3. import hunt.application;
  4. public import entity;
  5. @Table("test2")
  6. struct Test
  7. {
  8. @Primarykey()
  9. int id;
  10. @Field ("floatcol")
  11. float fcol;
  12. @Field("doublecol")
  13. double dcol;
  14. @Field("datecol")
  15. Date date;
  16. @Field("datetimecol")
  17. DateTime dt;
  18. @Field("timecol")
  19. Time time;
  20. @Field()
  21. string stringcol;
  22. @Field()
  23. ubyte[] ubytecol;
  24. }
  25. class IndexModel : Model!Test
  26. {
  27. void showTest2()
  28. {
  29. auto iterator = Select();
  30. if(iterator !is null)
  31. foreach(tp; iterator)
  32. {
  33. writeln("float is : ", tp.fcol);
  34. writeln("the string is : ", tp.stringcol);
  35. writeln("the ubyte is : ", cast(string)tp.ubytecol);
  36. }
  37. }
  38. void insertNew(Test t)
  39. {
  40. Insert(t);
  41. }
  42. }