server.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // Code generated by ent, DO NOT EDIT.
  2. package server
  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 server type in the database.
  11. Label = "server"
  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. // FieldStatus holds the string denoting the status field in the database.
  19. FieldStatus = "status"
  20. // FieldDeletedAt holds the string denoting the deleted_at field in the database.
  21. FieldDeletedAt = "deleted_at"
  22. // FieldName holds the string denoting the name field in the database.
  23. FieldName = "name"
  24. // FieldPublicIP holds the string denoting the public_ip field in the database.
  25. FieldPublicIP = "public_ip"
  26. // FieldPrivateIP holds the string denoting the private_ip field in the database.
  27. FieldPrivateIP = "private_ip"
  28. // FieldAdminPort holds the string denoting the admin_port field in the database.
  29. FieldAdminPort = "admin_port"
  30. // EdgeWxs holds the string denoting the wxs edge name in mutations.
  31. EdgeWxs = "wxs"
  32. // Table holds the table name of the server in the database.
  33. Table = "server"
  34. // WxsTable is the table that holds the wxs relation/edge.
  35. WxsTable = "wx"
  36. // WxsInverseTable is the table name for the Wx entity.
  37. // It exists in this package in order to avoid circular dependency with the "wx" package.
  38. WxsInverseTable = "wx"
  39. // WxsColumn is the table column denoting the wxs relation/edge.
  40. WxsColumn = "server_id"
  41. )
  42. // Columns holds all SQL columns for server fields.
  43. var Columns = []string{
  44. FieldID,
  45. FieldCreatedAt,
  46. FieldUpdatedAt,
  47. FieldStatus,
  48. FieldDeletedAt,
  49. FieldName,
  50. FieldPublicIP,
  51. FieldPrivateIP,
  52. FieldAdminPort,
  53. }
  54. // ValidColumn reports if the column name is valid (part of the table columns).
  55. func ValidColumn(column string) bool {
  56. for i := range Columns {
  57. if column == Columns[i] {
  58. return true
  59. }
  60. }
  61. return false
  62. }
  63. // Note that the variables below are initialized by the runtime
  64. // package on the initialization of the application. Therefore,
  65. // it should be imported in the main as follows:
  66. //
  67. // import _ "wechat-api/ent/runtime"
  68. var (
  69. Hooks [1]ent.Hook
  70. Interceptors [1]ent.Interceptor
  71. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  72. DefaultCreatedAt func() time.Time
  73. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  74. DefaultUpdatedAt func() time.Time
  75. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  76. UpdateDefaultUpdatedAt func() time.Time
  77. // DefaultStatus holds the default value on creation for the "status" field.
  78. DefaultStatus uint8
  79. )
  80. // OrderOption defines the ordering options for the Server queries.
  81. type OrderOption func(*sql.Selector)
  82. // ByID orders the results by the id field.
  83. func ByID(opts ...sql.OrderTermOption) OrderOption {
  84. return sql.OrderByField(FieldID, opts...).ToFunc()
  85. }
  86. // ByCreatedAt orders the results by the created_at field.
  87. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  88. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  89. }
  90. // ByUpdatedAt orders the results by the updated_at field.
  91. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  92. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  93. }
  94. // ByStatus orders the results by the status field.
  95. func ByStatus(opts ...sql.OrderTermOption) OrderOption {
  96. return sql.OrderByField(FieldStatus, opts...).ToFunc()
  97. }
  98. // ByDeletedAt orders the results by the deleted_at field.
  99. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  100. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  101. }
  102. // ByName orders the results by the name field.
  103. func ByName(opts ...sql.OrderTermOption) OrderOption {
  104. return sql.OrderByField(FieldName, opts...).ToFunc()
  105. }
  106. // ByPublicIP orders the results by the public_ip field.
  107. func ByPublicIP(opts ...sql.OrderTermOption) OrderOption {
  108. return sql.OrderByField(FieldPublicIP, opts...).ToFunc()
  109. }
  110. // ByPrivateIP orders the results by the private_ip field.
  111. func ByPrivateIP(opts ...sql.OrderTermOption) OrderOption {
  112. return sql.OrderByField(FieldPrivateIP, opts...).ToFunc()
  113. }
  114. // ByAdminPort orders the results by the admin_port field.
  115. func ByAdminPort(opts ...sql.OrderTermOption) OrderOption {
  116. return sql.OrderByField(FieldAdminPort, opts...).ToFunc()
  117. }
  118. // ByWxsCount orders the results by wxs count.
  119. func ByWxsCount(opts ...sql.OrderTermOption) OrderOption {
  120. return func(s *sql.Selector) {
  121. sqlgraph.OrderByNeighborsCount(s, newWxsStep(), opts...)
  122. }
  123. }
  124. // ByWxs orders the results by wxs terms.
  125. func ByWxs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  126. return func(s *sql.Selector) {
  127. sqlgraph.OrderByNeighborTerms(s, newWxsStep(), append([]sql.OrderTerm{term}, terms...)...)
  128. }
  129. }
  130. func newWxsStep() *sqlgraph.Step {
  131. return sqlgraph.NewStep(
  132. sqlgraph.From(Table, FieldID),
  133. sqlgraph.To(WxsInverseTable, FieldID),
  134. sqlgraph.Edge(sqlgraph.O2M, false, WxsTable, WxsColumn),
  135. )
  136. }