apikey.go 6.8 KB

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