main.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package main
  2. //import (
  3. //DEATH "github.com/vrecan/death"
  4. //"go-framework/baize"
  5. //"syscall"
  6. //)
  7. //type Class struct {
  8. // domain.IDField
  9. // Name string `write:"column:name;" read:"column:name;condition:'${column} LIKE %${value}%'" cache:"key:${field.IDField}"`
  10. // domain.TenantIDField
  11. // domain.UserIDFields
  12. // domain.TimeFields
  13. //}
  14. //
  15. //type Student struct {
  16. // domain.IDField
  17. // Name string `write:"column:name;" read:"column:name;condition:'${column} LIKE %${value}%'"`
  18. // Age int `write:"column:age;" read:"column:age;condition:'${column} LIKE %${value}%'" cache:"key:${field.IDField}"`
  19. // domain.TenantIDField
  20. // domain.UserIDFields
  21. // domain.TimeFields
  22. //}
  23. func main() {
  24. //app, err := baize.NewApplication("10000", WithDB(config))
  25. //if err != nil {
  26. // panic(err)
  27. //}
  28. //
  29. //app.RegisterRouter("v1", middlewares...).
  30. // RegisterCommonCrud(&Class{}).
  31. // RegisterCrud(&common.Crud{
  32. // Api: common.CrudApi{},
  33. // Service: common.CrudService{},
  34. // DomainObject: &Student{},
  35. // }).
  36. // RegisterRelation(&common.Relation{
  37. // Type: common.One2Many,
  38. // LeftDomainEntity: &Class{},
  39. // RightDomainEntity: &Student{},
  40. // })
  41. //
  42. //go func() {
  43. // err := app.Start()
  44. // if err != nil {
  45. // panic(err)
  46. // }
  47. //}()
  48. //
  49. //defer func() {
  50. // err := app.Finish()
  51. // if err != nil {
  52. // panic(err)
  53. // }
  54. //}()
  55. //
  56. //death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
  57. //_ = death.WaitForDeath()
  58. }