token.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. // Code generated by ent, DO NOT EDIT.
  2. package token
  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 token type in the database.
  11. Label = "token"
  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. // FieldExpireAt holds the string denoting the expire_at field in the database.
  21. FieldExpireAt = "expire_at"
  22. // FieldToken holds the string denoting the token field in the database.
  23. FieldToken = "token"
  24. // FieldMAC holds the string denoting the mac field in the database.
  25. FieldMAC = "mac"
  26. // FieldOrganizationID holds the string denoting the organization_id field in the database.
  27. FieldOrganizationID = "organization_id"
  28. // FieldAgentID holds the string denoting the agent_id field in the database.
  29. FieldAgentID = "agent_id"
  30. // FieldCustomAgentBase holds the string denoting the custom_agent_base field in the database.
  31. FieldCustomAgentBase = "custom_agent_base"
  32. // FieldCustomAgentKey holds the string denoting the custom_agent_key field in the database.
  33. FieldCustomAgentKey = "custom_agent_key"
  34. // FieldOpenaiBase holds the string denoting the openai_base field in the database.
  35. FieldOpenaiBase = "openai_base"
  36. // FieldOpenaiKey holds the string denoting the openai_key field in the database.
  37. FieldOpenaiKey = "openai_key"
  38. // EdgeAgent holds the string denoting the agent edge name in mutations.
  39. EdgeAgent = "agent"
  40. // Table holds the table name of the token in the database.
  41. Table = "token"
  42. // AgentTable is the table that holds the agent relation/edge.
  43. AgentTable = "token"
  44. // AgentInverseTable is the table name for the Agent entity.
  45. // It exists in this package in order to avoid circular dependency with the "agent" package.
  46. AgentInverseTable = "agent"
  47. // AgentColumn is the table column denoting the agent relation/edge.
  48. AgentColumn = "agent_id"
  49. )
  50. // Columns holds all SQL columns for token fields.
  51. var Columns = []string{
  52. FieldID,
  53. FieldCreatedAt,
  54. FieldUpdatedAt,
  55. FieldDeletedAt,
  56. FieldExpireAt,
  57. FieldToken,
  58. FieldMAC,
  59. FieldOrganizationID,
  60. FieldAgentID,
  61. FieldCustomAgentBase,
  62. FieldCustomAgentKey,
  63. FieldOpenaiBase,
  64. FieldOpenaiKey,
  65. }
  66. // ValidColumn reports if the column name is valid (part of the table columns).
  67. func ValidColumn(column string) bool {
  68. for i := range Columns {
  69. if column == Columns[i] {
  70. return true
  71. }
  72. }
  73. return false
  74. }
  75. // Note that the variables below are initialized by the runtime
  76. // package on the initialization of the application. Therefore,
  77. // it should be imported in the main as follows:
  78. //
  79. // import _ "wechat-api/ent/runtime"
  80. var (
  81. Hooks [1]ent.Hook
  82. Interceptors [1]ent.Interceptor
  83. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  84. DefaultCreatedAt func() time.Time
  85. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  86. DefaultUpdatedAt func() time.Time
  87. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  88. UpdateDefaultUpdatedAt func() time.Time
  89. // DefaultToken holds the default value on creation for the "token" field.
  90. DefaultToken string
  91. // DefaultMAC holds the default value on creation for the "mac" field.
  92. DefaultMAC string
  93. // DefaultOrganizationID holds the default value on creation for the "organization_id" field.
  94. DefaultOrganizationID uint64
  95. // DefaultAgentID holds the default value on creation for the "agent_id" field.
  96. DefaultAgentID uint64
  97. // DefaultCustomAgentBase holds the default value on creation for the "custom_agent_base" field.
  98. DefaultCustomAgentBase string
  99. // DefaultCustomAgentKey holds the default value on creation for the "custom_agent_key" field.
  100. DefaultCustomAgentKey string
  101. // DefaultOpenaiBase holds the default value on creation for the "openai_base" field.
  102. DefaultOpenaiBase string
  103. // DefaultOpenaiKey holds the default value on creation for the "openai_key" field.
  104. DefaultOpenaiKey string
  105. )
  106. // OrderOption defines the ordering options for the Token queries.
  107. type OrderOption func(*sql.Selector)
  108. // ByID orders the results by the id field.
  109. func ByID(opts ...sql.OrderTermOption) OrderOption {
  110. return sql.OrderByField(FieldID, opts...).ToFunc()
  111. }
  112. // ByCreatedAt orders the results by the created_at field.
  113. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  114. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  115. }
  116. // ByUpdatedAt orders the results by the updated_at field.
  117. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  118. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  119. }
  120. // ByDeletedAt orders the results by the deleted_at field.
  121. func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
  122. return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
  123. }
  124. // ByExpireAt orders the results by the expire_at field.
  125. func ByExpireAt(opts ...sql.OrderTermOption) OrderOption {
  126. return sql.OrderByField(FieldExpireAt, opts...).ToFunc()
  127. }
  128. // ByToken orders the results by the token field.
  129. func ByToken(opts ...sql.OrderTermOption) OrderOption {
  130. return sql.OrderByField(FieldToken, opts...).ToFunc()
  131. }
  132. // ByMAC orders the results by the mac field.
  133. func ByMAC(opts ...sql.OrderTermOption) OrderOption {
  134. return sql.OrderByField(FieldMAC, opts...).ToFunc()
  135. }
  136. // ByOrganizationID orders the results by the organization_id field.
  137. func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
  138. return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
  139. }
  140. // ByAgentID orders the results by the agent_id field.
  141. func ByAgentID(opts ...sql.OrderTermOption) OrderOption {
  142. return sql.OrderByField(FieldAgentID, opts...).ToFunc()
  143. }
  144. // ByCustomAgentBase orders the results by the custom_agent_base field.
  145. func ByCustomAgentBase(opts ...sql.OrderTermOption) OrderOption {
  146. return sql.OrderByField(FieldCustomAgentBase, opts...).ToFunc()
  147. }
  148. // ByCustomAgentKey orders the results by the custom_agent_key field.
  149. func ByCustomAgentKey(opts ...sql.OrderTermOption) OrderOption {
  150. return sql.OrderByField(FieldCustomAgentKey, opts...).ToFunc()
  151. }
  152. // ByOpenaiBase orders the results by the openai_base field.
  153. func ByOpenaiBase(opts ...sql.OrderTermOption) OrderOption {
  154. return sql.OrderByField(FieldOpenaiBase, opts...).ToFunc()
  155. }
  156. // ByOpenaiKey orders the results by the openai_key field.
  157. func ByOpenaiKey(opts ...sql.OrderTermOption) OrderOption {
  158. return sql.OrderByField(FieldOpenaiKey, opts...).ToFunc()
  159. }
  160. // ByAgentField orders the results by agent field.
  161. func ByAgentField(field string, opts ...sql.OrderTermOption) OrderOption {
  162. return func(s *sql.Selector) {
  163. sqlgraph.OrderByNeighborTerms(s, newAgentStep(), sql.OrderByField(field, opts...))
  164. }
  165. }
  166. func newAgentStep() *sqlgraph.Step {
  167. return sqlgraph.NewStep(
  168. sqlgraph.From(Table, FieldID),
  169. sqlgraph.To(AgentInverseTable, FieldID),
  170. sqlgraph.Edge(sqlgraph.M2O, true, AgentTable, AgentColumn),
  171. )
  172. }