securitypolicykeyword.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // Code generated by ent, DO NOT EDIT.
  2. package securitypolicykeyword
  3. import (
  4. "time"
  5. "entgo.io/ent"
  6. "entgo.io/ent/dialect/sql"
  7. "entgo.io/ent/dialect/sql/sqlgraph"
  8. )
  9. const (
  10. // Label holds the string label denoting the securitypolicykeyword type in the database.
  11. Label = "security_policy_keyword"
  12. // FieldID holds the string denoting the id field in the database.
  13. FieldID = "id"
  14. // FieldCreatedAt holds the string denoting the created_at field in the database.
  15. FieldCreatedAt = "created_at"
  16. // FieldUpdatedAt holds the string denoting the updated_at field in the database.
  17. FieldUpdatedAt = "updated_at"
  18. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  19. FieldDeletedAt = "deleted_at"
  20. // FieldGroupID holds the string denoting the group_id field in the database.
  21. FieldGroupID = "group_id"
  22. // FieldKeyword holds the string denoting the keyword field in the database.
  23. FieldKeyword = "keyword"
  24. // FieldCategory holds the string denoting the category field in the database.
  25. FieldCategory = "category"
  26. // FieldEnabled holds the string denoting the enabled field in the database.
  27. FieldEnabled = "enabled"
  28. // EdgeGroup holds the string denoting the group edge name in mutations.
  29. EdgeGroup = "group"
  30. // Table holds the table name of the securitypolicykeyword in the database.
  31. Table = "security_policy_keywords"
  32. // GroupTable is the table that holds the group relation/edge.
  33. GroupTable = "security_policy_keywords"
  34. // GroupInverseTable is the table name for the Group entity.
  35. // It exists in this package in order to avoid circular dependency with the "group" package.
  36. GroupInverseTable = "groups"
  37. // GroupColumn is the table column denoting the group relation/edge.
  38. GroupColumn = "group_id"
  39. )
  40. // Columns holds all SQL columns for securitypolicykeyword fields.
  41. var Columns = []string{
  42. FieldID,
  43. FieldCreatedAt,
  44. FieldUpdatedAt,
  45. FieldDeletedAt,
  46. FieldGroupID,
  47. FieldKeyword,
  48. FieldCategory,
  49. FieldEnabled,
  50. }
  51. // ValidColumn reports if the column name is valid (part of the table columns).
  52. func ValidColumn(column string) bool {
  53. for i := range Columns {
  54. if column == Columns[i] {
  55. return true
  56. }
  57. }
  58. return false
  59. }
  60. // Note that the variables below are initialized by the runtime
  61. // package on the initialization of the application. Therefore,
  62. // it should be imported in the main as follows:
  63. //
  64. // import _ "github.com/Wei-Shaw/sub2api/ent/runtime"
  65. var (
  66. Hooks [1]ent.Hook
  67. Interceptors [1]ent.Interceptor
  68. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  69. DefaultCreatedAt func() time.Time
  70. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  71. DefaultUpdatedAt func() time.Time
  72. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  73. UpdateDefaultUpdatedAt func() time.Time
  74. // KeywordValidator is a validator for the "keyword" field. It is called by the builders before save.
  75. KeywordValidator func(string) error
  76. // DefaultCategory holds the default value on creation for the "category" field.
  77. DefaultCategory string
  78. // CategoryValidator is a validator for the "category" field. It is called by the builders before save.
  79. CategoryValidator func(string) error
  80. // DefaultEnabled holds the default value on creation for the "enabled" field.
  81. DefaultEnabled bool
  82. )
  83. // OrderOption defines the ordering options for the SecurityPolicyKeyword queries.
  84. type OrderOption func(*sql.Selector)
  85. // ByID orders the results by the id field.
  86. func ByID(opts ...sql.OrderTermOption) OrderOption {
  87. return sql.OrderByField(FieldID, opts...).ToFunc()
  88. }
  89. // ByCreatedAt orders the results by the created_at field.
  90. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  91. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  92. }
  93. // ByUpdatedAt orders the results by the updated_at field.
  94. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  95. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  96. }
  97. // ByDeletedAt orders the results by the deleted_at field.
  98. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  99. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  100. }
  101. // ByGroupID orders the results by the group_id field.
  102. func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
  103. return sql.OrderByField(FieldGroupID, opts...).ToFunc()
  104. }
  105. // ByKeyword orders the results by the keyword field.
  106. func ByKeyword(opts ...sql.OrderTermOption) OrderOption {
  107. return sql.OrderByField(FieldKeyword, opts...).ToFunc()
  108. }
  109. // ByCategory orders the results by the category field.
  110. func ByCategory(opts ...sql.OrderTermOption) OrderOption {
  111. return sql.OrderByField(FieldCategory, opts...).ToFunc()
  112. }
  113. // ByEnabled orders the results by the enabled field.
  114. func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
  115. return sql.OrderByField(FieldEnabled, opts...).ToFunc()
  116. }
  117. // ByGroupField orders the results by group field.
  118. func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
  119. return func(s *sql.Selector) {
  120. sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
  121. }
  122. }
  123. func newGroupStep() *sqlgraph.Step {
  124. return sqlgraph.NewStep(
  125. sqlgraph.From(Table, FieldID),
  126. sqlgraph.To(GroupInverseTable, FieldID),
  127. sqlgraph.Edge(sqlgraph.M2O, false, GroupTable, GroupColumn),
  128. )
  129. }