account.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. // Code generated by ent, DO NOT EDIT.
  2. package ent
  3. import (
  4. "encoding/json"
  5. "fmt"
  6. "strings"
  7. "time"
  8. "entgo.io/ent"
  9. "entgo.io/ent/dialect/sql"
  10. "github.com/Wei-Shaw/sub2api/ent/account"
  11. "github.com/Wei-Shaw/sub2api/ent/proxy"
  12. )
  13. // Account is the model entity for the Account schema.
  14. type Account struct {
  15. config `json:"-"`
  16. // ID of the ent.
  17. ID int64 `json:"id,omitempty"`
  18. // CreatedAt holds the value of the "created_at" field.
  19. CreatedAt time.Time `json:"created_at,omitempty"`
  20. // UpdatedAt holds the value of the "updated_at" field.
  21. UpdatedAt time.Time `json:"updated_at,omitempty"`
  22. // DeletedAt holds the value of the "deleted_at" field.
  23. DeletedAt *time.Time `json:"deleted_at,omitempty"`
  24. // Name holds the value of the "name" field.
  25. Name string `json:"name,omitempty"`
  26. // Notes holds the value of the "notes" field.
  27. Notes *string `json:"notes,omitempty"`
  28. // Platform holds the value of the "platform" field.
  29. Platform string `json:"platform,omitempty"`
  30. // Type holds the value of the "type" field.
  31. Type string `json:"type,omitempty"`
  32. // Credentials holds the value of the "credentials" field.
  33. Credentials map[string]interface{} `json:"credentials,omitempty"`
  34. // Extra holds the value of the "extra" field.
  35. Extra map[string]interface{} `json:"extra,omitempty"`
  36. // ProxyID holds the value of the "proxy_id" field.
  37. ProxyID *int64 `json:"proxy_id,omitempty"`
  38. // Original proxy id replaced by expiry-fallback; for manual revert. NULL = not in fallback.
  39. ProxyFallbackOriginID *int64 `json:"proxy_fallback_origin_id,omitempty"`
  40. // Concurrency holds the value of the "concurrency" field.
  41. Concurrency int `json:"concurrency,omitempty"`
  42. // LoadFactor holds the value of the "load_factor" field.
  43. LoadFactor *int `json:"load_factor,omitempty"`
  44. // Priority holds the value of the "priority" field.
  45. Priority int `json:"priority,omitempty"`
  46. // RateMultiplier holds the value of the "rate_multiplier" field.
  47. RateMultiplier float64 `json:"rate_multiplier,omitempty"`
  48. // Status holds the value of the "status" field.
  49. Status string `json:"status,omitempty"`
  50. // ErrorMessage holds the value of the "error_message" field.
  51. ErrorMessage *string `json:"error_message,omitempty"`
  52. // LastUsedAt holds the value of the "last_used_at" field.
  53. LastUsedAt *time.Time `json:"last_used_at,omitempty"`
  54. // Account expiration time (NULL means no expiration).
  55. ExpiresAt *time.Time `json:"expires_at,omitempty"`
  56. // Auto pause scheduling when account expires.
  57. AutoPauseOnExpired bool `json:"auto_pause_on_expired,omitempty"`
  58. // Schedulable holds the value of the "schedulable" field.
  59. Schedulable bool `json:"schedulable,omitempty"`
  60. // RateLimitedAt holds the value of the "rate_limited_at" field.
  61. RateLimitedAt *time.Time `json:"rate_limited_at,omitempty"`
  62. // RateLimitResetAt holds the value of the "rate_limit_reset_at" field.
  63. RateLimitResetAt *time.Time `json:"rate_limit_reset_at,omitempty"`
  64. // OverloadUntil holds the value of the "overload_until" field.
  65. OverloadUntil *time.Time `json:"overload_until,omitempty"`
  66. // TempUnschedulableUntil holds the value of the "temp_unschedulable_until" field.
  67. TempUnschedulableUntil *time.Time `json:"temp_unschedulable_until,omitempty"`
  68. // TempUnschedulableReason holds the value of the "temp_unschedulable_reason" field.
  69. TempUnschedulableReason *string `json:"temp_unschedulable_reason,omitempty"`
  70. // SessionWindowStart holds the value of the "session_window_start" field.
  71. SessionWindowStart *time.Time `json:"session_window_start,omitempty"`
  72. // SessionWindowEnd holds the value of the "session_window_end" field.
  73. SessionWindowEnd *time.Time `json:"session_window_end,omitempty"`
  74. // SessionWindowStatus holds the value of the "session_window_status" field.
  75. SessionWindowStatus *string `json:"session_window_status,omitempty"`
  76. // Parent account id for a linked spark shadow (NULL = normal).
  77. ParentAccountID *int64 `json:"parent_account_id,omitempty"`
  78. // 'global' (default) or 'spark' (shadow reads codex_bengalfox).
  79. QuotaDimension account.QuotaDimension `json:"quota_dimension,omitempty"`
  80. // Edges holds the relations/edges for other nodes in the graph.
  81. // The values are being populated by the AccountQuery when eager-loading is set.
  82. Edges AccountEdges `json:"edges"`
  83. selectValues sql.SelectValues
  84. }
  85. // AccountEdges holds the relations/edges for other nodes in the graph.
  86. type AccountEdges struct {
  87. // Groups holds the value of the groups edge.
  88. Groups []*Group `json:"groups,omitempty"`
  89. // Proxy holds the value of the proxy edge.
  90. Proxy *Proxy `json:"proxy,omitempty"`
  91. // Parent holds the value of the parent edge.
  92. Parent *Account `json:"parent,omitempty"`
  93. // Children holds the value of the children edge.
  94. Children []*Account `json:"children,omitempty"`
  95. // UsageLogs holds the value of the usage_logs edge.
  96. UsageLogs []*UsageLog `json:"usage_logs,omitempty"`
  97. // AccountGroups holds the value of the account_groups edge.
  98. AccountGroups []*AccountGroup `json:"account_groups,omitempty"`
  99. // loadedTypes holds the information for reporting if a
  100. // type was loaded (or requested) in eager-loading or not.
  101. loadedTypes [6]bool
  102. }
  103. // GroupsOrErr returns the Groups value or an error if the edge
  104. // was not loaded in eager-loading.
  105. func (e AccountEdges) GroupsOrErr() ([]*Group, error) {
  106. if e.loadedTypes[0] {
  107. return e.Groups, nil
  108. }
  109. return nil, &NotLoadedError{edge: "groups"}
  110. }
  111. // ProxyOrErr returns the Proxy value or an error if the edge
  112. // was not loaded in eager-loading, or loaded but was not found.
  113. func (e AccountEdges) ProxyOrErr() (*Proxy, error) {
  114. if e.Proxy != nil {
  115. return e.Proxy, nil
  116. } else if e.loadedTypes[1] {
  117. return nil, &NotFoundError{label: proxy.Label}
  118. }
  119. return nil, &NotLoadedError{edge: "proxy"}
  120. }
  121. // ParentOrErr returns the Parent value or an error if the edge
  122. // was not loaded in eager-loading, or loaded but was not found.
  123. func (e AccountEdges) ParentOrErr() (*Account, error) {
  124. if e.Parent != nil {
  125. return e.Parent, nil
  126. } else if e.loadedTypes[2] {
  127. return nil, &NotFoundError{label: account.Label}
  128. }
  129. return nil, &NotLoadedError{edge: "parent"}
  130. }
  131. // ChildrenOrErr returns the Children value or an error if the edge
  132. // was not loaded in eager-loading.
  133. func (e AccountEdges) ChildrenOrErr() ([]*Account, error) {
  134. if e.loadedTypes[3] {
  135. return e.Children, nil
  136. }
  137. return nil, &NotLoadedError{edge: "children"}
  138. }
  139. // UsageLogsOrErr returns the UsageLogs value or an error if the edge
  140. // was not loaded in eager-loading.
  141. func (e AccountEdges) UsageLogsOrErr() ([]*UsageLog, error) {
  142. if e.loadedTypes[4] {
  143. return e.UsageLogs, nil
  144. }
  145. return nil, &NotLoadedError{edge: "usage_logs"}
  146. }
  147. // AccountGroupsOrErr returns the AccountGroups value or an error if the edge
  148. // was not loaded in eager-loading.
  149. func (e AccountEdges) AccountGroupsOrErr() ([]*AccountGroup, error) {
  150. if e.loadedTypes[5] {
  151. return e.AccountGroups, nil
  152. }
  153. return nil, &NotLoadedError{edge: "account_groups"}
  154. }
  155. // scanValues returns the types for scanning values from sql.Rows.
  156. func (*Account) scanValues(columns []string) ([]any, error) {
  157. values := make([]any, len(columns))
  158. for i := range columns {
  159. switch columns[i] {
  160. case account.FieldCredentials, account.FieldExtra:
  161. values[i] = new([]byte)
  162. case account.FieldAutoPauseOnExpired, account.FieldSchedulable:
  163. values[i] = new(sql.NullBool)
  164. case account.FieldRateMultiplier:
  165. values[i] = new(sql.NullFloat64)
  166. case account.FieldID, account.FieldProxyID, account.FieldProxyFallbackOriginID, account.FieldConcurrency, account.FieldLoadFactor, account.FieldPriority, account.FieldParentAccountID:
  167. values[i] = new(sql.NullInt64)
  168. case account.FieldName, account.FieldNotes, account.FieldPlatform, account.FieldType, account.FieldStatus, account.FieldErrorMessage, account.FieldTempUnschedulableReason, account.FieldSessionWindowStatus, account.FieldQuotaDimension:
  169. values[i] = new(sql.NullString)
  170. case account.FieldCreatedAt, account.FieldUpdatedAt, account.FieldDeletedAt, account.FieldLastUsedAt, account.FieldExpiresAt, account.FieldRateLimitedAt, account.FieldRateLimitResetAt, account.FieldOverloadUntil, account.FieldTempUnschedulableUntil, account.FieldSessionWindowStart, account.FieldSessionWindowEnd:
  171. values[i] = new(sql.NullTime)
  172. default:
  173. values[i] = new(sql.UnknownType)
  174. }
  175. }
  176. return values, nil
  177. }
  178. // assignValues assigns the values that were returned from sql.Rows (after scanning)
  179. // to the Account fields.
  180. func (_m *Account) assignValues(columns []string, values []any) error {
  181. if m, n := len(values), len(columns); m < n {
  182. return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
  183. }
  184. for i := range columns {
  185. switch columns[i] {
  186. case account.FieldID:
  187. value, ok := values[i].(*sql.NullInt64)
  188. if !ok {
  189. return fmt.Errorf("unexpected type %T for field id", value)
  190. }
  191. _m.ID = int64(value.Int64)
  192. case account.FieldCreatedAt:
  193. if value, ok := values[i].(*sql.NullTime); !ok {
  194. return fmt.Errorf("unexpected type %T for field created_at", values[i])
  195. } else if value.Valid {
  196. _m.CreatedAt = value.Time
  197. }
  198. case account.FieldUpdatedAt:
  199. if value, ok := values[i].(*sql.NullTime); !ok {
  200. return fmt.Errorf("unexpected type %T for field updated_at", values[i])
  201. } else if value.Valid {
  202. _m.UpdatedAt = value.Time
  203. }
  204. case account.FieldDeletedAt:
  205. if value, ok := values[i].(*sql.NullTime); !ok {
  206. return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
  207. } else if value.Valid {
  208. _m.DeletedAt = new(time.Time)
  209. *_m.DeletedAt = value.Time
  210. }
  211. case account.FieldName:
  212. if value, ok := values[i].(*sql.NullString); !ok {
  213. return fmt.Errorf("unexpected type %T for field name", values[i])
  214. } else if value.Valid {
  215. _m.Name = value.String
  216. }
  217. case account.FieldNotes:
  218. if value, ok := values[i].(*sql.NullString); !ok {
  219. return fmt.Errorf("unexpected type %T for field notes", values[i])
  220. } else if value.Valid {
  221. _m.Notes = new(string)
  222. *_m.Notes = value.String
  223. }
  224. case account.FieldPlatform:
  225. if value, ok := values[i].(*sql.NullString); !ok {
  226. return fmt.Errorf("unexpected type %T for field platform", values[i])
  227. } else if value.Valid {
  228. _m.Platform = value.String
  229. }
  230. case account.FieldType:
  231. if value, ok := values[i].(*sql.NullString); !ok {
  232. return fmt.Errorf("unexpected type %T for field type", values[i])
  233. } else if value.Valid {
  234. _m.Type = value.String
  235. }
  236. case account.FieldCredentials:
  237. if value, ok := values[i].(*[]byte); !ok {
  238. return fmt.Errorf("unexpected type %T for field credentials", values[i])
  239. } else if value != nil && len(*value) > 0 {
  240. if err := json.Unmarshal(*value, &_m.Credentials); err != nil {
  241. return fmt.Errorf("unmarshal field credentials: %w", err)
  242. }
  243. }
  244. case account.FieldExtra:
  245. if value, ok := values[i].(*[]byte); !ok {
  246. return fmt.Errorf("unexpected type %T for field extra", values[i])
  247. } else if value != nil && len(*value) > 0 {
  248. if err := json.Unmarshal(*value, &_m.Extra); err != nil {
  249. return fmt.Errorf("unmarshal field extra: %w", err)
  250. }
  251. }
  252. case account.FieldProxyID:
  253. if value, ok := values[i].(*sql.NullInt64); !ok {
  254. return fmt.Errorf("unexpected type %T for field proxy_id", values[i])
  255. } else if value.Valid {
  256. _m.ProxyID = new(int64)
  257. *_m.ProxyID = value.Int64
  258. }
  259. case account.FieldProxyFallbackOriginID:
  260. if value, ok := values[i].(*sql.NullInt64); !ok {
  261. return fmt.Errorf("unexpected type %T for field proxy_fallback_origin_id", values[i])
  262. } else if value.Valid {
  263. _m.ProxyFallbackOriginID = new(int64)
  264. *_m.ProxyFallbackOriginID = value.Int64
  265. }
  266. case account.FieldConcurrency:
  267. if value, ok := values[i].(*sql.NullInt64); !ok {
  268. return fmt.Errorf("unexpected type %T for field concurrency", values[i])
  269. } else if value.Valid {
  270. _m.Concurrency = int(value.Int64)
  271. }
  272. case account.FieldLoadFactor:
  273. if value, ok := values[i].(*sql.NullInt64); !ok {
  274. return fmt.Errorf("unexpected type %T for field load_factor", values[i])
  275. } else if value.Valid {
  276. _m.LoadFactor = new(int)
  277. *_m.LoadFactor = int(value.Int64)
  278. }
  279. case account.FieldPriority:
  280. if value, ok := values[i].(*sql.NullInt64); !ok {
  281. return fmt.Errorf("unexpected type %T for field priority", values[i])
  282. } else if value.Valid {
  283. _m.Priority = int(value.Int64)
  284. }
  285. case account.FieldRateMultiplier:
  286. if value, ok := values[i].(*sql.NullFloat64); !ok {
  287. return fmt.Errorf("unexpected type %T for field rate_multiplier", values[i])
  288. } else if value.Valid {
  289. _m.RateMultiplier = value.Float64
  290. }
  291. case account.FieldStatus:
  292. if value, ok := values[i].(*sql.NullString); !ok {
  293. return fmt.Errorf("unexpected type %T for field status", values[i])
  294. } else if value.Valid {
  295. _m.Status = value.String
  296. }
  297. case account.FieldErrorMessage:
  298. if value, ok := values[i].(*sql.NullString); !ok {
  299. return fmt.Errorf("unexpected type %T for field error_message", values[i])
  300. } else if value.Valid {
  301. _m.ErrorMessage = new(string)
  302. *_m.ErrorMessage = value.String
  303. }
  304. case account.FieldLastUsedAt:
  305. if value, ok := values[i].(*sql.NullTime); !ok {
  306. return fmt.Errorf("unexpected type %T for field last_used_at", values[i])
  307. } else if value.Valid {
  308. _m.LastUsedAt = new(time.Time)
  309. *_m.LastUsedAt = value.Time
  310. }
  311. case account.FieldExpiresAt:
  312. if value, ok := values[i].(*sql.NullTime); !ok {
  313. return fmt.Errorf("unexpected type %T for field expires_at", values[i])
  314. } else if value.Valid {
  315. _m.ExpiresAt = new(time.Time)
  316. *_m.ExpiresAt = value.Time
  317. }
  318. case account.FieldAutoPauseOnExpired:
  319. if value, ok := values[i].(*sql.NullBool); !ok {
  320. return fmt.Errorf("unexpected type %T for field auto_pause_on_expired", values[i])
  321. } else if value.Valid {
  322. _m.AutoPauseOnExpired = value.Bool
  323. }
  324. case account.FieldSchedulable:
  325. if value, ok := values[i].(*sql.NullBool); !ok {
  326. return fmt.Errorf("unexpected type %T for field schedulable", values[i])
  327. } else if value.Valid {
  328. _m.Schedulable = value.Bool
  329. }
  330. case account.FieldRateLimitedAt:
  331. if value, ok := values[i].(*sql.NullTime); !ok {
  332. return fmt.Errorf("unexpected type %T for field rate_limited_at", values[i])
  333. } else if value.Valid {
  334. _m.RateLimitedAt = new(time.Time)
  335. *_m.RateLimitedAt = value.Time
  336. }
  337. case account.FieldRateLimitResetAt:
  338. if value, ok := values[i].(*sql.NullTime); !ok {
  339. return fmt.Errorf("unexpected type %T for field rate_limit_reset_at", values[i])
  340. } else if value.Valid {
  341. _m.RateLimitResetAt = new(time.Time)
  342. *_m.RateLimitResetAt = value.Time
  343. }
  344. case account.FieldOverloadUntil:
  345. if value, ok := values[i].(*sql.NullTime); !ok {
  346. return fmt.Errorf("unexpected type %T for field overload_until", values[i])
  347. } else if value.Valid {
  348. _m.OverloadUntil = new(time.Time)
  349. *_m.OverloadUntil = value.Time
  350. }
  351. case account.FieldTempUnschedulableUntil:
  352. if value, ok := values[i].(*sql.NullTime); !ok {
  353. return fmt.Errorf("unexpected type %T for field temp_unschedulable_until", values[i])
  354. } else if value.Valid {
  355. _m.TempUnschedulableUntil = new(time.Time)
  356. *_m.TempUnschedulableUntil = value.Time
  357. }
  358. case account.FieldTempUnschedulableReason:
  359. if value, ok := values[i].(*sql.NullString); !ok {
  360. return fmt.Errorf("unexpected type %T for field temp_unschedulable_reason", values[i])
  361. } else if value.Valid {
  362. _m.TempUnschedulableReason = new(string)
  363. *_m.TempUnschedulableReason = value.String
  364. }
  365. case account.FieldSessionWindowStart:
  366. if value, ok := values[i].(*sql.NullTime); !ok {
  367. return fmt.Errorf("unexpected type %T for field session_window_start", values[i])
  368. } else if value.Valid {
  369. _m.SessionWindowStart = new(time.Time)
  370. *_m.SessionWindowStart = value.Time
  371. }
  372. case account.FieldSessionWindowEnd:
  373. if value, ok := values[i].(*sql.NullTime); !ok {
  374. return fmt.Errorf("unexpected type %T for field session_window_end", values[i])
  375. } else if value.Valid {
  376. _m.SessionWindowEnd = new(time.Time)
  377. *_m.SessionWindowEnd = value.Time
  378. }
  379. case account.FieldSessionWindowStatus:
  380. if value, ok := values[i].(*sql.NullString); !ok {
  381. return fmt.Errorf("unexpected type %T for field session_window_status", values[i])
  382. } else if value.Valid {
  383. _m.SessionWindowStatus = new(string)
  384. *_m.SessionWindowStatus = value.String
  385. }
  386. case account.FieldParentAccountID:
  387. if value, ok := values[i].(*sql.NullInt64); !ok {
  388. return fmt.Errorf("unexpected type %T for field parent_account_id", values[i])
  389. } else if value.Valid {
  390. _m.ParentAccountID = new(int64)
  391. *_m.ParentAccountID = value.Int64
  392. }
  393. case account.FieldQuotaDimension:
  394. if value, ok := values[i].(*sql.NullString); !ok {
  395. return fmt.Errorf("unexpected type %T for field quota_dimension", values[i])
  396. } else if value.Valid {
  397. _m.QuotaDimension = account.QuotaDimension(value.String)
  398. }
  399. default:
  400. _m.selectValues.Set(columns[i], values[i])
  401. }
  402. }
  403. return nil
  404. }
  405. // Value returns the ent.Value that was dynamically selected and assigned to the Account.
  406. // This includes values selected through modifiers, order, etc.
  407. func (_m *Account) Value(name string) (ent.Value, error) {
  408. return _m.selectValues.Get(name)
  409. }
  410. // QueryGroups queries the "groups" edge of the Account entity.
  411. func (_m *Account) QueryGroups() *GroupQuery {
  412. return NewAccountClient(_m.config).QueryGroups(_m)
  413. }
  414. // QueryProxy queries the "proxy" edge of the Account entity.
  415. func (_m *Account) QueryProxy() *ProxyQuery {
  416. return NewAccountClient(_m.config).QueryProxy(_m)
  417. }
  418. // QueryParent queries the "parent" edge of the Account entity.
  419. func (_m *Account) QueryParent() *AccountQuery {
  420. return NewAccountClient(_m.config).QueryParent(_m)
  421. }
  422. // QueryChildren queries the "children" edge of the Account entity.
  423. func (_m *Account) QueryChildren() *AccountQuery {
  424. return NewAccountClient(_m.config).QueryChildren(_m)
  425. }
  426. // QueryUsageLogs queries the "usage_logs" edge of the Account entity.
  427. func (_m *Account) QueryUsageLogs() *UsageLogQuery {
  428. return NewAccountClient(_m.config).QueryUsageLogs(_m)
  429. }
  430. // QueryAccountGroups queries the "account_groups" edge of the Account entity.
  431. func (_m *Account) QueryAccountGroups() *AccountGroupQuery {
  432. return NewAccountClient(_m.config).QueryAccountGroups(_m)
  433. }
  434. // Update returns a builder for updating this Account.
  435. // Note that you need to call Account.Unwrap() before calling this method if this Account
  436. // was returned from a transaction, and the transaction was committed or rolled back.
  437. func (_m *Account) Update() *AccountUpdateOne {
  438. return NewAccountClient(_m.config).UpdateOne(_m)
  439. }
  440. // Unwrap unwraps the Account entity that was returned from a transaction after it was closed,
  441. // so that all future queries will be executed through the driver which created the transaction.
  442. func (_m *Account) Unwrap() *Account {
  443. _tx, ok := _m.config.driver.(*txDriver)
  444. if !ok {
  445. panic("ent: Account is not a transactional entity")
  446. }
  447. _m.config.driver = _tx.drv
  448. return _m
  449. }
  450. // String implements the fmt.Stringer.
  451. func (_m *Account) String() string {
  452. var builder strings.Builder
  453. builder.WriteString("Account(")
  454. builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
  455. builder.WriteString("created_at=")
  456. builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
  457. builder.WriteString(", ")
  458. builder.WriteString("updated_at=")
  459. builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
  460. builder.WriteString(", ")
  461. if v := _m.DeletedAt; v != nil {
  462. builder.WriteString("deleted_at=")
  463. builder.WriteString(v.Format(time.ANSIC))
  464. }
  465. builder.WriteString(", ")
  466. builder.WriteString("name=")
  467. builder.WriteString(_m.Name)
  468. builder.WriteString(", ")
  469. if v := _m.Notes; v != nil {
  470. builder.WriteString("notes=")
  471. builder.WriteString(*v)
  472. }
  473. builder.WriteString(", ")
  474. builder.WriteString("platform=")
  475. builder.WriteString(_m.Platform)
  476. builder.WriteString(", ")
  477. builder.WriteString("type=")
  478. builder.WriteString(_m.Type)
  479. builder.WriteString(", ")
  480. builder.WriteString("credentials=")
  481. builder.WriteString(fmt.Sprintf("%v", _m.Credentials))
  482. builder.WriteString(", ")
  483. builder.WriteString("extra=")
  484. builder.WriteString(fmt.Sprintf("%v", _m.Extra))
  485. builder.WriteString(", ")
  486. if v := _m.ProxyID; v != nil {
  487. builder.WriteString("proxy_id=")
  488. builder.WriteString(fmt.Sprintf("%v", *v))
  489. }
  490. builder.WriteString(", ")
  491. if v := _m.ProxyFallbackOriginID; v != nil {
  492. builder.WriteString("proxy_fallback_origin_id=")
  493. builder.WriteString(fmt.Sprintf("%v", *v))
  494. }
  495. builder.WriteString(", ")
  496. builder.WriteString("concurrency=")
  497. builder.WriteString(fmt.Sprintf("%v", _m.Concurrency))
  498. builder.WriteString(", ")
  499. if v := _m.LoadFactor; v != nil {
  500. builder.WriteString("load_factor=")
  501. builder.WriteString(fmt.Sprintf("%v", *v))
  502. }
  503. builder.WriteString(", ")
  504. builder.WriteString("priority=")
  505. builder.WriteString(fmt.Sprintf("%v", _m.Priority))
  506. builder.WriteString(", ")
  507. builder.WriteString("rate_multiplier=")
  508. builder.WriteString(fmt.Sprintf("%v", _m.RateMultiplier))
  509. builder.WriteString(", ")
  510. builder.WriteString("status=")
  511. builder.WriteString(_m.Status)
  512. builder.WriteString(", ")
  513. if v := _m.ErrorMessage; v != nil {
  514. builder.WriteString("error_message=")
  515. builder.WriteString(*v)
  516. }
  517. builder.WriteString(", ")
  518. if v := _m.LastUsedAt; v != nil {
  519. builder.WriteString("last_used_at=")
  520. builder.WriteString(v.Format(time.ANSIC))
  521. }
  522. builder.WriteString(", ")
  523. if v := _m.ExpiresAt; v != nil {
  524. builder.WriteString("expires_at=")
  525. builder.WriteString(v.Format(time.ANSIC))
  526. }
  527. builder.WriteString(", ")
  528. builder.WriteString("auto_pause_on_expired=")
  529. builder.WriteString(fmt.Sprintf("%v", _m.AutoPauseOnExpired))
  530. builder.WriteString(", ")
  531. builder.WriteString("schedulable=")
  532. builder.WriteString(fmt.Sprintf("%v", _m.Schedulable))
  533. builder.WriteString(", ")
  534. if v := _m.RateLimitedAt; v != nil {
  535. builder.WriteString("rate_limited_at=")
  536. builder.WriteString(v.Format(time.ANSIC))
  537. }
  538. builder.WriteString(", ")
  539. if v := _m.RateLimitResetAt; v != nil {
  540. builder.WriteString("rate_limit_reset_at=")
  541. builder.WriteString(v.Format(time.ANSIC))
  542. }
  543. builder.WriteString(", ")
  544. if v := _m.OverloadUntil; v != nil {
  545. builder.WriteString("overload_until=")
  546. builder.WriteString(v.Format(time.ANSIC))
  547. }
  548. builder.WriteString(", ")
  549. if v := _m.TempUnschedulableUntil; v != nil {
  550. builder.WriteString("temp_unschedulable_until=")
  551. builder.WriteString(v.Format(time.ANSIC))
  552. }
  553. builder.WriteString(", ")
  554. if v := _m.TempUnschedulableReason; v != nil {
  555. builder.WriteString("temp_unschedulable_reason=")
  556. builder.WriteString(*v)
  557. }
  558. builder.WriteString(", ")
  559. if v := _m.SessionWindowStart; v != nil {
  560. builder.WriteString("session_window_start=")
  561. builder.WriteString(v.Format(time.ANSIC))
  562. }
  563. builder.WriteString(", ")
  564. if v := _m.SessionWindowEnd; v != nil {
  565. builder.WriteString("session_window_end=")
  566. builder.WriteString(v.Format(time.ANSIC))
  567. }
  568. builder.WriteString(", ")
  569. if v := _m.SessionWindowStatus; v != nil {
  570. builder.WriteString("session_window_status=")
  571. builder.WriteString(*v)
  572. }
  573. builder.WriteString(", ")
  574. if v := _m.ParentAccountID; v != nil {
  575. builder.WriteString("parent_account_id=")
  576. builder.WriteString(fmt.Sprintf("%v", *v))
  577. }
  578. builder.WriteString(", ")
  579. builder.WriteString("quota_dimension=")
  580. builder.WriteString(fmt.Sprintf("%v", _m.QuotaDimension))
  581. builder.WriteByte(')')
  582. return builder.String()
  583. }
  584. // Accounts is a parsable slice of Account.
  585. type Accounts []*Account