channelmonitor.go 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. // Code generated by ent, DO NOT EDIT.
  2. package channelmonitor
  3. import (
  4. "fmt"
  5. "time"
  6. "entgo.io/ent/dialect/sql"
  7. "entgo.io/ent/dialect/sql/sqlgraph"
  8. )
  9. const (
  10. // Label holds the string label denoting the channelmonitor type in the database.
  11. Label = "channel_monitor"
  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. // FieldName holds the string denoting the name field in the database.
  19. FieldName = "name"
  20. // FieldProvider holds the string denoting the provider field in the database.
  21. FieldProvider = "provider"
  22. // FieldCheckMode holds the string denoting the check_mode field in the database.
  23. FieldCheckMode = "check_mode"
  24. // FieldAccountID holds the string denoting the account_id field in the database.
  25. FieldAccountID = "account_id"
  26. // FieldAPIMode holds the string denoting the api_mode field in the database.
  27. FieldAPIMode = "api_mode"
  28. // FieldEndpoint holds the string denoting the endpoint field in the database.
  29. FieldEndpoint = "endpoint"
  30. // FieldAPIKeyEncrypted holds the string denoting the api_key_encrypted field in the database.
  31. FieldAPIKeyEncrypted = "api_key_encrypted"
  32. // FieldPrimaryModel holds the string denoting the primary_model field in the database.
  33. FieldPrimaryModel = "primary_model"
  34. // FieldExtraModels holds the string denoting the extra_models field in the database.
  35. FieldExtraModels = "extra_models"
  36. // FieldGroupName holds the string denoting the group_name field in the database.
  37. FieldGroupName = "group_name"
  38. // FieldEnabled holds the string denoting the enabled field in the database.
  39. FieldEnabled = "enabled"
  40. // FieldIntervalSeconds holds the string denoting the interval_seconds field in the database.
  41. FieldIntervalSeconds = "interval_seconds"
  42. // FieldJitterSeconds holds the string denoting the jitter_seconds field in the database.
  43. FieldJitterSeconds = "jitter_seconds"
  44. // FieldLastCheckedAt holds the string denoting the last_checked_at field in the database.
  45. FieldLastCheckedAt = "last_checked_at"
  46. // FieldCreatedBy holds the string denoting the created_by field in the database.
  47. FieldCreatedBy = "created_by"
  48. // FieldTemplateID holds the string denoting the template_id field in the database.
  49. FieldTemplateID = "template_id"
  50. // FieldExtraHeaders holds the string denoting the extra_headers field in the database.
  51. FieldExtraHeaders = "extra_headers"
  52. // FieldBodyOverrideMode holds the string denoting the body_override_mode field in the database.
  53. FieldBodyOverrideMode = "body_override_mode"
  54. // FieldBodyOverride holds the string denoting the body_override field in the database.
  55. FieldBodyOverride = "body_override"
  56. // EdgeHistory holds the string denoting the history edge name in mutations.
  57. EdgeHistory = "history"
  58. // EdgeDailyRollups holds the string denoting the daily_rollups edge name in mutations.
  59. EdgeDailyRollups = "daily_rollups"
  60. // EdgeRequestTemplate holds the string denoting the request_template edge name in mutations.
  61. EdgeRequestTemplate = "request_template"
  62. // Table holds the table name of the channelmonitor in the database.
  63. Table = "channel_monitors"
  64. // HistoryTable is the table that holds the history relation/edge.
  65. HistoryTable = "channel_monitor_histories"
  66. // HistoryInverseTable is the table name for the ChannelMonitorHistory entity.
  67. // It exists in this package in order to avoid circular dependency with the "channelmonitorhistory" package.
  68. HistoryInverseTable = "channel_monitor_histories"
  69. // HistoryColumn is the table column denoting the history relation/edge.
  70. HistoryColumn = "monitor_id"
  71. // DailyRollupsTable is the table that holds the daily_rollups relation/edge.
  72. DailyRollupsTable = "channel_monitor_daily_rollups"
  73. // DailyRollupsInverseTable is the table name for the ChannelMonitorDailyRollup entity.
  74. // It exists in this package in order to avoid circular dependency with the "channelmonitordailyrollup" package.
  75. DailyRollupsInverseTable = "channel_monitor_daily_rollups"
  76. // DailyRollupsColumn is the table column denoting the daily_rollups relation/edge.
  77. DailyRollupsColumn = "monitor_id"
  78. // RequestTemplateTable is the table that holds the request_template relation/edge.
  79. RequestTemplateTable = "channel_monitors"
  80. // RequestTemplateInverseTable is the table name for the ChannelMonitorRequestTemplate entity.
  81. // It exists in this package in order to avoid circular dependency with the "channelmonitorrequesttemplate" package.
  82. RequestTemplateInverseTable = "channel_monitor_request_templates"
  83. // RequestTemplateColumn is the table column denoting the request_template relation/edge.
  84. RequestTemplateColumn = "template_id"
  85. )
  86. // Columns holds all SQL columns for channelmonitor fields.
  87. var Columns = []string{
  88. FieldID,
  89. FieldCreatedAt,
  90. FieldUpdatedAt,
  91. FieldName,
  92. FieldProvider,
  93. FieldCheckMode,
  94. FieldAccountID,
  95. FieldAPIMode,
  96. FieldEndpoint,
  97. FieldAPIKeyEncrypted,
  98. FieldPrimaryModel,
  99. FieldExtraModels,
  100. FieldGroupName,
  101. FieldEnabled,
  102. FieldIntervalSeconds,
  103. FieldJitterSeconds,
  104. FieldLastCheckedAt,
  105. FieldCreatedBy,
  106. FieldTemplateID,
  107. FieldExtraHeaders,
  108. FieldBodyOverrideMode,
  109. FieldBodyOverride,
  110. }
  111. // ValidColumn reports if the column name is valid (part of the table columns).
  112. func ValidColumn(column string) bool {
  113. for i := range Columns {
  114. if column == Columns[i] {
  115. return true
  116. }
  117. }
  118. return false
  119. }
  120. var (
  121. // DefaultCreatedAt holds the default value on creation for the "created_at" field.
  122. DefaultCreatedAt func() time.Time
  123. // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
  124. DefaultUpdatedAt func() time.Time
  125. // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
  126. UpdateDefaultUpdatedAt func() time.Time
  127. // NameValidator is a validator for the "name" field. It is called by the builders before save.
  128. NameValidator func(string) error
  129. // DefaultCheckMode holds the default value on creation for the "check_mode" field.
  130. DefaultCheckMode string
  131. // CheckModeValidator is a validator for the "check_mode" field. It is called by the builders before save.
  132. CheckModeValidator func(string) error
  133. // DefaultAPIMode holds the default value on creation for the "api_mode" field.
  134. DefaultAPIMode string
  135. // APIModeValidator is a validator for the "api_mode" field. It is called by the builders before save.
  136. APIModeValidator func(string) error
  137. // EndpointValidator is a validator for the "endpoint" field. It is called by the builders before save.
  138. EndpointValidator func(string) error
  139. // APIKeyEncryptedValidator is a validator for the "api_key_encrypted" field. It is called by the builders before save.
  140. APIKeyEncryptedValidator func(string) error
  141. // PrimaryModelValidator is a validator for the "primary_model" field. It is called by the builders before save.
  142. PrimaryModelValidator func(string) error
  143. // DefaultExtraModels holds the default value on creation for the "extra_models" field.
  144. DefaultExtraModels []string
  145. // DefaultGroupName holds the default value on creation for the "group_name" field.
  146. DefaultGroupName string
  147. // GroupNameValidator is a validator for the "group_name" field. It is called by the builders before save.
  148. GroupNameValidator func(string) error
  149. // DefaultEnabled holds the default value on creation for the "enabled" field.
  150. DefaultEnabled bool
  151. // IntervalSecondsValidator is a validator for the "interval_seconds" field. It is called by the builders before save.
  152. IntervalSecondsValidator func(int) error
  153. // DefaultJitterSeconds holds the default value on creation for the "jitter_seconds" field.
  154. DefaultJitterSeconds int
  155. // JitterSecondsValidator is a validator for the "jitter_seconds" field. It is called by the builders before save.
  156. JitterSecondsValidator func(int) error
  157. // DefaultExtraHeaders holds the default value on creation for the "extra_headers" field.
  158. DefaultExtraHeaders map[string]string
  159. // DefaultBodyOverrideMode holds the default value on creation for the "body_override_mode" field.
  160. DefaultBodyOverrideMode string
  161. // BodyOverrideModeValidator is a validator for the "body_override_mode" field. It is called by the builders before save.
  162. BodyOverrideModeValidator func(string) error
  163. )
  164. // Provider defines the type for the "provider" enum field.
  165. type Provider string
  166. // Provider values.
  167. const (
  168. ProviderOpenai Provider = "openai"
  169. ProviderAnthropic Provider = "anthropic"
  170. ProviderGemini Provider = "gemini"
  171. ProviderGrok Provider = "grok"
  172. ProviderAntigravity Provider = "antigravity"
  173. ProviderKimi Provider = "kimi"
  174. ProviderZhipu Provider = "zhipu"
  175. ProviderDeepseek Provider = "deepseek"
  176. ProviderMinimax Provider = "minimax"
  177. )
  178. func (pr Provider) String() string {
  179. return string(pr)
  180. }
  181. // ProviderValidator is a validator for the "provider" field enum values. It is called by the builders before save.
  182. func ProviderValidator(pr Provider) error {
  183. switch pr {
  184. case ProviderOpenai, ProviderAnthropic, ProviderGemini, ProviderGrok, ProviderAntigravity, ProviderKimi, ProviderZhipu, ProviderDeepseek, ProviderMinimax:
  185. return nil
  186. default:
  187. return fmt.Errorf("channelmonitor: invalid enum value for provider field: %q", pr)
  188. }
  189. }
  190. // OrderOption defines the ordering options for the ChannelMonitor queries.
  191. type OrderOption func(*sql.Selector)
  192. // ByID orders the results by the id field.
  193. func ByID(opts ...sql.OrderTermOption) OrderOption {
  194. return sql.OrderByField(FieldID, opts...).ToFunc()
  195. }
  196. // ByCreatedAt orders the results by the created_at field.
  197. func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
  198. return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
  199. }
  200. // ByUpdatedAt orders the results by the updated_at field.
  201. func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
  202. return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
  203. }
  204. // ByName orders the results by the name field.
  205. func ByName(opts ...sql.OrderTermOption) OrderOption {
  206. return sql.OrderByField(FieldName, opts...).ToFunc()
  207. }
  208. // ByProvider orders the results by the provider field.
  209. func ByProvider(opts ...sql.OrderTermOption) OrderOption {
  210. return sql.OrderByField(FieldProvider, opts...).ToFunc()
  211. }
  212. // ByCheckMode orders the results by the check_mode field.
  213. func ByCheckMode(opts ...sql.OrderTermOption) OrderOption {
  214. return sql.OrderByField(FieldCheckMode, opts...).ToFunc()
  215. }
  216. // ByAccountID orders the results by the account_id field.
  217. func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
  218. return sql.OrderByField(FieldAccountID, opts...).ToFunc()
  219. }
  220. // ByAPIMode orders the results by the api_mode field.
  221. func ByAPIMode(opts ...sql.OrderTermOption) OrderOption {
  222. return sql.OrderByField(FieldAPIMode, opts...).ToFunc()
  223. }
  224. // ByEndpoint orders the results by the endpoint field.
  225. func ByEndpoint(opts ...sql.OrderTermOption) OrderOption {
  226. return sql.OrderByField(FieldEndpoint, opts...).ToFunc()
  227. }
  228. // ByAPIKeyEncrypted orders the results by the api_key_encrypted field.
  229. func ByAPIKeyEncrypted(opts ...sql.OrderTermOption) OrderOption {
  230. return sql.OrderByField(FieldAPIKeyEncrypted, opts...).ToFunc()
  231. }
  232. // ByPrimaryModel orders the results by the primary_model field.
  233. func ByPrimaryModel(opts ...sql.OrderTermOption) OrderOption {
  234. return sql.OrderByField(FieldPrimaryModel, opts...).ToFunc()
  235. }
  236. // ByGroupName orders the results by the group_name field.
  237. func ByGroupName(opts ...sql.OrderTermOption) OrderOption {
  238. return sql.OrderByField(FieldGroupName, opts...).ToFunc()
  239. }
  240. // ByEnabled orders the results by the enabled field.
  241. func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
  242. return sql.OrderByField(FieldEnabled, opts...).ToFunc()
  243. }
  244. // ByIntervalSeconds orders the results by the interval_seconds field.
  245. func ByIntervalSeconds(opts ...sql.OrderTermOption) OrderOption {
  246. return sql.OrderByField(FieldIntervalSeconds, opts...).ToFunc()
  247. }
  248. // ByJitterSeconds orders the results by the jitter_seconds field.
  249. func ByJitterSeconds(opts ...sql.OrderTermOption) OrderOption {
  250. return sql.OrderByField(FieldJitterSeconds, opts...).ToFunc()
  251. }
  252. // ByLastCheckedAt orders the results by the last_checked_at field.
  253. func ByLastCheckedAt(opts ...sql.OrderTermOption) OrderOption {
  254. return sql.OrderByField(FieldLastCheckedAt, opts...).ToFunc()
  255. }
  256. // ByCreatedBy orders the results by the created_by field.
  257. func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
  258. return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
  259. }
  260. // ByTemplateID orders the results by the template_id field.
  261. func ByTemplateID(opts ...sql.OrderTermOption) OrderOption {
  262. return sql.OrderByField(FieldTemplateID, opts...).ToFunc()
  263. }
  264. // ByBodyOverrideMode orders the results by the body_override_mode field.
  265. func ByBodyOverrideMode(opts ...sql.OrderTermOption) OrderOption {
  266. return sql.OrderByField(FieldBodyOverrideMode, opts...).ToFunc()
  267. }
  268. // ByHistoryCount orders the results by history count.
  269. func ByHistoryCount(opts ...sql.OrderTermOption) OrderOption {
  270. return func(s *sql.Selector) {
  271. sqlgraph.OrderByNeighborsCount(s, newHistoryStep(), opts...)
  272. }
  273. }
  274. // ByHistory orders the results by history terms.
  275. func ByHistory(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  276. return func(s *sql.Selector) {
  277. sqlgraph.OrderByNeighborTerms(s, newHistoryStep(), append([]sql.OrderTerm{term}, terms...)...)
  278. }
  279. }
  280. // ByDailyRollupsCount orders the results by daily_rollups count.
  281. func ByDailyRollupsCount(opts ...sql.OrderTermOption) OrderOption {
  282. return func(s *sql.Selector) {
  283. sqlgraph.OrderByNeighborsCount(s, newDailyRollupsStep(), opts...)
  284. }
  285. }
  286. // ByDailyRollups orders the results by daily_rollups terms.
  287. func ByDailyRollups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
  288. return func(s *sql.Selector) {
  289. sqlgraph.OrderByNeighborTerms(s, newDailyRollupsStep(), append([]sql.OrderTerm{term}, terms...)...)
  290. }
  291. }
  292. // ByRequestTemplateField orders the results by request_template field.
  293. func ByRequestTemplateField(field string, opts ...sql.OrderTermOption) OrderOption {
  294. return func(s *sql.Selector) {
  295. sqlgraph.OrderByNeighborTerms(s, newRequestTemplateStep(), sql.OrderByField(field, opts...))
  296. }
  297. }
  298. func newHistoryStep() *sqlgraph.Step {
  299. return sqlgraph.NewStep(
  300. sqlgraph.From(Table, FieldID),
  301. sqlgraph.To(HistoryInverseTable, FieldID),
  302. sqlgraph.Edge(sqlgraph.O2M, false, HistoryTable, HistoryColumn),
  303. )
  304. }
  305. func newDailyRollupsStep() *sqlgraph.Step {
  306. return sqlgraph.NewStep(
  307. sqlgraph.From(Table, FieldID),
  308. sqlgraph.To(DailyRollupsInverseTable, FieldID),
  309. sqlgraph.Edge(sqlgraph.O2M, false, DailyRollupsTable, DailyRollupsColumn),
  310. )
  311. }
  312. func newRequestTemplateStep() *sqlgraph.Step {
  313. return sqlgraph.NewStep(
  314. sqlgraph.From(Table, FieldID),
  315. sqlgraph.To(RequestTemplateInverseTable, FieldID),
  316. sqlgraph.Edge(sqlgraph.M2O, false, RequestTemplateTable, RequestTemplateColumn),
  317. )
  318. }