category.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // Code generated by ent, DO NOT EDIT.
  2. package category
  3. import (
  4. "time"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/sql"
  7. )
  8. const (
  9. // Label holds the string label denoting the category type in the database.
  10. Label = "category"
  11. // FieldID holds the string denoting the id field in the database.
  12. FieldID = "id"
  13. // FieldCreatedAt holds the string denoting the created_at field in the database.
  14. FieldCreatedAt = "created_at"
  15. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  16. FieldUpdatedAt = "updated_at"
  17. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  18. FieldDeletedAt = "deleted_at"
  19. // FieldName holds the string denoting the name field in the database.
  20. FieldName = "name"
  21. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  22. FieldOrganizationID = "organization_id"
  23. // Table holds the table name of the category in the database.
  24. Table = "category"
  25. )
  26. // Columns holds all SQL columns for category fields.
  27. var Columns = []string{
  28. FieldID,
  29. FieldCreatedAt,
  30. FieldUpdatedAt,
  31. FieldDeletedAt,
  32. FieldName,
  33. FieldOrganizationID,
  34. }
  35. // ValidColumn reports if the column name is valid (part of the table columns).
  36. func ValidColumn(column string) bool {
  37. for i := range Columns {
  38. if column == Columns[i] {
  39. return true
  40. }
  41. }
  42. return false
  43. }
  44. // Note that the variables below are initialized by the runtime
  45. // package on the initialization of the application. Therefore,
  46. // it should be imported in the main as follows:
  47. //
  48. // import _ "wechat-api/ent/runtime"
  49. var (
  50. Hooks [1]ent.Hook
  51. Interceptors [1]ent.Interceptor
  52. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  53. DefaultCreatedAt func() time.Time
  54. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  55. DefaultUpdatedAt func() time.Time
  56. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  57. UpdateDefaultUpdatedAt func() time.Time
  58. // NameValidator is a validator for the "name" field. It is called by the builders before save.
  59. NameValidator func(string) error
  60. // OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
  61. OrganizationIDValidator func(uint64) error
  62. )
  63. // OrderOption defines the ordering options for the Category queries.
  64. type OrderOption func(*sql.Selector)
  65. // ByID orders the results by the id field.
  66. func ByID(opts ...sql.OrderTermOption) OrderOption {
  67. return sql.OrderByField(FieldID, opts...).ToFunc()
  68. }
  69. // ByCreatedAt orders the results by the created_at field.
  70. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  71. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  72. }
  73. // ByUpdatedAt orders the results by the updated_at field.
  74. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  75. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  76. }
  77. // ByDeletedAt orders the results by the deleted_at field.
  78. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  79. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  80. }
  81. // ByName orders the results by the name field.
  82. func ByName(opts ...sql.OrderTermOption) OrderOption {
  83. return sql.OrderByField(FieldName, opts...).ToFunc()
  84. }
  85. // ByOrganizationID orders the results by the organization_id field.
  86. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  87. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  88. }