diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml
index a9cf349937..bb5cf692bc 100644
--- a/.github/workflows/backend-ci.yml
+++ b/.github/workflows/backend-ci.yml
@@ -20,7 +20,7 @@ jobs:
cache-dependency-path: backend/go.sum
- name: Verify Go version
run: |
- go version | grep -q 'go1.26.4'
+ go version | grep -q 'go1.26.5'
- name: Unit tests
working-directory: backend
run: make test-unit
@@ -60,7 +60,7 @@ jobs:
cache-dependency-path: backend/go.sum
- name: Verify Go version
run: |
- go version | grep -q 'go1.26.4'
+ go version | grep -q 'go1.26.5'
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f8c5dcfbfa..2ba01833c1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -115,7 +115,7 @@ jobs:
- name: Verify Go version
run: |
- go version | grep -q 'go1.26.4'
+ go version | grep -q 'go1.26.5'
# Docker setup for GoReleaser
- name: Set up QEMU
diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml
index ab3305ab6e..96a7ae4edd 100644
--- a/.github/workflows/security-scan.yml
+++ b/.github/workflows/security-scan.yml
@@ -23,7 +23,7 @@ jobs:
cache-dependency-path: backend/go.sum
- name: Verify Go version
run: |
- go version | grep -q 'go1.26.4'
+ go version | grep -q 'go1.26.5'
- name: Run govulncheck
working-directory: backend
run: |
diff --git a/Dockerfile b/Dockerfile
index bae531ac6e..17b631d5a0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,3 +1,4 @@
+# syntax=docker/dockerfile:1.7
# =============================================================================
# Sub2API Multi-Stage Dockerfile
# =============================================================================
@@ -7,16 +8,18 @@
# =============================================================================
ARG NODE_IMAGE=node:24-alpine
-ARG GOLANG_IMAGE=golang:1.26.4-alpine
+ARG GOLANG_IMAGE=golang:1.26.5-alpine
ARG ALPINE_IMAGE=alpine:3.21
ARG POSTGRES_IMAGE=postgres:18-alpine
ARG GOPROXY=https://goproxy.cn,direct
ARG GOSUMDB=sum.golang.google.cn
+ARG NPM_CONFIG_REGISTRY=
# -----------------------------------------------------------------------------
# Stage 1: Frontend Builder
# -----------------------------------------------------------------------------
FROM ${NODE_IMAGE} AS frontend-builder
+ARG NPM_CONFIG_REGISTRY
WORKDIR /app/frontend
@@ -25,7 +28,9 @@ RUN corepack enable && corepack prepare pnpm@9 --activate
# Install dependencies first (better caching)
COPY frontend/package.json frontend/pnpm-lock.yaml ./
-RUN pnpm install --frozen-lockfile
+RUN --mount=type=cache,id=sub2api-pnpm-store,target=/root/.local/share/pnpm/store \
+ if [ -n "${NPM_CONFIG_REGISTRY}" ]; then pnpm config set registry "${NPM_CONFIG_REGISTRY}"; fi && \
+ pnpm install --frozen-lockfile --prefer-offline
# Copy frontend source and build.
# LegalDocumentView.vue (admin-compliance gate) build-time imports
diff --git a/README.md b/README.md
index eb24b0d3d6..661cd8e7eb 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,11 @@ Please read the following carefully before using this project:
+
+ |
+Thanks to CCTK.AI for sponsoring this project! CCTK.AI is an AI API gateway focused on stability and cost-effectiveness, offering fast relay services for Claude, OpenAI, Gemini, and other popular models. It works seamlessly with Claude Code, Codex, and other mainstream coding tools, delivering the same model capabilities at a fraction of the official cost. Register via this link for faster, more stable, and more affordable AI API access. |
+
+
 |
One API, every top model! OpenModel is a production-grade, high-availability AI API gateway that makes your applications truly fast and stable: automatic failover, smart routing to the best-performing channel, and a production-grade SLA. An SLA that far surpasses any single provider — making stability your core competitive advantage. Works directly with Claude Code, Codex, and Gemini CLI. Register via this link to get started. |
@@ -41,6 +46,11 @@ Please read the following carefully before using this project:
Thanks to ETok.ai for sponsoring this project! ETok.ai is dedicated to building a one-stop AI programming tool service platform. We offer professional Claude Code packages and technical community services, with support for Google Gemini and OpenAI Codex. Through carefully designed plans and a professional tech community, we provide developers with reliable service guarantees and continuous technical support, making AI-assisted programming a true productivity tool. Click here to register! |
+
+ |
+Thanks to APIKEY.FUN for sponsoring this project! APIKEY.FUN is one of the core contributors to the sub2api open-source project, dedicated to providing open, stable, and cost-effective AI API access. The platform supports API relay services for Claude, OpenAI, Gemini, and other popular models, with pricing starting from as low as 7% of the original rate. Register via the exclusive link: APIKEY to enjoy a permanent 5% discount on all recharges. |
+
+
 |
Thanks to AIGoCode for sponsoring this project! AIGoCode is an all-in-one platform that integrates Claude Code, Codex, and the latest Gemini models, providing you with stable, efficient, and highly cost-effective AI coding services. The platform offers flexible subscription plans, zero risk of account suspension, direct access with no VPN required, and lightning-fast responses. AIGoCode has prepared a special benefit for sub2api users: if you register via this link, you'll receive an extra 10% bonus credit on your first top-up! |
@@ -145,6 +155,14 @@ Model authenticity: no content intervention or secondary filtering — experienc
+
+ |
+🎉 Thanks to FastAIToken for sponsoring this project! FastAIToken is an AI API aggregation platform for developers, supporting mainstream large models such as OpenAI, Claude, and Gemini. Top-up at 1:1 — 1 CNY = 1 USD of API credit — letting developers use the world's leading large model services at lower cost and with greater convenience.
+
+🚀 The platform offers a variety of channels to choose from: an ultra-low-price 0.02x OpenAI promotional group (limited time), groups as low as 0.25x OpenAI, 0.7x Claude with 95% fixed cache, and a 1.2x Claude Max channel. It also provides a public status page showing real-time availability, latency, and operating status of each group for transparent and reliable service, plus 7×24 human technical support (not bots) with fast responses to developer needs.
+ |
+
+
## Overview
diff --git a/README_CN.md b/README_CN.md
index a93056282b..88c8ce11b1 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -32,6 +32,11 @@
+
+ |
+感谢 CCTK.AI 赞助了本项目!CCTK.AI 是一个专注于稳定与性价比的 AI API 网关平台,提供 Claude、OpenAI、Gemini 等主流模型的高速中转服务,无缝兼容 Claude Code、Codex 等主流编程工具,以远低于官方的成本获得同等的模型能力。点击此链接注册,即刻体验更快、更稳、更省的 AI API 接入。 |
+
+
 |
一个API,顶级模型随便用!OpenModel 专注于生产级、高可用的 AI API 网关,让你的应用真正做到高速稳定:自动故障转移、智能选最优渠道、生产级 SLA 保障。远超单一供应商的 SLA,让稳定性成为您的核心竞争力。 |
@@ -42,6 +47,11 @@
感谢 ETok.ai 赞助了本项目!ETok.ai 致力于打造一站式 AI 编程工具服务平台。我们提供 Claude Code 专业套餐及技术社群服务,同时支持 Google Gemini 和 OpenAI Codex。通过精心设计的套餐方案和专业的技术社群,为开发者提供稳定的服务保障和持续的技术支持,让 AI 辅助编程真正成为开发者的生产力工具。点击这里注册! |
+
+ |
+感谢 APIKEY.FUN 赞助了本项目!APIKEY.FUN 是 sub2api 开源项目的核心贡献者之一,致力于提供开放、稳定、高性价比的 AI API 接入服务。平台支持 Claude、OpenAI、Gemini 等热门模型的 API 中转服务,价格低至官方原价的 7%。通过专属链接 APIKEY 注册,可享受所有充值永久 95 折优惠。 |
+
+
 |
感谢 AIGoCode 赞助了本项目!AIGoCode 是一站式集成 Claude Code、Codex 以及最新 Gemini 模型的综合平台,为您提供稳定、高效、高性价比的 AI 编程服务。平台提供灵活的订阅方案,零封号风险,免 VPN 直连,响应极速。AIGoCode 为 sub2api 用户准备了专属福利:通过此链接注册,首次充值可额外获得 10% 赠送额度! |
@@ -148,6 +158,14 @@
+
+ |
+🎉 感谢 FastAIToken 对本项目的赞助! FastAIToken 是面向开发者的 AI API 聚合平台,支持 OpenAI、Claude、Gemini 等主流大模型,充值 1:1,1 元 = 1 美元 API 额度,让开发者以更低成本、更便捷地使用全球领先的大模型服务。
+
+🚀 平台提供多种渠道自由选择:超级低价的0.02x OpenAI 福利分组(限时)、低至 0.25x OpenAI 分组、0.7x Claude 95%固定缓存、1.2x Claude Max 渠道;同时提供公开状态页,实时展示各分组的可用率、延迟及运行状态,服务透明可靠,并提供 7×24 小时真人技术支持(非机器人),快速响应开发者需求。
+ |
+
+
diff --git a/README_JA.md b/README_JA.md
index bd154a9a6b..21d070e397 100644
--- a/README_JA.md
+++ b/README_JA.md
@@ -31,6 +31,11 @@
+
+ |
+CCTK.AI のご支援に感謝します!CCTK.AI は安定性とコストパフォーマンスにこだわった AI API ゲートウェイで、Claude、OpenAI、Gemini など主要モデルの高速中継サービスを提供しています。Claude Code や Codex などの主要なコーディングツールにシームレスに対応し、公式価格を大きく下回るコストで同等のモデル能力を利用できます。こちらのリンクから登録して、より速く、より安定した、よりお得な AI API 接続をお試しください。 |
+
+
 |
1つの API で、トップモデルを使い放題!OpenModel は本番環境グレードで高可用性の AI API ゲートウェイに特化し、アプリを真に高速・安定させます:自動フェイルオーバー、最適なチャネルへのスマートルーティング、本番グレードの SLA 保証。単一プロバイダーをはるかに上回る SLA で、安定性をあなたの核心的な競争力にします。 |
@@ -41,6 +46,11 @@
ETok.ai のご支援に感謝します!ETok.ai はワンストップ AI プログラミングツールサービスプラットフォームの構築に取り組んでいます。Claude Code の専用プランと技術コミュニティサービスを提供し、Google Gemini や OpenAI Codex もサポートしています。丁寧に設計されたプランと専門的な技術コミュニティを通じて、開発者に安定したサービス保証と継続的な技術サポートを提供し、AI アシスト プログラミングを真の生産性向上ツールにします。こちらから登録! |
+
+ |
+APIKEY.FUN のご支援に感謝します!APIKEY.FUN は sub2api オープンソースプロジェクトのコアコントリビューターの一つであり、オープンで安定した、コストパフォーマンスに優れた AI API アクセスサービスの提供に取り組んでいます。プラットフォームは Claude、OpenAI、Gemini など人気モデルの API 中継サービスをサポートし、価格は公式料金のわずか 7% から。専用リンク APIKEY から登録すると、すべてのチャージで永久 5% 割引をご利用いただけます。 |
+
+
 |
AIGoCode のご支援に感謝します!AIGoCode は Claude Code、Codex、最新の Gemini モデルを統合したオールインワンプラットフォームで、安定的かつ効率的でコストパフォーマンスに優れた AI コーディングサービスを提供します。柔軟なサブスクリプションプラン、アカウント停止リスクゼロ、VPN 不要の直接アクセス、超高速レスポンスが特長です。AIGoCode は sub2api ユーザー向けに特別特典を用意しています:こちらのリンクから登録すると、初回チャージ時に 10% のボーナスクレジットを追加プレゼント! |
@@ -143,6 +153,14 @@
+
+ |
+🎉 FastAIToken のご支援に感謝します!FastAIToken は開発者向けの AI API アグリゲーションプラットフォームで、OpenAI、Claude、Gemini などの主要な大規模モデルに対応しています。チャージは 1:1(1 元 = 1 米ドル分の API クレジット)で、開発者がより低コスト・より手軽に世界トップクラスの大規模モデルサービスを利用できます。
+
+🚀 プラットフォームでは多彩なチャネルを自由に選択できます:超低価格の 0.02x OpenAI 特典グループ(期間限定)、最低 0.25x の OpenAI グループ、0.7x Claude(95% 固定キャッシュ)、1.2x Claude Max チャネル。さらに、各グループの可用率・レイテンシ・稼働状況をリアルタイムで表示する公開ステータスページを提供し、透明で信頼できるサービスを実現。7×24 時間の有人テクニカルサポート(ボットではありません)により、開発者のニーズに迅速に対応します。
+ |
+
+
## 概要
diff --git a/REDIS_SCAN_ARCHITECTURE_OPTIMIZATION.md b/REDIS_SCAN_ARCHITECTURE_OPTIMIZATION.md
deleted file mode 100644
index 7d95419a39..0000000000
--- a/REDIS_SCAN_ARCHITECTURE_OPTIMIZATION.md
+++ /dev/null
@@ -1,568 +0,0 @@
-# Redis SCAN 架构优化执行文档
-
-本文是架构级执行文档,只覆盖三个目标:
-
-1. 账号并发活跃负载查询不再通过 Redis keyspace `SCAN` 发现账号。
-2. 账号/用户并发槽过期清理、启动遗留槽清理不再通过 Redis keyspace `SCAN` 发现 key。
-3. 用户消息队列孤儿锁清理不再通过 Redis keyspace `SCAN` 发现 lock key。
-
-不覆盖旁路录制、OpenAI failover、日志量、业务限流配置调参。不要把本文扩展成短期止血方案。
-
-## 成功标准
-
-实现完成后必须同时满足:
-
-- `backend/internal/repository/concurrency_cache.go` 中不得再调用 `c.rdb.Scan(...)`。
-- `backend/internal/repository/user_msg_queue_cache.go` 中不得再调用 `c.rdb.Scan(...)`。
-- `backend/internal/service/user_msg_queue_service.go` 中不得再出现 `ScanLockKeys` 接口调用。
-- `GetActiveAccountLoadMap` 只读显式维护的 Redis 索引,不扫描 Redis keyspace。
-- `CleanupExpiredAccountSlotKeys` 只处理显式索引中的候选账号,不扫描 Redis keyspace。
-- `CleanupStaleProcessSlots` 不扫描 Redis keyspace;它必须基于显式索引清理,或只依赖 TTL/score 自然过期。
-- UMQ cleanup worker 只读 `umq:lock:index` 候选项,不扫描 `umq:{*}:lock`。
-- 主业务并发限制仍以原账号/用户 slot key 为准,不能以索引为准。索引只能用于发现候选对象、监控和清理。
-
-执行完必须用下面命令确认生产代码没有遗留扫描:
-
-```powershell
-rg -n "\.Scan\(" backend/internal/repository/concurrency_cache.go backend/internal/repository/user_msg_queue_cache.go backend/internal/service/user_msg_queue_service.go
-rg -n "ScanLockKeys|scanAccountIDsByPrefix|cleanupSlotsByPattern|deleteKeysByPattern|umqScanPattern" backend/internal/repository/concurrency_cache.go backend/internal/repository/user_msg_queue_cache.go backend/internal/service/user_msg_queue_service.go
-```
-
-第一条必须无输出。第二条必须无生产函数残留;测试文件不在此检查范围。
-
-## 不可违反的约束
-
-- 不要用 `KEYS` 替代 `SCAN`。
-- 不要把全量 Redis keyspace 扫描移动到另一个函数、goroutine、启动流程或管理接口里。
-- 不要在请求路径、后台 worker、启动流程中做 Redis keyspace pattern enumeration。
-- 不要在 Redis Lua 脚本里同时操作“全局索引 key”和“账号/用户局部 key”。项目代码当前有 Redis Cluster 兼容要求,这种写法会在 Cluster 下触发 CROSSSLOT。
-- 索引更新失败不得改变主业务 acquire/release 的成功结果。索引是 best-effort discovery structure,不是并发正确性的来源。
-- 不能因为索引缺失而拒绝用户请求。索引缺失最多影响 Ops 实时视图和后台提前清理;原 slot/wait key 的 TTL 必须保证最终自愈。
-
-## 新增 Redis Key
-
-### 并发索引
-
-在 `backend/internal/repository/concurrency_cache.go` 增加常量:
-
-```go
-const (
- accountActiveIndexKey = "concurrency:account:active_index" // ZSET member=accountID, score=expireAtUnixSeconds
- userActiveIndexKey = "concurrency:user:active_index" // ZSET member=userID, score=expireAtUnixSeconds
-
- activeIndexCleanupBatchSize = 1000
- activeIndexPipelineChunkSize = 500
-)
-```
-
-语义:
-
-- `accountActiveIndexKey` 记录“可能有账号槽位或账号等待计数”的账号 ID。
-- `userActiveIndexKey` 记录“可能有用户槽位或用户等待计数”的用户 ID。
-- ZSET score 是候选对象的保守过期时间,单位为 Unix 秒。
-- member 必须是十进制 ID 字符串,不要存完整 Redis key。
-- 索引允许短暂 stale;读索引后必须二次查询真实 slot/wait key。
-
-score 规则:
-
-- 成功获取账号槽位:score = Redis 当前秒 + `slotTTLSeconds`。
-- 成功增加账号等待计数:score = Redis 当前秒 + `waitQueueTTLSeconds`。
-- 成功获取用户槽位:score = Redis 当前秒 + `slotTTLSeconds`。
-- 成功增加用户等待计数:score = Redis 当前秒 + `waitQueueTTLSeconds`。
-- release/decrement 后如果真实 slot count 和 wait count 都为 0,则从索引 `ZREM`。
-- release/decrement 后如果仍有 slot 或 wait,则重新 `ZADD` 一个新的保守过期时间。
-
-### UMQ 锁索引
-
-在 `backend/internal/repository/user_msg_queue_cache.go` 增加常量:
-
-```go
-const (
- umqLockIndexKey = "umq:lock:index" // ZSET member=accountID, score=lockExpireAtUnixMs
- umqLockIndexCleanupBatchSize = 1000
-)
-```
-
-语义:
-
-- `umqLockIndexKey` 记录“可能存在 UMQ lock”的账号 ID。
-- ZSET score 是 lock 的预计过期时间,单位为 Unix 毫秒。
-- member 必须是十进制 accountID 字符串。
-- 索引只用于 cleanup worker 找候选 lock。锁是否存在、是否孤儿,必须再查 `umq:{accountID}:lock`。
-
-## 第一部分:并发活跃索引
-
-修改文件:`backend/internal/repository/concurrency_cache.go`。
-
-### 1.1 增加 Redis 时间 helper
-
-新增 helper,所有索引 score 使用 Redis server time,不用本机时间:
-
-```go
-func (c *concurrencyCache) redisUnixSeconds(ctx context.Context) (int64, error) {
- now, err := c.rdb.Time(ctx).Result()
- if err != nil {
- return 0, fmt.Errorf("redis TIME: %w", err)
- }
- return now.Unix(), nil
-}
-```
-
-不要在 Lua 脚本里写全局索引,避免 CROSSSLOT。
-
-### 1.2 增加索引 touch/remove/refresh helper
-
-新增以下 helper。名字可以微调,但行为不能改。
-
-```go
-func (c *concurrencyCache) touchAccountActiveIndex(ctx context.Context, accountID int64, ttlSeconds int) {
- c.touchActiveIndex(ctx, accountActiveIndexKey, accountID, ttlSeconds)
-}
-
-func (c *concurrencyCache) touchUserActiveIndex(ctx context.Context, userID int64, ttlSeconds int) {
- c.touchActiveIndex(ctx, userActiveIndexKey, userID, ttlSeconds)
-}
-
-func (c *concurrencyCache) touchActiveIndex(ctx context.Context, indexKey string, id int64, ttlSeconds int) {
- if c == nil || c.rdb == nil || id <= 0 || ttlSeconds <= 0 {
- return
- }
- now, err := c.redisUnixSeconds(ctx)
- if err != nil {
- return
- }
- _ = c.rdb.ZAdd(ctx, indexKey, redis.Z{
- Score: float64(now + int64(ttlSeconds)),
- Member: strconv.FormatInt(id, 10),
- }).Err()
-}
-```
-
-索引维护是 best-effort,所以 helper 内部吞掉错误。不要把索引错误返回给 acquire/release 调用方。
-
-再新增 refresh helper:
-
-```go
-func (c *concurrencyCache) refreshAccountActiveIndex(ctx context.Context, accountID int64) {
- // 真实状态以 accountSlotKey(accountID) 和 accountWaitKey(accountID) 为准。
- // 先清理该账号 slot 中过期成员,再读 ZCARD 和 GET wait。
- // 如果 slotCount == 0 && waitCount <= 0:ZREM accountActiveIndexKey accountID。
- // 否则:ZADD accountActiveIndexKey accountID,score = now + maxRelevantTTL。
-}
-
-func (c *concurrencyCache) refreshUserActiveIndex(ctx context.Context, userID int64) {
- // 真实状态以 userSlotKey(userID) 和 waitQueueKey(userID) 为准。
- // 行为同 refreshAccountActiveIndex。
-}
-```
-
-实现要求:
-
-- `refresh*` 必须 best-effort,不能向 release/decrement 返回索引错误。
-- `waitCount` 读取 `redis.Nil` 时按 0 处理。
-- `waitCount < 0` 必须按 0 处理。
-- `slotCount > 0` 时 score 至少延长 `slotTTLSeconds`。
-- `waitCount > 0` 时 score 至少延长 `waitQueueTTLSeconds`。
-- 两者都存在时使用更大的 TTL。
-
-### 1.3 修改账号写路径
-
-修改 `AcquireAccountSlot`:
-
-```go
-result, err := acquireScript.Run(...).Int()
-if err != nil { return false, err }
-if result == 1 {
- c.touchAccountActiveIndex(ctx, accountID, c.slotTTLSeconds)
-}
-return result == 1, nil
-```
-
-修改 `ReleaseAccountSlot`:
-
-```go
-if err := c.rdb.ZRem(ctx, key, requestID).Err(); err != nil {
- return err
-}
-c.refreshAccountActiveIndex(ctx, accountID)
-return nil
-```
-
-修改 `IncrementAccountWaitCount`:
-
-```go
-result, err := incrementAccountWaitScript.Run(...).Int()
-if err != nil { return false, err }
-if result == 1 {
- c.touchAccountActiveIndex(ctx, accountID, c.waitQueueTTLSeconds)
-}
-return result == 1, nil
-```
-
-修改 `DecrementAccountWaitCount`:
-
-```go
-_, err := decrementWaitScript.Run(...).Result()
-if err == nil {
- c.refreshAccountActiveIndex(ctx, accountID)
-}
-return err
-```
-
-### 1.4 修改用户写路径
-
-同账号路径,修改:
-
-- `AcquireUserSlot`
-- `ReleaseUserSlot`
-- `IncrementWaitCount`
-- `DecrementWaitCount`
-
-用户索引使用 `userActiveIndexKey`。
-
-### 1.5 重写 GetActiveAccountLoadMap
-
-删除 `scanAccountIDsByPrefix` 和 `parseAccountIDFromPrefixedKey` 的生产调用。`GetActiveAccountLoadMap` 必须改成:
-
-1. 获取 Redis 当前秒。
-2. `ZRemRangeByScore(accountActiveIndexKey, "-inf", strconv.FormatInt(now, 10))` 删除过期候选。
-3. `ZRangeByScore(accountActiveIndexKey, &redis.ZRangeBy{Min: strconv.FormatInt(now+1, 10), Max: "+inf"})` 获取候选账号 ID。
-4. 解析 member 为 `int64`,非法 member 记录到待删除列表。
-5. 分块 pipeline,块大小 `activeIndexPipelineChunkSize`。
-6. 对每个候选账号执行:
- - `ZRemRangeByScore(accountSlotKey(id), "-inf", cutoffUnixSeconds)`
- - `ZCard(accountSlotKey(id))`
- - `Get(accountWaitKey(id))`
-7. 构造结果时只返回 `currentConcurrency > 0 || waitingCount > 0` 的账号。
-8. 对真实状态为空或 member 非法的账号执行 `ZREM accountActiveIndexKey member`。
-9. 对真实状态仍活跃但 index score 已接近过期的账号,调用 `touchAccountActiveIndex` 刷新。
-
-禁止:
-
-- 禁止再扫 `concurrency:account:*`。
-- 禁止再扫 `wait:account:*`。
-- 禁止用索引里的 score 直接判断并发数。
-
-## 第二部分:并发槽清理和启动清理
-
-修改文件:`backend/internal/repository/concurrency_cache.go`。
-
-### 2.1 重写 CleanupExpiredAccountSlotKeys
-
-当前实现调用 `cleanupExpiredSlotKeysByPattern(ctx, accountSlotKeyPrefix+"*")`,必须删除。
-
-新行为:
-
-1. 获取 Redis 当前秒 `now`。
-2. 从 `accountActiveIndexKey` 读取过期候选:
-
-```go
-ids, err := c.rdb.ZRangeByScore(ctx, accountActiveIndexKey, &redis.ZRangeBy{
- Min: "-inf",
- Max: strconv.FormatInt(now, 10),
- Count: activeIndexCleanupBatchSize,
-}).Result()
-```
-
-3. 对每个候选账号清理该账号 slot 过期成员并读真实状态。
-4. 如果真实 `slotCount == 0 && waitCount <= 0`,从 `accountActiveIndexKey` 删除该账号。
-5. 如果真实仍活跃,刷新 `accountActiveIndexKey` score。
-6. 不需要处理不在索引中的账号;其 slot key 自身有 `EXPIRE`,并且 acquire/get-load 会惰性清理过期成员。
-
-这个函数不再表示“遍历所有账号槽位 key”,而是“处理索引中到期的账号候选”。保留原函数名是为了少改接口。
-
-### 2.2 重写 CleanupStaleProcessSlots
-
-当前实现会扫描:
-
-- `concurrency:account:*`
-- `concurrency:user:*`
-- `wait:account:*`
-- `concurrency:wait:*`
-
-必须去掉这些扫描。
-
-新行为必须基于索引:
-
-1. 从 `accountActiveIndexKey` 读取所有未过期候选账号。
-2. 对每个账号:
- - 对 `accountSlotKey(id)` 运行“单 key 清理脚本”,删除 requestID 前缀不是当前 `activeRequestPrefix` 的成员。
- - 删除 `accountWaitKey(id)`,因为等待者属于旧进程,重启后不能继续等待。
- - 调用 `refreshAccountActiveIndex(ctx, id)`。
-3. 从 `userActiveIndexKey` 读取所有未过期候选用户。
-4. 对每个用户:
- - 对 `userSlotKey(id)` 运行同一个“单 key 清理脚本”。
- - 删除 `waitQueueKey(id)`。
- - 调用 `refreshUserActiveIndex(ctx, id)`。
-
-新增单 key Lua 脚本,替代当前 `startupCleanupScript` 的多 key 版本:
-
-```lua
-local key = KEYS[1]
-local activePrefix = ARGV[1]
-local slotTTL = tonumber(ARGV[2])
-local removed = 0
-local members = redis.call('ZRANGE', key, 0, -1)
-for _, member in ipairs(members) do
- if string.sub(member, 1, string.len(activePrefix)) ~= activePrefix then
- removed = removed + redis.call('ZREM', key, member)
- end
-end
-if redis.call('ZCARD', key) == 0 then
- redis.call('DEL', key)
-else
- redis.call('EXPIRE', key, slotTTL)
-end
-return removed
-```
-
-该脚本只接受一个 slot key,避免 Redis Cluster CROSSSLOT。
-
-如果索引不存在或为空:
-
-- `CleanupStaleProcessSlots` 直接返回 nil。
-- 不要 fallback 到 `SCAN`。
-- 旧版本遗留 key 依赖 Redis TTL 自然过期。不要在 app 启动时做兼容性 keyspace backfill。
-
-### 2.3 删除旧扫描函数
-
-删除以下生产函数:
-
-- `scanAccountIDsByPrefix`
-- `parseAccountIDFromPrefixedKey`,如果没有其他生产调用
-- `cleanupExpiredSlotKeysByPattern`
-- `cleanupSlotsByPattern`
-- `deleteKeysByPattern`
-
-如果测试需要解析 key,测试内自建 helper,不要保留生产 helper。
-
-## 第三部分:UMQ 锁索引
-
-修改文件:
-
-- `backend/internal/repository/user_msg_queue_cache.go`
-- `backend/internal/service/user_msg_queue_service.go`
-
-### 3.1 修改 service 接口
-
-在 `backend/internal/service/user_msg_queue_service.go` 的 `UserMsgQueueCache` 接口中删除:
-
-```go
-ScanLockKeys(ctx context.Context, maxCount int) ([]int64, error)
-ForceReleaseLock(ctx context.Context, accountID int64) error
-```
-
-替换为:
-
-```go
-ReconcileExpiredLockCandidates(ctx context.Context, maxCount int) (cleaned int, err error)
-```
-
-原因:cleanup worker 不应该知道 Redis lock key 的枚举方式,也不应该先枚举再逐个 `ForceReleaseLock`。候选读取、PTTL 校验、索引刷新应该封装在 cache 层。
-
-### 3.2 修改 acquireLockScript 返回值
-
-当前脚本只返回 0/1。改成返回数组:
-
-```lua
-redis.replicate_commands()
-local cur = redis.call('GET', KEYS[1])
-local ttl = tonumber(ARGV[2])
-if cur == ARGV[1] then
- redis.call('PEXPIRE', KEYS[1], ttl)
- local t = redis.call('TIME')
- local ms = tonumber(t[1])*1000 + math.floor(tonumber(t[2])/1000)
- return {1, ms + ttl}
-end
-if cur ~= false then
- return {0, 0}
-end
-redis.call('SET', KEYS[1], ARGV[1], 'PX', ttl)
-local t = redis.call('TIME')
-local ms = tonumber(t[1])*1000 + math.floor(tonumber(t[2])/1000)
-return {1, ms + ttl}
-```
-
-Go 侧解析:
-
-- 第一个元素是 acquired,1 表示拿到锁。
-- 第二个元素是 Redis 时间计算出的 `expireAtUnixMs`。
-- acquired 为 1 时,best-effort 写 `ZADD umqLockIndexKey expireAtMs accountID`。
-- `ZADD` 失败不能让 `AcquireLock` 返回失败。
-
-### 3.3 修改 ReleaseLock
-
-`ReleaseLock` 主逻辑保持原子释放锁和写 last key。
-
-释放成功时:
-
-```go
-if result == 1 {
- _ = c.rdb.ZRem(ctx, umqLockIndexKey, strconv.FormatInt(accountID, 10)).Err()
-}
-```
-
-释放失败时不要删除索引。失败可能是 requestID 不匹配或 lock 已过期;cleanup worker 会处理 stale index。
-
-### 3.4 新增 reconcile 脚本
-
-删除 `forceReleaseLockScript` 的外部使用。新增脚本:
-
-```lua
-local pttl = redis.call('PTTL', KEYS[1])
-if pttl == -2 then
- return {-2, 0}
-end
-if pttl == -1 then
- redis.call('DEL', KEYS[1])
- return {-1, 0}
-end
-return {1, pttl}
-```
-
-返回语义:
-
-- `-2`:lock key 不存在。Go 侧 `ZREM umqLockIndexKey accountID`。
-- `-1`:lock key 存在但无 TTL,脚本已删除。Go 侧 `ZREM umqLockIndexKey accountID`,cleaned++。
-- `1`:lock key 仍有 TTL。Go 侧用 Redis 当前毫秒 + pttl 刷新 `umqLockIndexKey` score。
-
-### 3.5 实现 ReconcileExpiredLockCandidates
-
-实现步骤:
-
-1. 用 `c.rdb.Time(ctx)` 获取 Redis 当前毫秒 `nowMs`。
-2. 从 `umqLockIndexKey` 取到期候选:
-
-```go
-members, err := c.rdb.ZRangeByScore(ctx, umqLockIndexKey, &redis.ZRangeBy{
- Min: "-inf",
- Max: strconv.FormatInt(nowMs, 10),
- Count: int64(maxCount),
-}).Result()
-```
-
-3. 逐个解析 accountID。非法 member 直接 `ZREM`。
-4. 对合法 accountID 运行 reconcile 脚本,key 为 `umqLockKey(accountID)`。
-5. 根据返回值删除索引、刷新索引或累计 cleaned。
-6. 函数返回 cleaned 数。
-
-禁止:
-
-- 禁止 fallback 到 `SCAN umq:{*}:lock`。
-- 禁止用 `KEYS umq:*`。
-- 禁止 cleanup worker 自己解析 lock key。
-
-### 3.6 修改 StartCleanupWorker
-
-当前 worker 先 `ScanLockKeys` 再逐个 `ForceReleaseLock`。改成:
-
-```go
-cleaned, err := s.cache.ReconcileExpiredLockCandidates(ctx, 1000)
-if err != nil {
- logger.LegacyPrintf("service.umq", "Cleanup reconcile failed: %v", err)
- return
-}
-if cleaned > 0 {
- logger.LegacyPrintf("service.umq", "Cleanup completed: released %d orphaned locks", cleaned)
-}
-```
-
-worker 不再知道扫描、PTTL、索引等细节。
-
-### 3.7 删除旧 UMQ 扫描函数
-
-删除:
-
-- `umqScanPattern`
-- `ScanLockKeys`
-- `ForceReleaseLock`,如果无生产调用
-
-如果测试仍需要强造 PTTL == -1 的 key,只在测试里直接写 Redis。
-
-## 测试要求
-
-### 并发缓存测试
-
-新增或修改 `backend/internal/repository/concurrency_cache_*_test.go`。
-
-必须覆盖:
-
-1. `AcquireAccountSlot` 成功后 `GetActiveAccountLoadMap` 能看到该账号。
-2. `ReleaseAccountSlot` 后 `GetActiveAccountLoadMap` 不再返回该账号。
-3. `IncrementAccountWaitCount` 成功后 `GetActiveAccountLoadMap` 能看到 waiting count。
-4. `DecrementAccountWaitCount` 后如果无 slot,则索引被移除。
-5. `CleanupExpiredAccountSlotKeys` 不依赖 keyspace scan:测试里只创建索引成员和对应 slot key,然后确认会清理;再创建未索引 slot key,确认不会被该函数主动发现。
-6. `CleanupStaleProcessSlots` 只处理索引中的 account/user,删除旧 request prefix 成员,保留当前 prefix 成员,删除 account/user wait key。
-7. 索引中存在非法 member 时,`GetActiveAccountLoadMap` 不报错,并移除非法 member。
-
-### UMQ 测试
-
-新增或修改 `backend/internal/repository/user_msg_queue_cache*_test.go` 和 `backend/internal/service/user_msg_queue_service*_test.go`。
-
-必须覆盖:
-
-1. `AcquireLock` 成功后写入 `umq:lock:index`,score 大于 Redis 当前毫秒。
-2. `ReleaseLock` 成功后删除 `umq:lock:index` member。
-3. lock 已自然过期时,`ReconcileExpiredLockCandidates` 删除 stale index member。
-4. lock 仍有 TTL 但 index score 到期时,`ReconcileExpiredLockCandidates` 刷新 index score,不删除 lock。
-5. lock 存在且 `PTTL == -1` 时,`ReconcileExpiredLockCandidates` 删除 lock,删除 index member,并返回 cleaned=1。
-6. index 中非法 member 不导致错误,并被删除。
-7. `StartCleanupWorker` 调用 `ReconcileExpiredLockCandidates`,不再调用 `ScanLockKeys` 或 `ForceReleaseLock`。
-
-### 禁止项测试
-
-实现完成后运行:
-
-```powershell
-rg -n "\.Scan\(" backend/internal/repository/concurrency_cache.go backend/internal/repository/user_msg_queue_cache.go backend/internal/service/user_msg_queue_service.go
-rg -n "ScanLockKeys|umqScanPattern|scanAccountIDsByPrefix|cleanupExpiredSlotKeysByPattern|cleanupSlotsByPattern|deleteKeysByPattern" backend/internal/repository/concurrency_cache.go backend/internal/repository/user_msg_queue_cache.go backend/internal/service/user_msg_queue_service.go
-```
-
-上述命令必须无输出。
-
-再运行相关测试。按项目约定,编译很慢时先把代码复制到 WSL 文件系统再跑:
-
-```bash
-cd backend
-go test ./internal/repository ./internal/service
-```
-
-如果全量包太慢,至少先跑:
-
-```bash
-cd backend
-go test ./internal/repository -run 'Concurrency|UserMsgQueue|Redis'
-go test ./internal/service -run 'Concurrency|UserMessageQueue'
-```
-
-## 迁移和兼容
-
-不要在应用启动时扫描旧 key 回填索引。
-
-原因:
-
-- 这会把问题从运行期 `SCAN` 搬到启动期 `SCAN`。
-- 生产实例重启时 Redis 已经高 CPU,启动扫描会放大抖动。
-- 并发 slot key 和 wait key 都有 TTL,新版本写路径会为新流量维护索引,旧 key 可自然过期。
-
-兼容策略:
-
-- 新版本上线后,新请求会逐步填充 `concurrency:*:active_index` 和 `umq:lock:index`。
-- 旧并发 slot key 没有索引时,不影响并发限制本身;对应账号下一次 acquire/get-load 会清理自己的 slot。
-- 旧 UMQ lock 如果有 TTL,会自然过期。
-- 极少数历史 `PTTL == -1` UMQ lock 且没有 index 的情况,不由应用自动发现。需要人工离线维护时,单独写一次性脚本,维护窗口运行,不要放进服务启动或后台 worker。
-
-## 代码审查检查表
-
-提交前逐项确认:
-
-- [ ] 没有新增 `KEYS`。
-- [ ] 没有新增生产路径 `SCAN`。
-- [ ] 没有在 Lua 脚本中同时操作全局索引 key 和账号/用户局部 key。
-- [ ] 索引维护失败不会让 acquire/release/decrement 的主结果失败。
-- [ ] `GetActiveAccountLoadMap` 对 stale index、非法 member、Redis nil 都能正常返回。
-- [ ] `CleanupExpiredAccountSlotKeys` 不再遍历 keyspace。
-- [ ] `CleanupStaleProcessSlots` 不再遍历 keyspace。
-- [ ] UMQ cleanup worker 不再知道 lock key pattern。
-- [ ] 所有旧扫描 helper 已删除或仅存在于测试文件。
-- [ ] 新测试覆盖成功路径、stale index、非法 member、PTTL -1、自然过期。
diff --git a/assets/partners/logos/cctk.jpg b/assets/partners/logos/cctk.jpg
new file mode 100644
index 0000000000..3e50a07ae4
Binary files /dev/null and b/assets/partners/logos/cctk.jpg differ
diff --git a/assets/partners/logos/fastaitoken.jpg b/assets/partners/logos/fastaitoken.jpg
new file mode 100644
index 0000000000..afcf2acf51
Binary files /dev/null and b/assets/partners/logos/fastaitoken.jpg differ
diff --git a/backend/Dockerfile b/backend/Dockerfile
index d4adb5564b..9976abe46b 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -1,4 +1,4 @@
-FROM golang:1.26.4-alpine
+FROM golang:1.26.5-alpine
WORKDIR /app
diff --git a/backend/cmd/server/VERSION b/backend/cmd/server/VERSION
index a0e8ec1d4e..010fbfb884 100644
--- a/backend/cmd/server/VERSION
+++ b/backend/cmd/server/VERSION
@@ -1 +1 @@
-0.1.145
+0.1.149
diff --git a/backend/cmd/server/wire.go b/backend/cmd/server/wire.go
index b9a9a3e80e..496473bc88 100644
--- a/backend/cmd/server/wire.go
+++ b/backend/cmd/server/wire.go
@@ -85,6 +85,8 @@ func provideCleanup(
subscriptionExpiry *service.SubscriptionExpiryService,
usageCleanup *service.UsageCleanupService,
idempotencyCleanup *service.IdempotencyCleanupService,
+ batchImageCleanup *service.BatchImageCleanupService,
+ batchImageWorker *service.BatchImageWorkerRuntime,
pricing *service.PricingService,
emailQueue *service.EmailQueueService,
billingCache *service.BillingCacheService,
@@ -167,6 +169,18 @@ func provideCleanup(
}
return nil
}},
+ {"BatchImageCleanupService", func() error {
+ if batchImageCleanup != nil {
+ batchImageCleanup.Stop()
+ }
+ return nil
+ }},
+ {"BatchImageWorkerRuntime", func() error {
+ if batchImageWorker != nil {
+ batchImageWorker.Stop()
+ }
+ return nil
+ }},
{"TokenRefreshService", func() error {
tokenRefresh.Stop()
return nil
diff --git a/backend/cmd/server/wire_gen.go b/backend/cmd/server/wire_gen.go
index a412563a6c..e148c5c363 100644
--- a/backend/cmd/server/wire_gen.go
+++ b/backend/cmd/server/wire_gen.go
@@ -96,6 +96,9 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
usageLogRepository := repository.NewUsageLogRepository(client, db)
usageService := service.NewUsageService(usageLogRepository, userRepository, client, apiKeyAuthCacheInvalidator)
opsRepository := repository.NewOpsRepository(db)
+ batchImageRepository := repository.NewBatchImageRepository(db)
+ batchImageQueue := repository.NewBatchImageQueue(redisClient, configConfig)
+ batchImageDownloadLimiter := repository.NewBatchImageDownloadLimiter(redisClient, configConfig)
usageBillingRepository := repository.NewUsageBillingRepository(client, db)
gatewayCache := repository.NewGatewayCache(redisClient)
schedulerOutboxRepository := repository.NewSchedulerOutboxRepository(db)
@@ -134,6 +137,11 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
channelRepository := repository.NewChannelRepository(db)
channelService := service.NewChannelService(channelRepository, groupRepository, apiKeyAuthCacheInvalidator, pricingService)
modelPricingResolver := service.NewModelPricingResolver(channelService, billingService)
+ batchImageModelPricingResolver := service.ProvideBatchImageModelPricingResolver(modelPricingResolver)
+ batchImagePublicService := service.NewBatchImagePublicService(batchImageRepository, accountRepository, groupRepository, userGroupRateRepository, batchImageQueue, batchImageModelPricingResolver, usageBillingRepository, apiKeyAuthCacheInvalidator, configConfig)
+ batchImageDownloadService := service.NewBatchImageDownloadService(batchImageRepository, accountRepository, batchImageDownloadLimiter, configConfig)
+ batchImageCleanupService := service.ProvideBatchImageCleanupService(batchImageRepository, accountRepository, configConfig)
+ batchImageWorkerRuntime := service.ProvideBatchImageWorkerRuntime(batchImageRepository, accountRepository, batchImageQueue, usageBillingRepository, usageLogRepository, batchImageModelPricingResolver, apiKeyAuthCacheInvalidator, configConfig)
notificationEmailService := service.NewNotificationEmailService(settingRepository, emailService)
balanceNotifyService := service.ProvideBalanceNotifyService(emailService, settingRepository, accountRepository, notificationEmailService)
gatewayService := service.NewGatewayService(accountRepository, groupRepository, usageLogRepository, usageBillingRepository, userRepository, userSubscriptionRepository, userGroupRateRepository, gatewayCache, configConfig, schedulerSnapshotService, concurrencyService, billingService, rateLimitService, billingCacheService, identityService, httpUpstream, deferredService, claudeTokenProvider, sessionLimitCache, rpmCache, digestSessionStore, settingService, tlsFingerprintProfileService, channelService, modelPricingResolver, balanceNotifyService, serviceUserPlatformQuotaRepository)
@@ -259,9 +267,10 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
handlerPaymentHandler := handler.NewPaymentHandler(paymentService, paymentConfigService, channelService)
paymentWebhookHandler := handler.NewPaymentWebhookHandler(paymentService, registry)
availableChannelHandler := handler.NewAvailableChannelHandler(channelService, apiKeyService, settingService)
+ batchImageHandler := handler.NewBatchImageHandler(batchImagePublicService, batchImageDownloadService, batchImageCleanupService)
idempotencyCoordinator := service.ProvideIdempotencyCoordinator(idempotencyRepository, configConfig)
idempotencyCleanupService := service.ProvideIdempotencyCleanupService(idempotencyRepository, configConfig)
- handlers := handler.ProvideHandlers(authHandler, userHandler, apiKeyHandler, usageHandler, redeemHandler, subscriptionHandler, announcementHandler, channelMonitorUserHandler, adminHandlers, gatewayHandler, openAIGatewayHandler, handlerSettingHandler, totpHandler, handlerPaymentHandler, paymentWebhookHandler, availableChannelHandler, idempotencyCoordinator, idempotencyCleanupService)
+ handlers := handler.ProvideHandlers(authHandler, userHandler, apiKeyHandler, usageHandler, redeemHandler, subscriptionHandler, announcementHandler, channelMonitorUserHandler, adminHandlers, gatewayHandler, openAIGatewayHandler, handlerSettingHandler, totpHandler, handlerPaymentHandler, paymentWebhookHandler, availableChannelHandler, batchImageHandler, idempotencyCoordinator, idempotencyCleanupService)
jwtAuthMiddleware := middleware.NewJWTAuthMiddleware(authService, userService)
adminAuthMiddleware := middleware.NewAdminAuthMiddleware(authService, userService, settingService)
apiKeyAuthMiddleware := middleware.NewAPIKeyAuthMiddleware(apiKeyService, subscriptionService, configConfig)
@@ -280,7 +289,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
paymentOrderExpiryService := service.ProvidePaymentOrderExpiryService(paymentService, leaderLockCache, db)
channelMonitorRunner := service.ProvideChannelMonitorRunner(channelMonitorService, settingService)
userPlatformQuotaUsageFlusher := service.ProvideUserPlatformQuotaUsageFlusher(configConfig, billingCache, serviceUserPlatformQuotaRepository, timingWheelService)
- v := provideCleanup(client, redisClient, opsMetricsCollector, opsAggregationService, opsAlertEvaluatorService, opsCleanupService, opsScheduledReportService, opsSystemLogSink, schedulerSnapshotService, tokenRefreshService, accountExpiryService, proxyExpiryService, subscriptionExpiryService, usageCleanupService, idempotencyCleanupService, pricingService, emailQueueService, billingCacheService, usageRecordWorkerPool, subscriptionService, oAuthService, openAIOAuthService, geminiOAuthService, antigravityOAuthService, grokOAuthService, openAIGatewayService, scheduledTestRunnerService, backupService, paymentOrderExpiryService, channelMonitorRunner, userPlatformQuotaUsageFlusher)
+ v := provideCleanup(client, redisClient, opsMetricsCollector, opsAggregationService, opsAlertEvaluatorService, opsCleanupService, opsScheduledReportService, opsSystemLogSink, schedulerSnapshotService, tokenRefreshService, accountExpiryService, proxyExpiryService, subscriptionExpiryService, usageCleanupService, idempotencyCleanupService, batchImageCleanupService, batchImageWorkerRuntime, pricingService, emailQueueService, billingCacheService, usageRecordWorkerPool, subscriptionService, oAuthService, openAIOAuthService, geminiOAuthService, antigravityOAuthService, grokOAuthService, openAIGatewayService, scheduledTestRunnerService, backupService, paymentOrderExpiryService, channelMonitorRunner, userPlatformQuotaUsageFlusher)
application := &Application{
Server: httpServer,
Cleanup: v,
@@ -322,6 +331,8 @@ func provideCleanup(
subscriptionExpiry *service.SubscriptionExpiryService,
usageCleanup *service.UsageCleanupService,
idempotencyCleanup *service.IdempotencyCleanupService,
+ batchImageCleanup *service.BatchImageCleanupService,
+ batchImageWorker *service.BatchImageWorkerRuntime,
pricing *service.PricingService,
emailQueue *service.EmailQueueService,
billingCache *service.BillingCacheService,
@@ -403,6 +414,18 @@ func provideCleanup(
}
return nil
}},
+ {"BatchImageCleanupService", func() error {
+ if batchImageCleanup != nil {
+ batchImageCleanup.Stop()
+ }
+ return nil
+ }},
+ {"BatchImageWorkerRuntime", func() error {
+ if batchImageWorker != nil {
+ batchImageWorker.Stop()
+ }
+ return nil
+ }},
{"TokenRefreshService", func() error {
tokenRefresh.Stop()
return nil
diff --git a/backend/cmd/server/wire_gen_test.go b/backend/cmd/server/wire_gen_test.go
index ef74cb4a2d..27707bc8c6 100644
--- a/backend/cmd/server/wire_gen_test.go
+++ b/backend/cmd/server/wire_gen_test.go
@@ -65,6 +65,8 @@ func TestProvideCleanup_WithMinimalDependencies_NoPanic(t *testing.T) {
subscriptionExpirySvc,
&service.UsageCleanupService{},
idempotencyCleanupSvc,
+ &service.BatchImageCleanupService{},
+ nil, // batchImageWorker
pricingSvc,
emailQueueSvc,
billingCacheSvc,
diff --git a/backend/ent/batchimageevent.go b/backend/ent/batchimageevent.go
new file mode 100644
index 0000000000..3f95616e81
--- /dev/null
+++ b/backend/ent/batchimageevent.go
@@ -0,0 +1,158 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "encoding/json"
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+)
+
+// BatchImageEvent is the model entity for the BatchImageEvent schema.
+type BatchImageEvent struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID int64 `json:"id,omitempty"`
+ // JobID holds the value of the "job_id" field.
+ JobID string `json:"job_id,omitempty"`
+ // EventType holds the value of the "event_type" field.
+ EventType string `json:"event_type,omitempty"`
+ // Payload holds the value of the "payload" field.
+ Payload map[string]interface{} `json:"payload,omitempty"`
+ // EventHash holds the value of the "event_hash" field.
+ EventHash *string `json:"event_hash,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*BatchImageEvent) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case batchimageevent.FieldPayload:
+ values[i] = new([]byte)
+ case batchimageevent.FieldID:
+ values[i] = new(sql.NullInt64)
+ case batchimageevent.FieldJobID, batchimageevent.FieldEventType, batchimageevent.FieldEventHash:
+ values[i] = new(sql.NullString)
+ case batchimageevent.FieldCreatedAt:
+ values[i] = new(sql.NullTime)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the BatchImageEvent fields.
+func (_m *BatchImageEvent) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case batchimageevent.FieldID:
+ value, ok := values[i].(*sql.NullInt64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field id", value)
+ }
+ _m.ID = int64(value.Int64)
+ case batchimageevent.FieldJobID:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field job_id", values[i])
+ } else if value.Valid {
+ _m.JobID = value.String
+ }
+ case batchimageevent.FieldEventType:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field event_type", values[i])
+ } else if value.Valid {
+ _m.EventType = value.String
+ }
+ case batchimageevent.FieldPayload:
+ if value, ok := values[i].(*[]byte); !ok {
+ return fmt.Errorf("unexpected type %T for field payload", values[i])
+ } else if value != nil && len(*value) > 0 {
+ if err := json.Unmarshal(*value, &_m.Payload); err != nil {
+ return fmt.Errorf("unmarshal field payload: %w", err)
+ }
+ }
+ case batchimageevent.FieldEventHash:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field event_hash", values[i])
+ } else if value.Valid {
+ _m.EventHash = new(string)
+ *_m.EventHash = value.String
+ }
+ case batchimageevent.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ _m.CreatedAt = value.Time
+ }
+ default:
+ _m.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the BatchImageEvent.
+// This includes values selected through modifiers, order, etc.
+func (_m *BatchImageEvent) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this BatchImageEvent.
+// Note that you need to call BatchImageEvent.Unwrap() before calling this method if this BatchImageEvent
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (_m *BatchImageEvent) Update() *BatchImageEventUpdateOne {
+ return NewBatchImageEventClient(_m.config).UpdateOne(_m)
+}
+
+// Unwrap unwraps the BatchImageEvent entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (_m *BatchImageEvent) Unwrap() *BatchImageEvent {
+ _tx, ok := _m.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: BatchImageEvent is not a transactional entity")
+ }
+ _m.config.driver = _tx.drv
+ return _m
+}
+
+// String implements the fmt.Stringer.
+func (_m *BatchImageEvent) String() string {
+ var builder strings.Builder
+ builder.WriteString("BatchImageEvent(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
+ builder.WriteString("job_id=")
+ builder.WriteString(_m.JobID)
+ builder.WriteString(", ")
+ builder.WriteString("event_type=")
+ builder.WriteString(_m.EventType)
+ builder.WriteString(", ")
+ builder.WriteString("payload=")
+ builder.WriteString(fmt.Sprintf("%v", _m.Payload))
+ builder.WriteString(", ")
+ if v := _m.EventHash; v != nil {
+ builder.WriteString("event_hash=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// BatchImageEvents is a parsable slice of BatchImageEvent.
+type BatchImageEvents []*BatchImageEvent
diff --git a/backend/ent/batchimageevent/batchimageevent.go b/backend/ent/batchimageevent/batchimageevent.go
new file mode 100644
index 0000000000..88b3dd8eca
--- /dev/null
+++ b/backend/ent/batchimageevent/batchimageevent.go
@@ -0,0 +1,87 @@
+// Code generated by ent, DO NOT EDIT.
+
+package batchimageevent
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+)
+
+const (
+ // Label holds the string label denoting the batchimageevent type in the database.
+ Label = "batch_image_event"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldJobID holds the string denoting the job_id field in the database.
+ FieldJobID = "job_id"
+ // FieldEventType holds the string denoting the event_type field in the database.
+ FieldEventType = "event_type"
+ // FieldPayload holds the string denoting the payload field in the database.
+ FieldPayload = "payload"
+ // FieldEventHash holds the string denoting the event_hash field in the database.
+ FieldEventHash = "event_hash"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // Table holds the table name of the batchimageevent in the database.
+ Table = "batch_image_events"
+)
+
+// Columns holds all SQL columns for batchimageevent fields.
+var Columns = []string{
+ FieldID,
+ FieldJobID,
+ FieldEventType,
+ FieldPayload,
+ FieldEventHash,
+ FieldCreatedAt,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // JobIDValidator is a validator for the "job_id" field. It is called by the builders before save.
+ JobIDValidator func(string) error
+ // EventTypeValidator is a validator for the "event_type" field. It is called by the builders before save.
+ EventTypeValidator func(string) error
+ // EventHashValidator is a validator for the "event_hash" field. It is called by the builders before save.
+ EventHashValidator func(string) error
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+)
+
+// OrderOption defines the ordering options for the BatchImageEvent queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByJobID orders the results by the job_id field.
+func ByJobID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldJobID, opts...).ToFunc()
+}
+
+// ByEventType orders the results by the event_type field.
+func ByEventType(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldEventType, opts...).ToFunc()
+}
+
+// ByEventHash orders the results by the event_hash field.
+func ByEventHash(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldEventHash, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
diff --git a/backend/ent/batchimageevent/where.go b/backend/ent/batchimageevent/where.go
new file mode 100644
index 0000000000..3b5ef034f3
--- /dev/null
+++ b/backend/ent/batchimageevent/where.go
@@ -0,0 +1,345 @@
+// Code generated by ent, DO NOT EDIT.
+
+package batchimageevent
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id int64) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLTE(FieldID, id))
+}
+
+// JobID applies equality check predicate on the "job_id" field. It's identical to JobIDEQ.
+func JobID(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldJobID, v))
+}
+
+// EventType applies equality check predicate on the "event_type" field. It's identical to EventTypeEQ.
+func EventType(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldEventType, v))
+}
+
+// EventHash applies equality check predicate on the "event_hash" field. It's identical to EventHashEQ.
+func EventHash(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldEventHash, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// JobIDEQ applies the EQ predicate on the "job_id" field.
+func JobIDEQ(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldJobID, v))
+}
+
+// JobIDNEQ applies the NEQ predicate on the "job_id" field.
+func JobIDNEQ(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNEQ(FieldJobID, v))
+}
+
+// JobIDIn applies the In predicate on the "job_id" field.
+func JobIDIn(vs ...string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldIn(FieldJobID, vs...))
+}
+
+// JobIDNotIn applies the NotIn predicate on the "job_id" field.
+func JobIDNotIn(vs ...string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNotIn(FieldJobID, vs...))
+}
+
+// JobIDGT applies the GT predicate on the "job_id" field.
+func JobIDGT(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGT(FieldJobID, v))
+}
+
+// JobIDGTE applies the GTE predicate on the "job_id" field.
+func JobIDGTE(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGTE(FieldJobID, v))
+}
+
+// JobIDLT applies the LT predicate on the "job_id" field.
+func JobIDLT(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLT(FieldJobID, v))
+}
+
+// JobIDLTE applies the LTE predicate on the "job_id" field.
+func JobIDLTE(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLTE(FieldJobID, v))
+}
+
+// JobIDContains applies the Contains predicate on the "job_id" field.
+func JobIDContains(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldContains(FieldJobID, v))
+}
+
+// JobIDHasPrefix applies the HasPrefix predicate on the "job_id" field.
+func JobIDHasPrefix(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldHasPrefix(FieldJobID, v))
+}
+
+// JobIDHasSuffix applies the HasSuffix predicate on the "job_id" field.
+func JobIDHasSuffix(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldHasSuffix(FieldJobID, v))
+}
+
+// JobIDEqualFold applies the EqualFold predicate on the "job_id" field.
+func JobIDEqualFold(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEqualFold(FieldJobID, v))
+}
+
+// JobIDContainsFold applies the ContainsFold predicate on the "job_id" field.
+func JobIDContainsFold(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldContainsFold(FieldJobID, v))
+}
+
+// EventTypeEQ applies the EQ predicate on the "event_type" field.
+func EventTypeEQ(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldEventType, v))
+}
+
+// EventTypeNEQ applies the NEQ predicate on the "event_type" field.
+func EventTypeNEQ(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNEQ(FieldEventType, v))
+}
+
+// EventTypeIn applies the In predicate on the "event_type" field.
+func EventTypeIn(vs ...string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldIn(FieldEventType, vs...))
+}
+
+// EventTypeNotIn applies the NotIn predicate on the "event_type" field.
+func EventTypeNotIn(vs ...string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNotIn(FieldEventType, vs...))
+}
+
+// EventTypeGT applies the GT predicate on the "event_type" field.
+func EventTypeGT(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGT(FieldEventType, v))
+}
+
+// EventTypeGTE applies the GTE predicate on the "event_type" field.
+func EventTypeGTE(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGTE(FieldEventType, v))
+}
+
+// EventTypeLT applies the LT predicate on the "event_type" field.
+func EventTypeLT(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLT(FieldEventType, v))
+}
+
+// EventTypeLTE applies the LTE predicate on the "event_type" field.
+func EventTypeLTE(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLTE(FieldEventType, v))
+}
+
+// EventTypeContains applies the Contains predicate on the "event_type" field.
+func EventTypeContains(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldContains(FieldEventType, v))
+}
+
+// EventTypeHasPrefix applies the HasPrefix predicate on the "event_type" field.
+func EventTypeHasPrefix(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldHasPrefix(FieldEventType, v))
+}
+
+// EventTypeHasSuffix applies the HasSuffix predicate on the "event_type" field.
+func EventTypeHasSuffix(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldHasSuffix(FieldEventType, v))
+}
+
+// EventTypeEqualFold applies the EqualFold predicate on the "event_type" field.
+func EventTypeEqualFold(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEqualFold(FieldEventType, v))
+}
+
+// EventTypeContainsFold applies the ContainsFold predicate on the "event_type" field.
+func EventTypeContainsFold(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldContainsFold(FieldEventType, v))
+}
+
+// PayloadIsNil applies the IsNil predicate on the "payload" field.
+func PayloadIsNil() predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldIsNull(FieldPayload))
+}
+
+// PayloadNotNil applies the NotNil predicate on the "payload" field.
+func PayloadNotNil() predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNotNull(FieldPayload))
+}
+
+// EventHashEQ applies the EQ predicate on the "event_hash" field.
+func EventHashEQ(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldEventHash, v))
+}
+
+// EventHashNEQ applies the NEQ predicate on the "event_hash" field.
+func EventHashNEQ(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNEQ(FieldEventHash, v))
+}
+
+// EventHashIn applies the In predicate on the "event_hash" field.
+func EventHashIn(vs ...string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldIn(FieldEventHash, vs...))
+}
+
+// EventHashNotIn applies the NotIn predicate on the "event_hash" field.
+func EventHashNotIn(vs ...string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNotIn(FieldEventHash, vs...))
+}
+
+// EventHashGT applies the GT predicate on the "event_hash" field.
+func EventHashGT(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGT(FieldEventHash, v))
+}
+
+// EventHashGTE applies the GTE predicate on the "event_hash" field.
+func EventHashGTE(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGTE(FieldEventHash, v))
+}
+
+// EventHashLT applies the LT predicate on the "event_hash" field.
+func EventHashLT(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLT(FieldEventHash, v))
+}
+
+// EventHashLTE applies the LTE predicate on the "event_hash" field.
+func EventHashLTE(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLTE(FieldEventHash, v))
+}
+
+// EventHashContains applies the Contains predicate on the "event_hash" field.
+func EventHashContains(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldContains(FieldEventHash, v))
+}
+
+// EventHashHasPrefix applies the HasPrefix predicate on the "event_hash" field.
+func EventHashHasPrefix(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldHasPrefix(FieldEventHash, v))
+}
+
+// EventHashHasSuffix applies the HasSuffix predicate on the "event_hash" field.
+func EventHashHasSuffix(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldHasSuffix(FieldEventHash, v))
+}
+
+// EventHashIsNil applies the IsNil predicate on the "event_hash" field.
+func EventHashIsNil() predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldIsNull(FieldEventHash))
+}
+
+// EventHashNotNil applies the NotNil predicate on the "event_hash" field.
+func EventHashNotNil() predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNotNull(FieldEventHash))
+}
+
+// EventHashEqualFold applies the EqualFold predicate on the "event_hash" field.
+func EventHashEqualFold(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEqualFold(FieldEventHash, v))
+}
+
+// EventHashContainsFold applies the ContainsFold predicate on the "event_hash" field.
+func EventHashContainsFold(v string) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldContainsFold(FieldEventHash, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.BatchImageEvent) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.BatchImageEvent) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.BatchImageEvent) predicate.BatchImageEvent {
+ return predicate.BatchImageEvent(sql.NotPredicates(p))
+}
diff --git a/backend/ent/batchimageevent_create.go b/backend/ent/batchimageevent_create.go
new file mode 100644
index 0000000000..c6ebef1dff
--- /dev/null
+++ b/backend/ent/batchimageevent_create.go
@@ -0,0 +1,714 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+)
+
+// BatchImageEventCreate is the builder for creating a BatchImageEvent entity.
+type BatchImageEventCreate struct {
+ config
+ mutation *BatchImageEventMutation
+ hooks []Hook
+ conflict []sql.ConflictOption
+}
+
+// SetJobID sets the "job_id" field.
+func (_c *BatchImageEventCreate) SetJobID(v string) *BatchImageEventCreate {
+ _c.mutation.SetJobID(v)
+ return _c
+}
+
+// SetEventType sets the "event_type" field.
+func (_c *BatchImageEventCreate) SetEventType(v string) *BatchImageEventCreate {
+ _c.mutation.SetEventType(v)
+ return _c
+}
+
+// SetPayload sets the "payload" field.
+func (_c *BatchImageEventCreate) SetPayload(v map[string]interface{}) *BatchImageEventCreate {
+ _c.mutation.SetPayload(v)
+ return _c
+}
+
+// SetEventHash sets the "event_hash" field.
+func (_c *BatchImageEventCreate) SetEventHash(v string) *BatchImageEventCreate {
+ _c.mutation.SetEventHash(v)
+ return _c
+}
+
+// SetNillableEventHash sets the "event_hash" field if the given value is not nil.
+func (_c *BatchImageEventCreate) SetNillableEventHash(v *string) *BatchImageEventCreate {
+ if v != nil {
+ _c.SetEventHash(*v)
+ }
+ return _c
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (_c *BatchImageEventCreate) SetCreatedAt(v time.Time) *BatchImageEventCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (_c *BatchImageEventCreate) SetNillableCreatedAt(v *time.Time) *BatchImageEventCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
+ }
+ return _c
+}
+
+// Mutation returns the BatchImageEventMutation object of the builder.
+func (_c *BatchImageEventCreate) Mutation() *BatchImageEventMutation {
+ return _c.mutation
+}
+
+// Save creates the BatchImageEvent in the database.
+func (_c *BatchImageEventCreate) Save(ctx context.Context) (*BatchImageEvent, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (_c *BatchImageEventCreate) SaveX(ctx context.Context) *BatchImageEvent {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *BatchImageEventCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *BatchImageEventCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (_c *BatchImageEventCreate) defaults() {
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ v := batchimageevent.DefaultCreatedAt()
+ _c.mutation.SetCreatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_c *BatchImageEventCreate) check() error {
+ if _, ok := _c.mutation.JobID(); !ok {
+ return &ValidationError{Name: "job_id", err: errors.New(`ent: missing required field "BatchImageEvent.job_id"`)}
+ }
+ if v, ok := _c.mutation.JobID(); ok {
+ if err := batchimageevent.JobIDValidator(v); err != nil {
+ return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.job_id": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.EventType(); !ok {
+ return &ValidationError{Name: "event_type", err: errors.New(`ent: missing required field "BatchImageEvent.event_type"`)}
+ }
+ if v, ok := _c.mutation.EventType(); ok {
+ if err := batchimageevent.EventTypeValidator(v); err != nil {
+ return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_type": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.EventHash(); ok {
+ if err := batchimageevent.EventHashValidator(v); err != nil {
+ return &ValidationError{Name: "event_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_hash": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BatchImageEvent.created_at"`)}
+ }
+ return nil
+}
+
+func (_c *BatchImageEventCreate) sqlSave(ctx context.Context) (*BatchImageEvent, error) {
+ if err := _c.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ id := _spec.ID.Value.(int64)
+ _node.ID = int64(id)
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
+ return _node, nil
+}
+
+func (_c *BatchImageEventCreate) createSpec() (*BatchImageEvent, *sqlgraph.CreateSpec) {
+ var (
+ _node = &BatchImageEvent{config: _c.config}
+ _spec = sqlgraph.NewCreateSpec(batchimageevent.Table, sqlgraph.NewFieldSpec(batchimageevent.FieldID, field.TypeInt64))
+ )
+ _spec.OnConflict = _c.conflict
+ if value, ok := _c.mutation.JobID(); ok {
+ _spec.SetField(batchimageevent.FieldJobID, field.TypeString, value)
+ _node.JobID = value
+ }
+ if value, ok := _c.mutation.EventType(); ok {
+ _spec.SetField(batchimageevent.FieldEventType, field.TypeString, value)
+ _node.EventType = value
+ }
+ if value, ok := _c.mutation.Payload(); ok {
+ _spec.SetField(batchimageevent.FieldPayload, field.TypeJSON, value)
+ _node.Payload = value
+ }
+ if value, ok := _c.mutation.EventHash(); ok {
+ _spec.SetField(batchimageevent.FieldEventHash, field.TypeString, value)
+ _node.EventHash = &value
+ }
+ if value, ok := _c.mutation.CreatedAt(); ok {
+ _spec.SetField(batchimageevent.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+// client.BatchImageEvent.Create().
+// SetJobID(v).
+// OnConflict(
+// // Update the row with the new values
+// // the was proposed for insertion.
+// sql.ResolveWithNewValues(),
+// ).
+// // Override some of the fields with custom
+// // update values.
+// Update(func(u *ent.BatchImageEventUpsert) {
+// SetJobID(v+v).
+// }).
+// Exec(ctx)
+func (_c *BatchImageEventCreate) OnConflict(opts ...sql.ConflictOption) *BatchImageEventUpsertOne {
+ _c.conflict = opts
+ return &BatchImageEventUpsertOne{
+ create: _c,
+ }
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+// client.BatchImageEvent.Create().
+// OnConflict(sql.ConflictColumns(columns...)).
+// Exec(ctx)
+func (_c *BatchImageEventCreate) OnConflictColumns(columns ...string) *BatchImageEventUpsertOne {
+ _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
+ return &BatchImageEventUpsertOne{
+ create: _c,
+ }
+}
+
+type (
+ // BatchImageEventUpsertOne is the builder for "upsert"-ing
+ // one BatchImageEvent node.
+ BatchImageEventUpsertOne struct {
+ create *BatchImageEventCreate
+ }
+
+ // BatchImageEventUpsert is the "OnConflict" setter.
+ BatchImageEventUpsert struct {
+ *sql.UpdateSet
+ }
+)
+
+// SetJobID sets the "job_id" field.
+func (u *BatchImageEventUpsert) SetJobID(v string) *BatchImageEventUpsert {
+ u.Set(batchimageevent.FieldJobID, v)
+ return u
+}
+
+// UpdateJobID sets the "job_id" field to the value that was provided on create.
+func (u *BatchImageEventUpsert) UpdateJobID() *BatchImageEventUpsert {
+ u.SetExcluded(batchimageevent.FieldJobID)
+ return u
+}
+
+// SetEventType sets the "event_type" field.
+func (u *BatchImageEventUpsert) SetEventType(v string) *BatchImageEventUpsert {
+ u.Set(batchimageevent.FieldEventType, v)
+ return u
+}
+
+// UpdateEventType sets the "event_type" field to the value that was provided on create.
+func (u *BatchImageEventUpsert) UpdateEventType() *BatchImageEventUpsert {
+ u.SetExcluded(batchimageevent.FieldEventType)
+ return u
+}
+
+// SetPayload sets the "payload" field.
+func (u *BatchImageEventUpsert) SetPayload(v map[string]interface{}) *BatchImageEventUpsert {
+ u.Set(batchimageevent.FieldPayload, v)
+ return u
+}
+
+// UpdatePayload sets the "payload" field to the value that was provided on create.
+func (u *BatchImageEventUpsert) UpdatePayload() *BatchImageEventUpsert {
+ u.SetExcluded(batchimageevent.FieldPayload)
+ return u
+}
+
+// ClearPayload clears the value of the "payload" field.
+func (u *BatchImageEventUpsert) ClearPayload() *BatchImageEventUpsert {
+ u.SetNull(batchimageevent.FieldPayload)
+ return u
+}
+
+// SetEventHash sets the "event_hash" field.
+func (u *BatchImageEventUpsert) SetEventHash(v string) *BatchImageEventUpsert {
+ u.Set(batchimageevent.FieldEventHash, v)
+ return u
+}
+
+// UpdateEventHash sets the "event_hash" field to the value that was provided on create.
+func (u *BatchImageEventUpsert) UpdateEventHash() *BatchImageEventUpsert {
+ u.SetExcluded(batchimageevent.FieldEventHash)
+ return u
+}
+
+// ClearEventHash clears the value of the "event_hash" field.
+func (u *BatchImageEventUpsert) ClearEventHash() *BatchImageEventUpsert {
+ u.SetNull(batchimageevent.FieldEventHash)
+ return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create.
+// Using this option is equivalent to using:
+//
+// client.BatchImageEvent.Create().
+// OnConflict(
+// sql.ResolveWithNewValues(),
+// ).
+// Exec(ctx)
+func (u *BatchImageEventUpsertOne) UpdateNewValues() *BatchImageEventUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+ if _, exists := u.create.mutation.CreatedAt(); exists {
+ s.SetIgnore(batchimageevent.FieldCreatedAt)
+ }
+ }))
+ return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+// client.BatchImageEvent.Create().
+// OnConflict(sql.ResolveWithIgnore()).
+// Exec(ctx)
+func (u *BatchImageEventUpsertOne) Ignore() *BatchImageEventUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+ return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *BatchImageEventUpsertOne) DoNothing() *BatchImageEventUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.DoNothing())
+ return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the BatchImageEventCreate.OnConflict
+// documentation for more info.
+func (u *BatchImageEventUpsertOne) Update(set func(*BatchImageEventUpsert)) *BatchImageEventUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+ set(&BatchImageEventUpsert{UpdateSet: update})
+ }))
+ return u
+}
+
+// SetJobID sets the "job_id" field.
+func (u *BatchImageEventUpsertOne) SetJobID(v string) *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetJobID(v)
+ })
+}
+
+// UpdateJobID sets the "job_id" field to the value that was provided on create.
+func (u *BatchImageEventUpsertOne) UpdateJobID() *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdateJobID()
+ })
+}
+
+// SetEventType sets the "event_type" field.
+func (u *BatchImageEventUpsertOne) SetEventType(v string) *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetEventType(v)
+ })
+}
+
+// UpdateEventType sets the "event_type" field to the value that was provided on create.
+func (u *BatchImageEventUpsertOne) UpdateEventType() *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdateEventType()
+ })
+}
+
+// SetPayload sets the "payload" field.
+func (u *BatchImageEventUpsertOne) SetPayload(v map[string]interface{}) *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetPayload(v)
+ })
+}
+
+// UpdatePayload sets the "payload" field to the value that was provided on create.
+func (u *BatchImageEventUpsertOne) UpdatePayload() *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdatePayload()
+ })
+}
+
+// ClearPayload clears the value of the "payload" field.
+func (u *BatchImageEventUpsertOne) ClearPayload() *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.ClearPayload()
+ })
+}
+
+// SetEventHash sets the "event_hash" field.
+func (u *BatchImageEventUpsertOne) SetEventHash(v string) *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetEventHash(v)
+ })
+}
+
+// UpdateEventHash sets the "event_hash" field to the value that was provided on create.
+func (u *BatchImageEventUpsertOne) UpdateEventHash() *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdateEventHash()
+ })
+}
+
+// ClearEventHash clears the value of the "event_hash" field.
+func (u *BatchImageEventUpsertOne) ClearEventHash() *BatchImageEventUpsertOne {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.ClearEventHash()
+ })
+}
+
+// Exec executes the query.
+func (u *BatchImageEventUpsertOne) Exec(ctx context.Context) error {
+ if len(u.create.conflict) == 0 {
+ return errors.New("ent: missing options for BatchImageEventCreate.OnConflict")
+ }
+ return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *BatchImageEventUpsertOne) ExecX(ctx context.Context) {
+ if err := u.create.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *BatchImageEventUpsertOne) ID(ctx context.Context) (id int64, err error) {
+ node, err := u.create.Save(ctx)
+ if err != nil {
+ return id, err
+ }
+ return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *BatchImageEventUpsertOne) IDX(ctx context.Context) int64 {
+ id, err := u.ID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// BatchImageEventCreateBulk is the builder for creating many BatchImageEvent entities in bulk.
+type BatchImageEventCreateBulk struct {
+ config
+ err error
+ builders []*BatchImageEventCreate
+ conflict []sql.ConflictOption
+}
+
+// Save creates the BatchImageEvent entities in the database.
+func (_c *BatchImageEventCreateBulk) Save(ctx context.Context) ([]*BatchImageEvent, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*BatchImageEvent, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
+ func(i int, root context.Context) {
+ builder := _c.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*BatchImageEventMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ spec.OnConflict = _c.conflict
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ if specs[i].ID.Value != nil {
+ id := specs[i].ID.Value.(int64)
+ nodes[i].ID = int64(id)
+ }
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_c *BatchImageEventCreateBulk) SaveX(ctx context.Context) []*BatchImageEvent {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *BatchImageEventCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *BatchImageEventCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+// client.BatchImageEvent.CreateBulk(builders...).
+// OnConflict(
+// // Update the row with the new values
+// // the was proposed for insertion.
+// sql.ResolveWithNewValues(),
+// ).
+// // Override some of the fields with custom
+// // update values.
+// Update(func(u *ent.BatchImageEventUpsert) {
+// SetJobID(v+v).
+// }).
+// Exec(ctx)
+func (_c *BatchImageEventCreateBulk) OnConflict(opts ...sql.ConflictOption) *BatchImageEventUpsertBulk {
+ _c.conflict = opts
+ return &BatchImageEventUpsertBulk{
+ create: _c,
+ }
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+// client.BatchImageEvent.Create().
+// OnConflict(sql.ConflictColumns(columns...)).
+// Exec(ctx)
+func (_c *BatchImageEventCreateBulk) OnConflictColumns(columns ...string) *BatchImageEventUpsertBulk {
+ _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
+ return &BatchImageEventUpsertBulk{
+ create: _c,
+ }
+}
+
+// BatchImageEventUpsertBulk is the builder for "upsert"-ing
+// a bulk of BatchImageEvent nodes.
+type BatchImageEventUpsertBulk struct {
+ create *BatchImageEventCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+// client.BatchImageEvent.Create().
+// OnConflict(
+// sql.ResolveWithNewValues(),
+// ).
+// Exec(ctx)
+func (u *BatchImageEventUpsertBulk) UpdateNewValues() *BatchImageEventUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+ for _, b := range u.create.builders {
+ if _, exists := b.mutation.CreatedAt(); exists {
+ s.SetIgnore(batchimageevent.FieldCreatedAt)
+ }
+ }
+ }))
+ return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+// client.BatchImageEvent.Create().
+// OnConflict(sql.ResolveWithIgnore()).
+// Exec(ctx)
+func (u *BatchImageEventUpsertBulk) Ignore() *BatchImageEventUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+ return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *BatchImageEventUpsertBulk) DoNothing() *BatchImageEventUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.DoNothing())
+ return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the BatchImageEventCreateBulk.OnConflict
+// documentation for more info.
+func (u *BatchImageEventUpsertBulk) Update(set func(*BatchImageEventUpsert)) *BatchImageEventUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+ set(&BatchImageEventUpsert{UpdateSet: update})
+ }))
+ return u
+}
+
+// SetJobID sets the "job_id" field.
+func (u *BatchImageEventUpsertBulk) SetJobID(v string) *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetJobID(v)
+ })
+}
+
+// UpdateJobID sets the "job_id" field to the value that was provided on create.
+func (u *BatchImageEventUpsertBulk) UpdateJobID() *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdateJobID()
+ })
+}
+
+// SetEventType sets the "event_type" field.
+func (u *BatchImageEventUpsertBulk) SetEventType(v string) *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetEventType(v)
+ })
+}
+
+// UpdateEventType sets the "event_type" field to the value that was provided on create.
+func (u *BatchImageEventUpsertBulk) UpdateEventType() *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdateEventType()
+ })
+}
+
+// SetPayload sets the "payload" field.
+func (u *BatchImageEventUpsertBulk) SetPayload(v map[string]interface{}) *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetPayload(v)
+ })
+}
+
+// UpdatePayload sets the "payload" field to the value that was provided on create.
+func (u *BatchImageEventUpsertBulk) UpdatePayload() *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdatePayload()
+ })
+}
+
+// ClearPayload clears the value of the "payload" field.
+func (u *BatchImageEventUpsertBulk) ClearPayload() *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.ClearPayload()
+ })
+}
+
+// SetEventHash sets the "event_hash" field.
+func (u *BatchImageEventUpsertBulk) SetEventHash(v string) *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.SetEventHash(v)
+ })
+}
+
+// UpdateEventHash sets the "event_hash" field to the value that was provided on create.
+func (u *BatchImageEventUpsertBulk) UpdateEventHash() *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.UpdateEventHash()
+ })
+}
+
+// ClearEventHash clears the value of the "event_hash" field.
+func (u *BatchImageEventUpsertBulk) ClearEventHash() *BatchImageEventUpsertBulk {
+ return u.Update(func(s *BatchImageEventUpsert) {
+ s.ClearEventHash()
+ })
+}
+
+// Exec executes the query.
+func (u *BatchImageEventUpsertBulk) Exec(ctx context.Context) error {
+ if u.create.err != nil {
+ return u.create.err
+ }
+ for i, b := range u.create.builders {
+ if len(b.conflict) != 0 {
+ return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the BatchImageEventCreateBulk instead", i)
+ }
+ }
+ if len(u.create.conflict) == 0 {
+ return errors.New("ent: missing options for BatchImageEventCreateBulk.OnConflict")
+ }
+ return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *BatchImageEventUpsertBulk) ExecX(ctx context.Context) {
+ if err := u.create.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/ent/batchimageevent_delete.go b/backend/ent/batchimageevent_delete.go
new file mode 100644
index 0000000000..54a51bef35
--- /dev/null
+++ b/backend/ent/batchimageevent_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageEventDelete is the builder for deleting a BatchImageEvent entity.
+type BatchImageEventDelete struct {
+ config
+ hooks []Hook
+ mutation *BatchImageEventMutation
+}
+
+// Where appends a list predicates to the BatchImageEventDelete builder.
+func (_d *BatchImageEventDelete) Where(ps ...predicate.BatchImageEvent) *BatchImageEventDelete {
+ _d.mutation.Where(ps...)
+ return _d
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (_d *BatchImageEventDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_d *BatchImageEventDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (_d *BatchImageEventDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(batchimageevent.Table, sqlgraph.NewFieldSpec(batchimageevent.FieldID, field.TypeInt64))
+ if ps := _d.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ _d.mutation.done = true
+ return affected, err
+}
+
+// BatchImageEventDeleteOne is the builder for deleting a single BatchImageEvent entity.
+type BatchImageEventDeleteOne struct {
+ _d *BatchImageEventDelete
+}
+
+// Where appends a list predicates to the BatchImageEventDelete builder.
+func (_d *BatchImageEventDeleteOne) Where(ps ...predicate.BatchImageEvent) *BatchImageEventDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
+}
+
+// Exec executes the deletion query.
+func (_d *BatchImageEventDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{batchimageevent.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_d *BatchImageEventDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/ent/batchimageevent_query.go b/backend/ent/batchimageevent_query.go
new file mode 100644
index 0000000000..26fc5189a1
--- /dev/null
+++ b/backend/ent/batchimageevent_query.go
@@ -0,0 +1,564 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "fmt"
+ "math"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageEventQuery is the builder for querying BatchImageEvent entities.
+type BatchImageEventQuery struct {
+ config
+ ctx *QueryContext
+ order []batchimageevent.OrderOption
+ inters []Interceptor
+ predicates []predicate.BatchImageEvent
+ modifiers []func(*sql.Selector)
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the BatchImageEventQuery builder.
+func (_q *BatchImageEventQuery) Where(ps ...predicate.BatchImageEvent) *BatchImageEventQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
+}
+
+// Limit the number of records to be returned by this query.
+func (_q *BatchImageEventQuery) Limit(limit int) *BatchImageEventQuery {
+ _q.ctx.Limit = &limit
+ return _q
+}
+
+// Offset to start from.
+func (_q *BatchImageEventQuery) Offset(offset int) *BatchImageEventQuery {
+ _q.ctx.Offset = &offset
+ return _q
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (_q *BatchImageEventQuery) Unique(unique bool) *BatchImageEventQuery {
+ _q.ctx.Unique = &unique
+ return _q
+}
+
+// Order specifies how the records should be ordered.
+func (_q *BatchImageEventQuery) Order(o ...batchimageevent.OrderOption) *BatchImageEventQuery {
+ _q.order = append(_q.order, o...)
+ return _q
+}
+
+// First returns the first BatchImageEvent entity from the query.
+// Returns a *NotFoundError when no BatchImageEvent was found.
+func (_q *BatchImageEventQuery) First(ctx context.Context) (*BatchImageEvent, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{batchimageevent.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (_q *BatchImageEventQuery) FirstX(ctx context.Context) *BatchImageEvent {
+ node, err := _q.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first BatchImageEvent ID from the query.
+// Returns a *NotFoundError when no BatchImageEvent ID was found.
+func (_q *BatchImageEventQuery) FirstID(ctx context.Context) (id int64, err error) {
+ var ids []int64
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{batchimageevent.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (_q *BatchImageEventQuery) FirstIDX(ctx context.Context) int64 {
+ id, err := _q.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single BatchImageEvent entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one BatchImageEvent entity is found.
+// Returns a *NotFoundError when no BatchImageEvent entities are found.
+func (_q *BatchImageEventQuery) Only(ctx context.Context) (*BatchImageEvent, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{batchimageevent.Label}
+ default:
+ return nil, &NotSingularError{batchimageevent.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (_q *BatchImageEventQuery) OnlyX(ctx context.Context) *BatchImageEvent {
+ node, err := _q.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only BatchImageEvent ID in the query.
+// Returns a *NotSingularError when more than one BatchImageEvent ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (_q *BatchImageEventQuery) OnlyID(ctx context.Context) (id int64, err error) {
+ var ids []int64
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{batchimageevent.Label}
+ default:
+ err = &NotSingularError{batchimageevent.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (_q *BatchImageEventQuery) OnlyIDX(ctx context.Context) int64 {
+ id, err := _q.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of BatchImageEvents.
+func (_q *BatchImageEventQuery) All(ctx context.Context) ([]*BatchImageEvent, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*BatchImageEvent, *BatchImageEventQuery]()
+ return withInterceptors[[]*BatchImageEvent](ctx, _q, qr, _q.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (_q *BatchImageEventQuery) AllX(ctx context.Context) []*BatchImageEvent {
+ nodes, err := _q.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of BatchImageEvent IDs.
+func (_q *BatchImageEventQuery) IDs(ctx context.Context) (ids []int64, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
+ }
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(batchimageevent.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (_q *BatchImageEventQuery) IDsX(ctx context.Context) []int64 {
+ ids, err := _q.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (_q *BatchImageEventQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, _q, querierCount[*BatchImageEventQuery](), _q.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (_q *BatchImageEventQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (_q *BatchImageEventQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (_q *BatchImageEventQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the BatchImageEventQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (_q *BatchImageEventQuery) Clone() *BatchImageEventQuery {
+ if _q == nil {
+ return nil
+ }
+ return &BatchImageEventQuery{
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]batchimageevent.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.BatchImageEvent{}, _q.predicates...),
+ // clone intermediate query.
+ sql: _q.sql.Clone(),
+ path: _q.path,
+ }
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// JobID string `json:"job_id,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.BatchImageEvent.Query().
+// GroupBy(batchimageevent.FieldJobID).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (_q *BatchImageEventQuery) GroupBy(field string, fields ...string) *BatchImageEventGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &BatchImageEventGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
+ grbuild.label = batchimageevent.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// JobID string `json:"job_id,omitempty"`
+// }
+//
+// client.BatchImageEvent.Query().
+// Select(batchimageevent.FieldJobID).
+// Scan(ctx, &v)
+func (_q *BatchImageEventQuery) Select(fields ...string) *BatchImageEventSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &BatchImageEventSelect{BatchImageEventQuery: _q}
+ sbuild.label = batchimageevent.Label
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a BatchImageEventSelect configured with the given aggregations.
+func (_q *BatchImageEventQuery) Aggregate(fns ...AggregateFunc) *BatchImageEventSelect {
+ return _q.Select().Aggregate(fns...)
+}
+
+func (_q *BatchImageEventQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, _q); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range _q.ctx.Fields {
+ if !batchimageevent.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
+ if err != nil {
+ return err
+ }
+ _q.sql = prev
+ }
+ return nil
+}
+
+func (_q *BatchImageEventQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BatchImageEvent, error) {
+ var (
+ nodes = []*BatchImageEvent{}
+ _spec = _q.querySpec()
+ )
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*BatchImageEvent).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &BatchImageEvent{config: _q.config}
+ nodes = append(nodes, node)
+ return node.assignValues(columns, values)
+ }
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ return nodes, nil
+}
+
+func (_q *BatchImageEventQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
+}
+
+func (_q *BatchImageEventQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(batchimageevent.Table, batchimageevent.Columns, sqlgraph.NewFieldSpec(batchimageevent.FieldID, field.TypeInt64))
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if _q.path != nil {
+ _spec.Unique = true
+ }
+ if fields := _q.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, batchimageevent.FieldID)
+ for i := range fields {
+ if fields[i] != batchimageevent.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := _q.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := _q.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := _q.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := _q.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (_q *BatchImageEventQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
+ t1 := builder.Table(batchimageevent.Table)
+ columns := _q.ctx.Fields
+ if len(columns) == 0 {
+ columns = batchimageevent.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if _q.sql != nil {
+ selector = _q.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, m := range _q.modifiers {
+ m(selector)
+ }
+ for _, p := range _q.predicates {
+ p(selector)
+ }
+ for _, p := range _q.order {
+ p(selector)
+ }
+ if offset := _q.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := _q.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// ForUpdate locks the selected rows against concurrent updates, and prevent them from being
+// updated, deleted or "selected ... for update" by other sessions, until the transaction is
+// either committed or rolled-back.
+func (_q *BatchImageEventQuery) ForUpdate(opts ...sql.LockOption) *BatchImageEventQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForUpdate(opts...)
+ })
+ return _q
+}
+
+// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock
+// on any rows that are read. Other sessions can read the rows, but cannot modify them
+// until your transaction commits.
+func (_q *BatchImageEventQuery) ForShare(opts ...sql.LockOption) *BatchImageEventQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForShare(opts...)
+ })
+ return _q
+}
+
+// BatchImageEventGroupBy is the group-by builder for BatchImageEvent entities.
+type BatchImageEventGroupBy struct {
+ selector
+ build *BatchImageEventQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (_g *BatchImageEventGroupBy) Aggregate(fns ...AggregateFunc) *BatchImageEventGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (_g *BatchImageEventGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BatchImageEventQuery, *BatchImageEventGroupBy](ctx, _g.build, _g, _g.build.inters, v)
+}
+
+func (_g *BatchImageEventGroupBy) sqlScan(ctx context.Context, root *BatchImageEventQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// BatchImageEventSelect is the builder for selecting fields of BatchImageEvent entities.
+type BatchImageEventSelect struct {
+ *BatchImageEventQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (_s *BatchImageEventSelect) Aggregate(fns ...AggregateFunc) *BatchImageEventSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (_s *BatchImageEventSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BatchImageEventQuery, *BatchImageEventSelect](ctx, _s.BatchImageEventQuery, _s, _s.inters, v)
+}
+
+func (_s *BatchImageEventSelect) sqlScan(ctx context.Context, root *BatchImageEventQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*_s.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/ent/batchimageevent_update.go b/backend/ent/batchimageevent_update.go
new file mode 100644
index 0000000000..39035d6691
--- /dev/null
+++ b/backend/ent/batchimageevent_update.go
@@ -0,0 +1,377 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageEventUpdate is the builder for updating BatchImageEvent entities.
+type BatchImageEventUpdate struct {
+ config
+ hooks []Hook
+ mutation *BatchImageEventMutation
+}
+
+// Where appends a list predicates to the BatchImageEventUpdate builder.
+func (_u *BatchImageEventUpdate) Where(ps ...predicate.BatchImageEvent) *BatchImageEventUpdate {
+ _u.mutation.Where(ps...)
+ return _u
+}
+
+// SetJobID sets the "job_id" field.
+func (_u *BatchImageEventUpdate) SetJobID(v string) *BatchImageEventUpdate {
+ _u.mutation.SetJobID(v)
+ return _u
+}
+
+// SetNillableJobID sets the "job_id" field if the given value is not nil.
+func (_u *BatchImageEventUpdate) SetNillableJobID(v *string) *BatchImageEventUpdate {
+ if v != nil {
+ _u.SetJobID(*v)
+ }
+ return _u
+}
+
+// SetEventType sets the "event_type" field.
+func (_u *BatchImageEventUpdate) SetEventType(v string) *BatchImageEventUpdate {
+ _u.mutation.SetEventType(v)
+ return _u
+}
+
+// SetNillableEventType sets the "event_type" field if the given value is not nil.
+func (_u *BatchImageEventUpdate) SetNillableEventType(v *string) *BatchImageEventUpdate {
+ if v != nil {
+ _u.SetEventType(*v)
+ }
+ return _u
+}
+
+// SetPayload sets the "payload" field.
+func (_u *BatchImageEventUpdate) SetPayload(v map[string]interface{}) *BatchImageEventUpdate {
+ _u.mutation.SetPayload(v)
+ return _u
+}
+
+// ClearPayload clears the value of the "payload" field.
+func (_u *BatchImageEventUpdate) ClearPayload() *BatchImageEventUpdate {
+ _u.mutation.ClearPayload()
+ return _u
+}
+
+// SetEventHash sets the "event_hash" field.
+func (_u *BatchImageEventUpdate) SetEventHash(v string) *BatchImageEventUpdate {
+ _u.mutation.SetEventHash(v)
+ return _u
+}
+
+// SetNillableEventHash sets the "event_hash" field if the given value is not nil.
+func (_u *BatchImageEventUpdate) SetNillableEventHash(v *string) *BatchImageEventUpdate {
+ if v != nil {
+ _u.SetEventHash(*v)
+ }
+ return _u
+}
+
+// ClearEventHash clears the value of the "event_hash" field.
+func (_u *BatchImageEventUpdate) ClearEventHash() *BatchImageEventUpdate {
+ _u.mutation.ClearEventHash()
+ return _u
+}
+
+// Mutation returns the BatchImageEventMutation object of the builder.
+func (_u *BatchImageEventUpdate) Mutation() *BatchImageEventMutation {
+ return _u.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (_u *BatchImageEventUpdate) Save(ctx context.Context) (int, error) {
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_u *BatchImageEventUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (_u *BatchImageEventUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_u *BatchImageEventUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_u *BatchImageEventUpdate) check() error {
+ if v, ok := _u.mutation.JobID(); ok {
+ if err := batchimageevent.JobIDValidator(v); err != nil {
+ return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.job_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.EventType(); ok {
+ if err := batchimageevent.EventTypeValidator(v); err != nil {
+ return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_type": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.EventHash(); ok {
+ if err := batchimageevent.EventHashValidator(v); err != nil {
+ return &ValidationError{Name: "event_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_hash": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (_u *BatchImageEventUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(batchimageevent.Table, batchimageevent.Columns, sqlgraph.NewFieldSpec(batchimageevent.FieldID, field.TypeInt64))
+ if ps := _u.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := _u.mutation.JobID(); ok {
+ _spec.SetField(batchimageevent.FieldJobID, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.EventType(); ok {
+ _spec.SetField(batchimageevent.FieldEventType, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Payload(); ok {
+ _spec.SetField(batchimageevent.FieldPayload, field.TypeJSON, value)
+ }
+ if _u.mutation.PayloadCleared() {
+ _spec.ClearField(batchimageevent.FieldPayload, field.TypeJSON)
+ }
+ if value, ok := _u.mutation.EventHash(); ok {
+ _spec.SetField(batchimageevent.FieldEventHash, field.TypeString, value)
+ }
+ if _u.mutation.EventHashCleared() {
+ _spec.ClearField(batchimageevent.FieldEventHash, field.TypeString)
+ }
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{batchimageevent.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ _u.mutation.done = true
+ return _node, nil
+}
+
+// BatchImageEventUpdateOne is the builder for updating a single BatchImageEvent entity.
+type BatchImageEventUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *BatchImageEventMutation
+}
+
+// SetJobID sets the "job_id" field.
+func (_u *BatchImageEventUpdateOne) SetJobID(v string) *BatchImageEventUpdateOne {
+ _u.mutation.SetJobID(v)
+ return _u
+}
+
+// SetNillableJobID sets the "job_id" field if the given value is not nil.
+func (_u *BatchImageEventUpdateOne) SetNillableJobID(v *string) *BatchImageEventUpdateOne {
+ if v != nil {
+ _u.SetJobID(*v)
+ }
+ return _u
+}
+
+// SetEventType sets the "event_type" field.
+func (_u *BatchImageEventUpdateOne) SetEventType(v string) *BatchImageEventUpdateOne {
+ _u.mutation.SetEventType(v)
+ return _u
+}
+
+// SetNillableEventType sets the "event_type" field if the given value is not nil.
+func (_u *BatchImageEventUpdateOne) SetNillableEventType(v *string) *BatchImageEventUpdateOne {
+ if v != nil {
+ _u.SetEventType(*v)
+ }
+ return _u
+}
+
+// SetPayload sets the "payload" field.
+func (_u *BatchImageEventUpdateOne) SetPayload(v map[string]interface{}) *BatchImageEventUpdateOne {
+ _u.mutation.SetPayload(v)
+ return _u
+}
+
+// ClearPayload clears the value of the "payload" field.
+func (_u *BatchImageEventUpdateOne) ClearPayload() *BatchImageEventUpdateOne {
+ _u.mutation.ClearPayload()
+ return _u
+}
+
+// SetEventHash sets the "event_hash" field.
+func (_u *BatchImageEventUpdateOne) SetEventHash(v string) *BatchImageEventUpdateOne {
+ _u.mutation.SetEventHash(v)
+ return _u
+}
+
+// SetNillableEventHash sets the "event_hash" field if the given value is not nil.
+func (_u *BatchImageEventUpdateOne) SetNillableEventHash(v *string) *BatchImageEventUpdateOne {
+ if v != nil {
+ _u.SetEventHash(*v)
+ }
+ return _u
+}
+
+// ClearEventHash clears the value of the "event_hash" field.
+func (_u *BatchImageEventUpdateOne) ClearEventHash() *BatchImageEventUpdateOne {
+ _u.mutation.ClearEventHash()
+ return _u
+}
+
+// Mutation returns the BatchImageEventMutation object of the builder.
+func (_u *BatchImageEventUpdateOne) Mutation() *BatchImageEventMutation {
+ return _u.mutation
+}
+
+// Where appends a list predicates to the BatchImageEventUpdate builder.
+func (_u *BatchImageEventUpdateOne) Where(ps ...predicate.BatchImageEvent) *BatchImageEventUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (_u *BatchImageEventUpdateOne) Select(field string, fields ...string) *BatchImageEventUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
+}
+
+// Save executes the query and returns the updated BatchImageEvent entity.
+func (_u *BatchImageEventUpdateOne) Save(ctx context.Context) (*BatchImageEvent, error) {
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_u *BatchImageEventUpdateOne) SaveX(ctx context.Context) *BatchImageEvent {
+ node, err := _u.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (_u *BatchImageEventUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_u *BatchImageEventUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_u *BatchImageEventUpdateOne) check() error {
+ if v, ok := _u.mutation.JobID(); ok {
+ if err := batchimageevent.JobIDValidator(v); err != nil {
+ return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.job_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.EventType(); ok {
+ if err := batchimageevent.EventTypeValidator(v); err != nil {
+ return &ValidationError{Name: "event_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_type": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.EventHash(); ok {
+ if err := batchimageevent.EventHashValidator(v); err != nil {
+ return &ValidationError{Name: "event_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageEvent.event_hash": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (_u *BatchImageEventUpdateOne) sqlSave(ctx context.Context) (_node *BatchImageEvent, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(batchimageevent.Table, batchimageevent.Columns, sqlgraph.NewFieldSpec(batchimageevent.FieldID, field.TypeInt64))
+ id, ok := _u.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BatchImageEvent.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := _u.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, batchimageevent.FieldID)
+ for _, f := range fields {
+ if !batchimageevent.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != batchimageevent.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := _u.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := _u.mutation.JobID(); ok {
+ _spec.SetField(batchimageevent.FieldJobID, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.EventType(); ok {
+ _spec.SetField(batchimageevent.FieldEventType, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Payload(); ok {
+ _spec.SetField(batchimageevent.FieldPayload, field.TypeJSON, value)
+ }
+ if _u.mutation.PayloadCleared() {
+ _spec.ClearField(batchimageevent.FieldPayload, field.TypeJSON)
+ }
+ if value, ok := _u.mutation.EventHash(); ok {
+ _spec.SetField(batchimageevent.FieldEventHash, field.TypeString, value)
+ }
+ if _u.mutation.EventHashCleared() {
+ _spec.ClearField(batchimageevent.FieldEventHash, field.TypeString)
+ }
+ _node = &BatchImageEvent{config: _u.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{batchimageevent.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ _u.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/ent/batchimageitem.go b/backend/ent/batchimageitem.go
new file mode 100644
index 0000000000..47b876f158
--- /dev/null
+++ b/backend/ent/batchimageitem.go
@@ -0,0 +1,320 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+)
+
+// BatchImageItem is the model entity for the BatchImageItem schema.
+type BatchImageItem struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID int64 `json:"id,omitempty"`
+ // JobID holds the value of the "job_id" field.
+ JobID string `json:"job_id,omitempty"`
+ // CustomID holds the value of the "custom_id" field.
+ CustomID string `json:"custom_id,omitempty"`
+ // Status holds the value of the "status" field.
+ Status string `json:"status,omitempty"`
+ // RequestHash holds the value of the "request_hash" field.
+ RequestHash *string `json:"request_hash,omitempty"`
+ // PromptPreview holds the value of the "prompt_preview" field.
+ PromptPreview *string `json:"prompt_preview,omitempty"`
+ // ProviderSourceObject holds the value of the "provider_source_object" field.
+ ProviderSourceObject *string `json:"provider_source_object,omitempty"`
+ // SourceLineNumber holds the value of the "source_line_number" field.
+ SourceLineNumber *int `json:"source_line_number,omitempty"`
+ // SourceByteOffset holds the value of the "source_byte_offset" field.
+ SourceByteOffset *int64 `json:"source_byte_offset,omitempty"`
+ // SourceByteLength holds the value of the "source_byte_length" field.
+ SourceByteLength *int64 `json:"source_byte_length,omitempty"`
+ // MimeType holds the value of the "mime_type" field.
+ MimeType *string `json:"mime_type,omitempty"`
+ // FileExtension holds the value of the "file_extension" field.
+ FileExtension *string `json:"file_extension,omitempty"`
+ // ImageCount holds the value of the "image_count" field.
+ ImageCount int `json:"image_count,omitempty"`
+ // ErrorCode holds the value of the "error_code" field.
+ ErrorCode *string `json:"error_code,omitempty"`
+ // ErrorMessage holds the value of the "error_message" field.
+ ErrorMessage *string `json:"error_message,omitempty"`
+ // BilledAmount holds the value of the "billed_amount" field.
+ BilledAmount *float64 `json:"billed_amount,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // IndexedAt holds the value of the "indexed_at" field.
+ IndexedAt *time.Time `json:"indexed_at,omitempty"`
+ selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*BatchImageItem) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case batchimageitem.FieldBilledAmount:
+ values[i] = new(sql.NullFloat64)
+ case batchimageitem.FieldID, batchimageitem.FieldSourceLineNumber, batchimageitem.FieldSourceByteOffset, batchimageitem.FieldSourceByteLength, batchimageitem.FieldImageCount:
+ values[i] = new(sql.NullInt64)
+ case batchimageitem.FieldJobID, batchimageitem.FieldCustomID, batchimageitem.FieldStatus, batchimageitem.FieldRequestHash, batchimageitem.FieldPromptPreview, batchimageitem.FieldProviderSourceObject, batchimageitem.FieldMimeType, batchimageitem.FieldFileExtension, batchimageitem.FieldErrorCode, batchimageitem.FieldErrorMessage:
+ values[i] = new(sql.NullString)
+ case batchimageitem.FieldCreatedAt, batchimageitem.FieldIndexedAt:
+ values[i] = new(sql.NullTime)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the BatchImageItem fields.
+func (_m *BatchImageItem) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case batchimageitem.FieldID:
+ value, ok := values[i].(*sql.NullInt64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field id", value)
+ }
+ _m.ID = int64(value.Int64)
+ case batchimageitem.FieldJobID:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field job_id", values[i])
+ } else if value.Valid {
+ _m.JobID = value.String
+ }
+ case batchimageitem.FieldCustomID:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field custom_id", values[i])
+ } else if value.Valid {
+ _m.CustomID = value.String
+ }
+ case batchimageitem.FieldStatus:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field status", values[i])
+ } else if value.Valid {
+ _m.Status = value.String
+ }
+ case batchimageitem.FieldRequestHash:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field request_hash", values[i])
+ } else if value.Valid {
+ _m.RequestHash = new(string)
+ *_m.RequestHash = value.String
+ }
+ case batchimageitem.FieldPromptPreview:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field prompt_preview", values[i])
+ } else if value.Valid {
+ _m.PromptPreview = new(string)
+ *_m.PromptPreview = value.String
+ }
+ case batchimageitem.FieldProviderSourceObject:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field provider_source_object", values[i])
+ } else if value.Valid {
+ _m.ProviderSourceObject = new(string)
+ *_m.ProviderSourceObject = value.String
+ }
+ case batchimageitem.FieldSourceLineNumber:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field source_line_number", values[i])
+ } else if value.Valid {
+ _m.SourceLineNumber = new(int)
+ *_m.SourceLineNumber = int(value.Int64)
+ }
+ case batchimageitem.FieldSourceByteOffset:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field source_byte_offset", values[i])
+ } else if value.Valid {
+ _m.SourceByteOffset = new(int64)
+ *_m.SourceByteOffset = value.Int64
+ }
+ case batchimageitem.FieldSourceByteLength:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field source_byte_length", values[i])
+ } else if value.Valid {
+ _m.SourceByteLength = new(int64)
+ *_m.SourceByteLength = value.Int64
+ }
+ case batchimageitem.FieldMimeType:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field mime_type", values[i])
+ } else if value.Valid {
+ _m.MimeType = new(string)
+ *_m.MimeType = value.String
+ }
+ case batchimageitem.FieldFileExtension:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field file_extension", values[i])
+ } else if value.Valid {
+ _m.FileExtension = new(string)
+ *_m.FileExtension = value.String
+ }
+ case batchimageitem.FieldImageCount:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field image_count", values[i])
+ } else if value.Valid {
+ _m.ImageCount = int(value.Int64)
+ }
+ case batchimageitem.FieldErrorCode:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field error_code", values[i])
+ } else if value.Valid {
+ _m.ErrorCode = new(string)
+ *_m.ErrorCode = value.String
+ }
+ case batchimageitem.FieldErrorMessage:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field error_message", values[i])
+ } else if value.Valid {
+ _m.ErrorMessage = new(string)
+ *_m.ErrorMessage = value.String
+ }
+ case batchimageitem.FieldBilledAmount:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field billed_amount", values[i])
+ } else if value.Valid {
+ _m.BilledAmount = new(float64)
+ *_m.BilledAmount = value.Float64
+ }
+ case batchimageitem.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ _m.CreatedAt = value.Time
+ }
+ case batchimageitem.FieldIndexedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field indexed_at", values[i])
+ } else if value.Valid {
+ _m.IndexedAt = new(time.Time)
+ *_m.IndexedAt = value.Time
+ }
+ default:
+ _m.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the BatchImageItem.
+// This includes values selected through modifiers, order, etc.
+func (_m *BatchImageItem) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this BatchImageItem.
+// Note that you need to call BatchImageItem.Unwrap() before calling this method if this BatchImageItem
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (_m *BatchImageItem) Update() *BatchImageItemUpdateOne {
+ return NewBatchImageItemClient(_m.config).UpdateOne(_m)
+}
+
+// Unwrap unwraps the BatchImageItem entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (_m *BatchImageItem) Unwrap() *BatchImageItem {
+ _tx, ok := _m.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: BatchImageItem is not a transactional entity")
+ }
+ _m.config.driver = _tx.drv
+ return _m
+}
+
+// String implements the fmt.Stringer.
+func (_m *BatchImageItem) String() string {
+ var builder strings.Builder
+ builder.WriteString("BatchImageItem(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
+ builder.WriteString("job_id=")
+ builder.WriteString(_m.JobID)
+ builder.WriteString(", ")
+ builder.WriteString("custom_id=")
+ builder.WriteString(_m.CustomID)
+ builder.WriteString(", ")
+ builder.WriteString("status=")
+ builder.WriteString(_m.Status)
+ builder.WriteString(", ")
+ if v := _m.RequestHash; v != nil {
+ builder.WriteString("request_hash=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.PromptPreview; v != nil {
+ builder.WriteString("prompt_preview=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.ProviderSourceObject; v != nil {
+ builder.WriteString("provider_source_object=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.SourceLineNumber; v != nil {
+ builder.WriteString("source_line_number=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ if v := _m.SourceByteOffset; v != nil {
+ builder.WriteString("source_byte_offset=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ if v := _m.SourceByteLength; v != nil {
+ builder.WriteString("source_byte_length=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ if v := _m.MimeType; v != nil {
+ builder.WriteString("mime_type=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.FileExtension; v != nil {
+ builder.WriteString("file_extension=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ builder.WriteString("image_count=")
+ builder.WriteString(fmt.Sprintf("%v", _m.ImageCount))
+ builder.WriteString(", ")
+ if v := _m.ErrorCode; v != nil {
+ builder.WriteString("error_code=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.ErrorMessage; v != nil {
+ builder.WriteString("error_message=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.BilledAmount; v != nil {
+ builder.WriteString("billed_amount=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ if v := _m.IndexedAt; v != nil {
+ builder.WriteString("indexed_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// BatchImageItems is a parsable slice of BatchImageItem.
+type BatchImageItems []*BatchImageItem
diff --git a/backend/ent/batchimageitem/batchimageitem.go b/backend/ent/batchimageitem/batchimageitem.go
new file mode 100644
index 0000000000..3656e31dfe
--- /dev/null
+++ b/backend/ent/batchimageitem/batchimageitem.go
@@ -0,0 +1,200 @@
+// Code generated by ent, DO NOT EDIT.
+
+package batchimageitem
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+)
+
+const (
+ // Label holds the string label denoting the batchimageitem type in the database.
+ Label = "batch_image_item"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldJobID holds the string denoting the job_id field in the database.
+ FieldJobID = "job_id"
+ // FieldCustomID holds the string denoting the custom_id field in the database.
+ FieldCustomID = "custom_id"
+ // FieldStatus holds the string denoting the status field in the database.
+ FieldStatus = "status"
+ // FieldRequestHash holds the string denoting the request_hash field in the database.
+ FieldRequestHash = "request_hash"
+ // FieldPromptPreview holds the string denoting the prompt_preview field in the database.
+ FieldPromptPreview = "prompt_preview"
+ // FieldProviderSourceObject holds the string denoting the provider_source_object field in the database.
+ FieldProviderSourceObject = "provider_source_object"
+ // FieldSourceLineNumber holds the string denoting the source_line_number field in the database.
+ FieldSourceLineNumber = "source_line_number"
+ // FieldSourceByteOffset holds the string denoting the source_byte_offset field in the database.
+ FieldSourceByteOffset = "source_byte_offset"
+ // FieldSourceByteLength holds the string denoting the source_byte_length field in the database.
+ FieldSourceByteLength = "source_byte_length"
+ // FieldMimeType holds the string denoting the mime_type field in the database.
+ FieldMimeType = "mime_type"
+ // FieldFileExtension holds the string denoting the file_extension field in the database.
+ FieldFileExtension = "file_extension"
+ // FieldImageCount holds the string denoting the image_count field in the database.
+ FieldImageCount = "image_count"
+ // FieldErrorCode holds the string denoting the error_code field in the database.
+ FieldErrorCode = "error_code"
+ // FieldErrorMessage holds the string denoting the error_message field in the database.
+ FieldErrorMessage = "error_message"
+ // FieldBilledAmount holds the string denoting the billed_amount field in the database.
+ FieldBilledAmount = "billed_amount"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldIndexedAt holds the string denoting the indexed_at field in the database.
+ FieldIndexedAt = "indexed_at"
+ // Table holds the table name of the batchimageitem in the database.
+ Table = "batch_image_items"
+)
+
+// Columns holds all SQL columns for batchimageitem fields.
+var Columns = []string{
+ FieldID,
+ FieldJobID,
+ FieldCustomID,
+ FieldStatus,
+ FieldRequestHash,
+ FieldPromptPreview,
+ FieldProviderSourceObject,
+ FieldSourceLineNumber,
+ FieldSourceByteOffset,
+ FieldSourceByteLength,
+ FieldMimeType,
+ FieldFileExtension,
+ FieldImageCount,
+ FieldErrorCode,
+ FieldErrorMessage,
+ FieldBilledAmount,
+ FieldCreatedAt,
+ FieldIndexedAt,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // JobIDValidator is a validator for the "job_id" field. It is called by the builders before save.
+ JobIDValidator func(string) error
+ // CustomIDValidator is a validator for the "custom_id" field. It is called by the builders before save.
+ CustomIDValidator func(string) error
+ // StatusValidator is a validator for the "status" field. It is called by the builders before save.
+ StatusValidator func(string) error
+ // RequestHashValidator is a validator for the "request_hash" field. It is called by the builders before save.
+ RequestHashValidator func(string) error
+ // ProviderSourceObjectValidator is a validator for the "provider_source_object" field. It is called by the builders before save.
+ ProviderSourceObjectValidator func(string) error
+ // MimeTypeValidator is a validator for the "mime_type" field. It is called by the builders before save.
+ MimeTypeValidator func(string) error
+ // FileExtensionValidator is a validator for the "file_extension" field. It is called by the builders before save.
+ FileExtensionValidator func(string) error
+ // DefaultImageCount holds the default value on creation for the "image_count" field.
+ DefaultImageCount int
+ // ErrorCodeValidator is a validator for the "error_code" field. It is called by the builders before save.
+ ErrorCodeValidator func(string) error
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+)
+
+// OrderOption defines the ordering options for the BatchImageItem queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByJobID orders the results by the job_id field.
+func ByJobID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldJobID, opts...).ToFunc()
+}
+
+// ByCustomID orders the results by the custom_id field.
+func ByCustomID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCustomID, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByRequestHash orders the results by the request_hash field.
+func ByRequestHash(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldRequestHash, opts...).ToFunc()
+}
+
+// ByPromptPreview orders the results by the prompt_preview field.
+func ByPromptPreview(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldPromptPreview, opts...).ToFunc()
+}
+
+// ByProviderSourceObject orders the results by the provider_source_object field.
+func ByProviderSourceObject(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldProviderSourceObject, opts...).ToFunc()
+}
+
+// BySourceLineNumber orders the results by the source_line_number field.
+func BySourceLineNumber(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSourceLineNumber, opts...).ToFunc()
+}
+
+// BySourceByteOffset orders the results by the source_byte_offset field.
+func BySourceByteOffset(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSourceByteOffset, opts...).ToFunc()
+}
+
+// BySourceByteLength orders the results by the source_byte_length field.
+func BySourceByteLength(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSourceByteLength, opts...).ToFunc()
+}
+
+// ByMimeType orders the results by the mime_type field.
+func ByMimeType(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldMimeType, opts...).ToFunc()
+}
+
+// ByFileExtension orders the results by the file_extension field.
+func ByFileExtension(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldFileExtension, opts...).ToFunc()
+}
+
+// ByImageCount orders the results by the image_count field.
+func ByImageCount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldImageCount, opts...).ToFunc()
+}
+
+// ByErrorCode orders the results by the error_code field.
+func ByErrorCode(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldErrorCode, opts...).ToFunc()
+}
+
+// ByErrorMessage orders the results by the error_message field.
+func ByErrorMessage(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldErrorMessage, opts...).ToFunc()
+}
+
+// ByBilledAmount orders the results by the billed_amount field.
+func ByBilledAmount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldBilledAmount, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByIndexedAt orders the results by the indexed_at field.
+func ByIndexedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldIndexedAt, opts...).ToFunc()
+}
diff --git a/backend/ent/batchimageitem/where.go b/backend/ent/batchimageitem/where.go
new file mode 100644
index 0000000000..55dc32fde7
--- /dev/null
+++ b/backend/ent/batchimageitem/where.go
@@ -0,0 +1,1205 @@
+// Code generated by ent, DO NOT EDIT.
+
+package batchimageitem
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldID, id))
+}
+
+// JobID applies equality check predicate on the "job_id" field. It's identical to JobIDEQ.
+func JobID(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldJobID, v))
+}
+
+// CustomID applies equality check predicate on the "custom_id" field. It's identical to CustomIDEQ.
+func CustomID(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldCustomID, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldStatus, v))
+}
+
+// RequestHash applies equality check predicate on the "request_hash" field. It's identical to RequestHashEQ.
+func RequestHash(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldRequestHash, v))
+}
+
+// PromptPreview applies equality check predicate on the "prompt_preview" field. It's identical to PromptPreviewEQ.
+func PromptPreview(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldPromptPreview, v))
+}
+
+// ProviderSourceObject applies equality check predicate on the "provider_source_object" field. It's identical to ProviderSourceObjectEQ.
+func ProviderSourceObject(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldProviderSourceObject, v))
+}
+
+// SourceLineNumber applies equality check predicate on the "source_line_number" field. It's identical to SourceLineNumberEQ.
+func SourceLineNumber(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldSourceLineNumber, v))
+}
+
+// SourceByteOffset applies equality check predicate on the "source_byte_offset" field. It's identical to SourceByteOffsetEQ.
+func SourceByteOffset(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldSourceByteOffset, v))
+}
+
+// SourceByteLength applies equality check predicate on the "source_byte_length" field. It's identical to SourceByteLengthEQ.
+func SourceByteLength(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldSourceByteLength, v))
+}
+
+// MimeType applies equality check predicate on the "mime_type" field. It's identical to MimeTypeEQ.
+func MimeType(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldMimeType, v))
+}
+
+// FileExtension applies equality check predicate on the "file_extension" field. It's identical to FileExtensionEQ.
+func FileExtension(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldFileExtension, v))
+}
+
+// ImageCount applies equality check predicate on the "image_count" field. It's identical to ImageCountEQ.
+func ImageCount(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldImageCount, v))
+}
+
+// ErrorCode applies equality check predicate on the "error_code" field. It's identical to ErrorCodeEQ.
+func ErrorCode(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldErrorCode, v))
+}
+
+// ErrorMessage applies equality check predicate on the "error_message" field. It's identical to ErrorMessageEQ.
+func ErrorMessage(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldErrorMessage, v))
+}
+
+// BilledAmount applies equality check predicate on the "billed_amount" field. It's identical to BilledAmountEQ.
+func BilledAmount(v float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldBilledAmount, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// IndexedAt applies equality check predicate on the "indexed_at" field. It's identical to IndexedAtEQ.
+func IndexedAt(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldIndexedAt, v))
+}
+
+// JobIDEQ applies the EQ predicate on the "job_id" field.
+func JobIDEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldJobID, v))
+}
+
+// JobIDNEQ applies the NEQ predicate on the "job_id" field.
+func JobIDNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldJobID, v))
+}
+
+// JobIDIn applies the In predicate on the "job_id" field.
+func JobIDIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldJobID, vs...))
+}
+
+// JobIDNotIn applies the NotIn predicate on the "job_id" field.
+func JobIDNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldJobID, vs...))
+}
+
+// JobIDGT applies the GT predicate on the "job_id" field.
+func JobIDGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldJobID, v))
+}
+
+// JobIDGTE applies the GTE predicate on the "job_id" field.
+func JobIDGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldJobID, v))
+}
+
+// JobIDLT applies the LT predicate on the "job_id" field.
+func JobIDLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldJobID, v))
+}
+
+// JobIDLTE applies the LTE predicate on the "job_id" field.
+func JobIDLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldJobID, v))
+}
+
+// JobIDContains applies the Contains predicate on the "job_id" field.
+func JobIDContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldJobID, v))
+}
+
+// JobIDHasPrefix applies the HasPrefix predicate on the "job_id" field.
+func JobIDHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldJobID, v))
+}
+
+// JobIDHasSuffix applies the HasSuffix predicate on the "job_id" field.
+func JobIDHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldJobID, v))
+}
+
+// JobIDEqualFold applies the EqualFold predicate on the "job_id" field.
+func JobIDEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldJobID, v))
+}
+
+// JobIDContainsFold applies the ContainsFold predicate on the "job_id" field.
+func JobIDContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldJobID, v))
+}
+
+// CustomIDEQ applies the EQ predicate on the "custom_id" field.
+func CustomIDEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldCustomID, v))
+}
+
+// CustomIDNEQ applies the NEQ predicate on the "custom_id" field.
+func CustomIDNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldCustomID, v))
+}
+
+// CustomIDIn applies the In predicate on the "custom_id" field.
+func CustomIDIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldCustomID, vs...))
+}
+
+// CustomIDNotIn applies the NotIn predicate on the "custom_id" field.
+func CustomIDNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldCustomID, vs...))
+}
+
+// CustomIDGT applies the GT predicate on the "custom_id" field.
+func CustomIDGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldCustomID, v))
+}
+
+// CustomIDGTE applies the GTE predicate on the "custom_id" field.
+func CustomIDGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldCustomID, v))
+}
+
+// CustomIDLT applies the LT predicate on the "custom_id" field.
+func CustomIDLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldCustomID, v))
+}
+
+// CustomIDLTE applies the LTE predicate on the "custom_id" field.
+func CustomIDLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldCustomID, v))
+}
+
+// CustomIDContains applies the Contains predicate on the "custom_id" field.
+func CustomIDContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldCustomID, v))
+}
+
+// CustomIDHasPrefix applies the HasPrefix predicate on the "custom_id" field.
+func CustomIDHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldCustomID, v))
+}
+
+// CustomIDHasSuffix applies the HasSuffix predicate on the "custom_id" field.
+func CustomIDHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldCustomID, v))
+}
+
+// CustomIDEqualFold applies the EqualFold predicate on the "custom_id" field.
+func CustomIDEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldCustomID, v))
+}
+
+// CustomIDContainsFold applies the ContainsFold predicate on the "custom_id" field.
+func CustomIDContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldCustomID, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusContains applies the Contains predicate on the "status" field.
+func StatusContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldStatus, v))
+}
+
+// StatusHasPrefix applies the HasPrefix predicate on the "status" field.
+func StatusHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldStatus, v))
+}
+
+// StatusHasSuffix applies the HasSuffix predicate on the "status" field.
+func StatusHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldStatus, v))
+}
+
+// StatusEqualFold applies the EqualFold predicate on the "status" field.
+func StatusEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldStatus, v))
+}
+
+// StatusContainsFold applies the ContainsFold predicate on the "status" field.
+func StatusContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldStatus, v))
+}
+
+// RequestHashEQ applies the EQ predicate on the "request_hash" field.
+func RequestHashEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldRequestHash, v))
+}
+
+// RequestHashNEQ applies the NEQ predicate on the "request_hash" field.
+func RequestHashNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldRequestHash, v))
+}
+
+// RequestHashIn applies the In predicate on the "request_hash" field.
+func RequestHashIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldRequestHash, vs...))
+}
+
+// RequestHashNotIn applies the NotIn predicate on the "request_hash" field.
+func RequestHashNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldRequestHash, vs...))
+}
+
+// RequestHashGT applies the GT predicate on the "request_hash" field.
+func RequestHashGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldRequestHash, v))
+}
+
+// RequestHashGTE applies the GTE predicate on the "request_hash" field.
+func RequestHashGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldRequestHash, v))
+}
+
+// RequestHashLT applies the LT predicate on the "request_hash" field.
+func RequestHashLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldRequestHash, v))
+}
+
+// RequestHashLTE applies the LTE predicate on the "request_hash" field.
+func RequestHashLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldRequestHash, v))
+}
+
+// RequestHashContains applies the Contains predicate on the "request_hash" field.
+func RequestHashContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldRequestHash, v))
+}
+
+// RequestHashHasPrefix applies the HasPrefix predicate on the "request_hash" field.
+func RequestHashHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldRequestHash, v))
+}
+
+// RequestHashHasSuffix applies the HasSuffix predicate on the "request_hash" field.
+func RequestHashHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldRequestHash, v))
+}
+
+// RequestHashIsNil applies the IsNil predicate on the "request_hash" field.
+func RequestHashIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldRequestHash))
+}
+
+// RequestHashNotNil applies the NotNil predicate on the "request_hash" field.
+func RequestHashNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldRequestHash))
+}
+
+// RequestHashEqualFold applies the EqualFold predicate on the "request_hash" field.
+func RequestHashEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldRequestHash, v))
+}
+
+// RequestHashContainsFold applies the ContainsFold predicate on the "request_hash" field.
+func RequestHashContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldRequestHash, v))
+}
+
+// PromptPreviewEQ applies the EQ predicate on the "prompt_preview" field.
+func PromptPreviewEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldPromptPreview, v))
+}
+
+// PromptPreviewNEQ applies the NEQ predicate on the "prompt_preview" field.
+func PromptPreviewNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldPromptPreview, v))
+}
+
+// PromptPreviewIn applies the In predicate on the "prompt_preview" field.
+func PromptPreviewIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldPromptPreview, vs...))
+}
+
+// PromptPreviewNotIn applies the NotIn predicate on the "prompt_preview" field.
+func PromptPreviewNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldPromptPreview, vs...))
+}
+
+// PromptPreviewGT applies the GT predicate on the "prompt_preview" field.
+func PromptPreviewGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldPromptPreview, v))
+}
+
+// PromptPreviewGTE applies the GTE predicate on the "prompt_preview" field.
+func PromptPreviewGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldPromptPreview, v))
+}
+
+// PromptPreviewLT applies the LT predicate on the "prompt_preview" field.
+func PromptPreviewLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldPromptPreview, v))
+}
+
+// PromptPreviewLTE applies the LTE predicate on the "prompt_preview" field.
+func PromptPreviewLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldPromptPreview, v))
+}
+
+// PromptPreviewContains applies the Contains predicate on the "prompt_preview" field.
+func PromptPreviewContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldPromptPreview, v))
+}
+
+// PromptPreviewHasPrefix applies the HasPrefix predicate on the "prompt_preview" field.
+func PromptPreviewHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldPromptPreview, v))
+}
+
+// PromptPreviewHasSuffix applies the HasSuffix predicate on the "prompt_preview" field.
+func PromptPreviewHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldPromptPreview, v))
+}
+
+// PromptPreviewIsNil applies the IsNil predicate on the "prompt_preview" field.
+func PromptPreviewIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldPromptPreview))
+}
+
+// PromptPreviewNotNil applies the NotNil predicate on the "prompt_preview" field.
+func PromptPreviewNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldPromptPreview))
+}
+
+// PromptPreviewEqualFold applies the EqualFold predicate on the "prompt_preview" field.
+func PromptPreviewEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldPromptPreview, v))
+}
+
+// PromptPreviewContainsFold applies the ContainsFold predicate on the "prompt_preview" field.
+func PromptPreviewContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldPromptPreview, v))
+}
+
+// ProviderSourceObjectEQ applies the EQ predicate on the "provider_source_object" field.
+func ProviderSourceObjectEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectNEQ applies the NEQ predicate on the "provider_source_object" field.
+func ProviderSourceObjectNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectIn applies the In predicate on the "provider_source_object" field.
+func ProviderSourceObjectIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldProviderSourceObject, vs...))
+}
+
+// ProviderSourceObjectNotIn applies the NotIn predicate on the "provider_source_object" field.
+func ProviderSourceObjectNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldProviderSourceObject, vs...))
+}
+
+// ProviderSourceObjectGT applies the GT predicate on the "provider_source_object" field.
+func ProviderSourceObjectGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectGTE applies the GTE predicate on the "provider_source_object" field.
+func ProviderSourceObjectGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectLT applies the LT predicate on the "provider_source_object" field.
+func ProviderSourceObjectLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectLTE applies the LTE predicate on the "provider_source_object" field.
+func ProviderSourceObjectLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectContains applies the Contains predicate on the "provider_source_object" field.
+func ProviderSourceObjectContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectHasPrefix applies the HasPrefix predicate on the "provider_source_object" field.
+func ProviderSourceObjectHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectHasSuffix applies the HasSuffix predicate on the "provider_source_object" field.
+func ProviderSourceObjectHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectIsNil applies the IsNil predicate on the "provider_source_object" field.
+func ProviderSourceObjectIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldProviderSourceObject))
+}
+
+// ProviderSourceObjectNotNil applies the NotNil predicate on the "provider_source_object" field.
+func ProviderSourceObjectNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldProviderSourceObject))
+}
+
+// ProviderSourceObjectEqualFold applies the EqualFold predicate on the "provider_source_object" field.
+func ProviderSourceObjectEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldProviderSourceObject, v))
+}
+
+// ProviderSourceObjectContainsFold applies the ContainsFold predicate on the "provider_source_object" field.
+func ProviderSourceObjectContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldProviderSourceObject, v))
+}
+
+// SourceLineNumberEQ applies the EQ predicate on the "source_line_number" field.
+func SourceLineNumberEQ(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldSourceLineNumber, v))
+}
+
+// SourceLineNumberNEQ applies the NEQ predicate on the "source_line_number" field.
+func SourceLineNumberNEQ(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldSourceLineNumber, v))
+}
+
+// SourceLineNumberIn applies the In predicate on the "source_line_number" field.
+func SourceLineNumberIn(vs ...int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldSourceLineNumber, vs...))
+}
+
+// SourceLineNumberNotIn applies the NotIn predicate on the "source_line_number" field.
+func SourceLineNumberNotIn(vs ...int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldSourceLineNumber, vs...))
+}
+
+// SourceLineNumberGT applies the GT predicate on the "source_line_number" field.
+func SourceLineNumberGT(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldSourceLineNumber, v))
+}
+
+// SourceLineNumberGTE applies the GTE predicate on the "source_line_number" field.
+func SourceLineNumberGTE(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldSourceLineNumber, v))
+}
+
+// SourceLineNumberLT applies the LT predicate on the "source_line_number" field.
+func SourceLineNumberLT(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldSourceLineNumber, v))
+}
+
+// SourceLineNumberLTE applies the LTE predicate on the "source_line_number" field.
+func SourceLineNumberLTE(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldSourceLineNumber, v))
+}
+
+// SourceLineNumberIsNil applies the IsNil predicate on the "source_line_number" field.
+func SourceLineNumberIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldSourceLineNumber))
+}
+
+// SourceLineNumberNotNil applies the NotNil predicate on the "source_line_number" field.
+func SourceLineNumberNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldSourceLineNumber))
+}
+
+// SourceByteOffsetEQ applies the EQ predicate on the "source_byte_offset" field.
+func SourceByteOffsetEQ(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldSourceByteOffset, v))
+}
+
+// SourceByteOffsetNEQ applies the NEQ predicate on the "source_byte_offset" field.
+func SourceByteOffsetNEQ(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldSourceByteOffset, v))
+}
+
+// SourceByteOffsetIn applies the In predicate on the "source_byte_offset" field.
+func SourceByteOffsetIn(vs ...int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldSourceByteOffset, vs...))
+}
+
+// SourceByteOffsetNotIn applies the NotIn predicate on the "source_byte_offset" field.
+func SourceByteOffsetNotIn(vs ...int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldSourceByteOffset, vs...))
+}
+
+// SourceByteOffsetGT applies the GT predicate on the "source_byte_offset" field.
+func SourceByteOffsetGT(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldSourceByteOffset, v))
+}
+
+// SourceByteOffsetGTE applies the GTE predicate on the "source_byte_offset" field.
+func SourceByteOffsetGTE(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldSourceByteOffset, v))
+}
+
+// SourceByteOffsetLT applies the LT predicate on the "source_byte_offset" field.
+func SourceByteOffsetLT(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldSourceByteOffset, v))
+}
+
+// SourceByteOffsetLTE applies the LTE predicate on the "source_byte_offset" field.
+func SourceByteOffsetLTE(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldSourceByteOffset, v))
+}
+
+// SourceByteOffsetIsNil applies the IsNil predicate on the "source_byte_offset" field.
+func SourceByteOffsetIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldSourceByteOffset))
+}
+
+// SourceByteOffsetNotNil applies the NotNil predicate on the "source_byte_offset" field.
+func SourceByteOffsetNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldSourceByteOffset))
+}
+
+// SourceByteLengthEQ applies the EQ predicate on the "source_byte_length" field.
+func SourceByteLengthEQ(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldSourceByteLength, v))
+}
+
+// SourceByteLengthNEQ applies the NEQ predicate on the "source_byte_length" field.
+func SourceByteLengthNEQ(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldSourceByteLength, v))
+}
+
+// SourceByteLengthIn applies the In predicate on the "source_byte_length" field.
+func SourceByteLengthIn(vs ...int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldSourceByteLength, vs...))
+}
+
+// SourceByteLengthNotIn applies the NotIn predicate on the "source_byte_length" field.
+func SourceByteLengthNotIn(vs ...int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldSourceByteLength, vs...))
+}
+
+// SourceByteLengthGT applies the GT predicate on the "source_byte_length" field.
+func SourceByteLengthGT(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldSourceByteLength, v))
+}
+
+// SourceByteLengthGTE applies the GTE predicate on the "source_byte_length" field.
+func SourceByteLengthGTE(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldSourceByteLength, v))
+}
+
+// SourceByteLengthLT applies the LT predicate on the "source_byte_length" field.
+func SourceByteLengthLT(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldSourceByteLength, v))
+}
+
+// SourceByteLengthLTE applies the LTE predicate on the "source_byte_length" field.
+func SourceByteLengthLTE(v int64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldSourceByteLength, v))
+}
+
+// SourceByteLengthIsNil applies the IsNil predicate on the "source_byte_length" field.
+func SourceByteLengthIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldSourceByteLength))
+}
+
+// SourceByteLengthNotNil applies the NotNil predicate on the "source_byte_length" field.
+func SourceByteLengthNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldSourceByteLength))
+}
+
+// MimeTypeEQ applies the EQ predicate on the "mime_type" field.
+func MimeTypeEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldMimeType, v))
+}
+
+// MimeTypeNEQ applies the NEQ predicate on the "mime_type" field.
+func MimeTypeNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldMimeType, v))
+}
+
+// MimeTypeIn applies the In predicate on the "mime_type" field.
+func MimeTypeIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldMimeType, vs...))
+}
+
+// MimeTypeNotIn applies the NotIn predicate on the "mime_type" field.
+func MimeTypeNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldMimeType, vs...))
+}
+
+// MimeTypeGT applies the GT predicate on the "mime_type" field.
+func MimeTypeGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldMimeType, v))
+}
+
+// MimeTypeGTE applies the GTE predicate on the "mime_type" field.
+func MimeTypeGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldMimeType, v))
+}
+
+// MimeTypeLT applies the LT predicate on the "mime_type" field.
+func MimeTypeLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldMimeType, v))
+}
+
+// MimeTypeLTE applies the LTE predicate on the "mime_type" field.
+func MimeTypeLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldMimeType, v))
+}
+
+// MimeTypeContains applies the Contains predicate on the "mime_type" field.
+func MimeTypeContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldMimeType, v))
+}
+
+// MimeTypeHasPrefix applies the HasPrefix predicate on the "mime_type" field.
+func MimeTypeHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldMimeType, v))
+}
+
+// MimeTypeHasSuffix applies the HasSuffix predicate on the "mime_type" field.
+func MimeTypeHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldMimeType, v))
+}
+
+// MimeTypeIsNil applies the IsNil predicate on the "mime_type" field.
+func MimeTypeIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldMimeType))
+}
+
+// MimeTypeNotNil applies the NotNil predicate on the "mime_type" field.
+func MimeTypeNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldMimeType))
+}
+
+// MimeTypeEqualFold applies the EqualFold predicate on the "mime_type" field.
+func MimeTypeEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldMimeType, v))
+}
+
+// MimeTypeContainsFold applies the ContainsFold predicate on the "mime_type" field.
+func MimeTypeContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldMimeType, v))
+}
+
+// FileExtensionEQ applies the EQ predicate on the "file_extension" field.
+func FileExtensionEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldFileExtension, v))
+}
+
+// FileExtensionNEQ applies the NEQ predicate on the "file_extension" field.
+func FileExtensionNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldFileExtension, v))
+}
+
+// FileExtensionIn applies the In predicate on the "file_extension" field.
+func FileExtensionIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldFileExtension, vs...))
+}
+
+// FileExtensionNotIn applies the NotIn predicate on the "file_extension" field.
+func FileExtensionNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldFileExtension, vs...))
+}
+
+// FileExtensionGT applies the GT predicate on the "file_extension" field.
+func FileExtensionGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldFileExtension, v))
+}
+
+// FileExtensionGTE applies the GTE predicate on the "file_extension" field.
+func FileExtensionGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldFileExtension, v))
+}
+
+// FileExtensionLT applies the LT predicate on the "file_extension" field.
+func FileExtensionLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldFileExtension, v))
+}
+
+// FileExtensionLTE applies the LTE predicate on the "file_extension" field.
+func FileExtensionLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldFileExtension, v))
+}
+
+// FileExtensionContains applies the Contains predicate on the "file_extension" field.
+func FileExtensionContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldFileExtension, v))
+}
+
+// FileExtensionHasPrefix applies the HasPrefix predicate on the "file_extension" field.
+func FileExtensionHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldFileExtension, v))
+}
+
+// FileExtensionHasSuffix applies the HasSuffix predicate on the "file_extension" field.
+func FileExtensionHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldFileExtension, v))
+}
+
+// FileExtensionIsNil applies the IsNil predicate on the "file_extension" field.
+func FileExtensionIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldFileExtension))
+}
+
+// FileExtensionNotNil applies the NotNil predicate on the "file_extension" field.
+func FileExtensionNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldFileExtension))
+}
+
+// FileExtensionEqualFold applies the EqualFold predicate on the "file_extension" field.
+func FileExtensionEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldFileExtension, v))
+}
+
+// FileExtensionContainsFold applies the ContainsFold predicate on the "file_extension" field.
+func FileExtensionContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldFileExtension, v))
+}
+
+// ImageCountEQ applies the EQ predicate on the "image_count" field.
+func ImageCountEQ(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldImageCount, v))
+}
+
+// ImageCountNEQ applies the NEQ predicate on the "image_count" field.
+func ImageCountNEQ(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldImageCount, v))
+}
+
+// ImageCountIn applies the In predicate on the "image_count" field.
+func ImageCountIn(vs ...int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldImageCount, vs...))
+}
+
+// ImageCountNotIn applies the NotIn predicate on the "image_count" field.
+func ImageCountNotIn(vs ...int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldImageCount, vs...))
+}
+
+// ImageCountGT applies the GT predicate on the "image_count" field.
+func ImageCountGT(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldImageCount, v))
+}
+
+// ImageCountGTE applies the GTE predicate on the "image_count" field.
+func ImageCountGTE(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldImageCount, v))
+}
+
+// ImageCountLT applies the LT predicate on the "image_count" field.
+func ImageCountLT(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldImageCount, v))
+}
+
+// ImageCountLTE applies the LTE predicate on the "image_count" field.
+func ImageCountLTE(v int) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldImageCount, v))
+}
+
+// ErrorCodeEQ applies the EQ predicate on the "error_code" field.
+func ErrorCodeEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldErrorCode, v))
+}
+
+// ErrorCodeNEQ applies the NEQ predicate on the "error_code" field.
+func ErrorCodeNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldErrorCode, v))
+}
+
+// ErrorCodeIn applies the In predicate on the "error_code" field.
+func ErrorCodeIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldErrorCode, vs...))
+}
+
+// ErrorCodeNotIn applies the NotIn predicate on the "error_code" field.
+func ErrorCodeNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldErrorCode, vs...))
+}
+
+// ErrorCodeGT applies the GT predicate on the "error_code" field.
+func ErrorCodeGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldErrorCode, v))
+}
+
+// ErrorCodeGTE applies the GTE predicate on the "error_code" field.
+func ErrorCodeGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldErrorCode, v))
+}
+
+// ErrorCodeLT applies the LT predicate on the "error_code" field.
+func ErrorCodeLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldErrorCode, v))
+}
+
+// ErrorCodeLTE applies the LTE predicate on the "error_code" field.
+func ErrorCodeLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldErrorCode, v))
+}
+
+// ErrorCodeContains applies the Contains predicate on the "error_code" field.
+func ErrorCodeContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldErrorCode, v))
+}
+
+// ErrorCodeHasPrefix applies the HasPrefix predicate on the "error_code" field.
+func ErrorCodeHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldErrorCode, v))
+}
+
+// ErrorCodeHasSuffix applies the HasSuffix predicate on the "error_code" field.
+func ErrorCodeHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldErrorCode, v))
+}
+
+// ErrorCodeIsNil applies the IsNil predicate on the "error_code" field.
+func ErrorCodeIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldErrorCode))
+}
+
+// ErrorCodeNotNil applies the NotNil predicate on the "error_code" field.
+func ErrorCodeNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldErrorCode))
+}
+
+// ErrorCodeEqualFold applies the EqualFold predicate on the "error_code" field.
+func ErrorCodeEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldErrorCode, v))
+}
+
+// ErrorCodeContainsFold applies the ContainsFold predicate on the "error_code" field.
+func ErrorCodeContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldErrorCode, v))
+}
+
+// ErrorMessageEQ applies the EQ predicate on the "error_message" field.
+func ErrorMessageEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldErrorMessage, v))
+}
+
+// ErrorMessageNEQ applies the NEQ predicate on the "error_message" field.
+func ErrorMessageNEQ(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldErrorMessage, v))
+}
+
+// ErrorMessageIn applies the In predicate on the "error_message" field.
+func ErrorMessageIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldErrorMessage, vs...))
+}
+
+// ErrorMessageNotIn applies the NotIn predicate on the "error_message" field.
+func ErrorMessageNotIn(vs ...string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldErrorMessage, vs...))
+}
+
+// ErrorMessageGT applies the GT predicate on the "error_message" field.
+func ErrorMessageGT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldErrorMessage, v))
+}
+
+// ErrorMessageGTE applies the GTE predicate on the "error_message" field.
+func ErrorMessageGTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldErrorMessage, v))
+}
+
+// ErrorMessageLT applies the LT predicate on the "error_message" field.
+func ErrorMessageLT(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldErrorMessage, v))
+}
+
+// ErrorMessageLTE applies the LTE predicate on the "error_message" field.
+func ErrorMessageLTE(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldErrorMessage, v))
+}
+
+// ErrorMessageContains applies the Contains predicate on the "error_message" field.
+func ErrorMessageContains(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContains(FieldErrorMessage, v))
+}
+
+// ErrorMessageHasPrefix applies the HasPrefix predicate on the "error_message" field.
+func ErrorMessageHasPrefix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasPrefix(FieldErrorMessage, v))
+}
+
+// ErrorMessageHasSuffix applies the HasSuffix predicate on the "error_message" field.
+func ErrorMessageHasSuffix(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldHasSuffix(FieldErrorMessage, v))
+}
+
+// ErrorMessageIsNil applies the IsNil predicate on the "error_message" field.
+func ErrorMessageIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldErrorMessage))
+}
+
+// ErrorMessageNotNil applies the NotNil predicate on the "error_message" field.
+func ErrorMessageNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldErrorMessage))
+}
+
+// ErrorMessageEqualFold applies the EqualFold predicate on the "error_message" field.
+func ErrorMessageEqualFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEqualFold(FieldErrorMessage, v))
+}
+
+// ErrorMessageContainsFold applies the ContainsFold predicate on the "error_message" field.
+func ErrorMessageContainsFold(v string) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldContainsFold(FieldErrorMessage, v))
+}
+
+// BilledAmountEQ applies the EQ predicate on the "billed_amount" field.
+func BilledAmountEQ(v float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldBilledAmount, v))
+}
+
+// BilledAmountNEQ applies the NEQ predicate on the "billed_amount" field.
+func BilledAmountNEQ(v float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldBilledAmount, v))
+}
+
+// BilledAmountIn applies the In predicate on the "billed_amount" field.
+func BilledAmountIn(vs ...float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldBilledAmount, vs...))
+}
+
+// BilledAmountNotIn applies the NotIn predicate on the "billed_amount" field.
+func BilledAmountNotIn(vs ...float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldBilledAmount, vs...))
+}
+
+// BilledAmountGT applies the GT predicate on the "billed_amount" field.
+func BilledAmountGT(v float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldBilledAmount, v))
+}
+
+// BilledAmountGTE applies the GTE predicate on the "billed_amount" field.
+func BilledAmountGTE(v float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldBilledAmount, v))
+}
+
+// BilledAmountLT applies the LT predicate on the "billed_amount" field.
+func BilledAmountLT(v float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldBilledAmount, v))
+}
+
+// BilledAmountLTE applies the LTE predicate on the "billed_amount" field.
+func BilledAmountLTE(v float64) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldBilledAmount, v))
+}
+
+// BilledAmountIsNil applies the IsNil predicate on the "billed_amount" field.
+func BilledAmountIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldBilledAmount))
+}
+
+// BilledAmountNotNil applies the NotNil predicate on the "billed_amount" field.
+func BilledAmountNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldBilledAmount))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// IndexedAtEQ applies the EQ predicate on the "indexed_at" field.
+func IndexedAtEQ(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldEQ(FieldIndexedAt, v))
+}
+
+// IndexedAtNEQ applies the NEQ predicate on the "indexed_at" field.
+func IndexedAtNEQ(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNEQ(FieldIndexedAt, v))
+}
+
+// IndexedAtIn applies the In predicate on the "indexed_at" field.
+func IndexedAtIn(vs ...time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIn(FieldIndexedAt, vs...))
+}
+
+// IndexedAtNotIn applies the NotIn predicate on the "indexed_at" field.
+func IndexedAtNotIn(vs ...time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotIn(FieldIndexedAt, vs...))
+}
+
+// IndexedAtGT applies the GT predicate on the "indexed_at" field.
+func IndexedAtGT(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGT(FieldIndexedAt, v))
+}
+
+// IndexedAtGTE applies the GTE predicate on the "indexed_at" field.
+func IndexedAtGTE(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldGTE(FieldIndexedAt, v))
+}
+
+// IndexedAtLT applies the LT predicate on the "indexed_at" field.
+func IndexedAtLT(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLT(FieldIndexedAt, v))
+}
+
+// IndexedAtLTE applies the LTE predicate on the "indexed_at" field.
+func IndexedAtLTE(v time.Time) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldLTE(FieldIndexedAt, v))
+}
+
+// IndexedAtIsNil applies the IsNil predicate on the "indexed_at" field.
+func IndexedAtIsNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldIsNull(FieldIndexedAt))
+}
+
+// IndexedAtNotNil applies the NotNil predicate on the "indexed_at" field.
+func IndexedAtNotNil() predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.FieldNotNull(FieldIndexedAt))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.BatchImageItem) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.BatchImageItem) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.BatchImageItem) predicate.BatchImageItem {
+ return predicate.BatchImageItem(sql.NotPredicates(p))
+}
diff --git a/backend/ent/batchimageitem_create.go b/backend/ent/batchimageitem_create.go
new file mode 100644
index 0000000000..f9ee14998a
--- /dev/null
+++ b/backend/ent/batchimageitem_create.go
@@ -0,0 +1,1745 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+)
+
+// BatchImageItemCreate is the builder for creating a BatchImageItem entity.
+type BatchImageItemCreate struct {
+ config
+ mutation *BatchImageItemMutation
+ hooks []Hook
+ conflict []sql.ConflictOption
+}
+
+// SetJobID sets the "job_id" field.
+func (_c *BatchImageItemCreate) SetJobID(v string) *BatchImageItemCreate {
+ _c.mutation.SetJobID(v)
+ return _c
+}
+
+// SetCustomID sets the "custom_id" field.
+func (_c *BatchImageItemCreate) SetCustomID(v string) *BatchImageItemCreate {
+ _c.mutation.SetCustomID(v)
+ return _c
+}
+
+// SetStatus sets the "status" field.
+func (_c *BatchImageItemCreate) SetStatus(v string) *BatchImageItemCreate {
+ _c.mutation.SetStatus(v)
+ return _c
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (_c *BatchImageItemCreate) SetRequestHash(v string) *BatchImageItemCreate {
+ _c.mutation.SetRequestHash(v)
+ return _c
+}
+
+// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableRequestHash(v *string) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetRequestHash(*v)
+ }
+ return _c
+}
+
+// SetPromptPreview sets the "prompt_preview" field.
+func (_c *BatchImageItemCreate) SetPromptPreview(v string) *BatchImageItemCreate {
+ _c.mutation.SetPromptPreview(v)
+ return _c
+}
+
+// SetNillablePromptPreview sets the "prompt_preview" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillablePromptPreview(v *string) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetPromptPreview(*v)
+ }
+ return _c
+}
+
+// SetProviderSourceObject sets the "provider_source_object" field.
+func (_c *BatchImageItemCreate) SetProviderSourceObject(v string) *BatchImageItemCreate {
+ _c.mutation.SetProviderSourceObject(v)
+ return _c
+}
+
+// SetNillableProviderSourceObject sets the "provider_source_object" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableProviderSourceObject(v *string) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetProviderSourceObject(*v)
+ }
+ return _c
+}
+
+// SetSourceLineNumber sets the "source_line_number" field.
+func (_c *BatchImageItemCreate) SetSourceLineNumber(v int) *BatchImageItemCreate {
+ _c.mutation.SetSourceLineNumber(v)
+ return _c
+}
+
+// SetNillableSourceLineNumber sets the "source_line_number" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableSourceLineNumber(v *int) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetSourceLineNumber(*v)
+ }
+ return _c
+}
+
+// SetSourceByteOffset sets the "source_byte_offset" field.
+func (_c *BatchImageItemCreate) SetSourceByteOffset(v int64) *BatchImageItemCreate {
+ _c.mutation.SetSourceByteOffset(v)
+ return _c
+}
+
+// SetNillableSourceByteOffset sets the "source_byte_offset" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableSourceByteOffset(v *int64) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetSourceByteOffset(*v)
+ }
+ return _c
+}
+
+// SetSourceByteLength sets the "source_byte_length" field.
+func (_c *BatchImageItemCreate) SetSourceByteLength(v int64) *BatchImageItemCreate {
+ _c.mutation.SetSourceByteLength(v)
+ return _c
+}
+
+// SetNillableSourceByteLength sets the "source_byte_length" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableSourceByteLength(v *int64) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetSourceByteLength(*v)
+ }
+ return _c
+}
+
+// SetMimeType sets the "mime_type" field.
+func (_c *BatchImageItemCreate) SetMimeType(v string) *BatchImageItemCreate {
+ _c.mutation.SetMimeType(v)
+ return _c
+}
+
+// SetNillableMimeType sets the "mime_type" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableMimeType(v *string) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetMimeType(*v)
+ }
+ return _c
+}
+
+// SetFileExtension sets the "file_extension" field.
+func (_c *BatchImageItemCreate) SetFileExtension(v string) *BatchImageItemCreate {
+ _c.mutation.SetFileExtension(v)
+ return _c
+}
+
+// SetNillableFileExtension sets the "file_extension" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableFileExtension(v *string) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetFileExtension(*v)
+ }
+ return _c
+}
+
+// SetImageCount sets the "image_count" field.
+func (_c *BatchImageItemCreate) SetImageCount(v int) *BatchImageItemCreate {
+ _c.mutation.SetImageCount(v)
+ return _c
+}
+
+// SetNillableImageCount sets the "image_count" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableImageCount(v *int) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetImageCount(*v)
+ }
+ return _c
+}
+
+// SetErrorCode sets the "error_code" field.
+func (_c *BatchImageItemCreate) SetErrorCode(v string) *BatchImageItemCreate {
+ _c.mutation.SetErrorCode(v)
+ return _c
+}
+
+// SetNillableErrorCode sets the "error_code" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableErrorCode(v *string) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetErrorCode(*v)
+ }
+ return _c
+}
+
+// SetErrorMessage sets the "error_message" field.
+func (_c *BatchImageItemCreate) SetErrorMessage(v string) *BatchImageItemCreate {
+ _c.mutation.SetErrorMessage(v)
+ return _c
+}
+
+// SetNillableErrorMessage sets the "error_message" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableErrorMessage(v *string) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetErrorMessage(*v)
+ }
+ return _c
+}
+
+// SetBilledAmount sets the "billed_amount" field.
+func (_c *BatchImageItemCreate) SetBilledAmount(v float64) *BatchImageItemCreate {
+ _c.mutation.SetBilledAmount(v)
+ return _c
+}
+
+// SetNillableBilledAmount sets the "billed_amount" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableBilledAmount(v *float64) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetBilledAmount(*v)
+ }
+ return _c
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (_c *BatchImageItemCreate) SetCreatedAt(v time.Time) *BatchImageItemCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableCreatedAt(v *time.Time) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
+ }
+ return _c
+}
+
+// SetIndexedAt sets the "indexed_at" field.
+func (_c *BatchImageItemCreate) SetIndexedAt(v time.Time) *BatchImageItemCreate {
+ _c.mutation.SetIndexedAt(v)
+ return _c
+}
+
+// SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil.
+func (_c *BatchImageItemCreate) SetNillableIndexedAt(v *time.Time) *BatchImageItemCreate {
+ if v != nil {
+ _c.SetIndexedAt(*v)
+ }
+ return _c
+}
+
+// Mutation returns the BatchImageItemMutation object of the builder.
+func (_c *BatchImageItemCreate) Mutation() *BatchImageItemMutation {
+ return _c.mutation
+}
+
+// Save creates the BatchImageItem in the database.
+func (_c *BatchImageItemCreate) Save(ctx context.Context) (*BatchImageItem, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (_c *BatchImageItemCreate) SaveX(ctx context.Context) *BatchImageItem {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *BatchImageItemCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *BatchImageItemCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (_c *BatchImageItemCreate) defaults() {
+ if _, ok := _c.mutation.ImageCount(); !ok {
+ v := batchimageitem.DefaultImageCount
+ _c.mutation.SetImageCount(v)
+ }
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ v := batchimageitem.DefaultCreatedAt()
+ _c.mutation.SetCreatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_c *BatchImageItemCreate) check() error {
+ if _, ok := _c.mutation.JobID(); !ok {
+ return &ValidationError{Name: "job_id", err: errors.New(`ent: missing required field "BatchImageItem.job_id"`)}
+ }
+ if v, ok := _c.mutation.JobID(); ok {
+ if err := batchimageitem.JobIDValidator(v); err != nil {
+ return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.job_id": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.CustomID(); !ok {
+ return &ValidationError{Name: "custom_id", err: errors.New(`ent: missing required field "BatchImageItem.custom_id"`)}
+ }
+ if v, ok := _c.mutation.CustomID(); ok {
+ if err := batchimageitem.CustomIDValidator(v); err != nil {
+ return &ValidationError{Name: "custom_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.custom_id": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.Status(); !ok {
+ return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "BatchImageItem.status"`)}
+ }
+ if v, ok := _c.mutation.Status(); ok {
+ if err := batchimageitem.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.status": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.RequestHash(); ok {
+ if err := batchimageitem.RequestHashValidator(v); err != nil {
+ return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.request_hash": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.ProviderSourceObject(); ok {
+ if err := batchimageitem.ProviderSourceObjectValidator(v); err != nil {
+ return &ValidationError{Name: "provider_source_object", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.provider_source_object": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.MimeType(); ok {
+ if err := batchimageitem.MimeTypeValidator(v); err != nil {
+ return &ValidationError{Name: "mime_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.mime_type": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.FileExtension(); ok {
+ if err := batchimageitem.FileExtensionValidator(v); err != nil {
+ return &ValidationError{Name: "file_extension", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.file_extension": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.ImageCount(); !ok {
+ return &ValidationError{Name: "image_count", err: errors.New(`ent: missing required field "BatchImageItem.image_count"`)}
+ }
+ if v, ok := _c.mutation.ErrorCode(); ok {
+ if err := batchimageitem.ErrorCodeValidator(v); err != nil {
+ return &ValidationError{Name: "error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.error_code": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BatchImageItem.created_at"`)}
+ }
+ return nil
+}
+
+func (_c *BatchImageItemCreate) sqlSave(ctx context.Context) (*BatchImageItem, error) {
+ if err := _c.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ id := _spec.ID.Value.(int64)
+ _node.ID = int64(id)
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
+ return _node, nil
+}
+
+func (_c *BatchImageItemCreate) createSpec() (*BatchImageItem, *sqlgraph.CreateSpec) {
+ var (
+ _node = &BatchImageItem{config: _c.config}
+ _spec = sqlgraph.NewCreateSpec(batchimageitem.Table, sqlgraph.NewFieldSpec(batchimageitem.FieldID, field.TypeInt64))
+ )
+ _spec.OnConflict = _c.conflict
+ if value, ok := _c.mutation.JobID(); ok {
+ _spec.SetField(batchimageitem.FieldJobID, field.TypeString, value)
+ _node.JobID = value
+ }
+ if value, ok := _c.mutation.CustomID(); ok {
+ _spec.SetField(batchimageitem.FieldCustomID, field.TypeString, value)
+ _node.CustomID = value
+ }
+ if value, ok := _c.mutation.Status(); ok {
+ _spec.SetField(batchimageitem.FieldStatus, field.TypeString, value)
+ _node.Status = value
+ }
+ if value, ok := _c.mutation.RequestHash(); ok {
+ _spec.SetField(batchimageitem.FieldRequestHash, field.TypeString, value)
+ _node.RequestHash = &value
+ }
+ if value, ok := _c.mutation.PromptPreview(); ok {
+ _spec.SetField(batchimageitem.FieldPromptPreview, field.TypeString, value)
+ _node.PromptPreview = &value
+ }
+ if value, ok := _c.mutation.ProviderSourceObject(); ok {
+ _spec.SetField(batchimageitem.FieldProviderSourceObject, field.TypeString, value)
+ _node.ProviderSourceObject = &value
+ }
+ if value, ok := _c.mutation.SourceLineNumber(); ok {
+ _spec.SetField(batchimageitem.FieldSourceLineNumber, field.TypeInt, value)
+ _node.SourceLineNumber = &value
+ }
+ if value, ok := _c.mutation.SourceByteOffset(); ok {
+ _spec.SetField(batchimageitem.FieldSourceByteOffset, field.TypeInt64, value)
+ _node.SourceByteOffset = &value
+ }
+ if value, ok := _c.mutation.SourceByteLength(); ok {
+ _spec.SetField(batchimageitem.FieldSourceByteLength, field.TypeInt64, value)
+ _node.SourceByteLength = &value
+ }
+ if value, ok := _c.mutation.MimeType(); ok {
+ _spec.SetField(batchimageitem.FieldMimeType, field.TypeString, value)
+ _node.MimeType = &value
+ }
+ if value, ok := _c.mutation.FileExtension(); ok {
+ _spec.SetField(batchimageitem.FieldFileExtension, field.TypeString, value)
+ _node.FileExtension = &value
+ }
+ if value, ok := _c.mutation.ImageCount(); ok {
+ _spec.SetField(batchimageitem.FieldImageCount, field.TypeInt, value)
+ _node.ImageCount = value
+ }
+ if value, ok := _c.mutation.ErrorCode(); ok {
+ _spec.SetField(batchimageitem.FieldErrorCode, field.TypeString, value)
+ _node.ErrorCode = &value
+ }
+ if value, ok := _c.mutation.ErrorMessage(); ok {
+ _spec.SetField(batchimageitem.FieldErrorMessage, field.TypeString, value)
+ _node.ErrorMessage = &value
+ }
+ if value, ok := _c.mutation.BilledAmount(); ok {
+ _spec.SetField(batchimageitem.FieldBilledAmount, field.TypeFloat64, value)
+ _node.BilledAmount = &value
+ }
+ if value, ok := _c.mutation.CreatedAt(); ok {
+ _spec.SetField(batchimageitem.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := _c.mutation.IndexedAt(); ok {
+ _spec.SetField(batchimageitem.FieldIndexedAt, field.TypeTime, value)
+ _node.IndexedAt = &value
+ }
+ return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+// client.BatchImageItem.Create().
+// SetJobID(v).
+// OnConflict(
+// // Update the row with the new values
+// // the was proposed for insertion.
+// sql.ResolveWithNewValues(),
+// ).
+// // Override some of the fields with custom
+// // update values.
+// Update(func(u *ent.BatchImageItemUpsert) {
+// SetJobID(v+v).
+// }).
+// Exec(ctx)
+func (_c *BatchImageItemCreate) OnConflict(opts ...sql.ConflictOption) *BatchImageItemUpsertOne {
+ _c.conflict = opts
+ return &BatchImageItemUpsertOne{
+ create: _c,
+ }
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+// client.BatchImageItem.Create().
+// OnConflict(sql.ConflictColumns(columns...)).
+// Exec(ctx)
+func (_c *BatchImageItemCreate) OnConflictColumns(columns ...string) *BatchImageItemUpsertOne {
+ _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
+ return &BatchImageItemUpsertOne{
+ create: _c,
+ }
+}
+
+type (
+ // BatchImageItemUpsertOne is the builder for "upsert"-ing
+ // one BatchImageItem node.
+ BatchImageItemUpsertOne struct {
+ create *BatchImageItemCreate
+ }
+
+ // BatchImageItemUpsert is the "OnConflict" setter.
+ BatchImageItemUpsert struct {
+ *sql.UpdateSet
+ }
+)
+
+// SetJobID sets the "job_id" field.
+func (u *BatchImageItemUpsert) SetJobID(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldJobID, v)
+ return u
+}
+
+// UpdateJobID sets the "job_id" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateJobID() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldJobID)
+ return u
+}
+
+// SetCustomID sets the "custom_id" field.
+func (u *BatchImageItemUpsert) SetCustomID(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldCustomID, v)
+ return u
+}
+
+// UpdateCustomID sets the "custom_id" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateCustomID() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldCustomID)
+ return u
+}
+
+// SetStatus sets the "status" field.
+func (u *BatchImageItemUpsert) SetStatus(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldStatus, v)
+ return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateStatus() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldStatus)
+ return u
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (u *BatchImageItemUpsert) SetRequestHash(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldRequestHash, v)
+ return u
+}
+
+// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateRequestHash() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldRequestHash)
+ return u
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (u *BatchImageItemUpsert) ClearRequestHash() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldRequestHash)
+ return u
+}
+
+// SetPromptPreview sets the "prompt_preview" field.
+func (u *BatchImageItemUpsert) SetPromptPreview(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldPromptPreview, v)
+ return u
+}
+
+// UpdatePromptPreview sets the "prompt_preview" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdatePromptPreview() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldPromptPreview)
+ return u
+}
+
+// ClearPromptPreview clears the value of the "prompt_preview" field.
+func (u *BatchImageItemUpsert) ClearPromptPreview() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldPromptPreview)
+ return u
+}
+
+// SetProviderSourceObject sets the "provider_source_object" field.
+func (u *BatchImageItemUpsert) SetProviderSourceObject(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldProviderSourceObject, v)
+ return u
+}
+
+// UpdateProviderSourceObject sets the "provider_source_object" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateProviderSourceObject() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldProviderSourceObject)
+ return u
+}
+
+// ClearProviderSourceObject clears the value of the "provider_source_object" field.
+func (u *BatchImageItemUpsert) ClearProviderSourceObject() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldProviderSourceObject)
+ return u
+}
+
+// SetSourceLineNumber sets the "source_line_number" field.
+func (u *BatchImageItemUpsert) SetSourceLineNumber(v int) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldSourceLineNumber, v)
+ return u
+}
+
+// UpdateSourceLineNumber sets the "source_line_number" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateSourceLineNumber() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldSourceLineNumber)
+ return u
+}
+
+// AddSourceLineNumber adds v to the "source_line_number" field.
+func (u *BatchImageItemUpsert) AddSourceLineNumber(v int) *BatchImageItemUpsert {
+ u.Add(batchimageitem.FieldSourceLineNumber, v)
+ return u
+}
+
+// ClearSourceLineNumber clears the value of the "source_line_number" field.
+func (u *BatchImageItemUpsert) ClearSourceLineNumber() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldSourceLineNumber)
+ return u
+}
+
+// SetSourceByteOffset sets the "source_byte_offset" field.
+func (u *BatchImageItemUpsert) SetSourceByteOffset(v int64) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldSourceByteOffset, v)
+ return u
+}
+
+// UpdateSourceByteOffset sets the "source_byte_offset" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateSourceByteOffset() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldSourceByteOffset)
+ return u
+}
+
+// AddSourceByteOffset adds v to the "source_byte_offset" field.
+func (u *BatchImageItemUpsert) AddSourceByteOffset(v int64) *BatchImageItemUpsert {
+ u.Add(batchimageitem.FieldSourceByteOffset, v)
+ return u
+}
+
+// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
+func (u *BatchImageItemUpsert) ClearSourceByteOffset() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldSourceByteOffset)
+ return u
+}
+
+// SetSourceByteLength sets the "source_byte_length" field.
+func (u *BatchImageItemUpsert) SetSourceByteLength(v int64) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldSourceByteLength, v)
+ return u
+}
+
+// UpdateSourceByteLength sets the "source_byte_length" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateSourceByteLength() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldSourceByteLength)
+ return u
+}
+
+// AddSourceByteLength adds v to the "source_byte_length" field.
+func (u *BatchImageItemUpsert) AddSourceByteLength(v int64) *BatchImageItemUpsert {
+ u.Add(batchimageitem.FieldSourceByteLength, v)
+ return u
+}
+
+// ClearSourceByteLength clears the value of the "source_byte_length" field.
+func (u *BatchImageItemUpsert) ClearSourceByteLength() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldSourceByteLength)
+ return u
+}
+
+// SetMimeType sets the "mime_type" field.
+func (u *BatchImageItemUpsert) SetMimeType(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldMimeType, v)
+ return u
+}
+
+// UpdateMimeType sets the "mime_type" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateMimeType() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldMimeType)
+ return u
+}
+
+// ClearMimeType clears the value of the "mime_type" field.
+func (u *BatchImageItemUpsert) ClearMimeType() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldMimeType)
+ return u
+}
+
+// SetFileExtension sets the "file_extension" field.
+func (u *BatchImageItemUpsert) SetFileExtension(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldFileExtension, v)
+ return u
+}
+
+// UpdateFileExtension sets the "file_extension" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateFileExtension() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldFileExtension)
+ return u
+}
+
+// ClearFileExtension clears the value of the "file_extension" field.
+func (u *BatchImageItemUpsert) ClearFileExtension() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldFileExtension)
+ return u
+}
+
+// SetImageCount sets the "image_count" field.
+func (u *BatchImageItemUpsert) SetImageCount(v int) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldImageCount, v)
+ return u
+}
+
+// UpdateImageCount sets the "image_count" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateImageCount() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldImageCount)
+ return u
+}
+
+// AddImageCount adds v to the "image_count" field.
+func (u *BatchImageItemUpsert) AddImageCount(v int) *BatchImageItemUpsert {
+ u.Add(batchimageitem.FieldImageCount, v)
+ return u
+}
+
+// SetErrorCode sets the "error_code" field.
+func (u *BatchImageItemUpsert) SetErrorCode(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldErrorCode, v)
+ return u
+}
+
+// UpdateErrorCode sets the "error_code" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateErrorCode() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldErrorCode)
+ return u
+}
+
+// ClearErrorCode clears the value of the "error_code" field.
+func (u *BatchImageItemUpsert) ClearErrorCode() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldErrorCode)
+ return u
+}
+
+// SetErrorMessage sets the "error_message" field.
+func (u *BatchImageItemUpsert) SetErrorMessage(v string) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldErrorMessage, v)
+ return u
+}
+
+// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateErrorMessage() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldErrorMessage)
+ return u
+}
+
+// ClearErrorMessage clears the value of the "error_message" field.
+func (u *BatchImageItemUpsert) ClearErrorMessage() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldErrorMessage)
+ return u
+}
+
+// SetBilledAmount sets the "billed_amount" field.
+func (u *BatchImageItemUpsert) SetBilledAmount(v float64) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldBilledAmount, v)
+ return u
+}
+
+// UpdateBilledAmount sets the "billed_amount" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateBilledAmount() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldBilledAmount)
+ return u
+}
+
+// AddBilledAmount adds v to the "billed_amount" field.
+func (u *BatchImageItemUpsert) AddBilledAmount(v float64) *BatchImageItemUpsert {
+ u.Add(batchimageitem.FieldBilledAmount, v)
+ return u
+}
+
+// ClearBilledAmount clears the value of the "billed_amount" field.
+func (u *BatchImageItemUpsert) ClearBilledAmount() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldBilledAmount)
+ return u
+}
+
+// SetIndexedAt sets the "indexed_at" field.
+func (u *BatchImageItemUpsert) SetIndexedAt(v time.Time) *BatchImageItemUpsert {
+ u.Set(batchimageitem.FieldIndexedAt, v)
+ return u
+}
+
+// UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create.
+func (u *BatchImageItemUpsert) UpdateIndexedAt() *BatchImageItemUpsert {
+ u.SetExcluded(batchimageitem.FieldIndexedAt)
+ return u
+}
+
+// ClearIndexedAt clears the value of the "indexed_at" field.
+func (u *BatchImageItemUpsert) ClearIndexedAt() *BatchImageItemUpsert {
+ u.SetNull(batchimageitem.FieldIndexedAt)
+ return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create.
+// Using this option is equivalent to using:
+//
+// client.BatchImageItem.Create().
+// OnConflict(
+// sql.ResolveWithNewValues(),
+// ).
+// Exec(ctx)
+func (u *BatchImageItemUpsertOne) UpdateNewValues() *BatchImageItemUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+ if _, exists := u.create.mutation.CreatedAt(); exists {
+ s.SetIgnore(batchimageitem.FieldCreatedAt)
+ }
+ }))
+ return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+// client.BatchImageItem.Create().
+// OnConflict(sql.ResolveWithIgnore()).
+// Exec(ctx)
+func (u *BatchImageItemUpsertOne) Ignore() *BatchImageItemUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+ return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *BatchImageItemUpsertOne) DoNothing() *BatchImageItemUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.DoNothing())
+ return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the BatchImageItemCreate.OnConflict
+// documentation for more info.
+func (u *BatchImageItemUpsertOne) Update(set func(*BatchImageItemUpsert)) *BatchImageItemUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+ set(&BatchImageItemUpsert{UpdateSet: update})
+ }))
+ return u
+}
+
+// SetJobID sets the "job_id" field.
+func (u *BatchImageItemUpsertOne) SetJobID(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetJobID(v)
+ })
+}
+
+// UpdateJobID sets the "job_id" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateJobID() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateJobID()
+ })
+}
+
+// SetCustomID sets the "custom_id" field.
+func (u *BatchImageItemUpsertOne) SetCustomID(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetCustomID(v)
+ })
+}
+
+// UpdateCustomID sets the "custom_id" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateCustomID() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateCustomID()
+ })
+}
+
+// SetStatus sets the "status" field.
+func (u *BatchImageItemUpsertOne) SetStatus(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetStatus(v)
+ })
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateStatus() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateStatus()
+ })
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (u *BatchImageItemUpsertOne) SetRequestHash(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetRequestHash(v)
+ })
+}
+
+// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateRequestHash() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateRequestHash()
+ })
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (u *BatchImageItemUpsertOne) ClearRequestHash() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearRequestHash()
+ })
+}
+
+// SetPromptPreview sets the "prompt_preview" field.
+func (u *BatchImageItemUpsertOne) SetPromptPreview(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetPromptPreview(v)
+ })
+}
+
+// UpdatePromptPreview sets the "prompt_preview" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdatePromptPreview() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdatePromptPreview()
+ })
+}
+
+// ClearPromptPreview clears the value of the "prompt_preview" field.
+func (u *BatchImageItemUpsertOne) ClearPromptPreview() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearPromptPreview()
+ })
+}
+
+// SetProviderSourceObject sets the "provider_source_object" field.
+func (u *BatchImageItemUpsertOne) SetProviderSourceObject(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetProviderSourceObject(v)
+ })
+}
+
+// UpdateProviderSourceObject sets the "provider_source_object" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateProviderSourceObject() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateProviderSourceObject()
+ })
+}
+
+// ClearProviderSourceObject clears the value of the "provider_source_object" field.
+func (u *BatchImageItemUpsertOne) ClearProviderSourceObject() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearProviderSourceObject()
+ })
+}
+
+// SetSourceLineNumber sets the "source_line_number" field.
+func (u *BatchImageItemUpsertOne) SetSourceLineNumber(v int) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetSourceLineNumber(v)
+ })
+}
+
+// AddSourceLineNumber adds v to the "source_line_number" field.
+func (u *BatchImageItemUpsertOne) AddSourceLineNumber(v int) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddSourceLineNumber(v)
+ })
+}
+
+// UpdateSourceLineNumber sets the "source_line_number" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateSourceLineNumber() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateSourceLineNumber()
+ })
+}
+
+// ClearSourceLineNumber clears the value of the "source_line_number" field.
+func (u *BatchImageItemUpsertOne) ClearSourceLineNumber() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearSourceLineNumber()
+ })
+}
+
+// SetSourceByteOffset sets the "source_byte_offset" field.
+func (u *BatchImageItemUpsertOne) SetSourceByteOffset(v int64) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetSourceByteOffset(v)
+ })
+}
+
+// AddSourceByteOffset adds v to the "source_byte_offset" field.
+func (u *BatchImageItemUpsertOne) AddSourceByteOffset(v int64) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddSourceByteOffset(v)
+ })
+}
+
+// UpdateSourceByteOffset sets the "source_byte_offset" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateSourceByteOffset() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateSourceByteOffset()
+ })
+}
+
+// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
+func (u *BatchImageItemUpsertOne) ClearSourceByteOffset() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearSourceByteOffset()
+ })
+}
+
+// SetSourceByteLength sets the "source_byte_length" field.
+func (u *BatchImageItemUpsertOne) SetSourceByteLength(v int64) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetSourceByteLength(v)
+ })
+}
+
+// AddSourceByteLength adds v to the "source_byte_length" field.
+func (u *BatchImageItemUpsertOne) AddSourceByteLength(v int64) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddSourceByteLength(v)
+ })
+}
+
+// UpdateSourceByteLength sets the "source_byte_length" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateSourceByteLength() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateSourceByteLength()
+ })
+}
+
+// ClearSourceByteLength clears the value of the "source_byte_length" field.
+func (u *BatchImageItemUpsertOne) ClearSourceByteLength() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearSourceByteLength()
+ })
+}
+
+// SetMimeType sets the "mime_type" field.
+func (u *BatchImageItemUpsertOne) SetMimeType(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetMimeType(v)
+ })
+}
+
+// UpdateMimeType sets the "mime_type" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateMimeType() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateMimeType()
+ })
+}
+
+// ClearMimeType clears the value of the "mime_type" field.
+func (u *BatchImageItemUpsertOne) ClearMimeType() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearMimeType()
+ })
+}
+
+// SetFileExtension sets the "file_extension" field.
+func (u *BatchImageItemUpsertOne) SetFileExtension(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetFileExtension(v)
+ })
+}
+
+// UpdateFileExtension sets the "file_extension" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateFileExtension() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateFileExtension()
+ })
+}
+
+// ClearFileExtension clears the value of the "file_extension" field.
+func (u *BatchImageItemUpsertOne) ClearFileExtension() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearFileExtension()
+ })
+}
+
+// SetImageCount sets the "image_count" field.
+func (u *BatchImageItemUpsertOne) SetImageCount(v int) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetImageCount(v)
+ })
+}
+
+// AddImageCount adds v to the "image_count" field.
+func (u *BatchImageItemUpsertOne) AddImageCount(v int) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddImageCount(v)
+ })
+}
+
+// UpdateImageCount sets the "image_count" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateImageCount() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateImageCount()
+ })
+}
+
+// SetErrorCode sets the "error_code" field.
+func (u *BatchImageItemUpsertOne) SetErrorCode(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetErrorCode(v)
+ })
+}
+
+// UpdateErrorCode sets the "error_code" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateErrorCode() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateErrorCode()
+ })
+}
+
+// ClearErrorCode clears the value of the "error_code" field.
+func (u *BatchImageItemUpsertOne) ClearErrorCode() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearErrorCode()
+ })
+}
+
+// SetErrorMessage sets the "error_message" field.
+func (u *BatchImageItemUpsertOne) SetErrorMessage(v string) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetErrorMessage(v)
+ })
+}
+
+// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateErrorMessage() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateErrorMessage()
+ })
+}
+
+// ClearErrorMessage clears the value of the "error_message" field.
+func (u *BatchImageItemUpsertOne) ClearErrorMessage() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearErrorMessage()
+ })
+}
+
+// SetBilledAmount sets the "billed_amount" field.
+func (u *BatchImageItemUpsertOne) SetBilledAmount(v float64) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetBilledAmount(v)
+ })
+}
+
+// AddBilledAmount adds v to the "billed_amount" field.
+func (u *BatchImageItemUpsertOne) AddBilledAmount(v float64) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddBilledAmount(v)
+ })
+}
+
+// UpdateBilledAmount sets the "billed_amount" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateBilledAmount() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateBilledAmount()
+ })
+}
+
+// ClearBilledAmount clears the value of the "billed_amount" field.
+func (u *BatchImageItemUpsertOne) ClearBilledAmount() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearBilledAmount()
+ })
+}
+
+// SetIndexedAt sets the "indexed_at" field.
+func (u *BatchImageItemUpsertOne) SetIndexedAt(v time.Time) *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetIndexedAt(v)
+ })
+}
+
+// UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create.
+func (u *BatchImageItemUpsertOne) UpdateIndexedAt() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateIndexedAt()
+ })
+}
+
+// ClearIndexedAt clears the value of the "indexed_at" field.
+func (u *BatchImageItemUpsertOne) ClearIndexedAt() *BatchImageItemUpsertOne {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearIndexedAt()
+ })
+}
+
+// Exec executes the query.
+func (u *BatchImageItemUpsertOne) Exec(ctx context.Context) error {
+ if len(u.create.conflict) == 0 {
+ return errors.New("ent: missing options for BatchImageItemCreate.OnConflict")
+ }
+ return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *BatchImageItemUpsertOne) ExecX(ctx context.Context) {
+ if err := u.create.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *BatchImageItemUpsertOne) ID(ctx context.Context) (id int64, err error) {
+ node, err := u.create.Save(ctx)
+ if err != nil {
+ return id, err
+ }
+ return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *BatchImageItemUpsertOne) IDX(ctx context.Context) int64 {
+ id, err := u.ID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// BatchImageItemCreateBulk is the builder for creating many BatchImageItem entities in bulk.
+type BatchImageItemCreateBulk struct {
+ config
+ err error
+ builders []*BatchImageItemCreate
+ conflict []sql.ConflictOption
+}
+
+// Save creates the BatchImageItem entities in the database.
+func (_c *BatchImageItemCreateBulk) Save(ctx context.Context) ([]*BatchImageItem, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*BatchImageItem, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
+ func(i int, root context.Context) {
+ builder := _c.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*BatchImageItemMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ spec.OnConflict = _c.conflict
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ if specs[i].ID.Value != nil {
+ id := specs[i].ID.Value.(int64)
+ nodes[i].ID = int64(id)
+ }
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_c *BatchImageItemCreateBulk) SaveX(ctx context.Context) []*BatchImageItem {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *BatchImageItemCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *BatchImageItemCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+// client.BatchImageItem.CreateBulk(builders...).
+// OnConflict(
+// // Update the row with the new values
+// // the was proposed for insertion.
+// sql.ResolveWithNewValues(),
+// ).
+// // Override some of the fields with custom
+// // update values.
+// Update(func(u *ent.BatchImageItemUpsert) {
+// SetJobID(v+v).
+// }).
+// Exec(ctx)
+func (_c *BatchImageItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *BatchImageItemUpsertBulk {
+ _c.conflict = opts
+ return &BatchImageItemUpsertBulk{
+ create: _c,
+ }
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+// client.BatchImageItem.Create().
+// OnConflict(sql.ConflictColumns(columns...)).
+// Exec(ctx)
+func (_c *BatchImageItemCreateBulk) OnConflictColumns(columns ...string) *BatchImageItemUpsertBulk {
+ _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
+ return &BatchImageItemUpsertBulk{
+ create: _c,
+ }
+}
+
+// BatchImageItemUpsertBulk is the builder for "upsert"-ing
+// a bulk of BatchImageItem nodes.
+type BatchImageItemUpsertBulk struct {
+ create *BatchImageItemCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+// client.BatchImageItem.Create().
+// OnConflict(
+// sql.ResolveWithNewValues(),
+// ).
+// Exec(ctx)
+func (u *BatchImageItemUpsertBulk) UpdateNewValues() *BatchImageItemUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+ for _, b := range u.create.builders {
+ if _, exists := b.mutation.CreatedAt(); exists {
+ s.SetIgnore(batchimageitem.FieldCreatedAt)
+ }
+ }
+ }))
+ return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+// client.BatchImageItem.Create().
+// OnConflict(sql.ResolveWithIgnore()).
+// Exec(ctx)
+func (u *BatchImageItemUpsertBulk) Ignore() *BatchImageItemUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+ return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *BatchImageItemUpsertBulk) DoNothing() *BatchImageItemUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.DoNothing())
+ return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the BatchImageItemCreateBulk.OnConflict
+// documentation for more info.
+func (u *BatchImageItemUpsertBulk) Update(set func(*BatchImageItemUpsert)) *BatchImageItemUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+ set(&BatchImageItemUpsert{UpdateSet: update})
+ }))
+ return u
+}
+
+// SetJobID sets the "job_id" field.
+func (u *BatchImageItemUpsertBulk) SetJobID(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetJobID(v)
+ })
+}
+
+// UpdateJobID sets the "job_id" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateJobID() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateJobID()
+ })
+}
+
+// SetCustomID sets the "custom_id" field.
+func (u *BatchImageItemUpsertBulk) SetCustomID(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetCustomID(v)
+ })
+}
+
+// UpdateCustomID sets the "custom_id" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateCustomID() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateCustomID()
+ })
+}
+
+// SetStatus sets the "status" field.
+func (u *BatchImageItemUpsertBulk) SetStatus(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetStatus(v)
+ })
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateStatus() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateStatus()
+ })
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (u *BatchImageItemUpsertBulk) SetRequestHash(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetRequestHash(v)
+ })
+}
+
+// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateRequestHash() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateRequestHash()
+ })
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (u *BatchImageItemUpsertBulk) ClearRequestHash() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearRequestHash()
+ })
+}
+
+// SetPromptPreview sets the "prompt_preview" field.
+func (u *BatchImageItemUpsertBulk) SetPromptPreview(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetPromptPreview(v)
+ })
+}
+
+// UpdatePromptPreview sets the "prompt_preview" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdatePromptPreview() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdatePromptPreview()
+ })
+}
+
+// ClearPromptPreview clears the value of the "prompt_preview" field.
+func (u *BatchImageItemUpsertBulk) ClearPromptPreview() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearPromptPreview()
+ })
+}
+
+// SetProviderSourceObject sets the "provider_source_object" field.
+func (u *BatchImageItemUpsertBulk) SetProviderSourceObject(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetProviderSourceObject(v)
+ })
+}
+
+// UpdateProviderSourceObject sets the "provider_source_object" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateProviderSourceObject() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateProviderSourceObject()
+ })
+}
+
+// ClearProviderSourceObject clears the value of the "provider_source_object" field.
+func (u *BatchImageItemUpsertBulk) ClearProviderSourceObject() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearProviderSourceObject()
+ })
+}
+
+// SetSourceLineNumber sets the "source_line_number" field.
+func (u *BatchImageItemUpsertBulk) SetSourceLineNumber(v int) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetSourceLineNumber(v)
+ })
+}
+
+// AddSourceLineNumber adds v to the "source_line_number" field.
+func (u *BatchImageItemUpsertBulk) AddSourceLineNumber(v int) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddSourceLineNumber(v)
+ })
+}
+
+// UpdateSourceLineNumber sets the "source_line_number" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateSourceLineNumber() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateSourceLineNumber()
+ })
+}
+
+// ClearSourceLineNumber clears the value of the "source_line_number" field.
+func (u *BatchImageItemUpsertBulk) ClearSourceLineNumber() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearSourceLineNumber()
+ })
+}
+
+// SetSourceByteOffset sets the "source_byte_offset" field.
+func (u *BatchImageItemUpsertBulk) SetSourceByteOffset(v int64) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetSourceByteOffset(v)
+ })
+}
+
+// AddSourceByteOffset adds v to the "source_byte_offset" field.
+func (u *BatchImageItemUpsertBulk) AddSourceByteOffset(v int64) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddSourceByteOffset(v)
+ })
+}
+
+// UpdateSourceByteOffset sets the "source_byte_offset" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateSourceByteOffset() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateSourceByteOffset()
+ })
+}
+
+// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
+func (u *BatchImageItemUpsertBulk) ClearSourceByteOffset() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearSourceByteOffset()
+ })
+}
+
+// SetSourceByteLength sets the "source_byte_length" field.
+func (u *BatchImageItemUpsertBulk) SetSourceByteLength(v int64) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetSourceByteLength(v)
+ })
+}
+
+// AddSourceByteLength adds v to the "source_byte_length" field.
+func (u *BatchImageItemUpsertBulk) AddSourceByteLength(v int64) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddSourceByteLength(v)
+ })
+}
+
+// UpdateSourceByteLength sets the "source_byte_length" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateSourceByteLength() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateSourceByteLength()
+ })
+}
+
+// ClearSourceByteLength clears the value of the "source_byte_length" field.
+func (u *BatchImageItemUpsertBulk) ClearSourceByteLength() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearSourceByteLength()
+ })
+}
+
+// SetMimeType sets the "mime_type" field.
+func (u *BatchImageItemUpsertBulk) SetMimeType(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetMimeType(v)
+ })
+}
+
+// UpdateMimeType sets the "mime_type" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateMimeType() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateMimeType()
+ })
+}
+
+// ClearMimeType clears the value of the "mime_type" field.
+func (u *BatchImageItemUpsertBulk) ClearMimeType() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearMimeType()
+ })
+}
+
+// SetFileExtension sets the "file_extension" field.
+func (u *BatchImageItemUpsertBulk) SetFileExtension(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetFileExtension(v)
+ })
+}
+
+// UpdateFileExtension sets the "file_extension" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateFileExtension() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateFileExtension()
+ })
+}
+
+// ClearFileExtension clears the value of the "file_extension" field.
+func (u *BatchImageItemUpsertBulk) ClearFileExtension() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearFileExtension()
+ })
+}
+
+// SetImageCount sets the "image_count" field.
+func (u *BatchImageItemUpsertBulk) SetImageCount(v int) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetImageCount(v)
+ })
+}
+
+// AddImageCount adds v to the "image_count" field.
+func (u *BatchImageItemUpsertBulk) AddImageCount(v int) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddImageCount(v)
+ })
+}
+
+// UpdateImageCount sets the "image_count" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateImageCount() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateImageCount()
+ })
+}
+
+// SetErrorCode sets the "error_code" field.
+func (u *BatchImageItemUpsertBulk) SetErrorCode(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetErrorCode(v)
+ })
+}
+
+// UpdateErrorCode sets the "error_code" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateErrorCode() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateErrorCode()
+ })
+}
+
+// ClearErrorCode clears the value of the "error_code" field.
+func (u *BatchImageItemUpsertBulk) ClearErrorCode() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearErrorCode()
+ })
+}
+
+// SetErrorMessage sets the "error_message" field.
+func (u *BatchImageItemUpsertBulk) SetErrorMessage(v string) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetErrorMessage(v)
+ })
+}
+
+// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateErrorMessage() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateErrorMessage()
+ })
+}
+
+// ClearErrorMessage clears the value of the "error_message" field.
+func (u *BatchImageItemUpsertBulk) ClearErrorMessage() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearErrorMessage()
+ })
+}
+
+// SetBilledAmount sets the "billed_amount" field.
+func (u *BatchImageItemUpsertBulk) SetBilledAmount(v float64) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetBilledAmount(v)
+ })
+}
+
+// AddBilledAmount adds v to the "billed_amount" field.
+func (u *BatchImageItemUpsertBulk) AddBilledAmount(v float64) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.AddBilledAmount(v)
+ })
+}
+
+// UpdateBilledAmount sets the "billed_amount" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateBilledAmount() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateBilledAmount()
+ })
+}
+
+// ClearBilledAmount clears the value of the "billed_amount" field.
+func (u *BatchImageItemUpsertBulk) ClearBilledAmount() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearBilledAmount()
+ })
+}
+
+// SetIndexedAt sets the "indexed_at" field.
+func (u *BatchImageItemUpsertBulk) SetIndexedAt(v time.Time) *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.SetIndexedAt(v)
+ })
+}
+
+// UpdateIndexedAt sets the "indexed_at" field to the value that was provided on create.
+func (u *BatchImageItemUpsertBulk) UpdateIndexedAt() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.UpdateIndexedAt()
+ })
+}
+
+// ClearIndexedAt clears the value of the "indexed_at" field.
+func (u *BatchImageItemUpsertBulk) ClearIndexedAt() *BatchImageItemUpsertBulk {
+ return u.Update(func(s *BatchImageItemUpsert) {
+ s.ClearIndexedAt()
+ })
+}
+
+// Exec executes the query.
+func (u *BatchImageItemUpsertBulk) Exec(ctx context.Context) error {
+ if u.create.err != nil {
+ return u.create.err
+ }
+ for i, b := range u.create.builders {
+ if len(b.conflict) != 0 {
+ return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the BatchImageItemCreateBulk instead", i)
+ }
+ }
+ if len(u.create.conflict) == 0 {
+ return errors.New("ent: missing options for BatchImageItemCreateBulk.OnConflict")
+ }
+ return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *BatchImageItemUpsertBulk) ExecX(ctx context.Context) {
+ if err := u.create.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/ent/batchimageitem_delete.go b/backend/ent/batchimageitem_delete.go
new file mode 100644
index 0000000000..7aa3bf32e8
--- /dev/null
+++ b/backend/ent/batchimageitem_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageItemDelete is the builder for deleting a BatchImageItem entity.
+type BatchImageItemDelete struct {
+ config
+ hooks []Hook
+ mutation *BatchImageItemMutation
+}
+
+// Where appends a list predicates to the BatchImageItemDelete builder.
+func (_d *BatchImageItemDelete) Where(ps ...predicate.BatchImageItem) *BatchImageItemDelete {
+ _d.mutation.Where(ps...)
+ return _d
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (_d *BatchImageItemDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_d *BatchImageItemDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (_d *BatchImageItemDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(batchimageitem.Table, sqlgraph.NewFieldSpec(batchimageitem.FieldID, field.TypeInt64))
+ if ps := _d.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ _d.mutation.done = true
+ return affected, err
+}
+
+// BatchImageItemDeleteOne is the builder for deleting a single BatchImageItem entity.
+type BatchImageItemDeleteOne struct {
+ _d *BatchImageItemDelete
+}
+
+// Where appends a list predicates to the BatchImageItemDelete builder.
+func (_d *BatchImageItemDeleteOne) Where(ps ...predicate.BatchImageItem) *BatchImageItemDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
+}
+
+// Exec executes the deletion query.
+func (_d *BatchImageItemDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{batchimageitem.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_d *BatchImageItemDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/ent/batchimageitem_query.go b/backend/ent/batchimageitem_query.go
new file mode 100644
index 0000000000..7e1d08f7be
--- /dev/null
+++ b/backend/ent/batchimageitem_query.go
@@ -0,0 +1,564 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "fmt"
+ "math"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageItemQuery is the builder for querying BatchImageItem entities.
+type BatchImageItemQuery struct {
+ config
+ ctx *QueryContext
+ order []batchimageitem.OrderOption
+ inters []Interceptor
+ predicates []predicate.BatchImageItem
+ modifiers []func(*sql.Selector)
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the BatchImageItemQuery builder.
+func (_q *BatchImageItemQuery) Where(ps ...predicate.BatchImageItem) *BatchImageItemQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
+}
+
+// Limit the number of records to be returned by this query.
+func (_q *BatchImageItemQuery) Limit(limit int) *BatchImageItemQuery {
+ _q.ctx.Limit = &limit
+ return _q
+}
+
+// Offset to start from.
+func (_q *BatchImageItemQuery) Offset(offset int) *BatchImageItemQuery {
+ _q.ctx.Offset = &offset
+ return _q
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (_q *BatchImageItemQuery) Unique(unique bool) *BatchImageItemQuery {
+ _q.ctx.Unique = &unique
+ return _q
+}
+
+// Order specifies how the records should be ordered.
+func (_q *BatchImageItemQuery) Order(o ...batchimageitem.OrderOption) *BatchImageItemQuery {
+ _q.order = append(_q.order, o...)
+ return _q
+}
+
+// First returns the first BatchImageItem entity from the query.
+// Returns a *NotFoundError when no BatchImageItem was found.
+func (_q *BatchImageItemQuery) First(ctx context.Context) (*BatchImageItem, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{batchimageitem.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (_q *BatchImageItemQuery) FirstX(ctx context.Context) *BatchImageItem {
+ node, err := _q.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first BatchImageItem ID from the query.
+// Returns a *NotFoundError when no BatchImageItem ID was found.
+func (_q *BatchImageItemQuery) FirstID(ctx context.Context) (id int64, err error) {
+ var ids []int64
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{batchimageitem.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (_q *BatchImageItemQuery) FirstIDX(ctx context.Context) int64 {
+ id, err := _q.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single BatchImageItem entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one BatchImageItem entity is found.
+// Returns a *NotFoundError when no BatchImageItem entities are found.
+func (_q *BatchImageItemQuery) Only(ctx context.Context) (*BatchImageItem, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{batchimageitem.Label}
+ default:
+ return nil, &NotSingularError{batchimageitem.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (_q *BatchImageItemQuery) OnlyX(ctx context.Context) *BatchImageItem {
+ node, err := _q.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only BatchImageItem ID in the query.
+// Returns a *NotSingularError when more than one BatchImageItem ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (_q *BatchImageItemQuery) OnlyID(ctx context.Context) (id int64, err error) {
+ var ids []int64
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{batchimageitem.Label}
+ default:
+ err = &NotSingularError{batchimageitem.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (_q *BatchImageItemQuery) OnlyIDX(ctx context.Context) int64 {
+ id, err := _q.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of BatchImageItems.
+func (_q *BatchImageItemQuery) All(ctx context.Context) ([]*BatchImageItem, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*BatchImageItem, *BatchImageItemQuery]()
+ return withInterceptors[[]*BatchImageItem](ctx, _q, qr, _q.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (_q *BatchImageItemQuery) AllX(ctx context.Context) []*BatchImageItem {
+ nodes, err := _q.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of BatchImageItem IDs.
+func (_q *BatchImageItemQuery) IDs(ctx context.Context) (ids []int64, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
+ }
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(batchimageitem.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (_q *BatchImageItemQuery) IDsX(ctx context.Context) []int64 {
+ ids, err := _q.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (_q *BatchImageItemQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, _q, querierCount[*BatchImageItemQuery](), _q.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (_q *BatchImageItemQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (_q *BatchImageItemQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (_q *BatchImageItemQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the BatchImageItemQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (_q *BatchImageItemQuery) Clone() *BatchImageItemQuery {
+ if _q == nil {
+ return nil
+ }
+ return &BatchImageItemQuery{
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]batchimageitem.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.BatchImageItem{}, _q.predicates...),
+ // clone intermediate query.
+ sql: _q.sql.Clone(),
+ path: _q.path,
+ }
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// JobID string `json:"job_id,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.BatchImageItem.Query().
+// GroupBy(batchimageitem.FieldJobID).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (_q *BatchImageItemQuery) GroupBy(field string, fields ...string) *BatchImageItemGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &BatchImageItemGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
+ grbuild.label = batchimageitem.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// JobID string `json:"job_id,omitempty"`
+// }
+//
+// client.BatchImageItem.Query().
+// Select(batchimageitem.FieldJobID).
+// Scan(ctx, &v)
+func (_q *BatchImageItemQuery) Select(fields ...string) *BatchImageItemSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &BatchImageItemSelect{BatchImageItemQuery: _q}
+ sbuild.label = batchimageitem.Label
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a BatchImageItemSelect configured with the given aggregations.
+func (_q *BatchImageItemQuery) Aggregate(fns ...AggregateFunc) *BatchImageItemSelect {
+ return _q.Select().Aggregate(fns...)
+}
+
+func (_q *BatchImageItemQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, _q); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range _q.ctx.Fields {
+ if !batchimageitem.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
+ if err != nil {
+ return err
+ }
+ _q.sql = prev
+ }
+ return nil
+}
+
+func (_q *BatchImageItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BatchImageItem, error) {
+ var (
+ nodes = []*BatchImageItem{}
+ _spec = _q.querySpec()
+ )
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*BatchImageItem).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &BatchImageItem{config: _q.config}
+ nodes = append(nodes, node)
+ return node.assignValues(columns, values)
+ }
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ return nodes, nil
+}
+
+func (_q *BatchImageItemQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
+}
+
+func (_q *BatchImageItemQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(batchimageitem.Table, batchimageitem.Columns, sqlgraph.NewFieldSpec(batchimageitem.FieldID, field.TypeInt64))
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if _q.path != nil {
+ _spec.Unique = true
+ }
+ if fields := _q.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, batchimageitem.FieldID)
+ for i := range fields {
+ if fields[i] != batchimageitem.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := _q.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := _q.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := _q.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := _q.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (_q *BatchImageItemQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
+ t1 := builder.Table(batchimageitem.Table)
+ columns := _q.ctx.Fields
+ if len(columns) == 0 {
+ columns = batchimageitem.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if _q.sql != nil {
+ selector = _q.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, m := range _q.modifiers {
+ m(selector)
+ }
+ for _, p := range _q.predicates {
+ p(selector)
+ }
+ for _, p := range _q.order {
+ p(selector)
+ }
+ if offset := _q.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := _q.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// ForUpdate locks the selected rows against concurrent updates, and prevent them from being
+// updated, deleted or "selected ... for update" by other sessions, until the transaction is
+// either committed or rolled-back.
+func (_q *BatchImageItemQuery) ForUpdate(opts ...sql.LockOption) *BatchImageItemQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForUpdate(opts...)
+ })
+ return _q
+}
+
+// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock
+// on any rows that are read. Other sessions can read the rows, but cannot modify them
+// until your transaction commits.
+func (_q *BatchImageItemQuery) ForShare(opts ...sql.LockOption) *BatchImageItemQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForShare(opts...)
+ })
+ return _q
+}
+
+// BatchImageItemGroupBy is the group-by builder for BatchImageItem entities.
+type BatchImageItemGroupBy struct {
+ selector
+ build *BatchImageItemQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (_g *BatchImageItemGroupBy) Aggregate(fns ...AggregateFunc) *BatchImageItemGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (_g *BatchImageItemGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BatchImageItemQuery, *BatchImageItemGroupBy](ctx, _g.build, _g, _g.build.inters, v)
+}
+
+func (_g *BatchImageItemGroupBy) sqlScan(ctx context.Context, root *BatchImageItemQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// BatchImageItemSelect is the builder for selecting fields of BatchImageItem entities.
+type BatchImageItemSelect struct {
+ *BatchImageItemQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (_s *BatchImageItemSelect) Aggregate(fns ...AggregateFunc) *BatchImageItemSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (_s *BatchImageItemSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BatchImageItemQuery, *BatchImageItemSelect](ctx, _s.BatchImageItemQuery, _s, _s.inters, v)
+}
+
+func (_s *BatchImageItemSelect) sqlScan(ctx context.Context, root *BatchImageItemQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*_s.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/ent/batchimageitem_update.go b/backend/ent/batchimageitem_update.go
new file mode 100644
index 0000000000..edca025b7e
--- /dev/null
+++ b/backend/ent/batchimageitem_update.go
@@ -0,0 +1,1132 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageItemUpdate is the builder for updating BatchImageItem entities.
+type BatchImageItemUpdate struct {
+ config
+ hooks []Hook
+ mutation *BatchImageItemMutation
+}
+
+// Where appends a list predicates to the BatchImageItemUpdate builder.
+func (_u *BatchImageItemUpdate) Where(ps ...predicate.BatchImageItem) *BatchImageItemUpdate {
+ _u.mutation.Where(ps...)
+ return _u
+}
+
+// SetJobID sets the "job_id" field.
+func (_u *BatchImageItemUpdate) SetJobID(v string) *BatchImageItemUpdate {
+ _u.mutation.SetJobID(v)
+ return _u
+}
+
+// SetNillableJobID sets the "job_id" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableJobID(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetJobID(*v)
+ }
+ return _u
+}
+
+// SetCustomID sets the "custom_id" field.
+func (_u *BatchImageItemUpdate) SetCustomID(v string) *BatchImageItemUpdate {
+ _u.mutation.SetCustomID(v)
+ return _u
+}
+
+// SetNillableCustomID sets the "custom_id" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableCustomID(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetCustomID(*v)
+ }
+ return _u
+}
+
+// SetStatus sets the "status" field.
+func (_u *BatchImageItemUpdate) SetStatus(v string) *BatchImageItemUpdate {
+ _u.mutation.SetStatus(v)
+ return _u
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableStatus(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetStatus(*v)
+ }
+ return _u
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (_u *BatchImageItemUpdate) SetRequestHash(v string) *BatchImageItemUpdate {
+ _u.mutation.SetRequestHash(v)
+ return _u
+}
+
+// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableRequestHash(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetRequestHash(*v)
+ }
+ return _u
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (_u *BatchImageItemUpdate) ClearRequestHash() *BatchImageItemUpdate {
+ _u.mutation.ClearRequestHash()
+ return _u
+}
+
+// SetPromptPreview sets the "prompt_preview" field.
+func (_u *BatchImageItemUpdate) SetPromptPreview(v string) *BatchImageItemUpdate {
+ _u.mutation.SetPromptPreview(v)
+ return _u
+}
+
+// SetNillablePromptPreview sets the "prompt_preview" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillablePromptPreview(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetPromptPreview(*v)
+ }
+ return _u
+}
+
+// ClearPromptPreview clears the value of the "prompt_preview" field.
+func (_u *BatchImageItemUpdate) ClearPromptPreview() *BatchImageItemUpdate {
+ _u.mutation.ClearPromptPreview()
+ return _u
+}
+
+// SetProviderSourceObject sets the "provider_source_object" field.
+func (_u *BatchImageItemUpdate) SetProviderSourceObject(v string) *BatchImageItemUpdate {
+ _u.mutation.SetProviderSourceObject(v)
+ return _u
+}
+
+// SetNillableProviderSourceObject sets the "provider_source_object" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableProviderSourceObject(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetProviderSourceObject(*v)
+ }
+ return _u
+}
+
+// ClearProviderSourceObject clears the value of the "provider_source_object" field.
+func (_u *BatchImageItemUpdate) ClearProviderSourceObject() *BatchImageItemUpdate {
+ _u.mutation.ClearProviderSourceObject()
+ return _u
+}
+
+// SetSourceLineNumber sets the "source_line_number" field.
+func (_u *BatchImageItemUpdate) SetSourceLineNumber(v int) *BatchImageItemUpdate {
+ _u.mutation.ResetSourceLineNumber()
+ _u.mutation.SetSourceLineNumber(v)
+ return _u
+}
+
+// SetNillableSourceLineNumber sets the "source_line_number" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableSourceLineNumber(v *int) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetSourceLineNumber(*v)
+ }
+ return _u
+}
+
+// AddSourceLineNumber adds value to the "source_line_number" field.
+func (_u *BatchImageItemUpdate) AddSourceLineNumber(v int) *BatchImageItemUpdate {
+ _u.mutation.AddSourceLineNumber(v)
+ return _u
+}
+
+// ClearSourceLineNumber clears the value of the "source_line_number" field.
+func (_u *BatchImageItemUpdate) ClearSourceLineNumber() *BatchImageItemUpdate {
+ _u.mutation.ClearSourceLineNumber()
+ return _u
+}
+
+// SetSourceByteOffset sets the "source_byte_offset" field.
+func (_u *BatchImageItemUpdate) SetSourceByteOffset(v int64) *BatchImageItemUpdate {
+ _u.mutation.ResetSourceByteOffset()
+ _u.mutation.SetSourceByteOffset(v)
+ return _u
+}
+
+// SetNillableSourceByteOffset sets the "source_byte_offset" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableSourceByteOffset(v *int64) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetSourceByteOffset(*v)
+ }
+ return _u
+}
+
+// AddSourceByteOffset adds value to the "source_byte_offset" field.
+func (_u *BatchImageItemUpdate) AddSourceByteOffset(v int64) *BatchImageItemUpdate {
+ _u.mutation.AddSourceByteOffset(v)
+ return _u
+}
+
+// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
+func (_u *BatchImageItemUpdate) ClearSourceByteOffset() *BatchImageItemUpdate {
+ _u.mutation.ClearSourceByteOffset()
+ return _u
+}
+
+// SetSourceByteLength sets the "source_byte_length" field.
+func (_u *BatchImageItemUpdate) SetSourceByteLength(v int64) *BatchImageItemUpdate {
+ _u.mutation.ResetSourceByteLength()
+ _u.mutation.SetSourceByteLength(v)
+ return _u
+}
+
+// SetNillableSourceByteLength sets the "source_byte_length" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableSourceByteLength(v *int64) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetSourceByteLength(*v)
+ }
+ return _u
+}
+
+// AddSourceByteLength adds value to the "source_byte_length" field.
+func (_u *BatchImageItemUpdate) AddSourceByteLength(v int64) *BatchImageItemUpdate {
+ _u.mutation.AddSourceByteLength(v)
+ return _u
+}
+
+// ClearSourceByteLength clears the value of the "source_byte_length" field.
+func (_u *BatchImageItemUpdate) ClearSourceByteLength() *BatchImageItemUpdate {
+ _u.mutation.ClearSourceByteLength()
+ return _u
+}
+
+// SetMimeType sets the "mime_type" field.
+func (_u *BatchImageItemUpdate) SetMimeType(v string) *BatchImageItemUpdate {
+ _u.mutation.SetMimeType(v)
+ return _u
+}
+
+// SetNillableMimeType sets the "mime_type" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableMimeType(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetMimeType(*v)
+ }
+ return _u
+}
+
+// ClearMimeType clears the value of the "mime_type" field.
+func (_u *BatchImageItemUpdate) ClearMimeType() *BatchImageItemUpdate {
+ _u.mutation.ClearMimeType()
+ return _u
+}
+
+// SetFileExtension sets the "file_extension" field.
+func (_u *BatchImageItemUpdate) SetFileExtension(v string) *BatchImageItemUpdate {
+ _u.mutation.SetFileExtension(v)
+ return _u
+}
+
+// SetNillableFileExtension sets the "file_extension" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableFileExtension(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetFileExtension(*v)
+ }
+ return _u
+}
+
+// ClearFileExtension clears the value of the "file_extension" field.
+func (_u *BatchImageItemUpdate) ClearFileExtension() *BatchImageItemUpdate {
+ _u.mutation.ClearFileExtension()
+ return _u
+}
+
+// SetImageCount sets the "image_count" field.
+func (_u *BatchImageItemUpdate) SetImageCount(v int) *BatchImageItemUpdate {
+ _u.mutation.ResetImageCount()
+ _u.mutation.SetImageCount(v)
+ return _u
+}
+
+// SetNillableImageCount sets the "image_count" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableImageCount(v *int) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetImageCount(*v)
+ }
+ return _u
+}
+
+// AddImageCount adds value to the "image_count" field.
+func (_u *BatchImageItemUpdate) AddImageCount(v int) *BatchImageItemUpdate {
+ _u.mutation.AddImageCount(v)
+ return _u
+}
+
+// SetErrorCode sets the "error_code" field.
+func (_u *BatchImageItemUpdate) SetErrorCode(v string) *BatchImageItemUpdate {
+ _u.mutation.SetErrorCode(v)
+ return _u
+}
+
+// SetNillableErrorCode sets the "error_code" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableErrorCode(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetErrorCode(*v)
+ }
+ return _u
+}
+
+// ClearErrorCode clears the value of the "error_code" field.
+func (_u *BatchImageItemUpdate) ClearErrorCode() *BatchImageItemUpdate {
+ _u.mutation.ClearErrorCode()
+ return _u
+}
+
+// SetErrorMessage sets the "error_message" field.
+func (_u *BatchImageItemUpdate) SetErrorMessage(v string) *BatchImageItemUpdate {
+ _u.mutation.SetErrorMessage(v)
+ return _u
+}
+
+// SetNillableErrorMessage sets the "error_message" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableErrorMessage(v *string) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetErrorMessage(*v)
+ }
+ return _u
+}
+
+// ClearErrorMessage clears the value of the "error_message" field.
+func (_u *BatchImageItemUpdate) ClearErrorMessage() *BatchImageItemUpdate {
+ _u.mutation.ClearErrorMessage()
+ return _u
+}
+
+// SetBilledAmount sets the "billed_amount" field.
+func (_u *BatchImageItemUpdate) SetBilledAmount(v float64) *BatchImageItemUpdate {
+ _u.mutation.ResetBilledAmount()
+ _u.mutation.SetBilledAmount(v)
+ return _u
+}
+
+// SetNillableBilledAmount sets the "billed_amount" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableBilledAmount(v *float64) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetBilledAmount(*v)
+ }
+ return _u
+}
+
+// AddBilledAmount adds value to the "billed_amount" field.
+func (_u *BatchImageItemUpdate) AddBilledAmount(v float64) *BatchImageItemUpdate {
+ _u.mutation.AddBilledAmount(v)
+ return _u
+}
+
+// ClearBilledAmount clears the value of the "billed_amount" field.
+func (_u *BatchImageItemUpdate) ClearBilledAmount() *BatchImageItemUpdate {
+ _u.mutation.ClearBilledAmount()
+ return _u
+}
+
+// SetIndexedAt sets the "indexed_at" field.
+func (_u *BatchImageItemUpdate) SetIndexedAt(v time.Time) *BatchImageItemUpdate {
+ _u.mutation.SetIndexedAt(v)
+ return _u
+}
+
+// SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil.
+func (_u *BatchImageItemUpdate) SetNillableIndexedAt(v *time.Time) *BatchImageItemUpdate {
+ if v != nil {
+ _u.SetIndexedAt(*v)
+ }
+ return _u
+}
+
+// ClearIndexedAt clears the value of the "indexed_at" field.
+func (_u *BatchImageItemUpdate) ClearIndexedAt() *BatchImageItemUpdate {
+ _u.mutation.ClearIndexedAt()
+ return _u
+}
+
+// Mutation returns the BatchImageItemMutation object of the builder.
+func (_u *BatchImageItemUpdate) Mutation() *BatchImageItemMutation {
+ return _u.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (_u *BatchImageItemUpdate) Save(ctx context.Context) (int, error) {
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_u *BatchImageItemUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (_u *BatchImageItemUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_u *BatchImageItemUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_u *BatchImageItemUpdate) check() error {
+ if v, ok := _u.mutation.JobID(); ok {
+ if err := batchimageitem.JobIDValidator(v); err != nil {
+ return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.job_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.CustomID(); ok {
+ if err := batchimageitem.CustomIDValidator(v); err != nil {
+ return &ValidationError{Name: "custom_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.custom_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Status(); ok {
+ if err := batchimageitem.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.status": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.RequestHash(); ok {
+ if err := batchimageitem.RequestHashValidator(v); err != nil {
+ return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.request_hash": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderSourceObject(); ok {
+ if err := batchimageitem.ProviderSourceObjectValidator(v); err != nil {
+ return &ValidationError{Name: "provider_source_object", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.provider_source_object": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.MimeType(); ok {
+ if err := batchimageitem.MimeTypeValidator(v); err != nil {
+ return &ValidationError{Name: "mime_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.mime_type": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.FileExtension(); ok {
+ if err := batchimageitem.FileExtensionValidator(v); err != nil {
+ return &ValidationError{Name: "file_extension", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.file_extension": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ErrorCode(); ok {
+ if err := batchimageitem.ErrorCodeValidator(v); err != nil {
+ return &ValidationError{Name: "error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.error_code": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (_u *BatchImageItemUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(batchimageitem.Table, batchimageitem.Columns, sqlgraph.NewFieldSpec(batchimageitem.FieldID, field.TypeInt64))
+ if ps := _u.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := _u.mutation.JobID(); ok {
+ _spec.SetField(batchimageitem.FieldJobID, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.CustomID(); ok {
+ _spec.SetField(batchimageitem.FieldCustomID, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Status(); ok {
+ _spec.SetField(batchimageitem.FieldStatus, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.RequestHash(); ok {
+ _spec.SetField(batchimageitem.FieldRequestHash, field.TypeString, value)
+ }
+ if _u.mutation.RequestHashCleared() {
+ _spec.ClearField(batchimageitem.FieldRequestHash, field.TypeString)
+ }
+ if value, ok := _u.mutation.PromptPreview(); ok {
+ _spec.SetField(batchimageitem.FieldPromptPreview, field.TypeString, value)
+ }
+ if _u.mutation.PromptPreviewCleared() {
+ _spec.ClearField(batchimageitem.FieldPromptPreview, field.TypeString)
+ }
+ if value, ok := _u.mutation.ProviderSourceObject(); ok {
+ _spec.SetField(batchimageitem.FieldProviderSourceObject, field.TypeString, value)
+ }
+ if _u.mutation.ProviderSourceObjectCleared() {
+ _spec.ClearField(batchimageitem.FieldProviderSourceObject, field.TypeString)
+ }
+ if value, ok := _u.mutation.SourceLineNumber(); ok {
+ _spec.SetField(batchimageitem.FieldSourceLineNumber, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedSourceLineNumber(); ok {
+ _spec.AddField(batchimageitem.FieldSourceLineNumber, field.TypeInt, value)
+ }
+ if _u.mutation.SourceLineNumberCleared() {
+ _spec.ClearField(batchimageitem.FieldSourceLineNumber, field.TypeInt)
+ }
+ if value, ok := _u.mutation.SourceByteOffset(); ok {
+ _spec.SetField(batchimageitem.FieldSourceByteOffset, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedSourceByteOffset(); ok {
+ _spec.AddField(batchimageitem.FieldSourceByteOffset, field.TypeInt64, value)
+ }
+ if _u.mutation.SourceByteOffsetCleared() {
+ _spec.ClearField(batchimageitem.FieldSourceByteOffset, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.SourceByteLength(); ok {
+ _spec.SetField(batchimageitem.FieldSourceByteLength, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedSourceByteLength(); ok {
+ _spec.AddField(batchimageitem.FieldSourceByteLength, field.TypeInt64, value)
+ }
+ if _u.mutation.SourceByteLengthCleared() {
+ _spec.ClearField(batchimageitem.FieldSourceByteLength, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.MimeType(); ok {
+ _spec.SetField(batchimageitem.FieldMimeType, field.TypeString, value)
+ }
+ if _u.mutation.MimeTypeCleared() {
+ _spec.ClearField(batchimageitem.FieldMimeType, field.TypeString)
+ }
+ if value, ok := _u.mutation.FileExtension(); ok {
+ _spec.SetField(batchimageitem.FieldFileExtension, field.TypeString, value)
+ }
+ if _u.mutation.FileExtensionCleared() {
+ _spec.ClearField(batchimageitem.FieldFileExtension, field.TypeString)
+ }
+ if value, ok := _u.mutation.ImageCount(); ok {
+ _spec.SetField(batchimageitem.FieldImageCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedImageCount(); ok {
+ _spec.AddField(batchimageitem.FieldImageCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.ErrorCode(); ok {
+ _spec.SetField(batchimageitem.FieldErrorCode, field.TypeString, value)
+ }
+ if _u.mutation.ErrorCodeCleared() {
+ _spec.ClearField(batchimageitem.FieldErrorCode, field.TypeString)
+ }
+ if value, ok := _u.mutation.ErrorMessage(); ok {
+ _spec.SetField(batchimageitem.FieldErrorMessage, field.TypeString, value)
+ }
+ if _u.mutation.ErrorMessageCleared() {
+ _spec.ClearField(batchimageitem.FieldErrorMessage, field.TypeString)
+ }
+ if value, ok := _u.mutation.BilledAmount(); ok {
+ _spec.SetField(batchimageitem.FieldBilledAmount, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedBilledAmount(); ok {
+ _spec.AddField(batchimageitem.FieldBilledAmount, field.TypeFloat64, value)
+ }
+ if _u.mutation.BilledAmountCleared() {
+ _spec.ClearField(batchimageitem.FieldBilledAmount, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.IndexedAt(); ok {
+ _spec.SetField(batchimageitem.FieldIndexedAt, field.TypeTime, value)
+ }
+ if _u.mutation.IndexedAtCleared() {
+ _spec.ClearField(batchimageitem.FieldIndexedAt, field.TypeTime)
+ }
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{batchimageitem.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ _u.mutation.done = true
+ return _node, nil
+}
+
+// BatchImageItemUpdateOne is the builder for updating a single BatchImageItem entity.
+type BatchImageItemUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *BatchImageItemMutation
+}
+
+// SetJobID sets the "job_id" field.
+func (_u *BatchImageItemUpdateOne) SetJobID(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetJobID(v)
+ return _u
+}
+
+// SetNillableJobID sets the "job_id" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableJobID(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetJobID(*v)
+ }
+ return _u
+}
+
+// SetCustomID sets the "custom_id" field.
+func (_u *BatchImageItemUpdateOne) SetCustomID(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetCustomID(v)
+ return _u
+}
+
+// SetNillableCustomID sets the "custom_id" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableCustomID(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetCustomID(*v)
+ }
+ return _u
+}
+
+// SetStatus sets the "status" field.
+func (_u *BatchImageItemUpdateOne) SetStatus(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetStatus(v)
+ return _u
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableStatus(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetStatus(*v)
+ }
+ return _u
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (_u *BatchImageItemUpdateOne) SetRequestHash(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetRequestHash(v)
+ return _u
+}
+
+// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableRequestHash(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetRequestHash(*v)
+ }
+ return _u
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (_u *BatchImageItemUpdateOne) ClearRequestHash() *BatchImageItemUpdateOne {
+ _u.mutation.ClearRequestHash()
+ return _u
+}
+
+// SetPromptPreview sets the "prompt_preview" field.
+func (_u *BatchImageItemUpdateOne) SetPromptPreview(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetPromptPreview(v)
+ return _u
+}
+
+// SetNillablePromptPreview sets the "prompt_preview" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillablePromptPreview(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetPromptPreview(*v)
+ }
+ return _u
+}
+
+// ClearPromptPreview clears the value of the "prompt_preview" field.
+func (_u *BatchImageItemUpdateOne) ClearPromptPreview() *BatchImageItemUpdateOne {
+ _u.mutation.ClearPromptPreview()
+ return _u
+}
+
+// SetProviderSourceObject sets the "provider_source_object" field.
+func (_u *BatchImageItemUpdateOne) SetProviderSourceObject(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetProviderSourceObject(v)
+ return _u
+}
+
+// SetNillableProviderSourceObject sets the "provider_source_object" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableProviderSourceObject(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetProviderSourceObject(*v)
+ }
+ return _u
+}
+
+// ClearProviderSourceObject clears the value of the "provider_source_object" field.
+func (_u *BatchImageItemUpdateOne) ClearProviderSourceObject() *BatchImageItemUpdateOne {
+ _u.mutation.ClearProviderSourceObject()
+ return _u
+}
+
+// SetSourceLineNumber sets the "source_line_number" field.
+func (_u *BatchImageItemUpdateOne) SetSourceLineNumber(v int) *BatchImageItemUpdateOne {
+ _u.mutation.ResetSourceLineNumber()
+ _u.mutation.SetSourceLineNumber(v)
+ return _u
+}
+
+// SetNillableSourceLineNumber sets the "source_line_number" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableSourceLineNumber(v *int) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetSourceLineNumber(*v)
+ }
+ return _u
+}
+
+// AddSourceLineNumber adds value to the "source_line_number" field.
+func (_u *BatchImageItemUpdateOne) AddSourceLineNumber(v int) *BatchImageItemUpdateOne {
+ _u.mutation.AddSourceLineNumber(v)
+ return _u
+}
+
+// ClearSourceLineNumber clears the value of the "source_line_number" field.
+func (_u *BatchImageItemUpdateOne) ClearSourceLineNumber() *BatchImageItemUpdateOne {
+ _u.mutation.ClearSourceLineNumber()
+ return _u
+}
+
+// SetSourceByteOffset sets the "source_byte_offset" field.
+func (_u *BatchImageItemUpdateOne) SetSourceByteOffset(v int64) *BatchImageItemUpdateOne {
+ _u.mutation.ResetSourceByteOffset()
+ _u.mutation.SetSourceByteOffset(v)
+ return _u
+}
+
+// SetNillableSourceByteOffset sets the "source_byte_offset" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableSourceByteOffset(v *int64) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetSourceByteOffset(*v)
+ }
+ return _u
+}
+
+// AddSourceByteOffset adds value to the "source_byte_offset" field.
+func (_u *BatchImageItemUpdateOne) AddSourceByteOffset(v int64) *BatchImageItemUpdateOne {
+ _u.mutation.AddSourceByteOffset(v)
+ return _u
+}
+
+// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
+func (_u *BatchImageItemUpdateOne) ClearSourceByteOffset() *BatchImageItemUpdateOne {
+ _u.mutation.ClearSourceByteOffset()
+ return _u
+}
+
+// SetSourceByteLength sets the "source_byte_length" field.
+func (_u *BatchImageItemUpdateOne) SetSourceByteLength(v int64) *BatchImageItemUpdateOne {
+ _u.mutation.ResetSourceByteLength()
+ _u.mutation.SetSourceByteLength(v)
+ return _u
+}
+
+// SetNillableSourceByteLength sets the "source_byte_length" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableSourceByteLength(v *int64) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetSourceByteLength(*v)
+ }
+ return _u
+}
+
+// AddSourceByteLength adds value to the "source_byte_length" field.
+func (_u *BatchImageItemUpdateOne) AddSourceByteLength(v int64) *BatchImageItemUpdateOne {
+ _u.mutation.AddSourceByteLength(v)
+ return _u
+}
+
+// ClearSourceByteLength clears the value of the "source_byte_length" field.
+func (_u *BatchImageItemUpdateOne) ClearSourceByteLength() *BatchImageItemUpdateOne {
+ _u.mutation.ClearSourceByteLength()
+ return _u
+}
+
+// SetMimeType sets the "mime_type" field.
+func (_u *BatchImageItemUpdateOne) SetMimeType(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetMimeType(v)
+ return _u
+}
+
+// SetNillableMimeType sets the "mime_type" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableMimeType(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetMimeType(*v)
+ }
+ return _u
+}
+
+// ClearMimeType clears the value of the "mime_type" field.
+func (_u *BatchImageItemUpdateOne) ClearMimeType() *BatchImageItemUpdateOne {
+ _u.mutation.ClearMimeType()
+ return _u
+}
+
+// SetFileExtension sets the "file_extension" field.
+func (_u *BatchImageItemUpdateOne) SetFileExtension(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetFileExtension(v)
+ return _u
+}
+
+// SetNillableFileExtension sets the "file_extension" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableFileExtension(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetFileExtension(*v)
+ }
+ return _u
+}
+
+// ClearFileExtension clears the value of the "file_extension" field.
+func (_u *BatchImageItemUpdateOne) ClearFileExtension() *BatchImageItemUpdateOne {
+ _u.mutation.ClearFileExtension()
+ return _u
+}
+
+// SetImageCount sets the "image_count" field.
+func (_u *BatchImageItemUpdateOne) SetImageCount(v int) *BatchImageItemUpdateOne {
+ _u.mutation.ResetImageCount()
+ _u.mutation.SetImageCount(v)
+ return _u
+}
+
+// SetNillableImageCount sets the "image_count" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableImageCount(v *int) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetImageCount(*v)
+ }
+ return _u
+}
+
+// AddImageCount adds value to the "image_count" field.
+func (_u *BatchImageItemUpdateOne) AddImageCount(v int) *BatchImageItemUpdateOne {
+ _u.mutation.AddImageCount(v)
+ return _u
+}
+
+// SetErrorCode sets the "error_code" field.
+func (_u *BatchImageItemUpdateOne) SetErrorCode(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetErrorCode(v)
+ return _u
+}
+
+// SetNillableErrorCode sets the "error_code" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableErrorCode(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetErrorCode(*v)
+ }
+ return _u
+}
+
+// ClearErrorCode clears the value of the "error_code" field.
+func (_u *BatchImageItemUpdateOne) ClearErrorCode() *BatchImageItemUpdateOne {
+ _u.mutation.ClearErrorCode()
+ return _u
+}
+
+// SetErrorMessage sets the "error_message" field.
+func (_u *BatchImageItemUpdateOne) SetErrorMessage(v string) *BatchImageItemUpdateOne {
+ _u.mutation.SetErrorMessage(v)
+ return _u
+}
+
+// SetNillableErrorMessage sets the "error_message" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableErrorMessage(v *string) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetErrorMessage(*v)
+ }
+ return _u
+}
+
+// ClearErrorMessage clears the value of the "error_message" field.
+func (_u *BatchImageItemUpdateOne) ClearErrorMessage() *BatchImageItemUpdateOne {
+ _u.mutation.ClearErrorMessage()
+ return _u
+}
+
+// SetBilledAmount sets the "billed_amount" field.
+func (_u *BatchImageItemUpdateOne) SetBilledAmount(v float64) *BatchImageItemUpdateOne {
+ _u.mutation.ResetBilledAmount()
+ _u.mutation.SetBilledAmount(v)
+ return _u
+}
+
+// SetNillableBilledAmount sets the "billed_amount" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableBilledAmount(v *float64) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetBilledAmount(*v)
+ }
+ return _u
+}
+
+// AddBilledAmount adds value to the "billed_amount" field.
+func (_u *BatchImageItemUpdateOne) AddBilledAmount(v float64) *BatchImageItemUpdateOne {
+ _u.mutation.AddBilledAmount(v)
+ return _u
+}
+
+// ClearBilledAmount clears the value of the "billed_amount" field.
+func (_u *BatchImageItemUpdateOne) ClearBilledAmount() *BatchImageItemUpdateOne {
+ _u.mutation.ClearBilledAmount()
+ return _u
+}
+
+// SetIndexedAt sets the "indexed_at" field.
+func (_u *BatchImageItemUpdateOne) SetIndexedAt(v time.Time) *BatchImageItemUpdateOne {
+ _u.mutation.SetIndexedAt(v)
+ return _u
+}
+
+// SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil.
+func (_u *BatchImageItemUpdateOne) SetNillableIndexedAt(v *time.Time) *BatchImageItemUpdateOne {
+ if v != nil {
+ _u.SetIndexedAt(*v)
+ }
+ return _u
+}
+
+// ClearIndexedAt clears the value of the "indexed_at" field.
+func (_u *BatchImageItemUpdateOne) ClearIndexedAt() *BatchImageItemUpdateOne {
+ _u.mutation.ClearIndexedAt()
+ return _u
+}
+
+// Mutation returns the BatchImageItemMutation object of the builder.
+func (_u *BatchImageItemUpdateOne) Mutation() *BatchImageItemMutation {
+ return _u.mutation
+}
+
+// Where appends a list predicates to the BatchImageItemUpdate builder.
+func (_u *BatchImageItemUpdateOne) Where(ps ...predicate.BatchImageItem) *BatchImageItemUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (_u *BatchImageItemUpdateOne) Select(field string, fields ...string) *BatchImageItemUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
+}
+
+// Save executes the query and returns the updated BatchImageItem entity.
+func (_u *BatchImageItemUpdateOne) Save(ctx context.Context) (*BatchImageItem, error) {
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_u *BatchImageItemUpdateOne) SaveX(ctx context.Context) *BatchImageItem {
+ node, err := _u.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (_u *BatchImageItemUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_u *BatchImageItemUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_u *BatchImageItemUpdateOne) check() error {
+ if v, ok := _u.mutation.JobID(); ok {
+ if err := batchimageitem.JobIDValidator(v); err != nil {
+ return &ValidationError{Name: "job_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.job_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.CustomID(); ok {
+ if err := batchimageitem.CustomIDValidator(v); err != nil {
+ return &ValidationError{Name: "custom_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.custom_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Status(); ok {
+ if err := batchimageitem.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.status": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.RequestHash(); ok {
+ if err := batchimageitem.RequestHashValidator(v); err != nil {
+ return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.request_hash": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderSourceObject(); ok {
+ if err := batchimageitem.ProviderSourceObjectValidator(v); err != nil {
+ return &ValidationError{Name: "provider_source_object", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.provider_source_object": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.MimeType(); ok {
+ if err := batchimageitem.MimeTypeValidator(v); err != nil {
+ return &ValidationError{Name: "mime_type", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.mime_type": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.FileExtension(); ok {
+ if err := batchimageitem.FileExtensionValidator(v); err != nil {
+ return &ValidationError{Name: "file_extension", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.file_extension": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ErrorCode(); ok {
+ if err := batchimageitem.ErrorCodeValidator(v); err != nil {
+ return &ValidationError{Name: "error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageItem.error_code": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (_u *BatchImageItemUpdateOne) sqlSave(ctx context.Context) (_node *BatchImageItem, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(batchimageitem.Table, batchimageitem.Columns, sqlgraph.NewFieldSpec(batchimageitem.FieldID, field.TypeInt64))
+ id, ok := _u.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BatchImageItem.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := _u.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, batchimageitem.FieldID)
+ for _, f := range fields {
+ if !batchimageitem.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != batchimageitem.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := _u.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := _u.mutation.JobID(); ok {
+ _spec.SetField(batchimageitem.FieldJobID, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.CustomID(); ok {
+ _spec.SetField(batchimageitem.FieldCustomID, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Status(); ok {
+ _spec.SetField(batchimageitem.FieldStatus, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.RequestHash(); ok {
+ _spec.SetField(batchimageitem.FieldRequestHash, field.TypeString, value)
+ }
+ if _u.mutation.RequestHashCleared() {
+ _spec.ClearField(batchimageitem.FieldRequestHash, field.TypeString)
+ }
+ if value, ok := _u.mutation.PromptPreview(); ok {
+ _spec.SetField(batchimageitem.FieldPromptPreview, field.TypeString, value)
+ }
+ if _u.mutation.PromptPreviewCleared() {
+ _spec.ClearField(batchimageitem.FieldPromptPreview, field.TypeString)
+ }
+ if value, ok := _u.mutation.ProviderSourceObject(); ok {
+ _spec.SetField(batchimageitem.FieldProviderSourceObject, field.TypeString, value)
+ }
+ if _u.mutation.ProviderSourceObjectCleared() {
+ _spec.ClearField(batchimageitem.FieldProviderSourceObject, field.TypeString)
+ }
+ if value, ok := _u.mutation.SourceLineNumber(); ok {
+ _spec.SetField(batchimageitem.FieldSourceLineNumber, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedSourceLineNumber(); ok {
+ _spec.AddField(batchimageitem.FieldSourceLineNumber, field.TypeInt, value)
+ }
+ if _u.mutation.SourceLineNumberCleared() {
+ _spec.ClearField(batchimageitem.FieldSourceLineNumber, field.TypeInt)
+ }
+ if value, ok := _u.mutation.SourceByteOffset(); ok {
+ _spec.SetField(batchimageitem.FieldSourceByteOffset, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedSourceByteOffset(); ok {
+ _spec.AddField(batchimageitem.FieldSourceByteOffset, field.TypeInt64, value)
+ }
+ if _u.mutation.SourceByteOffsetCleared() {
+ _spec.ClearField(batchimageitem.FieldSourceByteOffset, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.SourceByteLength(); ok {
+ _spec.SetField(batchimageitem.FieldSourceByteLength, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedSourceByteLength(); ok {
+ _spec.AddField(batchimageitem.FieldSourceByteLength, field.TypeInt64, value)
+ }
+ if _u.mutation.SourceByteLengthCleared() {
+ _spec.ClearField(batchimageitem.FieldSourceByteLength, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.MimeType(); ok {
+ _spec.SetField(batchimageitem.FieldMimeType, field.TypeString, value)
+ }
+ if _u.mutation.MimeTypeCleared() {
+ _spec.ClearField(batchimageitem.FieldMimeType, field.TypeString)
+ }
+ if value, ok := _u.mutation.FileExtension(); ok {
+ _spec.SetField(batchimageitem.FieldFileExtension, field.TypeString, value)
+ }
+ if _u.mutation.FileExtensionCleared() {
+ _spec.ClearField(batchimageitem.FieldFileExtension, field.TypeString)
+ }
+ if value, ok := _u.mutation.ImageCount(); ok {
+ _spec.SetField(batchimageitem.FieldImageCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedImageCount(); ok {
+ _spec.AddField(batchimageitem.FieldImageCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.ErrorCode(); ok {
+ _spec.SetField(batchimageitem.FieldErrorCode, field.TypeString, value)
+ }
+ if _u.mutation.ErrorCodeCleared() {
+ _spec.ClearField(batchimageitem.FieldErrorCode, field.TypeString)
+ }
+ if value, ok := _u.mutation.ErrorMessage(); ok {
+ _spec.SetField(batchimageitem.FieldErrorMessage, field.TypeString, value)
+ }
+ if _u.mutation.ErrorMessageCleared() {
+ _spec.ClearField(batchimageitem.FieldErrorMessage, field.TypeString)
+ }
+ if value, ok := _u.mutation.BilledAmount(); ok {
+ _spec.SetField(batchimageitem.FieldBilledAmount, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedBilledAmount(); ok {
+ _spec.AddField(batchimageitem.FieldBilledAmount, field.TypeFloat64, value)
+ }
+ if _u.mutation.BilledAmountCleared() {
+ _spec.ClearField(batchimageitem.FieldBilledAmount, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.IndexedAt(); ok {
+ _spec.SetField(batchimageitem.FieldIndexedAt, field.TypeTime, value)
+ }
+ if _u.mutation.IndexedAtCleared() {
+ _spec.ClearField(batchimageitem.FieldIndexedAt, field.TypeTime)
+ }
+ _node = &BatchImageItem{config: _u.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{batchimageitem.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ _u.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/ent/batchimagejob.go b/backend/ent/batchimagejob.go
new file mode 100644
index 0000000000..29f09bb289
--- /dev/null
+++ b/backend/ent/batchimagejob.go
@@ -0,0 +1,609 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "fmt"
+ "strings"
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/sql"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
+)
+
+// BatchImageJob is the model entity for the BatchImageJob schema.
+type BatchImageJob struct {
+ config `json:"-"`
+ // ID of the ent.
+ ID int64 `json:"id,omitempty"`
+ // BatchID holds the value of the "batch_id" field.
+ BatchID string `json:"batch_id,omitempty"`
+ // UserID holds the value of the "user_id" field.
+ UserID int64 `json:"user_id,omitempty"`
+ // APIKeyID holds the value of the "api_key_id" field.
+ APIKeyID *int64 `json:"api_key_id,omitempty"`
+ // AccountID holds the value of the "account_id" field.
+ AccountID *int64 `json:"account_id,omitempty"`
+ // Provider holds the value of the "provider" field.
+ Provider string `json:"provider,omitempty"`
+ // Model holds the value of the "model" field.
+ Model string `json:"model,omitempty"`
+ // TaskName holds the value of the "task_name" field.
+ TaskName string `json:"task_name,omitempty"`
+ // Status holds the value of the "status" field.
+ Status string `json:"status,omitempty"`
+ // ProviderJobName holds the value of the "provider_job_name" field.
+ ProviderJobName *string `json:"provider_job_name,omitempty"`
+ // ProviderInputRef holds the value of the "provider_input_ref" field.
+ ProviderInputRef *string `json:"provider_input_ref,omitempty"`
+ // ProviderOutputRef holds the value of the "provider_output_ref" field.
+ ProviderOutputRef *string `json:"provider_output_ref,omitempty"`
+ // GcsInputURI holds the value of the "gcs_input_uri" field.
+ GcsInputURI *string `json:"gcs_input_uri,omitempty"`
+ // GcsOutputURI holds the value of the "gcs_output_uri" field.
+ GcsOutputURI *string `json:"gcs_output_uri,omitempty"`
+ // ItemCount holds the value of the "item_count" field.
+ ItemCount int `json:"item_count,omitempty"`
+ // SuccessCount holds the value of the "success_count" field.
+ SuccessCount int `json:"success_count,omitempty"`
+ // FailCount holds the value of the "fail_count" field.
+ FailCount int `json:"fail_count,omitempty"`
+ // CancelledCount holds the value of the "cancelled_count" field.
+ CancelledCount int `json:"cancelled_count,omitempty"`
+ // EstimatedCost holds the value of the "estimated_cost" field.
+ EstimatedCost float64 `json:"estimated_cost,omitempty"`
+ // HoldAmount holds the value of the "hold_amount" field.
+ HoldAmount *float64 `json:"hold_amount,omitempty"`
+ // ActualCost holds the value of the "actual_cost" field.
+ ActualCost *float64 `json:"actual_cost,omitempty"`
+ // Currency holds the value of the "currency" field.
+ Currency string `json:"currency,omitempty"`
+ // HoldID holds the value of the "hold_id" field.
+ HoldID *string `json:"hold_id,omitempty"`
+ // IdempotencyKey holds the value of the "idempotency_key" field.
+ IdempotencyKey *string `json:"idempotency_key,omitempty"`
+ // RequestHash holds the value of the "request_hash" field.
+ RequestHash *string `json:"request_hash,omitempty"`
+ // ManifestHash holds the value of the "manifest_hash" field.
+ ManifestHash *string `json:"manifest_hash,omitempty"`
+ // RetryCount holds the value of the "retry_count" field.
+ RetryCount int `json:"retry_count,omitempty"`
+ // Version holds the value of the "version" field.
+ Version int `json:"version,omitempty"`
+ // OutputExpiresAt holds the value of the "output_expires_at" field.
+ OutputExpiresAt *time.Time `json:"output_expires_at,omitempty"`
+ // InputDeletedAt holds the value of the "input_deleted_at" field.
+ InputDeletedAt *time.Time `json:"input_deleted_at,omitempty"`
+ // OutputDeletedAt holds the value of the "output_deleted_at" field.
+ OutputDeletedAt *time.Time `json:"output_deleted_at,omitempty"`
+ // DownloadedAt holds the value of the "downloaded_at" field.
+ DownloadedAt *time.Time `json:"downloaded_at,omitempty"`
+ // UserDeletedAt holds the value of the "user_deleted_at" field.
+ UserDeletedAt *time.Time `json:"user_deleted_at,omitempty"`
+ // LastErrorCode holds the value of the "last_error_code" field.
+ LastErrorCode *string `json:"last_error_code,omitempty"`
+ // LastErrorMessage holds the value of the "last_error_message" field.
+ LastErrorMessage *string `json:"last_error_message,omitempty"`
+ // CreatedAt holds the value of the "created_at" field.
+ CreatedAt time.Time `json:"created_at,omitempty"`
+ // UpdatedAt holds the value of the "updated_at" field.
+ UpdatedAt time.Time `json:"updated_at,omitempty"`
+ // SubmittedAt holds the value of the "submitted_at" field.
+ SubmittedAt *time.Time `json:"submitted_at,omitempty"`
+ // StartedAt holds the value of the "started_at" field.
+ StartedAt *time.Time `json:"started_at,omitempty"`
+ // FinishedAt holds the value of the "finished_at" field.
+ FinishedAt *time.Time `json:"finished_at,omitempty"`
+ // SettledAt holds the value of the "settled_at" field.
+ SettledAt *time.Time `json:"settled_at,omitempty"`
+ selectValues sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*BatchImageJob) scanValues(columns []string) ([]any, error) {
+ values := make([]any, len(columns))
+ for i := range columns {
+ switch columns[i] {
+ case batchimagejob.FieldEstimatedCost, batchimagejob.FieldHoldAmount, batchimagejob.FieldActualCost:
+ values[i] = new(sql.NullFloat64)
+ case batchimagejob.FieldID, batchimagejob.FieldUserID, batchimagejob.FieldAPIKeyID, batchimagejob.FieldAccountID, batchimagejob.FieldItemCount, batchimagejob.FieldSuccessCount, batchimagejob.FieldFailCount, batchimagejob.FieldCancelledCount, batchimagejob.FieldRetryCount, batchimagejob.FieldVersion:
+ values[i] = new(sql.NullInt64)
+ case batchimagejob.FieldBatchID, batchimagejob.FieldProvider, batchimagejob.FieldModel, batchimagejob.FieldTaskName, batchimagejob.FieldStatus, batchimagejob.FieldProviderJobName, batchimagejob.FieldProviderInputRef, batchimagejob.FieldProviderOutputRef, batchimagejob.FieldGcsInputURI, batchimagejob.FieldGcsOutputURI, batchimagejob.FieldCurrency, batchimagejob.FieldHoldID, batchimagejob.FieldIdempotencyKey, batchimagejob.FieldRequestHash, batchimagejob.FieldManifestHash, batchimagejob.FieldLastErrorCode, batchimagejob.FieldLastErrorMessage:
+ values[i] = new(sql.NullString)
+ case batchimagejob.FieldOutputExpiresAt, batchimagejob.FieldInputDeletedAt, batchimagejob.FieldOutputDeletedAt, batchimagejob.FieldDownloadedAt, batchimagejob.FieldUserDeletedAt, batchimagejob.FieldCreatedAt, batchimagejob.FieldUpdatedAt, batchimagejob.FieldSubmittedAt, batchimagejob.FieldStartedAt, batchimagejob.FieldFinishedAt, batchimagejob.FieldSettledAt:
+ values[i] = new(sql.NullTime)
+ default:
+ values[i] = new(sql.UnknownType)
+ }
+ }
+ return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the BatchImageJob fields.
+func (_m *BatchImageJob) assignValues(columns []string, values []any) error {
+ if m, n := len(values), len(columns); m < n {
+ return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+ }
+ for i := range columns {
+ switch columns[i] {
+ case batchimagejob.FieldID:
+ value, ok := values[i].(*sql.NullInt64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field id", value)
+ }
+ _m.ID = int64(value.Int64)
+ case batchimagejob.FieldBatchID:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field batch_id", values[i])
+ } else if value.Valid {
+ _m.BatchID = value.String
+ }
+ case batchimagejob.FieldUserID:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field user_id", values[i])
+ } else if value.Valid {
+ _m.UserID = value.Int64
+ }
+ case batchimagejob.FieldAPIKeyID:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field api_key_id", values[i])
+ } else if value.Valid {
+ _m.APIKeyID = new(int64)
+ *_m.APIKeyID = value.Int64
+ }
+ case batchimagejob.FieldAccountID:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field account_id", values[i])
+ } else if value.Valid {
+ _m.AccountID = new(int64)
+ *_m.AccountID = value.Int64
+ }
+ case batchimagejob.FieldProvider:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field provider", values[i])
+ } else if value.Valid {
+ _m.Provider = value.String
+ }
+ case batchimagejob.FieldModel:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field model", values[i])
+ } else if value.Valid {
+ _m.Model = value.String
+ }
+ case batchimagejob.FieldTaskName:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field task_name", values[i])
+ } else if value.Valid {
+ _m.TaskName = value.String
+ }
+ case batchimagejob.FieldStatus:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field status", values[i])
+ } else if value.Valid {
+ _m.Status = value.String
+ }
+ case batchimagejob.FieldProviderJobName:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field provider_job_name", values[i])
+ } else if value.Valid {
+ _m.ProviderJobName = new(string)
+ *_m.ProviderJobName = value.String
+ }
+ case batchimagejob.FieldProviderInputRef:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field provider_input_ref", values[i])
+ } else if value.Valid {
+ _m.ProviderInputRef = new(string)
+ *_m.ProviderInputRef = value.String
+ }
+ case batchimagejob.FieldProviderOutputRef:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field provider_output_ref", values[i])
+ } else if value.Valid {
+ _m.ProviderOutputRef = new(string)
+ *_m.ProviderOutputRef = value.String
+ }
+ case batchimagejob.FieldGcsInputURI:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field gcs_input_uri", values[i])
+ } else if value.Valid {
+ _m.GcsInputURI = new(string)
+ *_m.GcsInputURI = value.String
+ }
+ case batchimagejob.FieldGcsOutputURI:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field gcs_output_uri", values[i])
+ } else if value.Valid {
+ _m.GcsOutputURI = new(string)
+ *_m.GcsOutputURI = value.String
+ }
+ case batchimagejob.FieldItemCount:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field item_count", values[i])
+ } else if value.Valid {
+ _m.ItemCount = int(value.Int64)
+ }
+ case batchimagejob.FieldSuccessCount:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field success_count", values[i])
+ } else if value.Valid {
+ _m.SuccessCount = int(value.Int64)
+ }
+ case batchimagejob.FieldFailCount:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field fail_count", values[i])
+ } else if value.Valid {
+ _m.FailCount = int(value.Int64)
+ }
+ case batchimagejob.FieldCancelledCount:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field cancelled_count", values[i])
+ } else if value.Valid {
+ _m.CancelledCount = int(value.Int64)
+ }
+ case batchimagejob.FieldEstimatedCost:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field estimated_cost", values[i])
+ } else if value.Valid {
+ _m.EstimatedCost = value.Float64
+ }
+ case batchimagejob.FieldHoldAmount:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field hold_amount", values[i])
+ } else if value.Valid {
+ _m.HoldAmount = new(float64)
+ *_m.HoldAmount = value.Float64
+ }
+ case batchimagejob.FieldActualCost:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field actual_cost", values[i])
+ } else if value.Valid {
+ _m.ActualCost = new(float64)
+ *_m.ActualCost = value.Float64
+ }
+ case batchimagejob.FieldCurrency:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field currency", values[i])
+ } else if value.Valid {
+ _m.Currency = value.String
+ }
+ case batchimagejob.FieldHoldID:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field hold_id", values[i])
+ } else if value.Valid {
+ _m.HoldID = new(string)
+ *_m.HoldID = value.String
+ }
+ case batchimagejob.FieldIdempotencyKey:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field idempotency_key", values[i])
+ } else if value.Valid {
+ _m.IdempotencyKey = new(string)
+ *_m.IdempotencyKey = value.String
+ }
+ case batchimagejob.FieldRequestHash:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field request_hash", values[i])
+ } else if value.Valid {
+ _m.RequestHash = new(string)
+ *_m.RequestHash = value.String
+ }
+ case batchimagejob.FieldManifestHash:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field manifest_hash", values[i])
+ } else if value.Valid {
+ _m.ManifestHash = new(string)
+ *_m.ManifestHash = value.String
+ }
+ case batchimagejob.FieldRetryCount:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field retry_count", values[i])
+ } else if value.Valid {
+ _m.RetryCount = int(value.Int64)
+ }
+ case batchimagejob.FieldVersion:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field version", values[i])
+ } else if value.Valid {
+ _m.Version = int(value.Int64)
+ }
+ case batchimagejob.FieldOutputExpiresAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field output_expires_at", values[i])
+ } else if value.Valid {
+ _m.OutputExpiresAt = new(time.Time)
+ *_m.OutputExpiresAt = value.Time
+ }
+ case batchimagejob.FieldInputDeletedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field input_deleted_at", values[i])
+ } else if value.Valid {
+ _m.InputDeletedAt = new(time.Time)
+ *_m.InputDeletedAt = value.Time
+ }
+ case batchimagejob.FieldOutputDeletedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field output_deleted_at", values[i])
+ } else if value.Valid {
+ _m.OutputDeletedAt = new(time.Time)
+ *_m.OutputDeletedAt = value.Time
+ }
+ case batchimagejob.FieldDownloadedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field downloaded_at", values[i])
+ } else if value.Valid {
+ _m.DownloadedAt = new(time.Time)
+ *_m.DownloadedAt = value.Time
+ }
+ case batchimagejob.FieldUserDeletedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field user_deleted_at", values[i])
+ } else if value.Valid {
+ _m.UserDeletedAt = new(time.Time)
+ *_m.UserDeletedAt = value.Time
+ }
+ case batchimagejob.FieldLastErrorCode:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field last_error_code", values[i])
+ } else if value.Valid {
+ _m.LastErrorCode = new(string)
+ *_m.LastErrorCode = value.String
+ }
+ case batchimagejob.FieldLastErrorMessage:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field last_error_message", values[i])
+ } else if value.Valid {
+ _m.LastErrorMessage = new(string)
+ *_m.LastErrorMessage = value.String
+ }
+ case batchimagejob.FieldCreatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ } else if value.Valid {
+ _m.CreatedAt = value.Time
+ }
+ case batchimagejob.FieldUpdatedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+ } else if value.Valid {
+ _m.UpdatedAt = value.Time
+ }
+ case batchimagejob.FieldSubmittedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field submitted_at", values[i])
+ } else if value.Valid {
+ _m.SubmittedAt = new(time.Time)
+ *_m.SubmittedAt = value.Time
+ }
+ case batchimagejob.FieldStartedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field started_at", values[i])
+ } else if value.Valid {
+ _m.StartedAt = new(time.Time)
+ *_m.StartedAt = value.Time
+ }
+ case batchimagejob.FieldFinishedAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field finished_at", values[i])
+ } else if value.Valid {
+ _m.FinishedAt = new(time.Time)
+ *_m.FinishedAt = value.Time
+ }
+ case batchimagejob.FieldSettledAt:
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field settled_at", values[i])
+ } else if value.Valid {
+ _m.SettledAt = new(time.Time)
+ *_m.SettledAt = value.Time
+ }
+ default:
+ _m.selectValues.Set(columns[i], values[i])
+ }
+ }
+ return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the BatchImageJob.
+// This includes values selected through modifiers, order, etc.
+func (_m *BatchImageJob) Value(name string) (ent.Value, error) {
+ return _m.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this BatchImageJob.
+// Note that you need to call BatchImageJob.Unwrap() before calling this method if this BatchImageJob
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (_m *BatchImageJob) Update() *BatchImageJobUpdateOne {
+ return NewBatchImageJobClient(_m.config).UpdateOne(_m)
+}
+
+// Unwrap unwraps the BatchImageJob entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (_m *BatchImageJob) Unwrap() *BatchImageJob {
+ _tx, ok := _m.config.driver.(*txDriver)
+ if !ok {
+ panic("ent: BatchImageJob is not a transactional entity")
+ }
+ _m.config.driver = _tx.drv
+ return _m
+}
+
+// String implements the fmt.Stringer.
+func (_m *BatchImageJob) String() string {
+ var builder strings.Builder
+ builder.WriteString("BatchImageJob(")
+ builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
+ builder.WriteString("batch_id=")
+ builder.WriteString(_m.BatchID)
+ builder.WriteString(", ")
+ builder.WriteString("user_id=")
+ builder.WriteString(fmt.Sprintf("%v", _m.UserID))
+ builder.WriteString(", ")
+ if v := _m.APIKeyID; v != nil {
+ builder.WriteString("api_key_id=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ if v := _m.AccountID; v != nil {
+ builder.WriteString("account_id=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ builder.WriteString("provider=")
+ builder.WriteString(_m.Provider)
+ builder.WriteString(", ")
+ builder.WriteString("model=")
+ builder.WriteString(_m.Model)
+ builder.WriteString(", ")
+ builder.WriteString("task_name=")
+ builder.WriteString(_m.TaskName)
+ builder.WriteString(", ")
+ builder.WriteString("status=")
+ builder.WriteString(_m.Status)
+ builder.WriteString(", ")
+ if v := _m.ProviderJobName; v != nil {
+ builder.WriteString("provider_job_name=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.ProviderInputRef; v != nil {
+ builder.WriteString("provider_input_ref=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.ProviderOutputRef; v != nil {
+ builder.WriteString("provider_output_ref=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.GcsInputURI; v != nil {
+ builder.WriteString("gcs_input_uri=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.GcsOutputURI; v != nil {
+ builder.WriteString("gcs_output_uri=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ builder.WriteString("item_count=")
+ builder.WriteString(fmt.Sprintf("%v", _m.ItemCount))
+ builder.WriteString(", ")
+ builder.WriteString("success_count=")
+ builder.WriteString(fmt.Sprintf("%v", _m.SuccessCount))
+ builder.WriteString(", ")
+ builder.WriteString("fail_count=")
+ builder.WriteString(fmt.Sprintf("%v", _m.FailCount))
+ builder.WriteString(", ")
+ builder.WriteString("cancelled_count=")
+ builder.WriteString(fmt.Sprintf("%v", _m.CancelledCount))
+ builder.WriteString(", ")
+ builder.WriteString("estimated_cost=")
+ builder.WriteString(fmt.Sprintf("%v", _m.EstimatedCost))
+ builder.WriteString(", ")
+ if v := _m.HoldAmount; v != nil {
+ builder.WriteString("hold_amount=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ if v := _m.ActualCost; v != nil {
+ builder.WriteString("actual_cost=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ builder.WriteString("currency=")
+ builder.WriteString(_m.Currency)
+ builder.WriteString(", ")
+ if v := _m.HoldID; v != nil {
+ builder.WriteString("hold_id=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.IdempotencyKey; v != nil {
+ builder.WriteString("idempotency_key=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.RequestHash; v != nil {
+ builder.WriteString("request_hash=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.ManifestHash; v != nil {
+ builder.WriteString("manifest_hash=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ builder.WriteString("retry_count=")
+ builder.WriteString(fmt.Sprintf("%v", _m.RetryCount))
+ builder.WriteString(", ")
+ builder.WriteString("version=")
+ builder.WriteString(fmt.Sprintf("%v", _m.Version))
+ builder.WriteString(", ")
+ if v := _m.OutputExpiresAt; v != nil {
+ builder.WriteString("output_expires_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.InputDeletedAt; v != nil {
+ builder.WriteString("input_deleted_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.OutputDeletedAt; v != nil {
+ builder.WriteString("output_deleted_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.DownloadedAt; v != nil {
+ builder.WriteString("downloaded_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.UserDeletedAt; v != nil {
+ builder.WriteString("user_deleted_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.LastErrorCode; v != nil {
+ builder.WriteString("last_error_code=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.LastErrorMessage; v != nil {
+ builder.WriteString("last_error_message=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ builder.WriteString("created_at=")
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ builder.WriteString("updated_at=")
+ builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
+ builder.WriteString(", ")
+ if v := _m.SubmittedAt; v != nil {
+ builder.WriteString("submitted_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.StartedAt; v != nil {
+ builder.WriteString("started_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.FinishedAt; v != nil {
+ builder.WriteString("finished_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteString(", ")
+ if v := _m.SettledAt; v != nil {
+ builder.WriteString("settled_at=")
+ builder.WriteString(v.Format(time.ANSIC))
+ }
+ builder.WriteByte(')')
+ return builder.String()
+}
+
+// BatchImageJobs is a parsable slice of BatchImageJob.
+type BatchImageJobs []*BatchImageJob
diff --git a/backend/ent/batchimagejob/batchimagejob.go b/backend/ent/batchimagejob/batchimagejob.go
new file mode 100644
index 0000000000..be819183da
--- /dev/null
+++ b/backend/ent/batchimagejob/batchimagejob.go
@@ -0,0 +1,420 @@
+// Code generated by ent, DO NOT EDIT.
+
+package batchimagejob
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+)
+
+const (
+ // Label holds the string label denoting the batchimagejob type in the database.
+ Label = "batch_image_job"
+ // FieldID holds the string denoting the id field in the database.
+ FieldID = "id"
+ // FieldBatchID holds the string denoting the batch_id field in the database.
+ FieldBatchID = "batch_id"
+ // FieldUserID holds the string denoting the user_id field in the database.
+ FieldUserID = "user_id"
+ // FieldAPIKeyID holds the string denoting the api_key_id field in the database.
+ FieldAPIKeyID = "api_key_id"
+ // FieldAccountID holds the string denoting the account_id field in the database.
+ FieldAccountID = "account_id"
+ // FieldProvider holds the string denoting the provider field in the database.
+ FieldProvider = "provider"
+ // FieldModel holds the string denoting the model field in the database.
+ FieldModel = "model"
+ // FieldTaskName holds the string denoting the task_name field in the database.
+ FieldTaskName = "task_name"
+ // FieldStatus holds the string denoting the status field in the database.
+ FieldStatus = "status"
+ // FieldProviderJobName holds the string denoting the provider_job_name field in the database.
+ FieldProviderJobName = "provider_job_name"
+ // FieldProviderInputRef holds the string denoting the provider_input_ref field in the database.
+ FieldProviderInputRef = "provider_input_ref"
+ // FieldProviderOutputRef holds the string denoting the provider_output_ref field in the database.
+ FieldProviderOutputRef = "provider_output_ref"
+ // FieldGcsInputURI holds the string denoting the gcs_input_uri field in the database.
+ FieldGcsInputURI = "gcs_input_uri"
+ // FieldGcsOutputURI holds the string denoting the gcs_output_uri field in the database.
+ FieldGcsOutputURI = "gcs_output_uri"
+ // FieldItemCount holds the string denoting the item_count field in the database.
+ FieldItemCount = "item_count"
+ // FieldSuccessCount holds the string denoting the success_count field in the database.
+ FieldSuccessCount = "success_count"
+ // FieldFailCount holds the string denoting the fail_count field in the database.
+ FieldFailCount = "fail_count"
+ // FieldCancelledCount holds the string denoting the cancelled_count field in the database.
+ FieldCancelledCount = "cancelled_count"
+ // FieldEstimatedCost holds the string denoting the estimated_cost field in the database.
+ FieldEstimatedCost = "estimated_cost"
+ // FieldHoldAmount holds the string denoting the hold_amount field in the database.
+ FieldHoldAmount = "hold_amount"
+ // FieldActualCost holds the string denoting the actual_cost field in the database.
+ FieldActualCost = "actual_cost"
+ // FieldCurrency holds the string denoting the currency field in the database.
+ FieldCurrency = "currency"
+ // FieldHoldID holds the string denoting the hold_id field in the database.
+ FieldHoldID = "hold_id"
+ // FieldIdempotencyKey holds the string denoting the idempotency_key field in the database.
+ FieldIdempotencyKey = "idempotency_key"
+ // FieldRequestHash holds the string denoting the request_hash field in the database.
+ FieldRequestHash = "request_hash"
+ // FieldManifestHash holds the string denoting the manifest_hash field in the database.
+ FieldManifestHash = "manifest_hash"
+ // FieldRetryCount holds the string denoting the retry_count field in the database.
+ FieldRetryCount = "retry_count"
+ // FieldVersion holds the string denoting the version field in the database.
+ FieldVersion = "version"
+ // FieldOutputExpiresAt holds the string denoting the output_expires_at field in the database.
+ FieldOutputExpiresAt = "output_expires_at"
+ // FieldInputDeletedAt holds the string denoting the input_deleted_at field in the database.
+ FieldInputDeletedAt = "input_deleted_at"
+ // FieldOutputDeletedAt holds the string denoting the output_deleted_at field in the database.
+ FieldOutputDeletedAt = "output_deleted_at"
+ // FieldDownloadedAt holds the string denoting the downloaded_at field in the database.
+ FieldDownloadedAt = "downloaded_at"
+ // FieldUserDeletedAt holds the string denoting the user_deleted_at field in the database.
+ FieldUserDeletedAt = "user_deleted_at"
+ // FieldLastErrorCode holds the string denoting the last_error_code field in the database.
+ FieldLastErrorCode = "last_error_code"
+ // FieldLastErrorMessage holds the string denoting the last_error_message field in the database.
+ FieldLastErrorMessage = "last_error_message"
+ // FieldCreatedAt holds the string denoting the created_at field in the database.
+ FieldCreatedAt = "created_at"
+ // FieldUpdatedAt holds the string denoting the updated_at field in the database.
+ FieldUpdatedAt = "updated_at"
+ // FieldSubmittedAt holds the string denoting the submitted_at field in the database.
+ FieldSubmittedAt = "submitted_at"
+ // FieldStartedAt holds the string denoting the started_at field in the database.
+ FieldStartedAt = "started_at"
+ // FieldFinishedAt holds the string denoting the finished_at field in the database.
+ FieldFinishedAt = "finished_at"
+ // FieldSettledAt holds the string denoting the settled_at field in the database.
+ FieldSettledAt = "settled_at"
+ // Table holds the table name of the batchimagejob in the database.
+ Table = "batch_image_jobs"
+)
+
+// Columns holds all SQL columns for batchimagejob fields.
+var Columns = []string{
+ FieldID,
+ FieldBatchID,
+ FieldUserID,
+ FieldAPIKeyID,
+ FieldAccountID,
+ FieldProvider,
+ FieldModel,
+ FieldTaskName,
+ FieldStatus,
+ FieldProviderJobName,
+ FieldProviderInputRef,
+ FieldProviderOutputRef,
+ FieldGcsInputURI,
+ FieldGcsOutputURI,
+ FieldItemCount,
+ FieldSuccessCount,
+ FieldFailCount,
+ FieldCancelledCount,
+ FieldEstimatedCost,
+ FieldHoldAmount,
+ FieldActualCost,
+ FieldCurrency,
+ FieldHoldID,
+ FieldIdempotencyKey,
+ FieldRequestHash,
+ FieldManifestHash,
+ FieldRetryCount,
+ FieldVersion,
+ FieldOutputExpiresAt,
+ FieldInputDeletedAt,
+ FieldOutputDeletedAt,
+ FieldDownloadedAt,
+ FieldUserDeletedAt,
+ FieldLastErrorCode,
+ FieldLastErrorMessage,
+ FieldCreatedAt,
+ FieldUpdatedAt,
+ FieldSubmittedAt,
+ FieldStartedAt,
+ FieldFinishedAt,
+ FieldSettledAt,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+ for i := range Columns {
+ if column == Columns[i] {
+ return true
+ }
+ }
+ return false
+}
+
+var (
+ // BatchIDValidator is a validator for the "batch_id" field. It is called by the builders before save.
+ BatchIDValidator func(string) error
+ // ProviderValidator is a validator for the "provider" field. It is called by the builders before save.
+ ProviderValidator func(string) error
+ // ModelValidator is a validator for the "model" field. It is called by the builders before save.
+ ModelValidator func(string) error
+ // DefaultTaskName holds the default value on creation for the "task_name" field.
+ DefaultTaskName string
+ // TaskNameValidator is a validator for the "task_name" field. It is called by the builders before save.
+ TaskNameValidator func(string) error
+ // DefaultStatus holds the default value on creation for the "status" field.
+ DefaultStatus string
+ // StatusValidator is a validator for the "status" field. It is called by the builders before save.
+ StatusValidator func(string) error
+ // ProviderJobNameValidator is a validator for the "provider_job_name" field. It is called by the builders before save.
+ ProviderJobNameValidator func(string) error
+ // ProviderInputRefValidator is a validator for the "provider_input_ref" field. It is called by the builders before save.
+ ProviderInputRefValidator func(string) error
+ // ProviderOutputRefValidator is a validator for the "provider_output_ref" field. It is called by the builders before save.
+ ProviderOutputRefValidator func(string) error
+ // GcsInputURIValidator is a validator for the "gcs_input_uri" field. It is called by the builders before save.
+ GcsInputURIValidator func(string) error
+ // GcsOutputURIValidator is a validator for the "gcs_output_uri" field. It is called by the builders before save.
+ GcsOutputURIValidator func(string) error
+ // DefaultSuccessCount holds the default value on creation for the "success_count" field.
+ DefaultSuccessCount int
+ // DefaultFailCount holds the default value on creation for the "fail_count" field.
+ DefaultFailCount int
+ // DefaultCancelledCount holds the default value on creation for the "cancelled_count" field.
+ DefaultCancelledCount int
+ // DefaultEstimatedCost holds the default value on creation for the "estimated_cost" field.
+ DefaultEstimatedCost float64
+ // DefaultCurrency holds the default value on creation for the "currency" field.
+ DefaultCurrency string
+ // CurrencyValidator is a validator for the "currency" field. It is called by the builders before save.
+ CurrencyValidator func(string) error
+ // HoldIDValidator is a validator for the "hold_id" field. It is called by the builders before save.
+ HoldIDValidator func(string) error
+ // IdempotencyKeyValidator is a validator for the "idempotency_key" field. It is called by the builders before save.
+ IdempotencyKeyValidator func(string) error
+ // RequestHashValidator is a validator for the "request_hash" field. It is called by the builders before save.
+ RequestHashValidator func(string) error
+ // ManifestHashValidator is a validator for the "manifest_hash" field. It is called by the builders before save.
+ ManifestHashValidator func(string) error
+ // DefaultRetryCount holds the default value on creation for the "retry_count" field.
+ DefaultRetryCount int
+ // DefaultVersion holds the default value on creation for the "version" field.
+ DefaultVersion int
+ // LastErrorCodeValidator is a validator for the "last_error_code" field. It is called by the builders before save.
+ LastErrorCodeValidator func(string) error
+ // DefaultCreatedAt holds the default value on creation for the "created_at" field.
+ DefaultCreatedAt func() time.Time
+ // DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+ DefaultUpdatedAt func() time.Time
+ // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+ UpdateDefaultUpdatedAt func() time.Time
+)
+
+// OrderOption defines the ordering options for the BatchImageJob queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByBatchID orders the results by the batch_id field.
+func ByBatchID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldBatchID, opts...).ToFunc()
+}
+
+// ByUserID orders the results by the user_id field.
+func ByUserID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUserID, opts...).ToFunc()
+}
+
+// ByAPIKeyID orders the results by the api_key_id field.
+func ByAPIKeyID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldAPIKeyID, opts...).ToFunc()
+}
+
+// ByAccountID orders the results by the account_id field.
+func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldAccountID, opts...).ToFunc()
+}
+
+// ByProvider orders the results by the provider field.
+func ByProvider(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldProvider, opts...).ToFunc()
+}
+
+// ByModel orders the results by the model field.
+func ByModel(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldModel, opts...).ToFunc()
+}
+
+// ByTaskName orders the results by the task_name field.
+func ByTaskName(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldTaskName, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByProviderJobName orders the results by the provider_job_name field.
+func ByProviderJobName(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldProviderJobName, opts...).ToFunc()
+}
+
+// ByProviderInputRef orders the results by the provider_input_ref field.
+func ByProviderInputRef(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldProviderInputRef, opts...).ToFunc()
+}
+
+// ByProviderOutputRef orders the results by the provider_output_ref field.
+func ByProviderOutputRef(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldProviderOutputRef, opts...).ToFunc()
+}
+
+// ByGcsInputURI orders the results by the gcs_input_uri field.
+func ByGcsInputURI(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldGcsInputURI, opts...).ToFunc()
+}
+
+// ByGcsOutputURI orders the results by the gcs_output_uri field.
+func ByGcsOutputURI(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldGcsOutputURI, opts...).ToFunc()
+}
+
+// ByItemCount orders the results by the item_count field.
+func ByItemCount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldItemCount, opts...).ToFunc()
+}
+
+// BySuccessCount orders the results by the success_count field.
+func BySuccessCount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSuccessCount, opts...).ToFunc()
+}
+
+// ByFailCount orders the results by the fail_count field.
+func ByFailCount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldFailCount, opts...).ToFunc()
+}
+
+// ByCancelledCount orders the results by the cancelled_count field.
+func ByCancelledCount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCancelledCount, opts...).ToFunc()
+}
+
+// ByEstimatedCost orders the results by the estimated_cost field.
+func ByEstimatedCost(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldEstimatedCost, opts...).ToFunc()
+}
+
+// ByHoldAmount orders the results by the hold_amount field.
+func ByHoldAmount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHoldAmount, opts...).ToFunc()
+}
+
+// ByActualCost orders the results by the actual_cost field.
+func ByActualCost(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldActualCost, opts...).ToFunc()
+}
+
+// ByCurrency orders the results by the currency field.
+func ByCurrency(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCurrency, opts...).ToFunc()
+}
+
+// ByHoldID orders the results by the hold_id field.
+func ByHoldID(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldHoldID, opts...).ToFunc()
+}
+
+// ByIdempotencyKey orders the results by the idempotency_key field.
+func ByIdempotencyKey(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldIdempotencyKey, opts...).ToFunc()
+}
+
+// ByRequestHash orders the results by the request_hash field.
+func ByRequestHash(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldRequestHash, opts...).ToFunc()
+}
+
+// ByManifestHash orders the results by the manifest_hash field.
+func ByManifestHash(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldManifestHash, opts...).ToFunc()
+}
+
+// ByRetryCount orders the results by the retry_count field.
+func ByRetryCount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldRetryCount, opts...).ToFunc()
+}
+
+// ByVersion orders the results by the version field.
+func ByVersion(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVersion, opts...).ToFunc()
+}
+
+// ByOutputExpiresAt orders the results by the output_expires_at field.
+func ByOutputExpiresAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldOutputExpiresAt, opts...).ToFunc()
+}
+
+// ByInputDeletedAt orders the results by the input_deleted_at field.
+func ByInputDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldInputDeletedAt, opts...).ToFunc()
+}
+
+// ByOutputDeletedAt orders the results by the output_deleted_at field.
+func ByOutputDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldOutputDeletedAt, opts...).ToFunc()
+}
+
+// ByDownloadedAt orders the results by the downloaded_at field.
+func ByDownloadedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldDownloadedAt, opts...).ToFunc()
+}
+
+// ByUserDeletedAt orders the results by the user_deleted_at field.
+func ByUserDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUserDeletedAt, opts...).ToFunc()
+}
+
+// ByLastErrorCode orders the results by the last_error_code field.
+func ByLastErrorCode(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldLastErrorCode, opts...).ToFunc()
+}
+
+// ByLastErrorMessage orders the results by the last_error_message field.
+func ByLastErrorMessage(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldLastErrorMessage, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// BySubmittedAt orders the results by the submitted_at field.
+func BySubmittedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSubmittedAt, opts...).ToFunc()
+}
+
+// ByStartedAt orders the results by the started_at field.
+func ByStartedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldStartedAt, opts...).ToFunc()
+}
+
+// ByFinishedAt orders the results by the finished_at field.
+func ByFinishedAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldFinishedAt, opts...).ToFunc()
+}
+
+// BySettledAt orders the results by the settled_at field.
+func BySettledAt(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldSettledAt, opts...).ToFunc()
+}
diff --git a/backend/ent/batchimagejob/where.go b/backend/ent/batchimagejob/where.go
new file mode 100644
index 0000000000..b94722e41d
--- /dev/null
+++ b/backend/ent/batchimagejob/where.go
@@ -0,0 +1,2535 @@
+// Code generated by ent, DO NOT EDIT.
+
+package batchimagejob
+
+import (
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldID, id))
+}
+
+// BatchID applies equality check predicate on the "batch_id" field. It's identical to BatchIDEQ.
+func BatchID(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldBatchID, v))
+}
+
+// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
+func UserID(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldUserID, v))
+}
+
+// APIKeyID applies equality check predicate on the "api_key_id" field. It's identical to APIKeyIDEQ.
+func APIKeyID(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldAPIKeyID, v))
+}
+
+// AccountID applies equality check predicate on the "account_id" field. It's identical to AccountIDEQ.
+func AccountID(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldAccountID, v))
+}
+
+// Provider applies equality check predicate on the "provider" field. It's identical to ProviderEQ.
+func Provider(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProvider, v))
+}
+
+// Model applies equality check predicate on the "model" field. It's identical to ModelEQ.
+func Model(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldModel, v))
+}
+
+// TaskName applies equality check predicate on the "task_name" field. It's identical to TaskNameEQ.
+func TaskName(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldTaskName, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldStatus, v))
+}
+
+// ProviderJobName applies equality check predicate on the "provider_job_name" field. It's identical to ProviderJobNameEQ.
+func ProviderJobName(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProviderJobName, v))
+}
+
+// ProviderInputRef applies equality check predicate on the "provider_input_ref" field. It's identical to ProviderInputRefEQ.
+func ProviderInputRef(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProviderInputRef, v))
+}
+
+// ProviderOutputRef applies equality check predicate on the "provider_output_ref" field. It's identical to ProviderOutputRefEQ.
+func ProviderOutputRef(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProviderOutputRef, v))
+}
+
+// GcsInputURI applies equality check predicate on the "gcs_input_uri" field. It's identical to GcsInputURIEQ.
+func GcsInputURI(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldGcsInputURI, v))
+}
+
+// GcsOutputURI applies equality check predicate on the "gcs_output_uri" field. It's identical to GcsOutputURIEQ.
+func GcsOutputURI(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldGcsOutputURI, v))
+}
+
+// ItemCount applies equality check predicate on the "item_count" field. It's identical to ItemCountEQ.
+func ItemCount(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldItemCount, v))
+}
+
+// SuccessCount applies equality check predicate on the "success_count" field. It's identical to SuccessCountEQ.
+func SuccessCount(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldSuccessCount, v))
+}
+
+// FailCount applies equality check predicate on the "fail_count" field. It's identical to FailCountEQ.
+func FailCount(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldFailCount, v))
+}
+
+// CancelledCount applies equality check predicate on the "cancelled_count" field. It's identical to CancelledCountEQ.
+func CancelledCount(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldCancelledCount, v))
+}
+
+// EstimatedCost applies equality check predicate on the "estimated_cost" field. It's identical to EstimatedCostEQ.
+func EstimatedCost(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldEstimatedCost, v))
+}
+
+// HoldAmount applies equality check predicate on the "hold_amount" field. It's identical to HoldAmountEQ.
+func HoldAmount(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldHoldAmount, v))
+}
+
+// ActualCost applies equality check predicate on the "actual_cost" field. It's identical to ActualCostEQ.
+func ActualCost(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldActualCost, v))
+}
+
+// Currency applies equality check predicate on the "currency" field. It's identical to CurrencyEQ.
+func Currency(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldCurrency, v))
+}
+
+// HoldID applies equality check predicate on the "hold_id" field. It's identical to HoldIDEQ.
+func HoldID(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldHoldID, v))
+}
+
+// IdempotencyKey applies equality check predicate on the "idempotency_key" field. It's identical to IdempotencyKeyEQ.
+func IdempotencyKey(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldIdempotencyKey, v))
+}
+
+// RequestHash applies equality check predicate on the "request_hash" field. It's identical to RequestHashEQ.
+func RequestHash(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldRequestHash, v))
+}
+
+// ManifestHash applies equality check predicate on the "manifest_hash" field. It's identical to ManifestHashEQ.
+func ManifestHash(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldManifestHash, v))
+}
+
+// RetryCount applies equality check predicate on the "retry_count" field. It's identical to RetryCountEQ.
+func RetryCount(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldRetryCount, v))
+}
+
+// Version applies equality check predicate on the "version" field. It's identical to VersionEQ.
+func Version(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldVersion, v))
+}
+
+// OutputExpiresAt applies equality check predicate on the "output_expires_at" field. It's identical to OutputExpiresAtEQ.
+func OutputExpiresAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldOutputExpiresAt, v))
+}
+
+// InputDeletedAt applies equality check predicate on the "input_deleted_at" field. It's identical to InputDeletedAtEQ.
+func InputDeletedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldInputDeletedAt, v))
+}
+
+// OutputDeletedAt applies equality check predicate on the "output_deleted_at" field. It's identical to OutputDeletedAtEQ.
+func OutputDeletedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldOutputDeletedAt, v))
+}
+
+// DownloadedAt applies equality check predicate on the "downloaded_at" field. It's identical to DownloadedAtEQ.
+func DownloadedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldDownloadedAt, v))
+}
+
+// UserDeletedAt applies equality check predicate on the "user_deleted_at" field. It's identical to UserDeletedAtEQ.
+func UserDeletedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldUserDeletedAt, v))
+}
+
+// LastErrorCode applies equality check predicate on the "last_error_code" field. It's identical to LastErrorCodeEQ.
+func LastErrorCode(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldLastErrorCode, v))
+}
+
+// LastErrorMessage applies equality check predicate on the "last_error_message" field. It's identical to LastErrorMessageEQ.
+func LastErrorMessage(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldLastErrorMessage, v))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// SubmittedAt applies equality check predicate on the "submitted_at" field. It's identical to SubmittedAtEQ.
+func SubmittedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldSubmittedAt, v))
+}
+
+// StartedAt applies equality check predicate on the "started_at" field. It's identical to StartedAtEQ.
+func StartedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldStartedAt, v))
+}
+
+// FinishedAt applies equality check predicate on the "finished_at" field. It's identical to FinishedAtEQ.
+func FinishedAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldFinishedAt, v))
+}
+
+// SettledAt applies equality check predicate on the "settled_at" field. It's identical to SettledAtEQ.
+func SettledAt(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldSettledAt, v))
+}
+
+// BatchIDEQ applies the EQ predicate on the "batch_id" field.
+func BatchIDEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldBatchID, v))
+}
+
+// BatchIDNEQ applies the NEQ predicate on the "batch_id" field.
+func BatchIDNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldBatchID, v))
+}
+
+// BatchIDIn applies the In predicate on the "batch_id" field.
+func BatchIDIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldBatchID, vs...))
+}
+
+// BatchIDNotIn applies the NotIn predicate on the "batch_id" field.
+func BatchIDNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldBatchID, vs...))
+}
+
+// BatchIDGT applies the GT predicate on the "batch_id" field.
+func BatchIDGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldBatchID, v))
+}
+
+// BatchIDGTE applies the GTE predicate on the "batch_id" field.
+func BatchIDGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldBatchID, v))
+}
+
+// BatchIDLT applies the LT predicate on the "batch_id" field.
+func BatchIDLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldBatchID, v))
+}
+
+// BatchIDLTE applies the LTE predicate on the "batch_id" field.
+func BatchIDLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldBatchID, v))
+}
+
+// BatchIDContains applies the Contains predicate on the "batch_id" field.
+func BatchIDContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldBatchID, v))
+}
+
+// BatchIDHasPrefix applies the HasPrefix predicate on the "batch_id" field.
+func BatchIDHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldBatchID, v))
+}
+
+// BatchIDHasSuffix applies the HasSuffix predicate on the "batch_id" field.
+func BatchIDHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldBatchID, v))
+}
+
+// BatchIDEqualFold applies the EqualFold predicate on the "batch_id" field.
+func BatchIDEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldBatchID, v))
+}
+
+// BatchIDContainsFold applies the ContainsFold predicate on the "batch_id" field.
+func BatchIDContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldBatchID, v))
+}
+
+// UserIDEQ applies the EQ predicate on the "user_id" field.
+func UserIDEQ(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldUserID, v))
+}
+
+// UserIDNEQ applies the NEQ predicate on the "user_id" field.
+func UserIDNEQ(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldUserID, v))
+}
+
+// UserIDIn applies the In predicate on the "user_id" field.
+func UserIDIn(vs ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldUserID, vs...))
+}
+
+// UserIDNotIn applies the NotIn predicate on the "user_id" field.
+func UserIDNotIn(vs ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldUserID, vs...))
+}
+
+// UserIDGT applies the GT predicate on the "user_id" field.
+func UserIDGT(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldUserID, v))
+}
+
+// UserIDGTE applies the GTE predicate on the "user_id" field.
+func UserIDGTE(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldUserID, v))
+}
+
+// UserIDLT applies the LT predicate on the "user_id" field.
+func UserIDLT(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldUserID, v))
+}
+
+// UserIDLTE applies the LTE predicate on the "user_id" field.
+func UserIDLTE(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldUserID, v))
+}
+
+// APIKeyIDEQ applies the EQ predicate on the "api_key_id" field.
+func APIKeyIDEQ(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldAPIKeyID, v))
+}
+
+// APIKeyIDNEQ applies the NEQ predicate on the "api_key_id" field.
+func APIKeyIDNEQ(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldAPIKeyID, v))
+}
+
+// APIKeyIDIn applies the In predicate on the "api_key_id" field.
+func APIKeyIDIn(vs ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldAPIKeyID, vs...))
+}
+
+// APIKeyIDNotIn applies the NotIn predicate on the "api_key_id" field.
+func APIKeyIDNotIn(vs ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldAPIKeyID, vs...))
+}
+
+// APIKeyIDGT applies the GT predicate on the "api_key_id" field.
+func APIKeyIDGT(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldAPIKeyID, v))
+}
+
+// APIKeyIDGTE applies the GTE predicate on the "api_key_id" field.
+func APIKeyIDGTE(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldAPIKeyID, v))
+}
+
+// APIKeyIDLT applies the LT predicate on the "api_key_id" field.
+func APIKeyIDLT(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldAPIKeyID, v))
+}
+
+// APIKeyIDLTE applies the LTE predicate on the "api_key_id" field.
+func APIKeyIDLTE(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldAPIKeyID, v))
+}
+
+// APIKeyIDIsNil applies the IsNil predicate on the "api_key_id" field.
+func APIKeyIDIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldAPIKeyID))
+}
+
+// APIKeyIDNotNil applies the NotNil predicate on the "api_key_id" field.
+func APIKeyIDNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldAPIKeyID))
+}
+
+// AccountIDEQ applies the EQ predicate on the "account_id" field.
+func AccountIDEQ(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldAccountID, v))
+}
+
+// AccountIDNEQ applies the NEQ predicate on the "account_id" field.
+func AccountIDNEQ(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldAccountID, v))
+}
+
+// AccountIDIn applies the In predicate on the "account_id" field.
+func AccountIDIn(vs ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldAccountID, vs...))
+}
+
+// AccountIDNotIn applies the NotIn predicate on the "account_id" field.
+func AccountIDNotIn(vs ...int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldAccountID, vs...))
+}
+
+// AccountIDGT applies the GT predicate on the "account_id" field.
+func AccountIDGT(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldAccountID, v))
+}
+
+// AccountIDGTE applies the GTE predicate on the "account_id" field.
+func AccountIDGTE(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldAccountID, v))
+}
+
+// AccountIDLT applies the LT predicate on the "account_id" field.
+func AccountIDLT(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldAccountID, v))
+}
+
+// AccountIDLTE applies the LTE predicate on the "account_id" field.
+func AccountIDLTE(v int64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldAccountID, v))
+}
+
+// AccountIDIsNil applies the IsNil predicate on the "account_id" field.
+func AccountIDIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldAccountID))
+}
+
+// AccountIDNotNil applies the NotNil predicate on the "account_id" field.
+func AccountIDNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldAccountID))
+}
+
+// ProviderEQ applies the EQ predicate on the "provider" field.
+func ProviderEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProvider, v))
+}
+
+// ProviderNEQ applies the NEQ predicate on the "provider" field.
+func ProviderNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldProvider, v))
+}
+
+// ProviderIn applies the In predicate on the "provider" field.
+func ProviderIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldProvider, vs...))
+}
+
+// ProviderNotIn applies the NotIn predicate on the "provider" field.
+func ProviderNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldProvider, vs...))
+}
+
+// ProviderGT applies the GT predicate on the "provider" field.
+func ProviderGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldProvider, v))
+}
+
+// ProviderGTE applies the GTE predicate on the "provider" field.
+func ProviderGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldProvider, v))
+}
+
+// ProviderLT applies the LT predicate on the "provider" field.
+func ProviderLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldProvider, v))
+}
+
+// ProviderLTE applies the LTE predicate on the "provider" field.
+func ProviderLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldProvider, v))
+}
+
+// ProviderContains applies the Contains predicate on the "provider" field.
+func ProviderContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldProvider, v))
+}
+
+// ProviderHasPrefix applies the HasPrefix predicate on the "provider" field.
+func ProviderHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldProvider, v))
+}
+
+// ProviderHasSuffix applies the HasSuffix predicate on the "provider" field.
+func ProviderHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldProvider, v))
+}
+
+// ProviderEqualFold applies the EqualFold predicate on the "provider" field.
+func ProviderEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldProvider, v))
+}
+
+// ProviderContainsFold applies the ContainsFold predicate on the "provider" field.
+func ProviderContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldProvider, v))
+}
+
+// ModelEQ applies the EQ predicate on the "model" field.
+func ModelEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldModel, v))
+}
+
+// ModelNEQ applies the NEQ predicate on the "model" field.
+func ModelNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldModel, v))
+}
+
+// ModelIn applies the In predicate on the "model" field.
+func ModelIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldModel, vs...))
+}
+
+// ModelNotIn applies the NotIn predicate on the "model" field.
+func ModelNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldModel, vs...))
+}
+
+// ModelGT applies the GT predicate on the "model" field.
+func ModelGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldModel, v))
+}
+
+// ModelGTE applies the GTE predicate on the "model" field.
+func ModelGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldModel, v))
+}
+
+// ModelLT applies the LT predicate on the "model" field.
+func ModelLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldModel, v))
+}
+
+// ModelLTE applies the LTE predicate on the "model" field.
+func ModelLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldModel, v))
+}
+
+// ModelContains applies the Contains predicate on the "model" field.
+func ModelContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldModel, v))
+}
+
+// ModelHasPrefix applies the HasPrefix predicate on the "model" field.
+func ModelHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldModel, v))
+}
+
+// ModelHasSuffix applies the HasSuffix predicate on the "model" field.
+func ModelHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldModel, v))
+}
+
+// ModelEqualFold applies the EqualFold predicate on the "model" field.
+func ModelEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldModel, v))
+}
+
+// ModelContainsFold applies the ContainsFold predicate on the "model" field.
+func ModelContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldModel, v))
+}
+
+// TaskNameEQ applies the EQ predicate on the "task_name" field.
+func TaskNameEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldTaskName, v))
+}
+
+// TaskNameNEQ applies the NEQ predicate on the "task_name" field.
+func TaskNameNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldTaskName, v))
+}
+
+// TaskNameIn applies the In predicate on the "task_name" field.
+func TaskNameIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldTaskName, vs...))
+}
+
+// TaskNameNotIn applies the NotIn predicate on the "task_name" field.
+func TaskNameNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldTaskName, vs...))
+}
+
+// TaskNameGT applies the GT predicate on the "task_name" field.
+func TaskNameGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldTaskName, v))
+}
+
+// TaskNameGTE applies the GTE predicate on the "task_name" field.
+func TaskNameGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldTaskName, v))
+}
+
+// TaskNameLT applies the LT predicate on the "task_name" field.
+func TaskNameLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldTaskName, v))
+}
+
+// TaskNameLTE applies the LTE predicate on the "task_name" field.
+func TaskNameLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldTaskName, v))
+}
+
+// TaskNameContains applies the Contains predicate on the "task_name" field.
+func TaskNameContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldTaskName, v))
+}
+
+// TaskNameHasPrefix applies the HasPrefix predicate on the "task_name" field.
+func TaskNameHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldTaskName, v))
+}
+
+// TaskNameHasSuffix applies the HasSuffix predicate on the "task_name" field.
+func TaskNameHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldTaskName, v))
+}
+
+// TaskNameEqualFold applies the EqualFold predicate on the "task_name" field.
+func TaskNameEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldTaskName, v))
+}
+
+// TaskNameContainsFold applies the ContainsFold predicate on the "task_name" field.
+func TaskNameContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldTaskName, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusContains applies the Contains predicate on the "status" field.
+func StatusContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldStatus, v))
+}
+
+// StatusHasPrefix applies the HasPrefix predicate on the "status" field.
+func StatusHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldStatus, v))
+}
+
+// StatusHasSuffix applies the HasSuffix predicate on the "status" field.
+func StatusHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldStatus, v))
+}
+
+// StatusEqualFold applies the EqualFold predicate on the "status" field.
+func StatusEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldStatus, v))
+}
+
+// StatusContainsFold applies the ContainsFold predicate on the "status" field.
+func StatusContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldStatus, v))
+}
+
+// ProviderJobNameEQ applies the EQ predicate on the "provider_job_name" field.
+func ProviderJobNameEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProviderJobName, v))
+}
+
+// ProviderJobNameNEQ applies the NEQ predicate on the "provider_job_name" field.
+func ProviderJobNameNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldProviderJobName, v))
+}
+
+// ProviderJobNameIn applies the In predicate on the "provider_job_name" field.
+func ProviderJobNameIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldProviderJobName, vs...))
+}
+
+// ProviderJobNameNotIn applies the NotIn predicate on the "provider_job_name" field.
+func ProviderJobNameNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldProviderJobName, vs...))
+}
+
+// ProviderJobNameGT applies the GT predicate on the "provider_job_name" field.
+func ProviderJobNameGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldProviderJobName, v))
+}
+
+// ProviderJobNameGTE applies the GTE predicate on the "provider_job_name" field.
+func ProviderJobNameGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldProviderJobName, v))
+}
+
+// ProviderJobNameLT applies the LT predicate on the "provider_job_name" field.
+func ProviderJobNameLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldProviderJobName, v))
+}
+
+// ProviderJobNameLTE applies the LTE predicate on the "provider_job_name" field.
+func ProviderJobNameLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldProviderJobName, v))
+}
+
+// ProviderJobNameContains applies the Contains predicate on the "provider_job_name" field.
+func ProviderJobNameContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldProviderJobName, v))
+}
+
+// ProviderJobNameHasPrefix applies the HasPrefix predicate on the "provider_job_name" field.
+func ProviderJobNameHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldProviderJobName, v))
+}
+
+// ProviderJobNameHasSuffix applies the HasSuffix predicate on the "provider_job_name" field.
+func ProviderJobNameHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldProviderJobName, v))
+}
+
+// ProviderJobNameIsNil applies the IsNil predicate on the "provider_job_name" field.
+func ProviderJobNameIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldProviderJobName))
+}
+
+// ProviderJobNameNotNil applies the NotNil predicate on the "provider_job_name" field.
+func ProviderJobNameNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldProviderJobName))
+}
+
+// ProviderJobNameEqualFold applies the EqualFold predicate on the "provider_job_name" field.
+func ProviderJobNameEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldProviderJobName, v))
+}
+
+// ProviderJobNameContainsFold applies the ContainsFold predicate on the "provider_job_name" field.
+func ProviderJobNameContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldProviderJobName, v))
+}
+
+// ProviderInputRefEQ applies the EQ predicate on the "provider_input_ref" field.
+func ProviderInputRefEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefNEQ applies the NEQ predicate on the "provider_input_ref" field.
+func ProviderInputRefNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefIn applies the In predicate on the "provider_input_ref" field.
+func ProviderInputRefIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldProviderInputRef, vs...))
+}
+
+// ProviderInputRefNotIn applies the NotIn predicate on the "provider_input_ref" field.
+func ProviderInputRefNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldProviderInputRef, vs...))
+}
+
+// ProviderInputRefGT applies the GT predicate on the "provider_input_ref" field.
+func ProviderInputRefGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefGTE applies the GTE predicate on the "provider_input_ref" field.
+func ProviderInputRefGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefLT applies the LT predicate on the "provider_input_ref" field.
+func ProviderInputRefLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefLTE applies the LTE predicate on the "provider_input_ref" field.
+func ProviderInputRefLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefContains applies the Contains predicate on the "provider_input_ref" field.
+func ProviderInputRefContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefHasPrefix applies the HasPrefix predicate on the "provider_input_ref" field.
+func ProviderInputRefHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefHasSuffix applies the HasSuffix predicate on the "provider_input_ref" field.
+func ProviderInputRefHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefIsNil applies the IsNil predicate on the "provider_input_ref" field.
+func ProviderInputRefIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldProviderInputRef))
+}
+
+// ProviderInputRefNotNil applies the NotNil predicate on the "provider_input_ref" field.
+func ProviderInputRefNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldProviderInputRef))
+}
+
+// ProviderInputRefEqualFold applies the EqualFold predicate on the "provider_input_ref" field.
+func ProviderInputRefEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldProviderInputRef, v))
+}
+
+// ProviderInputRefContainsFold applies the ContainsFold predicate on the "provider_input_ref" field.
+func ProviderInputRefContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldProviderInputRef, v))
+}
+
+// ProviderOutputRefEQ applies the EQ predicate on the "provider_output_ref" field.
+func ProviderOutputRefEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefNEQ applies the NEQ predicate on the "provider_output_ref" field.
+func ProviderOutputRefNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefIn applies the In predicate on the "provider_output_ref" field.
+func ProviderOutputRefIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldProviderOutputRef, vs...))
+}
+
+// ProviderOutputRefNotIn applies the NotIn predicate on the "provider_output_ref" field.
+func ProviderOutputRefNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldProviderOutputRef, vs...))
+}
+
+// ProviderOutputRefGT applies the GT predicate on the "provider_output_ref" field.
+func ProviderOutputRefGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefGTE applies the GTE predicate on the "provider_output_ref" field.
+func ProviderOutputRefGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefLT applies the LT predicate on the "provider_output_ref" field.
+func ProviderOutputRefLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefLTE applies the LTE predicate on the "provider_output_ref" field.
+func ProviderOutputRefLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefContains applies the Contains predicate on the "provider_output_ref" field.
+func ProviderOutputRefContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefHasPrefix applies the HasPrefix predicate on the "provider_output_ref" field.
+func ProviderOutputRefHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefHasSuffix applies the HasSuffix predicate on the "provider_output_ref" field.
+func ProviderOutputRefHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefIsNil applies the IsNil predicate on the "provider_output_ref" field.
+func ProviderOutputRefIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldProviderOutputRef))
+}
+
+// ProviderOutputRefNotNil applies the NotNil predicate on the "provider_output_ref" field.
+func ProviderOutputRefNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldProviderOutputRef))
+}
+
+// ProviderOutputRefEqualFold applies the EqualFold predicate on the "provider_output_ref" field.
+func ProviderOutputRefEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldProviderOutputRef, v))
+}
+
+// ProviderOutputRefContainsFold applies the ContainsFold predicate on the "provider_output_ref" field.
+func ProviderOutputRefContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldProviderOutputRef, v))
+}
+
+// GcsInputURIEQ applies the EQ predicate on the "gcs_input_uri" field.
+func GcsInputURIEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldGcsInputURI, v))
+}
+
+// GcsInputURINEQ applies the NEQ predicate on the "gcs_input_uri" field.
+func GcsInputURINEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldGcsInputURI, v))
+}
+
+// GcsInputURIIn applies the In predicate on the "gcs_input_uri" field.
+func GcsInputURIIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldGcsInputURI, vs...))
+}
+
+// GcsInputURINotIn applies the NotIn predicate on the "gcs_input_uri" field.
+func GcsInputURINotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldGcsInputURI, vs...))
+}
+
+// GcsInputURIGT applies the GT predicate on the "gcs_input_uri" field.
+func GcsInputURIGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldGcsInputURI, v))
+}
+
+// GcsInputURIGTE applies the GTE predicate on the "gcs_input_uri" field.
+func GcsInputURIGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldGcsInputURI, v))
+}
+
+// GcsInputURILT applies the LT predicate on the "gcs_input_uri" field.
+func GcsInputURILT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldGcsInputURI, v))
+}
+
+// GcsInputURILTE applies the LTE predicate on the "gcs_input_uri" field.
+func GcsInputURILTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldGcsInputURI, v))
+}
+
+// GcsInputURIContains applies the Contains predicate on the "gcs_input_uri" field.
+func GcsInputURIContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldGcsInputURI, v))
+}
+
+// GcsInputURIHasPrefix applies the HasPrefix predicate on the "gcs_input_uri" field.
+func GcsInputURIHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldGcsInputURI, v))
+}
+
+// GcsInputURIHasSuffix applies the HasSuffix predicate on the "gcs_input_uri" field.
+func GcsInputURIHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldGcsInputURI, v))
+}
+
+// GcsInputURIIsNil applies the IsNil predicate on the "gcs_input_uri" field.
+func GcsInputURIIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldGcsInputURI))
+}
+
+// GcsInputURINotNil applies the NotNil predicate on the "gcs_input_uri" field.
+func GcsInputURINotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldGcsInputURI))
+}
+
+// GcsInputURIEqualFold applies the EqualFold predicate on the "gcs_input_uri" field.
+func GcsInputURIEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldGcsInputURI, v))
+}
+
+// GcsInputURIContainsFold applies the ContainsFold predicate on the "gcs_input_uri" field.
+func GcsInputURIContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldGcsInputURI, v))
+}
+
+// GcsOutputURIEQ applies the EQ predicate on the "gcs_output_uri" field.
+func GcsOutputURIEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURINEQ applies the NEQ predicate on the "gcs_output_uri" field.
+func GcsOutputURINEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURIIn applies the In predicate on the "gcs_output_uri" field.
+func GcsOutputURIIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldGcsOutputURI, vs...))
+}
+
+// GcsOutputURINotIn applies the NotIn predicate on the "gcs_output_uri" field.
+func GcsOutputURINotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldGcsOutputURI, vs...))
+}
+
+// GcsOutputURIGT applies the GT predicate on the "gcs_output_uri" field.
+func GcsOutputURIGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURIGTE applies the GTE predicate on the "gcs_output_uri" field.
+func GcsOutputURIGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURILT applies the LT predicate on the "gcs_output_uri" field.
+func GcsOutputURILT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURILTE applies the LTE predicate on the "gcs_output_uri" field.
+func GcsOutputURILTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURIContains applies the Contains predicate on the "gcs_output_uri" field.
+func GcsOutputURIContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURIHasPrefix applies the HasPrefix predicate on the "gcs_output_uri" field.
+func GcsOutputURIHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURIHasSuffix applies the HasSuffix predicate on the "gcs_output_uri" field.
+func GcsOutputURIHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURIIsNil applies the IsNil predicate on the "gcs_output_uri" field.
+func GcsOutputURIIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldGcsOutputURI))
+}
+
+// GcsOutputURINotNil applies the NotNil predicate on the "gcs_output_uri" field.
+func GcsOutputURINotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldGcsOutputURI))
+}
+
+// GcsOutputURIEqualFold applies the EqualFold predicate on the "gcs_output_uri" field.
+func GcsOutputURIEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldGcsOutputURI, v))
+}
+
+// GcsOutputURIContainsFold applies the ContainsFold predicate on the "gcs_output_uri" field.
+func GcsOutputURIContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldGcsOutputURI, v))
+}
+
+// ItemCountEQ applies the EQ predicate on the "item_count" field.
+func ItemCountEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldItemCount, v))
+}
+
+// ItemCountNEQ applies the NEQ predicate on the "item_count" field.
+func ItemCountNEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldItemCount, v))
+}
+
+// ItemCountIn applies the In predicate on the "item_count" field.
+func ItemCountIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldItemCount, vs...))
+}
+
+// ItemCountNotIn applies the NotIn predicate on the "item_count" field.
+func ItemCountNotIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldItemCount, vs...))
+}
+
+// ItemCountGT applies the GT predicate on the "item_count" field.
+func ItemCountGT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldItemCount, v))
+}
+
+// ItemCountGTE applies the GTE predicate on the "item_count" field.
+func ItemCountGTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldItemCount, v))
+}
+
+// ItemCountLT applies the LT predicate on the "item_count" field.
+func ItemCountLT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldItemCount, v))
+}
+
+// ItemCountLTE applies the LTE predicate on the "item_count" field.
+func ItemCountLTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldItemCount, v))
+}
+
+// SuccessCountEQ applies the EQ predicate on the "success_count" field.
+func SuccessCountEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldSuccessCount, v))
+}
+
+// SuccessCountNEQ applies the NEQ predicate on the "success_count" field.
+func SuccessCountNEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldSuccessCount, v))
+}
+
+// SuccessCountIn applies the In predicate on the "success_count" field.
+func SuccessCountIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldSuccessCount, vs...))
+}
+
+// SuccessCountNotIn applies the NotIn predicate on the "success_count" field.
+func SuccessCountNotIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldSuccessCount, vs...))
+}
+
+// SuccessCountGT applies the GT predicate on the "success_count" field.
+func SuccessCountGT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldSuccessCount, v))
+}
+
+// SuccessCountGTE applies the GTE predicate on the "success_count" field.
+func SuccessCountGTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldSuccessCount, v))
+}
+
+// SuccessCountLT applies the LT predicate on the "success_count" field.
+func SuccessCountLT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldSuccessCount, v))
+}
+
+// SuccessCountLTE applies the LTE predicate on the "success_count" field.
+func SuccessCountLTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldSuccessCount, v))
+}
+
+// FailCountEQ applies the EQ predicate on the "fail_count" field.
+func FailCountEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldFailCount, v))
+}
+
+// FailCountNEQ applies the NEQ predicate on the "fail_count" field.
+func FailCountNEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldFailCount, v))
+}
+
+// FailCountIn applies the In predicate on the "fail_count" field.
+func FailCountIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldFailCount, vs...))
+}
+
+// FailCountNotIn applies the NotIn predicate on the "fail_count" field.
+func FailCountNotIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldFailCount, vs...))
+}
+
+// FailCountGT applies the GT predicate on the "fail_count" field.
+func FailCountGT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldFailCount, v))
+}
+
+// FailCountGTE applies the GTE predicate on the "fail_count" field.
+func FailCountGTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldFailCount, v))
+}
+
+// FailCountLT applies the LT predicate on the "fail_count" field.
+func FailCountLT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldFailCount, v))
+}
+
+// FailCountLTE applies the LTE predicate on the "fail_count" field.
+func FailCountLTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldFailCount, v))
+}
+
+// CancelledCountEQ applies the EQ predicate on the "cancelled_count" field.
+func CancelledCountEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldCancelledCount, v))
+}
+
+// CancelledCountNEQ applies the NEQ predicate on the "cancelled_count" field.
+func CancelledCountNEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldCancelledCount, v))
+}
+
+// CancelledCountIn applies the In predicate on the "cancelled_count" field.
+func CancelledCountIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldCancelledCount, vs...))
+}
+
+// CancelledCountNotIn applies the NotIn predicate on the "cancelled_count" field.
+func CancelledCountNotIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldCancelledCount, vs...))
+}
+
+// CancelledCountGT applies the GT predicate on the "cancelled_count" field.
+func CancelledCountGT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldCancelledCount, v))
+}
+
+// CancelledCountGTE applies the GTE predicate on the "cancelled_count" field.
+func CancelledCountGTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldCancelledCount, v))
+}
+
+// CancelledCountLT applies the LT predicate on the "cancelled_count" field.
+func CancelledCountLT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldCancelledCount, v))
+}
+
+// CancelledCountLTE applies the LTE predicate on the "cancelled_count" field.
+func CancelledCountLTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldCancelledCount, v))
+}
+
+// EstimatedCostEQ applies the EQ predicate on the "estimated_cost" field.
+func EstimatedCostEQ(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldEstimatedCost, v))
+}
+
+// EstimatedCostNEQ applies the NEQ predicate on the "estimated_cost" field.
+func EstimatedCostNEQ(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldEstimatedCost, v))
+}
+
+// EstimatedCostIn applies the In predicate on the "estimated_cost" field.
+func EstimatedCostIn(vs ...float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldEstimatedCost, vs...))
+}
+
+// EstimatedCostNotIn applies the NotIn predicate on the "estimated_cost" field.
+func EstimatedCostNotIn(vs ...float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldEstimatedCost, vs...))
+}
+
+// EstimatedCostGT applies the GT predicate on the "estimated_cost" field.
+func EstimatedCostGT(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldEstimatedCost, v))
+}
+
+// EstimatedCostGTE applies the GTE predicate on the "estimated_cost" field.
+func EstimatedCostGTE(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldEstimatedCost, v))
+}
+
+// EstimatedCostLT applies the LT predicate on the "estimated_cost" field.
+func EstimatedCostLT(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldEstimatedCost, v))
+}
+
+// EstimatedCostLTE applies the LTE predicate on the "estimated_cost" field.
+func EstimatedCostLTE(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldEstimatedCost, v))
+}
+
+// HoldAmountEQ applies the EQ predicate on the "hold_amount" field.
+func HoldAmountEQ(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldHoldAmount, v))
+}
+
+// HoldAmountNEQ applies the NEQ predicate on the "hold_amount" field.
+func HoldAmountNEQ(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldHoldAmount, v))
+}
+
+// HoldAmountIn applies the In predicate on the "hold_amount" field.
+func HoldAmountIn(vs ...float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldHoldAmount, vs...))
+}
+
+// HoldAmountNotIn applies the NotIn predicate on the "hold_amount" field.
+func HoldAmountNotIn(vs ...float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldHoldAmount, vs...))
+}
+
+// HoldAmountGT applies the GT predicate on the "hold_amount" field.
+func HoldAmountGT(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldHoldAmount, v))
+}
+
+// HoldAmountGTE applies the GTE predicate on the "hold_amount" field.
+func HoldAmountGTE(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldHoldAmount, v))
+}
+
+// HoldAmountLT applies the LT predicate on the "hold_amount" field.
+func HoldAmountLT(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldHoldAmount, v))
+}
+
+// HoldAmountLTE applies the LTE predicate on the "hold_amount" field.
+func HoldAmountLTE(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldHoldAmount, v))
+}
+
+// HoldAmountIsNil applies the IsNil predicate on the "hold_amount" field.
+func HoldAmountIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldHoldAmount))
+}
+
+// HoldAmountNotNil applies the NotNil predicate on the "hold_amount" field.
+func HoldAmountNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldHoldAmount))
+}
+
+// ActualCostEQ applies the EQ predicate on the "actual_cost" field.
+func ActualCostEQ(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldActualCost, v))
+}
+
+// ActualCostNEQ applies the NEQ predicate on the "actual_cost" field.
+func ActualCostNEQ(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldActualCost, v))
+}
+
+// ActualCostIn applies the In predicate on the "actual_cost" field.
+func ActualCostIn(vs ...float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldActualCost, vs...))
+}
+
+// ActualCostNotIn applies the NotIn predicate on the "actual_cost" field.
+func ActualCostNotIn(vs ...float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldActualCost, vs...))
+}
+
+// ActualCostGT applies the GT predicate on the "actual_cost" field.
+func ActualCostGT(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldActualCost, v))
+}
+
+// ActualCostGTE applies the GTE predicate on the "actual_cost" field.
+func ActualCostGTE(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldActualCost, v))
+}
+
+// ActualCostLT applies the LT predicate on the "actual_cost" field.
+func ActualCostLT(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldActualCost, v))
+}
+
+// ActualCostLTE applies the LTE predicate on the "actual_cost" field.
+func ActualCostLTE(v float64) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldActualCost, v))
+}
+
+// ActualCostIsNil applies the IsNil predicate on the "actual_cost" field.
+func ActualCostIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldActualCost))
+}
+
+// ActualCostNotNil applies the NotNil predicate on the "actual_cost" field.
+func ActualCostNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldActualCost))
+}
+
+// CurrencyEQ applies the EQ predicate on the "currency" field.
+func CurrencyEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldCurrency, v))
+}
+
+// CurrencyNEQ applies the NEQ predicate on the "currency" field.
+func CurrencyNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldCurrency, v))
+}
+
+// CurrencyIn applies the In predicate on the "currency" field.
+func CurrencyIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldCurrency, vs...))
+}
+
+// CurrencyNotIn applies the NotIn predicate on the "currency" field.
+func CurrencyNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldCurrency, vs...))
+}
+
+// CurrencyGT applies the GT predicate on the "currency" field.
+func CurrencyGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldCurrency, v))
+}
+
+// CurrencyGTE applies the GTE predicate on the "currency" field.
+func CurrencyGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldCurrency, v))
+}
+
+// CurrencyLT applies the LT predicate on the "currency" field.
+func CurrencyLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldCurrency, v))
+}
+
+// CurrencyLTE applies the LTE predicate on the "currency" field.
+func CurrencyLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldCurrency, v))
+}
+
+// CurrencyContains applies the Contains predicate on the "currency" field.
+func CurrencyContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldCurrency, v))
+}
+
+// CurrencyHasPrefix applies the HasPrefix predicate on the "currency" field.
+func CurrencyHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldCurrency, v))
+}
+
+// CurrencyHasSuffix applies the HasSuffix predicate on the "currency" field.
+func CurrencyHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldCurrency, v))
+}
+
+// CurrencyEqualFold applies the EqualFold predicate on the "currency" field.
+func CurrencyEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldCurrency, v))
+}
+
+// CurrencyContainsFold applies the ContainsFold predicate on the "currency" field.
+func CurrencyContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldCurrency, v))
+}
+
+// HoldIDEQ applies the EQ predicate on the "hold_id" field.
+func HoldIDEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldHoldID, v))
+}
+
+// HoldIDNEQ applies the NEQ predicate on the "hold_id" field.
+func HoldIDNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldHoldID, v))
+}
+
+// HoldIDIn applies the In predicate on the "hold_id" field.
+func HoldIDIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldHoldID, vs...))
+}
+
+// HoldIDNotIn applies the NotIn predicate on the "hold_id" field.
+func HoldIDNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldHoldID, vs...))
+}
+
+// HoldIDGT applies the GT predicate on the "hold_id" field.
+func HoldIDGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldHoldID, v))
+}
+
+// HoldIDGTE applies the GTE predicate on the "hold_id" field.
+func HoldIDGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldHoldID, v))
+}
+
+// HoldIDLT applies the LT predicate on the "hold_id" field.
+func HoldIDLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldHoldID, v))
+}
+
+// HoldIDLTE applies the LTE predicate on the "hold_id" field.
+func HoldIDLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldHoldID, v))
+}
+
+// HoldIDContains applies the Contains predicate on the "hold_id" field.
+func HoldIDContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldHoldID, v))
+}
+
+// HoldIDHasPrefix applies the HasPrefix predicate on the "hold_id" field.
+func HoldIDHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldHoldID, v))
+}
+
+// HoldIDHasSuffix applies the HasSuffix predicate on the "hold_id" field.
+func HoldIDHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldHoldID, v))
+}
+
+// HoldIDIsNil applies the IsNil predicate on the "hold_id" field.
+func HoldIDIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldHoldID))
+}
+
+// HoldIDNotNil applies the NotNil predicate on the "hold_id" field.
+func HoldIDNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldHoldID))
+}
+
+// HoldIDEqualFold applies the EqualFold predicate on the "hold_id" field.
+func HoldIDEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldHoldID, v))
+}
+
+// HoldIDContainsFold applies the ContainsFold predicate on the "hold_id" field.
+func HoldIDContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldHoldID, v))
+}
+
+// IdempotencyKeyEQ applies the EQ predicate on the "idempotency_key" field.
+func IdempotencyKeyEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyNEQ applies the NEQ predicate on the "idempotency_key" field.
+func IdempotencyKeyNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyIn applies the In predicate on the "idempotency_key" field.
+func IdempotencyKeyIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldIdempotencyKey, vs...))
+}
+
+// IdempotencyKeyNotIn applies the NotIn predicate on the "idempotency_key" field.
+func IdempotencyKeyNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldIdempotencyKey, vs...))
+}
+
+// IdempotencyKeyGT applies the GT predicate on the "idempotency_key" field.
+func IdempotencyKeyGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyGTE applies the GTE predicate on the "idempotency_key" field.
+func IdempotencyKeyGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyLT applies the LT predicate on the "idempotency_key" field.
+func IdempotencyKeyLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyLTE applies the LTE predicate on the "idempotency_key" field.
+func IdempotencyKeyLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyContains applies the Contains predicate on the "idempotency_key" field.
+func IdempotencyKeyContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyHasPrefix applies the HasPrefix predicate on the "idempotency_key" field.
+func IdempotencyKeyHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyHasSuffix applies the HasSuffix predicate on the "idempotency_key" field.
+func IdempotencyKeyHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyIsNil applies the IsNil predicate on the "idempotency_key" field.
+func IdempotencyKeyIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldIdempotencyKey))
+}
+
+// IdempotencyKeyNotNil applies the NotNil predicate on the "idempotency_key" field.
+func IdempotencyKeyNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldIdempotencyKey))
+}
+
+// IdempotencyKeyEqualFold applies the EqualFold predicate on the "idempotency_key" field.
+func IdempotencyKeyEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldIdempotencyKey, v))
+}
+
+// IdempotencyKeyContainsFold applies the ContainsFold predicate on the "idempotency_key" field.
+func IdempotencyKeyContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldIdempotencyKey, v))
+}
+
+// RequestHashEQ applies the EQ predicate on the "request_hash" field.
+func RequestHashEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldRequestHash, v))
+}
+
+// RequestHashNEQ applies the NEQ predicate on the "request_hash" field.
+func RequestHashNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldRequestHash, v))
+}
+
+// RequestHashIn applies the In predicate on the "request_hash" field.
+func RequestHashIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldRequestHash, vs...))
+}
+
+// RequestHashNotIn applies the NotIn predicate on the "request_hash" field.
+func RequestHashNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldRequestHash, vs...))
+}
+
+// RequestHashGT applies the GT predicate on the "request_hash" field.
+func RequestHashGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldRequestHash, v))
+}
+
+// RequestHashGTE applies the GTE predicate on the "request_hash" field.
+func RequestHashGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldRequestHash, v))
+}
+
+// RequestHashLT applies the LT predicate on the "request_hash" field.
+func RequestHashLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldRequestHash, v))
+}
+
+// RequestHashLTE applies the LTE predicate on the "request_hash" field.
+func RequestHashLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldRequestHash, v))
+}
+
+// RequestHashContains applies the Contains predicate on the "request_hash" field.
+func RequestHashContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldRequestHash, v))
+}
+
+// RequestHashHasPrefix applies the HasPrefix predicate on the "request_hash" field.
+func RequestHashHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldRequestHash, v))
+}
+
+// RequestHashHasSuffix applies the HasSuffix predicate on the "request_hash" field.
+func RequestHashHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldRequestHash, v))
+}
+
+// RequestHashIsNil applies the IsNil predicate on the "request_hash" field.
+func RequestHashIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldRequestHash))
+}
+
+// RequestHashNotNil applies the NotNil predicate on the "request_hash" field.
+func RequestHashNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldRequestHash))
+}
+
+// RequestHashEqualFold applies the EqualFold predicate on the "request_hash" field.
+func RequestHashEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldRequestHash, v))
+}
+
+// RequestHashContainsFold applies the ContainsFold predicate on the "request_hash" field.
+func RequestHashContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldRequestHash, v))
+}
+
+// ManifestHashEQ applies the EQ predicate on the "manifest_hash" field.
+func ManifestHashEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldManifestHash, v))
+}
+
+// ManifestHashNEQ applies the NEQ predicate on the "manifest_hash" field.
+func ManifestHashNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldManifestHash, v))
+}
+
+// ManifestHashIn applies the In predicate on the "manifest_hash" field.
+func ManifestHashIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldManifestHash, vs...))
+}
+
+// ManifestHashNotIn applies the NotIn predicate on the "manifest_hash" field.
+func ManifestHashNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldManifestHash, vs...))
+}
+
+// ManifestHashGT applies the GT predicate on the "manifest_hash" field.
+func ManifestHashGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldManifestHash, v))
+}
+
+// ManifestHashGTE applies the GTE predicate on the "manifest_hash" field.
+func ManifestHashGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldManifestHash, v))
+}
+
+// ManifestHashLT applies the LT predicate on the "manifest_hash" field.
+func ManifestHashLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldManifestHash, v))
+}
+
+// ManifestHashLTE applies the LTE predicate on the "manifest_hash" field.
+func ManifestHashLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldManifestHash, v))
+}
+
+// ManifestHashContains applies the Contains predicate on the "manifest_hash" field.
+func ManifestHashContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldManifestHash, v))
+}
+
+// ManifestHashHasPrefix applies the HasPrefix predicate on the "manifest_hash" field.
+func ManifestHashHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldManifestHash, v))
+}
+
+// ManifestHashHasSuffix applies the HasSuffix predicate on the "manifest_hash" field.
+func ManifestHashHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldManifestHash, v))
+}
+
+// ManifestHashIsNil applies the IsNil predicate on the "manifest_hash" field.
+func ManifestHashIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldManifestHash))
+}
+
+// ManifestHashNotNil applies the NotNil predicate on the "manifest_hash" field.
+func ManifestHashNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldManifestHash))
+}
+
+// ManifestHashEqualFold applies the EqualFold predicate on the "manifest_hash" field.
+func ManifestHashEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldManifestHash, v))
+}
+
+// ManifestHashContainsFold applies the ContainsFold predicate on the "manifest_hash" field.
+func ManifestHashContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldManifestHash, v))
+}
+
+// RetryCountEQ applies the EQ predicate on the "retry_count" field.
+func RetryCountEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldRetryCount, v))
+}
+
+// RetryCountNEQ applies the NEQ predicate on the "retry_count" field.
+func RetryCountNEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldRetryCount, v))
+}
+
+// RetryCountIn applies the In predicate on the "retry_count" field.
+func RetryCountIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldRetryCount, vs...))
+}
+
+// RetryCountNotIn applies the NotIn predicate on the "retry_count" field.
+func RetryCountNotIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldRetryCount, vs...))
+}
+
+// RetryCountGT applies the GT predicate on the "retry_count" field.
+func RetryCountGT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldRetryCount, v))
+}
+
+// RetryCountGTE applies the GTE predicate on the "retry_count" field.
+func RetryCountGTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldRetryCount, v))
+}
+
+// RetryCountLT applies the LT predicate on the "retry_count" field.
+func RetryCountLT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldRetryCount, v))
+}
+
+// RetryCountLTE applies the LTE predicate on the "retry_count" field.
+func RetryCountLTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldRetryCount, v))
+}
+
+// VersionEQ applies the EQ predicate on the "version" field.
+func VersionEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldVersion, v))
+}
+
+// VersionNEQ applies the NEQ predicate on the "version" field.
+func VersionNEQ(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldVersion, v))
+}
+
+// VersionIn applies the In predicate on the "version" field.
+func VersionIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldVersion, vs...))
+}
+
+// VersionNotIn applies the NotIn predicate on the "version" field.
+func VersionNotIn(vs ...int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldVersion, vs...))
+}
+
+// VersionGT applies the GT predicate on the "version" field.
+func VersionGT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldVersion, v))
+}
+
+// VersionGTE applies the GTE predicate on the "version" field.
+func VersionGTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldVersion, v))
+}
+
+// VersionLT applies the LT predicate on the "version" field.
+func VersionLT(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldVersion, v))
+}
+
+// VersionLTE applies the LTE predicate on the "version" field.
+func VersionLTE(v int) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldVersion, v))
+}
+
+// OutputExpiresAtEQ applies the EQ predicate on the "output_expires_at" field.
+func OutputExpiresAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldOutputExpiresAt, v))
+}
+
+// OutputExpiresAtNEQ applies the NEQ predicate on the "output_expires_at" field.
+func OutputExpiresAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldOutputExpiresAt, v))
+}
+
+// OutputExpiresAtIn applies the In predicate on the "output_expires_at" field.
+func OutputExpiresAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldOutputExpiresAt, vs...))
+}
+
+// OutputExpiresAtNotIn applies the NotIn predicate on the "output_expires_at" field.
+func OutputExpiresAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldOutputExpiresAt, vs...))
+}
+
+// OutputExpiresAtGT applies the GT predicate on the "output_expires_at" field.
+func OutputExpiresAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldOutputExpiresAt, v))
+}
+
+// OutputExpiresAtGTE applies the GTE predicate on the "output_expires_at" field.
+func OutputExpiresAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldOutputExpiresAt, v))
+}
+
+// OutputExpiresAtLT applies the LT predicate on the "output_expires_at" field.
+func OutputExpiresAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldOutputExpiresAt, v))
+}
+
+// OutputExpiresAtLTE applies the LTE predicate on the "output_expires_at" field.
+func OutputExpiresAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldOutputExpiresAt, v))
+}
+
+// OutputExpiresAtIsNil applies the IsNil predicate on the "output_expires_at" field.
+func OutputExpiresAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldOutputExpiresAt))
+}
+
+// OutputExpiresAtNotNil applies the NotNil predicate on the "output_expires_at" field.
+func OutputExpiresAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldOutputExpiresAt))
+}
+
+// InputDeletedAtEQ applies the EQ predicate on the "input_deleted_at" field.
+func InputDeletedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldInputDeletedAt, v))
+}
+
+// InputDeletedAtNEQ applies the NEQ predicate on the "input_deleted_at" field.
+func InputDeletedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldInputDeletedAt, v))
+}
+
+// InputDeletedAtIn applies the In predicate on the "input_deleted_at" field.
+func InputDeletedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldInputDeletedAt, vs...))
+}
+
+// InputDeletedAtNotIn applies the NotIn predicate on the "input_deleted_at" field.
+func InputDeletedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldInputDeletedAt, vs...))
+}
+
+// InputDeletedAtGT applies the GT predicate on the "input_deleted_at" field.
+func InputDeletedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldInputDeletedAt, v))
+}
+
+// InputDeletedAtGTE applies the GTE predicate on the "input_deleted_at" field.
+func InputDeletedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldInputDeletedAt, v))
+}
+
+// InputDeletedAtLT applies the LT predicate on the "input_deleted_at" field.
+func InputDeletedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldInputDeletedAt, v))
+}
+
+// InputDeletedAtLTE applies the LTE predicate on the "input_deleted_at" field.
+func InputDeletedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldInputDeletedAt, v))
+}
+
+// InputDeletedAtIsNil applies the IsNil predicate on the "input_deleted_at" field.
+func InputDeletedAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldInputDeletedAt))
+}
+
+// InputDeletedAtNotNil applies the NotNil predicate on the "input_deleted_at" field.
+func InputDeletedAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldInputDeletedAt))
+}
+
+// OutputDeletedAtEQ applies the EQ predicate on the "output_deleted_at" field.
+func OutputDeletedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldOutputDeletedAt, v))
+}
+
+// OutputDeletedAtNEQ applies the NEQ predicate on the "output_deleted_at" field.
+func OutputDeletedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldOutputDeletedAt, v))
+}
+
+// OutputDeletedAtIn applies the In predicate on the "output_deleted_at" field.
+func OutputDeletedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldOutputDeletedAt, vs...))
+}
+
+// OutputDeletedAtNotIn applies the NotIn predicate on the "output_deleted_at" field.
+func OutputDeletedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldOutputDeletedAt, vs...))
+}
+
+// OutputDeletedAtGT applies the GT predicate on the "output_deleted_at" field.
+func OutputDeletedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldOutputDeletedAt, v))
+}
+
+// OutputDeletedAtGTE applies the GTE predicate on the "output_deleted_at" field.
+func OutputDeletedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldOutputDeletedAt, v))
+}
+
+// OutputDeletedAtLT applies the LT predicate on the "output_deleted_at" field.
+func OutputDeletedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldOutputDeletedAt, v))
+}
+
+// OutputDeletedAtLTE applies the LTE predicate on the "output_deleted_at" field.
+func OutputDeletedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldOutputDeletedAt, v))
+}
+
+// OutputDeletedAtIsNil applies the IsNil predicate on the "output_deleted_at" field.
+func OutputDeletedAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldOutputDeletedAt))
+}
+
+// OutputDeletedAtNotNil applies the NotNil predicate on the "output_deleted_at" field.
+func OutputDeletedAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldOutputDeletedAt))
+}
+
+// DownloadedAtEQ applies the EQ predicate on the "downloaded_at" field.
+func DownloadedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldDownloadedAt, v))
+}
+
+// DownloadedAtNEQ applies the NEQ predicate on the "downloaded_at" field.
+func DownloadedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldDownloadedAt, v))
+}
+
+// DownloadedAtIn applies the In predicate on the "downloaded_at" field.
+func DownloadedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldDownloadedAt, vs...))
+}
+
+// DownloadedAtNotIn applies the NotIn predicate on the "downloaded_at" field.
+func DownloadedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldDownloadedAt, vs...))
+}
+
+// DownloadedAtGT applies the GT predicate on the "downloaded_at" field.
+func DownloadedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldDownloadedAt, v))
+}
+
+// DownloadedAtGTE applies the GTE predicate on the "downloaded_at" field.
+func DownloadedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldDownloadedAt, v))
+}
+
+// DownloadedAtLT applies the LT predicate on the "downloaded_at" field.
+func DownloadedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldDownloadedAt, v))
+}
+
+// DownloadedAtLTE applies the LTE predicate on the "downloaded_at" field.
+func DownloadedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldDownloadedAt, v))
+}
+
+// DownloadedAtIsNil applies the IsNil predicate on the "downloaded_at" field.
+func DownloadedAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldDownloadedAt))
+}
+
+// DownloadedAtNotNil applies the NotNil predicate on the "downloaded_at" field.
+func DownloadedAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldDownloadedAt))
+}
+
+// UserDeletedAtEQ applies the EQ predicate on the "user_deleted_at" field.
+func UserDeletedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldUserDeletedAt, v))
+}
+
+// UserDeletedAtNEQ applies the NEQ predicate on the "user_deleted_at" field.
+func UserDeletedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldUserDeletedAt, v))
+}
+
+// UserDeletedAtIn applies the In predicate on the "user_deleted_at" field.
+func UserDeletedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldUserDeletedAt, vs...))
+}
+
+// UserDeletedAtNotIn applies the NotIn predicate on the "user_deleted_at" field.
+func UserDeletedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldUserDeletedAt, vs...))
+}
+
+// UserDeletedAtGT applies the GT predicate on the "user_deleted_at" field.
+func UserDeletedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldUserDeletedAt, v))
+}
+
+// UserDeletedAtGTE applies the GTE predicate on the "user_deleted_at" field.
+func UserDeletedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldUserDeletedAt, v))
+}
+
+// UserDeletedAtLT applies the LT predicate on the "user_deleted_at" field.
+func UserDeletedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldUserDeletedAt, v))
+}
+
+// UserDeletedAtLTE applies the LTE predicate on the "user_deleted_at" field.
+func UserDeletedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldUserDeletedAt, v))
+}
+
+// UserDeletedAtIsNil applies the IsNil predicate on the "user_deleted_at" field.
+func UserDeletedAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldUserDeletedAt))
+}
+
+// UserDeletedAtNotNil applies the NotNil predicate on the "user_deleted_at" field.
+func UserDeletedAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldUserDeletedAt))
+}
+
+// LastErrorCodeEQ applies the EQ predicate on the "last_error_code" field.
+func LastErrorCodeEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeNEQ applies the NEQ predicate on the "last_error_code" field.
+func LastErrorCodeNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeIn applies the In predicate on the "last_error_code" field.
+func LastErrorCodeIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldLastErrorCode, vs...))
+}
+
+// LastErrorCodeNotIn applies the NotIn predicate on the "last_error_code" field.
+func LastErrorCodeNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldLastErrorCode, vs...))
+}
+
+// LastErrorCodeGT applies the GT predicate on the "last_error_code" field.
+func LastErrorCodeGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeGTE applies the GTE predicate on the "last_error_code" field.
+func LastErrorCodeGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeLT applies the LT predicate on the "last_error_code" field.
+func LastErrorCodeLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeLTE applies the LTE predicate on the "last_error_code" field.
+func LastErrorCodeLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeContains applies the Contains predicate on the "last_error_code" field.
+func LastErrorCodeContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeHasPrefix applies the HasPrefix predicate on the "last_error_code" field.
+func LastErrorCodeHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeHasSuffix applies the HasSuffix predicate on the "last_error_code" field.
+func LastErrorCodeHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeIsNil applies the IsNil predicate on the "last_error_code" field.
+func LastErrorCodeIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldLastErrorCode))
+}
+
+// LastErrorCodeNotNil applies the NotNil predicate on the "last_error_code" field.
+func LastErrorCodeNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldLastErrorCode))
+}
+
+// LastErrorCodeEqualFold applies the EqualFold predicate on the "last_error_code" field.
+func LastErrorCodeEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldLastErrorCode, v))
+}
+
+// LastErrorCodeContainsFold applies the ContainsFold predicate on the "last_error_code" field.
+func LastErrorCodeContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldLastErrorCode, v))
+}
+
+// LastErrorMessageEQ applies the EQ predicate on the "last_error_message" field.
+func LastErrorMessageEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageNEQ applies the NEQ predicate on the "last_error_message" field.
+func LastErrorMessageNEQ(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageIn applies the In predicate on the "last_error_message" field.
+func LastErrorMessageIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldLastErrorMessage, vs...))
+}
+
+// LastErrorMessageNotIn applies the NotIn predicate on the "last_error_message" field.
+func LastErrorMessageNotIn(vs ...string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldLastErrorMessage, vs...))
+}
+
+// LastErrorMessageGT applies the GT predicate on the "last_error_message" field.
+func LastErrorMessageGT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageGTE applies the GTE predicate on the "last_error_message" field.
+func LastErrorMessageGTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageLT applies the LT predicate on the "last_error_message" field.
+func LastErrorMessageLT(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageLTE applies the LTE predicate on the "last_error_message" field.
+func LastErrorMessageLTE(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageContains applies the Contains predicate on the "last_error_message" field.
+func LastErrorMessageContains(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContains(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageHasPrefix applies the HasPrefix predicate on the "last_error_message" field.
+func LastErrorMessageHasPrefix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasPrefix(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageHasSuffix applies the HasSuffix predicate on the "last_error_message" field.
+func LastErrorMessageHasSuffix(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldHasSuffix(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageIsNil applies the IsNil predicate on the "last_error_message" field.
+func LastErrorMessageIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldLastErrorMessage))
+}
+
+// LastErrorMessageNotNil applies the NotNil predicate on the "last_error_message" field.
+func LastErrorMessageNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldLastErrorMessage))
+}
+
+// LastErrorMessageEqualFold applies the EqualFold predicate on the "last_error_message" field.
+func LastErrorMessageEqualFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEqualFold(FieldLastErrorMessage, v))
+}
+
+// LastErrorMessageContainsFold applies the ContainsFold predicate on the "last_error_message" field.
+func LastErrorMessageContainsFold(v string) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldContainsFold(FieldLastErrorMessage, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// SubmittedAtEQ applies the EQ predicate on the "submitted_at" field.
+func SubmittedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldSubmittedAt, v))
+}
+
+// SubmittedAtNEQ applies the NEQ predicate on the "submitted_at" field.
+func SubmittedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldSubmittedAt, v))
+}
+
+// SubmittedAtIn applies the In predicate on the "submitted_at" field.
+func SubmittedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldSubmittedAt, vs...))
+}
+
+// SubmittedAtNotIn applies the NotIn predicate on the "submitted_at" field.
+func SubmittedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldSubmittedAt, vs...))
+}
+
+// SubmittedAtGT applies the GT predicate on the "submitted_at" field.
+func SubmittedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldSubmittedAt, v))
+}
+
+// SubmittedAtGTE applies the GTE predicate on the "submitted_at" field.
+func SubmittedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldSubmittedAt, v))
+}
+
+// SubmittedAtLT applies the LT predicate on the "submitted_at" field.
+func SubmittedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldSubmittedAt, v))
+}
+
+// SubmittedAtLTE applies the LTE predicate on the "submitted_at" field.
+func SubmittedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldSubmittedAt, v))
+}
+
+// SubmittedAtIsNil applies the IsNil predicate on the "submitted_at" field.
+func SubmittedAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldSubmittedAt))
+}
+
+// SubmittedAtNotNil applies the NotNil predicate on the "submitted_at" field.
+func SubmittedAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldSubmittedAt))
+}
+
+// StartedAtEQ applies the EQ predicate on the "started_at" field.
+func StartedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldStartedAt, v))
+}
+
+// StartedAtNEQ applies the NEQ predicate on the "started_at" field.
+func StartedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldStartedAt, v))
+}
+
+// StartedAtIn applies the In predicate on the "started_at" field.
+func StartedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldStartedAt, vs...))
+}
+
+// StartedAtNotIn applies the NotIn predicate on the "started_at" field.
+func StartedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldStartedAt, vs...))
+}
+
+// StartedAtGT applies the GT predicate on the "started_at" field.
+func StartedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldStartedAt, v))
+}
+
+// StartedAtGTE applies the GTE predicate on the "started_at" field.
+func StartedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldStartedAt, v))
+}
+
+// StartedAtLT applies the LT predicate on the "started_at" field.
+func StartedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldStartedAt, v))
+}
+
+// StartedAtLTE applies the LTE predicate on the "started_at" field.
+func StartedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldStartedAt, v))
+}
+
+// StartedAtIsNil applies the IsNil predicate on the "started_at" field.
+func StartedAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldStartedAt))
+}
+
+// StartedAtNotNil applies the NotNil predicate on the "started_at" field.
+func StartedAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldStartedAt))
+}
+
+// FinishedAtEQ applies the EQ predicate on the "finished_at" field.
+func FinishedAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldFinishedAt, v))
+}
+
+// FinishedAtNEQ applies the NEQ predicate on the "finished_at" field.
+func FinishedAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldFinishedAt, v))
+}
+
+// FinishedAtIn applies the In predicate on the "finished_at" field.
+func FinishedAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldFinishedAt, vs...))
+}
+
+// FinishedAtNotIn applies the NotIn predicate on the "finished_at" field.
+func FinishedAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldFinishedAt, vs...))
+}
+
+// FinishedAtGT applies the GT predicate on the "finished_at" field.
+func FinishedAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldFinishedAt, v))
+}
+
+// FinishedAtGTE applies the GTE predicate on the "finished_at" field.
+func FinishedAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldFinishedAt, v))
+}
+
+// FinishedAtLT applies the LT predicate on the "finished_at" field.
+func FinishedAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldFinishedAt, v))
+}
+
+// FinishedAtLTE applies the LTE predicate on the "finished_at" field.
+func FinishedAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldFinishedAt, v))
+}
+
+// FinishedAtIsNil applies the IsNil predicate on the "finished_at" field.
+func FinishedAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldFinishedAt))
+}
+
+// FinishedAtNotNil applies the NotNil predicate on the "finished_at" field.
+func FinishedAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldFinishedAt))
+}
+
+// SettledAtEQ applies the EQ predicate on the "settled_at" field.
+func SettledAtEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldEQ(FieldSettledAt, v))
+}
+
+// SettledAtNEQ applies the NEQ predicate on the "settled_at" field.
+func SettledAtNEQ(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNEQ(FieldSettledAt, v))
+}
+
+// SettledAtIn applies the In predicate on the "settled_at" field.
+func SettledAtIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIn(FieldSettledAt, vs...))
+}
+
+// SettledAtNotIn applies the NotIn predicate on the "settled_at" field.
+func SettledAtNotIn(vs ...time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotIn(FieldSettledAt, vs...))
+}
+
+// SettledAtGT applies the GT predicate on the "settled_at" field.
+func SettledAtGT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGT(FieldSettledAt, v))
+}
+
+// SettledAtGTE applies the GTE predicate on the "settled_at" field.
+func SettledAtGTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldGTE(FieldSettledAt, v))
+}
+
+// SettledAtLT applies the LT predicate on the "settled_at" field.
+func SettledAtLT(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLT(FieldSettledAt, v))
+}
+
+// SettledAtLTE applies the LTE predicate on the "settled_at" field.
+func SettledAtLTE(v time.Time) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldLTE(FieldSettledAt, v))
+}
+
+// SettledAtIsNil applies the IsNil predicate on the "settled_at" field.
+func SettledAtIsNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldIsNull(FieldSettledAt))
+}
+
+// SettledAtNotNil applies the NotNil predicate on the "settled_at" field.
+func SettledAtNotNil() predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.FieldNotNull(FieldSettledAt))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.BatchImageJob) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.BatchImageJob) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.BatchImageJob) predicate.BatchImageJob {
+ return predicate.BatchImageJob(sql.NotPredicates(p))
+}
diff --git a/backend/ent/batchimagejob_create.go b/backend/ent/batchimagejob_create.go
new file mode 100644
index 0000000000..88c1197b15
--- /dev/null
+++ b/backend/ent/batchimagejob_create.go
@@ -0,0 +1,3518 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
+)
+
+// BatchImageJobCreate is the builder for creating a BatchImageJob entity.
+type BatchImageJobCreate struct {
+ config
+ mutation *BatchImageJobMutation
+ hooks []Hook
+ conflict []sql.ConflictOption
+}
+
+// SetBatchID sets the "batch_id" field.
+func (_c *BatchImageJobCreate) SetBatchID(v string) *BatchImageJobCreate {
+ _c.mutation.SetBatchID(v)
+ return _c
+}
+
+// SetUserID sets the "user_id" field.
+func (_c *BatchImageJobCreate) SetUserID(v int64) *BatchImageJobCreate {
+ _c.mutation.SetUserID(v)
+ return _c
+}
+
+// SetAPIKeyID sets the "api_key_id" field.
+func (_c *BatchImageJobCreate) SetAPIKeyID(v int64) *BatchImageJobCreate {
+ _c.mutation.SetAPIKeyID(v)
+ return _c
+}
+
+// SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableAPIKeyID(v *int64) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetAPIKeyID(*v)
+ }
+ return _c
+}
+
+// SetAccountID sets the "account_id" field.
+func (_c *BatchImageJobCreate) SetAccountID(v int64) *BatchImageJobCreate {
+ _c.mutation.SetAccountID(v)
+ return _c
+}
+
+// SetNillableAccountID sets the "account_id" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableAccountID(v *int64) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetAccountID(*v)
+ }
+ return _c
+}
+
+// SetProvider sets the "provider" field.
+func (_c *BatchImageJobCreate) SetProvider(v string) *BatchImageJobCreate {
+ _c.mutation.SetProvider(v)
+ return _c
+}
+
+// SetModel sets the "model" field.
+func (_c *BatchImageJobCreate) SetModel(v string) *BatchImageJobCreate {
+ _c.mutation.SetModel(v)
+ return _c
+}
+
+// SetTaskName sets the "task_name" field.
+func (_c *BatchImageJobCreate) SetTaskName(v string) *BatchImageJobCreate {
+ _c.mutation.SetTaskName(v)
+ return _c
+}
+
+// SetNillableTaskName sets the "task_name" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableTaskName(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetTaskName(*v)
+ }
+ return _c
+}
+
+// SetStatus sets the "status" field.
+func (_c *BatchImageJobCreate) SetStatus(v string) *BatchImageJobCreate {
+ _c.mutation.SetStatus(v)
+ return _c
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableStatus(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetStatus(*v)
+ }
+ return _c
+}
+
+// SetProviderJobName sets the "provider_job_name" field.
+func (_c *BatchImageJobCreate) SetProviderJobName(v string) *BatchImageJobCreate {
+ _c.mutation.SetProviderJobName(v)
+ return _c
+}
+
+// SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableProviderJobName(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetProviderJobName(*v)
+ }
+ return _c
+}
+
+// SetProviderInputRef sets the "provider_input_ref" field.
+func (_c *BatchImageJobCreate) SetProviderInputRef(v string) *BatchImageJobCreate {
+ _c.mutation.SetProviderInputRef(v)
+ return _c
+}
+
+// SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableProviderInputRef(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetProviderInputRef(*v)
+ }
+ return _c
+}
+
+// SetProviderOutputRef sets the "provider_output_ref" field.
+func (_c *BatchImageJobCreate) SetProviderOutputRef(v string) *BatchImageJobCreate {
+ _c.mutation.SetProviderOutputRef(v)
+ return _c
+}
+
+// SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableProviderOutputRef(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetProviderOutputRef(*v)
+ }
+ return _c
+}
+
+// SetGcsInputURI sets the "gcs_input_uri" field.
+func (_c *BatchImageJobCreate) SetGcsInputURI(v string) *BatchImageJobCreate {
+ _c.mutation.SetGcsInputURI(v)
+ return _c
+}
+
+// SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableGcsInputURI(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetGcsInputURI(*v)
+ }
+ return _c
+}
+
+// SetGcsOutputURI sets the "gcs_output_uri" field.
+func (_c *BatchImageJobCreate) SetGcsOutputURI(v string) *BatchImageJobCreate {
+ _c.mutation.SetGcsOutputURI(v)
+ return _c
+}
+
+// SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableGcsOutputURI(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetGcsOutputURI(*v)
+ }
+ return _c
+}
+
+// SetItemCount sets the "item_count" field.
+func (_c *BatchImageJobCreate) SetItemCount(v int) *BatchImageJobCreate {
+ _c.mutation.SetItemCount(v)
+ return _c
+}
+
+// SetSuccessCount sets the "success_count" field.
+func (_c *BatchImageJobCreate) SetSuccessCount(v int) *BatchImageJobCreate {
+ _c.mutation.SetSuccessCount(v)
+ return _c
+}
+
+// SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableSuccessCount(v *int) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetSuccessCount(*v)
+ }
+ return _c
+}
+
+// SetFailCount sets the "fail_count" field.
+func (_c *BatchImageJobCreate) SetFailCount(v int) *BatchImageJobCreate {
+ _c.mutation.SetFailCount(v)
+ return _c
+}
+
+// SetNillableFailCount sets the "fail_count" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableFailCount(v *int) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetFailCount(*v)
+ }
+ return _c
+}
+
+// SetCancelledCount sets the "cancelled_count" field.
+func (_c *BatchImageJobCreate) SetCancelledCount(v int) *BatchImageJobCreate {
+ _c.mutation.SetCancelledCount(v)
+ return _c
+}
+
+// SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableCancelledCount(v *int) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetCancelledCount(*v)
+ }
+ return _c
+}
+
+// SetEstimatedCost sets the "estimated_cost" field.
+func (_c *BatchImageJobCreate) SetEstimatedCost(v float64) *BatchImageJobCreate {
+ _c.mutation.SetEstimatedCost(v)
+ return _c
+}
+
+// SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableEstimatedCost(v *float64) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetEstimatedCost(*v)
+ }
+ return _c
+}
+
+// SetHoldAmount sets the "hold_amount" field.
+func (_c *BatchImageJobCreate) SetHoldAmount(v float64) *BatchImageJobCreate {
+ _c.mutation.SetHoldAmount(v)
+ return _c
+}
+
+// SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableHoldAmount(v *float64) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetHoldAmount(*v)
+ }
+ return _c
+}
+
+// SetActualCost sets the "actual_cost" field.
+func (_c *BatchImageJobCreate) SetActualCost(v float64) *BatchImageJobCreate {
+ _c.mutation.SetActualCost(v)
+ return _c
+}
+
+// SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableActualCost(v *float64) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetActualCost(*v)
+ }
+ return _c
+}
+
+// SetCurrency sets the "currency" field.
+func (_c *BatchImageJobCreate) SetCurrency(v string) *BatchImageJobCreate {
+ _c.mutation.SetCurrency(v)
+ return _c
+}
+
+// SetNillableCurrency sets the "currency" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableCurrency(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetCurrency(*v)
+ }
+ return _c
+}
+
+// SetHoldID sets the "hold_id" field.
+func (_c *BatchImageJobCreate) SetHoldID(v string) *BatchImageJobCreate {
+ _c.mutation.SetHoldID(v)
+ return _c
+}
+
+// SetNillableHoldID sets the "hold_id" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableHoldID(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetHoldID(*v)
+ }
+ return _c
+}
+
+// SetIdempotencyKey sets the "idempotency_key" field.
+func (_c *BatchImageJobCreate) SetIdempotencyKey(v string) *BatchImageJobCreate {
+ _c.mutation.SetIdempotencyKey(v)
+ return _c
+}
+
+// SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableIdempotencyKey(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetIdempotencyKey(*v)
+ }
+ return _c
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (_c *BatchImageJobCreate) SetRequestHash(v string) *BatchImageJobCreate {
+ _c.mutation.SetRequestHash(v)
+ return _c
+}
+
+// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableRequestHash(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetRequestHash(*v)
+ }
+ return _c
+}
+
+// SetManifestHash sets the "manifest_hash" field.
+func (_c *BatchImageJobCreate) SetManifestHash(v string) *BatchImageJobCreate {
+ _c.mutation.SetManifestHash(v)
+ return _c
+}
+
+// SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableManifestHash(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetManifestHash(*v)
+ }
+ return _c
+}
+
+// SetRetryCount sets the "retry_count" field.
+func (_c *BatchImageJobCreate) SetRetryCount(v int) *BatchImageJobCreate {
+ _c.mutation.SetRetryCount(v)
+ return _c
+}
+
+// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableRetryCount(v *int) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetRetryCount(*v)
+ }
+ return _c
+}
+
+// SetVersion sets the "version" field.
+func (_c *BatchImageJobCreate) SetVersion(v int) *BatchImageJobCreate {
+ _c.mutation.SetVersion(v)
+ return _c
+}
+
+// SetNillableVersion sets the "version" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableVersion(v *int) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetVersion(*v)
+ }
+ return _c
+}
+
+// SetOutputExpiresAt sets the "output_expires_at" field.
+func (_c *BatchImageJobCreate) SetOutputExpiresAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetOutputExpiresAt(v)
+ return _c
+}
+
+// SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetOutputExpiresAt(*v)
+ }
+ return _c
+}
+
+// SetInputDeletedAt sets the "input_deleted_at" field.
+func (_c *BatchImageJobCreate) SetInputDeletedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetInputDeletedAt(v)
+ return _c
+}
+
+// SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetInputDeletedAt(*v)
+ }
+ return _c
+}
+
+// SetOutputDeletedAt sets the "output_deleted_at" field.
+func (_c *BatchImageJobCreate) SetOutputDeletedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetOutputDeletedAt(v)
+ return _c
+}
+
+// SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetOutputDeletedAt(*v)
+ }
+ return _c
+}
+
+// SetDownloadedAt sets the "downloaded_at" field.
+func (_c *BatchImageJobCreate) SetDownloadedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetDownloadedAt(v)
+ return _c
+}
+
+// SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableDownloadedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetDownloadedAt(*v)
+ }
+ return _c
+}
+
+// SetUserDeletedAt sets the "user_deleted_at" field.
+func (_c *BatchImageJobCreate) SetUserDeletedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetUserDeletedAt(v)
+ return _c
+}
+
+// SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetUserDeletedAt(*v)
+ }
+ return _c
+}
+
+// SetLastErrorCode sets the "last_error_code" field.
+func (_c *BatchImageJobCreate) SetLastErrorCode(v string) *BatchImageJobCreate {
+ _c.mutation.SetLastErrorCode(v)
+ return _c
+}
+
+// SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableLastErrorCode(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetLastErrorCode(*v)
+ }
+ return _c
+}
+
+// SetLastErrorMessage sets the "last_error_message" field.
+func (_c *BatchImageJobCreate) SetLastErrorMessage(v string) *BatchImageJobCreate {
+ _c.mutation.SetLastErrorMessage(v)
+ return _c
+}
+
+// SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableLastErrorMessage(v *string) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetLastErrorMessage(*v)
+ }
+ return _c
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (_c *BatchImageJobCreate) SetCreatedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableCreatedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
+ }
+ return _c
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (_c *BatchImageJobCreate) SetUpdatedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetUpdatedAt(v)
+ return _c
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableUpdatedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetUpdatedAt(*v)
+ }
+ return _c
+}
+
+// SetSubmittedAt sets the "submitted_at" field.
+func (_c *BatchImageJobCreate) SetSubmittedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetSubmittedAt(v)
+ return _c
+}
+
+// SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableSubmittedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetSubmittedAt(*v)
+ }
+ return _c
+}
+
+// SetStartedAt sets the "started_at" field.
+func (_c *BatchImageJobCreate) SetStartedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetStartedAt(v)
+ return _c
+}
+
+// SetNillableStartedAt sets the "started_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableStartedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetStartedAt(*v)
+ }
+ return _c
+}
+
+// SetFinishedAt sets the "finished_at" field.
+func (_c *BatchImageJobCreate) SetFinishedAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetFinishedAt(v)
+ return _c
+}
+
+// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableFinishedAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetFinishedAt(*v)
+ }
+ return _c
+}
+
+// SetSettledAt sets the "settled_at" field.
+func (_c *BatchImageJobCreate) SetSettledAt(v time.Time) *BatchImageJobCreate {
+ _c.mutation.SetSettledAt(v)
+ return _c
+}
+
+// SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
+func (_c *BatchImageJobCreate) SetNillableSettledAt(v *time.Time) *BatchImageJobCreate {
+ if v != nil {
+ _c.SetSettledAt(*v)
+ }
+ return _c
+}
+
+// Mutation returns the BatchImageJobMutation object of the builder.
+func (_c *BatchImageJobCreate) Mutation() *BatchImageJobMutation {
+ return _c.mutation
+}
+
+// Save creates the BatchImageJob in the database.
+func (_c *BatchImageJobCreate) Save(ctx context.Context) (*BatchImageJob, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (_c *BatchImageJobCreate) SaveX(ctx context.Context) *BatchImageJob {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *BatchImageJobCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *BatchImageJobCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (_c *BatchImageJobCreate) defaults() {
+ if _, ok := _c.mutation.TaskName(); !ok {
+ v := batchimagejob.DefaultTaskName
+ _c.mutation.SetTaskName(v)
+ }
+ if _, ok := _c.mutation.Status(); !ok {
+ v := batchimagejob.DefaultStatus
+ _c.mutation.SetStatus(v)
+ }
+ if _, ok := _c.mutation.SuccessCount(); !ok {
+ v := batchimagejob.DefaultSuccessCount
+ _c.mutation.SetSuccessCount(v)
+ }
+ if _, ok := _c.mutation.FailCount(); !ok {
+ v := batchimagejob.DefaultFailCount
+ _c.mutation.SetFailCount(v)
+ }
+ if _, ok := _c.mutation.CancelledCount(); !ok {
+ v := batchimagejob.DefaultCancelledCount
+ _c.mutation.SetCancelledCount(v)
+ }
+ if _, ok := _c.mutation.EstimatedCost(); !ok {
+ v := batchimagejob.DefaultEstimatedCost
+ _c.mutation.SetEstimatedCost(v)
+ }
+ if _, ok := _c.mutation.Currency(); !ok {
+ v := batchimagejob.DefaultCurrency
+ _c.mutation.SetCurrency(v)
+ }
+ if _, ok := _c.mutation.RetryCount(); !ok {
+ v := batchimagejob.DefaultRetryCount
+ _c.mutation.SetRetryCount(v)
+ }
+ if _, ok := _c.mutation.Version(); !ok {
+ v := batchimagejob.DefaultVersion
+ _c.mutation.SetVersion(v)
+ }
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ v := batchimagejob.DefaultCreatedAt()
+ _c.mutation.SetCreatedAt(v)
+ }
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
+ v := batchimagejob.DefaultUpdatedAt()
+ _c.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_c *BatchImageJobCreate) check() error {
+ if _, ok := _c.mutation.BatchID(); !ok {
+ return &ValidationError{Name: "batch_id", err: errors.New(`ent: missing required field "BatchImageJob.batch_id"`)}
+ }
+ if v, ok := _c.mutation.BatchID(); ok {
+ if err := batchimagejob.BatchIDValidator(v); err != nil {
+ return &ValidationError{Name: "batch_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.batch_id": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.UserID(); !ok {
+ return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "BatchImageJob.user_id"`)}
+ }
+ if _, ok := _c.mutation.Provider(); !ok {
+ return &ValidationError{Name: "provider", err: errors.New(`ent: missing required field "BatchImageJob.provider"`)}
+ }
+ if v, ok := _c.mutation.Provider(); ok {
+ if err := batchimagejob.ProviderValidator(v); err != nil {
+ return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.Model(); !ok {
+ return &ValidationError{Name: "model", err: errors.New(`ent: missing required field "BatchImageJob.model"`)}
+ }
+ if v, ok := _c.mutation.Model(); ok {
+ if err := batchimagejob.ModelValidator(v); err != nil {
+ return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.TaskName(); !ok {
+ return &ValidationError{Name: "task_name", err: errors.New(`ent: missing required field "BatchImageJob.task_name"`)}
+ }
+ if v, ok := _c.mutation.TaskName(); ok {
+ if err := batchimagejob.TaskNameValidator(v); err != nil {
+ return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.Status(); !ok {
+ return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "BatchImageJob.status"`)}
+ }
+ if v, ok := _c.mutation.Status(); ok {
+ if err := batchimagejob.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.ProviderJobName(); ok {
+ if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
+ return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.ProviderInputRef(); ok {
+ if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
+ return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.ProviderOutputRef(); ok {
+ if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
+ return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.GcsInputURI(); ok {
+ if err := batchimagejob.GcsInputURIValidator(v); err != nil {
+ return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.GcsOutputURI(); ok {
+ if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
+ return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.ItemCount(); !ok {
+ return &ValidationError{Name: "item_count", err: errors.New(`ent: missing required field "BatchImageJob.item_count"`)}
+ }
+ if _, ok := _c.mutation.SuccessCount(); !ok {
+ return &ValidationError{Name: "success_count", err: errors.New(`ent: missing required field "BatchImageJob.success_count"`)}
+ }
+ if _, ok := _c.mutation.FailCount(); !ok {
+ return &ValidationError{Name: "fail_count", err: errors.New(`ent: missing required field "BatchImageJob.fail_count"`)}
+ }
+ if _, ok := _c.mutation.CancelledCount(); !ok {
+ return &ValidationError{Name: "cancelled_count", err: errors.New(`ent: missing required field "BatchImageJob.cancelled_count"`)}
+ }
+ if _, ok := _c.mutation.EstimatedCost(); !ok {
+ return &ValidationError{Name: "estimated_cost", err: errors.New(`ent: missing required field "BatchImageJob.estimated_cost"`)}
+ }
+ if _, ok := _c.mutation.Currency(); !ok {
+ return &ValidationError{Name: "currency", err: errors.New(`ent: missing required field "BatchImageJob.currency"`)}
+ }
+ if v, ok := _c.mutation.Currency(); ok {
+ if err := batchimagejob.CurrencyValidator(v); err != nil {
+ return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.HoldID(); ok {
+ if err := batchimagejob.HoldIDValidator(v); err != nil {
+ return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.IdempotencyKey(); ok {
+ if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
+ return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.RequestHash(); ok {
+ if err := batchimagejob.RequestHashValidator(v); err != nil {
+ return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
+ }
+ }
+ if v, ok := _c.mutation.ManifestHash(); ok {
+ if err := batchimagejob.ManifestHashValidator(v); err != nil {
+ return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.RetryCount(); !ok {
+ return &ValidationError{Name: "retry_count", err: errors.New(`ent: missing required field "BatchImageJob.retry_count"`)}
+ }
+ if _, ok := _c.mutation.Version(); !ok {
+ return &ValidationError{Name: "version", err: errors.New(`ent: missing required field "BatchImageJob.version"`)}
+ }
+ if v, ok := _c.mutation.LastErrorCode(); ok {
+ if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
+ return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BatchImageJob.created_at"`)}
+ }
+ if _, ok := _c.mutation.UpdatedAt(); !ok {
+ return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "BatchImageJob.updated_at"`)}
+ }
+ return nil
+}
+
+func (_c *BatchImageJobCreate) sqlSave(ctx context.Context) (*BatchImageJob, error) {
+ if err := _c.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ id := _spec.ID.Value.(int64)
+ _node.ID = int64(id)
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
+ return _node, nil
+}
+
+func (_c *BatchImageJobCreate) createSpec() (*BatchImageJob, *sqlgraph.CreateSpec) {
+ var (
+ _node = &BatchImageJob{config: _c.config}
+ _spec = sqlgraph.NewCreateSpec(batchimagejob.Table, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
+ )
+ _spec.OnConflict = _c.conflict
+ if value, ok := _c.mutation.BatchID(); ok {
+ _spec.SetField(batchimagejob.FieldBatchID, field.TypeString, value)
+ _node.BatchID = value
+ }
+ if value, ok := _c.mutation.UserID(); ok {
+ _spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
+ _node.UserID = value
+ }
+ if value, ok := _c.mutation.APIKeyID(); ok {
+ _spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
+ _node.APIKeyID = &value
+ }
+ if value, ok := _c.mutation.AccountID(); ok {
+ _spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
+ _node.AccountID = &value
+ }
+ if value, ok := _c.mutation.Provider(); ok {
+ _spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
+ _node.Provider = value
+ }
+ if value, ok := _c.mutation.Model(); ok {
+ _spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
+ _node.Model = value
+ }
+ if value, ok := _c.mutation.TaskName(); ok {
+ _spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
+ _node.TaskName = value
+ }
+ if value, ok := _c.mutation.Status(); ok {
+ _spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
+ _node.Status = value
+ }
+ if value, ok := _c.mutation.ProviderJobName(); ok {
+ _spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
+ _node.ProviderJobName = &value
+ }
+ if value, ok := _c.mutation.ProviderInputRef(); ok {
+ _spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
+ _node.ProviderInputRef = &value
+ }
+ if value, ok := _c.mutation.ProviderOutputRef(); ok {
+ _spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
+ _node.ProviderOutputRef = &value
+ }
+ if value, ok := _c.mutation.GcsInputURI(); ok {
+ _spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
+ _node.GcsInputURI = &value
+ }
+ if value, ok := _c.mutation.GcsOutputURI(); ok {
+ _spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
+ _node.GcsOutputURI = &value
+ }
+ if value, ok := _c.mutation.ItemCount(); ok {
+ _spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
+ _node.ItemCount = value
+ }
+ if value, ok := _c.mutation.SuccessCount(); ok {
+ _spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
+ _node.SuccessCount = value
+ }
+ if value, ok := _c.mutation.FailCount(); ok {
+ _spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
+ _node.FailCount = value
+ }
+ if value, ok := _c.mutation.CancelledCount(); ok {
+ _spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
+ _node.CancelledCount = value
+ }
+ if value, ok := _c.mutation.EstimatedCost(); ok {
+ _spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
+ _node.EstimatedCost = value
+ }
+ if value, ok := _c.mutation.HoldAmount(); ok {
+ _spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
+ _node.HoldAmount = &value
+ }
+ if value, ok := _c.mutation.ActualCost(); ok {
+ _spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
+ _node.ActualCost = &value
+ }
+ if value, ok := _c.mutation.Currency(); ok {
+ _spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
+ _node.Currency = value
+ }
+ if value, ok := _c.mutation.HoldID(); ok {
+ _spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
+ _node.HoldID = &value
+ }
+ if value, ok := _c.mutation.IdempotencyKey(); ok {
+ _spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
+ _node.IdempotencyKey = &value
+ }
+ if value, ok := _c.mutation.RequestHash(); ok {
+ _spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
+ _node.RequestHash = &value
+ }
+ if value, ok := _c.mutation.ManifestHash(); ok {
+ _spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
+ _node.ManifestHash = &value
+ }
+ if value, ok := _c.mutation.RetryCount(); ok {
+ _spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
+ _node.RetryCount = value
+ }
+ if value, ok := _c.mutation.Version(); ok {
+ _spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
+ _node.Version = value
+ }
+ if value, ok := _c.mutation.OutputExpiresAt(); ok {
+ _spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
+ _node.OutputExpiresAt = &value
+ }
+ if value, ok := _c.mutation.InputDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
+ _node.InputDeletedAt = &value
+ }
+ if value, ok := _c.mutation.OutputDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
+ _node.OutputDeletedAt = &value
+ }
+ if value, ok := _c.mutation.DownloadedAt(); ok {
+ _spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
+ _node.DownloadedAt = &value
+ }
+ if value, ok := _c.mutation.UserDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
+ _node.UserDeletedAt = &value
+ }
+ if value, ok := _c.mutation.LastErrorCode(); ok {
+ _spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
+ _node.LastErrorCode = &value
+ }
+ if value, ok := _c.mutation.LastErrorMessage(); ok {
+ _spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
+ _node.LastErrorMessage = &value
+ }
+ if value, ok := _c.mutation.CreatedAt(); ok {
+ _spec.SetField(batchimagejob.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ if value, ok := _c.mutation.UpdatedAt(); ok {
+ _spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
+ _node.UpdatedAt = value
+ }
+ if value, ok := _c.mutation.SubmittedAt(); ok {
+ _spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
+ _node.SubmittedAt = &value
+ }
+ if value, ok := _c.mutation.StartedAt(); ok {
+ _spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
+ _node.StartedAt = &value
+ }
+ if value, ok := _c.mutation.FinishedAt(); ok {
+ _spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
+ _node.FinishedAt = &value
+ }
+ if value, ok := _c.mutation.SettledAt(); ok {
+ _spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
+ _node.SettledAt = &value
+ }
+ return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+// client.BatchImageJob.Create().
+// SetBatchID(v).
+// OnConflict(
+// // Update the row with the new values
+// // the was proposed for insertion.
+// sql.ResolveWithNewValues(),
+// ).
+// // Override some of the fields with custom
+// // update values.
+// Update(func(u *ent.BatchImageJobUpsert) {
+// SetBatchID(v+v).
+// }).
+// Exec(ctx)
+func (_c *BatchImageJobCreate) OnConflict(opts ...sql.ConflictOption) *BatchImageJobUpsertOne {
+ _c.conflict = opts
+ return &BatchImageJobUpsertOne{
+ create: _c,
+ }
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+// client.BatchImageJob.Create().
+// OnConflict(sql.ConflictColumns(columns...)).
+// Exec(ctx)
+func (_c *BatchImageJobCreate) OnConflictColumns(columns ...string) *BatchImageJobUpsertOne {
+ _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
+ return &BatchImageJobUpsertOne{
+ create: _c,
+ }
+}
+
+type (
+ // BatchImageJobUpsertOne is the builder for "upsert"-ing
+ // one BatchImageJob node.
+ BatchImageJobUpsertOne struct {
+ create *BatchImageJobCreate
+ }
+
+ // BatchImageJobUpsert is the "OnConflict" setter.
+ BatchImageJobUpsert struct {
+ *sql.UpdateSet
+ }
+)
+
+// SetUserID sets the "user_id" field.
+func (u *BatchImageJobUpsert) SetUserID(v int64) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldUserID, v)
+ return u
+}
+
+// UpdateUserID sets the "user_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateUserID() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldUserID)
+ return u
+}
+
+// AddUserID adds v to the "user_id" field.
+func (u *BatchImageJobUpsert) AddUserID(v int64) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldUserID, v)
+ return u
+}
+
+// SetAPIKeyID sets the "api_key_id" field.
+func (u *BatchImageJobUpsert) SetAPIKeyID(v int64) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldAPIKeyID, v)
+ return u
+}
+
+// UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateAPIKeyID() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldAPIKeyID)
+ return u
+}
+
+// AddAPIKeyID adds v to the "api_key_id" field.
+func (u *BatchImageJobUpsert) AddAPIKeyID(v int64) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldAPIKeyID, v)
+ return u
+}
+
+// ClearAPIKeyID clears the value of the "api_key_id" field.
+func (u *BatchImageJobUpsert) ClearAPIKeyID() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldAPIKeyID)
+ return u
+}
+
+// SetAccountID sets the "account_id" field.
+func (u *BatchImageJobUpsert) SetAccountID(v int64) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldAccountID, v)
+ return u
+}
+
+// UpdateAccountID sets the "account_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateAccountID() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldAccountID)
+ return u
+}
+
+// AddAccountID adds v to the "account_id" field.
+func (u *BatchImageJobUpsert) AddAccountID(v int64) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldAccountID, v)
+ return u
+}
+
+// ClearAccountID clears the value of the "account_id" field.
+func (u *BatchImageJobUpsert) ClearAccountID() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldAccountID)
+ return u
+}
+
+// SetProvider sets the "provider" field.
+func (u *BatchImageJobUpsert) SetProvider(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldProvider, v)
+ return u
+}
+
+// UpdateProvider sets the "provider" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateProvider() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldProvider)
+ return u
+}
+
+// SetModel sets the "model" field.
+func (u *BatchImageJobUpsert) SetModel(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldModel, v)
+ return u
+}
+
+// UpdateModel sets the "model" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateModel() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldModel)
+ return u
+}
+
+// SetTaskName sets the "task_name" field.
+func (u *BatchImageJobUpsert) SetTaskName(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldTaskName, v)
+ return u
+}
+
+// UpdateTaskName sets the "task_name" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateTaskName() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldTaskName)
+ return u
+}
+
+// SetStatus sets the "status" field.
+func (u *BatchImageJobUpsert) SetStatus(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldStatus, v)
+ return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateStatus() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldStatus)
+ return u
+}
+
+// SetProviderJobName sets the "provider_job_name" field.
+func (u *BatchImageJobUpsert) SetProviderJobName(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldProviderJobName, v)
+ return u
+}
+
+// UpdateProviderJobName sets the "provider_job_name" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateProviderJobName() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldProviderJobName)
+ return u
+}
+
+// ClearProviderJobName clears the value of the "provider_job_name" field.
+func (u *BatchImageJobUpsert) ClearProviderJobName() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldProviderJobName)
+ return u
+}
+
+// SetProviderInputRef sets the "provider_input_ref" field.
+func (u *BatchImageJobUpsert) SetProviderInputRef(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldProviderInputRef, v)
+ return u
+}
+
+// UpdateProviderInputRef sets the "provider_input_ref" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateProviderInputRef() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldProviderInputRef)
+ return u
+}
+
+// ClearProviderInputRef clears the value of the "provider_input_ref" field.
+func (u *BatchImageJobUpsert) ClearProviderInputRef() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldProviderInputRef)
+ return u
+}
+
+// SetProviderOutputRef sets the "provider_output_ref" field.
+func (u *BatchImageJobUpsert) SetProviderOutputRef(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldProviderOutputRef, v)
+ return u
+}
+
+// UpdateProviderOutputRef sets the "provider_output_ref" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateProviderOutputRef() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldProviderOutputRef)
+ return u
+}
+
+// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
+func (u *BatchImageJobUpsert) ClearProviderOutputRef() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldProviderOutputRef)
+ return u
+}
+
+// SetGcsInputURI sets the "gcs_input_uri" field.
+func (u *BatchImageJobUpsert) SetGcsInputURI(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldGcsInputURI, v)
+ return u
+}
+
+// UpdateGcsInputURI sets the "gcs_input_uri" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateGcsInputURI() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldGcsInputURI)
+ return u
+}
+
+// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
+func (u *BatchImageJobUpsert) ClearGcsInputURI() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldGcsInputURI)
+ return u
+}
+
+// SetGcsOutputURI sets the "gcs_output_uri" field.
+func (u *BatchImageJobUpsert) SetGcsOutputURI(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldGcsOutputURI, v)
+ return u
+}
+
+// UpdateGcsOutputURI sets the "gcs_output_uri" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateGcsOutputURI() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldGcsOutputURI)
+ return u
+}
+
+// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
+func (u *BatchImageJobUpsert) ClearGcsOutputURI() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldGcsOutputURI)
+ return u
+}
+
+// SetItemCount sets the "item_count" field.
+func (u *BatchImageJobUpsert) SetItemCount(v int) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldItemCount, v)
+ return u
+}
+
+// UpdateItemCount sets the "item_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateItemCount() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldItemCount)
+ return u
+}
+
+// AddItemCount adds v to the "item_count" field.
+func (u *BatchImageJobUpsert) AddItemCount(v int) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldItemCount, v)
+ return u
+}
+
+// SetSuccessCount sets the "success_count" field.
+func (u *BatchImageJobUpsert) SetSuccessCount(v int) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldSuccessCount, v)
+ return u
+}
+
+// UpdateSuccessCount sets the "success_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateSuccessCount() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldSuccessCount)
+ return u
+}
+
+// AddSuccessCount adds v to the "success_count" field.
+func (u *BatchImageJobUpsert) AddSuccessCount(v int) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldSuccessCount, v)
+ return u
+}
+
+// SetFailCount sets the "fail_count" field.
+func (u *BatchImageJobUpsert) SetFailCount(v int) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldFailCount, v)
+ return u
+}
+
+// UpdateFailCount sets the "fail_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateFailCount() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldFailCount)
+ return u
+}
+
+// AddFailCount adds v to the "fail_count" field.
+func (u *BatchImageJobUpsert) AddFailCount(v int) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldFailCount, v)
+ return u
+}
+
+// SetCancelledCount sets the "cancelled_count" field.
+func (u *BatchImageJobUpsert) SetCancelledCount(v int) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldCancelledCount, v)
+ return u
+}
+
+// UpdateCancelledCount sets the "cancelled_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateCancelledCount() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldCancelledCount)
+ return u
+}
+
+// AddCancelledCount adds v to the "cancelled_count" field.
+func (u *BatchImageJobUpsert) AddCancelledCount(v int) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldCancelledCount, v)
+ return u
+}
+
+// SetEstimatedCost sets the "estimated_cost" field.
+func (u *BatchImageJobUpsert) SetEstimatedCost(v float64) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldEstimatedCost, v)
+ return u
+}
+
+// UpdateEstimatedCost sets the "estimated_cost" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateEstimatedCost() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldEstimatedCost)
+ return u
+}
+
+// AddEstimatedCost adds v to the "estimated_cost" field.
+func (u *BatchImageJobUpsert) AddEstimatedCost(v float64) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldEstimatedCost, v)
+ return u
+}
+
+// SetHoldAmount sets the "hold_amount" field.
+func (u *BatchImageJobUpsert) SetHoldAmount(v float64) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldHoldAmount, v)
+ return u
+}
+
+// UpdateHoldAmount sets the "hold_amount" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateHoldAmount() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldHoldAmount)
+ return u
+}
+
+// AddHoldAmount adds v to the "hold_amount" field.
+func (u *BatchImageJobUpsert) AddHoldAmount(v float64) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldHoldAmount, v)
+ return u
+}
+
+// ClearHoldAmount clears the value of the "hold_amount" field.
+func (u *BatchImageJobUpsert) ClearHoldAmount() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldHoldAmount)
+ return u
+}
+
+// SetActualCost sets the "actual_cost" field.
+func (u *BatchImageJobUpsert) SetActualCost(v float64) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldActualCost, v)
+ return u
+}
+
+// UpdateActualCost sets the "actual_cost" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateActualCost() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldActualCost)
+ return u
+}
+
+// AddActualCost adds v to the "actual_cost" field.
+func (u *BatchImageJobUpsert) AddActualCost(v float64) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldActualCost, v)
+ return u
+}
+
+// ClearActualCost clears the value of the "actual_cost" field.
+func (u *BatchImageJobUpsert) ClearActualCost() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldActualCost)
+ return u
+}
+
+// SetCurrency sets the "currency" field.
+func (u *BatchImageJobUpsert) SetCurrency(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldCurrency, v)
+ return u
+}
+
+// UpdateCurrency sets the "currency" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateCurrency() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldCurrency)
+ return u
+}
+
+// SetHoldID sets the "hold_id" field.
+func (u *BatchImageJobUpsert) SetHoldID(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldHoldID, v)
+ return u
+}
+
+// UpdateHoldID sets the "hold_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateHoldID() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldHoldID)
+ return u
+}
+
+// ClearHoldID clears the value of the "hold_id" field.
+func (u *BatchImageJobUpsert) ClearHoldID() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldHoldID)
+ return u
+}
+
+// SetIdempotencyKey sets the "idempotency_key" field.
+func (u *BatchImageJobUpsert) SetIdempotencyKey(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldIdempotencyKey, v)
+ return u
+}
+
+// UpdateIdempotencyKey sets the "idempotency_key" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateIdempotencyKey() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldIdempotencyKey)
+ return u
+}
+
+// ClearIdempotencyKey clears the value of the "idempotency_key" field.
+func (u *BatchImageJobUpsert) ClearIdempotencyKey() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldIdempotencyKey)
+ return u
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (u *BatchImageJobUpsert) SetRequestHash(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldRequestHash, v)
+ return u
+}
+
+// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateRequestHash() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldRequestHash)
+ return u
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (u *BatchImageJobUpsert) ClearRequestHash() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldRequestHash)
+ return u
+}
+
+// SetManifestHash sets the "manifest_hash" field.
+func (u *BatchImageJobUpsert) SetManifestHash(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldManifestHash, v)
+ return u
+}
+
+// UpdateManifestHash sets the "manifest_hash" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateManifestHash() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldManifestHash)
+ return u
+}
+
+// ClearManifestHash clears the value of the "manifest_hash" field.
+func (u *BatchImageJobUpsert) ClearManifestHash() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldManifestHash)
+ return u
+}
+
+// SetRetryCount sets the "retry_count" field.
+func (u *BatchImageJobUpsert) SetRetryCount(v int) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldRetryCount, v)
+ return u
+}
+
+// UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateRetryCount() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldRetryCount)
+ return u
+}
+
+// AddRetryCount adds v to the "retry_count" field.
+func (u *BatchImageJobUpsert) AddRetryCount(v int) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldRetryCount, v)
+ return u
+}
+
+// SetVersion sets the "version" field.
+func (u *BatchImageJobUpsert) SetVersion(v int) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldVersion, v)
+ return u
+}
+
+// UpdateVersion sets the "version" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateVersion() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldVersion)
+ return u
+}
+
+// AddVersion adds v to the "version" field.
+func (u *BatchImageJobUpsert) AddVersion(v int) *BatchImageJobUpsert {
+ u.Add(batchimagejob.FieldVersion, v)
+ return u
+}
+
+// SetOutputExpiresAt sets the "output_expires_at" field.
+func (u *BatchImageJobUpsert) SetOutputExpiresAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldOutputExpiresAt, v)
+ return u
+}
+
+// UpdateOutputExpiresAt sets the "output_expires_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateOutputExpiresAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldOutputExpiresAt)
+ return u
+}
+
+// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
+func (u *BatchImageJobUpsert) ClearOutputExpiresAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldOutputExpiresAt)
+ return u
+}
+
+// SetInputDeletedAt sets the "input_deleted_at" field.
+func (u *BatchImageJobUpsert) SetInputDeletedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldInputDeletedAt, v)
+ return u
+}
+
+// UpdateInputDeletedAt sets the "input_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateInputDeletedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldInputDeletedAt)
+ return u
+}
+
+// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
+func (u *BatchImageJobUpsert) ClearInputDeletedAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldInputDeletedAt)
+ return u
+}
+
+// SetOutputDeletedAt sets the "output_deleted_at" field.
+func (u *BatchImageJobUpsert) SetOutputDeletedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldOutputDeletedAt, v)
+ return u
+}
+
+// UpdateOutputDeletedAt sets the "output_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateOutputDeletedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldOutputDeletedAt)
+ return u
+}
+
+// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
+func (u *BatchImageJobUpsert) ClearOutputDeletedAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldOutputDeletedAt)
+ return u
+}
+
+// SetDownloadedAt sets the "downloaded_at" field.
+func (u *BatchImageJobUpsert) SetDownloadedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldDownloadedAt, v)
+ return u
+}
+
+// UpdateDownloadedAt sets the "downloaded_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateDownloadedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldDownloadedAt)
+ return u
+}
+
+// ClearDownloadedAt clears the value of the "downloaded_at" field.
+func (u *BatchImageJobUpsert) ClearDownloadedAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldDownloadedAt)
+ return u
+}
+
+// SetUserDeletedAt sets the "user_deleted_at" field.
+func (u *BatchImageJobUpsert) SetUserDeletedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldUserDeletedAt, v)
+ return u
+}
+
+// UpdateUserDeletedAt sets the "user_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateUserDeletedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldUserDeletedAt)
+ return u
+}
+
+// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
+func (u *BatchImageJobUpsert) ClearUserDeletedAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldUserDeletedAt)
+ return u
+}
+
+// SetLastErrorCode sets the "last_error_code" field.
+func (u *BatchImageJobUpsert) SetLastErrorCode(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldLastErrorCode, v)
+ return u
+}
+
+// UpdateLastErrorCode sets the "last_error_code" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateLastErrorCode() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldLastErrorCode)
+ return u
+}
+
+// ClearLastErrorCode clears the value of the "last_error_code" field.
+func (u *BatchImageJobUpsert) ClearLastErrorCode() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldLastErrorCode)
+ return u
+}
+
+// SetLastErrorMessage sets the "last_error_message" field.
+func (u *BatchImageJobUpsert) SetLastErrorMessage(v string) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldLastErrorMessage, v)
+ return u
+}
+
+// UpdateLastErrorMessage sets the "last_error_message" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateLastErrorMessage() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldLastErrorMessage)
+ return u
+}
+
+// ClearLastErrorMessage clears the value of the "last_error_message" field.
+func (u *BatchImageJobUpsert) ClearLastErrorMessage() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldLastErrorMessage)
+ return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *BatchImageJobUpsert) SetUpdatedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldUpdatedAt, v)
+ return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateUpdatedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldUpdatedAt)
+ return u
+}
+
+// SetSubmittedAt sets the "submitted_at" field.
+func (u *BatchImageJobUpsert) SetSubmittedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldSubmittedAt, v)
+ return u
+}
+
+// UpdateSubmittedAt sets the "submitted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateSubmittedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldSubmittedAt)
+ return u
+}
+
+// ClearSubmittedAt clears the value of the "submitted_at" field.
+func (u *BatchImageJobUpsert) ClearSubmittedAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldSubmittedAt)
+ return u
+}
+
+// SetStartedAt sets the "started_at" field.
+func (u *BatchImageJobUpsert) SetStartedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldStartedAt, v)
+ return u
+}
+
+// UpdateStartedAt sets the "started_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateStartedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldStartedAt)
+ return u
+}
+
+// ClearStartedAt clears the value of the "started_at" field.
+func (u *BatchImageJobUpsert) ClearStartedAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldStartedAt)
+ return u
+}
+
+// SetFinishedAt sets the "finished_at" field.
+func (u *BatchImageJobUpsert) SetFinishedAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldFinishedAt, v)
+ return u
+}
+
+// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateFinishedAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldFinishedAt)
+ return u
+}
+
+// ClearFinishedAt clears the value of the "finished_at" field.
+func (u *BatchImageJobUpsert) ClearFinishedAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldFinishedAt)
+ return u
+}
+
+// SetSettledAt sets the "settled_at" field.
+func (u *BatchImageJobUpsert) SetSettledAt(v time.Time) *BatchImageJobUpsert {
+ u.Set(batchimagejob.FieldSettledAt, v)
+ return u
+}
+
+// UpdateSettledAt sets the "settled_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsert) UpdateSettledAt() *BatchImageJobUpsert {
+ u.SetExcluded(batchimagejob.FieldSettledAt)
+ return u
+}
+
+// ClearSettledAt clears the value of the "settled_at" field.
+func (u *BatchImageJobUpsert) ClearSettledAt() *BatchImageJobUpsert {
+ u.SetNull(batchimagejob.FieldSettledAt)
+ return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create.
+// Using this option is equivalent to using:
+//
+// client.BatchImageJob.Create().
+// OnConflict(
+// sql.ResolveWithNewValues(),
+// ).
+// Exec(ctx)
+func (u *BatchImageJobUpsertOne) UpdateNewValues() *BatchImageJobUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+ if _, exists := u.create.mutation.BatchID(); exists {
+ s.SetIgnore(batchimagejob.FieldBatchID)
+ }
+ if _, exists := u.create.mutation.CreatedAt(); exists {
+ s.SetIgnore(batchimagejob.FieldCreatedAt)
+ }
+ }))
+ return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+// client.BatchImageJob.Create().
+// OnConflict(sql.ResolveWithIgnore()).
+// Exec(ctx)
+func (u *BatchImageJobUpsertOne) Ignore() *BatchImageJobUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+ return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *BatchImageJobUpsertOne) DoNothing() *BatchImageJobUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.DoNothing())
+ return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the BatchImageJobCreate.OnConflict
+// documentation for more info.
+func (u *BatchImageJobUpsertOne) Update(set func(*BatchImageJobUpsert)) *BatchImageJobUpsertOne {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+ set(&BatchImageJobUpsert{UpdateSet: update})
+ }))
+ return u
+}
+
+// SetUserID sets the "user_id" field.
+func (u *BatchImageJobUpsertOne) SetUserID(v int64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetUserID(v)
+ })
+}
+
+// AddUserID adds v to the "user_id" field.
+func (u *BatchImageJobUpsertOne) AddUserID(v int64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddUserID(v)
+ })
+}
+
+// UpdateUserID sets the "user_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateUserID() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateUserID()
+ })
+}
+
+// SetAPIKeyID sets the "api_key_id" field.
+func (u *BatchImageJobUpsertOne) SetAPIKeyID(v int64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetAPIKeyID(v)
+ })
+}
+
+// AddAPIKeyID adds v to the "api_key_id" field.
+func (u *BatchImageJobUpsertOne) AddAPIKeyID(v int64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddAPIKeyID(v)
+ })
+}
+
+// UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateAPIKeyID() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateAPIKeyID()
+ })
+}
+
+// ClearAPIKeyID clears the value of the "api_key_id" field.
+func (u *BatchImageJobUpsertOne) ClearAPIKeyID() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearAPIKeyID()
+ })
+}
+
+// SetAccountID sets the "account_id" field.
+func (u *BatchImageJobUpsertOne) SetAccountID(v int64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetAccountID(v)
+ })
+}
+
+// AddAccountID adds v to the "account_id" field.
+func (u *BatchImageJobUpsertOne) AddAccountID(v int64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddAccountID(v)
+ })
+}
+
+// UpdateAccountID sets the "account_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateAccountID() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateAccountID()
+ })
+}
+
+// ClearAccountID clears the value of the "account_id" field.
+func (u *BatchImageJobUpsertOne) ClearAccountID() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearAccountID()
+ })
+}
+
+// SetProvider sets the "provider" field.
+func (u *BatchImageJobUpsertOne) SetProvider(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProvider(v)
+ })
+}
+
+// UpdateProvider sets the "provider" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateProvider() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProvider()
+ })
+}
+
+// SetModel sets the "model" field.
+func (u *BatchImageJobUpsertOne) SetModel(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetModel(v)
+ })
+}
+
+// UpdateModel sets the "model" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateModel() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateModel()
+ })
+}
+
+// SetTaskName sets the "task_name" field.
+func (u *BatchImageJobUpsertOne) SetTaskName(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetTaskName(v)
+ })
+}
+
+// UpdateTaskName sets the "task_name" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateTaskName() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateTaskName()
+ })
+}
+
+// SetStatus sets the "status" field.
+func (u *BatchImageJobUpsertOne) SetStatus(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetStatus(v)
+ })
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateStatus() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateStatus()
+ })
+}
+
+// SetProviderJobName sets the "provider_job_name" field.
+func (u *BatchImageJobUpsertOne) SetProviderJobName(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProviderJobName(v)
+ })
+}
+
+// UpdateProviderJobName sets the "provider_job_name" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateProviderJobName() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProviderJobName()
+ })
+}
+
+// ClearProviderJobName clears the value of the "provider_job_name" field.
+func (u *BatchImageJobUpsertOne) ClearProviderJobName() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearProviderJobName()
+ })
+}
+
+// SetProviderInputRef sets the "provider_input_ref" field.
+func (u *BatchImageJobUpsertOne) SetProviderInputRef(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProviderInputRef(v)
+ })
+}
+
+// UpdateProviderInputRef sets the "provider_input_ref" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateProviderInputRef() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProviderInputRef()
+ })
+}
+
+// ClearProviderInputRef clears the value of the "provider_input_ref" field.
+func (u *BatchImageJobUpsertOne) ClearProviderInputRef() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearProviderInputRef()
+ })
+}
+
+// SetProviderOutputRef sets the "provider_output_ref" field.
+func (u *BatchImageJobUpsertOne) SetProviderOutputRef(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProviderOutputRef(v)
+ })
+}
+
+// UpdateProviderOutputRef sets the "provider_output_ref" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateProviderOutputRef() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProviderOutputRef()
+ })
+}
+
+// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
+func (u *BatchImageJobUpsertOne) ClearProviderOutputRef() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearProviderOutputRef()
+ })
+}
+
+// SetGcsInputURI sets the "gcs_input_uri" field.
+func (u *BatchImageJobUpsertOne) SetGcsInputURI(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetGcsInputURI(v)
+ })
+}
+
+// UpdateGcsInputURI sets the "gcs_input_uri" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateGcsInputURI() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateGcsInputURI()
+ })
+}
+
+// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
+func (u *BatchImageJobUpsertOne) ClearGcsInputURI() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearGcsInputURI()
+ })
+}
+
+// SetGcsOutputURI sets the "gcs_output_uri" field.
+func (u *BatchImageJobUpsertOne) SetGcsOutputURI(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetGcsOutputURI(v)
+ })
+}
+
+// UpdateGcsOutputURI sets the "gcs_output_uri" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateGcsOutputURI() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateGcsOutputURI()
+ })
+}
+
+// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
+func (u *BatchImageJobUpsertOne) ClearGcsOutputURI() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearGcsOutputURI()
+ })
+}
+
+// SetItemCount sets the "item_count" field.
+func (u *BatchImageJobUpsertOne) SetItemCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetItemCount(v)
+ })
+}
+
+// AddItemCount adds v to the "item_count" field.
+func (u *BatchImageJobUpsertOne) AddItemCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddItemCount(v)
+ })
+}
+
+// UpdateItemCount sets the "item_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateItemCount() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateItemCount()
+ })
+}
+
+// SetSuccessCount sets the "success_count" field.
+func (u *BatchImageJobUpsertOne) SetSuccessCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetSuccessCount(v)
+ })
+}
+
+// AddSuccessCount adds v to the "success_count" field.
+func (u *BatchImageJobUpsertOne) AddSuccessCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddSuccessCount(v)
+ })
+}
+
+// UpdateSuccessCount sets the "success_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateSuccessCount() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateSuccessCount()
+ })
+}
+
+// SetFailCount sets the "fail_count" field.
+func (u *BatchImageJobUpsertOne) SetFailCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetFailCount(v)
+ })
+}
+
+// AddFailCount adds v to the "fail_count" field.
+func (u *BatchImageJobUpsertOne) AddFailCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddFailCount(v)
+ })
+}
+
+// UpdateFailCount sets the "fail_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateFailCount() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateFailCount()
+ })
+}
+
+// SetCancelledCount sets the "cancelled_count" field.
+func (u *BatchImageJobUpsertOne) SetCancelledCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetCancelledCount(v)
+ })
+}
+
+// AddCancelledCount adds v to the "cancelled_count" field.
+func (u *BatchImageJobUpsertOne) AddCancelledCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddCancelledCount(v)
+ })
+}
+
+// UpdateCancelledCount sets the "cancelled_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateCancelledCount() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateCancelledCount()
+ })
+}
+
+// SetEstimatedCost sets the "estimated_cost" field.
+func (u *BatchImageJobUpsertOne) SetEstimatedCost(v float64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetEstimatedCost(v)
+ })
+}
+
+// AddEstimatedCost adds v to the "estimated_cost" field.
+func (u *BatchImageJobUpsertOne) AddEstimatedCost(v float64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddEstimatedCost(v)
+ })
+}
+
+// UpdateEstimatedCost sets the "estimated_cost" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateEstimatedCost() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateEstimatedCost()
+ })
+}
+
+// SetHoldAmount sets the "hold_amount" field.
+func (u *BatchImageJobUpsertOne) SetHoldAmount(v float64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetHoldAmount(v)
+ })
+}
+
+// AddHoldAmount adds v to the "hold_amount" field.
+func (u *BatchImageJobUpsertOne) AddHoldAmount(v float64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddHoldAmount(v)
+ })
+}
+
+// UpdateHoldAmount sets the "hold_amount" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateHoldAmount() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateHoldAmount()
+ })
+}
+
+// ClearHoldAmount clears the value of the "hold_amount" field.
+func (u *BatchImageJobUpsertOne) ClearHoldAmount() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearHoldAmount()
+ })
+}
+
+// SetActualCost sets the "actual_cost" field.
+func (u *BatchImageJobUpsertOne) SetActualCost(v float64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetActualCost(v)
+ })
+}
+
+// AddActualCost adds v to the "actual_cost" field.
+func (u *BatchImageJobUpsertOne) AddActualCost(v float64) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddActualCost(v)
+ })
+}
+
+// UpdateActualCost sets the "actual_cost" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateActualCost() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateActualCost()
+ })
+}
+
+// ClearActualCost clears the value of the "actual_cost" field.
+func (u *BatchImageJobUpsertOne) ClearActualCost() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearActualCost()
+ })
+}
+
+// SetCurrency sets the "currency" field.
+func (u *BatchImageJobUpsertOne) SetCurrency(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetCurrency(v)
+ })
+}
+
+// UpdateCurrency sets the "currency" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateCurrency() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateCurrency()
+ })
+}
+
+// SetHoldID sets the "hold_id" field.
+func (u *BatchImageJobUpsertOne) SetHoldID(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetHoldID(v)
+ })
+}
+
+// UpdateHoldID sets the "hold_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateHoldID() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateHoldID()
+ })
+}
+
+// ClearHoldID clears the value of the "hold_id" field.
+func (u *BatchImageJobUpsertOne) ClearHoldID() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearHoldID()
+ })
+}
+
+// SetIdempotencyKey sets the "idempotency_key" field.
+func (u *BatchImageJobUpsertOne) SetIdempotencyKey(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetIdempotencyKey(v)
+ })
+}
+
+// UpdateIdempotencyKey sets the "idempotency_key" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateIdempotencyKey() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateIdempotencyKey()
+ })
+}
+
+// ClearIdempotencyKey clears the value of the "idempotency_key" field.
+func (u *BatchImageJobUpsertOne) ClearIdempotencyKey() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearIdempotencyKey()
+ })
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (u *BatchImageJobUpsertOne) SetRequestHash(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetRequestHash(v)
+ })
+}
+
+// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateRequestHash() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateRequestHash()
+ })
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (u *BatchImageJobUpsertOne) ClearRequestHash() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearRequestHash()
+ })
+}
+
+// SetManifestHash sets the "manifest_hash" field.
+func (u *BatchImageJobUpsertOne) SetManifestHash(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetManifestHash(v)
+ })
+}
+
+// UpdateManifestHash sets the "manifest_hash" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateManifestHash() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateManifestHash()
+ })
+}
+
+// ClearManifestHash clears the value of the "manifest_hash" field.
+func (u *BatchImageJobUpsertOne) ClearManifestHash() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearManifestHash()
+ })
+}
+
+// SetRetryCount sets the "retry_count" field.
+func (u *BatchImageJobUpsertOne) SetRetryCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetRetryCount(v)
+ })
+}
+
+// AddRetryCount adds v to the "retry_count" field.
+func (u *BatchImageJobUpsertOne) AddRetryCount(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddRetryCount(v)
+ })
+}
+
+// UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateRetryCount() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateRetryCount()
+ })
+}
+
+// SetVersion sets the "version" field.
+func (u *BatchImageJobUpsertOne) SetVersion(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetVersion(v)
+ })
+}
+
+// AddVersion adds v to the "version" field.
+func (u *BatchImageJobUpsertOne) AddVersion(v int) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddVersion(v)
+ })
+}
+
+// UpdateVersion sets the "version" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateVersion() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateVersion()
+ })
+}
+
+// SetOutputExpiresAt sets the "output_expires_at" field.
+func (u *BatchImageJobUpsertOne) SetOutputExpiresAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetOutputExpiresAt(v)
+ })
+}
+
+// UpdateOutputExpiresAt sets the "output_expires_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateOutputExpiresAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateOutputExpiresAt()
+ })
+}
+
+// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
+func (u *BatchImageJobUpsertOne) ClearOutputExpiresAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearOutputExpiresAt()
+ })
+}
+
+// SetInputDeletedAt sets the "input_deleted_at" field.
+func (u *BatchImageJobUpsertOne) SetInputDeletedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetInputDeletedAt(v)
+ })
+}
+
+// UpdateInputDeletedAt sets the "input_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateInputDeletedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateInputDeletedAt()
+ })
+}
+
+// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
+func (u *BatchImageJobUpsertOne) ClearInputDeletedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearInputDeletedAt()
+ })
+}
+
+// SetOutputDeletedAt sets the "output_deleted_at" field.
+func (u *BatchImageJobUpsertOne) SetOutputDeletedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetOutputDeletedAt(v)
+ })
+}
+
+// UpdateOutputDeletedAt sets the "output_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateOutputDeletedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateOutputDeletedAt()
+ })
+}
+
+// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
+func (u *BatchImageJobUpsertOne) ClearOutputDeletedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearOutputDeletedAt()
+ })
+}
+
+// SetDownloadedAt sets the "downloaded_at" field.
+func (u *BatchImageJobUpsertOne) SetDownloadedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetDownloadedAt(v)
+ })
+}
+
+// UpdateDownloadedAt sets the "downloaded_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateDownloadedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateDownloadedAt()
+ })
+}
+
+// ClearDownloadedAt clears the value of the "downloaded_at" field.
+func (u *BatchImageJobUpsertOne) ClearDownloadedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearDownloadedAt()
+ })
+}
+
+// SetUserDeletedAt sets the "user_deleted_at" field.
+func (u *BatchImageJobUpsertOne) SetUserDeletedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetUserDeletedAt(v)
+ })
+}
+
+// UpdateUserDeletedAt sets the "user_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateUserDeletedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateUserDeletedAt()
+ })
+}
+
+// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
+func (u *BatchImageJobUpsertOne) ClearUserDeletedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearUserDeletedAt()
+ })
+}
+
+// SetLastErrorCode sets the "last_error_code" field.
+func (u *BatchImageJobUpsertOne) SetLastErrorCode(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetLastErrorCode(v)
+ })
+}
+
+// UpdateLastErrorCode sets the "last_error_code" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateLastErrorCode() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateLastErrorCode()
+ })
+}
+
+// ClearLastErrorCode clears the value of the "last_error_code" field.
+func (u *BatchImageJobUpsertOne) ClearLastErrorCode() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearLastErrorCode()
+ })
+}
+
+// SetLastErrorMessage sets the "last_error_message" field.
+func (u *BatchImageJobUpsertOne) SetLastErrorMessage(v string) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetLastErrorMessage(v)
+ })
+}
+
+// UpdateLastErrorMessage sets the "last_error_message" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateLastErrorMessage() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateLastErrorMessage()
+ })
+}
+
+// ClearLastErrorMessage clears the value of the "last_error_message" field.
+func (u *BatchImageJobUpsertOne) ClearLastErrorMessage() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearLastErrorMessage()
+ })
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *BatchImageJobUpsertOne) SetUpdatedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetUpdatedAt(v)
+ })
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateUpdatedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateUpdatedAt()
+ })
+}
+
+// SetSubmittedAt sets the "submitted_at" field.
+func (u *BatchImageJobUpsertOne) SetSubmittedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetSubmittedAt(v)
+ })
+}
+
+// UpdateSubmittedAt sets the "submitted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateSubmittedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateSubmittedAt()
+ })
+}
+
+// ClearSubmittedAt clears the value of the "submitted_at" field.
+func (u *BatchImageJobUpsertOne) ClearSubmittedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearSubmittedAt()
+ })
+}
+
+// SetStartedAt sets the "started_at" field.
+func (u *BatchImageJobUpsertOne) SetStartedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetStartedAt(v)
+ })
+}
+
+// UpdateStartedAt sets the "started_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateStartedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateStartedAt()
+ })
+}
+
+// ClearStartedAt clears the value of the "started_at" field.
+func (u *BatchImageJobUpsertOne) ClearStartedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearStartedAt()
+ })
+}
+
+// SetFinishedAt sets the "finished_at" field.
+func (u *BatchImageJobUpsertOne) SetFinishedAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetFinishedAt(v)
+ })
+}
+
+// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateFinishedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateFinishedAt()
+ })
+}
+
+// ClearFinishedAt clears the value of the "finished_at" field.
+func (u *BatchImageJobUpsertOne) ClearFinishedAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearFinishedAt()
+ })
+}
+
+// SetSettledAt sets the "settled_at" field.
+func (u *BatchImageJobUpsertOne) SetSettledAt(v time.Time) *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetSettledAt(v)
+ })
+}
+
+// UpdateSettledAt sets the "settled_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertOne) UpdateSettledAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateSettledAt()
+ })
+}
+
+// ClearSettledAt clears the value of the "settled_at" field.
+func (u *BatchImageJobUpsertOne) ClearSettledAt() *BatchImageJobUpsertOne {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearSettledAt()
+ })
+}
+
+// Exec executes the query.
+func (u *BatchImageJobUpsertOne) Exec(ctx context.Context) error {
+ if len(u.create.conflict) == 0 {
+ return errors.New("ent: missing options for BatchImageJobCreate.OnConflict")
+ }
+ return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *BatchImageJobUpsertOne) ExecX(ctx context.Context) {
+ if err := u.create.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *BatchImageJobUpsertOne) ID(ctx context.Context) (id int64, err error) {
+ node, err := u.create.Save(ctx)
+ if err != nil {
+ return id, err
+ }
+ return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *BatchImageJobUpsertOne) IDX(ctx context.Context) int64 {
+ id, err := u.ID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// BatchImageJobCreateBulk is the builder for creating many BatchImageJob entities in bulk.
+type BatchImageJobCreateBulk struct {
+ config
+ err error
+ builders []*BatchImageJobCreate
+ conflict []sql.ConflictOption
+}
+
+// Save creates the BatchImageJob entities in the database.
+func (_c *BatchImageJobCreateBulk) Save(ctx context.Context) ([]*BatchImageJob, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*BatchImageJob, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
+ func(i int, root context.Context) {
+ builder := _c.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*BatchImageJobMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ spec.OnConflict = _c.conflict
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ if specs[i].ID.Value != nil {
+ id := specs[i].ID.Value.(int64)
+ nodes[i].ID = int64(id)
+ }
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_c *BatchImageJobCreateBulk) SaveX(ctx context.Context) []*BatchImageJob {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *BatchImageJobCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *BatchImageJobCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+// client.BatchImageJob.CreateBulk(builders...).
+// OnConflict(
+// // Update the row with the new values
+// // the was proposed for insertion.
+// sql.ResolveWithNewValues(),
+// ).
+// // Override some of the fields with custom
+// // update values.
+// Update(func(u *ent.BatchImageJobUpsert) {
+// SetBatchID(v+v).
+// }).
+// Exec(ctx)
+func (_c *BatchImageJobCreateBulk) OnConflict(opts ...sql.ConflictOption) *BatchImageJobUpsertBulk {
+ _c.conflict = opts
+ return &BatchImageJobUpsertBulk{
+ create: _c,
+ }
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+// client.BatchImageJob.Create().
+// OnConflict(sql.ConflictColumns(columns...)).
+// Exec(ctx)
+func (_c *BatchImageJobCreateBulk) OnConflictColumns(columns ...string) *BatchImageJobUpsertBulk {
+ _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
+ return &BatchImageJobUpsertBulk{
+ create: _c,
+ }
+}
+
+// BatchImageJobUpsertBulk is the builder for "upsert"-ing
+// a bulk of BatchImageJob nodes.
+type BatchImageJobUpsertBulk struct {
+ create *BatchImageJobCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+// client.BatchImageJob.Create().
+// OnConflict(
+// sql.ResolveWithNewValues(),
+// ).
+// Exec(ctx)
+func (u *BatchImageJobUpsertBulk) UpdateNewValues() *BatchImageJobUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+ for _, b := range u.create.builders {
+ if _, exists := b.mutation.BatchID(); exists {
+ s.SetIgnore(batchimagejob.FieldBatchID)
+ }
+ if _, exists := b.mutation.CreatedAt(); exists {
+ s.SetIgnore(batchimagejob.FieldCreatedAt)
+ }
+ }
+ }))
+ return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+// client.BatchImageJob.Create().
+// OnConflict(sql.ResolveWithIgnore()).
+// Exec(ctx)
+func (u *BatchImageJobUpsertBulk) Ignore() *BatchImageJobUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+ return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *BatchImageJobUpsertBulk) DoNothing() *BatchImageJobUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.DoNothing())
+ return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the BatchImageJobCreateBulk.OnConflict
+// documentation for more info.
+func (u *BatchImageJobUpsertBulk) Update(set func(*BatchImageJobUpsert)) *BatchImageJobUpsertBulk {
+ u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+ set(&BatchImageJobUpsert{UpdateSet: update})
+ }))
+ return u
+}
+
+// SetUserID sets the "user_id" field.
+func (u *BatchImageJobUpsertBulk) SetUserID(v int64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetUserID(v)
+ })
+}
+
+// AddUserID adds v to the "user_id" field.
+func (u *BatchImageJobUpsertBulk) AddUserID(v int64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddUserID(v)
+ })
+}
+
+// UpdateUserID sets the "user_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateUserID() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateUserID()
+ })
+}
+
+// SetAPIKeyID sets the "api_key_id" field.
+func (u *BatchImageJobUpsertBulk) SetAPIKeyID(v int64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetAPIKeyID(v)
+ })
+}
+
+// AddAPIKeyID adds v to the "api_key_id" field.
+func (u *BatchImageJobUpsertBulk) AddAPIKeyID(v int64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddAPIKeyID(v)
+ })
+}
+
+// UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateAPIKeyID() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateAPIKeyID()
+ })
+}
+
+// ClearAPIKeyID clears the value of the "api_key_id" field.
+func (u *BatchImageJobUpsertBulk) ClearAPIKeyID() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearAPIKeyID()
+ })
+}
+
+// SetAccountID sets the "account_id" field.
+func (u *BatchImageJobUpsertBulk) SetAccountID(v int64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetAccountID(v)
+ })
+}
+
+// AddAccountID adds v to the "account_id" field.
+func (u *BatchImageJobUpsertBulk) AddAccountID(v int64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddAccountID(v)
+ })
+}
+
+// UpdateAccountID sets the "account_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateAccountID() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateAccountID()
+ })
+}
+
+// ClearAccountID clears the value of the "account_id" field.
+func (u *BatchImageJobUpsertBulk) ClearAccountID() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearAccountID()
+ })
+}
+
+// SetProvider sets the "provider" field.
+func (u *BatchImageJobUpsertBulk) SetProvider(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProvider(v)
+ })
+}
+
+// UpdateProvider sets the "provider" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateProvider() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProvider()
+ })
+}
+
+// SetModel sets the "model" field.
+func (u *BatchImageJobUpsertBulk) SetModel(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetModel(v)
+ })
+}
+
+// UpdateModel sets the "model" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateModel() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateModel()
+ })
+}
+
+// SetTaskName sets the "task_name" field.
+func (u *BatchImageJobUpsertBulk) SetTaskName(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetTaskName(v)
+ })
+}
+
+// UpdateTaskName sets the "task_name" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateTaskName() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateTaskName()
+ })
+}
+
+// SetStatus sets the "status" field.
+func (u *BatchImageJobUpsertBulk) SetStatus(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetStatus(v)
+ })
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateStatus() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateStatus()
+ })
+}
+
+// SetProviderJobName sets the "provider_job_name" field.
+func (u *BatchImageJobUpsertBulk) SetProviderJobName(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProviderJobName(v)
+ })
+}
+
+// UpdateProviderJobName sets the "provider_job_name" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateProviderJobName() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProviderJobName()
+ })
+}
+
+// ClearProviderJobName clears the value of the "provider_job_name" field.
+func (u *BatchImageJobUpsertBulk) ClearProviderJobName() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearProviderJobName()
+ })
+}
+
+// SetProviderInputRef sets the "provider_input_ref" field.
+func (u *BatchImageJobUpsertBulk) SetProviderInputRef(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProviderInputRef(v)
+ })
+}
+
+// UpdateProviderInputRef sets the "provider_input_ref" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateProviderInputRef() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProviderInputRef()
+ })
+}
+
+// ClearProviderInputRef clears the value of the "provider_input_ref" field.
+func (u *BatchImageJobUpsertBulk) ClearProviderInputRef() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearProviderInputRef()
+ })
+}
+
+// SetProviderOutputRef sets the "provider_output_ref" field.
+func (u *BatchImageJobUpsertBulk) SetProviderOutputRef(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetProviderOutputRef(v)
+ })
+}
+
+// UpdateProviderOutputRef sets the "provider_output_ref" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateProviderOutputRef() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateProviderOutputRef()
+ })
+}
+
+// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
+func (u *BatchImageJobUpsertBulk) ClearProviderOutputRef() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearProviderOutputRef()
+ })
+}
+
+// SetGcsInputURI sets the "gcs_input_uri" field.
+func (u *BatchImageJobUpsertBulk) SetGcsInputURI(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetGcsInputURI(v)
+ })
+}
+
+// UpdateGcsInputURI sets the "gcs_input_uri" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateGcsInputURI() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateGcsInputURI()
+ })
+}
+
+// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
+func (u *BatchImageJobUpsertBulk) ClearGcsInputURI() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearGcsInputURI()
+ })
+}
+
+// SetGcsOutputURI sets the "gcs_output_uri" field.
+func (u *BatchImageJobUpsertBulk) SetGcsOutputURI(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetGcsOutputURI(v)
+ })
+}
+
+// UpdateGcsOutputURI sets the "gcs_output_uri" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateGcsOutputURI() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateGcsOutputURI()
+ })
+}
+
+// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
+func (u *BatchImageJobUpsertBulk) ClearGcsOutputURI() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearGcsOutputURI()
+ })
+}
+
+// SetItemCount sets the "item_count" field.
+func (u *BatchImageJobUpsertBulk) SetItemCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetItemCount(v)
+ })
+}
+
+// AddItemCount adds v to the "item_count" field.
+func (u *BatchImageJobUpsertBulk) AddItemCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddItemCount(v)
+ })
+}
+
+// UpdateItemCount sets the "item_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateItemCount() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateItemCount()
+ })
+}
+
+// SetSuccessCount sets the "success_count" field.
+func (u *BatchImageJobUpsertBulk) SetSuccessCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetSuccessCount(v)
+ })
+}
+
+// AddSuccessCount adds v to the "success_count" field.
+func (u *BatchImageJobUpsertBulk) AddSuccessCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddSuccessCount(v)
+ })
+}
+
+// UpdateSuccessCount sets the "success_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateSuccessCount() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateSuccessCount()
+ })
+}
+
+// SetFailCount sets the "fail_count" field.
+func (u *BatchImageJobUpsertBulk) SetFailCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetFailCount(v)
+ })
+}
+
+// AddFailCount adds v to the "fail_count" field.
+func (u *BatchImageJobUpsertBulk) AddFailCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddFailCount(v)
+ })
+}
+
+// UpdateFailCount sets the "fail_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateFailCount() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateFailCount()
+ })
+}
+
+// SetCancelledCount sets the "cancelled_count" field.
+func (u *BatchImageJobUpsertBulk) SetCancelledCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetCancelledCount(v)
+ })
+}
+
+// AddCancelledCount adds v to the "cancelled_count" field.
+func (u *BatchImageJobUpsertBulk) AddCancelledCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddCancelledCount(v)
+ })
+}
+
+// UpdateCancelledCount sets the "cancelled_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateCancelledCount() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateCancelledCount()
+ })
+}
+
+// SetEstimatedCost sets the "estimated_cost" field.
+func (u *BatchImageJobUpsertBulk) SetEstimatedCost(v float64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetEstimatedCost(v)
+ })
+}
+
+// AddEstimatedCost adds v to the "estimated_cost" field.
+func (u *BatchImageJobUpsertBulk) AddEstimatedCost(v float64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddEstimatedCost(v)
+ })
+}
+
+// UpdateEstimatedCost sets the "estimated_cost" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateEstimatedCost() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateEstimatedCost()
+ })
+}
+
+// SetHoldAmount sets the "hold_amount" field.
+func (u *BatchImageJobUpsertBulk) SetHoldAmount(v float64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetHoldAmount(v)
+ })
+}
+
+// AddHoldAmount adds v to the "hold_amount" field.
+func (u *BatchImageJobUpsertBulk) AddHoldAmount(v float64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddHoldAmount(v)
+ })
+}
+
+// UpdateHoldAmount sets the "hold_amount" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateHoldAmount() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateHoldAmount()
+ })
+}
+
+// ClearHoldAmount clears the value of the "hold_amount" field.
+func (u *BatchImageJobUpsertBulk) ClearHoldAmount() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearHoldAmount()
+ })
+}
+
+// SetActualCost sets the "actual_cost" field.
+func (u *BatchImageJobUpsertBulk) SetActualCost(v float64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetActualCost(v)
+ })
+}
+
+// AddActualCost adds v to the "actual_cost" field.
+func (u *BatchImageJobUpsertBulk) AddActualCost(v float64) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddActualCost(v)
+ })
+}
+
+// UpdateActualCost sets the "actual_cost" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateActualCost() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateActualCost()
+ })
+}
+
+// ClearActualCost clears the value of the "actual_cost" field.
+func (u *BatchImageJobUpsertBulk) ClearActualCost() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearActualCost()
+ })
+}
+
+// SetCurrency sets the "currency" field.
+func (u *BatchImageJobUpsertBulk) SetCurrency(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetCurrency(v)
+ })
+}
+
+// UpdateCurrency sets the "currency" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateCurrency() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateCurrency()
+ })
+}
+
+// SetHoldID sets the "hold_id" field.
+func (u *BatchImageJobUpsertBulk) SetHoldID(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetHoldID(v)
+ })
+}
+
+// UpdateHoldID sets the "hold_id" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateHoldID() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateHoldID()
+ })
+}
+
+// ClearHoldID clears the value of the "hold_id" field.
+func (u *BatchImageJobUpsertBulk) ClearHoldID() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearHoldID()
+ })
+}
+
+// SetIdempotencyKey sets the "idempotency_key" field.
+func (u *BatchImageJobUpsertBulk) SetIdempotencyKey(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetIdempotencyKey(v)
+ })
+}
+
+// UpdateIdempotencyKey sets the "idempotency_key" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateIdempotencyKey() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateIdempotencyKey()
+ })
+}
+
+// ClearIdempotencyKey clears the value of the "idempotency_key" field.
+func (u *BatchImageJobUpsertBulk) ClearIdempotencyKey() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearIdempotencyKey()
+ })
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (u *BatchImageJobUpsertBulk) SetRequestHash(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetRequestHash(v)
+ })
+}
+
+// UpdateRequestHash sets the "request_hash" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateRequestHash() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateRequestHash()
+ })
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (u *BatchImageJobUpsertBulk) ClearRequestHash() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearRequestHash()
+ })
+}
+
+// SetManifestHash sets the "manifest_hash" field.
+func (u *BatchImageJobUpsertBulk) SetManifestHash(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetManifestHash(v)
+ })
+}
+
+// UpdateManifestHash sets the "manifest_hash" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateManifestHash() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateManifestHash()
+ })
+}
+
+// ClearManifestHash clears the value of the "manifest_hash" field.
+func (u *BatchImageJobUpsertBulk) ClearManifestHash() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearManifestHash()
+ })
+}
+
+// SetRetryCount sets the "retry_count" field.
+func (u *BatchImageJobUpsertBulk) SetRetryCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetRetryCount(v)
+ })
+}
+
+// AddRetryCount adds v to the "retry_count" field.
+func (u *BatchImageJobUpsertBulk) AddRetryCount(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddRetryCount(v)
+ })
+}
+
+// UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateRetryCount() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateRetryCount()
+ })
+}
+
+// SetVersion sets the "version" field.
+func (u *BatchImageJobUpsertBulk) SetVersion(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetVersion(v)
+ })
+}
+
+// AddVersion adds v to the "version" field.
+func (u *BatchImageJobUpsertBulk) AddVersion(v int) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.AddVersion(v)
+ })
+}
+
+// UpdateVersion sets the "version" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateVersion() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateVersion()
+ })
+}
+
+// SetOutputExpiresAt sets the "output_expires_at" field.
+func (u *BatchImageJobUpsertBulk) SetOutputExpiresAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetOutputExpiresAt(v)
+ })
+}
+
+// UpdateOutputExpiresAt sets the "output_expires_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateOutputExpiresAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateOutputExpiresAt()
+ })
+}
+
+// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
+func (u *BatchImageJobUpsertBulk) ClearOutputExpiresAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearOutputExpiresAt()
+ })
+}
+
+// SetInputDeletedAt sets the "input_deleted_at" field.
+func (u *BatchImageJobUpsertBulk) SetInputDeletedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetInputDeletedAt(v)
+ })
+}
+
+// UpdateInputDeletedAt sets the "input_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateInputDeletedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateInputDeletedAt()
+ })
+}
+
+// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
+func (u *BatchImageJobUpsertBulk) ClearInputDeletedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearInputDeletedAt()
+ })
+}
+
+// SetOutputDeletedAt sets the "output_deleted_at" field.
+func (u *BatchImageJobUpsertBulk) SetOutputDeletedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetOutputDeletedAt(v)
+ })
+}
+
+// UpdateOutputDeletedAt sets the "output_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateOutputDeletedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateOutputDeletedAt()
+ })
+}
+
+// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
+func (u *BatchImageJobUpsertBulk) ClearOutputDeletedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearOutputDeletedAt()
+ })
+}
+
+// SetDownloadedAt sets the "downloaded_at" field.
+func (u *BatchImageJobUpsertBulk) SetDownloadedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetDownloadedAt(v)
+ })
+}
+
+// UpdateDownloadedAt sets the "downloaded_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateDownloadedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateDownloadedAt()
+ })
+}
+
+// ClearDownloadedAt clears the value of the "downloaded_at" field.
+func (u *BatchImageJobUpsertBulk) ClearDownloadedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearDownloadedAt()
+ })
+}
+
+// SetUserDeletedAt sets the "user_deleted_at" field.
+func (u *BatchImageJobUpsertBulk) SetUserDeletedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetUserDeletedAt(v)
+ })
+}
+
+// UpdateUserDeletedAt sets the "user_deleted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateUserDeletedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateUserDeletedAt()
+ })
+}
+
+// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
+func (u *BatchImageJobUpsertBulk) ClearUserDeletedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearUserDeletedAt()
+ })
+}
+
+// SetLastErrorCode sets the "last_error_code" field.
+func (u *BatchImageJobUpsertBulk) SetLastErrorCode(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetLastErrorCode(v)
+ })
+}
+
+// UpdateLastErrorCode sets the "last_error_code" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateLastErrorCode() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateLastErrorCode()
+ })
+}
+
+// ClearLastErrorCode clears the value of the "last_error_code" field.
+func (u *BatchImageJobUpsertBulk) ClearLastErrorCode() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearLastErrorCode()
+ })
+}
+
+// SetLastErrorMessage sets the "last_error_message" field.
+func (u *BatchImageJobUpsertBulk) SetLastErrorMessage(v string) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetLastErrorMessage(v)
+ })
+}
+
+// UpdateLastErrorMessage sets the "last_error_message" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateLastErrorMessage() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateLastErrorMessage()
+ })
+}
+
+// ClearLastErrorMessage clears the value of the "last_error_message" field.
+func (u *BatchImageJobUpsertBulk) ClearLastErrorMessage() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearLastErrorMessage()
+ })
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *BatchImageJobUpsertBulk) SetUpdatedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetUpdatedAt(v)
+ })
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateUpdatedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateUpdatedAt()
+ })
+}
+
+// SetSubmittedAt sets the "submitted_at" field.
+func (u *BatchImageJobUpsertBulk) SetSubmittedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetSubmittedAt(v)
+ })
+}
+
+// UpdateSubmittedAt sets the "submitted_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateSubmittedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateSubmittedAt()
+ })
+}
+
+// ClearSubmittedAt clears the value of the "submitted_at" field.
+func (u *BatchImageJobUpsertBulk) ClearSubmittedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearSubmittedAt()
+ })
+}
+
+// SetStartedAt sets the "started_at" field.
+func (u *BatchImageJobUpsertBulk) SetStartedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetStartedAt(v)
+ })
+}
+
+// UpdateStartedAt sets the "started_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateStartedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateStartedAt()
+ })
+}
+
+// ClearStartedAt clears the value of the "started_at" field.
+func (u *BatchImageJobUpsertBulk) ClearStartedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearStartedAt()
+ })
+}
+
+// SetFinishedAt sets the "finished_at" field.
+func (u *BatchImageJobUpsertBulk) SetFinishedAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetFinishedAt(v)
+ })
+}
+
+// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateFinishedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateFinishedAt()
+ })
+}
+
+// ClearFinishedAt clears the value of the "finished_at" field.
+func (u *BatchImageJobUpsertBulk) ClearFinishedAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearFinishedAt()
+ })
+}
+
+// SetSettledAt sets the "settled_at" field.
+func (u *BatchImageJobUpsertBulk) SetSettledAt(v time.Time) *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.SetSettledAt(v)
+ })
+}
+
+// UpdateSettledAt sets the "settled_at" field to the value that was provided on create.
+func (u *BatchImageJobUpsertBulk) UpdateSettledAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.UpdateSettledAt()
+ })
+}
+
+// ClearSettledAt clears the value of the "settled_at" field.
+func (u *BatchImageJobUpsertBulk) ClearSettledAt() *BatchImageJobUpsertBulk {
+ return u.Update(func(s *BatchImageJobUpsert) {
+ s.ClearSettledAt()
+ })
+}
+
+// Exec executes the query.
+func (u *BatchImageJobUpsertBulk) Exec(ctx context.Context) error {
+ if u.create.err != nil {
+ return u.create.err
+ }
+ for i, b := range u.create.builders {
+ if len(b.conflict) != 0 {
+ return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the BatchImageJobCreateBulk instead", i)
+ }
+ }
+ if len(u.create.conflict) == 0 {
+ return errors.New("ent: missing options for BatchImageJobCreateBulk.OnConflict")
+ }
+ return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *BatchImageJobUpsertBulk) ExecX(ctx context.Context) {
+ if err := u.create.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/ent/batchimagejob_delete.go b/backend/ent/batchimagejob_delete.go
new file mode 100644
index 0000000000..da3dec2109
--- /dev/null
+++ b/backend/ent/batchimagejob_delete.go
@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageJobDelete is the builder for deleting a BatchImageJob entity.
+type BatchImageJobDelete struct {
+ config
+ hooks []Hook
+ mutation *BatchImageJobMutation
+}
+
+// Where appends a list predicates to the BatchImageJobDelete builder.
+func (_d *BatchImageJobDelete) Where(ps ...predicate.BatchImageJob) *BatchImageJobDelete {
+ _d.mutation.Where(ps...)
+ return _d
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (_d *BatchImageJobDelete) Exec(ctx context.Context) (int, error) {
+ return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_d *BatchImageJobDelete) ExecX(ctx context.Context) int {
+ n, err := _d.Exec(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return n
+}
+
+func (_d *BatchImageJobDelete) sqlExec(ctx context.Context) (int, error) {
+ _spec := sqlgraph.NewDeleteSpec(batchimagejob.Table, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
+ if ps := _d.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
+ if err != nil && sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ _d.mutation.done = true
+ return affected, err
+}
+
+// BatchImageJobDeleteOne is the builder for deleting a single BatchImageJob entity.
+type BatchImageJobDeleteOne struct {
+ _d *BatchImageJobDelete
+}
+
+// Where appends a list predicates to the BatchImageJobDelete builder.
+func (_d *BatchImageJobDeleteOne) Where(ps ...predicate.BatchImageJob) *BatchImageJobDeleteOne {
+ _d._d.mutation.Where(ps...)
+ return _d
+}
+
+// Exec executes the deletion query.
+func (_d *BatchImageJobDeleteOne) Exec(ctx context.Context) error {
+ n, err := _d._d.Exec(ctx)
+ switch {
+ case err != nil:
+ return err
+ case n == 0:
+ return &NotFoundError{batchimagejob.Label}
+ default:
+ return nil
+ }
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_d *BatchImageJobDeleteOne) ExecX(ctx context.Context) {
+ if err := _d.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/backend/ent/batchimagejob_query.go b/backend/ent/batchimagejob_query.go
new file mode 100644
index 0000000000..5ea4af42b2
--- /dev/null
+++ b/backend/ent/batchimagejob_query.go
@@ -0,0 +1,564 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "fmt"
+ "math"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageJobQuery is the builder for querying BatchImageJob entities.
+type BatchImageJobQuery struct {
+ config
+ ctx *QueryContext
+ order []batchimagejob.OrderOption
+ inters []Interceptor
+ predicates []predicate.BatchImageJob
+ modifiers []func(*sql.Selector)
+ // intermediate query (i.e. traversal path).
+ sql *sql.Selector
+ path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the BatchImageJobQuery builder.
+func (_q *BatchImageJobQuery) Where(ps ...predicate.BatchImageJob) *BatchImageJobQuery {
+ _q.predicates = append(_q.predicates, ps...)
+ return _q
+}
+
+// Limit the number of records to be returned by this query.
+func (_q *BatchImageJobQuery) Limit(limit int) *BatchImageJobQuery {
+ _q.ctx.Limit = &limit
+ return _q
+}
+
+// Offset to start from.
+func (_q *BatchImageJobQuery) Offset(offset int) *BatchImageJobQuery {
+ _q.ctx.Offset = &offset
+ return _q
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (_q *BatchImageJobQuery) Unique(unique bool) *BatchImageJobQuery {
+ _q.ctx.Unique = &unique
+ return _q
+}
+
+// Order specifies how the records should be ordered.
+func (_q *BatchImageJobQuery) Order(o ...batchimagejob.OrderOption) *BatchImageJobQuery {
+ _q.order = append(_q.order, o...)
+ return _q
+}
+
+// First returns the first BatchImageJob entity from the query.
+// Returns a *NotFoundError when no BatchImageJob was found.
+func (_q *BatchImageJobQuery) First(ctx context.Context) (*BatchImageJob, error) {
+ nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
+ if err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nil, &NotFoundError{batchimagejob.Label}
+ }
+ return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (_q *BatchImageJobQuery) FirstX(ctx context.Context) *BatchImageJob {
+ node, err := _q.First(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return node
+}
+
+// FirstID returns the first BatchImageJob ID from the query.
+// Returns a *NotFoundError when no BatchImageJob ID was found.
+func (_q *BatchImageJobQuery) FirstID(ctx context.Context) (id int64, err error) {
+ var ids []int64
+ if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
+ return
+ }
+ if len(ids) == 0 {
+ err = &NotFoundError{batchimagejob.Label}
+ return
+ }
+ return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (_q *BatchImageJobQuery) FirstIDX(ctx context.Context) int64 {
+ id, err := _q.FirstID(ctx)
+ if err != nil && !IsNotFound(err) {
+ panic(err)
+ }
+ return id
+}
+
+// Only returns a single BatchImageJob entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one BatchImageJob entity is found.
+// Returns a *NotFoundError when no BatchImageJob entities are found.
+func (_q *BatchImageJobQuery) Only(ctx context.Context) (*BatchImageJob, error) {
+ nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
+ if err != nil {
+ return nil, err
+ }
+ switch len(nodes) {
+ case 1:
+ return nodes[0], nil
+ case 0:
+ return nil, &NotFoundError{batchimagejob.Label}
+ default:
+ return nil, &NotSingularError{batchimagejob.Label}
+ }
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (_q *BatchImageJobQuery) OnlyX(ctx context.Context) *BatchImageJob {
+ node, err := _q.Only(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// OnlyID is like Only, but returns the only BatchImageJob ID in the query.
+// Returns a *NotSingularError when more than one BatchImageJob ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (_q *BatchImageJobQuery) OnlyID(ctx context.Context) (id int64, err error) {
+ var ids []int64
+ if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
+ return
+ }
+ switch len(ids) {
+ case 1:
+ id = ids[0]
+ case 0:
+ err = &NotFoundError{batchimagejob.Label}
+ default:
+ err = &NotSingularError{batchimagejob.Label}
+ }
+ return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (_q *BatchImageJobQuery) OnlyIDX(ctx context.Context) int64 {
+ id, err := _q.OnlyID(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return id
+}
+
+// All executes the query and returns a list of BatchImageJobs.
+func (_q *BatchImageJobQuery) All(ctx context.Context) ([]*BatchImageJob, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
+ if err := _q.prepareQuery(ctx); err != nil {
+ return nil, err
+ }
+ qr := querierAll[[]*BatchImageJob, *BatchImageJobQuery]()
+ return withInterceptors[[]*BatchImageJob](ctx, _q, qr, _q.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (_q *BatchImageJobQuery) AllX(ctx context.Context) []*BatchImageJob {
+ nodes, err := _q.All(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return nodes
+}
+
+// IDs executes the query and returns a list of BatchImageJob IDs.
+func (_q *BatchImageJobQuery) IDs(ctx context.Context) (ids []int64, err error) {
+ if _q.ctx.Unique == nil && _q.path != nil {
+ _q.Unique(true)
+ }
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
+ if err = _q.Select(batchimagejob.FieldID).Scan(ctx, &ids); err != nil {
+ return nil, err
+ }
+ return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (_q *BatchImageJobQuery) IDsX(ctx context.Context) []int64 {
+ ids, err := _q.IDs(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return ids
+}
+
+// Count returns the count of the given query.
+func (_q *BatchImageJobQuery) Count(ctx context.Context) (int, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
+ if err := _q.prepareQuery(ctx); err != nil {
+ return 0, err
+ }
+ return withInterceptors[int](ctx, _q, querierCount[*BatchImageJobQuery](), _q.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (_q *BatchImageJobQuery) CountX(ctx context.Context) int {
+ count, err := _q.Count(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (_q *BatchImageJobQuery) Exist(ctx context.Context) (bool, error) {
+ ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
+ switch _, err := _q.FirstID(ctx); {
+ case IsNotFound(err):
+ return false, nil
+ case err != nil:
+ return false, fmt.Errorf("ent: check existence: %w", err)
+ default:
+ return true, nil
+ }
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (_q *BatchImageJobQuery) ExistX(ctx context.Context) bool {
+ exist, err := _q.Exist(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return exist
+}
+
+// Clone returns a duplicate of the BatchImageJobQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (_q *BatchImageJobQuery) Clone() *BatchImageJobQuery {
+ if _q == nil {
+ return nil
+ }
+ return &BatchImageJobQuery{
+ config: _q.config,
+ ctx: _q.ctx.Clone(),
+ order: append([]batchimagejob.OrderOption{}, _q.order...),
+ inters: append([]Interceptor{}, _q.inters...),
+ predicates: append([]predicate.BatchImageJob{}, _q.predicates...),
+ // clone intermediate query.
+ sql: _q.sql.Clone(),
+ path: _q.path,
+ }
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+// var v []struct {
+// BatchID string `json:"batch_id,omitempty"`
+// Count int `json:"count,omitempty"`
+// }
+//
+// client.BatchImageJob.Query().
+// GroupBy(batchimagejob.FieldBatchID).
+// Aggregate(ent.Count()).
+// Scan(ctx, &v)
+func (_q *BatchImageJobQuery) GroupBy(field string, fields ...string) *BatchImageJobGroupBy {
+ _q.ctx.Fields = append([]string{field}, fields...)
+ grbuild := &BatchImageJobGroupBy{build: _q}
+ grbuild.flds = &_q.ctx.Fields
+ grbuild.label = batchimagejob.Label
+ grbuild.scan = grbuild.Scan
+ return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+// var v []struct {
+// BatchID string `json:"batch_id,omitempty"`
+// }
+//
+// client.BatchImageJob.Query().
+// Select(batchimagejob.FieldBatchID).
+// Scan(ctx, &v)
+func (_q *BatchImageJobQuery) Select(fields ...string) *BatchImageJobSelect {
+ _q.ctx.Fields = append(_q.ctx.Fields, fields...)
+ sbuild := &BatchImageJobSelect{BatchImageJobQuery: _q}
+ sbuild.label = batchimagejob.Label
+ sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
+ return sbuild
+}
+
+// Aggregate returns a BatchImageJobSelect configured with the given aggregations.
+func (_q *BatchImageJobQuery) Aggregate(fns ...AggregateFunc) *BatchImageJobSelect {
+ return _q.Select().Aggregate(fns...)
+}
+
+func (_q *BatchImageJobQuery) prepareQuery(ctx context.Context) error {
+ for _, inter := range _q.inters {
+ if inter == nil {
+ return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+ }
+ if trv, ok := inter.(Traverser); ok {
+ if err := trv.Traverse(ctx, _q); err != nil {
+ return err
+ }
+ }
+ }
+ for _, f := range _q.ctx.Fields {
+ if !batchimagejob.ValidColumn(f) {
+ return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ }
+ if _q.path != nil {
+ prev, err := _q.path(ctx)
+ if err != nil {
+ return err
+ }
+ _q.sql = prev
+ }
+ return nil
+}
+
+func (_q *BatchImageJobQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BatchImageJob, error) {
+ var (
+ nodes = []*BatchImageJob{}
+ _spec = _q.querySpec()
+ )
+ _spec.ScanValues = func(columns []string) ([]any, error) {
+ return (*BatchImageJob).scanValues(nil, columns)
+ }
+ _spec.Assign = func(columns []string, values []any) error {
+ node := &BatchImageJob{config: _q.config}
+ nodes = append(nodes, node)
+ return node.assignValues(columns, values)
+ }
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
+ for i := range hooks {
+ hooks[i](ctx, _spec)
+ }
+ if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
+ return nil, err
+ }
+ if len(nodes) == 0 {
+ return nodes, nil
+ }
+ return nodes, nil
+}
+
+func (_q *BatchImageJobQuery) sqlCount(ctx context.Context) (int, error) {
+ _spec := _q.querySpec()
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
+ _spec.Node.Columns = _q.ctx.Fields
+ if len(_q.ctx.Fields) > 0 {
+ _spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
+ }
+ return sqlgraph.CountNodes(ctx, _q.driver, _spec)
+}
+
+func (_q *BatchImageJobQuery) querySpec() *sqlgraph.QuerySpec {
+ _spec := sqlgraph.NewQuerySpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
+ _spec.From = _q.sql
+ if unique := _q.ctx.Unique; unique != nil {
+ _spec.Unique = *unique
+ } else if _q.path != nil {
+ _spec.Unique = true
+ }
+ if fields := _q.ctx.Fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, batchimagejob.FieldID)
+ for i := range fields {
+ if fields[i] != batchimagejob.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+ }
+ }
+ }
+ if ps := _q.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if limit := _q.ctx.Limit; limit != nil {
+ _spec.Limit = *limit
+ }
+ if offset := _q.ctx.Offset; offset != nil {
+ _spec.Offset = *offset
+ }
+ if ps := _q.order; len(ps) > 0 {
+ _spec.Order = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ return _spec
+}
+
+func (_q *BatchImageJobQuery) sqlQuery(ctx context.Context) *sql.Selector {
+ builder := sql.Dialect(_q.driver.Dialect())
+ t1 := builder.Table(batchimagejob.Table)
+ columns := _q.ctx.Fields
+ if len(columns) == 0 {
+ columns = batchimagejob.Columns
+ }
+ selector := builder.Select(t1.Columns(columns...)...).From(t1)
+ if _q.sql != nil {
+ selector = _q.sql
+ selector.Select(selector.Columns(columns...)...)
+ }
+ if _q.ctx.Unique != nil && *_q.ctx.Unique {
+ selector.Distinct()
+ }
+ for _, m := range _q.modifiers {
+ m(selector)
+ }
+ for _, p := range _q.predicates {
+ p(selector)
+ }
+ for _, p := range _q.order {
+ p(selector)
+ }
+ if offset := _q.ctx.Offset; offset != nil {
+ // limit is mandatory for offset clause. We start
+ // with default value, and override it below if needed.
+ selector.Offset(*offset).Limit(math.MaxInt32)
+ }
+ if limit := _q.ctx.Limit; limit != nil {
+ selector.Limit(*limit)
+ }
+ return selector
+}
+
+// ForUpdate locks the selected rows against concurrent updates, and prevent them from being
+// updated, deleted or "selected ... for update" by other sessions, until the transaction is
+// either committed or rolled-back.
+func (_q *BatchImageJobQuery) ForUpdate(opts ...sql.LockOption) *BatchImageJobQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForUpdate(opts...)
+ })
+ return _q
+}
+
+// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock
+// on any rows that are read. Other sessions can read the rows, but cannot modify them
+// until your transaction commits.
+func (_q *BatchImageJobQuery) ForShare(opts ...sql.LockOption) *BatchImageJobQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForShare(opts...)
+ })
+ return _q
+}
+
+// BatchImageJobGroupBy is the group-by builder for BatchImageJob entities.
+type BatchImageJobGroupBy struct {
+ selector
+ build *BatchImageJobQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (_g *BatchImageJobGroupBy) Aggregate(fns ...AggregateFunc) *BatchImageJobGroupBy {
+ _g.fns = append(_g.fns, fns...)
+ return _g
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (_g *BatchImageJobGroupBy) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
+ if err := _g.build.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BatchImageJobQuery, *BatchImageJobGroupBy](ctx, _g.build, _g, _g.build.inters, v)
+}
+
+func (_g *BatchImageJobGroupBy) sqlScan(ctx context.Context, root *BatchImageJobQuery, v any) error {
+ selector := root.sqlQuery(ctx).Select()
+ aggregation := make([]string, 0, len(_g.fns))
+ for _, fn := range _g.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ if len(selector.SelectedColumns()) == 0 {
+ columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
+ for _, f := range *_g.flds {
+ columns = append(columns, selector.C(f))
+ }
+ columns = append(columns, aggregation...)
+ selector.Select(columns...)
+ }
+ selector.GroupBy(selector.Columns(*_g.flds...)...)
+ if err := selector.Err(); err != nil {
+ return err
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
+
+// BatchImageJobSelect is the builder for selecting fields of BatchImageJob entities.
+type BatchImageJobSelect struct {
+ *BatchImageJobQuery
+ selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (_s *BatchImageJobSelect) Aggregate(fns ...AggregateFunc) *BatchImageJobSelect {
+ _s.fns = append(_s.fns, fns...)
+ return _s
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (_s *BatchImageJobSelect) Scan(ctx context.Context, v any) error {
+ ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
+ if err := _s.prepareQuery(ctx); err != nil {
+ return err
+ }
+ return scanWithInterceptors[*BatchImageJobQuery, *BatchImageJobSelect](ctx, _s.BatchImageJobQuery, _s, _s.inters, v)
+}
+
+func (_s *BatchImageJobSelect) sqlScan(ctx context.Context, root *BatchImageJobQuery, v any) error {
+ selector := root.sqlQuery(ctx)
+ aggregation := make([]string, 0, len(_s.fns))
+ for _, fn := range _s.fns {
+ aggregation = append(aggregation, fn(selector))
+ }
+ switch n := len(*_s.selector.flds); {
+ case n == 0 && len(aggregation) > 0:
+ selector.Select(aggregation...)
+ case n != 0 && len(aggregation) > 0:
+ selector.AppendSelect(aggregation...)
+ }
+ rows := &sql.Rows{}
+ query, args := selector.Query()
+ if err := _s.driver.Query(ctx, query, args, rows); err != nil {
+ return err
+ }
+ defer rows.Close()
+ return sql.ScanSlice(rows, v)
+}
diff --git a/backend/ent/batchimagejob_update.go b/backend/ent/batchimagejob_update.go
new file mode 100644
index 0000000000..8df7302500
--- /dev/null
+++ b/backend/ent/batchimagejob_update.go
@@ -0,0 +1,2308 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql"
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
+ "github.com/Wei-Shaw/sub2api/ent/predicate"
+)
+
+// BatchImageJobUpdate is the builder for updating BatchImageJob entities.
+type BatchImageJobUpdate struct {
+ config
+ hooks []Hook
+ mutation *BatchImageJobMutation
+}
+
+// Where appends a list predicates to the BatchImageJobUpdate builder.
+func (_u *BatchImageJobUpdate) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdate {
+ _u.mutation.Where(ps...)
+ return _u
+}
+
+// SetUserID sets the "user_id" field.
+func (_u *BatchImageJobUpdate) SetUserID(v int64) *BatchImageJobUpdate {
+ _u.mutation.ResetUserID()
+ _u.mutation.SetUserID(v)
+ return _u
+}
+
+// SetNillableUserID sets the "user_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableUserID(v *int64) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetUserID(*v)
+ }
+ return _u
+}
+
+// AddUserID adds value to the "user_id" field.
+func (_u *BatchImageJobUpdate) AddUserID(v int64) *BatchImageJobUpdate {
+ _u.mutation.AddUserID(v)
+ return _u
+}
+
+// SetAPIKeyID sets the "api_key_id" field.
+func (_u *BatchImageJobUpdate) SetAPIKeyID(v int64) *BatchImageJobUpdate {
+ _u.mutation.ResetAPIKeyID()
+ _u.mutation.SetAPIKeyID(v)
+ return _u
+}
+
+// SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetAPIKeyID(*v)
+ }
+ return _u
+}
+
+// AddAPIKeyID adds value to the "api_key_id" field.
+func (_u *BatchImageJobUpdate) AddAPIKeyID(v int64) *BatchImageJobUpdate {
+ _u.mutation.AddAPIKeyID(v)
+ return _u
+}
+
+// ClearAPIKeyID clears the value of the "api_key_id" field.
+func (_u *BatchImageJobUpdate) ClearAPIKeyID() *BatchImageJobUpdate {
+ _u.mutation.ClearAPIKeyID()
+ return _u
+}
+
+// SetAccountID sets the "account_id" field.
+func (_u *BatchImageJobUpdate) SetAccountID(v int64) *BatchImageJobUpdate {
+ _u.mutation.ResetAccountID()
+ _u.mutation.SetAccountID(v)
+ return _u
+}
+
+// SetNillableAccountID sets the "account_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableAccountID(v *int64) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetAccountID(*v)
+ }
+ return _u
+}
+
+// AddAccountID adds value to the "account_id" field.
+func (_u *BatchImageJobUpdate) AddAccountID(v int64) *BatchImageJobUpdate {
+ _u.mutation.AddAccountID(v)
+ return _u
+}
+
+// ClearAccountID clears the value of the "account_id" field.
+func (_u *BatchImageJobUpdate) ClearAccountID() *BatchImageJobUpdate {
+ _u.mutation.ClearAccountID()
+ return _u
+}
+
+// SetProvider sets the "provider" field.
+func (_u *BatchImageJobUpdate) SetProvider(v string) *BatchImageJobUpdate {
+ _u.mutation.SetProvider(v)
+ return _u
+}
+
+// SetNillableProvider sets the "provider" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableProvider(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetProvider(*v)
+ }
+ return _u
+}
+
+// SetModel sets the "model" field.
+func (_u *BatchImageJobUpdate) SetModel(v string) *BatchImageJobUpdate {
+ _u.mutation.SetModel(v)
+ return _u
+}
+
+// SetNillableModel sets the "model" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableModel(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetModel(*v)
+ }
+ return _u
+}
+
+// SetTaskName sets the "task_name" field.
+func (_u *BatchImageJobUpdate) SetTaskName(v string) *BatchImageJobUpdate {
+ _u.mutation.SetTaskName(v)
+ return _u
+}
+
+// SetNillableTaskName sets the "task_name" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableTaskName(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetTaskName(*v)
+ }
+ return _u
+}
+
+// SetStatus sets the "status" field.
+func (_u *BatchImageJobUpdate) SetStatus(v string) *BatchImageJobUpdate {
+ _u.mutation.SetStatus(v)
+ return _u
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableStatus(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetStatus(*v)
+ }
+ return _u
+}
+
+// SetProviderJobName sets the "provider_job_name" field.
+func (_u *BatchImageJobUpdate) SetProviderJobName(v string) *BatchImageJobUpdate {
+ _u.mutation.SetProviderJobName(v)
+ return _u
+}
+
+// SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableProviderJobName(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetProviderJobName(*v)
+ }
+ return _u
+}
+
+// ClearProviderJobName clears the value of the "provider_job_name" field.
+func (_u *BatchImageJobUpdate) ClearProviderJobName() *BatchImageJobUpdate {
+ _u.mutation.ClearProviderJobName()
+ return _u
+}
+
+// SetProviderInputRef sets the "provider_input_ref" field.
+func (_u *BatchImageJobUpdate) SetProviderInputRef(v string) *BatchImageJobUpdate {
+ _u.mutation.SetProviderInputRef(v)
+ return _u
+}
+
+// SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableProviderInputRef(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetProviderInputRef(*v)
+ }
+ return _u
+}
+
+// ClearProviderInputRef clears the value of the "provider_input_ref" field.
+func (_u *BatchImageJobUpdate) ClearProviderInputRef() *BatchImageJobUpdate {
+ _u.mutation.ClearProviderInputRef()
+ return _u
+}
+
+// SetProviderOutputRef sets the "provider_output_ref" field.
+func (_u *BatchImageJobUpdate) SetProviderOutputRef(v string) *BatchImageJobUpdate {
+ _u.mutation.SetProviderOutputRef(v)
+ return _u
+}
+
+// SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetProviderOutputRef(*v)
+ }
+ return _u
+}
+
+// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
+func (_u *BatchImageJobUpdate) ClearProviderOutputRef() *BatchImageJobUpdate {
+ _u.mutation.ClearProviderOutputRef()
+ return _u
+}
+
+// SetGcsInputURI sets the "gcs_input_uri" field.
+func (_u *BatchImageJobUpdate) SetGcsInputURI(v string) *BatchImageJobUpdate {
+ _u.mutation.SetGcsInputURI(v)
+ return _u
+}
+
+// SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableGcsInputURI(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetGcsInputURI(*v)
+ }
+ return _u
+}
+
+// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
+func (_u *BatchImageJobUpdate) ClearGcsInputURI() *BatchImageJobUpdate {
+ _u.mutation.ClearGcsInputURI()
+ return _u
+}
+
+// SetGcsOutputURI sets the "gcs_output_uri" field.
+func (_u *BatchImageJobUpdate) SetGcsOutputURI(v string) *BatchImageJobUpdate {
+ _u.mutation.SetGcsOutputURI(v)
+ return _u
+}
+
+// SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetGcsOutputURI(*v)
+ }
+ return _u
+}
+
+// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
+func (_u *BatchImageJobUpdate) ClearGcsOutputURI() *BatchImageJobUpdate {
+ _u.mutation.ClearGcsOutputURI()
+ return _u
+}
+
+// SetItemCount sets the "item_count" field.
+func (_u *BatchImageJobUpdate) SetItemCount(v int) *BatchImageJobUpdate {
+ _u.mutation.ResetItemCount()
+ _u.mutation.SetItemCount(v)
+ return _u
+}
+
+// SetNillableItemCount sets the "item_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableItemCount(v *int) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetItemCount(*v)
+ }
+ return _u
+}
+
+// AddItemCount adds value to the "item_count" field.
+func (_u *BatchImageJobUpdate) AddItemCount(v int) *BatchImageJobUpdate {
+ _u.mutation.AddItemCount(v)
+ return _u
+}
+
+// SetSuccessCount sets the "success_count" field.
+func (_u *BatchImageJobUpdate) SetSuccessCount(v int) *BatchImageJobUpdate {
+ _u.mutation.ResetSuccessCount()
+ _u.mutation.SetSuccessCount(v)
+ return _u
+}
+
+// SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableSuccessCount(v *int) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetSuccessCount(*v)
+ }
+ return _u
+}
+
+// AddSuccessCount adds value to the "success_count" field.
+func (_u *BatchImageJobUpdate) AddSuccessCount(v int) *BatchImageJobUpdate {
+ _u.mutation.AddSuccessCount(v)
+ return _u
+}
+
+// SetFailCount sets the "fail_count" field.
+func (_u *BatchImageJobUpdate) SetFailCount(v int) *BatchImageJobUpdate {
+ _u.mutation.ResetFailCount()
+ _u.mutation.SetFailCount(v)
+ return _u
+}
+
+// SetNillableFailCount sets the "fail_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableFailCount(v *int) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetFailCount(*v)
+ }
+ return _u
+}
+
+// AddFailCount adds value to the "fail_count" field.
+func (_u *BatchImageJobUpdate) AddFailCount(v int) *BatchImageJobUpdate {
+ _u.mutation.AddFailCount(v)
+ return _u
+}
+
+// SetCancelledCount sets the "cancelled_count" field.
+func (_u *BatchImageJobUpdate) SetCancelledCount(v int) *BatchImageJobUpdate {
+ _u.mutation.ResetCancelledCount()
+ _u.mutation.SetCancelledCount(v)
+ return _u
+}
+
+// SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableCancelledCount(v *int) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetCancelledCount(*v)
+ }
+ return _u
+}
+
+// AddCancelledCount adds value to the "cancelled_count" field.
+func (_u *BatchImageJobUpdate) AddCancelledCount(v int) *BatchImageJobUpdate {
+ _u.mutation.AddCancelledCount(v)
+ return _u
+}
+
+// SetEstimatedCost sets the "estimated_cost" field.
+func (_u *BatchImageJobUpdate) SetEstimatedCost(v float64) *BatchImageJobUpdate {
+ _u.mutation.ResetEstimatedCost()
+ _u.mutation.SetEstimatedCost(v)
+ return _u
+}
+
+// SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetEstimatedCost(*v)
+ }
+ return _u
+}
+
+// AddEstimatedCost adds value to the "estimated_cost" field.
+func (_u *BatchImageJobUpdate) AddEstimatedCost(v float64) *BatchImageJobUpdate {
+ _u.mutation.AddEstimatedCost(v)
+ return _u
+}
+
+// SetHoldAmount sets the "hold_amount" field.
+func (_u *BatchImageJobUpdate) SetHoldAmount(v float64) *BatchImageJobUpdate {
+ _u.mutation.ResetHoldAmount()
+ _u.mutation.SetHoldAmount(v)
+ return _u
+}
+
+// SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableHoldAmount(v *float64) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetHoldAmount(*v)
+ }
+ return _u
+}
+
+// AddHoldAmount adds value to the "hold_amount" field.
+func (_u *BatchImageJobUpdate) AddHoldAmount(v float64) *BatchImageJobUpdate {
+ _u.mutation.AddHoldAmount(v)
+ return _u
+}
+
+// ClearHoldAmount clears the value of the "hold_amount" field.
+func (_u *BatchImageJobUpdate) ClearHoldAmount() *BatchImageJobUpdate {
+ _u.mutation.ClearHoldAmount()
+ return _u
+}
+
+// SetActualCost sets the "actual_cost" field.
+func (_u *BatchImageJobUpdate) SetActualCost(v float64) *BatchImageJobUpdate {
+ _u.mutation.ResetActualCost()
+ _u.mutation.SetActualCost(v)
+ return _u
+}
+
+// SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableActualCost(v *float64) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetActualCost(*v)
+ }
+ return _u
+}
+
+// AddActualCost adds value to the "actual_cost" field.
+func (_u *BatchImageJobUpdate) AddActualCost(v float64) *BatchImageJobUpdate {
+ _u.mutation.AddActualCost(v)
+ return _u
+}
+
+// ClearActualCost clears the value of the "actual_cost" field.
+func (_u *BatchImageJobUpdate) ClearActualCost() *BatchImageJobUpdate {
+ _u.mutation.ClearActualCost()
+ return _u
+}
+
+// SetCurrency sets the "currency" field.
+func (_u *BatchImageJobUpdate) SetCurrency(v string) *BatchImageJobUpdate {
+ _u.mutation.SetCurrency(v)
+ return _u
+}
+
+// SetNillableCurrency sets the "currency" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableCurrency(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetCurrency(*v)
+ }
+ return _u
+}
+
+// SetHoldID sets the "hold_id" field.
+func (_u *BatchImageJobUpdate) SetHoldID(v string) *BatchImageJobUpdate {
+ _u.mutation.SetHoldID(v)
+ return _u
+}
+
+// SetNillableHoldID sets the "hold_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableHoldID(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetHoldID(*v)
+ }
+ return _u
+}
+
+// ClearHoldID clears the value of the "hold_id" field.
+func (_u *BatchImageJobUpdate) ClearHoldID() *BatchImageJobUpdate {
+ _u.mutation.ClearHoldID()
+ return _u
+}
+
+// SetIdempotencyKey sets the "idempotency_key" field.
+func (_u *BatchImageJobUpdate) SetIdempotencyKey(v string) *BatchImageJobUpdate {
+ _u.mutation.SetIdempotencyKey(v)
+ return _u
+}
+
+// SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetIdempotencyKey(*v)
+ }
+ return _u
+}
+
+// ClearIdempotencyKey clears the value of the "idempotency_key" field.
+func (_u *BatchImageJobUpdate) ClearIdempotencyKey() *BatchImageJobUpdate {
+ _u.mutation.ClearIdempotencyKey()
+ return _u
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (_u *BatchImageJobUpdate) SetRequestHash(v string) *BatchImageJobUpdate {
+ _u.mutation.SetRequestHash(v)
+ return _u
+}
+
+// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableRequestHash(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetRequestHash(*v)
+ }
+ return _u
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (_u *BatchImageJobUpdate) ClearRequestHash() *BatchImageJobUpdate {
+ _u.mutation.ClearRequestHash()
+ return _u
+}
+
+// SetManifestHash sets the "manifest_hash" field.
+func (_u *BatchImageJobUpdate) SetManifestHash(v string) *BatchImageJobUpdate {
+ _u.mutation.SetManifestHash(v)
+ return _u
+}
+
+// SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableManifestHash(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetManifestHash(*v)
+ }
+ return _u
+}
+
+// ClearManifestHash clears the value of the "manifest_hash" field.
+func (_u *BatchImageJobUpdate) ClearManifestHash() *BatchImageJobUpdate {
+ _u.mutation.ClearManifestHash()
+ return _u
+}
+
+// SetRetryCount sets the "retry_count" field.
+func (_u *BatchImageJobUpdate) SetRetryCount(v int) *BatchImageJobUpdate {
+ _u.mutation.ResetRetryCount()
+ _u.mutation.SetRetryCount(v)
+ return _u
+}
+
+// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableRetryCount(v *int) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetRetryCount(*v)
+ }
+ return _u
+}
+
+// AddRetryCount adds value to the "retry_count" field.
+func (_u *BatchImageJobUpdate) AddRetryCount(v int) *BatchImageJobUpdate {
+ _u.mutation.AddRetryCount(v)
+ return _u
+}
+
+// SetVersion sets the "version" field.
+func (_u *BatchImageJobUpdate) SetVersion(v int) *BatchImageJobUpdate {
+ _u.mutation.ResetVersion()
+ _u.mutation.SetVersion(v)
+ return _u
+}
+
+// SetNillableVersion sets the "version" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableVersion(v *int) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetVersion(*v)
+ }
+ return _u
+}
+
+// AddVersion adds value to the "version" field.
+func (_u *BatchImageJobUpdate) AddVersion(v int) *BatchImageJobUpdate {
+ _u.mutation.AddVersion(v)
+ return _u
+}
+
+// SetOutputExpiresAt sets the "output_expires_at" field.
+func (_u *BatchImageJobUpdate) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetOutputExpiresAt(v)
+ return _u
+}
+
+// SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetOutputExpiresAt(*v)
+ }
+ return _u
+}
+
+// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
+func (_u *BatchImageJobUpdate) ClearOutputExpiresAt() *BatchImageJobUpdate {
+ _u.mutation.ClearOutputExpiresAt()
+ return _u
+}
+
+// SetInputDeletedAt sets the "input_deleted_at" field.
+func (_u *BatchImageJobUpdate) SetInputDeletedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetInputDeletedAt(v)
+ return _u
+}
+
+// SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetInputDeletedAt(*v)
+ }
+ return _u
+}
+
+// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
+func (_u *BatchImageJobUpdate) ClearInputDeletedAt() *BatchImageJobUpdate {
+ _u.mutation.ClearInputDeletedAt()
+ return _u
+}
+
+// SetOutputDeletedAt sets the "output_deleted_at" field.
+func (_u *BatchImageJobUpdate) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetOutputDeletedAt(v)
+ return _u
+}
+
+// SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetOutputDeletedAt(*v)
+ }
+ return _u
+}
+
+// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
+func (_u *BatchImageJobUpdate) ClearOutputDeletedAt() *BatchImageJobUpdate {
+ _u.mutation.ClearOutputDeletedAt()
+ return _u
+}
+
+// SetDownloadedAt sets the "downloaded_at" field.
+func (_u *BatchImageJobUpdate) SetDownloadedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetDownloadedAt(v)
+ return _u
+}
+
+// SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetDownloadedAt(*v)
+ }
+ return _u
+}
+
+// ClearDownloadedAt clears the value of the "downloaded_at" field.
+func (_u *BatchImageJobUpdate) ClearDownloadedAt() *BatchImageJobUpdate {
+ _u.mutation.ClearDownloadedAt()
+ return _u
+}
+
+// SetUserDeletedAt sets the "user_deleted_at" field.
+func (_u *BatchImageJobUpdate) SetUserDeletedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetUserDeletedAt(v)
+ return _u
+}
+
+// SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetUserDeletedAt(*v)
+ }
+ return _u
+}
+
+// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
+func (_u *BatchImageJobUpdate) ClearUserDeletedAt() *BatchImageJobUpdate {
+ _u.mutation.ClearUserDeletedAt()
+ return _u
+}
+
+// SetLastErrorCode sets the "last_error_code" field.
+func (_u *BatchImageJobUpdate) SetLastErrorCode(v string) *BatchImageJobUpdate {
+ _u.mutation.SetLastErrorCode(v)
+ return _u
+}
+
+// SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableLastErrorCode(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetLastErrorCode(*v)
+ }
+ return _u
+}
+
+// ClearLastErrorCode clears the value of the "last_error_code" field.
+func (_u *BatchImageJobUpdate) ClearLastErrorCode() *BatchImageJobUpdate {
+ _u.mutation.ClearLastErrorCode()
+ return _u
+}
+
+// SetLastErrorMessage sets the "last_error_message" field.
+func (_u *BatchImageJobUpdate) SetLastErrorMessage(v string) *BatchImageJobUpdate {
+ _u.mutation.SetLastErrorMessage(v)
+ return _u
+}
+
+// SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetLastErrorMessage(*v)
+ }
+ return _u
+}
+
+// ClearLastErrorMessage clears the value of the "last_error_message" field.
+func (_u *BatchImageJobUpdate) ClearLastErrorMessage() *BatchImageJobUpdate {
+ _u.mutation.ClearLastErrorMessage()
+ return _u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (_u *BatchImageJobUpdate) SetUpdatedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
+}
+
+// SetSubmittedAt sets the "submitted_at" field.
+func (_u *BatchImageJobUpdate) SetSubmittedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetSubmittedAt(v)
+ return _u
+}
+
+// SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetSubmittedAt(*v)
+ }
+ return _u
+}
+
+// ClearSubmittedAt clears the value of the "submitted_at" field.
+func (_u *BatchImageJobUpdate) ClearSubmittedAt() *BatchImageJobUpdate {
+ _u.mutation.ClearSubmittedAt()
+ return _u
+}
+
+// SetStartedAt sets the "started_at" field.
+func (_u *BatchImageJobUpdate) SetStartedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetStartedAt(v)
+ return _u
+}
+
+// SetNillableStartedAt sets the "started_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetStartedAt(*v)
+ }
+ return _u
+}
+
+// ClearStartedAt clears the value of the "started_at" field.
+func (_u *BatchImageJobUpdate) ClearStartedAt() *BatchImageJobUpdate {
+ _u.mutation.ClearStartedAt()
+ return _u
+}
+
+// SetFinishedAt sets the "finished_at" field.
+func (_u *BatchImageJobUpdate) SetFinishedAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetFinishedAt(v)
+ return _u
+}
+
+// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetFinishedAt(*v)
+ }
+ return _u
+}
+
+// ClearFinishedAt clears the value of the "finished_at" field.
+func (_u *BatchImageJobUpdate) ClearFinishedAt() *BatchImageJobUpdate {
+ _u.mutation.ClearFinishedAt()
+ return _u
+}
+
+// SetSettledAt sets the "settled_at" field.
+func (_u *BatchImageJobUpdate) SetSettledAt(v time.Time) *BatchImageJobUpdate {
+ _u.mutation.SetSettledAt(v)
+ return _u
+}
+
+// SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdate) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdate {
+ if v != nil {
+ _u.SetSettledAt(*v)
+ }
+ return _u
+}
+
+// ClearSettledAt clears the value of the "settled_at" field.
+func (_u *BatchImageJobUpdate) ClearSettledAt() *BatchImageJobUpdate {
+ _u.mutation.ClearSettledAt()
+ return _u
+}
+
+// Mutation returns the BatchImageJobMutation object of the builder.
+func (_u *BatchImageJobUpdate) Mutation() *BatchImageJobMutation {
+ return _u.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (_u *BatchImageJobUpdate) Save(ctx context.Context) (int, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_u *BatchImageJobUpdate) SaveX(ctx context.Context) int {
+ affected, err := _u.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return affected
+}
+
+// Exec executes the query.
+func (_u *BatchImageJobUpdate) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_u *BatchImageJobUpdate) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (_u *BatchImageJobUpdate) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
+ v := batchimagejob.UpdateDefaultUpdatedAt()
+ _u.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_u *BatchImageJobUpdate) check() error {
+ if v, ok := _u.mutation.Provider(); ok {
+ if err := batchimagejob.ProviderValidator(v); err != nil {
+ return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Model(); ok {
+ if err := batchimagejob.ModelValidator(v); err != nil {
+ return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.TaskName(); ok {
+ if err := batchimagejob.TaskNameValidator(v); err != nil {
+ return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Status(); ok {
+ if err := batchimagejob.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderJobName(); ok {
+ if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
+ return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderInputRef(); ok {
+ if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
+ return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderOutputRef(); ok {
+ if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
+ return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.GcsInputURI(); ok {
+ if err := batchimagejob.GcsInputURIValidator(v); err != nil {
+ return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.GcsOutputURI(); ok {
+ if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
+ return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Currency(); ok {
+ if err := batchimagejob.CurrencyValidator(v); err != nil {
+ return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.HoldID(); ok {
+ if err := batchimagejob.HoldIDValidator(v); err != nil {
+ return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.IdempotencyKey(); ok {
+ if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
+ return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.RequestHash(); ok {
+ if err := batchimagejob.RequestHashValidator(v); err != nil {
+ return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ManifestHash(); ok {
+ if err := batchimagejob.ManifestHashValidator(v); err != nil {
+ return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.LastErrorCode(); ok {
+ if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
+ return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (_u *BatchImageJobUpdate) sqlSave(ctx context.Context) (_node int, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
+ if ps := _u.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := _u.mutation.UserID(); ok {
+ _spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedUserID(); ok {
+ _spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.APIKeyID(); ok {
+ _spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedAPIKeyID(); ok {
+ _spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
+ }
+ if _u.mutation.APIKeyIDCleared() {
+ _spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.AccountID(); ok {
+ _spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedAccountID(); ok {
+ _spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
+ }
+ if _u.mutation.AccountIDCleared() {
+ _spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.Provider(); ok {
+ _spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Model(); ok {
+ _spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.TaskName(); ok {
+ _spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Status(); ok {
+ _spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.ProviderJobName(); ok {
+ _spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
+ }
+ if _u.mutation.ProviderJobNameCleared() {
+ _spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
+ }
+ if value, ok := _u.mutation.ProviderInputRef(); ok {
+ _spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
+ }
+ if _u.mutation.ProviderInputRefCleared() {
+ _spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
+ }
+ if value, ok := _u.mutation.ProviderOutputRef(); ok {
+ _spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
+ }
+ if _u.mutation.ProviderOutputRefCleared() {
+ _spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
+ }
+ if value, ok := _u.mutation.GcsInputURI(); ok {
+ _spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
+ }
+ if _u.mutation.GcsInputURICleared() {
+ _spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
+ }
+ if value, ok := _u.mutation.GcsOutputURI(); ok {
+ _spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
+ }
+ if _u.mutation.GcsOutputURICleared() {
+ _spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
+ }
+ if value, ok := _u.mutation.ItemCount(); ok {
+ _spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedItemCount(); ok {
+ _spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.SuccessCount(); ok {
+ _spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedSuccessCount(); ok {
+ _spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.FailCount(); ok {
+ _spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedFailCount(); ok {
+ _spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.CancelledCount(); ok {
+ _spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedCancelledCount(); ok {
+ _spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.EstimatedCost(); ok {
+ _spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedEstimatedCost(); ok {
+ _spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.HoldAmount(); ok {
+ _spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedHoldAmount(); ok {
+ _spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
+ }
+ if _u.mutation.HoldAmountCleared() {
+ _spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.ActualCost(); ok {
+ _spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedActualCost(); ok {
+ _spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
+ }
+ if _u.mutation.ActualCostCleared() {
+ _spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.Currency(); ok {
+ _spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.HoldID(); ok {
+ _spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
+ }
+ if _u.mutation.HoldIDCleared() {
+ _spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
+ }
+ if value, ok := _u.mutation.IdempotencyKey(); ok {
+ _spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
+ }
+ if _u.mutation.IdempotencyKeyCleared() {
+ _spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
+ }
+ if value, ok := _u.mutation.RequestHash(); ok {
+ _spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
+ }
+ if _u.mutation.RequestHashCleared() {
+ _spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
+ }
+ if value, ok := _u.mutation.ManifestHash(); ok {
+ _spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
+ }
+ if _u.mutation.ManifestHashCleared() {
+ _spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
+ }
+ if value, ok := _u.mutation.RetryCount(); ok {
+ _spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedRetryCount(); ok {
+ _spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.Version(); ok {
+ _spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedVersion(); ok {
+ _spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.OutputExpiresAt(); ok {
+ _spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
+ }
+ if _u.mutation.OutputExpiresAtCleared() {
+ _spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.InputDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
+ }
+ if _u.mutation.InputDeletedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.OutputDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
+ }
+ if _u.mutation.OutputDeletedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.DownloadedAt(); ok {
+ _spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
+ }
+ if _u.mutation.DownloadedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.UserDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
+ }
+ if _u.mutation.UserDeletedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.LastErrorCode(); ok {
+ _spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
+ }
+ if _u.mutation.LastErrorCodeCleared() {
+ _spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
+ }
+ if value, ok := _u.mutation.LastErrorMessage(); ok {
+ _spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
+ }
+ if _u.mutation.LastErrorMessageCleared() {
+ _spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
+ }
+ if value, ok := _u.mutation.UpdatedAt(); ok {
+ _spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if value, ok := _u.mutation.SubmittedAt(); ok {
+ _spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
+ }
+ if _u.mutation.SubmittedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.StartedAt(); ok {
+ _spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
+ }
+ if _u.mutation.StartedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.FinishedAt(); ok {
+ _spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
+ }
+ if _u.mutation.FinishedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.SettledAt(); ok {
+ _spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
+ }
+ if _u.mutation.SettledAtCleared() {
+ _spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
+ }
+ if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{batchimagejob.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return 0, err
+ }
+ _u.mutation.done = true
+ return _node, nil
+}
+
+// BatchImageJobUpdateOne is the builder for updating a single BatchImageJob entity.
+type BatchImageJobUpdateOne struct {
+ config
+ fields []string
+ hooks []Hook
+ mutation *BatchImageJobMutation
+}
+
+// SetUserID sets the "user_id" field.
+func (_u *BatchImageJobUpdateOne) SetUserID(v int64) *BatchImageJobUpdateOne {
+ _u.mutation.ResetUserID()
+ _u.mutation.SetUserID(v)
+ return _u
+}
+
+// SetNillableUserID sets the "user_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableUserID(v *int64) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetUserID(*v)
+ }
+ return _u
+}
+
+// AddUserID adds value to the "user_id" field.
+func (_u *BatchImageJobUpdateOne) AddUserID(v int64) *BatchImageJobUpdateOne {
+ _u.mutation.AddUserID(v)
+ return _u
+}
+
+// SetAPIKeyID sets the "api_key_id" field.
+func (_u *BatchImageJobUpdateOne) SetAPIKeyID(v int64) *BatchImageJobUpdateOne {
+ _u.mutation.ResetAPIKeyID()
+ _u.mutation.SetAPIKeyID(v)
+ return _u
+}
+
+// SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetAPIKeyID(*v)
+ }
+ return _u
+}
+
+// AddAPIKeyID adds value to the "api_key_id" field.
+func (_u *BatchImageJobUpdateOne) AddAPIKeyID(v int64) *BatchImageJobUpdateOne {
+ _u.mutation.AddAPIKeyID(v)
+ return _u
+}
+
+// ClearAPIKeyID clears the value of the "api_key_id" field.
+func (_u *BatchImageJobUpdateOne) ClearAPIKeyID() *BatchImageJobUpdateOne {
+ _u.mutation.ClearAPIKeyID()
+ return _u
+}
+
+// SetAccountID sets the "account_id" field.
+func (_u *BatchImageJobUpdateOne) SetAccountID(v int64) *BatchImageJobUpdateOne {
+ _u.mutation.ResetAccountID()
+ _u.mutation.SetAccountID(v)
+ return _u
+}
+
+// SetNillableAccountID sets the "account_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableAccountID(v *int64) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetAccountID(*v)
+ }
+ return _u
+}
+
+// AddAccountID adds value to the "account_id" field.
+func (_u *BatchImageJobUpdateOne) AddAccountID(v int64) *BatchImageJobUpdateOne {
+ _u.mutation.AddAccountID(v)
+ return _u
+}
+
+// ClearAccountID clears the value of the "account_id" field.
+func (_u *BatchImageJobUpdateOne) ClearAccountID() *BatchImageJobUpdateOne {
+ _u.mutation.ClearAccountID()
+ return _u
+}
+
+// SetProvider sets the "provider" field.
+func (_u *BatchImageJobUpdateOne) SetProvider(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetProvider(v)
+ return _u
+}
+
+// SetNillableProvider sets the "provider" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableProvider(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetProvider(*v)
+ }
+ return _u
+}
+
+// SetModel sets the "model" field.
+func (_u *BatchImageJobUpdateOne) SetModel(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetModel(v)
+ return _u
+}
+
+// SetNillableModel sets the "model" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableModel(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetModel(*v)
+ }
+ return _u
+}
+
+// SetTaskName sets the "task_name" field.
+func (_u *BatchImageJobUpdateOne) SetTaskName(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetTaskName(v)
+ return _u
+}
+
+// SetNillableTaskName sets the "task_name" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableTaskName(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetTaskName(*v)
+ }
+ return _u
+}
+
+// SetStatus sets the "status" field.
+func (_u *BatchImageJobUpdateOne) SetStatus(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetStatus(v)
+ return _u
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableStatus(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetStatus(*v)
+ }
+ return _u
+}
+
+// SetProviderJobName sets the "provider_job_name" field.
+func (_u *BatchImageJobUpdateOne) SetProviderJobName(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetProviderJobName(v)
+ return _u
+}
+
+// SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableProviderJobName(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetProviderJobName(*v)
+ }
+ return _u
+}
+
+// ClearProviderJobName clears the value of the "provider_job_name" field.
+func (_u *BatchImageJobUpdateOne) ClearProviderJobName() *BatchImageJobUpdateOne {
+ _u.mutation.ClearProviderJobName()
+ return _u
+}
+
+// SetProviderInputRef sets the "provider_input_ref" field.
+func (_u *BatchImageJobUpdateOne) SetProviderInputRef(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetProviderInputRef(v)
+ return _u
+}
+
+// SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableProviderInputRef(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetProviderInputRef(*v)
+ }
+ return _u
+}
+
+// ClearProviderInputRef clears the value of the "provider_input_ref" field.
+func (_u *BatchImageJobUpdateOne) ClearProviderInputRef() *BatchImageJobUpdateOne {
+ _u.mutation.ClearProviderInputRef()
+ return _u
+}
+
+// SetProviderOutputRef sets the "provider_output_ref" field.
+func (_u *BatchImageJobUpdateOne) SetProviderOutputRef(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetProviderOutputRef(v)
+ return _u
+}
+
+// SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetProviderOutputRef(*v)
+ }
+ return _u
+}
+
+// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
+func (_u *BatchImageJobUpdateOne) ClearProviderOutputRef() *BatchImageJobUpdateOne {
+ _u.mutation.ClearProviderOutputRef()
+ return _u
+}
+
+// SetGcsInputURI sets the "gcs_input_uri" field.
+func (_u *BatchImageJobUpdateOne) SetGcsInputURI(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetGcsInputURI(v)
+ return _u
+}
+
+// SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableGcsInputURI(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetGcsInputURI(*v)
+ }
+ return _u
+}
+
+// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
+func (_u *BatchImageJobUpdateOne) ClearGcsInputURI() *BatchImageJobUpdateOne {
+ _u.mutation.ClearGcsInputURI()
+ return _u
+}
+
+// SetGcsOutputURI sets the "gcs_output_uri" field.
+func (_u *BatchImageJobUpdateOne) SetGcsOutputURI(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetGcsOutputURI(v)
+ return _u
+}
+
+// SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetGcsOutputURI(*v)
+ }
+ return _u
+}
+
+// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
+func (_u *BatchImageJobUpdateOne) ClearGcsOutputURI() *BatchImageJobUpdateOne {
+ _u.mutation.ClearGcsOutputURI()
+ return _u
+}
+
+// SetItemCount sets the "item_count" field.
+func (_u *BatchImageJobUpdateOne) SetItemCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.ResetItemCount()
+ _u.mutation.SetItemCount(v)
+ return _u
+}
+
+// SetNillableItemCount sets the "item_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableItemCount(v *int) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetItemCount(*v)
+ }
+ return _u
+}
+
+// AddItemCount adds value to the "item_count" field.
+func (_u *BatchImageJobUpdateOne) AddItemCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.AddItemCount(v)
+ return _u
+}
+
+// SetSuccessCount sets the "success_count" field.
+func (_u *BatchImageJobUpdateOne) SetSuccessCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.ResetSuccessCount()
+ _u.mutation.SetSuccessCount(v)
+ return _u
+}
+
+// SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableSuccessCount(v *int) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetSuccessCount(*v)
+ }
+ return _u
+}
+
+// AddSuccessCount adds value to the "success_count" field.
+func (_u *BatchImageJobUpdateOne) AddSuccessCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.AddSuccessCount(v)
+ return _u
+}
+
+// SetFailCount sets the "fail_count" field.
+func (_u *BatchImageJobUpdateOne) SetFailCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.ResetFailCount()
+ _u.mutation.SetFailCount(v)
+ return _u
+}
+
+// SetNillableFailCount sets the "fail_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableFailCount(v *int) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetFailCount(*v)
+ }
+ return _u
+}
+
+// AddFailCount adds value to the "fail_count" field.
+func (_u *BatchImageJobUpdateOne) AddFailCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.AddFailCount(v)
+ return _u
+}
+
+// SetCancelledCount sets the "cancelled_count" field.
+func (_u *BatchImageJobUpdateOne) SetCancelledCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.ResetCancelledCount()
+ _u.mutation.SetCancelledCount(v)
+ return _u
+}
+
+// SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableCancelledCount(v *int) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetCancelledCount(*v)
+ }
+ return _u
+}
+
+// AddCancelledCount adds value to the "cancelled_count" field.
+func (_u *BatchImageJobUpdateOne) AddCancelledCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.AddCancelledCount(v)
+ return _u
+}
+
+// SetEstimatedCost sets the "estimated_cost" field.
+func (_u *BatchImageJobUpdateOne) SetEstimatedCost(v float64) *BatchImageJobUpdateOne {
+ _u.mutation.ResetEstimatedCost()
+ _u.mutation.SetEstimatedCost(v)
+ return _u
+}
+
+// SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetEstimatedCost(*v)
+ }
+ return _u
+}
+
+// AddEstimatedCost adds value to the "estimated_cost" field.
+func (_u *BatchImageJobUpdateOne) AddEstimatedCost(v float64) *BatchImageJobUpdateOne {
+ _u.mutation.AddEstimatedCost(v)
+ return _u
+}
+
+// SetHoldAmount sets the "hold_amount" field.
+func (_u *BatchImageJobUpdateOne) SetHoldAmount(v float64) *BatchImageJobUpdateOne {
+ _u.mutation.ResetHoldAmount()
+ _u.mutation.SetHoldAmount(v)
+ return _u
+}
+
+// SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableHoldAmount(v *float64) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetHoldAmount(*v)
+ }
+ return _u
+}
+
+// AddHoldAmount adds value to the "hold_amount" field.
+func (_u *BatchImageJobUpdateOne) AddHoldAmount(v float64) *BatchImageJobUpdateOne {
+ _u.mutation.AddHoldAmount(v)
+ return _u
+}
+
+// ClearHoldAmount clears the value of the "hold_amount" field.
+func (_u *BatchImageJobUpdateOne) ClearHoldAmount() *BatchImageJobUpdateOne {
+ _u.mutation.ClearHoldAmount()
+ return _u
+}
+
+// SetActualCost sets the "actual_cost" field.
+func (_u *BatchImageJobUpdateOne) SetActualCost(v float64) *BatchImageJobUpdateOne {
+ _u.mutation.ResetActualCost()
+ _u.mutation.SetActualCost(v)
+ return _u
+}
+
+// SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableActualCost(v *float64) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetActualCost(*v)
+ }
+ return _u
+}
+
+// AddActualCost adds value to the "actual_cost" field.
+func (_u *BatchImageJobUpdateOne) AddActualCost(v float64) *BatchImageJobUpdateOne {
+ _u.mutation.AddActualCost(v)
+ return _u
+}
+
+// ClearActualCost clears the value of the "actual_cost" field.
+func (_u *BatchImageJobUpdateOne) ClearActualCost() *BatchImageJobUpdateOne {
+ _u.mutation.ClearActualCost()
+ return _u
+}
+
+// SetCurrency sets the "currency" field.
+func (_u *BatchImageJobUpdateOne) SetCurrency(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetCurrency(v)
+ return _u
+}
+
+// SetNillableCurrency sets the "currency" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableCurrency(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetCurrency(*v)
+ }
+ return _u
+}
+
+// SetHoldID sets the "hold_id" field.
+func (_u *BatchImageJobUpdateOne) SetHoldID(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetHoldID(v)
+ return _u
+}
+
+// SetNillableHoldID sets the "hold_id" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableHoldID(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetHoldID(*v)
+ }
+ return _u
+}
+
+// ClearHoldID clears the value of the "hold_id" field.
+func (_u *BatchImageJobUpdateOne) ClearHoldID() *BatchImageJobUpdateOne {
+ _u.mutation.ClearHoldID()
+ return _u
+}
+
+// SetIdempotencyKey sets the "idempotency_key" field.
+func (_u *BatchImageJobUpdateOne) SetIdempotencyKey(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetIdempotencyKey(v)
+ return _u
+}
+
+// SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetIdempotencyKey(*v)
+ }
+ return _u
+}
+
+// ClearIdempotencyKey clears the value of the "idempotency_key" field.
+func (_u *BatchImageJobUpdateOne) ClearIdempotencyKey() *BatchImageJobUpdateOne {
+ _u.mutation.ClearIdempotencyKey()
+ return _u
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (_u *BatchImageJobUpdateOne) SetRequestHash(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetRequestHash(v)
+ return _u
+}
+
+// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableRequestHash(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetRequestHash(*v)
+ }
+ return _u
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (_u *BatchImageJobUpdateOne) ClearRequestHash() *BatchImageJobUpdateOne {
+ _u.mutation.ClearRequestHash()
+ return _u
+}
+
+// SetManifestHash sets the "manifest_hash" field.
+func (_u *BatchImageJobUpdateOne) SetManifestHash(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetManifestHash(v)
+ return _u
+}
+
+// SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableManifestHash(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetManifestHash(*v)
+ }
+ return _u
+}
+
+// ClearManifestHash clears the value of the "manifest_hash" field.
+func (_u *BatchImageJobUpdateOne) ClearManifestHash() *BatchImageJobUpdateOne {
+ _u.mutation.ClearManifestHash()
+ return _u
+}
+
+// SetRetryCount sets the "retry_count" field.
+func (_u *BatchImageJobUpdateOne) SetRetryCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.ResetRetryCount()
+ _u.mutation.SetRetryCount(v)
+ return _u
+}
+
+// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableRetryCount(v *int) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetRetryCount(*v)
+ }
+ return _u
+}
+
+// AddRetryCount adds value to the "retry_count" field.
+func (_u *BatchImageJobUpdateOne) AddRetryCount(v int) *BatchImageJobUpdateOne {
+ _u.mutation.AddRetryCount(v)
+ return _u
+}
+
+// SetVersion sets the "version" field.
+func (_u *BatchImageJobUpdateOne) SetVersion(v int) *BatchImageJobUpdateOne {
+ _u.mutation.ResetVersion()
+ _u.mutation.SetVersion(v)
+ return _u
+}
+
+// SetNillableVersion sets the "version" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableVersion(v *int) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetVersion(*v)
+ }
+ return _u
+}
+
+// AddVersion adds value to the "version" field.
+func (_u *BatchImageJobUpdateOne) AddVersion(v int) *BatchImageJobUpdateOne {
+ _u.mutation.AddVersion(v)
+ return _u
+}
+
+// SetOutputExpiresAt sets the "output_expires_at" field.
+func (_u *BatchImageJobUpdateOne) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetOutputExpiresAt(v)
+ return _u
+}
+
+// SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetOutputExpiresAt(*v)
+ }
+ return _u
+}
+
+// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
+func (_u *BatchImageJobUpdateOne) ClearOutputExpiresAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearOutputExpiresAt()
+ return _u
+}
+
+// SetInputDeletedAt sets the "input_deleted_at" field.
+func (_u *BatchImageJobUpdateOne) SetInputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetInputDeletedAt(v)
+ return _u
+}
+
+// SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetInputDeletedAt(*v)
+ }
+ return _u
+}
+
+// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
+func (_u *BatchImageJobUpdateOne) ClearInputDeletedAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearInputDeletedAt()
+ return _u
+}
+
+// SetOutputDeletedAt sets the "output_deleted_at" field.
+func (_u *BatchImageJobUpdateOne) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetOutputDeletedAt(v)
+ return _u
+}
+
+// SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetOutputDeletedAt(*v)
+ }
+ return _u
+}
+
+// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
+func (_u *BatchImageJobUpdateOne) ClearOutputDeletedAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearOutputDeletedAt()
+ return _u
+}
+
+// SetDownloadedAt sets the "downloaded_at" field.
+func (_u *BatchImageJobUpdateOne) SetDownloadedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetDownloadedAt(v)
+ return _u
+}
+
+// SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetDownloadedAt(*v)
+ }
+ return _u
+}
+
+// ClearDownloadedAt clears the value of the "downloaded_at" field.
+func (_u *BatchImageJobUpdateOne) ClearDownloadedAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearDownloadedAt()
+ return _u
+}
+
+// SetUserDeletedAt sets the "user_deleted_at" field.
+func (_u *BatchImageJobUpdateOne) SetUserDeletedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetUserDeletedAt(v)
+ return _u
+}
+
+// SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetUserDeletedAt(*v)
+ }
+ return _u
+}
+
+// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
+func (_u *BatchImageJobUpdateOne) ClearUserDeletedAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearUserDeletedAt()
+ return _u
+}
+
+// SetLastErrorCode sets the "last_error_code" field.
+func (_u *BatchImageJobUpdateOne) SetLastErrorCode(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetLastErrorCode(v)
+ return _u
+}
+
+// SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableLastErrorCode(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetLastErrorCode(*v)
+ }
+ return _u
+}
+
+// ClearLastErrorCode clears the value of the "last_error_code" field.
+func (_u *BatchImageJobUpdateOne) ClearLastErrorCode() *BatchImageJobUpdateOne {
+ _u.mutation.ClearLastErrorCode()
+ return _u
+}
+
+// SetLastErrorMessage sets the "last_error_message" field.
+func (_u *BatchImageJobUpdateOne) SetLastErrorMessage(v string) *BatchImageJobUpdateOne {
+ _u.mutation.SetLastErrorMessage(v)
+ return _u
+}
+
+// SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetLastErrorMessage(*v)
+ }
+ return _u
+}
+
+// ClearLastErrorMessage clears the value of the "last_error_message" field.
+func (_u *BatchImageJobUpdateOne) ClearLastErrorMessage() *BatchImageJobUpdateOne {
+ _u.mutation.ClearLastErrorMessage()
+ return _u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (_u *BatchImageJobUpdateOne) SetUpdatedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetUpdatedAt(v)
+ return _u
+}
+
+// SetSubmittedAt sets the "submitted_at" field.
+func (_u *BatchImageJobUpdateOne) SetSubmittedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetSubmittedAt(v)
+ return _u
+}
+
+// SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetSubmittedAt(*v)
+ }
+ return _u
+}
+
+// ClearSubmittedAt clears the value of the "submitted_at" field.
+func (_u *BatchImageJobUpdateOne) ClearSubmittedAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearSubmittedAt()
+ return _u
+}
+
+// SetStartedAt sets the "started_at" field.
+func (_u *BatchImageJobUpdateOne) SetStartedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetStartedAt(v)
+ return _u
+}
+
+// SetNillableStartedAt sets the "started_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetStartedAt(*v)
+ }
+ return _u
+}
+
+// ClearStartedAt clears the value of the "started_at" field.
+func (_u *BatchImageJobUpdateOne) ClearStartedAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearStartedAt()
+ return _u
+}
+
+// SetFinishedAt sets the "finished_at" field.
+func (_u *BatchImageJobUpdateOne) SetFinishedAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetFinishedAt(v)
+ return _u
+}
+
+// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetFinishedAt(*v)
+ }
+ return _u
+}
+
+// ClearFinishedAt clears the value of the "finished_at" field.
+func (_u *BatchImageJobUpdateOne) ClearFinishedAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearFinishedAt()
+ return _u
+}
+
+// SetSettledAt sets the "settled_at" field.
+func (_u *BatchImageJobUpdateOne) SetSettledAt(v time.Time) *BatchImageJobUpdateOne {
+ _u.mutation.SetSettledAt(v)
+ return _u
+}
+
+// SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
+func (_u *BatchImageJobUpdateOne) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdateOne {
+ if v != nil {
+ _u.SetSettledAt(*v)
+ }
+ return _u
+}
+
+// ClearSettledAt clears the value of the "settled_at" field.
+func (_u *BatchImageJobUpdateOne) ClearSettledAt() *BatchImageJobUpdateOne {
+ _u.mutation.ClearSettledAt()
+ return _u
+}
+
+// Mutation returns the BatchImageJobMutation object of the builder.
+func (_u *BatchImageJobUpdateOne) Mutation() *BatchImageJobMutation {
+ return _u.mutation
+}
+
+// Where appends a list predicates to the BatchImageJobUpdate builder.
+func (_u *BatchImageJobUpdateOne) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdateOne {
+ _u.mutation.Where(ps...)
+ return _u
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (_u *BatchImageJobUpdateOne) Select(field string, fields ...string) *BatchImageJobUpdateOne {
+ _u.fields = append([]string{field}, fields...)
+ return _u
+}
+
+// Save executes the query and returns the updated BatchImageJob entity.
+func (_u *BatchImageJobUpdateOne) Save(ctx context.Context) (*BatchImageJob, error) {
+ _u.defaults()
+ return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_u *BatchImageJobUpdateOne) SaveX(ctx context.Context) *BatchImageJob {
+ node, err := _u.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return node
+}
+
+// Exec executes the query on the entity.
+func (_u *BatchImageJobUpdateOne) Exec(ctx context.Context) error {
+ _, err := _u.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_u *BatchImageJobUpdateOne) ExecX(ctx context.Context) {
+ if err := _u.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (_u *BatchImageJobUpdateOne) defaults() {
+ if _, ok := _u.mutation.UpdatedAt(); !ok {
+ v := batchimagejob.UpdateDefaultUpdatedAt()
+ _u.mutation.SetUpdatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_u *BatchImageJobUpdateOne) check() error {
+ if v, ok := _u.mutation.Provider(); ok {
+ if err := batchimagejob.ProviderValidator(v); err != nil {
+ return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Model(); ok {
+ if err := batchimagejob.ModelValidator(v); err != nil {
+ return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.TaskName(); ok {
+ if err := batchimagejob.TaskNameValidator(v); err != nil {
+ return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Status(); ok {
+ if err := batchimagejob.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderJobName(); ok {
+ if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
+ return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderInputRef(); ok {
+ if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
+ return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ProviderOutputRef(); ok {
+ if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
+ return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.GcsInputURI(); ok {
+ if err := batchimagejob.GcsInputURIValidator(v); err != nil {
+ return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.GcsOutputURI(); ok {
+ if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
+ return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.Currency(); ok {
+ if err := batchimagejob.CurrencyValidator(v); err != nil {
+ return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.HoldID(); ok {
+ if err := batchimagejob.HoldIDValidator(v); err != nil {
+ return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.IdempotencyKey(); ok {
+ if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
+ return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.RequestHash(); ok {
+ if err := batchimagejob.RequestHashValidator(v); err != nil {
+ return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.ManifestHash(); ok {
+ if err := batchimagejob.ManifestHashValidator(v); err != nil {
+ return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
+ }
+ }
+ if v, ok := _u.mutation.LastErrorCode(); ok {
+ if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
+ return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
+ }
+ }
+ return nil
+}
+
+func (_u *BatchImageJobUpdateOne) sqlSave(ctx context.Context) (_node *BatchImageJob, err error) {
+ if err := _u.check(); err != nil {
+ return _node, err
+ }
+ _spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
+ id, ok := _u.mutation.ID()
+ if !ok {
+ return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BatchImageJob.id" for update`)}
+ }
+ _spec.Node.ID.Value = id
+ if fields := _u.fields; len(fields) > 0 {
+ _spec.Node.Columns = make([]string, 0, len(fields))
+ _spec.Node.Columns = append(_spec.Node.Columns, batchimagejob.FieldID)
+ for _, f := range fields {
+ if !batchimagejob.ValidColumn(f) {
+ return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+ }
+ if f != batchimagejob.FieldID {
+ _spec.Node.Columns = append(_spec.Node.Columns, f)
+ }
+ }
+ }
+ if ps := _u.mutation.predicates; len(ps) > 0 {
+ _spec.Predicate = func(selector *sql.Selector) {
+ for i := range ps {
+ ps[i](selector)
+ }
+ }
+ }
+ if value, ok := _u.mutation.UserID(); ok {
+ _spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedUserID(); ok {
+ _spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.APIKeyID(); ok {
+ _spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedAPIKeyID(); ok {
+ _spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
+ }
+ if _u.mutation.APIKeyIDCleared() {
+ _spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.AccountID(); ok {
+ _spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
+ }
+ if value, ok := _u.mutation.AddedAccountID(); ok {
+ _spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
+ }
+ if _u.mutation.AccountIDCleared() {
+ _spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
+ }
+ if value, ok := _u.mutation.Provider(); ok {
+ _spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Model(); ok {
+ _spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.TaskName(); ok {
+ _spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.Status(); ok {
+ _spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.ProviderJobName(); ok {
+ _spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
+ }
+ if _u.mutation.ProviderJobNameCleared() {
+ _spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
+ }
+ if value, ok := _u.mutation.ProviderInputRef(); ok {
+ _spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
+ }
+ if _u.mutation.ProviderInputRefCleared() {
+ _spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
+ }
+ if value, ok := _u.mutation.ProviderOutputRef(); ok {
+ _spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
+ }
+ if _u.mutation.ProviderOutputRefCleared() {
+ _spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
+ }
+ if value, ok := _u.mutation.GcsInputURI(); ok {
+ _spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
+ }
+ if _u.mutation.GcsInputURICleared() {
+ _spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
+ }
+ if value, ok := _u.mutation.GcsOutputURI(); ok {
+ _spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
+ }
+ if _u.mutation.GcsOutputURICleared() {
+ _spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
+ }
+ if value, ok := _u.mutation.ItemCount(); ok {
+ _spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedItemCount(); ok {
+ _spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.SuccessCount(); ok {
+ _spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedSuccessCount(); ok {
+ _spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.FailCount(); ok {
+ _spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedFailCount(); ok {
+ _spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.CancelledCount(); ok {
+ _spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedCancelledCount(); ok {
+ _spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.EstimatedCost(); ok {
+ _spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedEstimatedCost(); ok {
+ _spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.HoldAmount(); ok {
+ _spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedHoldAmount(); ok {
+ _spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
+ }
+ if _u.mutation.HoldAmountCleared() {
+ _spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.ActualCost(); ok {
+ _spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedActualCost(); ok {
+ _spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
+ }
+ if _u.mutation.ActualCostCleared() {
+ _spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.Currency(); ok {
+ _spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
+ }
+ if value, ok := _u.mutation.HoldID(); ok {
+ _spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
+ }
+ if _u.mutation.HoldIDCleared() {
+ _spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
+ }
+ if value, ok := _u.mutation.IdempotencyKey(); ok {
+ _spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
+ }
+ if _u.mutation.IdempotencyKeyCleared() {
+ _spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
+ }
+ if value, ok := _u.mutation.RequestHash(); ok {
+ _spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
+ }
+ if _u.mutation.RequestHashCleared() {
+ _spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
+ }
+ if value, ok := _u.mutation.ManifestHash(); ok {
+ _spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
+ }
+ if _u.mutation.ManifestHashCleared() {
+ _spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
+ }
+ if value, ok := _u.mutation.RetryCount(); ok {
+ _spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedRetryCount(); ok {
+ _spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.Version(); ok {
+ _spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedVersion(); ok {
+ _spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.OutputExpiresAt(); ok {
+ _spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
+ }
+ if _u.mutation.OutputExpiresAtCleared() {
+ _spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.InputDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
+ }
+ if _u.mutation.InputDeletedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.OutputDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
+ }
+ if _u.mutation.OutputDeletedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.DownloadedAt(); ok {
+ _spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
+ }
+ if _u.mutation.DownloadedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.UserDeletedAt(); ok {
+ _spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
+ }
+ if _u.mutation.UserDeletedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.LastErrorCode(); ok {
+ _spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
+ }
+ if _u.mutation.LastErrorCodeCleared() {
+ _spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
+ }
+ if value, ok := _u.mutation.LastErrorMessage(); ok {
+ _spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
+ }
+ if _u.mutation.LastErrorMessageCleared() {
+ _spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
+ }
+ if value, ok := _u.mutation.UpdatedAt(); ok {
+ _spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
+ }
+ if value, ok := _u.mutation.SubmittedAt(); ok {
+ _spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
+ }
+ if _u.mutation.SubmittedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.StartedAt(); ok {
+ _spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
+ }
+ if _u.mutation.StartedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.FinishedAt(); ok {
+ _spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
+ }
+ if _u.mutation.FinishedAtCleared() {
+ _spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
+ }
+ if value, ok := _u.mutation.SettledAt(); ok {
+ _spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
+ }
+ if _u.mutation.SettledAtCleared() {
+ _spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
+ }
+ _node = &BatchImageJob{config: _u.config}
+ _spec.Assign = _node.assignValues
+ _spec.ScanValues = _node.scanValues
+ if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
+ if _, ok := err.(*sqlgraph.NotFoundError); ok {
+ err = &NotFoundError{batchimagejob.Label}
+ } else if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ _u.mutation.done = true
+ return _node, nil
+}
diff --git a/backend/ent/client.go b/backend/ent/client.go
index 0b4edcf203..e9b74fcfef 100644
--- a/backend/ent/client.go
+++ b/backend/ent/client.go
@@ -22,6 +22,9 @@ import (
"github.com/Wei-Shaw/sub2api/ent/apikey"
"github.com/Wei-Shaw/sub2api/ent/authidentity"
"github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
@@ -73,6 +76,12 @@ type Client struct {
AuthIdentity *AuthIdentityClient
// AuthIdentityChannel is the client for interacting with the AuthIdentityChannel builders.
AuthIdentityChannel *AuthIdentityChannelClient
+ // BatchImageEvent is the client for interacting with the BatchImageEvent builders.
+ BatchImageEvent *BatchImageEventClient
+ // BatchImageItem is the client for interacting with the BatchImageItem builders.
+ BatchImageItem *BatchImageItemClient
+ // BatchImageJob is the client for interacting with the BatchImageJob builders.
+ BatchImageJob *BatchImageJobClient
// ChannelMonitor is the client for interacting with the ChannelMonitor builders.
ChannelMonitor *ChannelMonitorClient
// ChannelMonitorDailyRollup is the client for interacting with the ChannelMonitorDailyRollup builders.
@@ -147,6 +156,9 @@ func (c *Client) init() {
c.AnnouncementRead = NewAnnouncementReadClient(c.config)
c.AuthIdentity = NewAuthIdentityClient(c.config)
c.AuthIdentityChannel = NewAuthIdentityChannelClient(c.config)
+ c.BatchImageEvent = NewBatchImageEventClient(c.config)
+ c.BatchImageItem = NewBatchImageItemClient(c.config)
+ c.BatchImageJob = NewBatchImageJobClient(c.config)
c.ChannelMonitor = NewChannelMonitorClient(c.config)
c.ChannelMonitorDailyRollup = NewChannelMonitorDailyRollupClient(c.config)
c.ChannelMonitorHistory = NewChannelMonitorHistoryClient(c.config)
@@ -274,6 +286,9 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
AnnouncementRead: NewAnnouncementReadClient(cfg),
AuthIdentity: NewAuthIdentityClient(cfg),
AuthIdentityChannel: NewAuthIdentityChannelClient(cfg),
+ BatchImageEvent: NewBatchImageEventClient(cfg),
+ BatchImageItem: NewBatchImageItemClient(cfg),
+ BatchImageJob: NewBatchImageJobClient(cfg),
ChannelMonitor: NewChannelMonitorClient(cfg),
ChannelMonitorDailyRollup: NewChannelMonitorDailyRollupClient(cfg),
ChannelMonitorHistory: NewChannelMonitorHistoryClient(cfg),
@@ -328,6 +343,9 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
AnnouncementRead: NewAnnouncementReadClient(cfg),
AuthIdentity: NewAuthIdentityClient(cfg),
AuthIdentityChannel: NewAuthIdentityChannelClient(cfg),
+ BatchImageEvent: NewBatchImageEventClient(cfg),
+ BatchImageItem: NewBatchImageItemClient(cfg),
+ BatchImageJob: NewBatchImageJobClient(cfg),
ChannelMonitor: NewChannelMonitorClient(cfg),
ChannelMonitorDailyRollup: NewChannelMonitorDailyRollupClient(cfg),
ChannelMonitorHistory: NewChannelMonitorHistoryClient(cfg),
@@ -386,14 +404,15 @@ func (c *Client) Close() error {
func (c *Client) Use(hooks ...Hook) {
for _, n := range []interface{ Use(...Hook) }{
c.APIKey, c.Account, c.AccountGroup, c.Announcement, c.AnnouncementRead,
- c.AuthIdentity, c.AuthIdentityChannel, c.ChannelMonitor,
- c.ChannelMonitorDailyRollup, c.ChannelMonitorHistory,
- c.ChannelMonitorRequestTemplate, c.ErrorPassthroughRule, c.Group,
- c.IdempotencyRecord, c.IdentityAdoptionDecision, c.PaymentAuditLog,
- c.PaymentOrder, c.PaymentProviderInstance, c.PendingAuthSession, c.PromoCode,
- c.PromoCodeUsage, c.Proxy, c.RedeemCode, c.SecuritySecret, c.Setting,
- c.SubscriptionPlan, c.TLSFingerprintProfile, c.UsageCleanupTask, c.UsageLog,
- c.User, c.UserAllowedGroup, c.UserAttributeDefinition, c.UserAttributeValue,
+ c.AuthIdentity, c.AuthIdentityChannel, c.BatchImageEvent, c.BatchImageItem,
+ c.BatchImageJob, c.ChannelMonitor, c.ChannelMonitorDailyRollup,
+ c.ChannelMonitorHistory, c.ChannelMonitorRequestTemplate,
+ c.ErrorPassthroughRule, c.Group, c.IdempotencyRecord,
+ c.IdentityAdoptionDecision, c.PaymentAuditLog, c.PaymentOrder,
+ c.PaymentProviderInstance, c.PendingAuthSession, c.PromoCode, c.PromoCodeUsage,
+ c.Proxy, c.RedeemCode, c.SecuritySecret, c.Setting, c.SubscriptionPlan,
+ c.TLSFingerprintProfile, c.UsageCleanupTask, c.UsageLog, c.User,
+ c.UserAllowedGroup, c.UserAttributeDefinition, c.UserAttributeValue,
c.UserPlatformQuota, c.UserSubscription,
} {
n.Use(hooks...)
@@ -405,14 +424,15 @@ func (c *Client) Use(hooks ...Hook) {
func (c *Client) Intercept(interceptors ...Interceptor) {
for _, n := range []interface{ Intercept(...Interceptor) }{
c.APIKey, c.Account, c.AccountGroup, c.Announcement, c.AnnouncementRead,
- c.AuthIdentity, c.AuthIdentityChannel, c.ChannelMonitor,
- c.ChannelMonitorDailyRollup, c.ChannelMonitorHistory,
- c.ChannelMonitorRequestTemplate, c.ErrorPassthroughRule, c.Group,
- c.IdempotencyRecord, c.IdentityAdoptionDecision, c.PaymentAuditLog,
- c.PaymentOrder, c.PaymentProviderInstance, c.PendingAuthSession, c.PromoCode,
- c.PromoCodeUsage, c.Proxy, c.RedeemCode, c.SecuritySecret, c.Setting,
- c.SubscriptionPlan, c.TLSFingerprintProfile, c.UsageCleanupTask, c.UsageLog,
- c.User, c.UserAllowedGroup, c.UserAttributeDefinition, c.UserAttributeValue,
+ c.AuthIdentity, c.AuthIdentityChannel, c.BatchImageEvent, c.BatchImageItem,
+ c.BatchImageJob, c.ChannelMonitor, c.ChannelMonitorDailyRollup,
+ c.ChannelMonitorHistory, c.ChannelMonitorRequestTemplate,
+ c.ErrorPassthroughRule, c.Group, c.IdempotencyRecord,
+ c.IdentityAdoptionDecision, c.PaymentAuditLog, c.PaymentOrder,
+ c.PaymentProviderInstance, c.PendingAuthSession, c.PromoCode, c.PromoCodeUsage,
+ c.Proxy, c.RedeemCode, c.SecuritySecret, c.Setting, c.SubscriptionPlan,
+ c.TLSFingerprintProfile, c.UsageCleanupTask, c.UsageLog, c.User,
+ c.UserAllowedGroup, c.UserAttributeDefinition, c.UserAttributeValue,
c.UserPlatformQuota, c.UserSubscription,
} {
n.Intercept(interceptors...)
@@ -436,6 +456,12 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
return c.AuthIdentity.mutate(ctx, m)
case *AuthIdentityChannelMutation:
return c.AuthIdentityChannel.mutate(ctx, m)
+ case *BatchImageEventMutation:
+ return c.BatchImageEvent.mutate(ctx, m)
+ case *BatchImageItemMutation:
+ return c.BatchImageItem.mutate(ctx, m)
+ case *BatchImageJobMutation:
+ return c.BatchImageJob.mutate(ctx, m)
case *ChannelMonitorMutation:
return c.ChannelMonitor.mutate(ctx, m)
case *ChannelMonitorDailyRollupMutation:
@@ -1671,6 +1697,405 @@ func (c *AuthIdentityChannelClient) mutate(ctx context.Context, m *AuthIdentityC
}
}
+// BatchImageEventClient is a client for the BatchImageEvent schema.
+type BatchImageEventClient struct {
+ config
+}
+
+// NewBatchImageEventClient returns a client for the BatchImageEvent from the given config.
+func NewBatchImageEventClient(c config) *BatchImageEventClient {
+ return &BatchImageEventClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `batchimageevent.Hooks(f(g(h())))`.
+func (c *BatchImageEventClient) Use(hooks ...Hook) {
+ c.hooks.BatchImageEvent = append(c.hooks.BatchImageEvent, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `batchimageevent.Intercept(f(g(h())))`.
+func (c *BatchImageEventClient) Intercept(interceptors ...Interceptor) {
+ c.inters.BatchImageEvent = append(c.inters.BatchImageEvent, interceptors...)
+}
+
+// Create returns a builder for creating a BatchImageEvent entity.
+func (c *BatchImageEventClient) Create() *BatchImageEventCreate {
+ mutation := newBatchImageEventMutation(c.config, OpCreate)
+ return &BatchImageEventCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of BatchImageEvent entities.
+func (c *BatchImageEventClient) CreateBulk(builders ...*BatchImageEventCreate) *BatchImageEventCreateBulk {
+ return &BatchImageEventCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *BatchImageEventClient) MapCreateBulk(slice any, setFunc func(*BatchImageEventCreate, int)) *BatchImageEventCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &BatchImageEventCreateBulk{err: fmt.Errorf("calling to BatchImageEventClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*BatchImageEventCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &BatchImageEventCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for BatchImageEvent.
+func (c *BatchImageEventClient) Update() *BatchImageEventUpdate {
+ mutation := newBatchImageEventMutation(c.config, OpUpdate)
+ return &BatchImageEventUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *BatchImageEventClient) UpdateOne(_m *BatchImageEvent) *BatchImageEventUpdateOne {
+ mutation := newBatchImageEventMutation(c.config, OpUpdateOne, withBatchImageEvent(_m))
+ return &BatchImageEventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *BatchImageEventClient) UpdateOneID(id int64) *BatchImageEventUpdateOne {
+ mutation := newBatchImageEventMutation(c.config, OpUpdateOne, withBatchImageEventID(id))
+ return &BatchImageEventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for BatchImageEvent.
+func (c *BatchImageEventClient) Delete() *BatchImageEventDelete {
+ mutation := newBatchImageEventMutation(c.config, OpDelete)
+ return &BatchImageEventDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *BatchImageEventClient) DeleteOne(_m *BatchImageEvent) *BatchImageEventDeleteOne {
+ return c.DeleteOneID(_m.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *BatchImageEventClient) DeleteOneID(id int64) *BatchImageEventDeleteOne {
+ builder := c.Delete().Where(batchimageevent.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &BatchImageEventDeleteOne{builder}
+}
+
+// Query returns a query builder for BatchImageEvent.
+func (c *BatchImageEventClient) Query() *BatchImageEventQuery {
+ return &BatchImageEventQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeBatchImageEvent},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a BatchImageEvent entity by its id.
+func (c *BatchImageEventClient) Get(ctx context.Context, id int64) (*BatchImageEvent, error) {
+ return c.Query().Where(batchimageevent.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *BatchImageEventClient) GetX(ctx context.Context, id int64) *BatchImageEvent {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// Hooks returns the client hooks.
+func (c *BatchImageEventClient) Hooks() []Hook {
+ return c.hooks.BatchImageEvent
+}
+
+// Interceptors returns the client interceptors.
+func (c *BatchImageEventClient) Interceptors() []Interceptor {
+ return c.inters.BatchImageEvent
+}
+
+func (c *BatchImageEventClient) mutate(ctx context.Context, m *BatchImageEventMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&BatchImageEventCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&BatchImageEventUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&BatchImageEventUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&BatchImageEventDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown BatchImageEvent mutation op: %q", m.Op())
+ }
+}
+
+// BatchImageItemClient is a client for the BatchImageItem schema.
+type BatchImageItemClient struct {
+ config
+}
+
+// NewBatchImageItemClient returns a client for the BatchImageItem from the given config.
+func NewBatchImageItemClient(c config) *BatchImageItemClient {
+ return &BatchImageItemClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `batchimageitem.Hooks(f(g(h())))`.
+func (c *BatchImageItemClient) Use(hooks ...Hook) {
+ c.hooks.BatchImageItem = append(c.hooks.BatchImageItem, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `batchimageitem.Intercept(f(g(h())))`.
+func (c *BatchImageItemClient) Intercept(interceptors ...Interceptor) {
+ c.inters.BatchImageItem = append(c.inters.BatchImageItem, interceptors...)
+}
+
+// Create returns a builder for creating a BatchImageItem entity.
+func (c *BatchImageItemClient) Create() *BatchImageItemCreate {
+ mutation := newBatchImageItemMutation(c.config, OpCreate)
+ return &BatchImageItemCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of BatchImageItem entities.
+func (c *BatchImageItemClient) CreateBulk(builders ...*BatchImageItemCreate) *BatchImageItemCreateBulk {
+ return &BatchImageItemCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *BatchImageItemClient) MapCreateBulk(slice any, setFunc func(*BatchImageItemCreate, int)) *BatchImageItemCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &BatchImageItemCreateBulk{err: fmt.Errorf("calling to BatchImageItemClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*BatchImageItemCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &BatchImageItemCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for BatchImageItem.
+func (c *BatchImageItemClient) Update() *BatchImageItemUpdate {
+ mutation := newBatchImageItemMutation(c.config, OpUpdate)
+ return &BatchImageItemUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *BatchImageItemClient) UpdateOne(_m *BatchImageItem) *BatchImageItemUpdateOne {
+ mutation := newBatchImageItemMutation(c.config, OpUpdateOne, withBatchImageItem(_m))
+ return &BatchImageItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *BatchImageItemClient) UpdateOneID(id int64) *BatchImageItemUpdateOne {
+ mutation := newBatchImageItemMutation(c.config, OpUpdateOne, withBatchImageItemID(id))
+ return &BatchImageItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for BatchImageItem.
+func (c *BatchImageItemClient) Delete() *BatchImageItemDelete {
+ mutation := newBatchImageItemMutation(c.config, OpDelete)
+ return &BatchImageItemDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *BatchImageItemClient) DeleteOne(_m *BatchImageItem) *BatchImageItemDeleteOne {
+ return c.DeleteOneID(_m.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *BatchImageItemClient) DeleteOneID(id int64) *BatchImageItemDeleteOne {
+ builder := c.Delete().Where(batchimageitem.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &BatchImageItemDeleteOne{builder}
+}
+
+// Query returns a query builder for BatchImageItem.
+func (c *BatchImageItemClient) Query() *BatchImageItemQuery {
+ return &BatchImageItemQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeBatchImageItem},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a BatchImageItem entity by its id.
+func (c *BatchImageItemClient) Get(ctx context.Context, id int64) (*BatchImageItem, error) {
+ return c.Query().Where(batchimageitem.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *BatchImageItemClient) GetX(ctx context.Context, id int64) *BatchImageItem {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// Hooks returns the client hooks.
+func (c *BatchImageItemClient) Hooks() []Hook {
+ return c.hooks.BatchImageItem
+}
+
+// Interceptors returns the client interceptors.
+func (c *BatchImageItemClient) Interceptors() []Interceptor {
+ return c.inters.BatchImageItem
+}
+
+func (c *BatchImageItemClient) mutate(ctx context.Context, m *BatchImageItemMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&BatchImageItemCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&BatchImageItemUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&BatchImageItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&BatchImageItemDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown BatchImageItem mutation op: %q", m.Op())
+ }
+}
+
+// BatchImageJobClient is a client for the BatchImageJob schema.
+type BatchImageJobClient struct {
+ config
+}
+
+// NewBatchImageJobClient returns a client for the BatchImageJob from the given config.
+func NewBatchImageJobClient(c config) *BatchImageJobClient {
+ return &BatchImageJobClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `batchimagejob.Hooks(f(g(h())))`.
+func (c *BatchImageJobClient) Use(hooks ...Hook) {
+ c.hooks.BatchImageJob = append(c.hooks.BatchImageJob, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `batchimagejob.Intercept(f(g(h())))`.
+func (c *BatchImageJobClient) Intercept(interceptors ...Interceptor) {
+ c.inters.BatchImageJob = append(c.inters.BatchImageJob, interceptors...)
+}
+
+// Create returns a builder for creating a BatchImageJob entity.
+func (c *BatchImageJobClient) Create() *BatchImageJobCreate {
+ mutation := newBatchImageJobMutation(c.config, OpCreate)
+ return &BatchImageJobCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of BatchImageJob entities.
+func (c *BatchImageJobClient) CreateBulk(builders ...*BatchImageJobCreate) *BatchImageJobCreateBulk {
+ return &BatchImageJobCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *BatchImageJobClient) MapCreateBulk(slice any, setFunc func(*BatchImageJobCreate, int)) *BatchImageJobCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &BatchImageJobCreateBulk{err: fmt.Errorf("calling to BatchImageJobClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*BatchImageJobCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &BatchImageJobCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for BatchImageJob.
+func (c *BatchImageJobClient) Update() *BatchImageJobUpdate {
+ mutation := newBatchImageJobMutation(c.config, OpUpdate)
+ return &BatchImageJobUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *BatchImageJobClient) UpdateOne(_m *BatchImageJob) *BatchImageJobUpdateOne {
+ mutation := newBatchImageJobMutation(c.config, OpUpdateOne, withBatchImageJob(_m))
+ return &BatchImageJobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *BatchImageJobClient) UpdateOneID(id int64) *BatchImageJobUpdateOne {
+ mutation := newBatchImageJobMutation(c.config, OpUpdateOne, withBatchImageJobID(id))
+ return &BatchImageJobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for BatchImageJob.
+func (c *BatchImageJobClient) Delete() *BatchImageJobDelete {
+ mutation := newBatchImageJobMutation(c.config, OpDelete)
+ return &BatchImageJobDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *BatchImageJobClient) DeleteOne(_m *BatchImageJob) *BatchImageJobDeleteOne {
+ return c.DeleteOneID(_m.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *BatchImageJobClient) DeleteOneID(id int64) *BatchImageJobDeleteOne {
+ builder := c.Delete().Where(batchimagejob.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &BatchImageJobDeleteOne{builder}
+}
+
+// Query returns a query builder for BatchImageJob.
+func (c *BatchImageJobClient) Query() *BatchImageJobQuery {
+ return &BatchImageJobQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeBatchImageJob},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a BatchImageJob entity by its id.
+func (c *BatchImageJobClient) Get(ctx context.Context, id int64) (*BatchImageJob, error) {
+ return c.Query().Where(batchimagejob.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *BatchImageJobClient) GetX(ctx context.Context, id int64) *BatchImageJob {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// Hooks returns the client hooks.
+func (c *BatchImageJobClient) Hooks() []Hook {
+ return c.hooks.BatchImageJob
+}
+
+// Interceptors returns the client interceptors.
+func (c *BatchImageJobClient) Interceptors() []Interceptor {
+ return c.inters.BatchImageJob
+}
+
+func (c *BatchImageJobClient) mutate(ctx context.Context, m *BatchImageJobMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&BatchImageJobCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&BatchImageJobUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&BatchImageJobUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&BatchImageJobDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown BatchImageJob mutation op: %q", m.Op())
+ }
+}
+
// ChannelMonitorClient is a client for the ChannelMonitor schema.
type ChannelMonitorClient struct {
config
@@ -6242,25 +6667,25 @@ func (c *UserSubscriptionClient) mutate(ctx context.Context, m *UserSubscription
type (
hooks struct {
APIKey, Account, AccountGroup, Announcement, AnnouncementRead, AuthIdentity,
- AuthIdentityChannel, ChannelMonitor, ChannelMonitorDailyRollup,
- ChannelMonitorHistory, ChannelMonitorRequestTemplate, ErrorPassthroughRule,
- Group, IdempotencyRecord, IdentityAdoptionDecision, PaymentAuditLog,
- PaymentOrder, PaymentProviderInstance, PendingAuthSession, PromoCode,
- PromoCodeUsage, Proxy, RedeemCode, SecuritySecret, Setting, SubscriptionPlan,
- TLSFingerprintProfile, UsageCleanupTask, UsageLog, User, UserAllowedGroup,
- UserAttributeDefinition, UserAttributeValue, UserPlatformQuota,
- UserSubscription []ent.Hook
+ AuthIdentityChannel, BatchImageEvent, BatchImageItem, BatchImageJob,
+ ChannelMonitor, ChannelMonitorDailyRollup, ChannelMonitorHistory,
+ ChannelMonitorRequestTemplate, ErrorPassthroughRule, Group, IdempotencyRecord,
+ IdentityAdoptionDecision, PaymentAuditLog, PaymentOrder,
+ PaymentProviderInstance, PendingAuthSession, PromoCode, PromoCodeUsage, Proxy,
+ RedeemCode, SecuritySecret, Setting, SubscriptionPlan, TLSFingerprintProfile,
+ UsageCleanupTask, UsageLog, User, UserAllowedGroup, UserAttributeDefinition,
+ UserAttributeValue, UserPlatformQuota, UserSubscription []ent.Hook
}
inters struct {
APIKey, Account, AccountGroup, Announcement, AnnouncementRead, AuthIdentity,
- AuthIdentityChannel, ChannelMonitor, ChannelMonitorDailyRollup,
- ChannelMonitorHistory, ChannelMonitorRequestTemplate, ErrorPassthroughRule,
- Group, IdempotencyRecord, IdentityAdoptionDecision, PaymentAuditLog,
- PaymentOrder, PaymentProviderInstance, PendingAuthSession, PromoCode,
- PromoCodeUsage, Proxy, RedeemCode, SecuritySecret, Setting, SubscriptionPlan,
- TLSFingerprintProfile, UsageCleanupTask, UsageLog, User, UserAllowedGroup,
- UserAttributeDefinition, UserAttributeValue, UserPlatformQuota,
- UserSubscription []ent.Interceptor
+ AuthIdentityChannel, BatchImageEvent, BatchImageItem, BatchImageJob,
+ ChannelMonitor, ChannelMonitorDailyRollup, ChannelMonitorHistory,
+ ChannelMonitorRequestTemplate, ErrorPassthroughRule, Group, IdempotencyRecord,
+ IdentityAdoptionDecision, PaymentAuditLog, PaymentOrder,
+ PaymentProviderInstance, PendingAuthSession, PromoCode, PromoCodeUsage, Proxy,
+ RedeemCode, SecuritySecret, Setting, SubscriptionPlan, TLSFingerprintProfile,
+ UsageCleanupTask, UsageLog, User, UserAllowedGroup, UserAttributeDefinition,
+ UserAttributeValue, UserPlatformQuota, UserSubscription []ent.Interceptor
}
)
diff --git a/backend/ent/ent.go b/backend/ent/ent.go
index 33d36e70ee..d23f61327f 100644
--- a/backend/ent/ent.go
+++ b/backend/ent/ent.go
@@ -19,6 +19,9 @@ import (
"github.com/Wei-Shaw/sub2api/ent/apikey"
"github.com/Wei-Shaw/sub2api/ent/authidentity"
"github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
@@ -114,6 +117,9 @@ func checkColumn(t, c string) error {
announcementread.Table: announcementread.ValidColumn,
authidentity.Table: authidentity.ValidColumn,
authidentitychannel.Table: authidentitychannel.ValidColumn,
+ batchimageevent.Table: batchimageevent.ValidColumn,
+ batchimageitem.Table: batchimageitem.ValidColumn,
+ batchimagejob.Table: batchimagejob.ValidColumn,
channelmonitor.Table: channelmonitor.ValidColumn,
channelmonitordailyrollup.Table: channelmonitordailyrollup.ValidColumn,
channelmonitorhistory.Table: channelmonitorhistory.ValidColumn,
diff --git a/backend/ent/group.go b/backend/ent/group.go
index 172b67777e..5bec594977 100644
--- a/backend/ent/group.go
+++ b/backend/ent/group.go
@@ -33,9 +33,9 @@ type Group struct {
RateMultiplier float64 `json:"rate_multiplier,omitempty"`
// 是否启用高峰时段倍率
PeakRateEnabled bool `json:"peak_rate_enabled,omitempty"`
- // 高峰开始时间 HH:MM(含),如 14:00;空表示未配置
+ // 高峰开始时间 HH:MM(含),如 14:00;空表示未配置;不支持跨天
PeakStart string `json:"peak_start,omitempty"`
- // 高峰结束时间 HH:MM(不含),如 18:00
+ // 高峰结束时间 HH:MM(不含),必须大于 peak_start;不支持跨天,如 22:00-02:00
PeakEnd string `json:"peak_end,omitempty"`
// 高峰时段叠加倍率,仅在 peak_rate_enabled 且处于 [peak_start, peak_end) 时乘入文本倍率
PeakRateMultiplier float64 `json:"peak_rate_multiplier,omitempty"`
@@ -57,6 +57,8 @@ type Group struct {
DefaultValidityDays int `json:"default_validity_days,omitempty"`
// 是否允许该分组使用图片生成能力
AllowImageGeneration bool `json:"allow_image_generation,omitempty"`
+ // 是否允许该分组使用批量图片生成能力
+ AllowBatchImageGeneration bool `json:"allow_batch_image_generation,omitempty"`
// 图片生成是否使用独立倍率;false 表示共享分组有效倍率
ImageRateIndependent bool `json:"image_rate_independent,omitempty"`
// 图片生成独立倍率,仅 image_rate_independent=true 时生效
@@ -67,6 +69,20 @@ type Group struct {
ImagePrice2k *float64 `json:"image_price_2k,omitempty"`
// ImagePrice4k holds the value of the "image_price_4k" field.
ImagePrice4k *float64 `json:"image_price_4k,omitempty"`
+ // 批量图片生成折扣倍率,最终单价会乘以该值;0 表示免费
+ BatchImageDiscountMultiplier float64 `json:"batch_image_discount_multiplier,omitempty"`
+ // 批量图片生成冻结价格比例,按普通生图原价乘以该比例冻结,结算后释放差额
+ BatchImageHoldMultiplier float64 `json:"batch_image_hold_multiplier,omitempty"`
+ // 视频生成是否使用独立倍率;false 表示共享分组有效倍率
+ VideoRateIndependent bool `json:"video_rate_independent,omitempty"`
+ // 视频生成独立倍率,仅 video_rate_independent=true 时生效
+ VideoRateMultiplier float64 `json:"video_rate_multiplier,omitempty"`
+ // VideoPrice480p holds the value of the "video_price_480p" field.
+ VideoPrice480p *float64 `json:"video_price_480p,omitempty"`
+ // VideoPrice720p holds the value of the "video_price_720p" field.
+ VideoPrice720p *float64 `json:"video_price_720p,omitempty"`
+ // VideoPrice1080p holds the value of the "video_price_1080p" field.
+ VideoPrice1080p *float64 `json:"video_price_1080p,omitempty"`
// 是否仅允许 Claude Code 客户端
ClaudeCodeOnly bool `json:"claude_code_only,omitempty"`
// 非 Claude Code 请求降级使用的分组 ID
@@ -205,9 +221,9 @@ func (*Group) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case group.FieldModelRouting, group.FieldSupportedModelScopes, group.FieldMessagesDispatchModelConfig, group.FieldModelsListConfig:
values[i] = new([]byte)
- case group.FieldPeakRateEnabled, group.FieldIsExclusive, group.FieldAllowImageGeneration, group.FieldImageRateIndependent, group.FieldClaudeCodeOnly, group.FieldModelRoutingEnabled, group.FieldMcpXMLInject, group.FieldAllowMessagesDispatch, group.FieldRequireOauthOnly, group.FieldRequirePrivacySet:
+ case group.FieldPeakRateEnabled, group.FieldIsExclusive, group.FieldAllowImageGeneration, group.FieldAllowBatchImageGeneration, group.FieldImageRateIndependent, group.FieldVideoRateIndependent, group.FieldClaudeCodeOnly, group.FieldModelRoutingEnabled, group.FieldMcpXMLInject, group.FieldAllowMessagesDispatch, group.FieldRequireOauthOnly, group.FieldRequirePrivacySet:
values[i] = new(sql.NullBool)
- case group.FieldRateMultiplier, group.FieldPeakRateMultiplier, group.FieldDailyLimitUsd, group.FieldWeeklyLimitUsd, group.FieldMonthlyLimitUsd, group.FieldImageRateMultiplier, group.FieldImagePrice1k, group.FieldImagePrice2k, group.FieldImagePrice4k:
+ case group.FieldRateMultiplier, group.FieldPeakRateMultiplier, group.FieldDailyLimitUsd, group.FieldWeeklyLimitUsd, group.FieldMonthlyLimitUsd, group.FieldImageRateMultiplier, group.FieldImagePrice1k, group.FieldImagePrice2k, group.FieldImagePrice4k, group.FieldBatchImageDiscountMultiplier, group.FieldBatchImageHoldMultiplier, group.FieldVideoRateMultiplier, group.FieldVideoPrice480p, group.FieldVideoPrice720p, group.FieldVideoPrice1080p:
values[i] = new(sql.NullFloat64)
case group.FieldID, group.FieldDefaultValidityDays, group.FieldFallbackGroupID, group.FieldFallbackGroupIDOnInvalidRequest, group.FieldSortOrder, group.FieldRpmLimit:
values[i] = new(sql.NullInt64)
@@ -355,6 +371,12 @@ func (_m *Group) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.AllowImageGeneration = value.Bool
}
+ case group.FieldAllowBatchImageGeneration:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field allow_batch_image_generation", values[i])
+ } else if value.Valid {
+ _m.AllowBatchImageGeneration = value.Bool
+ }
case group.FieldImageRateIndependent:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field image_rate_independent", values[i])
@@ -388,6 +410,51 @@ func (_m *Group) assignValues(columns []string, values []any) error {
_m.ImagePrice4k = new(float64)
*_m.ImagePrice4k = value.Float64
}
+ case group.FieldBatchImageDiscountMultiplier:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field batch_image_discount_multiplier", values[i])
+ } else if value.Valid {
+ _m.BatchImageDiscountMultiplier = value.Float64
+ }
+ case group.FieldBatchImageHoldMultiplier:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field batch_image_hold_multiplier", values[i])
+ } else if value.Valid {
+ _m.BatchImageHoldMultiplier = value.Float64
+ }
+ case group.FieldVideoRateIndependent:
+ if value, ok := values[i].(*sql.NullBool); !ok {
+ return fmt.Errorf("unexpected type %T for field video_rate_independent", values[i])
+ } else if value.Valid {
+ _m.VideoRateIndependent = value.Bool
+ }
+ case group.FieldVideoRateMultiplier:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field video_rate_multiplier", values[i])
+ } else if value.Valid {
+ _m.VideoRateMultiplier = value.Float64
+ }
+ case group.FieldVideoPrice480p:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field video_price_480p", values[i])
+ } else if value.Valid {
+ _m.VideoPrice480p = new(float64)
+ *_m.VideoPrice480p = value.Float64
+ }
+ case group.FieldVideoPrice720p:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field video_price_720p", values[i])
+ } else if value.Valid {
+ _m.VideoPrice720p = new(float64)
+ *_m.VideoPrice720p = value.Float64
+ }
+ case group.FieldVideoPrice1080p:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field video_price_1080p", values[i])
+ } else if value.Valid {
+ _m.VideoPrice1080p = new(float64)
+ *_m.VideoPrice1080p = value.Float64
+ }
case group.FieldClaudeCodeOnly:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field claude_code_only", values[i])
@@ -631,6 +698,9 @@ func (_m *Group) String() string {
builder.WriteString("allow_image_generation=")
builder.WriteString(fmt.Sprintf("%v", _m.AllowImageGeneration))
builder.WriteString(", ")
+ builder.WriteString("allow_batch_image_generation=")
+ builder.WriteString(fmt.Sprintf("%v", _m.AllowBatchImageGeneration))
+ builder.WriteString(", ")
builder.WriteString("image_rate_independent=")
builder.WriteString(fmt.Sprintf("%v", _m.ImageRateIndependent))
builder.WriteString(", ")
@@ -652,6 +722,33 @@ func (_m *Group) String() string {
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteString(", ")
+ builder.WriteString("batch_image_discount_multiplier=")
+ builder.WriteString(fmt.Sprintf("%v", _m.BatchImageDiscountMultiplier))
+ builder.WriteString(", ")
+ builder.WriteString("batch_image_hold_multiplier=")
+ builder.WriteString(fmt.Sprintf("%v", _m.BatchImageHoldMultiplier))
+ builder.WriteString(", ")
+ builder.WriteString("video_rate_independent=")
+ builder.WriteString(fmt.Sprintf("%v", _m.VideoRateIndependent))
+ builder.WriteString(", ")
+ builder.WriteString("video_rate_multiplier=")
+ builder.WriteString(fmt.Sprintf("%v", _m.VideoRateMultiplier))
+ builder.WriteString(", ")
+ if v := _m.VideoPrice480p; v != nil {
+ builder.WriteString("video_price_480p=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ if v := _m.VideoPrice720p; v != nil {
+ builder.WriteString("video_price_720p=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
+ if v := _m.VideoPrice1080p; v != nil {
+ builder.WriteString("video_price_1080p=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
builder.WriteString("claude_code_only=")
builder.WriteString(fmt.Sprintf("%v", _m.ClaudeCodeOnly))
builder.WriteString(", ")
diff --git a/backend/ent/group/group.go b/backend/ent/group/group.go
index bc95af71b6..769c63e6b1 100644
--- a/backend/ent/group/group.go
+++ b/backend/ent/group/group.go
@@ -54,6 +54,8 @@ const (
FieldDefaultValidityDays = "default_validity_days"
// FieldAllowImageGeneration holds the string denoting the allow_image_generation field in the database.
FieldAllowImageGeneration = "allow_image_generation"
+ // FieldAllowBatchImageGeneration holds the string denoting the allow_batch_image_generation field in the database.
+ FieldAllowBatchImageGeneration = "allow_batch_image_generation"
// FieldImageRateIndependent holds the string denoting the image_rate_independent field in the database.
FieldImageRateIndependent = "image_rate_independent"
// FieldImageRateMultiplier holds the string denoting the image_rate_multiplier field in the database.
@@ -64,6 +66,20 @@ const (
FieldImagePrice2k = "image_price_2k"
// FieldImagePrice4k holds the string denoting the image_price_4k field in the database.
FieldImagePrice4k = "image_price_4k"
+ // FieldBatchImageDiscountMultiplier holds the string denoting the batch_image_discount_multiplier field in the database.
+ FieldBatchImageDiscountMultiplier = "batch_image_discount_multiplier"
+ // FieldBatchImageHoldMultiplier holds the string denoting the batch_image_hold_multiplier field in the database.
+ FieldBatchImageHoldMultiplier = "batch_image_hold_multiplier"
+ // FieldVideoRateIndependent holds the string denoting the video_rate_independent field in the database.
+ FieldVideoRateIndependent = "video_rate_independent"
+ // FieldVideoRateMultiplier holds the string denoting the video_rate_multiplier field in the database.
+ FieldVideoRateMultiplier = "video_rate_multiplier"
+ // FieldVideoPrice480p holds the string denoting the video_price_480p field in the database.
+ FieldVideoPrice480p = "video_price_480p"
+ // FieldVideoPrice720p holds the string denoting the video_price_720p field in the database.
+ FieldVideoPrice720p = "video_price_720p"
+ // FieldVideoPrice1080p holds the string denoting the video_price_1080p field in the database.
+ FieldVideoPrice1080p = "video_price_1080p"
// FieldClaudeCodeOnly holds the string denoting the claude_code_only field in the database.
FieldClaudeCodeOnly = "claude_code_only"
// FieldFallbackGroupID holds the string denoting the fallback_group_id field in the database.
@@ -188,11 +204,19 @@ var Columns = []string{
FieldMonthlyLimitUsd,
FieldDefaultValidityDays,
FieldAllowImageGeneration,
+ FieldAllowBatchImageGeneration,
FieldImageRateIndependent,
FieldImageRateMultiplier,
FieldImagePrice1k,
FieldImagePrice2k,
FieldImagePrice4k,
+ FieldBatchImageDiscountMultiplier,
+ FieldBatchImageHoldMultiplier,
+ FieldVideoRateIndependent,
+ FieldVideoRateMultiplier,
+ FieldVideoPrice480p,
+ FieldVideoPrice720p,
+ FieldVideoPrice1080p,
FieldClaudeCodeOnly,
FieldFallbackGroupID,
FieldFallbackGroupIDOnInvalidRequest,
@@ -277,10 +301,20 @@ var (
DefaultDefaultValidityDays int
// DefaultAllowImageGeneration holds the default value on creation for the "allow_image_generation" field.
DefaultAllowImageGeneration bool
+ // DefaultAllowBatchImageGeneration holds the default value on creation for the "allow_batch_image_generation" field.
+ DefaultAllowBatchImageGeneration bool
// DefaultImageRateIndependent holds the default value on creation for the "image_rate_independent" field.
DefaultImageRateIndependent bool
// DefaultImageRateMultiplier holds the default value on creation for the "image_rate_multiplier" field.
DefaultImageRateMultiplier float64
+ // DefaultBatchImageDiscountMultiplier holds the default value on creation for the "batch_image_discount_multiplier" field.
+ DefaultBatchImageDiscountMultiplier float64
+ // DefaultBatchImageHoldMultiplier holds the default value on creation for the "batch_image_hold_multiplier" field.
+ DefaultBatchImageHoldMultiplier float64
+ // DefaultVideoRateIndependent holds the default value on creation for the "video_rate_independent" field.
+ DefaultVideoRateIndependent bool
+ // DefaultVideoRateMultiplier holds the default value on creation for the "video_rate_multiplier" field.
+ DefaultVideoRateMultiplier float64
// DefaultClaudeCodeOnly holds the default value on creation for the "claude_code_only" field.
DefaultClaudeCodeOnly bool
// DefaultModelRoutingEnabled holds the default value on creation for the "model_routing_enabled" field.
@@ -412,6 +446,11 @@ func ByAllowImageGeneration(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAllowImageGeneration, opts...).ToFunc()
}
+// ByAllowBatchImageGeneration orders the results by the allow_batch_image_generation field.
+func ByAllowBatchImageGeneration(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldAllowBatchImageGeneration, opts...).ToFunc()
+}
+
// ByImageRateIndependent orders the results by the image_rate_independent field.
func ByImageRateIndependent(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImageRateIndependent, opts...).ToFunc()
@@ -437,6 +476,41 @@ func ByImagePrice4k(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImagePrice4k, opts...).ToFunc()
}
+// ByBatchImageDiscountMultiplier orders the results by the batch_image_discount_multiplier field.
+func ByBatchImageDiscountMultiplier(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldBatchImageDiscountMultiplier, opts...).ToFunc()
+}
+
+// ByBatchImageHoldMultiplier orders the results by the batch_image_hold_multiplier field.
+func ByBatchImageHoldMultiplier(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldBatchImageHoldMultiplier, opts...).ToFunc()
+}
+
+// ByVideoRateIndependent orders the results by the video_rate_independent field.
+func ByVideoRateIndependent(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoRateIndependent, opts...).ToFunc()
+}
+
+// ByVideoRateMultiplier orders the results by the video_rate_multiplier field.
+func ByVideoRateMultiplier(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoRateMultiplier, opts...).ToFunc()
+}
+
+// ByVideoPrice480p orders the results by the video_price_480p field.
+func ByVideoPrice480p(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoPrice480p, opts...).ToFunc()
+}
+
+// ByVideoPrice720p orders the results by the video_price_720p field.
+func ByVideoPrice720p(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoPrice720p, opts...).ToFunc()
+}
+
+// ByVideoPrice1080p orders the results by the video_price_1080p field.
+func ByVideoPrice1080p(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoPrice1080p, opts...).ToFunc()
+}
+
// ByClaudeCodeOnly orders the results by the claude_code_only field.
func ByClaudeCodeOnly(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldClaudeCodeOnly, opts...).ToFunc()
diff --git a/backend/ent/group/where.go b/backend/ent/group/where.go
index 4a7fc01991..5a9d92d0f4 100644
--- a/backend/ent/group/where.go
+++ b/backend/ent/group/where.go
@@ -150,6 +150,11 @@ func AllowImageGeneration(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldAllowImageGeneration, v))
}
+// AllowBatchImageGeneration applies equality check predicate on the "allow_batch_image_generation" field. It's identical to AllowBatchImageGenerationEQ.
+func AllowBatchImageGeneration(v bool) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldAllowBatchImageGeneration, v))
+}
+
// ImageRateIndependent applies equality check predicate on the "image_rate_independent" field. It's identical to ImageRateIndependentEQ.
func ImageRateIndependent(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImageRateIndependent, v))
@@ -175,6 +180,41 @@ func ImagePrice4k(v float64) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImagePrice4k, v))
}
+// BatchImageDiscountMultiplier applies equality check predicate on the "batch_image_discount_multiplier" field. It's identical to BatchImageDiscountMultiplierEQ.
+func BatchImageDiscountMultiplier(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldBatchImageDiscountMultiplier, v))
+}
+
+// BatchImageHoldMultiplier applies equality check predicate on the "batch_image_hold_multiplier" field. It's identical to BatchImageHoldMultiplierEQ.
+func BatchImageHoldMultiplier(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldBatchImageHoldMultiplier, v))
+}
+
+// VideoRateIndependent applies equality check predicate on the "video_rate_independent" field. It's identical to VideoRateIndependentEQ.
+func VideoRateIndependent(v bool) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoRateIndependent, v))
+}
+
+// VideoRateMultiplier applies equality check predicate on the "video_rate_multiplier" field. It's identical to VideoRateMultiplierEQ.
+func VideoRateMultiplier(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoRateMultiplier, v))
+}
+
+// VideoPrice480p applies equality check predicate on the "video_price_480p" field. It's identical to VideoPrice480pEQ.
+func VideoPrice480p(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoPrice480p, v))
+}
+
+// VideoPrice720p applies equality check predicate on the "video_price_720p" field. It's identical to VideoPrice720pEQ.
+func VideoPrice720p(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoPrice720p, v))
+}
+
+// VideoPrice1080p applies equality check predicate on the "video_price_1080p" field. It's identical to VideoPrice1080pEQ.
+func VideoPrice1080p(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoPrice1080p, v))
+}
+
// ClaudeCodeOnly applies equality check predicate on the "claude_code_only" field. It's identical to ClaudeCodeOnlyEQ.
func ClaudeCodeOnly(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldClaudeCodeOnly, v))
@@ -1125,6 +1165,16 @@ func AllowImageGenerationNEQ(v bool) predicate.Group {
return predicate.Group(sql.FieldNEQ(FieldAllowImageGeneration, v))
}
+// AllowBatchImageGenerationEQ applies the EQ predicate on the "allow_batch_image_generation" field.
+func AllowBatchImageGenerationEQ(v bool) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldAllowBatchImageGeneration, v))
+}
+
+// AllowBatchImageGenerationNEQ applies the NEQ predicate on the "allow_batch_image_generation" field.
+func AllowBatchImageGenerationNEQ(v bool) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldAllowBatchImageGeneration, v))
+}
+
// ImageRateIndependentEQ applies the EQ predicate on the "image_rate_independent" field.
func ImageRateIndependentEQ(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldImageRateIndependent, v))
@@ -1325,6 +1375,286 @@ func ImagePrice4kNotNil() predicate.Group {
return predicate.Group(sql.FieldNotNull(FieldImagePrice4k))
}
+// BatchImageDiscountMultiplierEQ applies the EQ predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldBatchImageDiscountMultiplier, v))
+}
+
+// BatchImageDiscountMultiplierNEQ applies the NEQ predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierNEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldBatchImageDiscountMultiplier, v))
+}
+
+// BatchImageDiscountMultiplierIn applies the In predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldIn(FieldBatchImageDiscountMultiplier, vs...))
+}
+
+// BatchImageDiscountMultiplierNotIn applies the NotIn predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierNotIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldNotIn(FieldBatchImageDiscountMultiplier, vs...))
+}
+
+// BatchImageDiscountMultiplierGT applies the GT predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierGT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGT(FieldBatchImageDiscountMultiplier, v))
+}
+
+// BatchImageDiscountMultiplierGTE applies the GTE predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierGTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGTE(FieldBatchImageDiscountMultiplier, v))
+}
+
+// BatchImageDiscountMultiplierLT applies the LT predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierLT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLT(FieldBatchImageDiscountMultiplier, v))
+}
+
+// BatchImageDiscountMultiplierLTE applies the LTE predicate on the "batch_image_discount_multiplier" field.
+func BatchImageDiscountMultiplierLTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLTE(FieldBatchImageDiscountMultiplier, v))
+}
+
+// BatchImageHoldMultiplierEQ applies the EQ predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldBatchImageHoldMultiplier, v))
+}
+
+// BatchImageHoldMultiplierNEQ applies the NEQ predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierNEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldBatchImageHoldMultiplier, v))
+}
+
+// BatchImageHoldMultiplierIn applies the In predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldIn(FieldBatchImageHoldMultiplier, vs...))
+}
+
+// BatchImageHoldMultiplierNotIn applies the NotIn predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierNotIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldNotIn(FieldBatchImageHoldMultiplier, vs...))
+}
+
+// BatchImageHoldMultiplierGT applies the GT predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierGT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGT(FieldBatchImageHoldMultiplier, v))
+}
+
+// BatchImageHoldMultiplierGTE applies the GTE predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierGTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGTE(FieldBatchImageHoldMultiplier, v))
+}
+
+// BatchImageHoldMultiplierLT applies the LT predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierLT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLT(FieldBatchImageHoldMultiplier, v))
+}
+
+// BatchImageHoldMultiplierLTE applies the LTE predicate on the "batch_image_hold_multiplier" field.
+func BatchImageHoldMultiplierLTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLTE(FieldBatchImageHoldMultiplier, v))
+}
+
+// VideoRateIndependentEQ applies the EQ predicate on the "video_rate_independent" field.
+func VideoRateIndependentEQ(v bool) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoRateIndependent, v))
+}
+
+// VideoRateIndependentNEQ applies the NEQ predicate on the "video_rate_independent" field.
+func VideoRateIndependentNEQ(v bool) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldVideoRateIndependent, v))
+}
+
+// VideoRateMultiplierEQ applies the EQ predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoRateMultiplier, v))
+}
+
+// VideoRateMultiplierNEQ applies the NEQ predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierNEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldVideoRateMultiplier, v))
+}
+
+// VideoRateMultiplierIn applies the In predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldIn(FieldVideoRateMultiplier, vs...))
+}
+
+// VideoRateMultiplierNotIn applies the NotIn predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierNotIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldNotIn(FieldVideoRateMultiplier, vs...))
+}
+
+// VideoRateMultiplierGT applies the GT predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierGT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGT(FieldVideoRateMultiplier, v))
+}
+
+// VideoRateMultiplierGTE applies the GTE predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierGTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGTE(FieldVideoRateMultiplier, v))
+}
+
+// VideoRateMultiplierLT applies the LT predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierLT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLT(FieldVideoRateMultiplier, v))
+}
+
+// VideoRateMultiplierLTE applies the LTE predicate on the "video_rate_multiplier" field.
+func VideoRateMultiplierLTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLTE(FieldVideoRateMultiplier, v))
+}
+
+// VideoPrice480pEQ applies the EQ predicate on the "video_price_480p" field.
+func VideoPrice480pEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoPrice480p, v))
+}
+
+// VideoPrice480pNEQ applies the NEQ predicate on the "video_price_480p" field.
+func VideoPrice480pNEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldVideoPrice480p, v))
+}
+
+// VideoPrice480pIn applies the In predicate on the "video_price_480p" field.
+func VideoPrice480pIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldIn(FieldVideoPrice480p, vs...))
+}
+
+// VideoPrice480pNotIn applies the NotIn predicate on the "video_price_480p" field.
+func VideoPrice480pNotIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldNotIn(FieldVideoPrice480p, vs...))
+}
+
+// VideoPrice480pGT applies the GT predicate on the "video_price_480p" field.
+func VideoPrice480pGT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGT(FieldVideoPrice480p, v))
+}
+
+// VideoPrice480pGTE applies the GTE predicate on the "video_price_480p" field.
+func VideoPrice480pGTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGTE(FieldVideoPrice480p, v))
+}
+
+// VideoPrice480pLT applies the LT predicate on the "video_price_480p" field.
+func VideoPrice480pLT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLT(FieldVideoPrice480p, v))
+}
+
+// VideoPrice480pLTE applies the LTE predicate on the "video_price_480p" field.
+func VideoPrice480pLTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLTE(FieldVideoPrice480p, v))
+}
+
+// VideoPrice480pIsNil applies the IsNil predicate on the "video_price_480p" field.
+func VideoPrice480pIsNil() predicate.Group {
+ return predicate.Group(sql.FieldIsNull(FieldVideoPrice480p))
+}
+
+// VideoPrice480pNotNil applies the NotNil predicate on the "video_price_480p" field.
+func VideoPrice480pNotNil() predicate.Group {
+ return predicate.Group(sql.FieldNotNull(FieldVideoPrice480p))
+}
+
+// VideoPrice720pEQ applies the EQ predicate on the "video_price_720p" field.
+func VideoPrice720pEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoPrice720p, v))
+}
+
+// VideoPrice720pNEQ applies the NEQ predicate on the "video_price_720p" field.
+func VideoPrice720pNEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldVideoPrice720p, v))
+}
+
+// VideoPrice720pIn applies the In predicate on the "video_price_720p" field.
+func VideoPrice720pIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldIn(FieldVideoPrice720p, vs...))
+}
+
+// VideoPrice720pNotIn applies the NotIn predicate on the "video_price_720p" field.
+func VideoPrice720pNotIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldNotIn(FieldVideoPrice720p, vs...))
+}
+
+// VideoPrice720pGT applies the GT predicate on the "video_price_720p" field.
+func VideoPrice720pGT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGT(FieldVideoPrice720p, v))
+}
+
+// VideoPrice720pGTE applies the GTE predicate on the "video_price_720p" field.
+func VideoPrice720pGTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGTE(FieldVideoPrice720p, v))
+}
+
+// VideoPrice720pLT applies the LT predicate on the "video_price_720p" field.
+func VideoPrice720pLT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLT(FieldVideoPrice720p, v))
+}
+
+// VideoPrice720pLTE applies the LTE predicate on the "video_price_720p" field.
+func VideoPrice720pLTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLTE(FieldVideoPrice720p, v))
+}
+
+// VideoPrice720pIsNil applies the IsNil predicate on the "video_price_720p" field.
+func VideoPrice720pIsNil() predicate.Group {
+ return predicate.Group(sql.FieldIsNull(FieldVideoPrice720p))
+}
+
+// VideoPrice720pNotNil applies the NotNil predicate on the "video_price_720p" field.
+func VideoPrice720pNotNil() predicate.Group {
+ return predicate.Group(sql.FieldNotNull(FieldVideoPrice720p))
+}
+
+// VideoPrice1080pEQ applies the EQ predicate on the "video_price_1080p" field.
+func VideoPrice1080pEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldEQ(FieldVideoPrice1080p, v))
+}
+
+// VideoPrice1080pNEQ applies the NEQ predicate on the "video_price_1080p" field.
+func VideoPrice1080pNEQ(v float64) predicate.Group {
+ return predicate.Group(sql.FieldNEQ(FieldVideoPrice1080p, v))
+}
+
+// VideoPrice1080pIn applies the In predicate on the "video_price_1080p" field.
+func VideoPrice1080pIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldIn(FieldVideoPrice1080p, vs...))
+}
+
+// VideoPrice1080pNotIn applies the NotIn predicate on the "video_price_1080p" field.
+func VideoPrice1080pNotIn(vs ...float64) predicate.Group {
+ return predicate.Group(sql.FieldNotIn(FieldVideoPrice1080p, vs...))
+}
+
+// VideoPrice1080pGT applies the GT predicate on the "video_price_1080p" field.
+func VideoPrice1080pGT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGT(FieldVideoPrice1080p, v))
+}
+
+// VideoPrice1080pGTE applies the GTE predicate on the "video_price_1080p" field.
+func VideoPrice1080pGTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldGTE(FieldVideoPrice1080p, v))
+}
+
+// VideoPrice1080pLT applies the LT predicate on the "video_price_1080p" field.
+func VideoPrice1080pLT(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLT(FieldVideoPrice1080p, v))
+}
+
+// VideoPrice1080pLTE applies the LTE predicate on the "video_price_1080p" field.
+func VideoPrice1080pLTE(v float64) predicate.Group {
+ return predicate.Group(sql.FieldLTE(FieldVideoPrice1080p, v))
+}
+
+// VideoPrice1080pIsNil applies the IsNil predicate on the "video_price_1080p" field.
+func VideoPrice1080pIsNil() predicate.Group {
+ return predicate.Group(sql.FieldIsNull(FieldVideoPrice1080p))
+}
+
+// VideoPrice1080pNotNil applies the NotNil predicate on the "video_price_1080p" field.
+func VideoPrice1080pNotNil() predicate.Group {
+ return predicate.Group(sql.FieldNotNull(FieldVideoPrice1080p))
+}
+
// ClaudeCodeOnlyEQ applies the EQ predicate on the "claude_code_only" field.
func ClaudeCodeOnlyEQ(v bool) predicate.Group {
return predicate.Group(sql.FieldEQ(FieldClaudeCodeOnly, v))
diff --git a/backend/ent/group_create.go b/backend/ent/group_create.go
index 0f35f070ee..2a6c18e67d 100644
--- a/backend/ent/group_create.go
+++ b/backend/ent/group_create.go
@@ -287,6 +287,20 @@ func (_c *GroupCreate) SetNillableAllowImageGeneration(v *bool) *GroupCreate {
return _c
}
+// SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
+func (_c *GroupCreate) SetAllowBatchImageGeneration(v bool) *GroupCreate {
+ _c.mutation.SetAllowBatchImageGeneration(v)
+ return _c
+}
+
+// SetNillableAllowBatchImageGeneration sets the "allow_batch_image_generation" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableAllowBatchImageGeneration(v *bool) *GroupCreate {
+ if v != nil {
+ _c.SetAllowBatchImageGeneration(*v)
+ }
+ return _c
+}
+
// SetImageRateIndependent sets the "image_rate_independent" field.
func (_c *GroupCreate) SetImageRateIndependent(v bool) *GroupCreate {
_c.mutation.SetImageRateIndependent(v)
@@ -357,6 +371,104 @@ func (_c *GroupCreate) SetNillableImagePrice4k(v *float64) *GroupCreate {
return _c
}
+// SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
+func (_c *GroupCreate) SetBatchImageDiscountMultiplier(v float64) *GroupCreate {
+ _c.mutation.SetBatchImageDiscountMultiplier(v)
+ return _c
+}
+
+// SetNillableBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableBatchImageDiscountMultiplier(v *float64) *GroupCreate {
+ if v != nil {
+ _c.SetBatchImageDiscountMultiplier(*v)
+ }
+ return _c
+}
+
+// SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
+func (_c *GroupCreate) SetBatchImageHoldMultiplier(v float64) *GroupCreate {
+ _c.mutation.SetBatchImageHoldMultiplier(v)
+ return _c
+}
+
+// SetNillableBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableBatchImageHoldMultiplier(v *float64) *GroupCreate {
+ if v != nil {
+ _c.SetBatchImageHoldMultiplier(*v)
+ }
+ return _c
+}
+
+// SetVideoRateIndependent sets the "video_rate_independent" field.
+func (_c *GroupCreate) SetVideoRateIndependent(v bool) *GroupCreate {
+ _c.mutation.SetVideoRateIndependent(v)
+ return _c
+}
+
+// SetNillableVideoRateIndependent sets the "video_rate_independent" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableVideoRateIndependent(v *bool) *GroupCreate {
+ if v != nil {
+ _c.SetVideoRateIndependent(*v)
+ }
+ return _c
+}
+
+// SetVideoRateMultiplier sets the "video_rate_multiplier" field.
+func (_c *GroupCreate) SetVideoRateMultiplier(v float64) *GroupCreate {
+ _c.mutation.SetVideoRateMultiplier(v)
+ return _c
+}
+
+// SetNillableVideoRateMultiplier sets the "video_rate_multiplier" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableVideoRateMultiplier(v *float64) *GroupCreate {
+ if v != nil {
+ _c.SetVideoRateMultiplier(*v)
+ }
+ return _c
+}
+
+// SetVideoPrice480p sets the "video_price_480p" field.
+func (_c *GroupCreate) SetVideoPrice480p(v float64) *GroupCreate {
+ _c.mutation.SetVideoPrice480p(v)
+ return _c
+}
+
+// SetNillableVideoPrice480p sets the "video_price_480p" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableVideoPrice480p(v *float64) *GroupCreate {
+ if v != nil {
+ _c.SetVideoPrice480p(*v)
+ }
+ return _c
+}
+
+// SetVideoPrice720p sets the "video_price_720p" field.
+func (_c *GroupCreate) SetVideoPrice720p(v float64) *GroupCreate {
+ _c.mutation.SetVideoPrice720p(v)
+ return _c
+}
+
+// SetNillableVideoPrice720p sets the "video_price_720p" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableVideoPrice720p(v *float64) *GroupCreate {
+ if v != nil {
+ _c.SetVideoPrice720p(*v)
+ }
+ return _c
+}
+
+// SetVideoPrice1080p sets the "video_price_1080p" field.
+func (_c *GroupCreate) SetVideoPrice1080p(v float64) *GroupCreate {
+ _c.mutation.SetVideoPrice1080p(v)
+ return _c
+}
+
+// SetNillableVideoPrice1080p sets the "video_price_1080p" field if the given value is not nil.
+func (_c *GroupCreate) SetNillableVideoPrice1080p(v *float64) *GroupCreate {
+ if v != nil {
+ _c.SetVideoPrice1080p(*v)
+ }
+ return _c
+}
+
// SetClaudeCodeOnly sets the "claude_code_only" field.
func (_c *GroupCreate) SetClaudeCodeOnly(v bool) *GroupCreate {
_c.mutation.SetClaudeCodeOnly(v)
@@ -736,6 +848,10 @@ func (_c *GroupCreate) defaults() error {
v := group.DefaultAllowImageGeneration
_c.mutation.SetAllowImageGeneration(v)
}
+ if _, ok := _c.mutation.AllowBatchImageGeneration(); !ok {
+ v := group.DefaultAllowBatchImageGeneration
+ _c.mutation.SetAllowBatchImageGeneration(v)
+ }
if _, ok := _c.mutation.ImageRateIndependent(); !ok {
v := group.DefaultImageRateIndependent
_c.mutation.SetImageRateIndependent(v)
@@ -744,6 +860,22 @@ func (_c *GroupCreate) defaults() error {
v := group.DefaultImageRateMultiplier
_c.mutation.SetImageRateMultiplier(v)
}
+ if _, ok := _c.mutation.BatchImageDiscountMultiplier(); !ok {
+ v := group.DefaultBatchImageDiscountMultiplier
+ _c.mutation.SetBatchImageDiscountMultiplier(v)
+ }
+ if _, ok := _c.mutation.BatchImageHoldMultiplier(); !ok {
+ v := group.DefaultBatchImageHoldMultiplier
+ _c.mutation.SetBatchImageHoldMultiplier(v)
+ }
+ if _, ok := _c.mutation.VideoRateIndependent(); !ok {
+ v := group.DefaultVideoRateIndependent
+ _c.mutation.SetVideoRateIndependent(v)
+ }
+ if _, ok := _c.mutation.VideoRateMultiplier(); !ok {
+ v := group.DefaultVideoRateMultiplier
+ _c.mutation.SetVideoRateMultiplier(v)
+ }
if _, ok := _c.mutation.ClaudeCodeOnly(); !ok {
v := group.DefaultClaudeCodeOnly
_c.mutation.SetClaudeCodeOnly(v)
@@ -869,12 +1001,27 @@ func (_c *GroupCreate) check() error {
if _, ok := _c.mutation.AllowImageGeneration(); !ok {
return &ValidationError{Name: "allow_image_generation", err: errors.New(`ent: missing required field "Group.allow_image_generation"`)}
}
+ if _, ok := _c.mutation.AllowBatchImageGeneration(); !ok {
+ return &ValidationError{Name: "allow_batch_image_generation", err: errors.New(`ent: missing required field "Group.allow_batch_image_generation"`)}
+ }
if _, ok := _c.mutation.ImageRateIndependent(); !ok {
return &ValidationError{Name: "image_rate_independent", err: errors.New(`ent: missing required field "Group.image_rate_independent"`)}
}
if _, ok := _c.mutation.ImageRateMultiplier(); !ok {
return &ValidationError{Name: "image_rate_multiplier", err: errors.New(`ent: missing required field "Group.image_rate_multiplier"`)}
}
+ if _, ok := _c.mutation.BatchImageDiscountMultiplier(); !ok {
+ return &ValidationError{Name: "batch_image_discount_multiplier", err: errors.New(`ent: missing required field "Group.batch_image_discount_multiplier"`)}
+ }
+ if _, ok := _c.mutation.BatchImageHoldMultiplier(); !ok {
+ return &ValidationError{Name: "batch_image_hold_multiplier", err: errors.New(`ent: missing required field "Group.batch_image_hold_multiplier"`)}
+ }
+ if _, ok := _c.mutation.VideoRateIndependent(); !ok {
+ return &ValidationError{Name: "video_rate_independent", err: errors.New(`ent: missing required field "Group.video_rate_independent"`)}
+ }
+ if _, ok := _c.mutation.VideoRateMultiplier(); !ok {
+ return &ValidationError{Name: "video_rate_multiplier", err: errors.New(`ent: missing required field "Group.video_rate_multiplier"`)}
+ }
if _, ok := _c.mutation.ClaudeCodeOnly(); !ok {
return &ValidationError{Name: "claude_code_only", err: errors.New(`ent: missing required field "Group.claude_code_only"`)}
}
@@ -1019,6 +1166,10 @@ func (_c *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
_spec.SetField(group.FieldAllowImageGeneration, field.TypeBool, value)
_node.AllowImageGeneration = value
}
+ if value, ok := _c.mutation.AllowBatchImageGeneration(); ok {
+ _spec.SetField(group.FieldAllowBatchImageGeneration, field.TypeBool, value)
+ _node.AllowBatchImageGeneration = value
+ }
if value, ok := _c.mutation.ImageRateIndependent(); ok {
_spec.SetField(group.FieldImageRateIndependent, field.TypeBool, value)
_node.ImageRateIndependent = value
@@ -1039,6 +1190,34 @@ func (_c *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) {
_spec.SetField(group.FieldImagePrice4k, field.TypeFloat64, value)
_node.ImagePrice4k = &value
}
+ if value, ok := _c.mutation.BatchImageDiscountMultiplier(); ok {
+ _spec.SetField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
+ _node.BatchImageDiscountMultiplier = value
+ }
+ if value, ok := _c.mutation.BatchImageHoldMultiplier(); ok {
+ _spec.SetField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
+ _node.BatchImageHoldMultiplier = value
+ }
+ if value, ok := _c.mutation.VideoRateIndependent(); ok {
+ _spec.SetField(group.FieldVideoRateIndependent, field.TypeBool, value)
+ _node.VideoRateIndependent = value
+ }
+ if value, ok := _c.mutation.VideoRateMultiplier(); ok {
+ _spec.SetField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
+ _node.VideoRateMultiplier = value
+ }
+ if value, ok := _c.mutation.VideoPrice480p(); ok {
+ _spec.SetField(group.FieldVideoPrice480p, field.TypeFloat64, value)
+ _node.VideoPrice480p = &value
+ }
+ if value, ok := _c.mutation.VideoPrice720p(); ok {
+ _spec.SetField(group.FieldVideoPrice720p, field.TypeFloat64, value)
+ _node.VideoPrice720p = &value
+ }
+ if value, ok := _c.mutation.VideoPrice1080p(); ok {
+ _spec.SetField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
+ _node.VideoPrice1080p = &value
+ }
if value, ok := _c.mutation.ClaudeCodeOnly(); ok {
_spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value)
_node.ClaudeCodeOnly = value
@@ -1537,6 +1716,18 @@ func (u *GroupUpsert) UpdateAllowImageGeneration() *GroupUpsert {
return u
}
+// SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
+func (u *GroupUpsert) SetAllowBatchImageGeneration(v bool) *GroupUpsert {
+ u.Set(group.FieldAllowBatchImageGeneration, v)
+ return u
+}
+
+// UpdateAllowBatchImageGeneration sets the "allow_batch_image_generation" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateAllowBatchImageGeneration() *GroupUpsert {
+ u.SetExcluded(group.FieldAllowBatchImageGeneration)
+ return u
+}
+
// SetImageRateIndependent sets the "image_rate_independent" field.
func (u *GroupUpsert) SetImageRateIndependent(v bool) *GroupUpsert {
u.Set(group.FieldImageRateIndependent, v)
@@ -1639,6 +1830,144 @@ func (u *GroupUpsert) ClearImagePrice4k() *GroupUpsert {
return u
}
+// SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
+func (u *GroupUpsert) SetBatchImageDiscountMultiplier(v float64) *GroupUpsert {
+ u.Set(group.FieldBatchImageDiscountMultiplier, v)
+ return u
+}
+
+// UpdateBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateBatchImageDiscountMultiplier() *GroupUpsert {
+ u.SetExcluded(group.FieldBatchImageDiscountMultiplier)
+ return u
+}
+
+// AddBatchImageDiscountMultiplier adds v to the "batch_image_discount_multiplier" field.
+func (u *GroupUpsert) AddBatchImageDiscountMultiplier(v float64) *GroupUpsert {
+ u.Add(group.FieldBatchImageDiscountMultiplier, v)
+ return u
+}
+
+// SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
+func (u *GroupUpsert) SetBatchImageHoldMultiplier(v float64) *GroupUpsert {
+ u.Set(group.FieldBatchImageHoldMultiplier, v)
+ return u
+}
+
+// UpdateBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateBatchImageHoldMultiplier() *GroupUpsert {
+ u.SetExcluded(group.FieldBatchImageHoldMultiplier)
+ return u
+}
+
+// AddBatchImageHoldMultiplier adds v to the "batch_image_hold_multiplier" field.
+func (u *GroupUpsert) AddBatchImageHoldMultiplier(v float64) *GroupUpsert {
+ u.Add(group.FieldBatchImageHoldMultiplier, v)
+ return u
+}
+
+// SetVideoRateIndependent sets the "video_rate_independent" field.
+func (u *GroupUpsert) SetVideoRateIndependent(v bool) *GroupUpsert {
+ u.Set(group.FieldVideoRateIndependent, v)
+ return u
+}
+
+// UpdateVideoRateIndependent sets the "video_rate_independent" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateVideoRateIndependent() *GroupUpsert {
+ u.SetExcluded(group.FieldVideoRateIndependent)
+ return u
+}
+
+// SetVideoRateMultiplier sets the "video_rate_multiplier" field.
+func (u *GroupUpsert) SetVideoRateMultiplier(v float64) *GroupUpsert {
+ u.Set(group.FieldVideoRateMultiplier, v)
+ return u
+}
+
+// UpdateVideoRateMultiplier sets the "video_rate_multiplier" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateVideoRateMultiplier() *GroupUpsert {
+ u.SetExcluded(group.FieldVideoRateMultiplier)
+ return u
+}
+
+// AddVideoRateMultiplier adds v to the "video_rate_multiplier" field.
+func (u *GroupUpsert) AddVideoRateMultiplier(v float64) *GroupUpsert {
+ u.Add(group.FieldVideoRateMultiplier, v)
+ return u
+}
+
+// SetVideoPrice480p sets the "video_price_480p" field.
+func (u *GroupUpsert) SetVideoPrice480p(v float64) *GroupUpsert {
+ u.Set(group.FieldVideoPrice480p, v)
+ return u
+}
+
+// UpdateVideoPrice480p sets the "video_price_480p" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateVideoPrice480p() *GroupUpsert {
+ u.SetExcluded(group.FieldVideoPrice480p)
+ return u
+}
+
+// AddVideoPrice480p adds v to the "video_price_480p" field.
+func (u *GroupUpsert) AddVideoPrice480p(v float64) *GroupUpsert {
+ u.Add(group.FieldVideoPrice480p, v)
+ return u
+}
+
+// ClearVideoPrice480p clears the value of the "video_price_480p" field.
+func (u *GroupUpsert) ClearVideoPrice480p() *GroupUpsert {
+ u.SetNull(group.FieldVideoPrice480p)
+ return u
+}
+
+// SetVideoPrice720p sets the "video_price_720p" field.
+func (u *GroupUpsert) SetVideoPrice720p(v float64) *GroupUpsert {
+ u.Set(group.FieldVideoPrice720p, v)
+ return u
+}
+
+// UpdateVideoPrice720p sets the "video_price_720p" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateVideoPrice720p() *GroupUpsert {
+ u.SetExcluded(group.FieldVideoPrice720p)
+ return u
+}
+
+// AddVideoPrice720p adds v to the "video_price_720p" field.
+func (u *GroupUpsert) AddVideoPrice720p(v float64) *GroupUpsert {
+ u.Add(group.FieldVideoPrice720p, v)
+ return u
+}
+
+// ClearVideoPrice720p clears the value of the "video_price_720p" field.
+func (u *GroupUpsert) ClearVideoPrice720p() *GroupUpsert {
+ u.SetNull(group.FieldVideoPrice720p)
+ return u
+}
+
+// SetVideoPrice1080p sets the "video_price_1080p" field.
+func (u *GroupUpsert) SetVideoPrice1080p(v float64) *GroupUpsert {
+ u.Set(group.FieldVideoPrice1080p, v)
+ return u
+}
+
+// UpdateVideoPrice1080p sets the "video_price_1080p" field to the value that was provided on create.
+func (u *GroupUpsert) UpdateVideoPrice1080p() *GroupUpsert {
+ u.SetExcluded(group.FieldVideoPrice1080p)
+ return u
+}
+
+// AddVideoPrice1080p adds v to the "video_price_1080p" field.
+func (u *GroupUpsert) AddVideoPrice1080p(v float64) *GroupUpsert {
+ u.Add(group.FieldVideoPrice1080p, v)
+ return u
+}
+
+// ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
+func (u *GroupUpsert) ClearVideoPrice1080p() *GroupUpsert {
+ u.SetNull(group.FieldVideoPrice1080p)
+ return u
+}
+
// SetClaudeCodeOnly sets the "claude_code_only" field.
func (u *GroupUpsert) SetClaudeCodeOnly(v bool) *GroupUpsert {
u.Set(group.FieldClaudeCodeOnly, v)
@@ -2235,6 +2564,20 @@ func (u *GroupUpsertOne) UpdateAllowImageGeneration() *GroupUpsertOne {
})
}
+// SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
+func (u *GroupUpsertOne) SetAllowBatchImageGeneration(v bool) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetAllowBatchImageGeneration(v)
+ })
+}
+
+// UpdateAllowBatchImageGeneration sets the "allow_batch_image_generation" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateAllowBatchImageGeneration() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateAllowBatchImageGeneration()
+ })
+}
+
// SetImageRateIndependent sets the "image_rate_independent" field.
func (u *GroupUpsertOne) SetImageRateIndependent(v bool) *GroupUpsertOne {
return u.Update(func(s *GroupUpsert) {
@@ -2354,6 +2697,167 @@ func (u *GroupUpsertOne) ClearImagePrice4k() *GroupUpsertOne {
})
}
+// SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
+func (u *GroupUpsertOne) SetBatchImageDiscountMultiplier(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetBatchImageDiscountMultiplier(v)
+ })
+}
+
+// AddBatchImageDiscountMultiplier adds v to the "batch_image_discount_multiplier" field.
+func (u *GroupUpsertOne) AddBatchImageDiscountMultiplier(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddBatchImageDiscountMultiplier(v)
+ })
+}
+
+// UpdateBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateBatchImageDiscountMultiplier() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateBatchImageDiscountMultiplier()
+ })
+}
+
+// SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
+func (u *GroupUpsertOne) SetBatchImageHoldMultiplier(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetBatchImageHoldMultiplier(v)
+ })
+}
+
+// AddBatchImageHoldMultiplier adds v to the "batch_image_hold_multiplier" field.
+func (u *GroupUpsertOne) AddBatchImageHoldMultiplier(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddBatchImageHoldMultiplier(v)
+ })
+}
+
+// UpdateBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateBatchImageHoldMultiplier() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateBatchImageHoldMultiplier()
+ })
+}
+
+// SetVideoRateIndependent sets the "video_rate_independent" field.
+func (u *GroupUpsertOne) SetVideoRateIndependent(v bool) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoRateIndependent(v)
+ })
+}
+
+// UpdateVideoRateIndependent sets the "video_rate_independent" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateVideoRateIndependent() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoRateIndependent()
+ })
+}
+
+// SetVideoRateMultiplier sets the "video_rate_multiplier" field.
+func (u *GroupUpsertOne) SetVideoRateMultiplier(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoRateMultiplier(v)
+ })
+}
+
+// AddVideoRateMultiplier adds v to the "video_rate_multiplier" field.
+func (u *GroupUpsertOne) AddVideoRateMultiplier(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoRateMultiplier(v)
+ })
+}
+
+// UpdateVideoRateMultiplier sets the "video_rate_multiplier" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateVideoRateMultiplier() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoRateMultiplier()
+ })
+}
+
+// SetVideoPrice480p sets the "video_price_480p" field.
+func (u *GroupUpsertOne) SetVideoPrice480p(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoPrice480p(v)
+ })
+}
+
+// AddVideoPrice480p adds v to the "video_price_480p" field.
+func (u *GroupUpsertOne) AddVideoPrice480p(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoPrice480p(v)
+ })
+}
+
+// UpdateVideoPrice480p sets the "video_price_480p" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateVideoPrice480p() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoPrice480p()
+ })
+}
+
+// ClearVideoPrice480p clears the value of the "video_price_480p" field.
+func (u *GroupUpsertOne) ClearVideoPrice480p() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.ClearVideoPrice480p()
+ })
+}
+
+// SetVideoPrice720p sets the "video_price_720p" field.
+func (u *GroupUpsertOne) SetVideoPrice720p(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoPrice720p(v)
+ })
+}
+
+// AddVideoPrice720p adds v to the "video_price_720p" field.
+func (u *GroupUpsertOne) AddVideoPrice720p(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoPrice720p(v)
+ })
+}
+
+// UpdateVideoPrice720p sets the "video_price_720p" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateVideoPrice720p() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoPrice720p()
+ })
+}
+
+// ClearVideoPrice720p clears the value of the "video_price_720p" field.
+func (u *GroupUpsertOne) ClearVideoPrice720p() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.ClearVideoPrice720p()
+ })
+}
+
+// SetVideoPrice1080p sets the "video_price_1080p" field.
+func (u *GroupUpsertOne) SetVideoPrice1080p(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoPrice1080p(v)
+ })
+}
+
+// AddVideoPrice1080p adds v to the "video_price_1080p" field.
+func (u *GroupUpsertOne) AddVideoPrice1080p(v float64) *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoPrice1080p(v)
+ })
+}
+
+// UpdateVideoPrice1080p sets the "video_price_1080p" field to the value that was provided on create.
+func (u *GroupUpsertOne) UpdateVideoPrice1080p() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoPrice1080p()
+ })
+}
+
+// ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
+func (u *GroupUpsertOne) ClearVideoPrice1080p() *GroupUpsertOne {
+ return u.Update(func(s *GroupUpsert) {
+ s.ClearVideoPrice1080p()
+ })
+}
+
// SetClaudeCodeOnly sets the "claude_code_only" field.
func (u *GroupUpsertOne) SetClaudeCodeOnly(v bool) *GroupUpsertOne {
return u.Update(func(s *GroupUpsert) {
@@ -3153,6 +3657,20 @@ func (u *GroupUpsertBulk) UpdateAllowImageGeneration() *GroupUpsertBulk {
})
}
+// SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
+func (u *GroupUpsertBulk) SetAllowBatchImageGeneration(v bool) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetAllowBatchImageGeneration(v)
+ })
+}
+
+// UpdateAllowBatchImageGeneration sets the "allow_batch_image_generation" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateAllowBatchImageGeneration() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateAllowBatchImageGeneration()
+ })
+}
+
// SetImageRateIndependent sets the "image_rate_independent" field.
func (u *GroupUpsertBulk) SetImageRateIndependent(v bool) *GroupUpsertBulk {
return u.Update(func(s *GroupUpsert) {
@@ -3272,6 +3790,167 @@ func (u *GroupUpsertBulk) ClearImagePrice4k() *GroupUpsertBulk {
})
}
+// SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
+func (u *GroupUpsertBulk) SetBatchImageDiscountMultiplier(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetBatchImageDiscountMultiplier(v)
+ })
+}
+
+// AddBatchImageDiscountMultiplier adds v to the "batch_image_discount_multiplier" field.
+func (u *GroupUpsertBulk) AddBatchImageDiscountMultiplier(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddBatchImageDiscountMultiplier(v)
+ })
+}
+
+// UpdateBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateBatchImageDiscountMultiplier() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateBatchImageDiscountMultiplier()
+ })
+}
+
+// SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
+func (u *GroupUpsertBulk) SetBatchImageHoldMultiplier(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetBatchImageHoldMultiplier(v)
+ })
+}
+
+// AddBatchImageHoldMultiplier adds v to the "batch_image_hold_multiplier" field.
+func (u *GroupUpsertBulk) AddBatchImageHoldMultiplier(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddBatchImageHoldMultiplier(v)
+ })
+}
+
+// UpdateBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateBatchImageHoldMultiplier() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateBatchImageHoldMultiplier()
+ })
+}
+
+// SetVideoRateIndependent sets the "video_rate_independent" field.
+func (u *GroupUpsertBulk) SetVideoRateIndependent(v bool) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoRateIndependent(v)
+ })
+}
+
+// UpdateVideoRateIndependent sets the "video_rate_independent" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateVideoRateIndependent() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoRateIndependent()
+ })
+}
+
+// SetVideoRateMultiplier sets the "video_rate_multiplier" field.
+func (u *GroupUpsertBulk) SetVideoRateMultiplier(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoRateMultiplier(v)
+ })
+}
+
+// AddVideoRateMultiplier adds v to the "video_rate_multiplier" field.
+func (u *GroupUpsertBulk) AddVideoRateMultiplier(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoRateMultiplier(v)
+ })
+}
+
+// UpdateVideoRateMultiplier sets the "video_rate_multiplier" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateVideoRateMultiplier() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoRateMultiplier()
+ })
+}
+
+// SetVideoPrice480p sets the "video_price_480p" field.
+func (u *GroupUpsertBulk) SetVideoPrice480p(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoPrice480p(v)
+ })
+}
+
+// AddVideoPrice480p adds v to the "video_price_480p" field.
+func (u *GroupUpsertBulk) AddVideoPrice480p(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoPrice480p(v)
+ })
+}
+
+// UpdateVideoPrice480p sets the "video_price_480p" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateVideoPrice480p() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoPrice480p()
+ })
+}
+
+// ClearVideoPrice480p clears the value of the "video_price_480p" field.
+func (u *GroupUpsertBulk) ClearVideoPrice480p() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.ClearVideoPrice480p()
+ })
+}
+
+// SetVideoPrice720p sets the "video_price_720p" field.
+func (u *GroupUpsertBulk) SetVideoPrice720p(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoPrice720p(v)
+ })
+}
+
+// AddVideoPrice720p adds v to the "video_price_720p" field.
+func (u *GroupUpsertBulk) AddVideoPrice720p(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoPrice720p(v)
+ })
+}
+
+// UpdateVideoPrice720p sets the "video_price_720p" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateVideoPrice720p() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoPrice720p()
+ })
+}
+
+// ClearVideoPrice720p clears the value of the "video_price_720p" field.
+func (u *GroupUpsertBulk) ClearVideoPrice720p() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.ClearVideoPrice720p()
+ })
+}
+
+// SetVideoPrice1080p sets the "video_price_1080p" field.
+func (u *GroupUpsertBulk) SetVideoPrice1080p(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.SetVideoPrice1080p(v)
+ })
+}
+
+// AddVideoPrice1080p adds v to the "video_price_1080p" field.
+func (u *GroupUpsertBulk) AddVideoPrice1080p(v float64) *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.AddVideoPrice1080p(v)
+ })
+}
+
+// UpdateVideoPrice1080p sets the "video_price_1080p" field to the value that was provided on create.
+func (u *GroupUpsertBulk) UpdateVideoPrice1080p() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.UpdateVideoPrice1080p()
+ })
+}
+
+// ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
+func (u *GroupUpsertBulk) ClearVideoPrice1080p() *GroupUpsertBulk {
+ return u.Update(func(s *GroupUpsert) {
+ s.ClearVideoPrice1080p()
+ })
+}
+
// SetClaudeCodeOnly sets the "claude_code_only" field.
func (u *GroupUpsertBulk) SetClaudeCodeOnly(v bool) *GroupUpsertBulk {
return u.Update(func(s *GroupUpsert) {
diff --git a/backend/ent/group_update.go b/backend/ent/group_update.go
index 55555f323c..3bb18d3e1a 100644
--- a/backend/ent/group_update.go
+++ b/backend/ent/group_update.go
@@ -352,6 +352,20 @@ func (_u *GroupUpdate) SetNillableAllowImageGeneration(v *bool) *GroupUpdate {
return _u
}
+// SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
+func (_u *GroupUpdate) SetAllowBatchImageGeneration(v bool) *GroupUpdate {
+ _u.mutation.SetAllowBatchImageGeneration(v)
+ return _u
+}
+
+// SetNillableAllowBatchImageGeneration sets the "allow_batch_image_generation" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableAllowBatchImageGeneration(v *bool) *GroupUpdate {
+ if v != nil {
+ _u.SetAllowBatchImageGeneration(*v)
+ }
+ return _u
+}
+
// SetImageRateIndependent sets the "image_rate_independent" field.
func (_u *GroupUpdate) SetImageRateIndependent(v bool) *GroupUpdate {
_u.mutation.SetImageRateIndependent(v)
@@ -468,6 +482,164 @@ func (_u *GroupUpdate) ClearImagePrice4k() *GroupUpdate {
return _u
}
+// SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
+func (_u *GroupUpdate) SetBatchImageDiscountMultiplier(v float64) *GroupUpdate {
+ _u.mutation.ResetBatchImageDiscountMultiplier()
+ _u.mutation.SetBatchImageDiscountMultiplier(v)
+ return _u
+}
+
+// SetNillableBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableBatchImageDiscountMultiplier(v *float64) *GroupUpdate {
+ if v != nil {
+ _u.SetBatchImageDiscountMultiplier(*v)
+ }
+ return _u
+}
+
+// AddBatchImageDiscountMultiplier adds value to the "batch_image_discount_multiplier" field.
+func (_u *GroupUpdate) AddBatchImageDiscountMultiplier(v float64) *GroupUpdate {
+ _u.mutation.AddBatchImageDiscountMultiplier(v)
+ return _u
+}
+
+// SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
+func (_u *GroupUpdate) SetBatchImageHoldMultiplier(v float64) *GroupUpdate {
+ _u.mutation.ResetBatchImageHoldMultiplier()
+ _u.mutation.SetBatchImageHoldMultiplier(v)
+ return _u
+}
+
+// SetNillableBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableBatchImageHoldMultiplier(v *float64) *GroupUpdate {
+ if v != nil {
+ _u.SetBatchImageHoldMultiplier(*v)
+ }
+ return _u
+}
+
+// AddBatchImageHoldMultiplier adds value to the "batch_image_hold_multiplier" field.
+func (_u *GroupUpdate) AddBatchImageHoldMultiplier(v float64) *GroupUpdate {
+ _u.mutation.AddBatchImageHoldMultiplier(v)
+ return _u
+}
+
+// SetVideoRateIndependent sets the "video_rate_independent" field.
+func (_u *GroupUpdate) SetVideoRateIndependent(v bool) *GroupUpdate {
+ _u.mutation.SetVideoRateIndependent(v)
+ return _u
+}
+
+// SetNillableVideoRateIndependent sets the "video_rate_independent" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableVideoRateIndependent(v *bool) *GroupUpdate {
+ if v != nil {
+ _u.SetVideoRateIndependent(*v)
+ }
+ return _u
+}
+
+// SetVideoRateMultiplier sets the "video_rate_multiplier" field.
+func (_u *GroupUpdate) SetVideoRateMultiplier(v float64) *GroupUpdate {
+ _u.mutation.ResetVideoRateMultiplier()
+ _u.mutation.SetVideoRateMultiplier(v)
+ return _u
+}
+
+// SetNillableVideoRateMultiplier sets the "video_rate_multiplier" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableVideoRateMultiplier(v *float64) *GroupUpdate {
+ if v != nil {
+ _u.SetVideoRateMultiplier(*v)
+ }
+ return _u
+}
+
+// AddVideoRateMultiplier adds value to the "video_rate_multiplier" field.
+func (_u *GroupUpdate) AddVideoRateMultiplier(v float64) *GroupUpdate {
+ _u.mutation.AddVideoRateMultiplier(v)
+ return _u
+}
+
+// SetVideoPrice480p sets the "video_price_480p" field.
+func (_u *GroupUpdate) SetVideoPrice480p(v float64) *GroupUpdate {
+ _u.mutation.ResetVideoPrice480p()
+ _u.mutation.SetVideoPrice480p(v)
+ return _u
+}
+
+// SetNillableVideoPrice480p sets the "video_price_480p" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableVideoPrice480p(v *float64) *GroupUpdate {
+ if v != nil {
+ _u.SetVideoPrice480p(*v)
+ }
+ return _u
+}
+
+// AddVideoPrice480p adds value to the "video_price_480p" field.
+func (_u *GroupUpdate) AddVideoPrice480p(v float64) *GroupUpdate {
+ _u.mutation.AddVideoPrice480p(v)
+ return _u
+}
+
+// ClearVideoPrice480p clears the value of the "video_price_480p" field.
+func (_u *GroupUpdate) ClearVideoPrice480p() *GroupUpdate {
+ _u.mutation.ClearVideoPrice480p()
+ return _u
+}
+
+// SetVideoPrice720p sets the "video_price_720p" field.
+func (_u *GroupUpdate) SetVideoPrice720p(v float64) *GroupUpdate {
+ _u.mutation.ResetVideoPrice720p()
+ _u.mutation.SetVideoPrice720p(v)
+ return _u
+}
+
+// SetNillableVideoPrice720p sets the "video_price_720p" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableVideoPrice720p(v *float64) *GroupUpdate {
+ if v != nil {
+ _u.SetVideoPrice720p(*v)
+ }
+ return _u
+}
+
+// AddVideoPrice720p adds value to the "video_price_720p" field.
+func (_u *GroupUpdate) AddVideoPrice720p(v float64) *GroupUpdate {
+ _u.mutation.AddVideoPrice720p(v)
+ return _u
+}
+
+// ClearVideoPrice720p clears the value of the "video_price_720p" field.
+func (_u *GroupUpdate) ClearVideoPrice720p() *GroupUpdate {
+ _u.mutation.ClearVideoPrice720p()
+ return _u
+}
+
+// SetVideoPrice1080p sets the "video_price_1080p" field.
+func (_u *GroupUpdate) SetVideoPrice1080p(v float64) *GroupUpdate {
+ _u.mutation.ResetVideoPrice1080p()
+ _u.mutation.SetVideoPrice1080p(v)
+ return _u
+}
+
+// SetNillableVideoPrice1080p sets the "video_price_1080p" field if the given value is not nil.
+func (_u *GroupUpdate) SetNillableVideoPrice1080p(v *float64) *GroupUpdate {
+ if v != nil {
+ _u.SetVideoPrice1080p(*v)
+ }
+ return _u
+}
+
+// AddVideoPrice1080p adds value to the "video_price_1080p" field.
+func (_u *GroupUpdate) AddVideoPrice1080p(v float64) *GroupUpdate {
+ _u.mutation.AddVideoPrice1080p(v)
+ return _u
+}
+
+// ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
+func (_u *GroupUpdate) ClearVideoPrice1080p() *GroupUpdate {
+ _u.mutation.ClearVideoPrice1080p()
+ return _u
+}
+
// SetClaudeCodeOnly sets the "claude_code_only" field.
func (_u *GroupUpdate) SetClaudeCodeOnly(v bool) *GroupUpdate {
_u.mutation.SetClaudeCodeOnly(v)
@@ -1116,6 +1288,9 @@ func (_u *GroupUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if value, ok := _u.mutation.AllowImageGeneration(); ok {
_spec.SetField(group.FieldAllowImageGeneration, field.TypeBool, value)
}
+ if value, ok := _u.mutation.AllowBatchImageGeneration(); ok {
+ _spec.SetField(group.FieldAllowBatchImageGeneration, field.TypeBool, value)
+ }
if value, ok := _u.mutation.ImageRateIndependent(); ok {
_spec.SetField(group.FieldImageRateIndependent, field.TypeBool, value)
}
@@ -1152,6 +1327,54 @@ func (_u *GroupUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if _u.mutation.ImagePrice4kCleared() {
_spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64)
}
+ if value, ok := _u.mutation.BatchImageDiscountMultiplier(); ok {
+ _spec.SetField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedBatchImageDiscountMultiplier(); ok {
+ _spec.AddField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.BatchImageHoldMultiplier(); ok {
+ _spec.SetField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedBatchImageHoldMultiplier(); ok {
+ _spec.AddField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.VideoRateIndependent(); ok {
+ _spec.SetField(group.FieldVideoRateIndependent, field.TypeBool, value)
+ }
+ if value, ok := _u.mutation.VideoRateMultiplier(); ok {
+ _spec.SetField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoRateMultiplier(); ok {
+ _spec.AddField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.VideoPrice480p(); ok {
+ _spec.SetField(group.FieldVideoPrice480p, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoPrice480p(); ok {
+ _spec.AddField(group.FieldVideoPrice480p, field.TypeFloat64, value)
+ }
+ if _u.mutation.VideoPrice480pCleared() {
+ _spec.ClearField(group.FieldVideoPrice480p, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.VideoPrice720p(); ok {
+ _spec.SetField(group.FieldVideoPrice720p, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoPrice720p(); ok {
+ _spec.AddField(group.FieldVideoPrice720p, field.TypeFloat64, value)
+ }
+ if _u.mutation.VideoPrice720pCleared() {
+ _spec.ClearField(group.FieldVideoPrice720p, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.VideoPrice1080p(); ok {
+ _spec.SetField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoPrice1080p(); ok {
+ _spec.AddField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
+ }
+ if _u.mutation.VideoPrice1080pCleared() {
+ _spec.ClearField(group.FieldVideoPrice1080p, field.TypeFloat64)
+ }
if value, ok := _u.mutation.ClaudeCodeOnly(); ok {
_spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value)
}
@@ -1853,6 +2076,20 @@ func (_u *GroupUpdateOne) SetNillableAllowImageGeneration(v *bool) *GroupUpdateO
return _u
}
+// SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
+func (_u *GroupUpdateOne) SetAllowBatchImageGeneration(v bool) *GroupUpdateOne {
+ _u.mutation.SetAllowBatchImageGeneration(v)
+ return _u
+}
+
+// SetNillableAllowBatchImageGeneration sets the "allow_batch_image_generation" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableAllowBatchImageGeneration(v *bool) *GroupUpdateOne {
+ if v != nil {
+ _u.SetAllowBatchImageGeneration(*v)
+ }
+ return _u
+}
+
// SetImageRateIndependent sets the "image_rate_independent" field.
func (_u *GroupUpdateOne) SetImageRateIndependent(v bool) *GroupUpdateOne {
_u.mutation.SetImageRateIndependent(v)
@@ -1969,6 +2206,164 @@ func (_u *GroupUpdateOne) ClearImagePrice4k() *GroupUpdateOne {
return _u
}
+// SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
+func (_u *GroupUpdateOne) SetBatchImageDiscountMultiplier(v float64) *GroupUpdateOne {
+ _u.mutation.ResetBatchImageDiscountMultiplier()
+ _u.mutation.SetBatchImageDiscountMultiplier(v)
+ return _u
+}
+
+// SetNillableBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableBatchImageDiscountMultiplier(v *float64) *GroupUpdateOne {
+ if v != nil {
+ _u.SetBatchImageDiscountMultiplier(*v)
+ }
+ return _u
+}
+
+// AddBatchImageDiscountMultiplier adds value to the "batch_image_discount_multiplier" field.
+func (_u *GroupUpdateOne) AddBatchImageDiscountMultiplier(v float64) *GroupUpdateOne {
+ _u.mutation.AddBatchImageDiscountMultiplier(v)
+ return _u
+}
+
+// SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
+func (_u *GroupUpdateOne) SetBatchImageHoldMultiplier(v float64) *GroupUpdateOne {
+ _u.mutation.ResetBatchImageHoldMultiplier()
+ _u.mutation.SetBatchImageHoldMultiplier(v)
+ return _u
+}
+
+// SetNillableBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableBatchImageHoldMultiplier(v *float64) *GroupUpdateOne {
+ if v != nil {
+ _u.SetBatchImageHoldMultiplier(*v)
+ }
+ return _u
+}
+
+// AddBatchImageHoldMultiplier adds value to the "batch_image_hold_multiplier" field.
+func (_u *GroupUpdateOne) AddBatchImageHoldMultiplier(v float64) *GroupUpdateOne {
+ _u.mutation.AddBatchImageHoldMultiplier(v)
+ return _u
+}
+
+// SetVideoRateIndependent sets the "video_rate_independent" field.
+func (_u *GroupUpdateOne) SetVideoRateIndependent(v bool) *GroupUpdateOne {
+ _u.mutation.SetVideoRateIndependent(v)
+ return _u
+}
+
+// SetNillableVideoRateIndependent sets the "video_rate_independent" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableVideoRateIndependent(v *bool) *GroupUpdateOne {
+ if v != nil {
+ _u.SetVideoRateIndependent(*v)
+ }
+ return _u
+}
+
+// SetVideoRateMultiplier sets the "video_rate_multiplier" field.
+func (_u *GroupUpdateOne) SetVideoRateMultiplier(v float64) *GroupUpdateOne {
+ _u.mutation.ResetVideoRateMultiplier()
+ _u.mutation.SetVideoRateMultiplier(v)
+ return _u
+}
+
+// SetNillableVideoRateMultiplier sets the "video_rate_multiplier" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableVideoRateMultiplier(v *float64) *GroupUpdateOne {
+ if v != nil {
+ _u.SetVideoRateMultiplier(*v)
+ }
+ return _u
+}
+
+// AddVideoRateMultiplier adds value to the "video_rate_multiplier" field.
+func (_u *GroupUpdateOne) AddVideoRateMultiplier(v float64) *GroupUpdateOne {
+ _u.mutation.AddVideoRateMultiplier(v)
+ return _u
+}
+
+// SetVideoPrice480p sets the "video_price_480p" field.
+func (_u *GroupUpdateOne) SetVideoPrice480p(v float64) *GroupUpdateOne {
+ _u.mutation.ResetVideoPrice480p()
+ _u.mutation.SetVideoPrice480p(v)
+ return _u
+}
+
+// SetNillableVideoPrice480p sets the "video_price_480p" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableVideoPrice480p(v *float64) *GroupUpdateOne {
+ if v != nil {
+ _u.SetVideoPrice480p(*v)
+ }
+ return _u
+}
+
+// AddVideoPrice480p adds value to the "video_price_480p" field.
+func (_u *GroupUpdateOne) AddVideoPrice480p(v float64) *GroupUpdateOne {
+ _u.mutation.AddVideoPrice480p(v)
+ return _u
+}
+
+// ClearVideoPrice480p clears the value of the "video_price_480p" field.
+func (_u *GroupUpdateOne) ClearVideoPrice480p() *GroupUpdateOne {
+ _u.mutation.ClearVideoPrice480p()
+ return _u
+}
+
+// SetVideoPrice720p sets the "video_price_720p" field.
+func (_u *GroupUpdateOne) SetVideoPrice720p(v float64) *GroupUpdateOne {
+ _u.mutation.ResetVideoPrice720p()
+ _u.mutation.SetVideoPrice720p(v)
+ return _u
+}
+
+// SetNillableVideoPrice720p sets the "video_price_720p" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableVideoPrice720p(v *float64) *GroupUpdateOne {
+ if v != nil {
+ _u.SetVideoPrice720p(*v)
+ }
+ return _u
+}
+
+// AddVideoPrice720p adds value to the "video_price_720p" field.
+func (_u *GroupUpdateOne) AddVideoPrice720p(v float64) *GroupUpdateOne {
+ _u.mutation.AddVideoPrice720p(v)
+ return _u
+}
+
+// ClearVideoPrice720p clears the value of the "video_price_720p" field.
+func (_u *GroupUpdateOne) ClearVideoPrice720p() *GroupUpdateOne {
+ _u.mutation.ClearVideoPrice720p()
+ return _u
+}
+
+// SetVideoPrice1080p sets the "video_price_1080p" field.
+func (_u *GroupUpdateOne) SetVideoPrice1080p(v float64) *GroupUpdateOne {
+ _u.mutation.ResetVideoPrice1080p()
+ _u.mutation.SetVideoPrice1080p(v)
+ return _u
+}
+
+// SetNillableVideoPrice1080p sets the "video_price_1080p" field if the given value is not nil.
+func (_u *GroupUpdateOne) SetNillableVideoPrice1080p(v *float64) *GroupUpdateOne {
+ if v != nil {
+ _u.SetVideoPrice1080p(*v)
+ }
+ return _u
+}
+
+// AddVideoPrice1080p adds value to the "video_price_1080p" field.
+func (_u *GroupUpdateOne) AddVideoPrice1080p(v float64) *GroupUpdateOne {
+ _u.mutation.AddVideoPrice1080p(v)
+ return _u
+}
+
+// ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
+func (_u *GroupUpdateOne) ClearVideoPrice1080p() *GroupUpdateOne {
+ _u.mutation.ClearVideoPrice1080p()
+ return _u
+}
+
// SetClaudeCodeOnly sets the "claude_code_only" field.
func (_u *GroupUpdateOne) SetClaudeCodeOnly(v bool) *GroupUpdateOne {
_u.mutation.SetClaudeCodeOnly(v)
@@ -2647,6 +3042,9 @@ func (_u *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error)
if value, ok := _u.mutation.AllowImageGeneration(); ok {
_spec.SetField(group.FieldAllowImageGeneration, field.TypeBool, value)
}
+ if value, ok := _u.mutation.AllowBatchImageGeneration(); ok {
+ _spec.SetField(group.FieldAllowBatchImageGeneration, field.TypeBool, value)
+ }
if value, ok := _u.mutation.ImageRateIndependent(); ok {
_spec.SetField(group.FieldImageRateIndependent, field.TypeBool, value)
}
@@ -2683,6 +3081,54 @@ func (_u *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error)
if _u.mutation.ImagePrice4kCleared() {
_spec.ClearField(group.FieldImagePrice4k, field.TypeFloat64)
}
+ if value, ok := _u.mutation.BatchImageDiscountMultiplier(); ok {
+ _spec.SetField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedBatchImageDiscountMultiplier(); ok {
+ _spec.AddField(group.FieldBatchImageDiscountMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.BatchImageHoldMultiplier(); ok {
+ _spec.SetField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedBatchImageHoldMultiplier(); ok {
+ _spec.AddField(group.FieldBatchImageHoldMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.VideoRateIndependent(); ok {
+ _spec.SetField(group.FieldVideoRateIndependent, field.TypeBool, value)
+ }
+ if value, ok := _u.mutation.VideoRateMultiplier(); ok {
+ _spec.SetField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoRateMultiplier(); ok {
+ _spec.AddField(group.FieldVideoRateMultiplier, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.VideoPrice480p(); ok {
+ _spec.SetField(group.FieldVideoPrice480p, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoPrice480p(); ok {
+ _spec.AddField(group.FieldVideoPrice480p, field.TypeFloat64, value)
+ }
+ if _u.mutation.VideoPrice480pCleared() {
+ _spec.ClearField(group.FieldVideoPrice480p, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.VideoPrice720p(); ok {
+ _spec.SetField(group.FieldVideoPrice720p, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoPrice720p(); ok {
+ _spec.AddField(group.FieldVideoPrice720p, field.TypeFloat64, value)
+ }
+ if _u.mutation.VideoPrice720pCleared() {
+ _spec.ClearField(group.FieldVideoPrice720p, field.TypeFloat64)
+ }
+ if value, ok := _u.mutation.VideoPrice1080p(); ok {
+ _spec.SetField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedVideoPrice1080p(); ok {
+ _spec.AddField(group.FieldVideoPrice1080p, field.TypeFloat64, value)
+ }
+ if _u.mutation.VideoPrice1080pCleared() {
+ _spec.ClearField(group.FieldVideoPrice1080p, field.TypeFloat64)
+ }
if value, ok := _u.mutation.ClaudeCodeOnly(); ok {
_spec.SetField(group.FieldClaudeCodeOnly, field.TypeBool, value)
}
diff --git a/backend/ent/hook/hook.go b/backend/ent/hook/hook.go
index 71bfd3b88e..181f2f99db 100644
--- a/backend/ent/hook/hook.go
+++ b/backend/ent/hook/hook.go
@@ -93,6 +93,42 @@ func (f AuthIdentityChannelFunc) Mutate(ctx context.Context, m ent.Mutation) (en
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AuthIdentityChannelMutation", m)
}
+// The BatchImageEventFunc type is an adapter to allow the use of ordinary
+// function as BatchImageEvent mutator.
+type BatchImageEventFunc func(context.Context, *ent.BatchImageEventMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f BatchImageEventFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.BatchImageEventMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BatchImageEventMutation", m)
+}
+
+// The BatchImageItemFunc type is an adapter to allow the use of ordinary
+// function as BatchImageItem mutator.
+type BatchImageItemFunc func(context.Context, *ent.BatchImageItemMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f BatchImageItemFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.BatchImageItemMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BatchImageItemMutation", m)
+}
+
+// The BatchImageJobFunc type is an adapter to allow the use of ordinary
+// function as BatchImageJob mutator.
+type BatchImageJobFunc func(context.Context, *ent.BatchImageJobMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f BatchImageJobFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.BatchImageJobMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.BatchImageJobMutation", m)
+}
+
// The ChannelMonitorFunc type is an adapter to allow the use of ordinary
// function as ChannelMonitor mutator.
type ChannelMonitorFunc func(context.Context, *ent.ChannelMonitorMutation) (ent.Value, error)
diff --git a/backend/ent/intercept/intercept.go b/backend/ent/intercept/intercept.go
index 5d86e25bd5..7aeb07692d 100644
--- a/backend/ent/intercept/intercept.go
+++ b/backend/ent/intercept/intercept.go
@@ -15,6 +15,9 @@ import (
"github.com/Wei-Shaw/sub2api/ent/apikey"
"github.com/Wei-Shaw/sub2api/ent/authidentity"
"github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
@@ -291,6 +294,87 @@ func (f TraverseAuthIdentityChannel) Traverse(ctx context.Context, q ent.Query)
return fmt.Errorf("unexpected query type %T. expect *ent.AuthIdentityChannelQuery", q)
}
+// The BatchImageEventFunc type is an adapter to allow the use of ordinary function as a Querier.
+type BatchImageEventFunc func(context.Context, *ent.BatchImageEventQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f BatchImageEventFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+ if q, ok := q.(*ent.BatchImageEventQuery); ok {
+ return f(ctx, q)
+ }
+ return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchImageEventQuery", q)
+}
+
+// The TraverseBatchImageEvent type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseBatchImageEvent func(context.Context, *ent.BatchImageEventQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseBatchImageEvent) Intercept(next ent.Querier) ent.Querier {
+ return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseBatchImageEvent) Traverse(ctx context.Context, q ent.Query) error {
+ if q, ok := q.(*ent.BatchImageEventQuery); ok {
+ return f(ctx, q)
+ }
+ return fmt.Errorf("unexpected query type %T. expect *ent.BatchImageEventQuery", q)
+}
+
+// The BatchImageItemFunc type is an adapter to allow the use of ordinary function as a Querier.
+type BatchImageItemFunc func(context.Context, *ent.BatchImageItemQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f BatchImageItemFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+ if q, ok := q.(*ent.BatchImageItemQuery); ok {
+ return f(ctx, q)
+ }
+ return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchImageItemQuery", q)
+}
+
+// The TraverseBatchImageItem type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseBatchImageItem func(context.Context, *ent.BatchImageItemQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseBatchImageItem) Intercept(next ent.Querier) ent.Querier {
+ return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseBatchImageItem) Traverse(ctx context.Context, q ent.Query) error {
+ if q, ok := q.(*ent.BatchImageItemQuery); ok {
+ return f(ctx, q)
+ }
+ return fmt.Errorf("unexpected query type %T. expect *ent.BatchImageItemQuery", q)
+}
+
+// The BatchImageJobFunc type is an adapter to allow the use of ordinary function as a Querier.
+type BatchImageJobFunc func(context.Context, *ent.BatchImageJobQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f BatchImageJobFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+ if q, ok := q.(*ent.BatchImageJobQuery); ok {
+ return f(ctx, q)
+ }
+ return nil, fmt.Errorf("unexpected query type %T. expect *ent.BatchImageJobQuery", q)
+}
+
+// The TraverseBatchImageJob type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseBatchImageJob func(context.Context, *ent.BatchImageJobQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseBatchImageJob) Intercept(next ent.Querier) ent.Querier {
+ return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseBatchImageJob) Traverse(ctx context.Context, q ent.Query) error {
+ if q, ok := q.(*ent.BatchImageJobQuery); ok {
+ return f(ctx, q)
+ }
+ return fmt.Errorf("unexpected query type %T. expect *ent.BatchImageJobQuery", q)
+}
+
// The ChannelMonitorFunc type is an adapter to allow the use of ordinary function as a Querier.
type ChannelMonitorFunc func(context.Context, *ent.ChannelMonitorQuery) (ent.Value, error)
@@ -1064,6 +1148,12 @@ func NewQuery(q ent.Query) (Query, error) {
return &query[*ent.AuthIdentityQuery, predicate.AuthIdentity, authidentity.OrderOption]{typ: ent.TypeAuthIdentity, tq: q}, nil
case *ent.AuthIdentityChannelQuery:
return &query[*ent.AuthIdentityChannelQuery, predicate.AuthIdentityChannel, authidentitychannel.OrderOption]{typ: ent.TypeAuthIdentityChannel, tq: q}, nil
+ case *ent.BatchImageEventQuery:
+ return &query[*ent.BatchImageEventQuery, predicate.BatchImageEvent, batchimageevent.OrderOption]{typ: ent.TypeBatchImageEvent, tq: q}, nil
+ case *ent.BatchImageItemQuery:
+ return &query[*ent.BatchImageItemQuery, predicate.BatchImageItem, batchimageitem.OrderOption]{typ: ent.TypeBatchImageItem, tq: q}, nil
+ case *ent.BatchImageJobQuery:
+ return &query[*ent.BatchImageJobQuery, predicate.BatchImageJob, batchimagejob.OrderOption]{typ: ent.TypeBatchImageJob, tq: q}, nil
case *ent.ChannelMonitorQuery:
return &query[*ent.ChannelMonitorQuery, predicate.ChannelMonitor, channelmonitor.OrderOption]{typ: ent.TypeChannelMonitor, tq: q}, nil
case *ent.ChannelMonitorDailyRollupQuery:
diff --git a/backend/ent/migrate/schema.go b/backend/ent/migrate/schema.go
index c771f9572d..d3e8bc5448 100644
--- a/backend/ent/migrate/schema.go
+++ b/backend/ent/migrate/schema.go
@@ -435,6 +435,188 @@ var (
},
},
}
+ // BatchImageEventsColumns holds the columns for the "batch_image_events" table.
+ BatchImageEventsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeInt64, Increment: true},
+ {Name: "job_id", Type: field.TypeString, Size: 64},
+ {Name: "event_type", Type: field.TypeString, Size: 64},
+ {Name: "payload", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
+ {Name: "event_hash", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ }
+ // BatchImageEventsTable holds the schema information for the "batch_image_events" table.
+ BatchImageEventsTable = &schema.Table{
+ Name: "batch_image_events",
+ Columns: BatchImageEventsColumns,
+ PrimaryKey: []*schema.Column{BatchImageEventsColumns[0]},
+ Indexes: []*schema.Index{
+ {
+ Name: "batchimageevent_job_id_created_at",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageEventsColumns[1], BatchImageEventsColumns[5]},
+ },
+ {
+ Name: "batchimageevent_event_type",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageEventsColumns[2]},
+ },
+ {
+ Name: "batchimageevent_job_id_event_hash",
+ Unique: true,
+ Columns: []*schema.Column{BatchImageEventsColumns[1], BatchImageEventsColumns[4]},
+ Annotation: &entsql.IndexAnnotation{
+ Where: "event_hash IS NOT NULL AND event_hash <> ''",
+ },
+ },
+ },
+ }
+ // BatchImageItemsColumns holds the columns for the "batch_image_items" table.
+ BatchImageItemsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeInt64, Increment: true},
+ {Name: "job_id", Type: field.TypeString, Size: 64},
+ {Name: "custom_id", Type: field.TypeString, Size: 255},
+ {Name: "status", Type: field.TypeString, Size: 32},
+ {Name: "request_hash", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "prompt_preview", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
+ {Name: "provider_source_object", Type: field.TypeString, Nullable: true, Size: 1024},
+ {Name: "source_line_number", Type: field.TypeInt, Nullable: true},
+ {Name: "source_byte_offset", Type: field.TypeInt64, Nullable: true},
+ {Name: "source_byte_length", Type: field.TypeInt64, Nullable: true},
+ {Name: "mime_type", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "file_extension", Type: field.TypeString, Nullable: true, Size: 32},
+ {Name: "image_count", Type: field.TypeInt, Default: 0},
+ {Name: "error_code", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "error_message", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
+ {Name: "billed_amount", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
+ {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "indexed_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ }
+ // BatchImageItemsTable holds the schema information for the "batch_image_items" table.
+ BatchImageItemsTable = &schema.Table{
+ Name: "batch_image_items",
+ Columns: BatchImageItemsColumns,
+ PrimaryKey: []*schema.Column{BatchImageItemsColumns[0]},
+ Indexes: []*schema.Index{
+ {
+ Name: "batchimageitem_job_id_custom_id",
+ Unique: true,
+ Columns: []*schema.Column{BatchImageItemsColumns[1], BatchImageItemsColumns[2]},
+ },
+ {
+ Name: "batchimageitem_job_id_status",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageItemsColumns[1], BatchImageItemsColumns[3]},
+ },
+ {
+ Name: "batchimageitem_provider_source_object",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageItemsColumns[6]},
+ },
+ },
+ }
+ // BatchImageJobsColumns holds the columns for the "batch_image_jobs" table.
+ BatchImageJobsColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeInt64, Increment: true},
+ {Name: "batch_id", Type: field.TypeString, Size: 64},
+ {Name: "user_id", Type: field.TypeInt64},
+ {Name: "api_key_id", Type: field.TypeInt64, Nullable: true},
+ {Name: "account_id", Type: field.TypeInt64, Nullable: true},
+ {Name: "provider", Type: field.TypeString, Size: 32},
+ {Name: "model", Type: field.TypeString, Size: 128},
+ {Name: "task_name", Type: field.TypeString, Size: 255, Default: ""},
+ {Name: "status", Type: field.TypeString, Size: 32, Default: "created"},
+ {Name: "provider_job_name", Type: field.TypeString, Nullable: true, Size: 512},
+ {Name: "provider_input_ref", Type: field.TypeString, Nullable: true, Size: 1024},
+ {Name: "provider_output_ref", Type: field.TypeString, Nullable: true, Size: 1024},
+ {Name: "gcs_input_uri", Type: field.TypeString, Nullable: true, Size: 1024},
+ {Name: "gcs_output_uri", Type: field.TypeString, Nullable: true, Size: 1024},
+ {Name: "item_count", Type: field.TypeInt},
+ {Name: "success_count", Type: field.TypeInt, Default: 0},
+ {Name: "fail_count", Type: field.TypeInt, Default: 0},
+ {Name: "cancelled_count", Type: field.TypeInt, Default: 0},
+ {Name: "estimated_cost", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
+ {Name: "hold_amount", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
+ {Name: "actual_cost", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,10)"}},
+ {Name: "currency", Type: field.TypeString, Size: 16, Default: "USD"},
+ {Name: "hold_id", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "idempotency_key", Type: field.TypeString, Nullable: true, Size: 255},
+ {Name: "request_hash", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "manifest_hash", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "retry_count", Type: field.TypeInt, Default: 0},
+ {Name: "version", Type: field.TypeInt, Default: 0},
+ {Name: "output_expires_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "input_deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "output_deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "downloaded_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "user_deleted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "last_error_code", Type: field.TypeString, Nullable: true, Size: 128},
+ {Name: "last_error_message", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "text"}},
+ {Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "updated_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "submitted_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "started_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "finished_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ {Name: "settled_at", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"postgres": "timestamptz"}},
+ }
+ // BatchImageJobsTable holds the schema information for the "batch_image_jobs" table.
+ BatchImageJobsTable = &schema.Table{
+ Name: "batch_image_jobs",
+ Columns: BatchImageJobsColumns,
+ PrimaryKey: []*schema.Column{BatchImageJobsColumns[0]},
+ Indexes: []*schema.Index{
+ {
+ Name: "batchimagejob_batch_id",
+ Unique: true,
+ Columns: []*schema.Column{BatchImageJobsColumns[1]},
+ },
+ {
+ Name: "batchimagejob_user_id_created_at",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageJobsColumns[2], BatchImageJobsColumns[35]},
+ },
+ {
+ Name: "batchimagejob_status",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageJobsColumns[8]},
+ },
+ {
+ Name: "batchimagejob_provider_status",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageJobsColumns[5], BatchImageJobsColumns[8]},
+ },
+ {
+ Name: "batchimagejob_idempotency_key",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageJobsColumns[23]},
+ Annotation: &entsql.IndexAnnotation{
+ Where: "idempotency_key IS NOT NULL AND idempotency_key <> ''",
+ },
+ },
+ {
+ Name: "batchimagejob_manifest_hash",
+ Unique: true,
+ Columns: []*schema.Column{BatchImageJobsColumns[25]},
+ Annotation: &entsql.IndexAnnotation{
+ Where: "manifest_hash IS NOT NULL AND manifest_hash <> ''",
+ },
+ },
+ {
+ Name: "batchimagejob_output_expires_at",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageJobsColumns[28]},
+ },
+ {
+ Name: "batchimagejob_downloaded_at",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageJobsColumns[31]},
+ },
+ {
+ Name: "batchimagejob_user_deleted_at",
+ Unique: false,
+ Columns: []*schema.Column{BatchImageJobsColumns[32]},
+ },
+ },
+ }
// ChannelMonitorsColumns holds the columns for the "channel_monitors" table.
ChannelMonitorsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true},
@@ -670,11 +852,19 @@ var (
{Name: "monthly_limit_usd", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
{Name: "default_validity_days", Type: field.TypeInt, Default: 30},
{Name: "allow_image_generation", Type: field.TypeBool, Default: false},
+ {Name: "allow_batch_image_generation", Type: field.TypeBool, Default: false},
{Name: "image_rate_independent", Type: field.TypeBool, Default: false},
{Name: "image_rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
{Name: "image_price_1k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
{Name: "image_price_2k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
{Name: "image_price_4k", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
+ {Name: "batch_image_discount_multiplier", Type: field.TypeFloat64, Default: 0.5, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
+ {Name: "batch_image_hold_multiplier", Type: field.TypeFloat64, Default: 0.6, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
+ {Name: "video_rate_independent", Type: field.TypeBool, Default: false},
+ {Name: "video_rate_multiplier", Type: field.TypeFloat64, Default: 1, SchemaType: map[string]string{"postgres": "decimal(10,4)"}},
+ {Name: "video_price_480p", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
+ {Name: "video_price_720p", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
+ {Name: "video_price_1080p", Type: field.TypeFloat64, Nullable: true, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
{Name: "claude_code_only", Type: field.TypeBool, Default: false},
{Name: "fallback_group_id", Type: field.TypeInt64, Nullable: true},
{Name: "fallback_group_id_on_invalid_request", Type: field.TypeInt64, Nullable: true},
@@ -725,7 +915,7 @@ var (
{
Name: "group_sort_order",
Unique: false,
- Columns: []*schema.Column{GroupsColumns[32]},
+ Columns: []*schema.Column{GroupsColumns[40]},
},
},
}
@@ -1382,6 +1572,9 @@ var (
{Name: "image_output_size", Type: field.TypeString, Nullable: true, Size: 32},
{Name: "image_size_source", Type: field.TypeString, Nullable: true, Size: 16},
{Name: "image_size_breakdown", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
+ {Name: "video_count", Type: field.TypeInt, Default: 0},
+ {Name: "video_resolution", Type: field.TypeString, Nullable: true, Size: 10},
+ {Name: "video_duration_seconds", Type: field.TypeInt, Nullable: true},
{Name: "cache_ttl_overridden", Type: field.TypeBool, Default: false},
{Name: "created_at", Type: field.TypeTime, SchemaType: map[string]string{"postgres": "timestamptz"}},
{Name: "api_key_id", Type: field.TypeInt64},
@@ -1398,31 +1591,31 @@ var (
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "usage_logs_api_keys_usage_logs",
- Columns: []*schema.Column{UsageLogsColumns[37]},
+ Columns: []*schema.Column{UsageLogsColumns[40]},
RefColumns: []*schema.Column{APIKeysColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "usage_logs_accounts_usage_logs",
- Columns: []*schema.Column{UsageLogsColumns[38]},
+ Columns: []*schema.Column{UsageLogsColumns[41]},
RefColumns: []*schema.Column{AccountsColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "usage_logs_groups_usage_logs",
- Columns: []*schema.Column{UsageLogsColumns[39]},
+ Columns: []*schema.Column{UsageLogsColumns[42]},
RefColumns: []*schema.Column{GroupsColumns[0]},
OnDelete: schema.SetNull,
},
{
Symbol: "usage_logs_users_usage_logs",
- Columns: []*schema.Column{UsageLogsColumns[40]},
+ Columns: []*schema.Column{UsageLogsColumns[43]},
RefColumns: []*schema.Column{UsersColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "usage_logs_user_subscriptions_usage_logs",
- Columns: []*schema.Column{UsageLogsColumns[41]},
+ Columns: []*schema.Column{UsageLogsColumns[44]},
RefColumns: []*schema.Column{UserSubscriptionsColumns[0]},
OnDelete: schema.SetNull,
},
@@ -1431,32 +1624,32 @@ var (
{
Name: "usagelog_user_id",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[40]},
+ Columns: []*schema.Column{UsageLogsColumns[43]},
},
{
Name: "usagelog_api_key_id",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[37]},
+ Columns: []*schema.Column{UsageLogsColumns[40]},
},
{
Name: "usagelog_account_id",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[38]},
+ Columns: []*schema.Column{UsageLogsColumns[41]},
},
{
Name: "usagelog_group_id",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[39]},
+ Columns: []*schema.Column{UsageLogsColumns[42]},
},
{
Name: "usagelog_subscription_id",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[41]},
+ Columns: []*schema.Column{UsageLogsColumns[44]},
},
{
Name: "usagelog_created_at",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[36]},
+ Columns: []*schema.Column{UsageLogsColumns[39]},
},
{
Name: "usagelog_model",
@@ -1476,17 +1669,17 @@ var (
{
Name: "usagelog_user_id_created_at",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[40], UsageLogsColumns[36]},
+ Columns: []*schema.Column{UsageLogsColumns[43], UsageLogsColumns[39]},
},
{
Name: "usagelog_api_key_id_created_at",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[37], UsageLogsColumns[36]},
+ Columns: []*schema.Column{UsageLogsColumns[40], UsageLogsColumns[39]},
},
{
Name: "usagelog_group_id_created_at",
Unique: false,
- Columns: []*schema.Column{UsageLogsColumns[39], UsageLogsColumns[36]},
+ Columns: []*schema.Column{UsageLogsColumns[42], UsageLogsColumns[39]},
},
},
}
@@ -1500,6 +1693,7 @@ var (
{Name: "password_hash", Type: field.TypeString, Size: 255},
{Name: "role", Type: field.TypeString, Size: 20, Default: "user"},
{Name: "balance", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
+ {Name: "frozen_balance", Type: field.TypeFloat64, Default: 0, SchemaType: map[string]string{"postgres": "decimal(20,8)"}},
{Name: "concurrency", Type: field.TypeInt, Default: 5},
{Name: "status", Type: field.TypeString, Size: 20, Default: "active"},
{Name: "username", Type: field.TypeString, Size: 100, Default: ""},
@@ -1526,7 +1720,7 @@ var (
{
Name: "user_status",
Unique: false,
- Columns: []*schema.Column{UsersColumns[9]},
+ Columns: []*schema.Column{UsersColumns[10]},
},
{
Name: "user_deleted_at",
@@ -1799,6 +1993,9 @@ var (
AnnouncementReadsTable,
AuthIdentitiesTable,
AuthIdentityChannelsTable,
+ BatchImageEventsTable,
+ BatchImageItemsTable,
+ BatchImageJobsTable,
ChannelMonitorsTable,
ChannelMonitorDailyRollupsTable,
ChannelMonitorHistoriesTable,
@@ -1862,6 +2059,15 @@ func init() {
AuthIdentityChannelsTable.Annotation = &entsql.Annotation{
Table: "auth_identity_channels",
}
+ BatchImageEventsTable.Annotation = &entsql.Annotation{
+ Table: "batch_image_events",
+ }
+ BatchImageItemsTable.Annotation = &entsql.Annotation{
+ Table: "batch_image_items",
+ }
+ BatchImageJobsTable.Annotation = &entsql.Annotation{
+ Table: "batch_image_jobs",
+ }
ChannelMonitorsTable.ForeignKeys[0].RefTable = ChannelMonitorRequestTemplatesTable
ChannelMonitorsTable.Annotation = &entsql.Annotation{
Table: "channel_monitors",
diff --git a/backend/ent/mutation.go b/backend/ent/mutation.go
index c71850e4ce..8d32773050 100644
--- a/backend/ent/mutation.go
+++ b/backend/ent/mutation.go
@@ -19,6 +19,9 @@ import (
"github.com/Wei-Shaw/sub2api/ent/apikey"
"github.com/Wei-Shaw/sub2api/ent/authidentity"
"github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
@@ -67,6 +70,9 @@ const (
TypeAnnouncementRead = "AnnouncementRead"
TypeAuthIdentity = "AuthIdentity"
TypeAuthIdentityChannel = "AuthIdentityChannel"
+ TypeBatchImageEvent = "BatchImageEvent"
+ TypeBatchImageItem = "BatchImageItem"
+ TypeBatchImageJob = "BatchImageJob"
TypeChannelMonitor = "ChannelMonitor"
TypeChannelMonitorDailyRollup = "ChannelMonitorDailyRollup"
TypeChannelMonitorHistory = "ChannelMonitorHistory"
@@ -9120,6 +9126,5476 @@ func (m *AuthIdentityChannelMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown AuthIdentityChannel edge %s", name)
}
+// BatchImageEventMutation represents an operation that mutates the BatchImageEvent nodes in the graph.
+type BatchImageEventMutation struct {
+ config
+ op Op
+ typ string
+ id *int64
+ job_id *string
+ event_type *string
+ payload *map[string]interface{}
+ event_hash *string
+ created_at *time.Time
+ clearedFields map[string]struct{}
+ done bool
+ oldValue func(context.Context) (*BatchImageEvent, error)
+ predicates []predicate.BatchImageEvent
+}
+
+var _ ent.Mutation = (*BatchImageEventMutation)(nil)
+
+// batchimageeventOption allows management of the mutation configuration using functional options.
+type batchimageeventOption func(*BatchImageEventMutation)
+
+// newBatchImageEventMutation creates new mutation for the BatchImageEvent entity.
+func newBatchImageEventMutation(c config, op Op, opts ...batchimageeventOption) *BatchImageEventMutation {
+ m := &BatchImageEventMutation{
+ config: c,
+ op: op,
+ typ: TypeBatchImageEvent,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withBatchImageEventID sets the ID field of the mutation.
+func withBatchImageEventID(id int64) batchimageeventOption {
+ return func(m *BatchImageEventMutation) {
+ var (
+ err error
+ once sync.Once
+ value *BatchImageEvent
+ )
+ m.oldValue = func(ctx context.Context) (*BatchImageEvent, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().BatchImageEvent.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withBatchImageEvent sets the old BatchImageEvent of the mutation.
+func withBatchImageEvent(node *BatchImageEvent) batchimageeventOption {
+ return func(m *BatchImageEventMutation) {
+ m.oldValue = func(context.Context) (*BatchImageEvent, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m BatchImageEventMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m BatchImageEventMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *BatchImageEventMutation) ID() (id int64, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *BatchImageEventMutation) IDs(ctx context.Context) ([]int64, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []int64{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().BatchImageEvent.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetJobID sets the "job_id" field.
+func (m *BatchImageEventMutation) SetJobID(s string) {
+ m.job_id = &s
+}
+
+// JobID returns the value of the "job_id" field in the mutation.
+func (m *BatchImageEventMutation) JobID() (r string, exists bool) {
+ v := m.job_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldJobID returns the old "job_id" field's value of the BatchImageEvent entity.
+// If the BatchImageEvent object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageEventMutation) OldJobID(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldJobID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldJobID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldJobID: %w", err)
+ }
+ return oldValue.JobID, nil
+}
+
+// ResetJobID resets all changes to the "job_id" field.
+func (m *BatchImageEventMutation) ResetJobID() {
+ m.job_id = nil
+}
+
+// SetEventType sets the "event_type" field.
+func (m *BatchImageEventMutation) SetEventType(s string) {
+ m.event_type = &s
+}
+
+// EventType returns the value of the "event_type" field in the mutation.
+func (m *BatchImageEventMutation) EventType() (r string, exists bool) {
+ v := m.event_type
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldEventType returns the old "event_type" field's value of the BatchImageEvent entity.
+// If the BatchImageEvent object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageEventMutation) OldEventType(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldEventType is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldEventType requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldEventType: %w", err)
+ }
+ return oldValue.EventType, nil
+}
+
+// ResetEventType resets all changes to the "event_type" field.
+func (m *BatchImageEventMutation) ResetEventType() {
+ m.event_type = nil
+}
+
+// SetPayload sets the "payload" field.
+func (m *BatchImageEventMutation) SetPayload(value map[string]interface{}) {
+ m.payload = &value
+}
+
+// Payload returns the value of the "payload" field in the mutation.
+func (m *BatchImageEventMutation) Payload() (r map[string]interface{}, exists bool) {
+ v := m.payload
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldPayload returns the old "payload" field's value of the BatchImageEvent entity.
+// If the BatchImageEvent object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageEventMutation) OldPayload(ctx context.Context) (v map[string]interface{}, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldPayload is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldPayload requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldPayload: %w", err)
+ }
+ return oldValue.Payload, nil
+}
+
+// ClearPayload clears the value of the "payload" field.
+func (m *BatchImageEventMutation) ClearPayload() {
+ m.payload = nil
+ m.clearedFields[batchimageevent.FieldPayload] = struct{}{}
+}
+
+// PayloadCleared returns if the "payload" field was cleared in this mutation.
+func (m *BatchImageEventMutation) PayloadCleared() bool {
+ _, ok := m.clearedFields[batchimageevent.FieldPayload]
+ return ok
+}
+
+// ResetPayload resets all changes to the "payload" field.
+func (m *BatchImageEventMutation) ResetPayload() {
+ m.payload = nil
+ delete(m.clearedFields, batchimageevent.FieldPayload)
+}
+
+// SetEventHash sets the "event_hash" field.
+func (m *BatchImageEventMutation) SetEventHash(s string) {
+ m.event_hash = &s
+}
+
+// EventHash returns the value of the "event_hash" field in the mutation.
+func (m *BatchImageEventMutation) EventHash() (r string, exists bool) {
+ v := m.event_hash
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldEventHash returns the old "event_hash" field's value of the BatchImageEvent entity.
+// If the BatchImageEvent object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageEventMutation) OldEventHash(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldEventHash is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldEventHash requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldEventHash: %w", err)
+ }
+ return oldValue.EventHash, nil
+}
+
+// ClearEventHash clears the value of the "event_hash" field.
+func (m *BatchImageEventMutation) ClearEventHash() {
+ m.event_hash = nil
+ m.clearedFields[batchimageevent.FieldEventHash] = struct{}{}
+}
+
+// EventHashCleared returns if the "event_hash" field was cleared in this mutation.
+func (m *BatchImageEventMutation) EventHashCleared() bool {
+ _, ok := m.clearedFields[batchimageevent.FieldEventHash]
+ return ok
+}
+
+// ResetEventHash resets all changes to the "event_hash" field.
+func (m *BatchImageEventMutation) ResetEventHash() {
+ m.event_hash = nil
+ delete(m.clearedFields, batchimageevent.FieldEventHash)
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *BatchImageEventMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *BatchImageEventMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the BatchImageEvent entity.
+// If the BatchImageEvent object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageEventMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *BatchImageEventMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// Where appends a list predicates to the BatchImageEventMutation builder.
+func (m *BatchImageEventMutation) Where(ps ...predicate.BatchImageEvent) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the BatchImageEventMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *BatchImageEventMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.BatchImageEvent, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *BatchImageEventMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *BatchImageEventMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (BatchImageEvent).
+func (m *BatchImageEventMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *BatchImageEventMutation) Fields() []string {
+ fields := make([]string, 0, 5)
+ if m.job_id != nil {
+ fields = append(fields, batchimageevent.FieldJobID)
+ }
+ if m.event_type != nil {
+ fields = append(fields, batchimageevent.FieldEventType)
+ }
+ if m.payload != nil {
+ fields = append(fields, batchimageevent.FieldPayload)
+ }
+ if m.event_hash != nil {
+ fields = append(fields, batchimageevent.FieldEventHash)
+ }
+ if m.created_at != nil {
+ fields = append(fields, batchimageevent.FieldCreatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *BatchImageEventMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case batchimageevent.FieldJobID:
+ return m.JobID()
+ case batchimageevent.FieldEventType:
+ return m.EventType()
+ case batchimageevent.FieldPayload:
+ return m.Payload()
+ case batchimageevent.FieldEventHash:
+ return m.EventHash()
+ case batchimageevent.FieldCreatedAt:
+ return m.CreatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *BatchImageEventMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case batchimageevent.FieldJobID:
+ return m.OldJobID(ctx)
+ case batchimageevent.FieldEventType:
+ return m.OldEventType(ctx)
+ case batchimageevent.FieldPayload:
+ return m.OldPayload(ctx)
+ case batchimageevent.FieldEventHash:
+ return m.OldEventHash(ctx)
+ case batchimageevent.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown BatchImageEvent field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BatchImageEventMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case batchimageevent.FieldJobID:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetJobID(v)
+ return nil
+ case batchimageevent.FieldEventType:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetEventType(v)
+ return nil
+ case batchimageevent.FieldPayload:
+ v, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetPayload(v)
+ return nil
+ case batchimageevent.FieldEventHash:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetEventHash(v)
+ return nil
+ case batchimageevent.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageEvent field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *BatchImageEventMutation) AddedFields() []string {
+ return nil
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *BatchImageEventMutation) AddedField(name string) (ent.Value, bool) {
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BatchImageEventMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ }
+ return fmt.Errorf("unknown BatchImageEvent numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *BatchImageEventMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(batchimageevent.FieldPayload) {
+ fields = append(fields, batchimageevent.FieldPayload)
+ }
+ if m.FieldCleared(batchimageevent.FieldEventHash) {
+ fields = append(fields, batchimageevent.FieldEventHash)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *BatchImageEventMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *BatchImageEventMutation) ClearField(name string) error {
+ switch name {
+ case batchimageevent.FieldPayload:
+ m.ClearPayload()
+ return nil
+ case batchimageevent.FieldEventHash:
+ m.ClearEventHash()
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageEvent nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *BatchImageEventMutation) ResetField(name string) error {
+ switch name {
+ case batchimageevent.FieldJobID:
+ m.ResetJobID()
+ return nil
+ case batchimageevent.FieldEventType:
+ m.ResetEventType()
+ return nil
+ case batchimageevent.FieldPayload:
+ m.ResetPayload()
+ return nil
+ case batchimageevent.FieldEventHash:
+ m.ResetEventHash()
+ return nil
+ case batchimageevent.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageEvent field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *BatchImageEventMutation) AddedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *BatchImageEventMutation) AddedIDs(name string) []ent.Value {
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *BatchImageEventMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *BatchImageEventMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *BatchImageEventMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *BatchImageEventMutation) EdgeCleared(name string) bool {
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *BatchImageEventMutation) ClearEdge(name string) error {
+ return fmt.Errorf("unknown BatchImageEvent unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *BatchImageEventMutation) ResetEdge(name string) error {
+ return fmt.Errorf("unknown BatchImageEvent edge %s", name)
+}
+
+// BatchImageItemMutation represents an operation that mutates the BatchImageItem nodes in the graph.
+type BatchImageItemMutation struct {
+ config
+ op Op
+ typ string
+ id *int64
+ job_id *string
+ custom_id *string
+ status *string
+ request_hash *string
+ prompt_preview *string
+ provider_source_object *string
+ source_line_number *int
+ addsource_line_number *int
+ source_byte_offset *int64
+ addsource_byte_offset *int64
+ source_byte_length *int64
+ addsource_byte_length *int64
+ mime_type *string
+ file_extension *string
+ image_count *int
+ addimage_count *int
+ error_code *string
+ error_message *string
+ billed_amount *float64
+ addbilled_amount *float64
+ created_at *time.Time
+ indexed_at *time.Time
+ clearedFields map[string]struct{}
+ done bool
+ oldValue func(context.Context) (*BatchImageItem, error)
+ predicates []predicate.BatchImageItem
+}
+
+var _ ent.Mutation = (*BatchImageItemMutation)(nil)
+
+// batchimageitemOption allows management of the mutation configuration using functional options.
+type batchimageitemOption func(*BatchImageItemMutation)
+
+// newBatchImageItemMutation creates new mutation for the BatchImageItem entity.
+func newBatchImageItemMutation(c config, op Op, opts ...batchimageitemOption) *BatchImageItemMutation {
+ m := &BatchImageItemMutation{
+ config: c,
+ op: op,
+ typ: TypeBatchImageItem,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withBatchImageItemID sets the ID field of the mutation.
+func withBatchImageItemID(id int64) batchimageitemOption {
+ return func(m *BatchImageItemMutation) {
+ var (
+ err error
+ once sync.Once
+ value *BatchImageItem
+ )
+ m.oldValue = func(ctx context.Context) (*BatchImageItem, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().BatchImageItem.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withBatchImageItem sets the old BatchImageItem of the mutation.
+func withBatchImageItem(node *BatchImageItem) batchimageitemOption {
+ return func(m *BatchImageItemMutation) {
+ m.oldValue = func(context.Context) (*BatchImageItem, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m BatchImageItemMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m BatchImageItemMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *BatchImageItemMutation) ID() (id int64, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *BatchImageItemMutation) IDs(ctx context.Context) ([]int64, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []int64{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().BatchImageItem.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetJobID sets the "job_id" field.
+func (m *BatchImageItemMutation) SetJobID(s string) {
+ m.job_id = &s
+}
+
+// JobID returns the value of the "job_id" field in the mutation.
+func (m *BatchImageItemMutation) JobID() (r string, exists bool) {
+ v := m.job_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldJobID returns the old "job_id" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldJobID(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldJobID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldJobID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldJobID: %w", err)
+ }
+ return oldValue.JobID, nil
+}
+
+// ResetJobID resets all changes to the "job_id" field.
+func (m *BatchImageItemMutation) ResetJobID() {
+ m.job_id = nil
+}
+
+// SetCustomID sets the "custom_id" field.
+func (m *BatchImageItemMutation) SetCustomID(s string) {
+ m.custom_id = &s
+}
+
+// CustomID returns the value of the "custom_id" field in the mutation.
+func (m *BatchImageItemMutation) CustomID() (r string, exists bool) {
+ v := m.custom_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCustomID returns the old "custom_id" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldCustomID(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCustomID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCustomID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCustomID: %w", err)
+ }
+ return oldValue.CustomID, nil
+}
+
+// ResetCustomID resets all changes to the "custom_id" field.
+func (m *BatchImageItemMutation) ResetCustomID() {
+ m.custom_id = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *BatchImageItemMutation) SetStatus(s string) {
+ m.status = &s
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *BatchImageItemMutation) Status() (r string, exists bool) {
+ v := m.status
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldStatus(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldStatus requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+ }
+ return oldValue.Status, nil
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *BatchImageItemMutation) ResetStatus() {
+ m.status = nil
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (m *BatchImageItemMutation) SetRequestHash(s string) {
+ m.request_hash = &s
+}
+
+// RequestHash returns the value of the "request_hash" field in the mutation.
+func (m *BatchImageItemMutation) RequestHash() (r string, exists bool) {
+ v := m.request_hash
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldRequestHash returns the old "request_hash" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldRequestHash(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldRequestHash is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldRequestHash requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldRequestHash: %w", err)
+ }
+ return oldValue.RequestHash, nil
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (m *BatchImageItemMutation) ClearRequestHash() {
+ m.request_hash = nil
+ m.clearedFields[batchimageitem.FieldRequestHash] = struct{}{}
+}
+
+// RequestHashCleared returns if the "request_hash" field was cleared in this mutation.
+func (m *BatchImageItemMutation) RequestHashCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldRequestHash]
+ return ok
+}
+
+// ResetRequestHash resets all changes to the "request_hash" field.
+func (m *BatchImageItemMutation) ResetRequestHash() {
+ m.request_hash = nil
+ delete(m.clearedFields, batchimageitem.FieldRequestHash)
+}
+
+// SetPromptPreview sets the "prompt_preview" field.
+func (m *BatchImageItemMutation) SetPromptPreview(s string) {
+ m.prompt_preview = &s
+}
+
+// PromptPreview returns the value of the "prompt_preview" field in the mutation.
+func (m *BatchImageItemMutation) PromptPreview() (r string, exists bool) {
+ v := m.prompt_preview
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldPromptPreview returns the old "prompt_preview" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldPromptPreview(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldPromptPreview is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldPromptPreview requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldPromptPreview: %w", err)
+ }
+ return oldValue.PromptPreview, nil
+}
+
+// ClearPromptPreview clears the value of the "prompt_preview" field.
+func (m *BatchImageItemMutation) ClearPromptPreview() {
+ m.prompt_preview = nil
+ m.clearedFields[batchimageitem.FieldPromptPreview] = struct{}{}
+}
+
+// PromptPreviewCleared returns if the "prompt_preview" field was cleared in this mutation.
+func (m *BatchImageItemMutation) PromptPreviewCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldPromptPreview]
+ return ok
+}
+
+// ResetPromptPreview resets all changes to the "prompt_preview" field.
+func (m *BatchImageItemMutation) ResetPromptPreview() {
+ m.prompt_preview = nil
+ delete(m.clearedFields, batchimageitem.FieldPromptPreview)
+}
+
+// SetProviderSourceObject sets the "provider_source_object" field.
+func (m *BatchImageItemMutation) SetProviderSourceObject(s string) {
+ m.provider_source_object = &s
+}
+
+// ProviderSourceObject returns the value of the "provider_source_object" field in the mutation.
+func (m *BatchImageItemMutation) ProviderSourceObject() (r string, exists bool) {
+ v := m.provider_source_object
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldProviderSourceObject returns the old "provider_source_object" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldProviderSourceObject(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldProviderSourceObject is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldProviderSourceObject requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldProviderSourceObject: %w", err)
+ }
+ return oldValue.ProviderSourceObject, nil
+}
+
+// ClearProviderSourceObject clears the value of the "provider_source_object" field.
+func (m *BatchImageItemMutation) ClearProviderSourceObject() {
+ m.provider_source_object = nil
+ m.clearedFields[batchimageitem.FieldProviderSourceObject] = struct{}{}
+}
+
+// ProviderSourceObjectCleared returns if the "provider_source_object" field was cleared in this mutation.
+func (m *BatchImageItemMutation) ProviderSourceObjectCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldProviderSourceObject]
+ return ok
+}
+
+// ResetProviderSourceObject resets all changes to the "provider_source_object" field.
+func (m *BatchImageItemMutation) ResetProviderSourceObject() {
+ m.provider_source_object = nil
+ delete(m.clearedFields, batchimageitem.FieldProviderSourceObject)
+}
+
+// SetSourceLineNumber sets the "source_line_number" field.
+func (m *BatchImageItemMutation) SetSourceLineNumber(i int) {
+ m.source_line_number = &i
+ m.addsource_line_number = nil
+}
+
+// SourceLineNumber returns the value of the "source_line_number" field in the mutation.
+func (m *BatchImageItemMutation) SourceLineNumber() (r int, exists bool) {
+ v := m.source_line_number
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSourceLineNumber returns the old "source_line_number" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldSourceLineNumber(ctx context.Context) (v *int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSourceLineNumber is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSourceLineNumber requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSourceLineNumber: %w", err)
+ }
+ return oldValue.SourceLineNumber, nil
+}
+
+// AddSourceLineNumber adds i to the "source_line_number" field.
+func (m *BatchImageItemMutation) AddSourceLineNumber(i int) {
+ if m.addsource_line_number != nil {
+ *m.addsource_line_number += i
+ } else {
+ m.addsource_line_number = &i
+ }
+}
+
+// AddedSourceLineNumber returns the value that was added to the "source_line_number" field in this mutation.
+func (m *BatchImageItemMutation) AddedSourceLineNumber() (r int, exists bool) {
+ v := m.addsource_line_number
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearSourceLineNumber clears the value of the "source_line_number" field.
+func (m *BatchImageItemMutation) ClearSourceLineNumber() {
+ m.source_line_number = nil
+ m.addsource_line_number = nil
+ m.clearedFields[batchimageitem.FieldSourceLineNumber] = struct{}{}
+}
+
+// SourceLineNumberCleared returns if the "source_line_number" field was cleared in this mutation.
+func (m *BatchImageItemMutation) SourceLineNumberCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldSourceLineNumber]
+ return ok
+}
+
+// ResetSourceLineNumber resets all changes to the "source_line_number" field.
+func (m *BatchImageItemMutation) ResetSourceLineNumber() {
+ m.source_line_number = nil
+ m.addsource_line_number = nil
+ delete(m.clearedFields, batchimageitem.FieldSourceLineNumber)
+}
+
+// SetSourceByteOffset sets the "source_byte_offset" field.
+func (m *BatchImageItemMutation) SetSourceByteOffset(i int64) {
+ m.source_byte_offset = &i
+ m.addsource_byte_offset = nil
+}
+
+// SourceByteOffset returns the value of the "source_byte_offset" field in the mutation.
+func (m *BatchImageItemMutation) SourceByteOffset() (r int64, exists bool) {
+ v := m.source_byte_offset
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSourceByteOffset returns the old "source_byte_offset" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldSourceByteOffset(ctx context.Context) (v *int64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSourceByteOffset is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSourceByteOffset requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSourceByteOffset: %w", err)
+ }
+ return oldValue.SourceByteOffset, nil
+}
+
+// AddSourceByteOffset adds i to the "source_byte_offset" field.
+func (m *BatchImageItemMutation) AddSourceByteOffset(i int64) {
+ if m.addsource_byte_offset != nil {
+ *m.addsource_byte_offset += i
+ } else {
+ m.addsource_byte_offset = &i
+ }
+}
+
+// AddedSourceByteOffset returns the value that was added to the "source_byte_offset" field in this mutation.
+func (m *BatchImageItemMutation) AddedSourceByteOffset() (r int64, exists bool) {
+ v := m.addsource_byte_offset
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearSourceByteOffset clears the value of the "source_byte_offset" field.
+func (m *BatchImageItemMutation) ClearSourceByteOffset() {
+ m.source_byte_offset = nil
+ m.addsource_byte_offset = nil
+ m.clearedFields[batchimageitem.FieldSourceByteOffset] = struct{}{}
+}
+
+// SourceByteOffsetCleared returns if the "source_byte_offset" field was cleared in this mutation.
+func (m *BatchImageItemMutation) SourceByteOffsetCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldSourceByteOffset]
+ return ok
+}
+
+// ResetSourceByteOffset resets all changes to the "source_byte_offset" field.
+func (m *BatchImageItemMutation) ResetSourceByteOffset() {
+ m.source_byte_offset = nil
+ m.addsource_byte_offset = nil
+ delete(m.clearedFields, batchimageitem.FieldSourceByteOffset)
+}
+
+// SetSourceByteLength sets the "source_byte_length" field.
+func (m *BatchImageItemMutation) SetSourceByteLength(i int64) {
+ m.source_byte_length = &i
+ m.addsource_byte_length = nil
+}
+
+// SourceByteLength returns the value of the "source_byte_length" field in the mutation.
+func (m *BatchImageItemMutation) SourceByteLength() (r int64, exists bool) {
+ v := m.source_byte_length
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSourceByteLength returns the old "source_byte_length" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldSourceByteLength(ctx context.Context) (v *int64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSourceByteLength is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSourceByteLength requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSourceByteLength: %w", err)
+ }
+ return oldValue.SourceByteLength, nil
+}
+
+// AddSourceByteLength adds i to the "source_byte_length" field.
+func (m *BatchImageItemMutation) AddSourceByteLength(i int64) {
+ if m.addsource_byte_length != nil {
+ *m.addsource_byte_length += i
+ } else {
+ m.addsource_byte_length = &i
+ }
+}
+
+// AddedSourceByteLength returns the value that was added to the "source_byte_length" field in this mutation.
+func (m *BatchImageItemMutation) AddedSourceByteLength() (r int64, exists bool) {
+ v := m.addsource_byte_length
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearSourceByteLength clears the value of the "source_byte_length" field.
+func (m *BatchImageItemMutation) ClearSourceByteLength() {
+ m.source_byte_length = nil
+ m.addsource_byte_length = nil
+ m.clearedFields[batchimageitem.FieldSourceByteLength] = struct{}{}
+}
+
+// SourceByteLengthCleared returns if the "source_byte_length" field was cleared in this mutation.
+func (m *BatchImageItemMutation) SourceByteLengthCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldSourceByteLength]
+ return ok
+}
+
+// ResetSourceByteLength resets all changes to the "source_byte_length" field.
+func (m *BatchImageItemMutation) ResetSourceByteLength() {
+ m.source_byte_length = nil
+ m.addsource_byte_length = nil
+ delete(m.clearedFields, batchimageitem.FieldSourceByteLength)
+}
+
+// SetMimeType sets the "mime_type" field.
+func (m *BatchImageItemMutation) SetMimeType(s string) {
+ m.mime_type = &s
+}
+
+// MimeType returns the value of the "mime_type" field in the mutation.
+func (m *BatchImageItemMutation) MimeType() (r string, exists bool) {
+ v := m.mime_type
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldMimeType returns the old "mime_type" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldMimeType(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldMimeType is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldMimeType requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldMimeType: %w", err)
+ }
+ return oldValue.MimeType, nil
+}
+
+// ClearMimeType clears the value of the "mime_type" field.
+func (m *BatchImageItemMutation) ClearMimeType() {
+ m.mime_type = nil
+ m.clearedFields[batchimageitem.FieldMimeType] = struct{}{}
+}
+
+// MimeTypeCleared returns if the "mime_type" field was cleared in this mutation.
+func (m *BatchImageItemMutation) MimeTypeCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldMimeType]
+ return ok
+}
+
+// ResetMimeType resets all changes to the "mime_type" field.
+func (m *BatchImageItemMutation) ResetMimeType() {
+ m.mime_type = nil
+ delete(m.clearedFields, batchimageitem.FieldMimeType)
+}
+
+// SetFileExtension sets the "file_extension" field.
+func (m *BatchImageItemMutation) SetFileExtension(s string) {
+ m.file_extension = &s
+}
+
+// FileExtension returns the value of the "file_extension" field in the mutation.
+func (m *BatchImageItemMutation) FileExtension() (r string, exists bool) {
+ v := m.file_extension
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldFileExtension returns the old "file_extension" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldFileExtension(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldFileExtension is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldFileExtension requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldFileExtension: %w", err)
+ }
+ return oldValue.FileExtension, nil
+}
+
+// ClearFileExtension clears the value of the "file_extension" field.
+func (m *BatchImageItemMutation) ClearFileExtension() {
+ m.file_extension = nil
+ m.clearedFields[batchimageitem.FieldFileExtension] = struct{}{}
+}
+
+// FileExtensionCleared returns if the "file_extension" field was cleared in this mutation.
+func (m *BatchImageItemMutation) FileExtensionCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldFileExtension]
+ return ok
+}
+
+// ResetFileExtension resets all changes to the "file_extension" field.
+func (m *BatchImageItemMutation) ResetFileExtension() {
+ m.file_extension = nil
+ delete(m.clearedFields, batchimageitem.FieldFileExtension)
+}
+
+// SetImageCount sets the "image_count" field.
+func (m *BatchImageItemMutation) SetImageCount(i int) {
+ m.image_count = &i
+ m.addimage_count = nil
+}
+
+// ImageCount returns the value of the "image_count" field in the mutation.
+func (m *BatchImageItemMutation) ImageCount() (r int, exists bool) {
+ v := m.image_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldImageCount returns the old "image_count" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldImageCount(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldImageCount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldImageCount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldImageCount: %w", err)
+ }
+ return oldValue.ImageCount, nil
+}
+
+// AddImageCount adds i to the "image_count" field.
+func (m *BatchImageItemMutation) AddImageCount(i int) {
+ if m.addimage_count != nil {
+ *m.addimage_count += i
+ } else {
+ m.addimage_count = &i
+ }
+}
+
+// AddedImageCount returns the value that was added to the "image_count" field in this mutation.
+func (m *BatchImageItemMutation) AddedImageCount() (r int, exists bool) {
+ v := m.addimage_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetImageCount resets all changes to the "image_count" field.
+func (m *BatchImageItemMutation) ResetImageCount() {
+ m.image_count = nil
+ m.addimage_count = nil
+}
+
+// SetErrorCode sets the "error_code" field.
+func (m *BatchImageItemMutation) SetErrorCode(s string) {
+ m.error_code = &s
+}
+
+// ErrorCode returns the value of the "error_code" field in the mutation.
+func (m *BatchImageItemMutation) ErrorCode() (r string, exists bool) {
+ v := m.error_code
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldErrorCode returns the old "error_code" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldErrorCode(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldErrorCode is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldErrorCode requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldErrorCode: %w", err)
+ }
+ return oldValue.ErrorCode, nil
+}
+
+// ClearErrorCode clears the value of the "error_code" field.
+func (m *BatchImageItemMutation) ClearErrorCode() {
+ m.error_code = nil
+ m.clearedFields[batchimageitem.FieldErrorCode] = struct{}{}
+}
+
+// ErrorCodeCleared returns if the "error_code" field was cleared in this mutation.
+func (m *BatchImageItemMutation) ErrorCodeCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldErrorCode]
+ return ok
+}
+
+// ResetErrorCode resets all changes to the "error_code" field.
+func (m *BatchImageItemMutation) ResetErrorCode() {
+ m.error_code = nil
+ delete(m.clearedFields, batchimageitem.FieldErrorCode)
+}
+
+// SetErrorMessage sets the "error_message" field.
+func (m *BatchImageItemMutation) SetErrorMessage(s string) {
+ m.error_message = &s
+}
+
+// ErrorMessage returns the value of the "error_message" field in the mutation.
+func (m *BatchImageItemMutation) ErrorMessage() (r string, exists bool) {
+ v := m.error_message
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldErrorMessage returns the old "error_message" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldErrorMessage(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldErrorMessage is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldErrorMessage requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldErrorMessage: %w", err)
+ }
+ return oldValue.ErrorMessage, nil
+}
+
+// ClearErrorMessage clears the value of the "error_message" field.
+func (m *BatchImageItemMutation) ClearErrorMessage() {
+ m.error_message = nil
+ m.clearedFields[batchimageitem.FieldErrorMessage] = struct{}{}
+}
+
+// ErrorMessageCleared returns if the "error_message" field was cleared in this mutation.
+func (m *BatchImageItemMutation) ErrorMessageCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldErrorMessage]
+ return ok
+}
+
+// ResetErrorMessage resets all changes to the "error_message" field.
+func (m *BatchImageItemMutation) ResetErrorMessage() {
+ m.error_message = nil
+ delete(m.clearedFields, batchimageitem.FieldErrorMessage)
+}
+
+// SetBilledAmount sets the "billed_amount" field.
+func (m *BatchImageItemMutation) SetBilledAmount(f float64) {
+ m.billed_amount = &f
+ m.addbilled_amount = nil
+}
+
+// BilledAmount returns the value of the "billed_amount" field in the mutation.
+func (m *BatchImageItemMutation) BilledAmount() (r float64, exists bool) {
+ v := m.billed_amount
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldBilledAmount returns the old "billed_amount" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldBilledAmount(ctx context.Context) (v *float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldBilledAmount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldBilledAmount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldBilledAmount: %w", err)
+ }
+ return oldValue.BilledAmount, nil
+}
+
+// AddBilledAmount adds f to the "billed_amount" field.
+func (m *BatchImageItemMutation) AddBilledAmount(f float64) {
+ if m.addbilled_amount != nil {
+ *m.addbilled_amount += f
+ } else {
+ m.addbilled_amount = &f
+ }
+}
+
+// AddedBilledAmount returns the value that was added to the "billed_amount" field in this mutation.
+func (m *BatchImageItemMutation) AddedBilledAmount() (r float64, exists bool) {
+ v := m.addbilled_amount
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearBilledAmount clears the value of the "billed_amount" field.
+func (m *BatchImageItemMutation) ClearBilledAmount() {
+ m.billed_amount = nil
+ m.addbilled_amount = nil
+ m.clearedFields[batchimageitem.FieldBilledAmount] = struct{}{}
+}
+
+// BilledAmountCleared returns if the "billed_amount" field was cleared in this mutation.
+func (m *BatchImageItemMutation) BilledAmountCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldBilledAmount]
+ return ok
+}
+
+// ResetBilledAmount resets all changes to the "billed_amount" field.
+func (m *BatchImageItemMutation) ResetBilledAmount() {
+ m.billed_amount = nil
+ m.addbilled_amount = nil
+ delete(m.clearedFields, batchimageitem.FieldBilledAmount)
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *BatchImageItemMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *BatchImageItemMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *BatchImageItemMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetIndexedAt sets the "indexed_at" field.
+func (m *BatchImageItemMutation) SetIndexedAt(t time.Time) {
+ m.indexed_at = &t
+}
+
+// IndexedAt returns the value of the "indexed_at" field in the mutation.
+func (m *BatchImageItemMutation) IndexedAt() (r time.Time, exists bool) {
+ v := m.indexed_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldIndexedAt returns the old "indexed_at" field's value of the BatchImageItem entity.
+// If the BatchImageItem object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageItemMutation) OldIndexedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldIndexedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldIndexedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldIndexedAt: %w", err)
+ }
+ return oldValue.IndexedAt, nil
+}
+
+// ClearIndexedAt clears the value of the "indexed_at" field.
+func (m *BatchImageItemMutation) ClearIndexedAt() {
+ m.indexed_at = nil
+ m.clearedFields[batchimageitem.FieldIndexedAt] = struct{}{}
+}
+
+// IndexedAtCleared returns if the "indexed_at" field was cleared in this mutation.
+func (m *BatchImageItemMutation) IndexedAtCleared() bool {
+ _, ok := m.clearedFields[batchimageitem.FieldIndexedAt]
+ return ok
+}
+
+// ResetIndexedAt resets all changes to the "indexed_at" field.
+func (m *BatchImageItemMutation) ResetIndexedAt() {
+ m.indexed_at = nil
+ delete(m.clearedFields, batchimageitem.FieldIndexedAt)
+}
+
+// Where appends a list predicates to the BatchImageItemMutation builder.
+func (m *BatchImageItemMutation) Where(ps ...predicate.BatchImageItem) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the BatchImageItemMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *BatchImageItemMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.BatchImageItem, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *BatchImageItemMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *BatchImageItemMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (BatchImageItem).
+func (m *BatchImageItemMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *BatchImageItemMutation) Fields() []string {
+ fields := make([]string, 0, 17)
+ if m.job_id != nil {
+ fields = append(fields, batchimageitem.FieldJobID)
+ }
+ if m.custom_id != nil {
+ fields = append(fields, batchimageitem.FieldCustomID)
+ }
+ if m.status != nil {
+ fields = append(fields, batchimageitem.FieldStatus)
+ }
+ if m.request_hash != nil {
+ fields = append(fields, batchimageitem.FieldRequestHash)
+ }
+ if m.prompt_preview != nil {
+ fields = append(fields, batchimageitem.FieldPromptPreview)
+ }
+ if m.provider_source_object != nil {
+ fields = append(fields, batchimageitem.FieldProviderSourceObject)
+ }
+ if m.source_line_number != nil {
+ fields = append(fields, batchimageitem.FieldSourceLineNumber)
+ }
+ if m.source_byte_offset != nil {
+ fields = append(fields, batchimageitem.FieldSourceByteOffset)
+ }
+ if m.source_byte_length != nil {
+ fields = append(fields, batchimageitem.FieldSourceByteLength)
+ }
+ if m.mime_type != nil {
+ fields = append(fields, batchimageitem.FieldMimeType)
+ }
+ if m.file_extension != nil {
+ fields = append(fields, batchimageitem.FieldFileExtension)
+ }
+ if m.image_count != nil {
+ fields = append(fields, batchimageitem.FieldImageCount)
+ }
+ if m.error_code != nil {
+ fields = append(fields, batchimageitem.FieldErrorCode)
+ }
+ if m.error_message != nil {
+ fields = append(fields, batchimageitem.FieldErrorMessage)
+ }
+ if m.billed_amount != nil {
+ fields = append(fields, batchimageitem.FieldBilledAmount)
+ }
+ if m.created_at != nil {
+ fields = append(fields, batchimageitem.FieldCreatedAt)
+ }
+ if m.indexed_at != nil {
+ fields = append(fields, batchimageitem.FieldIndexedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *BatchImageItemMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case batchimageitem.FieldJobID:
+ return m.JobID()
+ case batchimageitem.FieldCustomID:
+ return m.CustomID()
+ case batchimageitem.FieldStatus:
+ return m.Status()
+ case batchimageitem.FieldRequestHash:
+ return m.RequestHash()
+ case batchimageitem.FieldPromptPreview:
+ return m.PromptPreview()
+ case batchimageitem.FieldProviderSourceObject:
+ return m.ProviderSourceObject()
+ case batchimageitem.FieldSourceLineNumber:
+ return m.SourceLineNumber()
+ case batchimageitem.FieldSourceByteOffset:
+ return m.SourceByteOffset()
+ case batchimageitem.FieldSourceByteLength:
+ return m.SourceByteLength()
+ case batchimageitem.FieldMimeType:
+ return m.MimeType()
+ case batchimageitem.FieldFileExtension:
+ return m.FileExtension()
+ case batchimageitem.FieldImageCount:
+ return m.ImageCount()
+ case batchimageitem.FieldErrorCode:
+ return m.ErrorCode()
+ case batchimageitem.FieldErrorMessage:
+ return m.ErrorMessage()
+ case batchimageitem.FieldBilledAmount:
+ return m.BilledAmount()
+ case batchimageitem.FieldCreatedAt:
+ return m.CreatedAt()
+ case batchimageitem.FieldIndexedAt:
+ return m.IndexedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *BatchImageItemMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case batchimageitem.FieldJobID:
+ return m.OldJobID(ctx)
+ case batchimageitem.FieldCustomID:
+ return m.OldCustomID(ctx)
+ case batchimageitem.FieldStatus:
+ return m.OldStatus(ctx)
+ case batchimageitem.FieldRequestHash:
+ return m.OldRequestHash(ctx)
+ case batchimageitem.FieldPromptPreview:
+ return m.OldPromptPreview(ctx)
+ case batchimageitem.FieldProviderSourceObject:
+ return m.OldProviderSourceObject(ctx)
+ case batchimageitem.FieldSourceLineNumber:
+ return m.OldSourceLineNumber(ctx)
+ case batchimageitem.FieldSourceByteOffset:
+ return m.OldSourceByteOffset(ctx)
+ case batchimageitem.FieldSourceByteLength:
+ return m.OldSourceByteLength(ctx)
+ case batchimageitem.FieldMimeType:
+ return m.OldMimeType(ctx)
+ case batchimageitem.FieldFileExtension:
+ return m.OldFileExtension(ctx)
+ case batchimageitem.FieldImageCount:
+ return m.OldImageCount(ctx)
+ case batchimageitem.FieldErrorCode:
+ return m.OldErrorCode(ctx)
+ case batchimageitem.FieldErrorMessage:
+ return m.OldErrorMessage(ctx)
+ case batchimageitem.FieldBilledAmount:
+ return m.OldBilledAmount(ctx)
+ case batchimageitem.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case batchimageitem.FieldIndexedAt:
+ return m.OldIndexedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown BatchImageItem field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BatchImageItemMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case batchimageitem.FieldJobID:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetJobID(v)
+ return nil
+ case batchimageitem.FieldCustomID:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCustomID(v)
+ return nil
+ case batchimageitem.FieldStatus:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetStatus(v)
+ return nil
+ case batchimageitem.FieldRequestHash:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetRequestHash(v)
+ return nil
+ case batchimageitem.FieldPromptPreview:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetPromptPreview(v)
+ return nil
+ case batchimageitem.FieldProviderSourceObject:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetProviderSourceObject(v)
+ return nil
+ case batchimageitem.FieldSourceLineNumber:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSourceLineNumber(v)
+ return nil
+ case batchimageitem.FieldSourceByteOffset:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSourceByteOffset(v)
+ return nil
+ case batchimageitem.FieldSourceByteLength:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSourceByteLength(v)
+ return nil
+ case batchimageitem.FieldMimeType:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetMimeType(v)
+ return nil
+ case batchimageitem.FieldFileExtension:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetFileExtension(v)
+ return nil
+ case batchimageitem.FieldImageCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetImageCount(v)
+ return nil
+ case batchimageitem.FieldErrorCode:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetErrorCode(v)
+ return nil
+ case batchimageitem.FieldErrorMessage:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetErrorMessage(v)
+ return nil
+ case batchimageitem.FieldBilledAmount:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetBilledAmount(v)
+ return nil
+ case batchimageitem.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case batchimageitem.FieldIndexedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetIndexedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageItem field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *BatchImageItemMutation) AddedFields() []string {
+ var fields []string
+ if m.addsource_line_number != nil {
+ fields = append(fields, batchimageitem.FieldSourceLineNumber)
+ }
+ if m.addsource_byte_offset != nil {
+ fields = append(fields, batchimageitem.FieldSourceByteOffset)
+ }
+ if m.addsource_byte_length != nil {
+ fields = append(fields, batchimageitem.FieldSourceByteLength)
+ }
+ if m.addimage_count != nil {
+ fields = append(fields, batchimageitem.FieldImageCount)
+ }
+ if m.addbilled_amount != nil {
+ fields = append(fields, batchimageitem.FieldBilledAmount)
+ }
+ return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *BatchImageItemMutation) AddedField(name string) (ent.Value, bool) {
+ switch name {
+ case batchimageitem.FieldSourceLineNumber:
+ return m.AddedSourceLineNumber()
+ case batchimageitem.FieldSourceByteOffset:
+ return m.AddedSourceByteOffset()
+ case batchimageitem.FieldSourceByteLength:
+ return m.AddedSourceByteLength()
+ case batchimageitem.FieldImageCount:
+ return m.AddedImageCount()
+ case batchimageitem.FieldBilledAmount:
+ return m.AddedBilledAmount()
+ }
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BatchImageItemMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ case batchimageitem.FieldSourceLineNumber:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddSourceLineNumber(v)
+ return nil
+ case batchimageitem.FieldSourceByteOffset:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddSourceByteOffset(v)
+ return nil
+ case batchimageitem.FieldSourceByteLength:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddSourceByteLength(v)
+ return nil
+ case batchimageitem.FieldImageCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddImageCount(v)
+ return nil
+ case batchimageitem.FieldBilledAmount:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddBilledAmount(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageItem numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *BatchImageItemMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(batchimageitem.FieldRequestHash) {
+ fields = append(fields, batchimageitem.FieldRequestHash)
+ }
+ if m.FieldCleared(batchimageitem.FieldPromptPreview) {
+ fields = append(fields, batchimageitem.FieldPromptPreview)
+ }
+ if m.FieldCleared(batchimageitem.FieldProviderSourceObject) {
+ fields = append(fields, batchimageitem.FieldProviderSourceObject)
+ }
+ if m.FieldCleared(batchimageitem.FieldSourceLineNumber) {
+ fields = append(fields, batchimageitem.FieldSourceLineNumber)
+ }
+ if m.FieldCleared(batchimageitem.FieldSourceByteOffset) {
+ fields = append(fields, batchimageitem.FieldSourceByteOffset)
+ }
+ if m.FieldCleared(batchimageitem.FieldSourceByteLength) {
+ fields = append(fields, batchimageitem.FieldSourceByteLength)
+ }
+ if m.FieldCleared(batchimageitem.FieldMimeType) {
+ fields = append(fields, batchimageitem.FieldMimeType)
+ }
+ if m.FieldCleared(batchimageitem.FieldFileExtension) {
+ fields = append(fields, batchimageitem.FieldFileExtension)
+ }
+ if m.FieldCleared(batchimageitem.FieldErrorCode) {
+ fields = append(fields, batchimageitem.FieldErrorCode)
+ }
+ if m.FieldCleared(batchimageitem.FieldErrorMessage) {
+ fields = append(fields, batchimageitem.FieldErrorMessage)
+ }
+ if m.FieldCleared(batchimageitem.FieldBilledAmount) {
+ fields = append(fields, batchimageitem.FieldBilledAmount)
+ }
+ if m.FieldCleared(batchimageitem.FieldIndexedAt) {
+ fields = append(fields, batchimageitem.FieldIndexedAt)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *BatchImageItemMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *BatchImageItemMutation) ClearField(name string) error {
+ switch name {
+ case batchimageitem.FieldRequestHash:
+ m.ClearRequestHash()
+ return nil
+ case batchimageitem.FieldPromptPreview:
+ m.ClearPromptPreview()
+ return nil
+ case batchimageitem.FieldProviderSourceObject:
+ m.ClearProviderSourceObject()
+ return nil
+ case batchimageitem.FieldSourceLineNumber:
+ m.ClearSourceLineNumber()
+ return nil
+ case batchimageitem.FieldSourceByteOffset:
+ m.ClearSourceByteOffset()
+ return nil
+ case batchimageitem.FieldSourceByteLength:
+ m.ClearSourceByteLength()
+ return nil
+ case batchimageitem.FieldMimeType:
+ m.ClearMimeType()
+ return nil
+ case batchimageitem.FieldFileExtension:
+ m.ClearFileExtension()
+ return nil
+ case batchimageitem.FieldErrorCode:
+ m.ClearErrorCode()
+ return nil
+ case batchimageitem.FieldErrorMessage:
+ m.ClearErrorMessage()
+ return nil
+ case batchimageitem.FieldBilledAmount:
+ m.ClearBilledAmount()
+ return nil
+ case batchimageitem.FieldIndexedAt:
+ m.ClearIndexedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageItem nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *BatchImageItemMutation) ResetField(name string) error {
+ switch name {
+ case batchimageitem.FieldJobID:
+ m.ResetJobID()
+ return nil
+ case batchimageitem.FieldCustomID:
+ m.ResetCustomID()
+ return nil
+ case batchimageitem.FieldStatus:
+ m.ResetStatus()
+ return nil
+ case batchimageitem.FieldRequestHash:
+ m.ResetRequestHash()
+ return nil
+ case batchimageitem.FieldPromptPreview:
+ m.ResetPromptPreview()
+ return nil
+ case batchimageitem.FieldProviderSourceObject:
+ m.ResetProviderSourceObject()
+ return nil
+ case batchimageitem.FieldSourceLineNumber:
+ m.ResetSourceLineNumber()
+ return nil
+ case batchimageitem.FieldSourceByteOffset:
+ m.ResetSourceByteOffset()
+ return nil
+ case batchimageitem.FieldSourceByteLength:
+ m.ResetSourceByteLength()
+ return nil
+ case batchimageitem.FieldMimeType:
+ m.ResetMimeType()
+ return nil
+ case batchimageitem.FieldFileExtension:
+ m.ResetFileExtension()
+ return nil
+ case batchimageitem.FieldImageCount:
+ m.ResetImageCount()
+ return nil
+ case batchimageitem.FieldErrorCode:
+ m.ResetErrorCode()
+ return nil
+ case batchimageitem.FieldErrorMessage:
+ m.ResetErrorMessage()
+ return nil
+ case batchimageitem.FieldBilledAmount:
+ m.ResetBilledAmount()
+ return nil
+ case batchimageitem.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case batchimageitem.FieldIndexedAt:
+ m.ResetIndexedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageItem field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *BatchImageItemMutation) AddedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *BatchImageItemMutation) AddedIDs(name string) []ent.Value {
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *BatchImageItemMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *BatchImageItemMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *BatchImageItemMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *BatchImageItemMutation) EdgeCleared(name string) bool {
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *BatchImageItemMutation) ClearEdge(name string) error {
+ return fmt.Errorf("unknown BatchImageItem unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *BatchImageItemMutation) ResetEdge(name string) error {
+ return fmt.Errorf("unknown BatchImageItem edge %s", name)
+}
+
+// BatchImageJobMutation represents an operation that mutates the BatchImageJob nodes in the graph.
+type BatchImageJobMutation struct {
+ config
+ op Op
+ typ string
+ id *int64
+ batch_id *string
+ user_id *int64
+ adduser_id *int64
+ api_key_id *int64
+ addapi_key_id *int64
+ account_id *int64
+ addaccount_id *int64
+ provider *string
+ model *string
+ task_name *string
+ status *string
+ provider_job_name *string
+ provider_input_ref *string
+ provider_output_ref *string
+ gcs_input_uri *string
+ gcs_output_uri *string
+ item_count *int
+ additem_count *int
+ success_count *int
+ addsuccess_count *int
+ fail_count *int
+ addfail_count *int
+ cancelled_count *int
+ addcancelled_count *int
+ estimated_cost *float64
+ addestimated_cost *float64
+ hold_amount *float64
+ addhold_amount *float64
+ actual_cost *float64
+ addactual_cost *float64
+ currency *string
+ hold_id *string
+ idempotency_key *string
+ request_hash *string
+ manifest_hash *string
+ retry_count *int
+ addretry_count *int
+ version *int
+ addversion *int
+ output_expires_at *time.Time
+ input_deleted_at *time.Time
+ output_deleted_at *time.Time
+ downloaded_at *time.Time
+ user_deleted_at *time.Time
+ last_error_code *string
+ last_error_message *string
+ created_at *time.Time
+ updated_at *time.Time
+ submitted_at *time.Time
+ started_at *time.Time
+ finished_at *time.Time
+ settled_at *time.Time
+ clearedFields map[string]struct{}
+ done bool
+ oldValue func(context.Context) (*BatchImageJob, error)
+ predicates []predicate.BatchImageJob
+}
+
+var _ ent.Mutation = (*BatchImageJobMutation)(nil)
+
+// batchimagejobOption allows management of the mutation configuration using functional options.
+type batchimagejobOption func(*BatchImageJobMutation)
+
+// newBatchImageJobMutation creates new mutation for the BatchImageJob entity.
+func newBatchImageJobMutation(c config, op Op, opts ...batchimagejobOption) *BatchImageJobMutation {
+ m := &BatchImageJobMutation{
+ config: c,
+ op: op,
+ typ: TypeBatchImageJob,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withBatchImageJobID sets the ID field of the mutation.
+func withBatchImageJobID(id int64) batchimagejobOption {
+ return func(m *BatchImageJobMutation) {
+ var (
+ err error
+ once sync.Once
+ value *BatchImageJob
+ )
+ m.oldValue = func(ctx context.Context) (*BatchImageJob, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().BatchImageJob.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withBatchImageJob sets the old BatchImageJob of the mutation.
+func withBatchImageJob(node *BatchImageJob) batchimagejobOption {
+ return func(m *BatchImageJobMutation) {
+ m.oldValue = func(context.Context) (*BatchImageJob, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m BatchImageJobMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m BatchImageJobMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *BatchImageJobMutation) ID() (id int64, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *BatchImageJobMutation) IDs(ctx context.Context) ([]int64, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []int64{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().BatchImageJob.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetBatchID sets the "batch_id" field.
+func (m *BatchImageJobMutation) SetBatchID(s string) {
+ m.batch_id = &s
+}
+
+// BatchID returns the value of the "batch_id" field in the mutation.
+func (m *BatchImageJobMutation) BatchID() (r string, exists bool) {
+ v := m.batch_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldBatchID returns the old "batch_id" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldBatchID(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldBatchID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldBatchID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldBatchID: %w", err)
+ }
+ return oldValue.BatchID, nil
+}
+
+// ResetBatchID resets all changes to the "batch_id" field.
+func (m *BatchImageJobMutation) ResetBatchID() {
+ m.batch_id = nil
+}
+
+// SetUserID sets the "user_id" field.
+func (m *BatchImageJobMutation) SetUserID(i int64) {
+ m.user_id = &i
+ m.adduser_id = nil
+}
+
+// UserID returns the value of the "user_id" field in the mutation.
+func (m *BatchImageJobMutation) UserID() (r int64, exists bool) {
+ v := m.user_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUserID returns the old "user_id" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldUserID(ctx context.Context) (v int64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUserID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUserID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUserID: %w", err)
+ }
+ return oldValue.UserID, nil
+}
+
+// AddUserID adds i to the "user_id" field.
+func (m *BatchImageJobMutation) AddUserID(i int64) {
+ if m.adduser_id != nil {
+ *m.adduser_id += i
+ } else {
+ m.adduser_id = &i
+ }
+}
+
+// AddedUserID returns the value that was added to the "user_id" field in this mutation.
+func (m *BatchImageJobMutation) AddedUserID() (r int64, exists bool) {
+ v := m.adduser_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetUserID resets all changes to the "user_id" field.
+func (m *BatchImageJobMutation) ResetUserID() {
+ m.user_id = nil
+ m.adduser_id = nil
+}
+
+// SetAPIKeyID sets the "api_key_id" field.
+func (m *BatchImageJobMutation) SetAPIKeyID(i int64) {
+ m.api_key_id = &i
+ m.addapi_key_id = nil
+}
+
+// APIKeyID returns the value of the "api_key_id" field in the mutation.
+func (m *BatchImageJobMutation) APIKeyID() (r int64, exists bool) {
+ v := m.api_key_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldAPIKeyID returns the old "api_key_id" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldAPIKeyID(ctx context.Context) (v *int64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldAPIKeyID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldAPIKeyID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldAPIKeyID: %w", err)
+ }
+ return oldValue.APIKeyID, nil
+}
+
+// AddAPIKeyID adds i to the "api_key_id" field.
+func (m *BatchImageJobMutation) AddAPIKeyID(i int64) {
+ if m.addapi_key_id != nil {
+ *m.addapi_key_id += i
+ } else {
+ m.addapi_key_id = &i
+ }
+}
+
+// AddedAPIKeyID returns the value that was added to the "api_key_id" field in this mutation.
+func (m *BatchImageJobMutation) AddedAPIKeyID() (r int64, exists bool) {
+ v := m.addapi_key_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearAPIKeyID clears the value of the "api_key_id" field.
+func (m *BatchImageJobMutation) ClearAPIKeyID() {
+ m.api_key_id = nil
+ m.addapi_key_id = nil
+ m.clearedFields[batchimagejob.FieldAPIKeyID] = struct{}{}
+}
+
+// APIKeyIDCleared returns if the "api_key_id" field was cleared in this mutation.
+func (m *BatchImageJobMutation) APIKeyIDCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldAPIKeyID]
+ return ok
+}
+
+// ResetAPIKeyID resets all changes to the "api_key_id" field.
+func (m *BatchImageJobMutation) ResetAPIKeyID() {
+ m.api_key_id = nil
+ m.addapi_key_id = nil
+ delete(m.clearedFields, batchimagejob.FieldAPIKeyID)
+}
+
+// SetAccountID sets the "account_id" field.
+func (m *BatchImageJobMutation) SetAccountID(i int64) {
+ m.account_id = &i
+ m.addaccount_id = nil
+}
+
+// AccountID returns the value of the "account_id" field in the mutation.
+func (m *BatchImageJobMutation) AccountID() (r int64, exists bool) {
+ v := m.account_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldAccountID returns the old "account_id" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldAccountID(ctx context.Context) (v *int64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldAccountID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldAccountID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldAccountID: %w", err)
+ }
+ return oldValue.AccountID, nil
+}
+
+// AddAccountID adds i to the "account_id" field.
+func (m *BatchImageJobMutation) AddAccountID(i int64) {
+ if m.addaccount_id != nil {
+ *m.addaccount_id += i
+ } else {
+ m.addaccount_id = &i
+ }
+}
+
+// AddedAccountID returns the value that was added to the "account_id" field in this mutation.
+func (m *BatchImageJobMutation) AddedAccountID() (r int64, exists bool) {
+ v := m.addaccount_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearAccountID clears the value of the "account_id" field.
+func (m *BatchImageJobMutation) ClearAccountID() {
+ m.account_id = nil
+ m.addaccount_id = nil
+ m.clearedFields[batchimagejob.FieldAccountID] = struct{}{}
+}
+
+// AccountIDCleared returns if the "account_id" field was cleared in this mutation.
+func (m *BatchImageJobMutation) AccountIDCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldAccountID]
+ return ok
+}
+
+// ResetAccountID resets all changes to the "account_id" field.
+func (m *BatchImageJobMutation) ResetAccountID() {
+ m.account_id = nil
+ m.addaccount_id = nil
+ delete(m.clearedFields, batchimagejob.FieldAccountID)
+}
+
+// SetProvider sets the "provider" field.
+func (m *BatchImageJobMutation) SetProvider(s string) {
+ m.provider = &s
+}
+
+// Provider returns the value of the "provider" field in the mutation.
+func (m *BatchImageJobMutation) Provider() (r string, exists bool) {
+ v := m.provider
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldProvider returns the old "provider" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldProvider(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldProvider is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldProvider requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldProvider: %w", err)
+ }
+ return oldValue.Provider, nil
+}
+
+// ResetProvider resets all changes to the "provider" field.
+func (m *BatchImageJobMutation) ResetProvider() {
+ m.provider = nil
+}
+
+// SetModel sets the "model" field.
+func (m *BatchImageJobMutation) SetModel(s string) {
+ m.model = &s
+}
+
+// Model returns the value of the "model" field in the mutation.
+func (m *BatchImageJobMutation) Model() (r string, exists bool) {
+ v := m.model
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldModel returns the old "model" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldModel(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldModel is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldModel requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldModel: %w", err)
+ }
+ return oldValue.Model, nil
+}
+
+// ResetModel resets all changes to the "model" field.
+func (m *BatchImageJobMutation) ResetModel() {
+ m.model = nil
+}
+
+// SetTaskName sets the "task_name" field.
+func (m *BatchImageJobMutation) SetTaskName(s string) {
+ m.task_name = &s
+}
+
+// TaskName returns the value of the "task_name" field in the mutation.
+func (m *BatchImageJobMutation) TaskName() (r string, exists bool) {
+ v := m.task_name
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldTaskName returns the old "task_name" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldTaskName(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldTaskName is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldTaskName requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldTaskName: %w", err)
+ }
+ return oldValue.TaskName, nil
+}
+
+// ResetTaskName resets all changes to the "task_name" field.
+func (m *BatchImageJobMutation) ResetTaskName() {
+ m.task_name = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *BatchImageJobMutation) SetStatus(s string) {
+ m.status = &s
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *BatchImageJobMutation) Status() (r string, exists bool) {
+ v := m.status
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldStatus(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldStatus requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+ }
+ return oldValue.Status, nil
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *BatchImageJobMutation) ResetStatus() {
+ m.status = nil
+}
+
+// SetProviderJobName sets the "provider_job_name" field.
+func (m *BatchImageJobMutation) SetProviderJobName(s string) {
+ m.provider_job_name = &s
+}
+
+// ProviderJobName returns the value of the "provider_job_name" field in the mutation.
+func (m *BatchImageJobMutation) ProviderJobName() (r string, exists bool) {
+ v := m.provider_job_name
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldProviderJobName returns the old "provider_job_name" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldProviderJobName(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldProviderJobName is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldProviderJobName requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldProviderJobName: %w", err)
+ }
+ return oldValue.ProviderJobName, nil
+}
+
+// ClearProviderJobName clears the value of the "provider_job_name" field.
+func (m *BatchImageJobMutation) ClearProviderJobName() {
+ m.provider_job_name = nil
+ m.clearedFields[batchimagejob.FieldProviderJobName] = struct{}{}
+}
+
+// ProviderJobNameCleared returns if the "provider_job_name" field was cleared in this mutation.
+func (m *BatchImageJobMutation) ProviderJobNameCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldProviderJobName]
+ return ok
+}
+
+// ResetProviderJobName resets all changes to the "provider_job_name" field.
+func (m *BatchImageJobMutation) ResetProviderJobName() {
+ m.provider_job_name = nil
+ delete(m.clearedFields, batchimagejob.FieldProviderJobName)
+}
+
+// SetProviderInputRef sets the "provider_input_ref" field.
+func (m *BatchImageJobMutation) SetProviderInputRef(s string) {
+ m.provider_input_ref = &s
+}
+
+// ProviderInputRef returns the value of the "provider_input_ref" field in the mutation.
+func (m *BatchImageJobMutation) ProviderInputRef() (r string, exists bool) {
+ v := m.provider_input_ref
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldProviderInputRef returns the old "provider_input_ref" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldProviderInputRef(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldProviderInputRef is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldProviderInputRef requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldProviderInputRef: %w", err)
+ }
+ return oldValue.ProviderInputRef, nil
+}
+
+// ClearProviderInputRef clears the value of the "provider_input_ref" field.
+func (m *BatchImageJobMutation) ClearProviderInputRef() {
+ m.provider_input_ref = nil
+ m.clearedFields[batchimagejob.FieldProviderInputRef] = struct{}{}
+}
+
+// ProviderInputRefCleared returns if the "provider_input_ref" field was cleared in this mutation.
+func (m *BatchImageJobMutation) ProviderInputRefCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldProviderInputRef]
+ return ok
+}
+
+// ResetProviderInputRef resets all changes to the "provider_input_ref" field.
+func (m *BatchImageJobMutation) ResetProviderInputRef() {
+ m.provider_input_ref = nil
+ delete(m.clearedFields, batchimagejob.FieldProviderInputRef)
+}
+
+// SetProviderOutputRef sets the "provider_output_ref" field.
+func (m *BatchImageJobMutation) SetProviderOutputRef(s string) {
+ m.provider_output_ref = &s
+}
+
+// ProviderOutputRef returns the value of the "provider_output_ref" field in the mutation.
+func (m *BatchImageJobMutation) ProviderOutputRef() (r string, exists bool) {
+ v := m.provider_output_ref
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldProviderOutputRef returns the old "provider_output_ref" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldProviderOutputRef(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldProviderOutputRef is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldProviderOutputRef requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldProviderOutputRef: %w", err)
+ }
+ return oldValue.ProviderOutputRef, nil
+}
+
+// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
+func (m *BatchImageJobMutation) ClearProviderOutputRef() {
+ m.provider_output_ref = nil
+ m.clearedFields[batchimagejob.FieldProviderOutputRef] = struct{}{}
+}
+
+// ProviderOutputRefCleared returns if the "provider_output_ref" field was cleared in this mutation.
+func (m *BatchImageJobMutation) ProviderOutputRefCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldProviderOutputRef]
+ return ok
+}
+
+// ResetProviderOutputRef resets all changes to the "provider_output_ref" field.
+func (m *BatchImageJobMutation) ResetProviderOutputRef() {
+ m.provider_output_ref = nil
+ delete(m.clearedFields, batchimagejob.FieldProviderOutputRef)
+}
+
+// SetGcsInputURI sets the "gcs_input_uri" field.
+func (m *BatchImageJobMutation) SetGcsInputURI(s string) {
+ m.gcs_input_uri = &s
+}
+
+// GcsInputURI returns the value of the "gcs_input_uri" field in the mutation.
+func (m *BatchImageJobMutation) GcsInputURI() (r string, exists bool) {
+ v := m.gcs_input_uri
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldGcsInputURI returns the old "gcs_input_uri" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldGcsInputURI(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldGcsInputURI is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldGcsInputURI requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldGcsInputURI: %w", err)
+ }
+ return oldValue.GcsInputURI, nil
+}
+
+// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
+func (m *BatchImageJobMutation) ClearGcsInputURI() {
+ m.gcs_input_uri = nil
+ m.clearedFields[batchimagejob.FieldGcsInputURI] = struct{}{}
+}
+
+// GcsInputURICleared returns if the "gcs_input_uri" field was cleared in this mutation.
+func (m *BatchImageJobMutation) GcsInputURICleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldGcsInputURI]
+ return ok
+}
+
+// ResetGcsInputURI resets all changes to the "gcs_input_uri" field.
+func (m *BatchImageJobMutation) ResetGcsInputURI() {
+ m.gcs_input_uri = nil
+ delete(m.clearedFields, batchimagejob.FieldGcsInputURI)
+}
+
+// SetGcsOutputURI sets the "gcs_output_uri" field.
+func (m *BatchImageJobMutation) SetGcsOutputURI(s string) {
+ m.gcs_output_uri = &s
+}
+
+// GcsOutputURI returns the value of the "gcs_output_uri" field in the mutation.
+func (m *BatchImageJobMutation) GcsOutputURI() (r string, exists bool) {
+ v := m.gcs_output_uri
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldGcsOutputURI returns the old "gcs_output_uri" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldGcsOutputURI(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldGcsOutputURI is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldGcsOutputURI requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldGcsOutputURI: %w", err)
+ }
+ return oldValue.GcsOutputURI, nil
+}
+
+// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
+func (m *BatchImageJobMutation) ClearGcsOutputURI() {
+ m.gcs_output_uri = nil
+ m.clearedFields[batchimagejob.FieldGcsOutputURI] = struct{}{}
+}
+
+// GcsOutputURICleared returns if the "gcs_output_uri" field was cleared in this mutation.
+func (m *BatchImageJobMutation) GcsOutputURICleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldGcsOutputURI]
+ return ok
+}
+
+// ResetGcsOutputURI resets all changes to the "gcs_output_uri" field.
+func (m *BatchImageJobMutation) ResetGcsOutputURI() {
+ m.gcs_output_uri = nil
+ delete(m.clearedFields, batchimagejob.FieldGcsOutputURI)
+}
+
+// SetItemCount sets the "item_count" field.
+func (m *BatchImageJobMutation) SetItemCount(i int) {
+ m.item_count = &i
+ m.additem_count = nil
+}
+
+// ItemCount returns the value of the "item_count" field in the mutation.
+func (m *BatchImageJobMutation) ItemCount() (r int, exists bool) {
+ v := m.item_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldItemCount returns the old "item_count" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldItemCount(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldItemCount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldItemCount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldItemCount: %w", err)
+ }
+ return oldValue.ItemCount, nil
+}
+
+// AddItemCount adds i to the "item_count" field.
+func (m *BatchImageJobMutation) AddItemCount(i int) {
+ if m.additem_count != nil {
+ *m.additem_count += i
+ } else {
+ m.additem_count = &i
+ }
+}
+
+// AddedItemCount returns the value that was added to the "item_count" field in this mutation.
+func (m *BatchImageJobMutation) AddedItemCount() (r int, exists bool) {
+ v := m.additem_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetItemCount resets all changes to the "item_count" field.
+func (m *BatchImageJobMutation) ResetItemCount() {
+ m.item_count = nil
+ m.additem_count = nil
+}
+
+// SetSuccessCount sets the "success_count" field.
+func (m *BatchImageJobMutation) SetSuccessCount(i int) {
+ m.success_count = &i
+ m.addsuccess_count = nil
+}
+
+// SuccessCount returns the value of the "success_count" field in the mutation.
+func (m *BatchImageJobMutation) SuccessCount() (r int, exists bool) {
+ v := m.success_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSuccessCount returns the old "success_count" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldSuccessCount(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSuccessCount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSuccessCount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSuccessCount: %w", err)
+ }
+ return oldValue.SuccessCount, nil
+}
+
+// AddSuccessCount adds i to the "success_count" field.
+func (m *BatchImageJobMutation) AddSuccessCount(i int) {
+ if m.addsuccess_count != nil {
+ *m.addsuccess_count += i
+ } else {
+ m.addsuccess_count = &i
+ }
+}
+
+// AddedSuccessCount returns the value that was added to the "success_count" field in this mutation.
+func (m *BatchImageJobMutation) AddedSuccessCount() (r int, exists bool) {
+ v := m.addsuccess_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetSuccessCount resets all changes to the "success_count" field.
+func (m *BatchImageJobMutation) ResetSuccessCount() {
+ m.success_count = nil
+ m.addsuccess_count = nil
+}
+
+// SetFailCount sets the "fail_count" field.
+func (m *BatchImageJobMutation) SetFailCount(i int) {
+ m.fail_count = &i
+ m.addfail_count = nil
+}
+
+// FailCount returns the value of the "fail_count" field in the mutation.
+func (m *BatchImageJobMutation) FailCount() (r int, exists bool) {
+ v := m.fail_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldFailCount returns the old "fail_count" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldFailCount(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldFailCount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldFailCount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldFailCount: %w", err)
+ }
+ return oldValue.FailCount, nil
+}
+
+// AddFailCount adds i to the "fail_count" field.
+func (m *BatchImageJobMutation) AddFailCount(i int) {
+ if m.addfail_count != nil {
+ *m.addfail_count += i
+ } else {
+ m.addfail_count = &i
+ }
+}
+
+// AddedFailCount returns the value that was added to the "fail_count" field in this mutation.
+func (m *BatchImageJobMutation) AddedFailCount() (r int, exists bool) {
+ v := m.addfail_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetFailCount resets all changes to the "fail_count" field.
+func (m *BatchImageJobMutation) ResetFailCount() {
+ m.fail_count = nil
+ m.addfail_count = nil
+}
+
+// SetCancelledCount sets the "cancelled_count" field.
+func (m *BatchImageJobMutation) SetCancelledCount(i int) {
+ m.cancelled_count = &i
+ m.addcancelled_count = nil
+}
+
+// CancelledCount returns the value of the "cancelled_count" field in the mutation.
+func (m *BatchImageJobMutation) CancelledCount() (r int, exists bool) {
+ v := m.cancelled_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCancelledCount returns the old "cancelled_count" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldCancelledCount(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCancelledCount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCancelledCount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCancelledCount: %w", err)
+ }
+ return oldValue.CancelledCount, nil
+}
+
+// AddCancelledCount adds i to the "cancelled_count" field.
+func (m *BatchImageJobMutation) AddCancelledCount(i int) {
+ if m.addcancelled_count != nil {
+ *m.addcancelled_count += i
+ } else {
+ m.addcancelled_count = &i
+ }
+}
+
+// AddedCancelledCount returns the value that was added to the "cancelled_count" field in this mutation.
+func (m *BatchImageJobMutation) AddedCancelledCount() (r int, exists bool) {
+ v := m.addcancelled_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetCancelledCount resets all changes to the "cancelled_count" field.
+func (m *BatchImageJobMutation) ResetCancelledCount() {
+ m.cancelled_count = nil
+ m.addcancelled_count = nil
+}
+
+// SetEstimatedCost sets the "estimated_cost" field.
+func (m *BatchImageJobMutation) SetEstimatedCost(f float64) {
+ m.estimated_cost = &f
+ m.addestimated_cost = nil
+}
+
+// EstimatedCost returns the value of the "estimated_cost" field in the mutation.
+func (m *BatchImageJobMutation) EstimatedCost() (r float64, exists bool) {
+ v := m.estimated_cost
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldEstimatedCost returns the old "estimated_cost" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldEstimatedCost(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldEstimatedCost is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldEstimatedCost requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldEstimatedCost: %w", err)
+ }
+ return oldValue.EstimatedCost, nil
+}
+
+// AddEstimatedCost adds f to the "estimated_cost" field.
+func (m *BatchImageJobMutation) AddEstimatedCost(f float64) {
+ if m.addestimated_cost != nil {
+ *m.addestimated_cost += f
+ } else {
+ m.addestimated_cost = &f
+ }
+}
+
+// AddedEstimatedCost returns the value that was added to the "estimated_cost" field in this mutation.
+func (m *BatchImageJobMutation) AddedEstimatedCost() (r float64, exists bool) {
+ v := m.addestimated_cost
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetEstimatedCost resets all changes to the "estimated_cost" field.
+func (m *BatchImageJobMutation) ResetEstimatedCost() {
+ m.estimated_cost = nil
+ m.addestimated_cost = nil
+}
+
+// SetHoldAmount sets the "hold_amount" field.
+func (m *BatchImageJobMutation) SetHoldAmount(f float64) {
+ m.hold_amount = &f
+ m.addhold_amount = nil
+}
+
+// HoldAmount returns the value of the "hold_amount" field in the mutation.
+func (m *BatchImageJobMutation) HoldAmount() (r float64, exists bool) {
+ v := m.hold_amount
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHoldAmount returns the old "hold_amount" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldHoldAmount(ctx context.Context) (v *float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHoldAmount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHoldAmount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHoldAmount: %w", err)
+ }
+ return oldValue.HoldAmount, nil
+}
+
+// AddHoldAmount adds f to the "hold_amount" field.
+func (m *BatchImageJobMutation) AddHoldAmount(f float64) {
+ if m.addhold_amount != nil {
+ *m.addhold_amount += f
+ } else {
+ m.addhold_amount = &f
+ }
+}
+
+// AddedHoldAmount returns the value that was added to the "hold_amount" field in this mutation.
+func (m *BatchImageJobMutation) AddedHoldAmount() (r float64, exists bool) {
+ v := m.addhold_amount
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearHoldAmount clears the value of the "hold_amount" field.
+func (m *BatchImageJobMutation) ClearHoldAmount() {
+ m.hold_amount = nil
+ m.addhold_amount = nil
+ m.clearedFields[batchimagejob.FieldHoldAmount] = struct{}{}
+}
+
+// HoldAmountCleared returns if the "hold_amount" field was cleared in this mutation.
+func (m *BatchImageJobMutation) HoldAmountCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldHoldAmount]
+ return ok
+}
+
+// ResetHoldAmount resets all changes to the "hold_amount" field.
+func (m *BatchImageJobMutation) ResetHoldAmount() {
+ m.hold_amount = nil
+ m.addhold_amount = nil
+ delete(m.clearedFields, batchimagejob.FieldHoldAmount)
+}
+
+// SetActualCost sets the "actual_cost" field.
+func (m *BatchImageJobMutation) SetActualCost(f float64) {
+ m.actual_cost = &f
+ m.addactual_cost = nil
+}
+
+// ActualCost returns the value of the "actual_cost" field in the mutation.
+func (m *BatchImageJobMutation) ActualCost() (r float64, exists bool) {
+ v := m.actual_cost
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldActualCost returns the old "actual_cost" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldActualCost(ctx context.Context) (v *float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldActualCost is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldActualCost requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldActualCost: %w", err)
+ }
+ return oldValue.ActualCost, nil
+}
+
+// AddActualCost adds f to the "actual_cost" field.
+func (m *BatchImageJobMutation) AddActualCost(f float64) {
+ if m.addactual_cost != nil {
+ *m.addactual_cost += f
+ } else {
+ m.addactual_cost = &f
+ }
+}
+
+// AddedActualCost returns the value that was added to the "actual_cost" field in this mutation.
+func (m *BatchImageJobMutation) AddedActualCost() (r float64, exists bool) {
+ v := m.addactual_cost
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearActualCost clears the value of the "actual_cost" field.
+func (m *BatchImageJobMutation) ClearActualCost() {
+ m.actual_cost = nil
+ m.addactual_cost = nil
+ m.clearedFields[batchimagejob.FieldActualCost] = struct{}{}
+}
+
+// ActualCostCleared returns if the "actual_cost" field was cleared in this mutation.
+func (m *BatchImageJobMutation) ActualCostCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldActualCost]
+ return ok
+}
+
+// ResetActualCost resets all changes to the "actual_cost" field.
+func (m *BatchImageJobMutation) ResetActualCost() {
+ m.actual_cost = nil
+ m.addactual_cost = nil
+ delete(m.clearedFields, batchimagejob.FieldActualCost)
+}
+
+// SetCurrency sets the "currency" field.
+func (m *BatchImageJobMutation) SetCurrency(s string) {
+ m.currency = &s
+}
+
+// Currency returns the value of the "currency" field in the mutation.
+func (m *BatchImageJobMutation) Currency() (r string, exists bool) {
+ v := m.currency
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCurrency returns the old "currency" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldCurrency(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCurrency is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCurrency requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCurrency: %w", err)
+ }
+ return oldValue.Currency, nil
+}
+
+// ResetCurrency resets all changes to the "currency" field.
+func (m *BatchImageJobMutation) ResetCurrency() {
+ m.currency = nil
+}
+
+// SetHoldID sets the "hold_id" field.
+func (m *BatchImageJobMutation) SetHoldID(s string) {
+ m.hold_id = &s
+}
+
+// HoldID returns the value of the "hold_id" field in the mutation.
+func (m *BatchImageJobMutation) HoldID() (r string, exists bool) {
+ v := m.hold_id
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHoldID returns the old "hold_id" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldHoldID(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHoldID is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHoldID requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHoldID: %w", err)
+ }
+ return oldValue.HoldID, nil
+}
+
+// ClearHoldID clears the value of the "hold_id" field.
+func (m *BatchImageJobMutation) ClearHoldID() {
+ m.hold_id = nil
+ m.clearedFields[batchimagejob.FieldHoldID] = struct{}{}
+}
+
+// HoldIDCleared returns if the "hold_id" field was cleared in this mutation.
+func (m *BatchImageJobMutation) HoldIDCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldHoldID]
+ return ok
+}
+
+// ResetHoldID resets all changes to the "hold_id" field.
+func (m *BatchImageJobMutation) ResetHoldID() {
+ m.hold_id = nil
+ delete(m.clearedFields, batchimagejob.FieldHoldID)
+}
+
+// SetIdempotencyKey sets the "idempotency_key" field.
+func (m *BatchImageJobMutation) SetIdempotencyKey(s string) {
+ m.idempotency_key = &s
+}
+
+// IdempotencyKey returns the value of the "idempotency_key" field in the mutation.
+func (m *BatchImageJobMutation) IdempotencyKey() (r string, exists bool) {
+ v := m.idempotency_key
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldIdempotencyKey returns the old "idempotency_key" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldIdempotencyKey(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldIdempotencyKey is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldIdempotencyKey requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldIdempotencyKey: %w", err)
+ }
+ return oldValue.IdempotencyKey, nil
+}
+
+// ClearIdempotencyKey clears the value of the "idempotency_key" field.
+func (m *BatchImageJobMutation) ClearIdempotencyKey() {
+ m.idempotency_key = nil
+ m.clearedFields[batchimagejob.FieldIdempotencyKey] = struct{}{}
+}
+
+// IdempotencyKeyCleared returns if the "idempotency_key" field was cleared in this mutation.
+func (m *BatchImageJobMutation) IdempotencyKeyCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldIdempotencyKey]
+ return ok
+}
+
+// ResetIdempotencyKey resets all changes to the "idempotency_key" field.
+func (m *BatchImageJobMutation) ResetIdempotencyKey() {
+ m.idempotency_key = nil
+ delete(m.clearedFields, batchimagejob.FieldIdempotencyKey)
+}
+
+// SetRequestHash sets the "request_hash" field.
+func (m *BatchImageJobMutation) SetRequestHash(s string) {
+ m.request_hash = &s
+}
+
+// RequestHash returns the value of the "request_hash" field in the mutation.
+func (m *BatchImageJobMutation) RequestHash() (r string, exists bool) {
+ v := m.request_hash
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldRequestHash returns the old "request_hash" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldRequestHash(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldRequestHash is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldRequestHash requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldRequestHash: %w", err)
+ }
+ return oldValue.RequestHash, nil
+}
+
+// ClearRequestHash clears the value of the "request_hash" field.
+func (m *BatchImageJobMutation) ClearRequestHash() {
+ m.request_hash = nil
+ m.clearedFields[batchimagejob.FieldRequestHash] = struct{}{}
+}
+
+// RequestHashCleared returns if the "request_hash" field was cleared in this mutation.
+func (m *BatchImageJobMutation) RequestHashCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldRequestHash]
+ return ok
+}
+
+// ResetRequestHash resets all changes to the "request_hash" field.
+func (m *BatchImageJobMutation) ResetRequestHash() {
+ m.request_hash = nil
+ delete(m.clearedFields, batchimagejob.FieldRequestHash)
+}
+
+// SetManifestHash sets the "manifest_hash" field.
+func (m *BatchImageJobMutation) SetManifestHash(s string) {
+ m.manifest_hash = &s
+}
+
+// ManifestHash returns the value of the "manifest_hash" field in the mutation.
+func (m *BatchImageJobMutation) ManifestHash() (r string, exists bool) {
+ v := m.manifest_hash
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldManifestHash returns the old "manifest_hash" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldManifestHash(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldManifestHash is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldManifestHash requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldManifestHash: %w", err)
+ }
+ return oldValue.ManifestHash, nil
+}
+
+// ClearManifestHash clears the value of the "manifest_hash" field.
+func (m *BatchImageJobMutation) ClearManifestHash() {
+ m.manifest_hash = nil
+ m.clearedFields[batchimagejob.FieldManifestHash] = struct{}{}
+}
+
+// ManifestHashCleared returns if the "manifest_hash" field was cleared in this mutation.
+func (m *BatchImageJobMutation) ManifestHashCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldManifestHash]
+ return ok
+}
+
+// ResetManifestHash resets all changes to the "manifest_hash" field.
+func (m *BatchImageJobMutation) ResetManifestHash() {
+ m.manifest_hash = nil
+ delete(m.clearedFields, batchimagejob.FieldManifestHash)
+}
+
+// SetRetryCount sets the "retry_count" field.
+func (m *BatchImageJobMutation) SetRetryCount(i int) {
+ m.retry_count = &i
+ m.addretry_count = nil
+}
+
+// RetryCount returns the value of the "retry_count" field in the mutation.
+func (m *BatchImageJobMutation) RetryCount() (r int, exists bool) {
+ v := m.retry_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldRetryCount returns the old "retry_count" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldRetryCount(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldRetryCount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldRetryCount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldRetryCount: %w", err)
+ }
+ return oldValue.RetryCount, nil
+}
+
+// AddRetryCount adds i to the "retry_count" field.
+func (m *BatchImageJobMutation) AddRetryCount(i int) {
+ if m.addretry_count != nil {
+ *m.addretry_count += i
+ } else {
+ m.addretry_count = &i
+ }
+}
+
+// AddedRetryCount returns the value that was added to the "retry_count" field in this mutation.
+func (m *BatchImageJobMutation) AddedRetryCount() (r int, exists bool) {
+ v := m.addretry_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetRetryCount resets all changes to the "retry_count" field.
+func (m *BatchImageJobMutation) ResetRetryCount() {
+ m.retry_count = nil
+ m.addretry_count = nil
+}
+
+// SetVersion sets the "version" field.
+func (m *BatchImageJobMutation) SetVersion(i int) {
+ m.version = &i
+ m.addversion = nil
+}
+
+// Version returns the value of the "version" field in the mutation.
+func (m *BatchImageJobMutation) Version() (r int, exists bool) {
+ v := m.version
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVersion returns the old "version" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldVersion(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVersion is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVersion requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVersion: %w", err)
+ }
+ return oldValue.Version, nil
+}
+
+// AddVersion adds i to the "version" field.
+func (m *BatchImageJobMutation) AddVersion(i int) {
+ if m.addversion != nil {
+ *m.addversion += i
+ } else {
+ m.addversion = &i
+ }
+}
+
+// AddedVersion returns the value that was added to the "version" field in this mutation.
+func (m *BatchImageJobMutation) AddedVersion() (r int, exists bool) {
+ v := m.addversion
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetVersion resets all changes to the "version" field.
+func (m *BatchImageJobMutation) ResetVersion() {
+ m.version = nil
+ m.addversion = nil
+}
+
+// SetOutputExpiresAt sets the "output_expires_at" field.
+func (m *BatchImageJobMutation) SetOutputExpiresAt(t time.Time) {
+ m.output_expires_at = &t
+}
+
+// OutputExpiresAt returns the value of the "output_expires_at" field in the mutation.
+func (m *BatchImageJobMutation) OutputExpiresAt() (r time.Time, exists bool) {
+ v := m.output_expires_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldOutputExpiresAt returns the old "output_expires_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldOutputExpiresAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldOutputExpiresAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldOutputExpiresAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldOutputExpiresAt: %w", err)
+ }
+ return oldValue.OutputExpiresAt, nil
+}
+
+// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
+func (m *BatchImageJobMutation) ClearOutputExpiresAt() {
+ m.output_expires_at = nil
+ m.clearedFields[batchimagejob.FieldOutputExpiresAt] = struct{}{}
+}
+
+// OutputExpiresAtCleared returns if the "output_expires_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) OutputExpiresAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldOutputExpiresAt]
+ return ok
+}
+
+// ResetOutputExpiresAt resets all changes to the "output_expires_at" field.
+func (m *BatchImageJobMutation) ResetOutputExpiresAt() {
+ m.output_expires_at = nil
+ delete(m.clearedFields, batchimagejob.FieldOutputExpiresAt)
+}
+
+// SetInputDeletedAt sets the "input_deleted_at" field.
+func (m *BatchImageJobMutation) SetInputDeletedAt(t time.Time) {
+ m.input_deleted_at = &t
+}
+
+// InputDeletedAt returns the value of the "input_deleted_at" field in the mutation.
+func (m *BatchImageJobMutation) InputDeletedAt() (r time.Time, exists bool) {
+ v := m.input_deleted_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldInputDeletedAt returns the old "input_deleted_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldInputDeletedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldInputDeletedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldInputDeletedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldInputDeletedAt: %w", err)
+ }
+ return oldValue.InputDeletedAt, nil
+}
+
+// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
+func (m *BatchImageJobMutation) ClearInputDeletedAt() {
+ m.input_deleted_at = nil
+ m.clearedFields[batchimagejob.FieldInputDeletedAt] = struct{}{}
+}
+
+// InputDeletedAtCleared returns if the "input_deleted_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) InputDeletedAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldInputDeletedAt]
+ return ok
+}
+
+// ResetInputDeletedAt resets all changes to the "input_deleted_at" field.
+func (m *BatchImageJobMutation) ResetInputDeletedAt() {
+ m.input_deleted_at = nil
+ delete(m.clearedFields, batchimagejob.FieldInputDeletedAt)
+}
+
+// SetOutputDeletedAt sets the "output_deleted_at" field.
+func (m *BatchImageJobMutation) SetOutputDeletedAt(t time.Time) {
+ m.output_deleted_at = &t
+}
+
+// OutputDeletedAt returns the value of the "output_deleted_at" field in the mutation.
+func (m *BatchImageJobMutation) OutputDeletedAt() (r time.Time, exists bool) {
+ v := m.output_deleted_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldOutputDeletedAt returns the old "output_deleted_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldOutputDeletedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldOutputDeletedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldOutputDeletedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldOutputDeletedAt: %w", err)
+ }
+ return oldValue.OutputDeletedAt, nil
+}
+
+// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
+func (m *BatchImageJobMutation) ClearOutputDeletedAt() {
+ m.output_deleted_at = nil
+ m.clearedFields[batchimagejob.FieldOutputDeletedAt] = struct{}{}
+}
+
+// OutputDeletedAtCleared returns if the "output_deleted_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) OutputDeletedAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldOutputDeletedAt]
+ return ok
+}
+
+// ResetOutputDeletedAt resets all changes to the "output_deleted_at" field.
+func (m *BatchImageJobMutation) ResetOutputDeletedAt() {
+ m.output_deleted_at = nil
+ delete(m.clearedFields, batchimagejob.FieldOutputDeletedAt)
+}
+
+// SetDownloadedAt sets the "downloaded_at" field.
+func (m *BatchImageJobMutation) SetDownloadedAt(t time.Time) {
+ m.downloaded_at = &t
+}
+
+// DownloadedAt returns the value of the "downloaded_at" field in the mutation.
+func (m *BatchImageJobMutation) DownloadedAt() (r time.Time, exists bool) {
+ v := m.downloaded_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldDownloadedAt returns the old "downloaded_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldDownloadedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldDownloadedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldDownloadedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldDownloadedAt: %w", err)
+ }
+ return oldValue.DownloadedAt, nil
+}
+
+// ClearDownloadedAt clears the value of the "downloaded_at" field.
+func (m *BatchImageJobMutation) ClearDownloadedAt() {
+ m.downloaded_at = nil
+ m.clearedFields[batchimagejob.FieldDownloadedAt] = struct{}{}
+}
+
+// DownloadedAtCleared returns if the "downloaded_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) DownloadedAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldDownloadedAt]
+ return ok
+}
+
+// ResetDownloadedAt resets all changes to the "downloaded_at" field.
+func (m *BatchImageJobMutation) ResetDownloadedAt() {
+ m.downloaded_at = nil
+ delete(m.clearedFields, batchimagejob.FieldDownloadedAt)
+}
+
+// SetUserDeletedAt sets the "user_deleted_at" field.
+func (m *BatchImageJobMutation) SetUserDeletedAt(t time.Time) {
+ m.user_deleted_at = &t
+}
+
+// UserDeletedAt returns the value of the "user_deleted_at" field in the mutation.
+func (m *BatchImageJobMutation) UserDeletedAt() (r time.Time, exists bool) {
+ v := m.user_deleted_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUserDeletedAt returns the old "user_deleted_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldUserDeletedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUserDeletedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUserDeletedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUserDeletedAt: %w", err)
+ }
+ return oldValue.UserDeletedAt, nil
+}
+
+// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
+func (m *BatchImageJobMutation) ClearUserDeletedAt() {
+ m.user_deleted_at = nil
+ m.clearedFields[batchimagejob.FieldUserDeletedAt] = struct{}{}
+}
+
+// UserDeletedAtCleared returns if the "user_deleted_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) UserDeletedAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldUserDeletedAt]
+ return ok
+}
+
+// ResetUserDeletedAt resets all changes to the "user_deleted_at" field.
+func (m *BatchImageJobMutation) ResetUserDeletedAt() {
+ m.user_deleted_at = nil
+ delete(m.clearedFields, batchimagejob.FieldUserDeletedAt)
+}
+
+// SetLastErrorCode sets the "last_error_code" field.
+func (m *BatchImageJobMutation) SetLastErrorCode(s string) {
+ m.last_error_code = &s
+}
+
+// LastErrorCode returns the value of the "last_error_code" field in the mutation.
+func (m *BatchImageJobMutation) LastErrorCode() (r string, exists bool) {
+ v := m.last_error_code
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldLastErrorCode returns the old "last_error_code" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldLastErrorCode(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldLastErrorCode is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldLastErrorCode requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldLastErrorCode: %w", err)
+ }
+ return oldValue.LastErrorCode, nil
+}
+
+// ClearLastErrorCode clears the value of the "last_error_code" field.
+func (m *BatchImageJobMutation) ClearLastErrorCode() {
+ m.last_error_code = nil
+ m.clearedFields[batchimagejob.FieldLastErrorCode] = struct{}{}
+}
+
+// LastErrorCodeCleared returns if the "last_error_code" field was cleared in this mutation.
+func (m *BatchImageJobMutation) LastErrorCodeCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldLastErrorCode]
+ return ok
+}
+
+// ResetLastErrorCode resets all changes to the "last_error_code" field.
+func (m *BatchImageJobMutation) ResetLastErrorCode() {
+ m.last_error_code = nil
+ delete(m.clearedFields, batchimagejob.FieldLastErrorCode)
+}
+
+// SetLastErrorMessage sets the "last_error_message" field.
+func (m *BatchImageJobMutation) SetLastErrorMessage(s string) {
+ m.last_error_message = &s
+}
+
+// LastErrorMessage returns the value of the "last_error_message" field in the mutation.
+func (m *BatchImageJobMutation) LastErrorMessage() (r string, exists bool) {
+ v := m.last_error_message
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldLastErrorMessage returns the old "last_error_message" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldLastErrorMessage(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldLastErrorMessage is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldLastErrorMessage requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldLastErrorMessage: %w", err)
+ }
+ return oldValue.LastErrorMessage, nil
+}
+
+// ClearLastErrorMessage clears the value of the "last_error_message" field.
+func (m *BatchImageJobMutation) ClearLastErrorMessage() {
+ m.last_error_message = nil
+ m.clearedFields[batchimagejob.FieldLastErrorMessage] = struct{}{}
+}
+
+// LastErrorMessageCleared returns if the "last_error_message" field was cleared in this mutation.
+func (m *BatchImageJobMutation) LastErrorMessageCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldLastErrorMessage]
+ return ok
+}
+
+// ResetLastErrorMessage resets all changes to the "last_error_message" field.
+func (m *BatchImageJobMutation) ResetLastErrorMessage() {
+ m.last_error_message = nil
+ delete(m.clearedFields, batchimagejob.FieldLastErrorMessage)
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *BatchImageJobMutation) SetCreatedAt(t time.Time) {
+ m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *BatchImageJobMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.created_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *BatchImageJobMutation) ResetCreatedAt() {
+ m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *BatchImageJobMutation) SetUpdatedAt(t time.Time) {
+ m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *BatchImageJobMutation) UpdatedAt() (r time.Time, exists bool) {
+ v := m.updated_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+ }
+ return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *BatchImageJobMutation) ResetUpdatedAt() {
+ m.updated_at = nil
+}
+
+// SetSubmittedAt sets the "submitted_at" field.
+func (m *BatchImageJobMutation) SetSubmittedAt(t time.Time) {
+ m.submitted_at = &t
+}
+
+// SubmittedAt returns the value of the "submitted_at" field in the mutation.
+func (m *BatchImageJobMutation) SubmittedAt() (r time.Time, exists bool) {
+ v := m.submitted_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSubmittedAt returns the old "submitted_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldSubmittedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSubmittedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSubmittedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSubmittedAt: %w", err)
+ }
+ return oldValue.SubmittedAt, nil
+}
+
+// ClearSubmittedAt clears the value of the "submitted_at" field.
+func (m *BatchImageJobMutation) ClearSubmittedAt() {
+ m.submitted_at = nil
+ m.clearedFields[batchimagejob.FieldSubmittedAt] = struct{}{}
+}
+
+// SubmittedAtCleared returns if the "submitted_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) SubmittedAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldSubmittedAt]
+ return ok
+}
+
+// ResetSubmittedAt resets all changes to the "submitted_at" field.
+func (m *BatchImageJobMutation) ResetSubmittedAt() {
+ m.submitted_at = nil
+ delete(m.clearedFields, batchimagejob.FieldSubmittedAt)
+}
+
+// SetStartedAt sets the "started_at" field.
+func (m *BatchImageJobMutation) SetStartedAt(t time.Time) {
+ m.started_at = &t
+}
+
+// StartedAt returns the value of the "started_at" field in the mutation.
+func (m *BatchImageJobMutation) StartedAt() (r time.Time, exists bool) {
+ v := m.started_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldStartedAt returns the old "started_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldStartedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldStartedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldStartedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldStartedAt: %w", err)
+ }
+ return oldValue.StartedAt, nil
+}
+
+// ClearStartedAt clears the value of the "started_at" field.
+func (m *BatchImageJobMutation) ClearStartedAt() {
+ m.started_at = nil
+ m.clearedFields[batchimagejob.FieldStartedAt] = struct{}{}
+}
+
+// StartedAtCleared returns if the "started_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) StartedAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldStartedAt]
+ return ok
+}
+
+// ResetStartedAt resets all changes to the "started_at" field.
+func (m *BatchImageJobMutation) ResetStartedAt() {
+ m.started_at = nil
+ delete(m.clearedFields, batchimagejob.FieldStartedAt)
+}
+
+// SetFinishedAt sets the "finished_at" field.
+func (m *BatchImageJobMutation) SetFinishedAt(t time.Time) {
+ m.finished_at = &t
+}
+
+// FinishedAt returns the value of the "finished_at" field in the mutation.
+func (m *BatchImageJobMutation) FinishedAt() (r time.Time, exists bool) {
+ v := m.finished_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldFinishedAt returns the old "finished_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldFinishedAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldFinishedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldFinishedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldFinishedAt: %w", err)
+ }
+ return oldValue.FinishedAt, nil
+}
+
+// ClearFinishedAt clears the value of the "finished_at" field.
+func (m *BatchImageJobMutation) ClearFinishedAt() {
+ m.finished_at = nil
+ m.clearedFields[batchimagejob.FieldFinishedAt] = struct{}{}
+}
+
+// FinishedAtCleared returns if the "finished_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) FinishedAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldFinishedAt]
+ return ok
+}
+
+// ResetFinishedAt resets all changes to the "finished_at" field.
+func (m *BatchImageJobMutation) ResetFinishedAt() {
+ m.finished_at = nil
+ delete(m.clearedFields, batchimagejob.FieldFinishedAt)
+}
+
+// SetSettledAt sets the "settled_at" field.
+func (m *BatchImageJobMutation) SetSettledAt(t time.Time) {
+ m.settled_at = &t
+}
+
+// SettledAt returns the value of the "settled_at" field in the mutation.
+func (m *BatchImageJobMutation) SettledAt() (r time.Time, exists bool) {
+ v := m.settled_at
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldSettledAt returns the old "settled_at" field's value of the BatchImageJob entity.
+// If the BatchImageJob object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *BatchImageJobMutation) OldSettledAt(ctx context.Context) (v *time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldSettledAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldSettledAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldSettledAt: %w", err)
+ }
+ return oldValue.SettledAt, nil
+}
+
+// ClearSettledAt clears the value of the "settled_at" field.
+func (m *BatchImageJobMutation) ClearSettledAt() {
+ m.settled_at = nil
+ m.clearedFields[batchimagejob.FieldSettledAt] = struct{}{}
+}
+
+// SettledAtCleared returns if the "settled_at" field was cleared in this mutation.
+func (m *BatchImageJobMutation) SettledAtCleared() bool {
+ _, ok := m.clearedFields[batchimagejob.FieldSettledAt]
+ return ok
+}
+
+// ResetSettledAt resets all changes to the "settled_at" field.
+func (m *BatchImageJobMutation) ResetSettledAt() {
+ m.settled_at = nil
+ delete(m.clearedFields, batchimagejob.FieldSettledAt)
+}
+
+// Where appends a list predicates to the BatchImageJobMutation builder.
+func (m *BatchImageJobMutation) Where(ps ...predicate.BatchImageJob) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the BatchImageJobMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *BatchImageJobMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.BatchImageJob, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *BatchImageJobMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *BatchImageJobMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (BatchImageJob).
+func (m *BatchImageJobMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *BatchImageJobMutation) Fields() []string {
+ fields := make([]string, 0, 40)
+ if m.batch_id != nil {
+ fields = append(fields, batchimagejob.FieldBatchID)
+ }
+ if m.user_id != nil {
+ fields = append(fields, batchimagejob.FieldUserID)
+ }
+ if m.api_key_id != nil {
+ fields = append(fields, batchimagejob.FieldAPIKeyID)
+ }
+ if m.account_id != nil {
+ fields = append(fields, batchimagejob.FieldAccountID)
+ }
+ if m.provider != nil {
+ fields = append(fields, batchimagejob.FieldProvider)
+ }
+ if m.model != nil {
+ fields = append(fields, batchimagejob.FieldModel)
+ }
+ if m.task_name != nil {
+ fields = append(fields, batchimagejob.FieldTaskName)
+ }
+ if m.status != nil {
+ fields = append(fields, batchimagejob.FieldStatus)
+ }
+ if m.provider_job_name != nil {
+ fields = append(fields, batchimagejob.FieldProviderJobName)
+ }
+ if m.provider_input_ref != nil {
+ fields = append(fields, batchimagejob.FieldProviderInputRef)
+ }
+ if m.provider_output_ref != nil {
+ fields = append(fields, batchimagejob.FieldProviderOutputRef)
+ }
+ if m.gcs_input_uri != nil {
+ fields = append(fields, batchimagejob.FieldGcsInputURI)
+ }
+ if m.gcs_output_uri != nil {
+ fields = append(fields, batchimagejob.FieldGcsOutputURI)
+ }
+ if m.item_count != nil {
+ fields = append(fields, batchimagejob.FieldItemCount)
+ }
+ if m.success_count != nil {
+ fields = append(fields, batchimagejob.FieldSuccessCount)
+ }
+ if m.fail_count != nil {
+ fields = append(fields, batchimagejob.FieldFailCount)
+ }
+ if m.cancelled_count != nil {
+ fields = append(fields, batchimagejob.FieldCancelledCount)
+ }
+ if m.estimated_cost != nil {
+ fields = append(fields, batchimagejob.FieldEstimatedCost)
+ }
+ if m.hold_amount != nil {
+ fields = append(fields, batchimagejob.FieldHoldAmount)
+ }
+ if m.actual_cost != nil {
+ fields = append(fields, batchimagejob.FieldActualCost)
+ }
+ if m.currency != nil {
+ fields = append(fields, batchimagejob.FieldCurrency)
+ }
+ if m.hold_id != nil {
+ fields = append(fields, batchimagejob.FieldHoldID)
+ }
+ if m.idempotency_key != nil {
+ fields = append(fields, batchimagejob.FieldIdempotencyKey)
+ }
+ if m.request_hash != nil {
+ fields = append(fields, batchimagejob.FieldRequestHash)
+ }
+ if m.manifest_hash != nil {
+ fields = append(fields, batchimagejob.FieldManifestHash)
+ }
+ if m.retry_count != nil {
+ fields = append(fields, batchimagejob.FieldRetryCount)
+ }
+ if m.version != nil {
+ fields = append(fields, batchimagejob.FieldVersion)
+ }
+ if m.output_expires_at != nil {
+ fields = append(fields, batchimagejob.FieldOutputExpiresAt)
+ }
+ if m.input_deleted_at != nil {
+ fields = append(fields, batchimagejob.FieldInputDeletedAt)
+ }
+ if m.output_deleted_at != nil {
+ fields = append(fields, batchimagejob.FieldOutputDeletedAt)
+ }
+ if m.downloaded_at != nil {
+ fields = append(fields, batchimagejob.FieldDownloadedAt)
+ }
+ if m.user_deleted_at != nil {
+ fields = append(fields, batchimagejob.FieldUserDeletedAt)
+ }
+ if m.last_error_code != nil {
+ fields = append(fields, batchimagejob.FieldLastErrorCode)
+ }
+ if m.last_error_message != nil {
+ fields = append(fields, batchimagejob.FieldLastErrorMessage)
+ }
+ if m.created_at != nil {
+ fields = append(fields, batchimagejob.FieldCreatedAt)
+ }
+ if m.updated_at != nil {
+ fields = append(fields, batchimagejob.FieldUpdatedAt)
+ }
+ if m.submitted_at != nil {
+ fields = append(fields, batchimagejob.FieldSubmittedAt)
+ }
+ if m.started_at != nil {
+ fields = append(fields, batchimagejob.FieldStartedAt)
+ }
+ if m.finished_at != nil {
+ fields = append(fields, batchimagejob.FieldFinishedAt)
+ }
+ if m.settled_at != nil {
+ fields = append(fields, batchimagejob.FieldSettledAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *BatchImageJobMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case batchimagejob.FieldBatchID:
+ return m.BatchID()
+ case batchimagejob.FieldUserID:
+ return m.UserID()
+ case batchimagejob.FieldAPIKeyID:
+ return m.APIKeyID()
+ case batchimagejob.FieldAccountID:
+ return m.AccountID()
+ case batchimagejob.FieldProvider:
+ return m.Provider()
+ case batchimagejob.FieldModel:
+ return m.Model()
+ case batchimagejob.FieldTaskName:
+ return m.TaskName()
+ case batchimagejob.FieldStatus:
+ return m.Status()
+ case batchimagejob.FieldProviderJobName:
+ return m.ProviderJobName()
+ case batchimagejob.FieldProviderInputRef:
+ return m.ProviderInputRef()
+ case batchimagejob.FieldProviderOutputRef:
+ return m.ProviderOutputRef()
+ case batchimagejob.FieldGcsInputURI:
+ return m.GcsInputURI()
+ case batchimagejob.FieldGcsOutputURI:
+ return m.GcsOutputURI()
+ case batchimagejob.FieldItemCount:
+ return m.ItemCount()
+ case batchimagejob.FieldSuccessCount:
+ return m.SuccessCount()
+ case batchimagejob.FieldFailCount:
+ return m.FailCount()
+ case batchimagejob.FieldCancelledCount:
+ return m.CancelledCount()
+ case batchimagejob.FieldEstimatedCost:
+ return m.EstimatedCost()
+ case batchimagejob.FieldHoldAmount:
+ return m.HoldAmount()
+ case batchimagejob.FieldActualCost:
+ return m.ActualCost()
+ case batchimagejob.FieldCurrency:
+ return m.Currency()
+ case batchimagejob.FieldHoldID:
+ return m.HoldID()
+ case batchimagejob.FieldIdempotencyKey:
+ return m.IdempotencyKey()
+ case batchimagejob.FieldRequestHash:
+ return m.RequestHash()
+ case batchimagejob.FieldManifestHash:
+ return m.ManifestHash()
+ case batchimagejob.FieldRetryCount:
+ return m.RetryCount()
+ case batchimagejob.FieldVersion:
+ return m.Version()
+ case batchimagejob.FieldOutputExpiresAt:
+ return m.OutputExpiresAt()
+ case batchimagejob.FieldInputDeletedAt:
+ return m.InputDeletedAt()
+ case batchimagejob.FieldOutputDeletedAt:
+ return m.OutputDeletedAt()
+ case batchimagejob.FieldDownloadedAt:
+ return m.DownloadedAt()
+ case batchimagejob.FieldUserDeletedAt:
+ return m.UserDeletedAt()
+ case batchimagejob.FieldLastErrorCode:
+ return m.LastErrorCode()
+ case batchimagejob.FieldLastErrorMessage:
+ return m.LastErrorMessage()
+ case batchimagejob.FieldCreatedAt:
+ return m.CreatedAt()
+ case batchimagejob.FieldUpdatedAt:
+ return m.UpdatedAt()
+ case batchimagejob.FieldSubmittedAt:
+ return m.SubmittedAt()
+ case batchimagejob.FieldStartedAt:
+ return m.StartedAt()
+ case batchimagejob.FieldFinishedAt:
+ return m.FinishedAt()
+ case batchimagejob.FieldSettledAt:
+ return m.SettledAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *BatchImageJobMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case batchimagejob.FieldBatchID:
+ return m.OldBatchID(ctx)
+ case batchimagejob.FieldUserID:
+ return m.OldUserID(ctx)
+ case batchimagejob.FieldAPIKeyID:
+ return m.OldAPIKeyID(ctx)
+ case batchimagejob.FieldAccountID:
+ return m.OldAccountID(ctx)
+ case batchimagejob.FieldProvider:
+ return m.OldProvider(ctx)
+ case batchimagejob.FieldModel:
+ return m.OldModel(ctx)
+ case batchimagejob.FieldTaskName:
+ return m.OldTaskName(ctx)
+ case batchimagejob.FieldStatus:
+ return m.OldStatus(ctx)
+ case batchimagejob.FieldProviderJobName:
+ return m.OldProviderJobName(ctx)
+ case batchimagejob.FieldProviderInputRef:
+ return m.OldProviderInputRef(ctx)
+ case batchimagejob.FieldProviderOutputRef:
+ return m.OldProviderOutputRef(ctx)
+ case batchimagejob.FieldGcsInputURI:
+ return m.OldGcsInputURI(ctx)
+ case batchimagejob.FieldGcsOutputURI:
+ return m.OldGcsOutputURI(ctx)
+ case batchimagejob.FieldItemCount:
+ return m.OldItemCount(ctx)
+ case batchimagejob.FieldSuccessCount:
+ return m.OldSuccessCount(ctx)
+ case batchimagejob.FieldFailCount:
+ return m.OldFailCount(ctx)
+ case batchimagejob.FieldCancelledCount:
+ return m.OldCancelledCount(ctx)
+ case batchimagejob.FieldEstimatedCost:
+ return m.OldEstimatedCost(ctx)
+ case batchimagejob.FieldHoldAmount:
+ return m.OldHoldAmount(ctx)
+ case batchimagejob.FieldActualCost:
+ return m.OldActualCost(ctx)
+ case batchimagejob.FieldCurrency:
+ return m.OldCurrency(ctx)
+ case batchimagejob.FieldHoldID:
+ return m.OldHoldID(ctx)
+ case batchimagejob.FieldIdempotencyKey:
+ return m.OldIdempotencyKey(ctx)
+ case batchimagejob.FieldRequestHash:
+ return m.OldRequestHash(ctx)
+ case batchimagejob.FieldManifestHash:
+ return m.OldManifestHash(ctx)
+ case batchimagejob.FieldRetryCount:
+ return m.OldRetryCount(ctx)
+ case batchimagejob.FieldVersion:
+ return m.OldVersion(ctx)
+ case batchimagejob.FieldOutputExpiresAt:
+ return m.OldOutputExpiresAt(ctx)
+ case batchimagejob.FieldInputDeletedAt:
+ return m.OldInputDeletedAt(ctx)
+ case batchimagejob.FieldOutputDeletedAt:
+ return m.OldOutputDeletedAt(ctx)
+ case batchimagejob.FieldDownloadedAt:
+ return m.OldDownloadedAt(ctx)
+ case batchimagejob.FieldUserDeletedAt:
+ return m.OldUserDeletedAt(ctx)
+ case batchimagejob.FieldLastErrorCode:
+ return m.OldLastErrorCode(ctx)
+ case batchimagejob.FieldLastErrorMessage:
+ return m.OldLastErrorMessage(ctx)
+ case batchimagejob.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ case batchimagejob.FieldUpdatedAt:
+ return m.OldUpdatedAt(ctx)
+ case batchimagejob.FieldSubmittedAt:
+ return m.OldSubmittedAt(ctx)
+ case batchimagejob.FieldStartedAt:
+ return m.OldStartedAt(ctx)
+ case batchimagejob.FieldFinishedAt:
+ return m.OldFinishedAt(ctx)
+ case batchimagejob.FieldSettledAt:
+ return m.OldSettledAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown BatchImageJob field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BatchImageJobMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case batchimagejob.FieldBatchID:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetBatchID(v)
+ return nil
+ case batchimagejob.FieldUserID:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUserID(v)
+ return nil
+ case batchimagejob.FieldAPIKeyID:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetAPIKeyID(v)
+ return nil
+ case batchimagejob.FieldAccountID:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetAccountID(v)
+ return nil
+ case batchimagejob.FieldProvider:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetProvider(v)
+ return nil
+ case batchimagejob.FieldModel:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetModel(v)
+ return nil
+ case batchimagejob.FieldTaskName:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetTaskName(v)
+ return nil
+ case batchimagejob.FieldStatus:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetStatus(v)
+ return nil
+ case batchimagejob.FieldProviderJobName:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetProviderJobName(v)
+ return nil
+ case batchimagejob.FieldProviderInputRef:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetProviderInputRef(v)
+ return nil
+ case batchimagejob.FieldProviderOutputRef:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetProviderOutputRef(v)
+ return nil
+ case batchimagejob.FieldGcsInputURI:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetGcsInputURI(v)
+ return nil
+ case batchimagejob.FieldGcsOutputURI:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetGcsOutputURI(v)
+ return nil
+ case batchimagejob.FieldItemCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetItemCount(v)
+ return nil
+ case batchimagejob.FieldSuccessCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSuccessCount(v)
+ return nil
+ case batchimagejob.FieldFailCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetFailCount(v)
+ return nil
+ case batchimagejob.FieldCancelledCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCancelledCount(v)
+ return nil
+ case batchimagejob.FieldEstimatedCost:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetEstimatedCost(v)
+ return nil
+ case batchimagejob.FieldHoldAmount:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHoldAmount(v)
+ return nil
+ case batchimagejob.FieldActualCost:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetActualCost(v)
+ return nil
+ case batchimagejob.FieldCurrency:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCurrency(v)
+ return nil
+ case batchimagejob.FieldHoldID:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHoldID(v)
+ return nil
+ case batchimagejob.FieldIdempotencyKey:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetIdempotencyKey(v)
+ return nil
+ case batchimagejob.FieldRequestHash:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetRequestHash(v)
+ return nil
+ case batchimagejob.FieldManifestHash:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetManifestHash(v)
+ return nil
+ case batchimagejob.FieldRetryCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetRetryCount(v)
+ return nil
+ case batchimagejob.FieldVersion:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVersion(v)
+ return nil
+ case batchimagejob.FieldOutputExpiresAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetOutputExpiresAt(v)
+ return nil
+ case batchimagejob.FieldInputDeletedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetInputDeletedAt(v)
+ return nil
+ case batchimagejob.FieldOutputDeletedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetOutputDeletedAt(v)
+ return nil
+ case batchimagejob.FieldDownloadedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetDownloadedAt(v)
+ return nil
+ case batchimagejob.FieldUserDeletedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUserDeletedAt(v)
+ return nil
+ case batchimagejob.FieldLastErrorCode:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetLastErrorCode(v)
+ return nil
+ case batchimagejob.FieldLastErrorMessage:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetLastErrorMessage(v)
+ return nil
+ case batchimagejob.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ case batchimagejob.FieldUpdatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetUpdatedAt(v)
+ return nil
+ case batchimagejob.FieldSubmittedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSubmittedAt(v)
+ return nil
+ case batchimagejob.FieldStartedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetStartedAt(v)
+ return nil
+ case batchimagejob.FieldFinishedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetFinishedAt(v)
+ return nil
+ case batchimagejob.FieldSettledAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetSettledAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageJob field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *BatchImageJobMutation) AddedFields() []string {
+ var fields []string
+ if m.adduser_id != nil {
+ fields = append(fields, batchimagejob.FieldUserID)
+ }
+ if m.addapi_key_id != nil {
+ fields = append(fields, batchimagejob.FieldAPIKeyID)
+ }
+ if m.addaccount_id != nil {
+ fields = append(fields, batchimagejob.FieldAccountID)
+ }
+ if m.additem_count != nil {
+ fields = append(fields, batchimagejob.FieldItemCount)
+ }
+ if m.addsuccess_count != nil {
+ fields = append(fields, batchimagejob.FieldSuccessCount)
+ }
+ if m.addfail_count != nil {
+ fields = append(fields, batchimagejob.FieldFailCount)
+ }
+ if m.addcancelled_count != nil {
+ fields = append(fields, batchimagejob.FieldCancelledCount)
+ }
+ if m.addestimated_cost != nil {
+ fields = append(fields, batchimagejob.FieldEstimatedCost)
+ }
+ if m.addhold_amount != nil {
+ fields = append(fields, batchimagejob.FieldHoldAmount)
+ }
+ if m.addactual_cost != nil {
+ fields = append(fields, batchimagejob.FieldActualCost)
+ }
+ if m.addretry_count != nil {
+ fields = append(fields, batchimagejob.FieldRetryCount)
+ }
+ if m.addversion != nil {
+ fields = append(fields, batchimagejob.FieldVersion)
+ }
+ return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *BatchImageJobMutation) AddedField(name string) (ent.Value, bool) {
+ switch name {
+ case batchimagejob.FieldUserID:
+ return m.AddedUserID()
+ case batchimagejob.FieldAPIKeyID:
+ return m.AddedAPIKeyID()
+ case batchimagejob.FieldAccountID:
+ return m.AddedAccountID()
+ case batchimagejob.FieldItemCount:
+ return m.AddedItemCount()
+ case batchimagejob.FieldSuccessCount:
+ return m.AddedSuccessCount()
+ case batchimagejob.FieldFailCount:
+ return m.AddedFailCount()
+ case batchimagejob.FieldCancelledCount:
+ return m.AddedCancelledCount()
+ case batchimagejob.FieldEstimatedCost:
+ return m.AddedEstimatedCost()
+ case batchimagejob.FieldHoldAmount:
+ return m.AddedHoldAmount()
+ case batchimagejob.FieldActualCost:
+ return m.AddedActualCost()
+ case batchimagejob.FieldRetryCount:
+ return m.AddedRetryCount()
+ case batchimagejob.FieldVersion:
+ return m.AddedVersion()
+ }
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *BatchImageJobMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ case batchimagejob.FieldUserID:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddUserID(v)
+ return nil
+ case batchimagejob.FieldAPIKeyID:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddAPIKeyID(v)
+ return nil
+ case batchimagejob.FieldAccountID:
+ v, ok := value.(int64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddAccountID(v)
+ return nil
+ case batchimagejob.FieldItemCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddItemCount(v)
+ return nil
+ case batchimagejob.FieldSuccessCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddSuccessCount(v)
+ return nil
+ case batchimagejob.FieldFailCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddFailCount(v)
+ return nil
+ case batchimagejob.FieldCancelledCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddCancelledCount(v)
+ return nil
+ case batchimagejob.FieldEstimatedCost:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddEstimatedCost(v)
+ return nil
+ case batchimagejob.FieldHoldAmount:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddHoldAmount(v)
+ return nil
+ case batchimagejob.FieldActualCost:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddActualCost(v)
+ return nil
+ case batchimagejob.FieldRetryCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddRetryCount(v)
+ return nil
+ case batchimagejob.FieldVersion:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddVersion(v)
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageJob numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *BatchImageJobMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(batchimagejob.FieldAPIKeyID) {
+ fields = append(fields, batchimagejob.FieldAPIKeyID)
+ }
+ if m.FieldCleared(batchimagejob.FieldAccountID) {
+ fields = append(fields, batchimagejob.FieldAccountID)
+ }
+ if m.FieldCleared(batchimagejob.FieldProviderJobName) {
+ fields = append(fields, batchimagejob.FieldProviderJobName)
+ }
+ if m.FieldCleared(batchimagejob.FieldProviderInputRef) {
+ fields = append(fields, batchimagejob.FieldProviderInputRef)
+ }
+ if m.FieldCleared(batchimagejob.FieldProviderOutputRef) {
+ fields = append(fields, batchimagejob.FieldProviderOutputRef)
+ }
+ if m.FieldCleared(batchimagejob.FieldGcsInputURI) {
+ fields = append(fields, batchimagejob.FieldGcsInputURI)
+ }
+ if m.FieldCleared(batchimagejob.FieldGcsOutputURI) {
+ fields = append(fields, batchimagejob.FieldGcsOutputURI)
+ }
+ if m.FieldCleared(batchimagejob.FieldHoldAmount) {
+ fields = append(fields, batchimagejob.FieldHoldAmount)
+ }
+ if m.FieldCleared(batchimagejob.FieldActualCost) {
+ fields = append(fields, batchimagejob.FieldActualCost)
+ }
+ if m.FieldCleared(batchimagejob.FieldHoldID) {
+ fields = append(fields, batchimagejob.FieldHoldID)
+ }
+ if m.FieldCleared(batchimagejob.FieldIdempotencyKey) {
+ fields = append(fields, batchimagejob.FieldIdempotencyKey)
+ }
+ if m.FieldCleared(batchimagejob.FieldRequestHash) {
+ fields = append(fields, batchimagejob.FieldRequestHash)
+ }
+ if m.FieldCleared(batchimagejob.FieldManifestHash) {
+ fields = append(fields, batchimagejob.FieldManifestHash)
+ }
+ if m.FieldCleared(batchimagejob.FieldOutputExpiresAt) {
+ fields = append(fields, batchimagejob.FieldOutputExpiresAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldInputDeletedAt) {
+ fields = append(fields, batchimagejob.FieldInputDeletedAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldOutputDeletedAt) {
+ fields = append(fields, batchimagejob.FieldOutputDeletedAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldDownloadedAt) {
+ fields = append(fields, batchimagejob.FieldDownloadedAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldUserDeletedAt) {
+ fields = append(fields, batchimagejob.FieldUserDeletedAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldLastErrorCode) {
+ fields = append(fields, batchimagejob.FieldLastErrorCode)
+ }
+ if m.FieldCleared(batchimagejob.FieldLastErrorMessage) {
+ fields = append(fields, batchimagejob.FieldLastErrorMessage)
+ }
+ if m.FieldCleared(batchimagejob.FieldSubmittedAt) {
+ fields = append(fields, batchimagejob.FieldSubmittedAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldStartedAt) {
+ fields = append(fields, batchimagejob.FieldStartedAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldFinishedAt) {
+ fields = append(fields, batchimagejob.FieldFinishedAt)
+ }
+ if m.FieldCleared(batchimagejob.FieldSettledAt) {
+ fields = append(fields, batchimagejob.FieldSettledAt)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *BatchImageJobMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *BatchImageJobMutation) ClearField(name string) error {
+ switch name {
+ case batchimagejob.FieldAPIKeyID:
+ m.ClearAPIKeyID()
+ return nil
+ case batchimagejob.FieldAccountID:
+ m.ClearAccountID()
+ return nil
+ case batchimagejob.FieldProviderJobName:
+ m.ClearProviderJobName()
+ return nil
+ case batchimagejob.FieldProviderInputRef:
+ m.ClearProviderInputRef()
+ return nil
+ case batchimagejob.FieldProviderOutputRef:
+ m.ClearProviderOutputRef()
+ return nil
+ case batchimagejob.FieldGcsInputURI:
+ m.ClearGcsInputURI()
+ return nil
+ case batchimagejob.FieldGcsOutputURI:
+ m.ClearGcsOutputURI()
+ return nil
+ case batchimagejob.FieldHoldAmount:
+ m.ClearHoldAmount()
+ return nil
+ case batchimagejob.FieldActualCost:
+ m.ClearActualCost()
+ return nil
+ case batchimagejob.FieldHoldID:
+ m.ClearHoldID()
+ return nil
+ case batchimagejob.FieldIdempotencyKey:
+ m.ClearIdempotencyKey()
+ return nil
+ case batchimagejob.FieldRequestHash:
+ m.ClearRequestHash()
+ return nil
+ case batchimagejob.FieldManifestHash:
+ m.ClearManifestHash()
+ return nil
+ case batchimagejob.FieldOutputExpiresAt:
+ m.ClearOutputExpiresAt()
+ return nil
+ case batchimagejob.FieldInputDeletedAt:
+ m.ClearInputDeletedAt()
+ return nil
+ case batchimagejob.FieldOutputDeletedAt:
+ m.ClearOutputDeletedAt()
+ return nil
+ case batchimagejob.FieldDownloadedAt:
+ m.ClearDownloadedAt()
+ return nil
+ case batchimagejob.FieldUserDeletedAt:
+ m.ClearUserDeletedAt()
+ return nil
+ case batchimagejob.FieldLastErrorCode:
+ m.ClearLastErrorCode()
+ return nil
+ case batchimagejob.FieldLastErrorMessage:
+ m.ClearLastErrorMessage()
+ return nil
+ case batchimagejob.FieldSubmittedAt:
+ m.ClearSubmittedAt()
+ return nil
+ case batchimagejob.FieldStartedAt:
+ m.ClearStartedAt()
+ return nil
+ case batchimagejob.FieldFinishedAt:
+ m.ClearFinishedAt()
+ return nil
+ case batchimagejob.FieldSettledAt:
+ m.ClearSettledAt()
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageJob nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *BatchImageJobMutation) ResetField(name string) error {
+ switch name {
+ case batchimagejob.FieldBatchID:
+ m.ResetBatchID()
+ return nil
+ case batchimagejob.FieldUserID:
+ m.ResetUserID()
+ return nil
+ case batchimagejob.FieldAPIKeyID:
+ m.ResetAPIKeyID()
+ return nil
+ case batchimagejob.FieldAccountID:
+ m.ResetAccountID()
+ return nil
+ case batchimagejob.FieldProvider:
+ m.ResetProvider()
+ return nil
+ case batchimagejob.FieldModel:
+ m.ResetModel()
+ return nil
+ case batchimagejob.FieldTaskName:
+ m.ResetTaskName()
+ return nil
+ case batchimagejob.FieldStatus:
+ m.ResetStatus()
+ return nil
+ case batchimagejob.FieldProviderJobName:
+ m.ResetProviderJobName()
+ return nil
+ case batchimagejob.FieldProviderInputRef:
+ m.ResetProviderInputRef()
+ return nil
+ case batchimagejob.FieldProviderOutputRef:
+ m.ResetProviderOutputRef()
+ return nil
+ case batchimagejob.FieldGcsInputURI:
+ m.ResetGcsInputURI()
+ return nil
+ case batchimagejob.FieldGcsOutputURI:
+ m.ResetGcsOutputURI()
+ return nil
+ case batchimagejob.FieldItemCount:
+ m.ResetItemCount()
+ return nil
+ case batchimagejob.FieldSuccessCount:
+ m.ResetSuccessCount()
+ return nil
+ case batchimagejob.FieldFailCount:
+ m.ResetFailCount()
+ return nil
+ case batchimagejob.FieldCancelledCount:
+ m.ResetCancelledCount()
+ return nil
+ case batchimagejob.FieldEstimatedCost:
+ m.ResetEstimatedCost()
+ return nil
+ case batchimagejob.FieldHoldAmount:
+ m.ResetHoldAmount()
+ return nil
+ case batchimagejob.FieldActualCost:
+ m.ResetActualCost()
+ return nil
+ case batchimagejob.FieldCurrency:
+ m.ResetCurrency()
+ return nil
+ case batchimagejob.FieldHoldID:
+ m.ResetHoldID()
+ return nil
+ case batchimagejob.FieldIdempotencyKey:
+ m.ResetIdempotencyKey()
+ return nil
+ case batchimagejob.FieldRequestHash:
+ m.ResetRequestHash()
+ return nil
+ case batchimagejob.FieldManifestHash:
+ m.ResetManifestHash()
+ return nil
+ case batchimagejob.FieldRetryCount:
+ m.ResetRetryCount()
+ return nil
+ case batchimagejob.FieldVersion:
+ m.ResetVersion()
+ return nil
+ case batchimagejob.FieldOutputExpiresAt:
+ m.ResetOutputExpiresAt()
+ return nil
+ case batchimagejob.FieldInputDeletedAt:
+ m.ResetInputDeletedAt()
+ return nil
+ case batchimagejob.FieldOutputDeletedAt:
+ m.ResetOutputDeletedAt()
+ return nil
+ case batchimagejob.FieldDownloadedAt:
+ m.ResetDownloadedAt()
+ return nil
+ case batchimagejob.FieldUserDeletedAt:
+ m.ResetUserDeletedAt()
+ return nil
+ case batchimagejob.FieldLastErrorCode:
+ m.ResetLastErrorCode()
+ return nil
+ case batchimagejob.FieldLastErrorMessage:
+ m.ResetLastErrorMessage()
+ return nil
+ case batchimagejob.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ case batchimagejob.FieldUpdatedAt:
+ m.ResetUpdatedAt()
+ return nil
+ case batchimagejob.FieldSubmittedAt:
+ m.ResetSubmittedAt()
+ return nil
+ case batchimagejob.FieldStartedAt:
+ m.ResetStartedAt()
+ return nil
+ case batchimagejob.FieldFinishedAt:
+ m.ResetFinishedAt()
+ return nil
+ case batchimagejob.FieldSettledAt:
+ m.ResetSettledAt()
+ return nil
+ }
+ return fmt.Errorf("unknown BatchImageJob field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *BatchImageJobMutation) AddedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *BatchImageJobMutation) AddedIDs(name string) []ent.Value {
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *BatchImageJobMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *BatchImageJobMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *BatchImageJobMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *BatchImageJobMutation) EdgeCleared(name string) bool {
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *BatchImageJobMutation) ClearEdge(name string) error {
+ return fmt.Errorf("unknown BatchImageJob unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *BatchImageJobMutation) ResetEdge(name string) error {
+ return fmt.Errorf("unknown BatchImageJob edge %s", name)
+}
+
// ChannelMonitorMutation represents an operation that mutates the ChannelMonitor nodes in the graph.
type ChannelMonitorMutation struct {
config
@@ -15343,6 +20819,7 @@ type GroupMutation struct {
default_validity_days *int
adddefault_validity_days *int
allow_image_generation *bool
+ allow_batch_image_generation *bool
image_rate_independent *bool
image_rate_multiplier *float64
addimage_rate_multiplier *float64
@@ -15352,6 +20829,19 @@ type GroupMutation struct {
addimage_price_2k *float64
image_price_4k *float64
addimage_price_4k *float64
+ batch_image_discount_multiplier *float64
+ addbatch_image_discount_multiplier *float64
+ batch_image_hold_multiplier *float64
+ addbatch_image_hold_multiplier *float64
+ video_rate_independent *bool
+ video_rate_multiplier *float64
+ addvideo_rate_multiplier *float64
+ video_price_480p *float64
+ addvideo_price_480p *float64
+ video_price_720p *float64
+ addvideo_price_720p *float64
+ video_price_1080p *float64
+ addvideo_price_1080p *float64
claude_code_only *bool
fallback_group_id *int64
addfallback_group_id *int64
@@ -16366,6 +21856,42 @@ func (m *GroupMutation) ResetAllowImageGeneration() {
m.allow_image_generation = nil
}
+// SetAllowBatchImageGeneration sets the "allow_batch_image_generation" field.
+func (m *GroupMutation) SetAllowBatchImageGeneration(b bool) {
+ m.allow_batch_image_generation = &b
+}
+
+// AllowBatchImageGeneration returns the value of the "allow_batch_image_generation" field in the mutation.
+func (m *GroupMutation) AllowBatchImageGeneration() (r bool, exists bool) {
+ v := m.allow_batch_image_generation
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldAllowBatchImageGeneration returns the old "allow_batch_image_generation" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldAllowBatchImageGeneration(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldAllowBatchImageGeneration is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldAllowBatchImageGeneration requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldAllowBatchImageGeneration: %w", err)
+ }
+ return oldValue.AllowBatchImageGeneration, nil
+}
+
+// ResetAllowBatchImageGeneration resets all changes to the "allow_batch_image_generation" field.
+func (m *GroupMutation) ResetAllowBatchImageGeneration() {
+ m.allow_batch_image_generation = nil
+}
+
// SetImageRateIndependent sets the "image_rate_independent" field.
func (m *GroupMutation) SetImageRateIndependent(b bool) {
m.image_rate_independent = &b
@@ -16668,6 +22194,420 @@ func (m *GroupMutation) ResetImagePrice4k() {
delete(m.clearedFields, group.FieldImagePrice4k)
}
+// SetBatchImageDiscountMultiplier sets the "batch_image_discount_multiplier" field.
+func (m *GroupMutation) SetBatchImageDiscountMultiplier(f float64) {
+ m.batch_image_discount_multiplier = &f
+ m.addbatch_image_discount_multiplier = nil
+}
+
+// BatchImageDiscountMultiplier returns the value of the "batch_image_discount_multiplier" field in the mutation.
+func (m *GroupMutation) BatchImageDiscountMultiplier() (r float64, exists bool) {
+ v := m.batch_image_discount_multiplier
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldBatchImageDiscountMultiplier returns the old "batch_image_discount_multiplier" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldBatchImageDiscountMultiplier(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldBatchImageDiscountMultiplier is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldBatchImageDiscountMultiplier requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldBatchImageDiscountMultiplier: %w", err)
+ }
+ return oldValue.BatchImageDiscountMultiplier, nil
+}
+
+// AddBatchImageDiscountMultiplier adds f to the "batch_image_discount_multiplier" field.
+func (m *GroupMutation) AddBatchImageDiscountMultiplier(f float64) {
+ if m.addbatch_image_discount_multiplier != nil {
+ *m.addbatch_image_discount_multiplier += f
+ } else {
+ m.addbatch_image_discount_multiplier = &f
+ }
+}
+
+// AddedBatchImageDiscountMultiplier returns the value that was added to the "batch_image_discount_multiplier" field in this mutation.
+func (m *GroupMutation) AddedBatchImageDiscountMultiplier() (r float64, exists bool) {
+ v := m.addbatch_image_discount_multiplier
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetBatchImageDiscountMultiplier resets all changes to the "batch_image_discount_multiplier" field.
+func (m *GroupMutation) ResetBatchImageDiscountMultiplier() {
+ m.batch_image_discount_multiplier = nil
+ m.addbatch_image_discount_multiplier = nil
+}
+
+// SetBatchImageHoldMultiplier sets the "batch_image_hold_multiplier" field.
+func (m *GroupMutation) SetBatchImageHoldMultiplier(f float64) {
+ m.batch_image_hold_multiplier = &f
+ m.addbatch_image_hold_multiplier = nil
+}
+
+// BatchImageHoldMultiplier returns the value of the "batch_image_hold_multiplier" field in the mutation.
+func (m *GroupMutation) BatchImageHoldMultiplier() (r float64, exists bool) {
+ v := m.batch_image_hold_multiplier
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldBatchImageHoldMultiplier returns the old "batch_image_hold_multiplier" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldBatchImageHoldMultiplier(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldBatchImageHoldMultiplier is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldBatchImageHoldMultiplier requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldBatchImageHoldMultiplier: %w", err)
+ }
+ return oldValue.BatchImageHoldMultiplier, nil
+}
+
+// AddBatchImageHoldMultiplier adds f to the "batch_image_hold_multiplier" field.
+func (m *GroupMutation) AddBatchImageHoldMultiplier(f float64) {
+ if m.addbatch_image_hold_multiplier != nil {
+ *m.addbatch_image_hold_multiplier += f
+ } else {
+ m.addbatch_image_hold_multiplier = &f
+ }
+}
+
+// AddedBatchImageHoldMultiplier returns the value that was added to the "batch_image_hold_multiplier" field in this mutation.
+func (m *GroupMutation) AddedBatchImageHoldMultiplier() (r float64, exists bool) {
+ v := m.addbatch_image_hold_multiplier
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetBatchImageHoldMultiplier resets all changes to the "batch_image_hold_multiplier" field.
+func (m *GroupMutation) ResetBatchImageHoldMultiplier() {
+ m.batch_image_hold_multiplier = nil
+ m.addbatch_image_hold_multiplier = nil
+}
+
+// SetVideoRateIndependent sets the "video_rate_independent" field.
+func (m *GroupMutation) SetVideoRateIndependent(b bool) {
+ m.video_rate_independent = &b
+}
+
+// VideoRateIndependent returns the value of the "video_rate_independent" field in the mutation.
+func (m *GroupMutation) VideoRateIndependent() (r bool, exists bool) {
+ v := m.video_rate_independent
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoRateIndependent returns the old "video_rate_independent" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldVideoRateIndependent(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoRateIndependent is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoRateIndependent requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoRateIndependent: %w", err)
+ }
+ return oldValue.VideoRateIndependent, nil
+}
+
+// ResetVideoRateIndependent resets all changes to the "video_rate_independent" field.
+func (m *GroupMutation) ResetVideoRateIndependent() {
+ m.video_rate_independent = nil
+}
+
+// SetVideoRateMultiplier sets the "video_rate_multiplier" field.
+func (m *GroupMutation) SetVideoRateMultiplier(f float64) {
+ m.video_rate_multiplier = &f
+ m.addvideo_rate_multiplier = nil
+}
+
+// VideoRateMultiplier returns the value of the "video_rate_multiplier" field in the mutation.
+func (m *GroupMutation) VideoRateMultiplier() (r float64, exists bool) {
+ v := m.video_rate_multiplier
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoRateMultiplier returns the old "video_rate_multiplier" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldVideoRateMultiplier(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoRateMultiplier is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoRateMultiplier requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoRateMultiplier: %w", err)
+ }
+ return oldValue.VideoRateMultiplier, nil
+}
+
+// AddVideoRateMultiplier adds f to the "video_rate_multiplier" field.
+func (m *GroupMutation) AddVideoRateMultiplier(f float64) {
+ if m.addvideo_rate_multiplier != nil {
+ *m.addvideo_rate_multiplier += f
+ } else {
+ m.addvideo_rate_multiplier = &f
+ }
+}
+
+// AddedVideoRateMultiplier returns the value that was added to the "video_rate_multiplier" field in this mutation.
+func (m *GroupMutation) AddedVideoRateMultiplier() (r float64, exists bool) {
+ v := m.addvideo_rate_multiplier
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetVideoRateMultiplier resets all changes to the "video_rate_multiplier" field.
+func (m *GroupMutation) ResetVideoRateMultiplier() {
+ m.video_rate_multiplier = nil
+ m.addvideo_rate_multiplier = nil
+}
+
+// SetVideoPrice480p sets the "video_price_480p" field.
+func (m *GroupMutation) SetVideoPrice480p(f float64) {
+ m.video_price_480p = &f
+ m.addvideo_price_480p = nil
+}
+
+// VideoPrice480p returns the value of the "video_price_480p" field in the mutation.
+func (m *GroupMutation) VideoPrice480p() (r float64, exists bool) {
+ v := m.video_price_480p
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoPrice480p returns the old "video_price_480p" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldVideoPrice480p(ctx context.Context) (v *float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoPrice480p is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoPrice480p requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoPrice480p: %w", err)
+ }
+ return oldValue.VideoPrice480p, nil
+}
+
+// AddVideoPrice480p adds f to the "video_price_480p" field.
+func (m *GroupMutation) AddVideoPrice480p(f float64) {
+ if m.addvideo_price_480p != nil {
+ *m.addvideo_price_480p += f
+ } else {
+ m.addvideo_price_480p = &f
+ }
+}
+
+// AddedVideoPrice480p returns the value that was added to the "video_price_480p" field in this mutation.
+func (m *GroupMutation) AddedVideoPrice480p() (r float64, exists bool) {
+ v := m.addvideo_price_480p
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearVideoPrice480p clears the value of the "video_price_480p" field.
+func (m *GroupMutation) ClearVideoPrice480p() {
+ m.video_price_480p = nil
+ m.addvideo_price_480p = nil
+ m.clearedFields[group.FieldVideoPrice480p] = struct{}{}
+}
+
+// VideoPrice480pCleared returns if the "video_price_480p" field was cleared in this mutation.
+func (m *GroupMutation) VideoPrice480pCleared() bool {
+ _, ok := m.clearedFields[group.FieldVideoPrice480p]
+ return ok
+}
+
+// ResetVideoPrice480p resets all changes to the "video_price_480p" field.
+func (m *GroupMutation) ResetVideoPrice480p() {
+ m.video_price_480p = nil
+ m.addvideo_price_480p = nil
+ delete(m.clearedFields, group.FieldVideoPrice480p)
+}
+
+// SetVideoPrice720p sets the "video_price_720p" field.
+func (m *GroupMutation) SetVideoPrice720p(f float64) {
+ m.video_price_720p = &f
+ m.addvideo_price_720p = nil
+}
+
+// VideoPrice720p returns the value of the "video_price_720p" field in the mutation.
+func (m *GroupMutation) VideoPrice720p() (r float64, exists bool) {
+ v := m.video_price_720p
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoPrice720p returns the old "video_price_720p" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldVideoPrice720p(ctx context.Context) (v *float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoPrice720p is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoPrice720p requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoPrice720p: %w", err)
+ }
+ return oldValue.VideoPrice720p, nil
+}
+
+// AddVideoPrice720p adds f to the "video_price_720p" field.
+func (m *GroupMutation) AddVideoPrice720p(f float64) {
+ if m.addvideo_price_720p != nil {
+ *m.addvideo_price_720p += f
+ } else {
+ m.addvideo_price_720p = &f
+ }
+}
+
+// AddedVideoPrice720p returns the value that was added to the "video_price_720p" field in this mutation.
+func (m *GroupMutation) AddedVideoPrice720p() (r float64, exists bool) {
+ v := m.addvideo_price_720p
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearVideoPrice720p clears the value of the "video_price_720p" field.
+func (m *GroupMutation) ClearVideoPrice720p() {
+ m.video_price_720p = nil
+ m.addvideo_price_720p = nil
+ m.clearedFields[group.FieldVideoPrice720p] = struct{}{}
+}
+
+// VideoPrice720pCleared returns if the "video_price_720p" field was cleared in this mutation.
+func (m *GroupMutation) VideoPrice720pCleared() bool {
+ _, ok := m.clearedFields[group.FieldVideoPrice720p]
+ return ok
+}
+
+// ResetVideoPrice720p resets all changes to the "video_price_720p" field.
+func (m *GroupMutation) ResetVideoPrice720p() {
+ m.video_price_720p = nil
+ m.addvideo_price_720p = nil
+ delete(m.clearedFields, group.FieldVideoPrice720p)
+}
+
+// SetVideoPrice1080p sets the "video_price_1080p" field.
+func (m *GroupMutation) SetVideoPrice1080p(f float64) {
+ m.video_price_1080p = &f
+ m.addvideo_price_1080p = nil
+}
+
+// VideoPrice1080p returns the value of the "video_price_1080p" field in the mutation.
+func (m *GroupMutation) VideoPrice1080p() (r float64, exists bool) {
+ v := m.video_price_1080p
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoPrice1080p returns the old "video_price_1080p" field's value of the Group entity.
+// If the Group object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *GroupMutation) OldVideoPrice1080p(ctx context.Context) (v *float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoPrice1080p is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoPrice1080p requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoPrice1080p: %w", err)
+ }
+ return oldValue.VideoPrice1080p, nil
+}
+
+// AddVideoPrice1080p adds f to the "video_price_1080p" field.
+func (m *GroupMutation) AddVideoPrice1080p(f float64) {
+ if m.addvideo_price_1080p != nil {
+ *m.addvideo_price_1080p += f
+ } else {
+ m.addvideo_price_1080p = &f
+ }
+}
+
+// AddedVideoPrice1080p returns the value that was added to the "video_price_1080p" field in this mutation.
+func (m *GroupMutation) AddedVideoPrice1080p() (r float64, exists bool) {
+ v := m.addvideo_price_1080p
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearVideoPrice1080p clears the value of the "video_price_1080p" field.
+func (m *GroupMutation) ClearVideoPrice1080p() {
+ m.video_price_1080p = nil
+ m.addvideo_price_1080p = nil
+ m.clearedFields[group.FieldVideoPrice1080p] = struct{}{}
+}
+
+// VideoPrice1080pCleared returns if the "video_price_1080p" field was cleared in this mutation.
+func (m *GroupMutation) VideoPrice1080pCleared() bool {
+ _, ok := m.clearedFields[group.FieldVideoPrice1080p]
+ return ok
+}
+
+// ResetVideoPrice1080p resets all changes to the "video_price_1080p" field.
+func (m *GroupMutation) ResetVideoPrice1080p() {
+ m.video_price_1080p = nil
+ m.addvideo_price_1080p = nil
+ delete(m.clearedFields, group.FieldVideoPrice1080p)
+}
+
// SetClaudeCodeOnly sets the "claude_code_only" field.
func (m *GroupMutation) SetClaudeCodeOnly(b bool) {
m.claude_code_only = &b
@@ -17702,7 +23642,7 @@ func (m *GroupMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *GroupMutation) Fields() []string {
- fields := make([]string, 0, 39)
+ fields := make([]string, 0, 47)
if m.created_at != nil {
fields = append(fields, group.FieldCreatedAt)
}
@@ -17760,6 +23700,9 @@ func (m *GroupMutation) Fields() []string {
if m.allow_image_generation != nil {
fields = append(fields, group.FieldAllowImageGeneration)
}
+ if m.allow_batch_image_generation != nil {
+ fields = append(fields, group.FieldAllowBatchImageGeneration)
+ }
if m.image_rate_independent != nil {
fields = append(fields, group.FieldImageRateIndependent)
}
@@ -17775,6 +23718,27 @@ func (m *GroupMutation) Fields() []string {
if m.image_price_4k != nil {
fields = append(fields, group.FieldImagePrice4k)
}
+ if m.batch_image_discount_multiplier != nil {
+ fields = append(fields, group.FieldBatchImageDiscountMultiplier)
+ }
+ if m.batch_image_hold_multiplier != nil {
+ fields = append(fields, group.FieldBatchImageHoldMultiplier)
+ }
+ if m.video_rate_independent != nil {
+ fields = append(fields, group.FieldVideoRateIndependent)
+ }
+ if m.video_rate_multiplier != nil {
+ fields = append(fields, group.FieldVideoRateMultiplier)
+ }
+ if m.video_price_480p != nil {
+ fields = append(fields, group.FieldVideoPrice480p)
+ }
+ if m.video_price_720p != nil {
+ fields = append(fields, group.FieldVideoPrice720p)
+ }
+ if m.video_price_1080p != nil {
+ fields = append(fields, group.FieldVideoPrice1080p)
+ }
if m.claude_code_only != nil {
fields = append(fields, group.FieldClaudeCodeOnly)
}
@@ -17866,6 +23830,8 @@ func (m *GroupMutation) Field(name string) (ent.Value, bool) {
return m.DefaultValidityDays()
case group.FieldAllowImageGeneration:
return m.AllowImageGeneration()
+ case group.FieldAllowBatchImageGeneration:
+ return m.AllowBatchImageGeneration()
case group.FieldImageRateIndependent:
return m.ImageRateIndependent()
case group.FieldImageRateMultiplier:
@@ -17876,6 +23842,20 @@ func (m *GroupMutation) Field(name string) (ent.Value, bool) {
return m.ImagePrice2k()
case group.FieldImagePrice4k:
return m.ImagePrice4k()
+ case group.FieldBatchImageDiscountMultiplier:
+ return m.BatchImageDiscountMultiplier()
+ case group.FieldBatchImageHoldMultiplier:
+ return m.BatchImageHoldMultiplier()
+ case group.FieldVideoRateIndependent:
+ return m.VideoRateIndependent()
+ case group.FieldVideoRateMultiplier:
+ return m.VideoRateMultiplier()
+ case group.FieldVideoPrice480p:
+ return m.VideoPrice480p()
+ case group.FieldVideoPrice720p:
+ return m.VideoPrice720p()
+ case group.FieldVideoPrice1080p:
+ return m.VideoPrice1080p()
case group.FieldClaudeCodeOnly:
return m.ClaudeCodeOnly()
case group.FieldFallbackGroupID:
@@ -17953,6 +23933,8 @@ func (m *GroupMutation) OldField(ctx context.Context, name string) (ent.Value, e
return m.OldDefaultValidityDays(ctx)
case group.FieldAllowImageGeneration:
return m.OldAllowImageGeneration(ctx)
+ case group.FieldAllowBatchImageGeneration:
+ return m.OldAllowBatchImageGeneration(ctx)
case group.FieldImageRateIndependent:
return m.OldImageRateIndependent(ctx)
case group.FieldImageRateMultiplier:
@@ -17963,6 +23945,20 @@ func (m *GroupMutation) OldField(ctx context.Context, name string) (ent.Value, e
return m.OldImagePrice2k(ctx)
case group.FieldImagePrice4k:
return m.OldImagePrice4k(ctx)
+ case group.FieldBatchImageDiscountMultiplier:
+ return m.OldBatchImageDiscountMultiplier(ctx)
+ case group.FieldBatchImageHoldMultiplier:
+ return m.OldBatchImageHoldMultiplier(ctx)
+ case group.FieldVideoRateIndependent:
+ return m.OldVideoRateIndependent(ctx)
+ case group.FieldVideoRateMultiplier:
+ return m.OldVideoRateMultiplier(ctx)
+ case group.FieldVideoPrice480p:
+ return m.OldVideoPrice480p(ctx)
+ case group.FieldVideoPrice720p:
+ return m.OldVideoPrice720p(ctx)
+ case group.FieldVideoPrice1080p:
+ return m.OldVideoPrice1080p(ctx)
case group.FieldClaudeCodeOnly:
return m.OldClaudeCodeOnly(ctx)
case group.FieldFallbackGroupID:
@@ -18135,6 +24131,13 @@ func (m *GroupMutation) SetField(name string, value ent.Value) error {
}
m.SetAllowImageGeneration(v)
return nil
+ case group.FieldAllowBatchImageGeneration:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetAllowBatchImageGeneration(v)
+ return nil
case group.FieldImageRateIndependent:
v, ok := value.(bool)
if !ok {
@@ -18170,6 +24173,55 @@ func (m *GroupMutation) SetField(name string, value ent.Value) error {
}
m.SetImagePrice4k(v)
return nil
+ case group.FieldBatchImageDiscountMultiplier:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetBatchImageDiscountMultiplier(v)
+ return nil
+ case group.FieldBatchImageHoldMultiplier:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetBatchImageHoldMultiplier(v)
+ return nil
+ case group.FieldVideoRateIndependent:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoRateIndependent(v)
+ return nil
+ case group.FieldVideoRateMultiplier:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoRateMultiplier(v)
+ return nil
+ case group.FieldVideoPrice480p:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoPrice480p(v)
+ return nil
+ case group.FieldVideoPrice720p:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoPrice720p(v)
+ return nil
+ case group.FieldVideoPrice1080p:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoPrice1080p(v)
+ return nil
case group.FieldClaudeCodeOnly:
v, ok := value.(bool)
if !ok {
@@ -18313,6 +24365,24 @@ func (m *GroupMutation) AddedFields() []string {
if m.addimage_price_4k != nil {
fields = append(fields, group.FieldImagePrice4k)
}
+ if m.addbatch_image_discount_multiplier != nil {
+ fields = append(fields, group.FieldBatchImageDiscountMultiplier)
+ }
+ if m.addbatch_image_hold_multiplier != nil {
+ fields = append(fields, group.FieldBatchImageHoldMultiplier)
+ }
+ if m.addvideo_rate_multiplier != nil {
+ fields = append(fields, group.FieldVideoRateMultiplier)
+ }
+ if m.addvideo_price_480p != nil {
+ fields = append(fields, group.FieldVideoPrice480p)
+ }
+ if m.addvideo_price_720p != nil {
+ fields = append(fields, group.FieldVideoPrice720p)
+ }
+ if m.addvideo_price_1080p != nil {
+ fields = append(fields, group.FieldVideoPrice1080p)
+ }
if m.addfallback_group_id != nil {
fields = append(fields, group.FieldFallbackGroupID)
}
@@ -18353,6 +24423,18 @@ func (m *GroupMutation) AddedField(name string) (ent.Value, bool) {
return m.AddedImagePrice2k()
case group.FieldImagePrice4k:
return m.AddedImagePrice4k()
+ case group.FieldBatchImageDiscountMultiplier:
+ return m.AddedBatchImageDiscountMultiplier()
+ case group.FieldBatchImageHoldMultiplier:
+ return m.AddedBatchImageHoldMultiplier()
+ case group.FieldVideoRateMultiplier:
+ return m.AddedVideoRateMultiplier()
+ case group.FieldVideoPrice480p:
+ return m.AddedVideoPrice480p()
+ case group.FieldVideoPrice720p:
+ return m.AddedVideoPrice720p()
+ case group.FieldVideoPrice1080p:
+ return m.AddedVideoPrice1080p()
case group.FieldFallbackGroupID:
return m.AddedFallbackGroupID()
case group.FieldFallbackGroupIDOnInvalidRequest:
@@ -18440,6 +24522,48 @@ func (m *GroupMutation) AddField(name string, value ent.Value) error {
}
m.AddImagePrice4k(v)
return nil
+ case group.FieldBatchImageDiscountMultiplier:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddBatchImageDiscountMultiplier(v)
+ return nil
+ case group.FieldBatchImageHoldMultiplier:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddBatchImageHoldMultiplier(v)
+ return nil
+ case group.FieldVideoRateMultiplier:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddVideoRateMultiplier(v)
+ return nil
+ case group.FieldVideoPrice480p:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddVideoPrice480p(v)
+ return nil
+ case group.FieldVideoPrice720p:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddVideoPrice720p(v)
+ return nil
+ case group.FieldVideoPrice1080p:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddVideoPrice1080p(v)
+ return nil
case group.FieldFallbackGroupID:
v, ok := value.(int64)
if !ok {
@@ -18500,6 +24624,15 @@ func (m *GroupMutation) ClearedFields() []string {
if m.FieldCleared(group.FieldImagePrice4k) {
fields = append(fields, group.FieldImagePrice4k)
}
+ if m.FieldCleared(group.FieldVideoPrice480p) {
+ fields = append(fields, group.FieldVideoPrice480p)
+ }
+ if m.FieldCleared(group.FieldVideoPrice720p) {
+ fields = append(fields, group.FieldVideoPrice720p)
+ }
+ if m.FieldCleared(group.FieldVideoPrice1080p) {
+ fields = append(fields, group.FieldVideoPrice1080p)
+ }
if m.FieldCleared(group.FieldFallbackGroupID) {
fields = append(fields, group.FieldFallbackGroupID)
}
@@ -18547,6 +24680,15 @@ func (m *GroupMutation) ClearField(name string) error {
case group.FieldImagePrice4k:
m.ClearImagePrice4k()
return nil
+ case group.FieldVideoPrice480p:
+ m.ClearVideoPrice480p()
+ return nil
+ case group.FieldVideoPrice720p:
+ m.ClearVideoPrice720p()
+ return nil
+ case group.FieldVideoPrice1080p:
+ m.ClearVideoPrice1080p()
+ return nil
case group.FieldFallbackGroupID:
m.ClearFallbackGroupID()
return nil
@@ -18621,6 +24763,9 @@ func (m *GroupMutation) ResetField(name string) error {
case group.FieldAllowImageGeneration:
m.ResetAllowImageGeneration()
return nil
+ case group.FieldAllowBatchImageGeneration:
+ m.ResetAllowBatchImageGeneration()
+ return nil
case group.FieldImageRateIndependent:
m.ResetImageRateIndependent()
return nil
@@ -18636,6 +24781,27 @@ func (m *GroupMutation) ResetField(name string) error {
case group.FieldImagePrice4k:
m.ResetImagePrice4k()
return nil
+ case group.FieldBatchImageDiscountMultiplier:
+ m.ResetBatchImageDiscountMultiplier()
+ return nil
+ case group.FieldBatchImageHoldMultiplier:
+ m.ResetBatchImageHoldMultiplier()
+ return nil
+ case group.FieldVideoRateIndependent:
+ m.ResetVideoRateIndependent()
+ return nil
+ case group.FieldVideoRateMultiplier:
+ m.ResetVideoRateMultiplier()
+ return nil
+ case group.FieldVideoPrice480p:
+ m.ResetVideoPrice480p()
+ return nil
+ case group.FieldVideoPrice720p:
+ m.ResetVideoPrice720p()
+ return nil
+ case group.FieldVideoPrice1080p:
+ m.ResetVideoPrice1080p()
+ return nil
case group.FieldClaudeCodeOnly:
m.ResetClaudeCodeOnly()
return nil
@@ -35546,6 +41712,11 @@ type UsageLogMutation struct {
image_output_size *string
image_size_source *string
image_size_breakdown *map[string]int
+ video_count *int
+ addvideo_count *int
+ video_resolution *string
+ video_duration_seconds *int
+ addvideo_duration_seconds *int
cache_ttl_overridden *bool
created_at *time.Time
clearedFields map[string]struct{}
@@ -37684,6 +43855,181 @@ func (m *UsageLogMutation) ResetImageSizeBreakdown() {
delete(m.clearedFields, usagelog.FieldImageSizeBreakdown)
}
+// SetVideoCount sets the "video_count" field.
+func (m *UsageLogMutation) SetVideoCount(i int) {
+ m.video_count = &i
+ m.addvideo_count = nil
+}
+
+// VideoCount returns the value of the "video_count" field in the mutation.
+func (m *UsageLogMutation) VideoCount() (r int, exists bool) {
+ v := m.video_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoCount returns the old "video_count" field's value of the UsageLog entity.
+// If the UsageLog object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageLogMutation) OldVideoCount(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoCount is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoCount requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoCount: %w", err)
+ }
+ return oldValue.VideoCount, nil
+}
+
+// AddVideoCount adds i to the "video_count" field.
+func (m *UsageLogMutation) AddVideoCount(i int) {
+ if m.addvideo_count != nil {
+ *m.addvideo_count += i
+ } else {
+ m.addvideo_count = &i
+ }
+}
+
+// AddedVideoCount returns the value that was added to the "video_count" field in this mutation.
+func (m *UsageLogMutation) AddedVideoCount() (r int, exists bool) {
+ v := m.addvideo_count
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetVideoCount resets all changes to the "video_count" field.
+func (m *UsageLogMutation) ResetVideoCount() {
+ m.video_count = nil
+ m.addvideo_count = nil
+}
+
+// SetVideoResolution sets the "video_resolution" field.
+func (m *UsageLogMutation) SetVideoResolution(s string) {
+ m.video_resolution = &s
+}
+
+// VideoResolution returns the value of the "video_resolution" field in the mutation.
+func (m *UsageLogMutation) VideoResolution() (r string, exists bool) {
+ v := m.video_resolution
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoResolution returns the old "video_resolution" field's value of the UsageLog entity.
+// If the UsageLog object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageLogMutation) OldVideoResolution(ctx context.Context) (v *string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoResolution is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoResolution requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoResolution: %w", err)
+ }
+ return oldValue.VideoResolution, nil
+}
+
+// ClearVideoResolution clears the value of the "video_resolution" field.
+func (m *UsageLogMutation) ClearVideoResolution() {
+ m.video_resolution = nil
+ m.clearedFields[usagelog.FieldVideoResolution] = struct{}{}
+}
+
+// VideoResolutionCleared returns if the "video_resolution" field was cleared in this mutation.
+func (m *UsageLogMutation) VideoResolutionCleared() bool {
+ _, ok := m.clearedFields[usagelog.FieldVideoResolution]
+ return ok
+}
+
+// ResetVideoResolution resets all changes to the "video_resolution" field.
+func (m *UsageLogMutation) ResetVideoResolution() {
+ m.video_resolution = nil
+ delete(m.clearedFields, usagelog.FieldVideoResolution)
+}
+
+// SetVideoDurationSeconds sets the "video_duration_seconds" field.
+func (m *UsageLogMutation) SetVideoDurationSeconds(i int) {
+ m.video_duration_seconds = &i
+ m.addvideo_duration_seconds = nil
+}
+
+// VideoDurationSeconds returns the value of the "video_duration_seconds" field in the mutation.
+func (m *UsageLogMutation) VideoDurationSeconds() (r int, exists bool) {
+ v := m.video_duration_seconds
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldVideoDurationSeconds returns the old "video_duration_seconds" field's value of the UsageLog entity.
+// If the UsageLog object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UsageLogMutation) OldVideoDurationSeconds(ctx context.Context) (v *int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldVideoDurationSeconds is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldVideoDurationSeconds requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldVideoDurationSeconds: %w", err)
+ }
+ return oldValue.VideoDurationSeconds, nil
+}
+
+// AddVideoDurationSeconds adds i to the "video_duration_seconds" field.
+func (m *UsageLogMutation) AddVideoDurationSeconds(i int) {
+ if m.addvideo_duration_seconds != nil {
+ *m.addvideo_duration_seconds += i
+ } else {
+ m.addvideo_duration_seconds = &i
+ }
+}
+
+// AddedVideoDurationSeconds returns the value that was added to the "video_duration_seconds" field in this mutation.
+func (m *UsageLogMutation) AddedVideoDurationSeconds() (r int, exists bool) {
+ v := m.addvideo_duration_seconds
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
+func (m *UsageLogMutation) ClearVideoDurationSeconds() {
+ m.video_duration_seconds = nil
+ m.addvideo_duration_seconds = nil
+ m.clearedFields[usagelog.FieldVideoDurationSeconds] = struct{}{}
+}
+
+// VideoDurationSecondsCleared returns if the "video_duration_seconds" field was cleared in this mutation.
+func (m *UsageLogMutation) VideoDurationSecondsCleared() bool {
+ _, ok := m.clearedFields[usagelog.FieldVideoDurationSeconds]
+ return ok
+}
+
+// ResetVideoDurationSeconds resets all changes to the "video_duration_seconds" field.
+func (m *UsageLogMutation) ResetVideoDurationSeconds() {
+ m.video_duration_seconds = nil
+ m.addvideo_duration_seconds = nil
+ delete(m.clearedFields, usagelog.FieldVideoDurationSeconds)
+}
+
// SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
func (m *UsageLogMutation) SetCacheTTLOverridden(b bool) {
m.cache_ttl_overridden = &b
@@ -37925,7 +44271,7 @@ func (m *UsageLogMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *UsageLogMutation) Fields() []string {
- fields := make([]string, 0, 41)
+ fields := make([]string, 0, 44)
if m.user != nil {
fields = append(fields, usagelog.FieldUserID)
}
@@ -38043,6 +44389,15 @@ func (m *UsageLogMutation) Fields() []string {
if m.image_size_breakdown != nil {
fields = append(fields, usagelog.FieldImageSizeBreakdown)
}
+ if m.video_count != nil {
+ fields = append(fields, usagelog.FieldVideoCount)
+ }
+ if m.video_resolution != nil {
+ fields = append(fields, usagelog.FieldVideoResolution)
+ }
+ if m.video_duration_seconds != nil {
+ fields = append(fields, usagelog.FieldVideoDurationSeconds)
+ }
if m.cache_ttl_overridden != nil {
fields = append(fields, usagelog.FieldCacheTTLOverridden)
}
@@ -38135,6 +44490,12 @@ func (m *UsageLogMutation) Field(name string) (ent.Value, bool) {
return m.ImageSizeSource()
case usagelog.FieldImageSizeBreakdown:
return m.ImageSizeBreakdown()
+ case usagelog.FieldVideoCount:
+ return m.VideoCount()
+ case usagelog.FieldVideoResolution:
+ return m.VideoResolution()
+ case usagelog.FieldVideoDurationSeconds:
+ return m.VideoDurationSeconds()
case usagelog.FieldCacheTTLOverridden:
return m.CacheTTLOverridden()
case usagelog.FieldCreatedAt:
@@ -38226,6 +44587,12 @@ func (m *UsageLogMutation) OldField(ctx context.Context, name string) (ent.Value
return m.OldImageSizeSource(ctx)
case usagelog.FieldImageSizeBreakdown:
return m.OldImageSizeBreakdown(ctx)
+ case usagelog.FieldVideoCount:
+ return m.OldVideoCount(ctx)
+ case usagelog.FieldVideoResolution:
+ return m.OldVideoResolution(ctx)
+ case usagelog.FieldVideoDurationSeconds:
+ return m.OldVideoDurationSeconds(ctx)
case usagelog.FieldCacheTTLOverridden:
return m.OldCacheTTLOverridden(ctx)
case usagelog.FieldCreatedAt:
@@ -38512,6 +44879,27 @@ func (m *UsageLogMutation) SetField(name string, value ent.Value) error {
}
m.SetImageSizeBreakdown(v)
return nil
+ case usagelog.FieldVideoCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoCount(v)
+ return nil
+ case usagelog.FieldVideoResolution:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoResolution(v)
+ return nil
+ case usagelog.FieldVideoDurationSeconds:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetVideoDurationSeconds(v)
+ return nil
case usagelog.FieldCacheTTLOverridden:
v, ok := value.(bool)
if !ok {
@@ -38591,6 +44979,12 @@ func (m *UsageLogMutation) AddedFields() []string {
if m.addimage_count != nil {
fields = append(fields, usagelog.FieldImageCount)
}
+ if m.addvideo_count != nil {
+ fields = append(fields, usagelog.FieldVideoCount)
+ }
+ if m.addvideo_duration_seconds != nil {
+ fields = append(fields, usagelog.FieldVideoDurationSeconds)
+ }
return fields
}
@@ -38637,6 +45031,10 @@ func (m *UsageLogMutation) AddedField(name string) (ent.Value, bool) {
return m.AddedFirstTokenMs()
case usagelog.FieldImageCount:
return m.AddedImageCount()
+ case usagelog.FieldVideoCount:
+ return m.AddedVideoCount()
+ case usagelog.FieldVideoDurationSeconds:
+ return m.AddedVideoDurationSeconds()
}
return nil, false
}
@@ -38779,6 +45177,20 @@ func (m *UsageLogMutation) AddField(name string, value ent.Value) error {
}
m.AddImageCount(v)
return nil
+ case usagelog.FieldVideoCount:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddVideoCount(v)
+ return nil
+ case usagelog.FieldVideoDurationSeconds:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddVideoDurationSeconds(v)
+ return nil
}
return fmt.Errorf("unknown UsageLog numeric field %s", name)
}
@@ -38841,6 +45253,12 @@ func (m *UsageLogMutation) ClearedFields() []string {
if m.FieldCleared(usagelog.FieldImageSizeBreakdown) {
fields = append(fields, usagelog.FieldImageSizeBreakdown)
}
+ if m.FieldCleared(usagelog.FieldVideoResolution) {
+ fields = append(fields, usagelog.FieldVideoResolution)
+ }
+ if m.FieldCleared(usagelog.FieldVideoDurationSeconds) {
+ fields = append(fields, usagelog.FieldVideoDurationSeconds)
+ }
return fields
}
@@ -38909,6 +45327,12 @@ func (m *UsageLogMutation) ClearField(name string) error {
case usagelog.FieldImageSizeBreakdown:
m.ClearImageSizeBreakdown()
return nil
+ case usagelog.FieldVideoResolution:
+ m.ClearVideoResolution()
+ return nil
+ case usagelog.FieldVideoDurationSeconds:
+ m.ClearVideoDurationSeconds()
+ return nil
}
return fmt.Errorf("unknown UsageLog nullable field %s", name)
}
@@ -39034,6 +45458,15 @@ func (m *UsageLogMutation) ResetField(name string) error {
case usagelog.FieldImageSizeBreakdown:
m.ResetImageSizeBreakdown()
return nil
+ case usagelog.FieldVideoCount:
+ m.ResetVideoCount()
+ return nil
+ case usagelog.FieldVideoResolution:
+ m.ResetVideoResolution()
+ return nil
+ case usagelog.FieldVideoDurationSeconds:
+ m.ResetVideoDurationSeconds()
+ return nil
case usagelog.FieldCacheTTLOverridden:
m.ResetCacheTTLOverridden()
return nil
@@ -39204,6 +45637,8 @@ type UserMutation struct {
role *string
balance *float64
addbalance *float64
+ frozen_balance *float64
+ addfrozen_balance *float64
concurrency *int
addconcurrency *int
status *string
@@ -39652,6 +46087,62 @@ func (m *UserMutation) ResetBalance() {
m.addbalance = nil
}
+// SetFrozenBalance sets the "frozen_balance" field.
+func (m *UserMutation) SetFrozenBalance(f float64) {
+ m.frozen_balance = &f
+ m.addfrozen_balance = nil
+}
+
+// FrozenBalance returns the value of the "frozen_balance" field in the mutation.
+func (m *UserMutation) FrozenBalance() (r float64, exists bool) {
+ v := m.frozen_balance
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldFrozenBalance returns the old "frozen_balance" field's value of the User entity.
+// If the User object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *UserMutation) OldFrozenBalance(ctx context.Context) (v float64, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldFrozenBalance is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldFrozenBalance requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldFrozenBalance: %w", err)
+ }
+ return oldValue.FrozenBalance, nil
+}
+
+// AddFrozenBalance adds f to the "frozen_balance" field.
+func (m *UserMutation) AddFrozenBalance(f float64) {
+ if m.addfrozen_balance != nil {
+ *m.addfrozen_balance += f
+ } else {
+ m.addfrozen_balance = &f
+ }
+}
+
+// AddedFrozenBalance returns the value that was added to the "frozen_balance" field in this mutation.
+func (m *UserMutation) AddedFrozenBalance() (r float64, exists bool) {
+ v := m.addfrozen_balance
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetFrozenBalance resets all changes to the "frozen_balance" field.
+func (m *UserMutation) ResetFrozenBalance() {
+ m.frozen_balance = nil
+ m.addfrozen_balance = nil
+}
+
// SetConcurrency sets the "concurrency" field.
func (m *UserMutation) SetConcurrency(i int) {
m.concurrency = &i
@@ -41110,7 +47601,7 @@ func (m *UserMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *UserMutation) Fields() []string {
- fields := make([]string, 0, 23)
+ fields := make([]string, 0, 24)
if m.created_at != nil {
fields = append(fields, user.FieldCreatedAt)
}
@@ -41132,6 +47623,9 @@ func (m *UserMutation) Fields() []string {
if m.balance != nil {
fields = append(fields, user.FieldBalance)
}
+ if m.frozen_balance != nil {
+ fields = append(fields, user.FieldFrozenBalance)
+ }
if m.concurrency != nil {
fields = append(fields, user.FieldConcurrency)
}
@@ -41202,6 +47696,8 @@ func (m *UserMutation) Field(name string) (ent.Value, bool) {
return m.Role()
case user.FieldBalance:
return m.Balance()
+ case user.FieldFrozenBalance:
+ return m.FrozenBalance()
case user.FieldConcurrency:
return m.Concurrency()
case user.FieldStatus:
@@ -41257,6 +47753,8 @@ func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, er
return m.OldRole(ctx)
case user.FieldBalance:
return m.OldBalance(ctx)
+ case user.FieldFrozenBalance:
+ return m.OldFrozenBalance(ctx)
case user.FieldConcurrency:
return m.OldConcurrency(ctx)
case user.FieldStatus:
@@ -41347,6 +47845,13 @@ func (m *UserMutation) SetField(name string, value ent.Value) error {
}
m.SetBalance(v)
return nil
+ case user.FieldFrozenBalance:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetFrozenBalance(v)
+ return nil
case user.FieldConcurrency:
v, ok := value.(int)
if !ok {
@@ -41470,6 +47975,9 @@ func (m *UserMutation) AddedFields() []string {
if m.addbalance != nil {
fields = append(fields, user.FieldBalance)
}
+ if m.addfrozen_balance != nil {
+ fields = append(fields, user.FieldFrozenBalance)
+ }
if m.addconcurrency != nil {
fields = append(fields, user.FieldConcurrency)
}
@@ -41492,6 +48000,8 @@ func (m *UserMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case user.FieldBalance:
return m.AddedBalance()
+ case user.FieldFrozenBalance:
+ return m.AddedFrozenBalance()
case user.FieldConcurrency:
return m.AddedConcurrency()
case user.FieldBalanceNotifyThreshold:
@@ -41516,6 +48026,13 @@ func (m *UserMutation) AddField(name string, value ent.Value) error {
}
m.AddBalance(v)
return nil
+ case user.FieldFrozenBalance:
+ v, ok := value.(float64)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddFrozenBalance(v)
+ return nil
case user.FieldConcurrency:
v, ok := value.(int)
if !ok {
@@ -41631,6 +48148,9 @@ func (m *UserMutation) ResetField(name string) error {
case user.FieldBalance:
m.ResetBalance()
return nil
+ case user.FieldFrozenBalance:
+ m.ResetFrozenBalance()
+ return nil
case user.FieldConcurrency:
m.ResetConcurrency()
return nil
diff --git a/backend/ent/predicate/predicate.go b/backend/ent/predicate/predicate.go
index ab4d7d1827..8d18d38151 100644
--- a/backend/ent/predicate/predicate.go
+++ b/backend/ent/predicate/predicate.go
@@ -27,6 +27,15 @@ type AuthIdentity func(*sql.Selector)
// AuthIdentityChannel is the predicate function for authidentitychannel builders.
type AuthIdentityChannel func(*sql.Selector)
+// BatchImageEvent is the predicate function for batchimageevent builders.
+type BatchImageEvent func(*sql.Selector)
+
+// BatchImageItem is the predicate function for batchimageitem builders.
+type BatchImageItem func(*sql.Selector)
+
+// BatchImageJob is the predicate function for batchimagejob builders.
+type BatchImageJob func(*sql.Selector)
+
// ChannelMonitor is the predicate function for channelmonitor builders.
type ChannelMonitor func(*sql.Selector)
diff --git a/backend/ent/runtime/runtime.go b/backend/ent/runtime/runtime.go
index b86f6a0560..d47e7d143b 100644
--- a/backend/ent/runtime/runtime.go
+++ b/backend/ent/runtime/runtime.go
@@ -12,6 +12,9 @@ import (
"github.com/Wei-Shaw/sub2api/ent/apikey"
"github.com/Wei-Shaw/sub2api/ent/authidentity"
"github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageevent"
+ "github.com/Wei-Shaw/sub2api/ent/batchimageitem"
+ "github.com/Wei-Shaw/sub2api/ent/batchimagejob"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
@@ -432,6 +435,172 @@ func init() {
authidentitychannelDescMetadata := authidentitychannelFields[6].Descriptor()
// authidentitychannel.DefaultMetadata holds the default value on creation for the metadata field.
authidentitychannel.DefaultMetadata = authidentitychannelDescMetadata.Default.(func() map[string]interface{})
+ batchimageeventFields := schema.BatchImageEvent{}.Fields()
+ _ = batchimageeventFields
+ // batchimageeventDescJobID is the schema descriptor for job_id field.
+ batchimageeventDescJobID := batchimageeventFields[0].Descriptor()
+ // batchimageevent.JobIDValidator is a validator for the "job_id" field. It is called by the builders before save.
+ batchimageevent.JobIDValidator = batchimageeventDescJobID.Validators[0].(func(string) error)
+ // batchimageeventDescEventType is the schema descriptor for event_type field.
+ batchimageeventDescEventType := batchimageeventFields[1].Descriptor()
+ // batchimageevent.EventTypeValidator is a validator for the "event_type" field. It is called by the builders before save.
+ batchimageevent.EventTypeValidator = batchimageeventDescEventType.Validators[0].(func(string) error)
+ // batchimageeventDescEventHash is the schema descriptor for event_hash field.
+ batchimageeventDescEventHash := batchimageeventFields[3].Descriptor()
+ // batchimageevent.EventHashValidator is a validator for the "event_hash" field. It is called by the builders before save.
+ batchimageevent.EventHashValidator = batchimageeventDescEventHash.Validators[0].(func(string) error)
+ // batchimageeventDescCreatedAt is the schema descriptor for created_at field.
+ batchimageeventDescCreatedAt := batchimageeventFields[4].Descriptor()
+ // batchimageevent.DefaultCreatedAt holds the default value on creation for the created_at field.
+ batchimageevent.DefaultCreatedAt = batchimageeventDescCreatedAt.Default.(func() time.Time)
+ batchimageitemFields := schema.BatchImageItem{}.Fields()
+ _ = batchimageitemFields
+ // batchimageitemDescJobID is the schema descriptor for job_id field.
+ batchimageitemDescJobID := batchimageitemFields[0].Descriptor()
+ // batchimageitem.JobIDValidator is a validator for the "job_id" field. It is called by the builders before save.
+ batchimageitem.JobIDValidator = batchimageitemDescJobID.Validators[0].(func(string) error)
+ // batchimageitemDescCustomID is the schema descriptor for custom_id field.
+ batchimageitemDescCustomID := batchimageitemFields[1].Descriptor()
+ // batchimageitem.CustomIDValidator is a validator for the "custom_id" field. It is called by the builders before save.
+ batchimageitem.CustomIDValidator = batchimageitemDescCustomID.Validators[0].(func(string) error)
+ // batchimageitemDescStatus is the schema descriptor for status field.
+ batchimageitemDescStatus := batchimageitemFields[2].Descriptor()
+ // batchimageitem.StatusValidator is a validator for the "status" field. It is called by the builders before save.
+ batchimageitem.StatusValidator = batchimageitemDescStatus.Validators[0].(func(string) error)
+ // batchimageitemDescRequestHash is the schema descriptor for request_hash field.
+ batchimageitemDescRequestHash := batchimageitemFields[3].Descriptor()
+ // batchimageitem.RequestHashValidator is a validator for the "request_hash" field. It is called by the builders before save.
+ batchimageitem.RequestHashValidator = batchimageitemDescRequestHash.Validators[0].(func(string) error)
+ // batchimageitemDescProviderSourceObject is the schema descriptor for provider_source_object field.
+ batchimageitemDescProviderSourceObject := batchimageitemFields[5].Descriptor()
+ // batchimageitem.ProviderSourceObjectValidator is a validator for the "provider_source_object" field. It is called by the builders before save.
+ batchimageitem.ProviderSourceObjectValidator = batchimageitemDescProviderSourceObject.Validators[0].(func(string) error)
+ // batchimageitemDescMimeType is the schema descriptor for mime_type field.
+ batchimageitemDescMimeType := batchimageitemFields[9].Descriptor()
+ // batchimageitem.MimeTypeValidator is a validator for the "mime_type" field. It is called by the builders before save.
+ batchimageitem.MimeTypeValidator = batchimageitemDescMimeType.Validators[0].(func(string) error)
+ // batchimageitemDescFileExtension is the schema descriptor for file_extension field.
+ batchimageitemDescFileExtension := batchimageitemFields[10].Descriptor()
+ // batchimageitem.FileExtensionValidator is a validator for the "file_extension" field. It is called by the builders before save.
+ batchimageitem.FileExtensionValidator = batchimageitemDescFileExtension.Validators[0].(func(string) error)
+ // batchimageitemDescImageCount is the schema descriptor for image_count field.
+ batchimageitemDescImageCount := batchimageitemFields[11].Descriptor()
+ // batchimageitem.DefaultImageCount holds the default value on creation for the image_count field.
+ batchimageitem.DefaultImageCount = batchimageitemDescImageCount.Default.(int)
+ // batchimageitemDescErrorCode is the schema descriptor for error_code field.
+ batchimageitemDescErrorCode := batchimageitemFields[12].Descriptor()
+ // batchimageitem.ErrorCodeValidator is a validator for the "error_code" field. It is called by the builders before save.
+ batchimageitem.ErrorCodeValidator = batchimageitemDescErrorCode.Validators[0].(func(string) error)
+ // batchimageitemDescCreatedAt is the schema descriptor for created_at field.
+ batchimageitemDescCreatedAt := batchimageitemFields[15].Descriptor()
+ // batchimageitem.DefaultCreatedAt holds the default value on creation for the created_at field.
+ batchimageitem.DefaultCreatedAt = batchimageitemDescCreatedAt.Default.(func() time.Time)
+ batchimagejobFields := schema.BatchImageJob{}.Fields()
+ _ = batchimagejobFields
+ // batchimagejobDescBatchID is the schema descriptor for batch_id field.
+ batchimagejobDescBatchID := batchimagejobFields[0].Descriptor()
+ // batchimagejob.BatchIDValidator is a validator for the "batch_id" field. It is called by the builders before save.
+ batchimagejob.BatchIDValidator = batchimagejobDescBatchID.Validators[0].(func(string) error)
+ // batchimagejobDescProvider is the schema descriptor for provider field.
+ batchimagejobDescProvider := batchimagejobFields[4].Descriptor()
+ // batchimagejob.ProviderValidator is a validator for the "provider" field. It is called by the builders before save.
+ batchimagejob.ProviderValidator = batchimagejobDescProvider.Validators[0].(func(string) error)
+ // batchimagejobDescModel is the schema descriptor for model field.
+ batchimagejobDescModel := batchimagejobFields[5].Descriptor()
+ // batchimagejob.ModelValidator is a validator for the "model" field. It is called by the builders before save.
+ batchimagejob.ModelValidator = batchimagejobDescModel.Validators[0].(func(string) error)
+ // batchimagejobDescTaskName is the schema descriptor for task_name field.
+ batchimagejobDescTaskName := batchimagejobFields[6].Descriptor()
+ // batchimagejob.DefaultTaskName holds the default value on creation for the task_name field.
+ batchimagejob.DefaultTaskName = batchimagejobDescTaskName.Default.(string)
+ // batchimagejob.TaskNameValidator is a validator for the "task_name" field. It is called by the builders before save.
+ batchimagejob.TaskNameValidator = batchimagejobDescTaskName.Validators[0].(func(string) error)
+ // batchimagejobDescStatus is the schema descriptor for status field.
+ batchimagejobDescStatus := batchimagejobFields[7].Descriptor()
+ // batchimagejob.DefaultStatus holds the default value on creation for the status field.
+ batchimagejob.DefaultStatus = batchimagejobDescStatus.Default.(string)
+ // batchimagejob.StatusValidator is a validator for the "status" field. It is called by the builders before save.
+ batchimagejob.StatusValidator = batchimagejobDescStatus.Validators[0].(func(string) error)
+ // batchimagejobDescProviderJobName is the schema descriptor for provider_job_name field.
+ batchimagejobDescProviderJobName := batchimagejobFields[8].Descriptor()
+ // batchimagejob.ProviderJobNameValidator is a validator for the "provider_job_name" field. It is called by the builders before save.
+ batchimagejob.ProviderJobNameValidator = batchimagejobDescProviderJobName.Validators[0].(func(string) error)
+ // batchimagejobDescProviderInputRef is the schema descriptor for provider_input_ref field.
+ batchimagejobDescProviderInputRef := batchimagejobFields[9].Descriptor()
+ // batchimagejob.ProviderInputRefValidator is a validator for the "provider_input_ref" field. It is called by the builders before save.
+ batchimagejob.ProviderInputRefValidator = batchimagejobDescProviderInputRef.Validators[0].(func(string) error)
+ // batchimagejobDescProviderOutputRef is the schema descriptor for provider_output_ref field.
+ batchimagejobDescProviderOutputRef := batchimagejobFields[10].Descriptor()
+ // batchimagejob.ProviderOutputRefValidator is a validator for the "provider_output_ref" field. It is called by the builders before save.
+ batchimagejob.ProviderOutputRefValidator = batchimagejobDescProviderOutputRef.Validators[0].(func(string) error)
+ // batchimagejobDescGcsInputURI is the schema descriptor for gcs_input_uri field.
+ batchimagejobDescGcsInputURI := batchimagejobFields[11].Descriptor()
+ // batchimagejob.GcsInputURIValidator is a validator for the "gcs_input_uri" field. It is called by the builders before save.
+ batchimagejob.GcsInputURIValidator = batchimagejobDescGcsInputURI.Validators[0].(func(string) error)
+ // batchimagejobDescGcsOutputURI is the schema descriptor for gcs_output_uri field.
+ batchimagejobDescGcsOutputURI := batchimagejobFields[12].Descriptor()
+ // batchimagejob.GcsOutputURIValidator is a validator for the "gcs_output_uri" field. It is called by the builders before save.
+ batchimagejob.GcsOutputURIValidator = batchimagejobDescGcsOutputURI.Validators[0].(func(string) error)
+ // batchimagejobDescSuccessCount is the schema descriptor for success_count field.
+ batchimagejobDescSuccessCount := batchimagejobFields[14].Descriptor()
+ // batchimagejob.DefaultSuccessCount holds the default value on creation for the success_count field.
+ batchimagejob.DefaultSuccessCount = batchimagejobDescSuccessCount.Default.(int)
+ // batchimagejobDescFailCount is the schema descriptor for fail_count field.
+ batchimagejobDescFailCount := batchimagejobFields[15].Descriptor()
+ // batchimagejob.DefaultFailCount holds the default value on creation for the fail_count field.
+ batchimagejob.DefaultFailCount = batchimagejobDescFailCount.Default.(int)
+ // batchimagejobDescCancelledCount is the schema descriptor for cancelled_count field.
+ batchimagejobDescCancelledCount := batchimagejobFields[16].Descriptor()
+ // batchimagejob.DefaultCancelledCount holds the default value on creation for the cancelled_count field.
+ batchimagejob.DefaultCancelledCount = batchimagejobDescCancelledCount.Default.(int)
+ // batchimagejobDescEstimatedCost is the schema descriptor for estimated_cost field.
+ batchimagejobDescEstimatedCost := batchimagejobFields[17].Descriptor()
+ // batchimagejob.DefaultEstimatedCost holds the default value on creation for the estimated_cost field.
+ batchimagejob.DefaultEstimatedCost = batchimagejobDescEstimatedCost.Default.(float64)
+ // batchimagejobDescCurrency is the schema descriptor for currency field.
+ batchimagejobDescCurrency := batchimagejobFields[20].Descriptor()
+ // batchimagejob.DefaultCurrency holds the default value on creation for the currency field.
+ batchimagejob.DefaultCurrency = batchimagejobDescCurrency.Default.(string)
+ // batchimagejob.CurrencyValidator is a validator for the "currency" field. It is called by the builders before save.
+ batchimagejob.CurrencyValidator = batchimagejobDescCurrency.Validators[0].(func(string) error)
+ // batchimagejobDescHoldID is the schema descriptor for hold_id field.
+ batchimagejobDescHoldID := batchimagejobFields[21].Descriptor()
+ // batchimagejob.HoldIDValidator is a validator for the "hold_id" field. It is called by the builders before save.
+ batchimagejob.HoldIDValidator = batchimagejobDescHoldID.Validators[0].(func(string) error)
+ // batchimagejobDescIdempotencyKey is the schema descriptor for idempotency_key field.
+ batchimagejobDescIdempotencyKey := batchimagejobFields[22].Descriptor()
+ // batchimagejob.IdempotencyKeyValidator is a validator for the "idempotency_key" field. It is called by the builders before save.
+ batchimagejob.IdempotencyKeyValidator = batchimagejobDescIdempotencyKey.Validators[0].(func(string) error)
+ // batchimagejobDescRequestHash is the schema descriptor for request_hash field.
+ batchimagejobDescRequestHash := batchimagejobFields[23].Descriptor()
+ // batchimagejob.RequestHashValidator is a validator for the "request_hash" field. It is called by the builders before save.
+ batchimagejob.RequestHashValidator = batchimagejobDescRequestHash.Validators[0].(func(string) error)
+ // batchimagejobDescManifestHash is the schema descriptor for manifest_hash field.
+ batchimagejobDescManifestHash := batchimagejobFields[24].Descriptor()
+ // batchimagejob.ManifestHashValidator is a validator for the "manifest_hash" field. It is called by the builders before save.
+ batchimagejob.ManifestHashValidator = batchimagejobDescManifestHash.Validators[0].(func(string) error)
+ // batchimagejobDescRetryCount is the schema descriptor for retry_count field.
+ batchimagejobDescRetryCount := batchimagejobFields[25].Descriptor()
+ // batchimagejob.DefaultRetryCount holds the default value on creation for the retry_count field.
+ batchimagejob.DefaultRetryCount = batchimagejobDescRetryCount.Default.(int)
+ // batchimagejobDescVersion is the schema descriptor for version field.
+ batchimagejobDescVersion := batchimagejobFields[26].Descriptor()
+ // batchimagejob.DefaultVersion holds the default value on creation for the version field.
+ batchimagejob.DefaultVersion = batchimagejobDescVersion.Default.(int)
+ // batchimagejobDescLastErrorCode is the schema descriptor for last_error_code field.
+ batchimagejobDescLastErrorCode := batchimagejobFields[32].Descriptor()
+ // batchimagejob.LastErrorCodeValidator is a validator for the "last_error_code" field. It is called by the builders before save.
+ batchimagejob.LastErrorCodeValidator = batchimagejobDescLastErrorCode.Validators[0].(func(string) error)
+ // batchimagejobDescCreatedAt is the schema descriptor for created_at field.
+ batchimagejobDescCreatedAt := batchimagejobFields[34].Descriptor()
+ // batchimagejob.DefaultCreatedAt holds the default value on creation for the created_at field.
+ batchimagejob.DefaultCreatedAt = batchimagejobDescCreatedAt.Default.(func() time.Time)
+ // batchimagejobDescUpdatedAt is the schema descriptor for updated_at field.
+ batchimagejobDescUpdatedAt := batchimagejobFields[35].Descriptor()
+ // batchimagejob.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+ batchimagejob.DefaultUpdatedAt = batchimagejobDescUpdatedAt.Default.(func() time.Time)
+ // batchimagejob.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+ batchimagejob.UpdateDefaultUpdatedAt = batchimagejobDescUpdatedAt.UpdateDefault.(func() time.Time)
channelmonitorMixin := schema.ChannelMonitor{}.Mixin()
channelmonitorMixinFields0 := channelmonitorMixin[0].Fields()
_ = channelmonitorMixinFields0
@@ -846,62 +1015,82 @@ func init() {
groupDescAllowImageGeneration := groupFields[15].Descriptor()
// group.DefaultAllowImageGeneration holds the default value on creation for the allow_image_generation field.
group.DefaultAllowImageGeneration = groupDescAllowImageGeneration.Default.(bool)
+ // groupDescAllowBatchImageGeneration is the schema descriptor for allow_batch_image_generation field.
+ groupDescAllowBatchImageGeneration := groupFields[16].Descriptor()
+ // group.DefaultAllowBatchImageGeneration holds the default value on creation for the allow_batch_image_generation field.
+ group.DefaultAllowBatchImageGeneration = groupDescAllowBatchImageGeneration.Default.(bool)
// groupDescImageRateIndependent is the schema descriptor for image_rate_independent field.
- groupDescImageRateIndependent := groupFields[16].Descriptor()
+ groupDescImageRateIndependent := groupFields[17].Descriptor()
// group.DefaultImageRateIndependent holds the default value on creation for the image_rate_independent field.
group.DefaultImageRateIndependent = groupDescImageRateIndependent.Default.(bool)
// groupDescImageRateMultiplier is the schema descriptor for image_rate_multiplier field.
- groupDescImageRateMultiplier := groupFields[17].Descriptor()
+ groupDescImageRateMultiplier := groupFields[18].Descriptor()
// group.DefaultImageRateMultiplier holds the default value on creation for the image_rate_multiplier field.
group.DefaultImageRateMultiplier = groupDescImageRateMultiplier.Default.(float64)
+ // groupDescBatchImageDiscountMultiplier is the schema descriptor for batch_image_discount_multiplier field.
+ groupDescBatchImageDiscountMultiplier := groupFields[22].Descriptor()
+ // group.DefaultBatchImageDiscountMultiplier holds the default value on creation for the batch_image_discount_multiplier field.
+ group.DefaultBatchImageDiscountMultiplier = groupDescBatchImageDiscountMultiplier.Default.(float64)
+ // groupDescBatchImageHoldMultiplier is the schema descriptor for batch_image_hold_multiplier field.
+ groupDescBatchImageHoldMultiplier := groupFields[23].Descriptor()
+ // group.DefaultBatchImageHoldMultiplier holds the default value on creation for the batch_image_hold_multiplier field.
+ group.DefaultBatchImageHoldMultiplier = groupDescBatchImageHoldMultiplier.Default.(float64)
+ // groupDescVideoRateIndependent is the schema descriptor for video_rate_independent field.
+ groupDescVideoRateIndependent := groupFields[24].Descriptor()
+ // group.DefaultVideoRateIndependent holds the default value on creation for the video_rate_independent field.
+ group.DefaultVideoRateIndependent = groupDescVideoRateIndependent.Default.(bool)
+ // groupDescVideoRateMultiplier is the schema descriptor for video_rate_multiplier field.
+ groupDescVideoRateMultiplier := groupFields[25].Descriptor()
+ // group.DefaultVideoRateMultiplier holds the default value on creation for the video_rate_multiplier field.
+ group.DefaultVideoRateMultiplier = groupDescVideoRateMultiplier.Default.(float64)
// groupDescClaudeCodeOnly is the schema descriptor for claude_code_only field.
- groupDescClaudeCodeOnly := groupFields[21].Descriptor()
+ groupDescClaudeCodeOnly := groupFields[29].Descriptor()
// group.DefaultClaudeCodeOnly holds the default value on creation for the claude_code_only field.
group.DefaultClaudeCodeOnly = groupDescClaudeCodeOnly.Default.(bool)
// groupDescModelRoutingEnabled is the schema descriptor for model_routing_enabled field.
- groupDescModelRoutingEnabled := groupFields[25].Descriptor()
+ groupDescModelRoutingEnabled := groupFields[33].Descriptor()
// group.DefaultModelRoutingEnabled holds the default value on creation for the model_routing_enabled field.
group.DefaultModelRoutingEnabled = groupDescModelRoutingEnabled.Default.(bool)
// groupDescMcpXMLInject is the schema descriptor for mcp_xml_inject field.
- groupDescMcpXMLInject := groupFields[26].Descriptor()
+ groupDescMcpXMLInject := groupFields[34].Descriptor()
// group.DefaultMcpXMLInject holds the default value on creation for the mcp_xml_inject field.
group.DefaultMcpXMLInject = groupDescMcpXMLInject.Default.(bool)
// groupDescSupportedModelScopes is the schema descriptor for supported_model_scopes field.
- groupDescSupportedModelScopes := groupFields[27].Descriptor()
+ groupDescSupportedModelScopes := groupFields[35].Descriptor()
// group.DefaultSupportedModelScopes holds the default value on creation for the supported_model_scopes field.
group.DefaultSupportedModelScopes = groupDescSupportedModelScopes.Default.([]string)
// groupDescSortOrder is the schema descriptor for sort_order field.
- groupDescSortOrder := groupFields[28].Descriptor()
+ groupDescSortOrder := groupFields[36].Descriptor()
// group.DefaultSortOrder holds the default value on creation for the sort_order field.
group.DefaultSortOrder = groupDescSortOrder.Default.(int)
// groupDescAllowMessagesDispatch is the schema descriptor for allow_messages_dispatch field.
- groupDescAllowMessagesDispatch := groupFields[29].Descriptor()
+ groupDescAllowMessagesDispatch := groupFields[37].Descriptor()
// group.DefaultAllowMessagesDispatch holds the default value on creation for the allow_messages_dispatch field.
group.DefaultAllowMessagesDispatch = groupDescAllowMessagesDispatch.Default.(bool)
// groupDescRequireOauthOnly is the schema descriptor for require_oauth_only field.
- groupDescRequireOauthOnly := groupFields[30].Descriptor()
+ groupDescRequireOauthOnly := groupFields[38].Descriptor()
// group.DefaultRequireOauthOnly holds the default value on creation for the require_oauth_only field.
group.DefaultRequireOauthOnly = groupDescRequireOauthOnly.Default.(bool)
// groupDescRequirePrivacySet is the schema descriptor for require_privacy_set field.
- groupDescRequirePrivacySet := groupFields[31].Descriptor()
+ groupDescRequirePrivacySet := groupFields[39].Descriptor()
// group.DefaultRequirePrivacySet holds the default value on creation for the require_privacy_set field.
group.DefaultRequirePrivacySet = groupDescRequirePrivacySet.Default.(bool)
// groupDescDefaultMappedModel is the schema descriptor for default_mapped_model field.
- groupDescDefaultMappedModel := groupFields[32].Descriptor()
+ groupDescDefaultMappedModel := groupFields[40].Descriptor()
// group.DefaultDefaultMappedModel holds the default value on creation for the default_mapped_model field.
group.DefaultDefaultMappedModel = groupDescDefaultMappedModel.Default.(string)
// group.DefaultMappedModelValidator is a validator for the "default_mapped_model" field. It is called by the builders before save.
group.DefaultMappedModelValidator = groupDescDefaultMappedModel.Validators[0].(func(string) error)
// groupDescMessagesDispatchModelConfig is the schema descriptor for messages_dispatch_model_config field.
- groupDescMessagesDispatchModelConfig := groupFields[33].Descriptor()
+ groupDescMessagesDispatchModelConfig := groupFields[41].Descriptor()
// group.DefaultMessagesDispatchModelConfig holds the default value on creation for the messages_dispatch_model_config field.
group.DefaultMessagesDispatchModelConfig = groupDescMessagesDispatchModelConfig.Default.(domain.OpenAIMessagesDispatchModelConfig)
// groupDescModelsListConfig is the schema descriptor for models_list_config field.
- groupDescModelsListConfig := groupFields[34].Descriptor()
+ groupDescModelsListConfig := groupFields[42].Descriptor()
// group.DefaultModelsListConfig holds the default value on creation for the models_list_config field.
group.DefaultModelsListConfig = groupDescModelsListConfig.Default.(domain.GroupModelsListConfig)
// groupDescRpmLimit is the schema descriptor for rpm_limit field.
- groupDescRpmLimit := groupFields[35].Descriptor()
+ groupDescRpmLimit := groupFields[43].Descriptor()
// group.DefaultRpmLimit holds the default value on creation for the rpm_limit field.
group.DefaultRpmLimit = groupDescRpmLimit.Default.(int)
idempotencyrecordMixin := schema.IdempotencyRecord{}.Mixin()
@@ -1787,12 +1976,20 @@ func init() {
usagelogDescImageSizeSource := usagelogFields[37].Descriptor()
// usagelog.ImageSizeSourceValidator is a validator for the "image_size_source" field. It is called by the builders before save.
usagelog.ImageSizeSourceValidator = usagelogDescImageSizeSource.Validators[0].(func(string) error)
+ // usagelogDescVideoCount is the schema descriptor for video_count field.
+ usagelogDescVideoCount := usagelogFields[39].Descriptor()
+ // usagelog.DefaultVideoCount holds the default value on creation for the video_count field.
+ usagelog.DefaultVideoCount = usagelogDescVideoCount.Default.(int)
+ // usagelogDescVideoResolution is the schema descriptor for video_resolution field.
+ usagelogDescVideoResolution := usagelogFields[40].Descriptor()
+ // usagelog.VideoResolutionValidator is a validator for the "video_resolution" field. It is called by the builders before save.
+ usagelog.VideoResolutionValidator = usagelogDescVideoResolution.Validators[0].(func(string) error)
// usagelogDescCacheTTLOverridden is the schema descriptor for cache_ttl_overridden field.
- usagelogDescCacheTTLOverridden := usagelogFields[39].Descriptor()
+ usagelogDescCacheTTLOverridden := usagelogFields[42].Descriptor()
// usagelog.DefaultCacheTTLOverridden holds the default value on creation for the cache_ttl_overridden field.
usagelog.DefaultCacheTTLOverridden = usagelogDescCacheTTLOverridden.Default.(bool)
// usagelogDescCreatedAt is the schema descriptor for created_at field.
- usagelogDescCreatedAt := usagelogFields[40].Descriptor()
+ usagelogDescCreatedAt := usagelogFields[43].Descriptor()
// usagelog.DefaultCreatedAt holds the default value on creation for the created_at field.
usagelog.DefaultCreatedAt = usagelogDescCreatedAt.Default.(func() time.Time)
userMixin := schema.User{}.Mixin()
@@ -1860,54 +2057,58 @@ func init() {
userDescBalance := userFields[3].Descriptor()
// user.DefaultBalance holds the default value on creation for the balance field.
user.DefaultBalance = userDescBalance.Default.(float64)
+ // userDescFrozenBalance is the schema descriptor for frozen_balance field.
+ userDescFrozenBalance := userFields[4].Descriptor()
+ // user.DefaultFrozenBalance holds the default value on creation for the frozen_balance field.
+ user.DefaultFrozenBalance = userDescFrozenBalance.Default.(float64)
// userDescConcurrency is the schema descriptor for concurrency field.
- userDescConcurrency := userFields[4].Descriptor()
+ userDescConcurrency := userFields[5].Descriptor()
// user.DefaultConcurrency holds the default value on creation for the concurrency field.
user.DefaultConcurrency = userDescConcurrency.Default.(int)
// userDescStatus is the schema descriptor for status field.
- userDescStatus := userFields[5].Descriptor()
+ userDescStatus := userFields[6].Descriptor()
// user.DefaultStatus holds the default value on creation for the status field.
user.DefaultStatus = userDescStatus.Default.(string)
// user.StatusValidator is a validator for the "status" field. It is called by the builders before save.
user.StatusValidator = userDescStatus.Validators[0].(func(string) error)
// userDescUsername is the schema descriptor for username field.
- userDescUsername := userFields[6].Descriptor()
+ userDescUsername := userFields[7].Descriptor()
// user.DefaultUsername holds the default value on creation for the username field.
user.DefaultUsername = userDescUsername.Default.(string)
// user.UsernameValidator is a validator for the "username" field. It is called by the builders before save.
user.UsernameValidator = userDescUsername.Validators[0].(func(string) error)
// userDescNotes is the schema descriptor for notes field.
- userDescNotes := userFields[7].Descriptor()
+ userDescNotes := userFields[8].Descriptor()
// user.DefaultNotes holds the default value on creation for the notes field.
user.DefaultNotes = userDescNotes.Default.(string)
// userDescTotpEnabled is the schema descriptor for totp_enabled field.
- userDescTotpEnabled := userFields[9].Descriptor()
+ userDescTotpEnabled := userFields[10].Descriptor()
// user.DefaultTotpEnabled holds the default value on creation for the totp_enabled field.
user.DefaultTotpEnabled = userDescTotpEnabled.Default.(bool)
// userDescSignupSource is the schema descriptor for signup_source field.
- userDescSignupSource := userFields[11].Descriptor()
+ userDescSignupSource := userFields[12].Descriptor()
// user.DefaultSignupSource holds the default value on creation for the signup_source field.
user.DefaultSignupSource = userDescSignupSource.Default.(string)
// user.SignupSourceValidator is a validator for the "signup_source" field. It is called by the builders before save.
user.SignupSourceValidator = userDescSignupSource.Validators[0].(func(string) error)
// userDescBalanceNotifyEnabled is the schema descriptor for balance_notify_enabled field.
- userDescBalanceNotifyEnabled := userFields[14].Descriptor()
+ userDescBalanceNotifyEnabled := userFields[15].Descriptor()
// user.DefaultBalanceNotifyEnabled holds the default value on creation for the balance_notify_enabled field.
user.DefaultBalanceNotifyEnabled = userDescBalanceNotifyEnabled.Default.(bool)
// userDescBalanceNotifyThresholdType is the schema descriptor for balance_notify_threshold_type field.
- userDescBalanceNotifyThresholdType := userFields[15].Descriptor()
+ userDescBalanceNotifyThresholdType := userFields[16].Descriptor()
// user.DefaultBalanceNotifyThresholdType holds the default value on creation for the balance_notify_threshold_type field.
user.DefaultBalanceNotifyThresholdType = userDescBalanceNotifyThresholdType.Default.(string)
// userDescBalanceNotifyExtraEmails is the schema descriptor for balance_notify_extra_emails field.
- userDescBalanceNotifyExtraEmails := userFields[17].Descriptor()
+ userDescBalanceNotifyExtraEmails := userFields[18].Descriptor()
// user.DefaultBalanceNotifyExtraEmails holds the default value on creation for the balance_notify_extra_emails field.
user.DefaultBalanceNotifyExtraEmails = userDescBalanceNotifyExtraEmails.Default.(string)
// userDescTotalRecharged is the schema descriptor for total_recharged field.
- userDescTotalRecharged := userFields[18].Descriptor()
+ userDescTotalRecharged := userFields[19].Descriptor()
// user.DefaultTotalRecharged holds the default value on creation for the total_recharged field.
user.DefaultTotalRecharged = userDescTotalRecharged.Default.(float64)
// userDescRpmLimit is the schema descriptor for rpm_limit field.
- userDescRpmLimit := userFields[19].Descriptor()
+ userDescRpmLimit := userFields[20].Descriptor()
// user.DefaultRpmLimit holds the default value on creation for the rpm_limit field.
user.DefaultRpmLimit = userDescRpmLimit.Default.(int)
userallowedgroupFields := schema.UserAllowedGroup{}.Fields()
diff --git a/backend/ent/schema/batch_image_event.go b/backend/ent/schema/batch_image_event.go
new file mode 100644
index 0000000000..44af3d1620
--- /dev/null
+++ b/backend/ent/schema/batch_image_event.go
@@ -0,0 +1,43 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/entsql"
+ "entgo.io/ent/schema"
+ "entgo.io/ent/schema/field"
+ "entgo.io/ent/schema/index"
+)
+
+// BatchImageEvent records append-only operational events for batch image jobs.
+type BatchImageEvent struct {
+ ent.Schema
+}
+
+func (BatchImageEvent) Annotations() []schema.Annotation {
+ return []schema.Annotation{
+ entsql.Annotation{Table: "batch_image_events"},
+ }
+}
+
+func (BatchImageEvent) Fields() []ent.Field {
+ return []ent.Field{
+ field.String("job_id").MaxLen(64),
+ field.String("event_type").MaxLen(64),
+ field.JSON("payload", map[string]any{}).
+ Optional().
+ SchemaType(map[string]string{dialect.Postgres: "jsonb"}),
+ field.String("event_hash").Optional().Nillable().MaxLen(128),
+ field.Time("created_at").Immutable().Default(time.Now).SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ }
+}
+
+func (BatchImageEvent) Indexes() []ent.Index {
+ return []ent.Index{
+ index.Fields("job_id", "created_at"),
+ index.Fields("event_type"),
+ index.Fields("job_id", "event_hash").Unique().Annotations(entsql.IndexWhere("event_hash IS NOT NULL AND event_hash <> ''")),
+ }
+}
diff --git a/backend/ent/schema/batch_image_item.go b/backend/ent/schema/batch_image_item.go
new file mode 100644
index 0000000000..6a7a097c6a
--- /dev/null
+++ b/backend/ent/schema/batch_image_item.go
@@ -0,0 +1,53 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/entsql"
+ "entgo.io/ent/schema"
+ "entgo.io/ent/schema/field"
+ "entgo.io/ent/schema/index"
+)
+
+// BatchImageItem holds indexed output rows for a batch image job.
+type BatchImageItem struct {
+ ent.Schema
+}
+
+func (BatchImageItem) Annotations() []schema.Annotation {
+ return []schema.Annotation{
+ entsql.Annotation{Table: "batch_image_items"},
+ }
+}
+
+func (BatchImageItem) Fields() []ent.Field {
+ return []ent.Field{
+ field.String("job_id").MaxLen(64),
+ field.String("custom_id").MaxLen(255),
+ field.String("status").MaxLen(32),
+ field.String("request_hash").Optional().Nillable().MaxLen(128),
+ field.String("prompt_preview").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "text"}),
+ field.String("provider_source_object").Optional().Nillable().MaxLen(1024),
+ field.Int("source_line_number").Optional().Nillable(),
+ field.Int64("source_byte_offset").Optional().Nillable(),
+ field.Int64("source_byte_length").Optional().Nillable(),
+ field.String("mime_type").Optional().Nillable().MaxLen(128),
+ field.String("file_extension").Optional().Nillable().MaxLen(32),
+ field.Int("image_count").Default(0),
+ field.String("error_code").Optional().Nillable().MaxLen(128),
+ field.String("error_message").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "text"}),
+ field.Float("billed_amount").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "decimal(20,10)"}),
+ field.Time("created_at").Immutable().Default(time.Now).SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("indexed_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ }
+}
+
+func (BatchImageItem) Indexes() []ent.Index {
+ return []ent.Index{
+ index.Fields("job_id", "custom_id").Unique(),
+ index.Fields("job_id", "status"),
+ index.Fields("provider_source_object"),
+ }
+}
diff --git a/backend/ent/schema/batch_image_job.go b/backend/ent/schema/batch_image_job.go
new file mode 100644
index 0000000000..a65156eaea
--- /dev/null
+++ b/backend/ent/schema/batch_image_job.go
@@ -0,0 +1,86 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect"
+ "entgo.io/ent/dialect/entsql"
+ "entgo.io/ent/schema"
+ "entgo.io/ent/schema/field"
+ "entgo.io/ent/schema/index"
+)
+
+// BatchImageJob holds the schema definition for asynchronous image batch jobs.
+//
+// 删除策略:账务源保留
+// 这张表是批量生图任务的账务和状态源;用户侧删除仅通过 user_deleted_at
+// 从列表隐藏,输出清理通过 output_deleted 状态和删除时间字段表达。
+type BatchImageJob struct {
+ ent.Schema
+}
+
+func (BatchImageJob) Annotations() []schema.Annotation {
+ return []schema.Annotation{
+ entsql.Annotation{Table: "batch_image_jobs"},
+ }
+}
+
+func (BatchImageJob) Fields() []ent.Field {
+ return []ent.Field{
+ field.String("batch_id").MaxLen(64).Immutable(),
+ field.Int64("user_id"),
+ field.Int64("api_key_id").Optional().Nillable(),
+ field.Int64("account_id").Optional().Nillable(),
+ field.String("provider").MaxLen(32),
+ field.String("model").MaxLen(128),
+ field.String("task_name").MaxLen(255).Default(""),
+ field.String("status").MaxLen(32).Default("created"),
+ field.String("provider_job_name").Optional().Nillable().MaxLen(512),
+ field.String("provider_input_ref").Optional().Nillable().MaxLen(1024),
+ field.String("provider_output_ref").Optional().Nillable().MaxLen(1024),
+ field.String("gcs_input_uri").Optional().Nillable().MaxLen(1024),
+ field.String("gcs_output_uri").Optional().Nillable().MaxLen(1024),
+ field.Int("item_count"),
+ field.Int("success_count").Default(0),
+ field.Int("fail_count").Default(0),
+ field.Int("cancelled_count").Default(0),
+ field.Float("estimated_cost").SchemaType(map[string]string{dialect.Postgres: "decimal(20,10)"}).Default(0),
+ field.Float("hold_amount").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "decimal(20,10)"}),
+ field.Float("actual_cost").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "decimal(20,10)"}),
+ field.String("currency").MaxLen(16).Default("USD"),
+ field.String("hold_id").Optional().Nillable().MaxLen(128),
+ field.String("idempotency_key").Optional().Nillable().MaxLen(255),
+ field.String("request_hash").Optional().Nillable().MaxLen(128),
+ field.String("manifest_hash").Optional().Nillable().MaxLen(128),
+ field.Int("retry_count").Default(0),
+ field.Int("version").Default(0),
+ field.Time("output_expires_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("input_deleted_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("output_deleted_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("downloaded_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("user_deleted_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.String("last_error_code").Optional().Nillable().MaxLen(128),
+ field.String("last_error_message").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "text"}),
+ field.Time("created_at").Immutable().Default(time.Now).SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now).SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("submitted_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("started_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("finished_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ field.Time("settled_at").Optional().Nillable().SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
+ }
+}
+
+func (BatchImageJob) Indexes() []ent.Index {
+ return []ent.Index{
+ index.Fields("batch_id").Unique(),
+ index.Fields("user_id", "created_at"),
+ index.Fields("status"),
+ index.Fields("provider", "status"),
+ index.Fields("idempotency_key").Annotations(entsql.IndexWhere("idempotency_key IS NOT NULL AND idempotency_key <> ''")),
+ index.Fields("manifest_hash").Unique().Annotations(entsql.IndexWhere("manifest_hash IS NOT NULL AND manifest_hash <> ''")),
+ index.Fields("output_expires_at"),
+ index.Fields("downloaded_at"),
+ index.Fields("user_deleted_at"),
+ }
+}
diff --git a/backend/ent/schema/group.go b/backend/ent/schema/group.go
index 2b8420db6d..b104609a1b 100644
--- a/backend/ent/schema/group.go
+++ b/backend/ent/schema/group.go
@@ -93,6 +93,9 @@ func (Group) Fields() []ent.Field {
field.Bool("allow_image_generation").
Default(false).
Comment("是否允许该分组使用图片生成能力"),
+ field.Bool("allow_batch_image_generation").
+ Default(false).
+ Comment("是否允许该分组使用批量图片生成能力"),
field.Bool("image_rate_independent").
Default(false).
Comment("图片生成是否使用独立倍率;false 表示共享分组有效倍率"),
@@ -112,6 +115,33 @@ func (Group) Fields() []ent.Field {
Optional().
Nillable().
SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}),
+ field.Float("batch_image_discount_multiplier").
+ SchemaType(map[string]string{dialect.Postgres: "decimal(10,4)"}).
+ Default(0.5).
+ Comment("批量图片生成折扣倍率,最终单价会乘以该值;0 表示免费"),
+ field.Float("batch_image_hold_multiplier").
+ SchemaType(map[string]string{dialect.Postgres: "decimal(10,4)"}).
+ Default(0.6).
+ Comment("批量图片生成冻结价格比例,按普通生图原价乘以该比例冻结,结算后释放差额"),
+ field.Bool("video_rate_independent").
+ Default(false).
+ Comment("视频生成是否使用独立倍率;false 表示共享分组有效倍率"),
+ field.Float("video_rate_multiplier").
+ SchemaType(map[string]string{dialect.Postgres: "decimal(10,4)"}).
+ Default(1.0).
+ Comment("视频生成独立倍率,仅 video_rate_independent=true 时生效"),
+ field.Float("video_price_480p").
+ Optional().
+ Nillable().
+ SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}),
+ field.Float("video_price_720p").
+ Optional().
+ Nillable().
+ SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}),
+ field.Float("video_price_1080p").
+ Optional().
+ Nillable().
+ SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}),
// Claude Code 客户端限制 (added by migration 029)
field.Bool("claude_code_only").
diff --git a/backend/ent/schema/usage_log.go b/backend/ent/schema/usage_log.go
index db9e517892..e84cc1c140 100644
--- a/backend/ent/schema/usage_log.go
+++ b/backend/ent/schema/usage_log.go
@@ -149,6 +149,20 @@ func (UsageLog) Fields() []ent.Field {
field.JSON("image_size_breakdown", map[string]int{}).
Optional().
SchemaType(map[string]string{dialect.Postgres: "jsonb"}),
+
+ // 视频生成字段(Grok 视频按秒计费;billing_mode 走 token/其他模式时这些列仍标记视频用量)
+ field.Int("video_count").
+ Default(0).
+ Comment("视频生成数量;>0 表示本行是视频生成用量"),
+ field.String("video_resolution").
+ MaxLen(10).
+ Optional().
+ Nillable().
+ Comment("计费用视频分辨率 480p/720p/1080p"),
+ field.Int("video_duration_seconds").
+ Optional().
+ Nillable().
+ Comment("提交时请求的视频时长(秒),按秒计费的乘数"),
// Cache TTL Override 标记(管理员强制替换了缓存 TTL 计费)
field.Bool("cache_ttl_overridden").
Default(false),
diff --git a/backend/ent/schema/user.go b/backend/ent/schema/user.go
index 127b5af9a7..baa7efbbd9 100644
--- a/backend/ent/schema/user.go
+++ b/backend/ent/schema/user.go
@@ -49,6 +49,9 @@ func (User) Fields() []ent.Field {
field.Float("balance").
SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}).
Default(0),
+ field.Float("frozen_balance").
+ SchemaType(map[string]string{dialect.Postgres: "decimal(20,8)"}).
+ Default(0),
field.Int("concurrency").
Default(5),
field.String("status").
diff --git a/backend/ent/tx.go b/backend/ent/tx.go
index 846cfcd4da..6de2c2b63b 100644
--- a/backend/ent/tx.go
+++ b/backend/ent/tx.go
@@ -28,6 +28,12 @@ type Tx struct {
AuthIdentity *AuthIdentityClient
// AuthIdentityChannel is the client for interacting with the AuthIdentityChannel builders.
AuthIdentityChannel *AuthIdentityChannelClient
+ // BatchImageEvent is the client for interacting with the BatchImageEvent builders.
+ BatchImageEvent *BatchImageEventClient
+ // BatchImageItem is the client for interacting with the BatchImageItem builders.
+ BatchImageItem *BatchImageItemClient
+ // BatchImageJob is the client for interacting with the BatchImageJob builders.
+ BatchImageJob *BatchImageJobClient
// ChannelMonitor is the client for interacting with the ChannelMonitor builders.
ChannelMonitor *ChannelMonitorClient
// ChannelMonitorDailyRollup is the client for interacting with the ChannelMonitorDailyRollup builders.
@@ -222,6 +228,9 @@ func (tx *Tx) init() {
tx.AnnouncementRead = NewAnnouncementReadClient(tx.config)
tx.AuthIdentity = NewAuthIdentityClient(tx.config)
tx.AuthIdentityChannel = NewAuthIdentityChannelClient(tx.config)
+ tx.BatchImageEvent = NewBatchImageEventClient(tx.config)
+ tx.BatchImageItem = NewBatchImageItemClient(tx.config)
+ tx.BatchImageJob = NewBatchImageJobClient(tx.config)
tx.ChannelMonitor = NewChannelMonitorClient(tx.config)
tx.ChannelMonitorDailyRollup = NewChannelMonitorDailyRollupClient(tx.config)
tx.ChannelMonitorHistory = NewChannelMonitorHistoryClient(tx.config)
diff --git a/backend/ent/usagelog.go b/backend/ent/usagelog.go
index 283fe828a9..4d374a8495 100644
--- a/backend/ent/usagelog.go
+++ b/backend/ent/usagelog.go
@@ -101,6 +101,12 @@ type UsageLog struct {
ImageSizeSource *string `json:"image_size_source,omitempty"`
// ImageSizeBreakdown holds the value of the "image_size_breakdown" field.
ImageSizeBreakdown map[string]int `json:"image_size_breakdown,omitempty"`
+ // 视频生成数量;>0 表示本行是视频生成用量
+ VideoCount int `json:"video_count,omitempty"`
+ // 计费用视频分辨率 480p/720p/1080p
+ VideoResolution *string `json:"video_resolution,omitempty"`
+ // 提交时请求的视频时长(秒),按秒计费的乘数
+ VideoDurationSeconds *int `json:"video_duration_seconds,omitempty"`
// CacheTTLOverridden holds the value of the "cache_ttl_overridden" field.
CacheTTLOverridden bool `json:"cache_ttl_overridden,omitempty"`
// CreatedAt holds the value of the "created_at" field.
@@ -194,9 +200,9 @@ func (*UsageLog) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullBool)
case usagelog.FieldInputCost, usagelog.FieldOutputCost, usagelog.FieldCacheCreationCost, usagelog.FieldCacheReadCost, usagelog.FieldTotalCost, usagelog.FieldActualCost, usagelog.FieldRateMultiplier, usagelog.FieldAccountRateMultiplier:
values[i] = new(sql.NullFloat64)
- case usagelog.FieldID, usagelog.FieldUserID, usagelog.FieldAPIKeyID, usagelog.FieldAccountID, usagelog.FieldChannelID, usagelog.FieldGroupID, usagelog.FieldSubscriptionID, usagelog.FieldInputTokens, usagelog.FieldOutputTokens, usagelog.FieldCacheCreationTokens, usagelog.FieldCacheReadTokens, usagelog.FieldCacheCreation5mTokens, usagelog.FieldCacheCreation1hTokens, usagelog.FieldBillingType, usagelog.FieldDurationMs, usagelog.FieldFirstTokenMs, usagelog.FieldImageCount:
+ case usagelog.FieldID, usagelog.FieldUserID, usagelog.FieldAPIKeyID, usagelog.FieldAccountID, usagelog.FieldChannelID, usagelog.FieldGroupID, usagelog.FieldSubscriptionID, usagelog.FieldInputTokens, usagelog.FieldOutputTokens, usagelog.FieldCacheCreationTokens, usagelog.FieldCacheReadTokens, usagelog.FieldCacheCreation5mTokens, usagelog.FieldCacheCreation1hTokens, usagelog.FieldBillingType, usagelog.FieldDurationMs, usagelog.FieldFirstTokenMs, usagelog.FieldImageCount, usagelog.FieldVideoCount, usagelog.FieldVideoDurationSeconds:
values[i] = new(sql.NullInt64)
- case usagelog.FieldRequestID, usagelog.FieldModel, usagelog.FieldRequestedModel, usagelog.FieldUpstreamModel, usagelog.FieldModelMappingChain, usagelog.FieldBillingTier, usagelog.FieldBillingMode, usagelog.FieldUserAgent, usagelog.FieldIPAddress, usagelog.FieldImageSize, usagelog.FieldImageInputSize, usagelog.FieldImageOutputSize, usagelog.FieldImageSizeSource:
+ case usagelog.FieldRequestID, usagelog.FieldModel, usagelog.FieldRequestedModel, usagelog.FieldUpstreamModel, usagelog.FieldModelMappingChain, usagelog.FieldBillingTier, usagelog.FieldBillingMode, usagelog.FieldUserAgent, usagelog.FieldIPAddress, usagelog.FieldImageSize, usagelog.FieldImageInputSize, usagelog.FieldImageOutputSize, usagelog.FieldImageSizeSource, usagelog.FieldVideoResolution:
values[i] = new(sql.NullString)
case usagelog.FieldCreatedAt:
values[i] = new(sql.NullTime)
@@ -474,6 +480,26 @@ func (_m *UsageLog) assignValues(columns []string, values []any) error {
return fmt.Errorf("unmarshal field image_size_breakdown: %w", err)
}
}
+ case usagelog.FieldVideoCount:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field video_count", values[i])
+ } else if value.Valid {
+ _m.VideoCount = int(value.Int64)
+ }
+ case usagelog.FieldVideoResolution:
+ if value, ok := values[i].(*sql.NullString); !ok {
+ return fmt.Errorf("unexpected type %T for field video_resolution", values[i])
+ } else if value.Valid {
+ _m.VideoResolution = new(string)
+ *_m.VideoResolution = value.String
+ }
+ case usagelog.FieldVideoDurationSeconds:
+ if value, ok := values[i].(*sql.NullInt64); !ok {
+ return fmt.Errorf("unexpected type %T for field video_duration_seconds", values[i])
+ } else if value.Valid {
+ _m.VideoDurationSeconds = new(int)
+ *_m.VideoDurationSeconds = int(value.Int64)
+ }
case usagelog.FieldCacheTTLOverridden:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field cache_ttl_overridden", values[i])
@@ -698,6 +724,19 @@ func (_m *UsageLog) String() string {
builder.WriteString("image_size_breakdown=")
builder.WriteString(fmt.Sprintf("%v", _m.ImageSizeBreakdown))
builder.WriteString(", ")
+ builder.WriteString("video_count=")
+ builder.WriteString(fmt.Sprintf("%v", _m.VideoCount))
+ builder.WriteString(", ")
+ if v := _m.VideoResolution; v != nil {
+ builder.WriteString("video_resolution=")
+ builder.WriteString(*v)
+ }
+ builder.WriteString(", ")
+ if v := _m.VideoDurationSeconds; v != nil {
+ builder.WriteString("video_duration_seconds=")
+ builder.WriteString(fmt.Sprintf("%v", *v))
+ }
+ builder.WriteString(", ")
builder.WriteString("cache_ttl_overridden=")
builder.WriteString(fmt.Sprintf("%v", _m.CacheTTLOverridden))
builder.WriteString(", ")
diff --git a/backend/ent/usagelog/usagelog.go b/backend/ent/usagelog/usagelog.go
index 297e0b41ad..a74a92c40f 100644
--- a/backend/ent/usagelog/usagelog.go
+++ b/backend/ent/usagelog/usagelog.go
@@ -92,6 +92,12 @@ const (
FieldImageSizeSource = "image_size_source"
// FieldImageSizeBreakdown holds the string denoting the image_size_breakdown field in the database.
FieldImageSizeBreakdown = "image_size_breakdown"
+ // FieldVideoCount holds the string denoting the video_count field in the database.
+ FieldVideoCount = "video_count"
+ // FieldVideoResolution holds the string denoting the video_resolution field in the database.
+ FieldVideoResolution = "video_resolution"
+ // FieldVideoDurationSeconds holds the string denoting the video_duration_seconds field in the database.
+ FieldVideoDurationSeconds = "video_duration_seconds"
// FieldCacheTTLOverridden holds the string denoting the cache_ttl_overridden field in the database.
FieldCacheTTLOverridden = "cache_ttl_overridden"
// FieldCreatedAt holds the string denoting the created_at field in the database.
@@ -187,6 +193,9 @@ var Columns = []string{
FieldImageOutputSize,
FieldImageSizeSource,
FieldImageSizeBreakdown,
+ FieldVideoCount,
+ FieldVideoResolution,
+ FieldVideoDurationSeconds,
FieldCacheTTLOverridden,
FieldCreatedAt,
}
@@ -260,6 +269,10 @@ var (
ImageOutputSizeValidator func(string) error
// ImageSizeSourceValidator is a validator for the "image_size_source" field. It is called by the builders before save.
ImageSizeSourceValidator func(string) error
+ // DefaultVideoCount holds the default value on creation for the "video_count" field.
+ DefaultVideoCount int
+ // VideoResolutionValidator is a validator for the "video_resolution" field. It is called by the builders before save.
+ VideoResolutionValidator func(string) error
// DefaultCacheTTLOverridden holds the default value on creation for the "cache_ttl_overridden" field.
DefaultCacheTTLOverridden bool
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
@@ -464,6 +477,21 @@ func ByImageSizeSource(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldImageSizeSource, opts...).ToFunc()
}
+// ByVideoCount orders the results by the video_count field.
+func ByVideoCount(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoCount, opts...).ToFunc()
+}
+
+// ByVideoResolution orders the results by the video_resolution field.
+func ByVideoResolution(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoResolution, opts...).ToFunc()
+}
+
+// ByVideoDurationSeconds orders the results by the video_duration_seconds field.
+func ByVideoDurationSeconds(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldVideoDurationSeconds, opts...).ToFunc()
+}
+
// ByCacheTTLOverridden orders the results by the cache_ttl_overridden field.
func ByCacheTTLOverridden(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCacheTTLOverridden, opts...).ToFunc()
diff --git a/backend/ent/usagelog/where.go b/backend/ent/usagelog/where.go
index 2987f17930..4b08cc3425 100644
--- a/backend/ent/usagelog/where.go
+++ b/backend/ent/usagelog/where.go
@@ -245,6 +245,21 @@ func ImageSizeSource(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldImageSizeSource, v))
}
+// VideoCount applies equality check predicate on the "video_count" field. It's identical to VideoCountEQ.
+func VideoCount(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldEQ(FieldVideoCount, v))
+}
+
+// VideoResolution applies equality check predicate on the "video_resolution" field. It's identical to VideoResolutionEQ.
+func VideoResolution(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldEQ(FieldVideoResolution, v))
+}
+
+// VideoDurationSeconds applies equality check predicate on the "video_duration_seconds" field. It's identical to VideoDurationSecondsEQ.
+func VideoDurationSeconds(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldEQ(FieldVideoDurationSeconds, v))
+}
+
// CacheTTLOverridden applies equality check predicate on the "cache_ttl_overridden" field. It's identical to CacheTTLOverriddenEQ.
func CacheTTLOverridden(v bool) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheTTLOverridden, v))
@@ -2150,6 +2165,171 @@ func ImageSizeBreakdownNotNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotNull(FieldImageSizeBreakdown))
}
+// VideoCountEQ applies the EQ predicate on the "video_count" field.
+func VideoCountEQ(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldEQ(FieldVideoCount, v))
+}
+
+// VideoCountNEQ applies the NEQ predicate on the "video_count" field.
+func VideoCountNEQ(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNEQ(FieldVideoCount, v))
+}
+
+// VideoCountIn applies the In predicate on the "video_count" field.
+func VideoCountIn(vs ...int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldIn(FieldVideoCount, vs...))
+}
+
+// VideoCountNotIn applies the NotIn predicate on the "video_count" field.
+func VideoCountNotIn(vs ...int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNotIn(FieldVideoCount, vs...))
+}
+
+// VideoCountGT applies the GT predicate on the "video_count" field.
+func VideoCountGT(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldGT(FieldVideoCount, v))
+}
+
+// VideoCountGTE applies the GTE predicate on the "video_count" field.
+func VideoCountGTE(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldGTE(FieldVideoCount, v))
+}
+
+// VideoCountLT applies the LT predicate on the "video_count" field.
+func VideoCountLT(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldLT(FieldVideoCount, v))
+}
+
+// VideoCountLTE applies the LTE predicate on the "video_count" field.
+func VideoCountLTE(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldLTE(FieldVideoCount, v))
+}
+
+// VideoResolutionEQ applies the EQ predicate on the "video_resolution" field.
+func VideoResolutionEQ(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldEQ(FieldVideoResolution, v))
+}
+
+// VideoResolutionNEQ applies the NEQ predicate on the "video_resolution" field.
+func VideoResolutionNEQ(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNEQ(FieldVideoResolution, v))
+}
+
+// VideoResolutionIn applies the In predicate on the "video_resolution" field.
+func VideoResolutionIn(vs ...string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldIn(FieldVideoResolution, vs...))
+}
+
+// VideoResolutionNotIn applies the NotIn predicate on the "video_resolution" field.
+func VideoResolutionNotIn(vs ...string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNotIn(FieldVideoResolution, vs...))
+}
+
+// VideoResolutionGT applies the GT predicate on the "video_resolution" field.
+func VideoResolutionGT(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldGT(FieldVideoResolution, v))
+}
+
+// VideoResolutionGTE applies the GTE predicate on the "video_resolution" field.
+func VideoResolutionGTE(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldGTE(FieldVideoResolution, v))
+}
+
+// VideoResolutionLT applies the LT predicate on the "video_resolution" field.
+func VideoResolutionLT(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldLT(FieldVideoResolution, v))
+}
+
+// VideoResolutionLTE applies the LTE predicate on the "video_resolution" field.
+func VideoResolutionLTE(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldLTE(FieldVideoResolution, v))
+}
+
+// VideoResolutionContains applies the Contains predicate on the "video_resolution" field.
+func VideoResolutionContains(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldContains(FieldVideoResolution, v))
+}
+
+// VideoResolutionHasPrefix applies the HasPrefix predicate on the "video_resolution" field.
+func VideoResolutionHasPrefix(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldHasPrefix(FieldVideoResolution, v))
+}
+
+// VideoResolutionHasSuffix applies the HasSuffix predicate on the "video_resolution" field.
+func VideoResolutionHasSuffix(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldHasSuffix(FieldVideoResolution, v))
+}
+
+// VideoResolutionIsNil applies the IsNil predicate on the "video_resolution" field.
+func VideoResolutionIsNil() predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldIsNull(FieldVideoResolution))
+}
+
+// VideoResolutionNotNil applies the NotNil predicate on the "video_resolution" field.
+func VideoResolutionNotNil() predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNotNull(FieldVideoResolution))
+}
+
+// VideoResolutionEqualFold applies the EqualFold predicate on the "video_resolution" field.
+func VideoResolutionEqualFold(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldEqualFold(FieldVideoResolution, v))
+}
+
+// VideoResolutionContainsFold applies the ContainsFold predicate on the "video_resolution" field.
+func VideoResolutionContainsFold(v string) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldContainsFold(FieldVideoResolution, v))
+}
+
+// VideoDurationSecondsEQ applies the EQ predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsEQ(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldEQ(FieldVideoDurationSeconds, v))
+}
+
+// VideoDurationSecondsNEQ applies the NEQ predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsNEQ(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNEQ(FieldVideoDurationSeconds, v))
+}
+
+// VideoDurationSecondsIn applies the In predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsIn(vs ...int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldIn(FieldVideoDurationSeconds, vs...))
+}
+
+// VideoDurationSecondsNotIn applies the NotIn predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsNotIn(vs ...int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNotIn(FieldVideoDurationSeconds, vs...))
+}
+
+// VideoDurationSecondsGT applies the GT predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsGT(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldGT(FieldVideoDurationSeconds, v))
+}
+
+// VideoDurationSecondsGTE applies the GTE predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsGTE(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldGTE(FieldVideoDurationSeconds, v))
+}
+
+// VideoDurationSecondsLT applies the LT predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsLT(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldLT(FieldVideoDurationSeconds, v))
+}
+
+// VideoDurationSecondsLTE applies the LTE predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsLTE(v int) predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldLTE(FieldVideoDurationSeconds, v))
+}
+
+// VideoDurationSecondsIsNil applies the IsNil predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsIsNil() predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldIsNull(FieldVideoDurationSeconds))
+}
+
+// VideoDurationSecondsNotNil applies the NotNil predicate on the "video_duration_seconds" field.
+func VideoDurationSecondsNotNil() predicate.UsageLog {
+ return predicate.UsageLog(sql.FieldNotNull(FieldVideoDurationSeconds))
+}
+
// CacheTTLOverriddenEQ applies the EQ predicate on the "cache_ttl_overridden" field.
func CacheTTLOverriddenEQ(v bool) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheTTLOverridden, v))
diff --git a/backend/ent/usagelog_create.go b/backend/ent/usagelog_create.go
index 17e800f9ca..3326f72fc0 100644
--- a/backend/ent/usagelog_create.go
+++ b/backend/ent/usagelog_create.go
@@ -525,6 +525,48 @@ func (_c *UsageLogCreate) SetImageSizeBreakdown(v map[string]int) *UsageLogCreat
return _c
}
+// SetVideoCount sets the "video_count" field.
+func (_c *UsageLogCreate) SetVideoCount(v int) *UsageLogCreate {
+ _c.mutation.SetVideoCount(v)
+ return _c
+}
+
+// SetNillableVideoCount sets the "video_count" field if the given value is not nil.
+func (_c *UsageLogCreate) SetNillableVideoCount(v *int) *UsageLogCreate {
+ if v != nil {
+ _c.SetVideoCount(*v)
+ }
+ return _c
+}
+
+// SetVideoResolution sets the "video_resolution" field.
+func (_c *UsageLogCreate) SetVideoResolution(v string) *UsageLogCreate {
+ _c.mutation.SetVideoResolution(v)
+ return _c
+}
+
+// SetNillableVideoResolution sets the "video_resolution" field if the given value is not nil.
+func (_c *UsageLogCreate) SetNillableVideoResolution(v *string) *UsageLogCreate {
+ if v != nil {
+ _c.SetVideoResolution(*v)
+ }
+ return _c
+}
+
+// SetVideoDurationSeconds sets the "video_duration_seconds" field.
+func (_c *UsageLogCreate) SetVideoDurationSeconds(v int) *UsageLogCreate {
+ _c.mutation.SetVideoDurationSeconds(v)
+ return _c
+}
+
+// SetNillableVideoDurationSeconds sets the "video_duration_seconds" field if the given value is not nil.
+func (_c *UsageLogCreate) SetNillableVideoDurationSeconds(v *int) *UsageLogCreate {
+ if v != nil {
+ _c.SetVideoDurationSeconds(*v)
+ }
+ return _c
+}
+
// SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
func (_c *UsageLogCreate) SetCacheTTLOverridden(v bool) *UsageLogCreate {
_c.mutation.SetCacheTTLOverridden(v)
@@ -677,6 +719,10 @@ func (_c *UsageLogCreate) defaults() {
v := usagelog.DefaultImageCount
_c.mutation.SetImageCount(v)
}
+ if _, ok := _c.mutation.VideoCount(); !ok {
+ v := usagelog.DefaultVideoCount
+ _c.mutation.SetVideoCount(v)
+ }
if _, ok := _c.mutation.CacheTTLOverridden(); !ok {
v := usagelog.DefaultCacheTTLOverridden
_c.mutation.SetCacheTTLOverridden(v)
@@ -817,6 +863,14 @@ func (_c *UsageLogCreate) check() error {
return &ValidationError{Name: "image_size_source", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size_source": %w`, err)}
}
}
+ if _, ok := _c.mutation.VideoCount(); !ok {
+ return &ValidationError{Name: "video_count", err: errors.New(`ent: missing required field "UsageLog.video_count"`)}
+ }
+ if v, ok := _c.mutation.VideoResolution(); ok {
+ if err := usagelog.VideoResolutionValidator(v); err != nil {
+ return &ValidationError{Name: "video_resolution", err: fmt.Errorf(`ent: validator failed for field "UsageLog.video_resolution": %w`, err)}
+ }
+ }
if _, ok := _c.mutation.CacheTTLOverridden(); !ok {
return &ValidationError{Name: "cache_ttl_overridden", err: errors.New(`ent: missing required field "UsageLog.cache_ttl_overridden"`)}
}
@@ -995,6 +1049,18 @@ func (_c *UsageLogCreate) createSpec() (*UsageLog, *sqlgraph.CreateSpec) {
_spec.SetField(usagelog.FieldImageSizeBreakdown, field.TypeJSON, value)
_node.ImageSizeBreakdown = value
}
+ if value, ok := _c.mutation.VideoCount(); ok {
+ _spec.SetField(usagelog.FieldVideoCount, field.TypeInt, value)
+ _node.VideoCount = value
+ }
+ if value, ok := _c.mutation.VideoResolution(); ok {
+ _spec.SetField(usagelog.FieldVideoResolution, field.TypeString, value)
+ _node.VideoResolution = &value
+ }
+ if value, ok := _c.mutation.VideoDurationSeconds(); ok {
+ _spec.SetField(usagelog.FieldVideoDurationSeconds, field.TypeInt, value)
+ _node.VideoDurationSeconds = &value
+ }
if value, ok := _c.mutation.CacheTTLOverridden(); ok {
_spec.SetField(usagelog.FieldCacheTTLOverridden, field.TypeBool, value)
_node.CacheTTLOverridden = value
@@ -1830,6 +1896,66 @@ func (u *UsageLogUpsert) ClearImageSizeBreakdown() *UsageLogUpsert {
return u
}
+// SetVideoCount sets the "video_count" field.
+func (u *UsageLogUpsert) SetVideoCount(v int) *UsageLogUpsert {
+ u.Set(usagelog.FieldVideoCount, v)
+ return u
+}
+
+// UpdateVideoCount sets the "video_count" field to the value that was provided on create.
+func (u *UsageLogUpsert) UpdateVideoCount() *UsageLogUpsert {
+ u.SetExcluded(usagelog.FieldVideoCount)
+ return u
+}
+
+// AddVideoCount adds v to the "video_count" field.
+func (u *UsageLogUpsert) AddVideoCount(v int) *UsageLogUpsert {
+ u.Add(usagelog.FieldVideoCount, v)
+ return u
+}
+
+// SetVideoResolution sets the "video_resolution" field.
+func (u *UsageLogUpsert) SetVideoResolution(v string) *UsageLogUpsert {
+ u.Set(usagelog.FieldVideoResolution, v)
+ return u
+}
+
+// UpdateVideoResolution sets the "video_resolution" field to the value that was provided on create.
+func (u *UsageLogUpsert) UpdateVideoResolution() *UsageLogUpsert {
+ u.SetExcluded(usagelog.FieldVideoResolution)
+ return u
+}
+
+// ClearVideoResolution clears the value of the "video_resolution" field.
+func (u *UsageLogUpsert) ClearVideoResolution() *UsageLogUpsert {
+ u.SetNull(usagelog.FieldVideoResolution)
+ return u
+}
+
+// SetVideoDurationSeconds sets the "video_duration_seconds" field.
+func (u *UsageLogUpsert) SetVideoDurationSeconds(v int) *UsageLogUpsert {
+ u.Set(usagelog.FieldVideoDurationSeconds, v)
+ return u
+}
+
+// UpdateVideoDurationSeconds sets the "video_duration_seconds" field to the value that was provided on create.
+func (u *UsageLogUpsert) UpdateVideoDurationSeconds() *UsageLogUpsert {
+ u.SetExcluded(usagelog.FieldVideoDurationSeconds)
+ return u
+}
+
+// AddVideoDurationSeconds adds v to the "video_duration_seconds" field.
+func (u *UsageLogUpsert) AddVideoDurationSeconds(v int) *UsageLogUpsert {
+ u.Add(usagelog.FieldVideoDurationSeconds, v)
+ return u
+}
+
+// ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
+func (u *UsageLogUpsert) ClearVideoDurationSeconds() *UsageLogUpsert {
+ u.SetNull(usagelog.FieldVideoDurationSeconds)
+ return u
+}
+
// SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
func (u *UsageLogUpsert) SetCacheTTLOverridden(v bool) *UsageLogUpsert {
u.Set(usagelog.FieldCacheTTLOverridden, v)
@@ -2692,6 +2818,76 @@ func (u *UsageLogUpsertOne) ClearImageSizeBreakdown() *UsageLogUpsertOne {
})
}
+// SetVideoCount sets the "video_count" field.
+func (u *UsageLogUpsertOne) SetVideoCount(v int) *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.SetVideoCount(v)
+ })
+}
+
+// AddVideoCount adds v to the "video_count" field.
+func (u *UsageLogUpsertOne) AddVideoCount(v int) *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.AddVideoCount(v)
+ })
+}
+
+// UpdateVideoCount sets the "video_count" field to the value that was provided on create.
+func (u *UsageLogUpsertOne) UpdateVideoCount() *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.UpdateVideoCount()
+ })
+}
+
+// SetVideoResolution sets the "video_resolution" field.
+func (u *UsageLogUpsertOne) SetVideoResolution(v string) *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.SetVideoResolution(v)
+ })
+}
+
+// UpdateVideoResolution sets the "video_resolution" field to the value that was provided on create.
+func (u *UsageLogUpsertOne) UpdateVideoResolution() *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.UpdateVideoResolution()
+ })
+}
+
+// ClearVideoResolution clears the value of the "video_resolution" field.
+func (u *UsageLogUpsertOne) ClearVideoResolution() *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.ClearVideoResolution()
+ })
+}
+
+// SetVideoDurationSeconds sets the "video_duration_seconds" field.
+func (u *UsageLogUpsertOne) SetVideoDurationSeconds(v int) *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.SetVideoDurationSeconds(v)
+ })
+}
+
+// AddVideoDurationSeconds adds v to the "video_duration_seconds" field.
+func (u *UsageLogUpsertOne) AddVideoDurationSeconds(v int) *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.AddVideoDurationSeconds(v)
+ })
+}
+
+// UpdateVideoDurationSeconds sets the "video_duration_seconds" field to the value that was provided on create.
+func (u *UsageLogUpsertOne) UpdateVideoDurationSeconds() *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.UpdateVideoDurationSeconds()
+ })
+}
+
+// ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
+func (u *UsageLogUpsertOne) ClearVideoDurationSeconds() *UsageLogUpsertOne {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.ClearVideoDurationSeconds()
+ })
+}
+
// SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
func (u *UsageLogUpsertOne) SetCacheTTLOverridden(v bool) *UsageLogUpsertOne {
return u.Update(func(s *UsageLogUpsert) {
@@ -3722,6 +3918,76 @@ func (u *UsageLogUpsertBulk) ClearImageSizeBreakdown() *UsageLogUpsertBulk {
})
}
+// SetVideoCount sets the "video_count" field.
+func (u *UsageLogUpsertBulk) SetVideoCount(v int) *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.SetVideoCount(v)
+ })
+}
+
+// AddVideoCount adds v to the "video_count" field.
+func (u *UsageLogUpsertBulk) AddVideoCount(v int) *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.AddVideoCount(v)
+ })
+}
+
+// UpdateVideoCount sets the "video_count" field to the value that was provided on create.
+func (u *UsageLogUpsertBulk) UpdateVideoCount() *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.UpdateVideoCount()
+ })
+}
+
+// SetVideoResolution sets the "video_resolution" field.
+func (u *UsageLogUpsertBulk) SetVideoResolution(v string) *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.SetVideoResolution(v)
+ })
+}
+
+// UpdateVideoResolution sets the "video_resolution" field to the value that was provided on create.
+func (u *UsageLogUpsertBulk) UpdateVideoResolution() *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.UpdateVideoResolution()
+ })
+}
+
+// ClearVideoResolution clears the value of the "video_resolution" field.
+func (u *UsageLogUpsertBulk) ClearVideoResolution() *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.ClearVideoResolution()
+ })
+}
+
+// SetVideoDurationSeconds sets the "video_duration_seconds" field.
+func (u *UsageLogUpsertBulk) SetVideoDurationSeconds(v int) *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.SetVideoDurationSeconds(v)
+ })
+}
+
+// AddVideoDurationSeconds adds v to the "video_duration_seconds" field.
+func (u *UsageLogUpsertBulk) AddVideoDurationSeconds(v int) *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.AddVideoDurationSeconds(v)
+ })
+}
+
+// UpdateVideoDurationSeconds sets the "video_duration_seconds" field to the value that was provided on create.
+func (u *UsageLogUpsertBulk) UpdateVideoDurationSeconds() *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.UpdateVideoDurationSeconds()
+ })
+}
+
+// ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
+func (u *UsageLogUpsertBulk) ClearVideoDurationSeconds() *UsageLogUpsertBulk {
+ return u.Update(func(s *UsageLogUpsert) {
+ s.ClearVideoDurationSeconds()
+ })
+}
+
// SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
func (u *UsageLogUpsertBulk) SetCacheTTLOverridden(v bool) *UsageLogUpsertBulk {
return u.Update(func(s *UsageLogUpsert) {
diff --git a/backend/ent/usagelog_update.go b/backend/ent/usagelog_update.go
index e8fa003c63..00a65ccff1 100644
--- a/backend/ent/usagelog_update.go
+++ b/backend/ent/usagelog_update.go
@@ -811,6 +811,74 @@ func (_u *UsageLogUpdate) ClearImageSizeBreakdown() *UsageLogUpdate {
return _u
}
+// SetVideoCount sets the "video_count" field.
+func (_u *UsageLogUpdate) SetVideoCount(v int) *UsageLogUpdate {
+ _u.mutation.ResetVideoCount()
+ _u.mutation.SetVideoCount(v)
+ return _u
+}
+
+// SetNillableVideoCount sets the "video_count" field if the given value is not nil.
+func (_u *UsageLogUpdate) SetNillableVideoCount(v *int) *UsageLogUpdate {
+ if v != nil {
+ _u.SetVideoCount(*v)
+ }
+ return _u
+}
+
+// AddVideoCount adds value to the "video_count" field.
+func (_u *UsageLogUpdate) AddVideoCount(v int) *UsageLogUpdate {
+ _u.mutation.AddVideoCount(v)
+ return _u
+}
+
+// SetVideoResolution sets the "video_resolution" field.
+func (_u *UsageLogUpdate) SetVideoResolution(v string) *UsageLogUpdate {
+ _u.mutation.SetVideoResolution(v)
+ return _u
+}
+
+// SetNillableVideoResolution sets the "video_resolution" field if the given value is not nil.
+func (_u *UsageLogUpdate) SetNillableVideoResolution(v *string) *UsageLogUpdate {
+ if v != nil {
+ _u.SetVideoResolution(*v)
+ }
+ return _u
+}
+
+// ClearVideoResolution clears the value of the "video_resolution" field.
+func (_u *UsageLogUpdate) ClearVideoResolution() *UsageLogUpdate {
+ _u.mutation.ClearVideoResolution()
+ return _u
+}
+
+// SetVideoDurationSeconds sets the "video_duration_seconds" field.
+func (_u *UsageLogUpdate) SetVideoDurationSeconds(v int) *UsageLogUpdate {
+ _u.mutation.ResetVideoDurationSeconds()
+ _u.mutation.SetVideoDurationSeconds(v)
+ return _u
+}
+
+// SetNillableVideoDurationSeconds sets the "video_duration_seconds" field if the given value is not nil.
+func (_u *UsageLogUpdate) SetNillableVideoDurationSeconds(v *int) *UsageLogUpdate {
+ if v != nil {
+ _u.SetVideoDurationSeconds(*v)
+ }
+ return _u
+}
+
+// AddVideoDurationSeconds adds value to the "video_duration_seconds" field.
+func (_u *UsageLogUpdate) AddVideoDurationSeconds(v int) *UsageLogUpdate {
+ _u.mutation.AddVideoDurationSeconds(v)
+ return _u
+}
+
+// ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
+func (_u *UsageLogUpdate) ClearVideoDurationSeconds() *UsageLogUpdate {
+ _u.mutation.ClearVideoDurationSeconds()
+ return _u
+}
+
// SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
func (_u *UsageLogUpdate) SetCacheTTLOverridden(v bool) *UsageLogUpdate {
_u.mutation.SetCacheTTLOverridden(v)
@@ -979,6 +1047,11 @@ func (_u *UsageLogUpdate) check() error {
return &ValidationError{Name: "image_size_source", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size_source": %w`, err)}
}
}
+ if v, ok := _u.mutation.VideoResolution(); ok {
+ if err := usagelog.VideoResolutionValidator(v); err != nil {
+ return &ValidationError{Name: "video_resolution", err: fmt.Errorf(`ent: validator failed for field "UsageLog.video_resolution": %w`, err)}
+ }
+ }
if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "UsageLog.user"`)
}
@@ -1210,6 +1283,27 @@ func (_u *UsageLogUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if _u.mutation.ImageSizeBreakdownCleared() {
_spec.ClearField(usagelog.FieldImageSizeBreakdown, field.TypeJSON)
}
+ if value, ok := _u.mutation.VideoCount(); ok {
+ _spec.SetField(usagelog.FieldVideoCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedVideoCount(); ok {
+ _spec.AddField(usagelog.FieldVideoCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.VideoResolution(); ok {
+ _spec.SetField(usagelog.FieldVideoResolution, field.TypeString, value)
+ }
+ if _u.mutation.VideoResolutionCleared() {
+ _spec.ClearField(usagelog.FieldVideoResolution, field.TypeString)
+ }
+ if value, ok := _u.mutation.VideoDurationSeconds(); ok {
+ _spec.SetField(usagelog.FieldVideoDurationSeconds, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedVideoDurationSeconds(); ok {
+ _spec.AddField(usagelog.FieldVideoDurationSeconds, field.TypeInt, value)
+ }
+ if _u.mutation.VideoDurationSecondsCleared() {
+ _spec.ClearField(usagelog.FieldVideoDurationSeconds, field.TypeInt)
+ }
if value, ok := _u.mutation.CacheTTLOverridden(); ok {
_spec.SetField(usagelog.FieldCacheTTLOverridden, field.TypeBool, value)
}
@@ -2157,6 +2251,74 @@ func (_u *UsageLogUpdateOne) ClearImageSizeBreakdown() *UsageLogUpdateOne {
return _u
}
+// SetVideoCount sets the "video_count" field.
+func (_u *UsageLogUpdateOne) SetVideoCount(v int) *UsageLogUpdateOne {
+ _u.mutation.ResetVideoCount()
+ _u.mutation.SetVideoCount(v)
+ return _u
+}
+
+// SetNillableVideoCount sets the "video_count" field if the given value is not nil.
+func (_u *UsageLogUpdateOne) SetNillableVideoCount(v *int) *UsageLogUpdateOne {
+ if v != nil {
+ _u.SetVideoCount(*v)
+ }
+ return _u
+}
+
+// AddVideoCount adds value to the "video_count" field.
+func (_u *UsageLogUpdateOne) AddVideoCount(v int) *UsageLogUpdateOne {
+ _u.mutation.AddVideoCount(v)
+ return _u
+}
+
+// SetVideoResolution sets the "video_resolution" field.
+func (_u *UsageLogUpdateOne) SetVideoResolution(v string) *UsageLogUpdateOne {
+ _u.mutation.SetVideoResolution(v)
+ return _u
+}
+
+// SetNillableVideoResolution sets the "video_resolution" field if the given value is not nil.
+func (_u *UsageLogUpdateOne) SetNillableVideoResolution(v *string) *UsageLogUpdateOne {
+ if v != nil {
+ _u.SetVideoResolution(*v)
+ }
+ return _u
+}
+
+// ClearVideoResolution clears the value of the "video_resolution" field.
+func (_u *UsageLogUpdateOne) ClearVideoResolution() *UsageLogUpdateOne {
+ _u.mutation.ClearVideoResolution()
+ return _u
+}
+
+// SetVideoDurationSeconds sets the "video_duration_seconds" field.
+func (_u *UsageLogUpdateOne) SetVideoDurationSeconds(v int) *UsageLogUpdateOne {
+ _u.mutation.ResetVideoDurationSeconds()
+ _u.mutation.SetVideoDurationSeconds(v)
+ return _u
+}
+
+// SetNillableVideoDurationSeconds sets the "video_duration_seconds" field if the given value is not nil.
+func (_u *UsageLogUpdateOne) SetNillableVideoDurationSeconds(v *int) *UsageLogUpdateOne {
+ if v != nil {
+ _u.SetVideoDurationSeconds(*v)
+ }
+ return _u
+}
+
+// AddVideoDurationSeconds adds value to the "video_duration_seconds" field.
+func (_u *UsageLogUpdateOne) AddVideoDurationSeconds(v int) *UsageLogUpdateOne {
+ _u.mutation.AddVideoDurationSeconds(v)
+ return _u
+}
+
+// ClearVideoDurationSeconds clears the value of the "video_duration_seconds" field.
+func (_u *UsageLogUpdateOne) ClearVideoDurationSeconds() *UsageLogUpdateOne {
+ _u.mutation.ClearVideoDurationSeconds()
+ return _u
+}
+
// SetCacheTTLOverridden sets the "cache_ttl_overridden" field.
func (_u *UsageLogUpdateOne) SetCacheTTLOverridden(v bool) *UsageLogUpdateOne {
_u.mutation.SetCacheTTLOverridden(v)
@@ -2338,6 +2500,11 @@ func (_u *UsageLogUpdateOne) check() error {
return &ValidationError{Name: "image_size_source", err: fmt.Errorf(`ent: validator failed for field "UsageLog.image_size_source": %w`, err)}
}
}
+ if v, ok := _u.mutation.VideoResolution(); ok {
+ if err := usagelog.VideoResolutionValidator(v); err != nil {
+ return &ValidationError{Name: "video_resolution", err: fmt.Errorf(`ent: validator failed for field "UsageLog.video_resolution": %w`, err)}
+ }
+ }
if _u.mutation.UserCleared() && len(_u.mutation.UserIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "UsageLog.user"`)
}
@@ -2586,6 +2753,27 @@ func (_u *UsageLogUpdateOne) sqlSave(ctx context.Context) (_node *UsageLog, err
if _u.mutation.ImageSizeBreakdownCleared() {
_spec.ClearField(usagelog.FieldImageSizeBreakdown, field.TypeJSON)
}
+ if value, ok := _u.mutation.VideoCount(); ok {
+ _spec.SetField(usagelog.FieldVideoCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedVideoCount(); ok {
+ _spec.AddField(usagelog.FieldVideoCount, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.VideoResolution(); ok {
+ _spec.SetField(usagelog.FieldVideoResolution, field.TypeString, value)
+ }
+ if _u.mutation.VideoResolutionCleared() {
+ _spec.ClearField(usagelog.FieldVideoResolution, field.TypeString)
+ }
+ if value, ok := _u.mutation.VideoDurationSeconds(); ok {
+ _spec.SetField(usagelog.FieldVideoDurationSeconds, field.TypeInt, value)
+ }
+ if value, ok := _u.mutation.AddedVideoDurationSeconds(); ok {
+ _spec.AddField(usagelog.FieldVideoDurationSeconds, field.TypeInt, value)
+ }
+ if _u.mutation.VideoDurationSecondsCleared() {
+ _spec.ClearField(usagelog.FieldVideoDurationSeconds, field.TypeInt)
+ }
if value, ok := _u.mutation.CacheTTLOverridden(); ok {
_spec.SetField(usagelog.FieldCacheTTLOverridden, field.TypeBool, value)
}
diff --git a/backend/ent/user.go b/backend/ent/user.go
index 486f2f64d9..299a8d627f 100644
--- a/backend/ent/user.go
+++ b/backend/ent/user.go
@@ -31,6 +31,8 @@ type User struct {
Role string `json:"role,omitempty"`
// Balance holds the value of the "balance" field.
Balance float64 `json:"balance,omitempty"`
+ // FrozenBalance holds the value of the "frozen_balance" field.
+ FrozenBalance float64 `json:"frozen_balance,omitempty"`
// Concurrency holds the value of the "concurrency" field.
Concurrency int `json:"concurrency,omitempty"`
// Status holds the value of the "status" field.
@@ -237,7 +239,7 @@ func (*User) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case user.FieldTotpEnabled, user.FieldBalanceNotifyEnabled:
values[i] = new(sql.NullBool)
- case user.FieldBalance, user.FieldBalanceNotifyThreshold, user.FieldTotalRecharged:
+ case user.FieldBalance, user.FieldFrozenBalance, user.FieldBalanceNotifyThreshold, user.FieldTotalRecharged:
values[i] = new(sql.NullFloat64)
case user.FieldID, user.FieldConcurrency, user.FieldRpmLimit:
values[i] = new(sql.NullInt64)
@@ -309,6 +311,12 @@ func (_m *User) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.Balance = value.Float64
}
+ case user.FieldFrozenBalance:
+ if value, ok := values[i].(*sql.NullFloat64); !ok {
+ return fmt.Errorf("unexpected type %T for field frozen_balance", values[i])
+ } else if value.Valid {
+ _m.FrozenBalance = value.Float64
+ }
case user.FieldConcurrency:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field concurrency", values[i])
@@ -539,6 +547,9 @@ func (_m *User) String() string {
builder.WriteString("balance=")
builder.WriteString(fmt.Sprintf("%v", _m.Balance))
builder.WriteString(", ")
+ builder.WriteString("frozen_balance=")
+ builder.WriteString(fmt.Sprintf("%v", _m.FrozenBalance))
+ builder.WriteString(", ")
builder.WriteString("concurrency=")
builder.WriteString(fmt.Sprintf("%v", _m.Concurrency))
builder.WriteString(", ")
diff --git a/backend/ent/user/user.go b/backend/ent/user/user.go
index ff40445bda..ae1a84494d 100644
--- a/backend/ent/user/user.go
+++ b/backend/ent/user/user.go
@@ -29,6 +29,8 @@ const (
FieldRole = "role"
// FieldBalance holds the string denoting the balance field in the database.
FieldBalance = "balance"
+ // FieldFrozenBalance holds the string denoting the frozen_balance field in the database.
+ FieldFrozenBalance = "frozen_balance"
// FieldConcurrency holds the string denoting the concurrency field in the database.
FieldConcurrency = "concurrency"
// FieldStatus holds the string denoting the status field in the database.
@@ -199,6 +201,7 @@ var Columns = []string{
FieldPasswordHash,
FieldRole,
FieldBalance,
+ FieldFrozenBalance,
FieldConcurrency,
FieldStatus,
FieldUsername,
@@ -257,6 +260,8 @@ var (
RoleValidator func(string) error
// DefaultBalance holds the default value on creation for the "balance" field.
DefaultBalance float64
+ // DefaultFrozenBalance holds the default value on creation for the "frozen_balance" field.
+ DefaultFrozenBalance float64
// DefaultConcurrency holds the default value on creation for the "concurrency" field.
DefaultConcurrency int
// DefaultStatus holds the default value on creation for the "status" field.
@@ -330,6 +335,11 @@ func ByBalance(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBalance, opts...).ToFunc()
}
+// ByFrozenBalance orders the results by the frozen_balance field.
+func ByFrozenBalance(opts ...sql.OrderTermOption) OrderOption {
+ return sql.OrderByField(FieldFrozenBalance, opts...).ToFunc()
+}
+
// ByConcurrency orders the results by the concurrency field.
func ByConcurrency(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldConcurrency, opts...).ToFunc()
diff --git a/backend/ent/user/where.go b/backend/ent/user/where.go
index a18cf49767..c2a71f6172 100644
--- a/backend/ent/user/where.go
+++ b/backend/ent/user/where.go
@@ -90,6 +90,11 @@ func Balance(v float64) predicate.User {
return predicate.User(sql.FieldEQ(FieldBalance, v))
}
+// FrozenBalance applies equality check predicate on the "frozen_balance" field. It's identical to FrozenBalanceEQ.
+func FrozenBalance(v float64) predicate.User {
+ return predicate.User(sql.FieldEQ(FieldFrozenBalance, v))
+}
+
// Concurrency applies equality check predicate on the "concurrency" field. It's identical to ConcurrencyEQ.
func Concurrency(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldConcurrency, v))
@@ -535,6 +540,46 @@ func BalanceLTE(v float64) predicate.User {
return predicate.User(sql.FieldLTE(FieldBalance, v))
}
+// FrozenBalanceEQ applies the EQ predicate on the "frozen_balance" field.
+func FrozenBalanceEQ(v float64) predicate.User {
+ return predicate.User(sql.FieldEQ(FieldFrozenBalance, v))
+}
+
+// FrozenBalanceNEQ applies the NEQ predicate on the "frozen_balance" field.
+func FrozenBalanceNEQ(v float64) predicate.User {
+ return predicate.User(sql.FieldNEQ(FieldFrozenBalance, v))
+}
+
+// FrozenBalanceIn applies the In predicate on the "frozen_balance" field.
+func FrozenBalanceIn(vs ...float64) predicate.User {
+ return predicate.User(sql.FieldIn(FieldFrozenBalance, vs...))
+}
+
+// FrozenBalanceNotIn applies the NotIn predicate on the "frozen_balance" field.
+func FrozenBalanceNotIn(vs ...float64) predicate.User {
+ return predicate.User(sql.FieldNotIn(FieldFrozenBalance, vs...))
+}
+
+// FrozenBalanceGT applies the GT predicate on the "frozen_balance" field.
+func FrozenBalanceGT(v float64) predicate.User {
+ return predicate.User(sql.FieldGT(FieldFrozenBalance, v))
+}
+
+// FrozenBalanceGTE applies the GTE predicate on the "frozen_balance" field.
+func FrozenBalanceGTE(v float64) predicate.User {
+ return predicate.User(sql.FieldGTE(FieldFrozenBalance, v))
+}
+
+// FrozenBalanceLT applies the LT predicate on the "frozen_balance" field.
+func FrozenBalanceLT(v float64) predicate.User {
+ return predicate.User(sql.FieldLT(FieldFrozenBalance, v))
+}
+
+// FrozenBalanceLTE applies the LTE predicate on the "frozen_balance" field.
+func FrozenBalanceLTE(v float64) predicate.User {
+ return predicate.User(sql.FieldLTE(FieldFrozenBalance, v))
+}
+
// ConcurrencyEQ applies the EQ predicate on the "concurrency" field.
func ConcurrencyEQ(v int) predicate.User {
return predicate.User(sql.FieldEQ(FieldConcurrency, v))
diff --git a/backend/ent/user_create.go b/backend/ent/user_create.go
index 92f1bd5e07..b5bdf986a0 100644
--- a/backend/ent/user_create.go
+++ b/backend/ent/user_create.go
@@ -116,6 +116,20 @@ func (_c *UserCreate) SetNillableBalance(v *float64) *UserCreate {
return _c
}
+// SetFrozenBalance sets the "frozen_balance" field.
+func (_c *UserCreate) SetFrozenBalance(v float64) *UserCreate {
+ _c.mutation.SetFrozenBalance(v)
+ return _c
+}
+
+// SetNillableFrozenBalance sets the "frozen_balance" field if the given value is not nil.
+func (_c *UserCreate) SetNillableFrozenBalance(v *float64) *UserCreate {
+ if v != nil {
+ _c.SetFrozenBalance(*v)
+ }
+ return _c
+}
+
// SetConcurrency sets the "concurrency" field.
func (_c *UserCreate) SetConcurrency(v int) *UserCreate {
_c.mutation.SetConcurrency(v)
@@ -594,6 +608,10 @@ func (_c *UserCreate) defaults() error {
v := user.DefaultBalance
_c.mutation.SetBalance(v)
}
+ if _, ok := _c.mutation.FrozenBalance(); !ok {
+ v := user.DefaultFrozenBalance
+ _c.mutation.SetFrozenBalance(v)
+ }
if _, ok := _c.mutation.Concurrency(); !ok {
v := user.DefaultConcurrency
_c.mutation.SetConcurrency(v)
@@ -676,6 +694,9 @@ func (_c *UserCreate) check() error {
if _, ok := _c.mutation.Balance(); !ok {
return &ValidationError{Name: "balance", err: errors.New(`ent: missing required field "User.balance"`)}
}
+ if _, ok := _c.mutation.FrozenBalance(); !ok {
+ return &ValidationError{Name: "frozen_balance", err: errors.New(`ent: missing required field "User.frozen_balance"`)}
+ }
if _, ok := _c.mutation.Concurrency(); !ok {
return &ValidationError{Name: "concurrency", err: errors.New(`ent: missing required field "User.concurrency"`)}
}
@@ -779,6 +800,10 @@ func (_c *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
_spec.SetField(user.FieldBalance, field.TypeFloat64, value)
_node.Balance = value
}
+ if value, ok := _c.mutation.FrozenBalance(); ok {
+ _spec.SetField(user.FieldFrozenBalance, field.TypeFloat64, value)
+ _node.FrozenBalance = value
+ }
if value, ok := _c.mutation.Concurrency(); ok {
_spec.SetField(user.FieldConcurrency, field.TypeInt, value)
_node.Concurrency = value
@@ -1191,6 +1216,24 @@ func (u *UserUpsert) AddBalance(v float64) *UserUpsert {
return u
}
+// SetFrozenBalance sets the "frozen_balance" field.
+func (u *UserUpsert) SetFrozenBalance(v float64) *UserUpsert {
+ u.Set(user.FieldFrozenBalance, v)
+ return u
+}
+
+// UpdateFrozenBalance sets the "frozen_balance" field to the value that was provided on create.
+func (u *UserUpsert) UpdateFrozenBalance() *UserUpsert {
+ u.SetExcluded(user.FieldFrozenBalance)
+ return u
+}
+
+// AddFrozenBalance adds v to the "frozen_balance" field.
+func (u *UserUpsert) AddFrozenBalance(v float64) *UserUpsert {
+ u.Add(user.FieldFrozenBalance, v)
+ return u
+}
+
// SetConcurrency sets the "concurrency" field.
func (u *UserUpsert) SetConcurrency(v int) *UserUpsert {
u.Set(user.FieldConcurrency, v)
@@ -1580,6 +1623,27 @@ func (u *UserUpsertOne) UpdateBalance() *UserUpsertOne {
})
}
+// SetFrozenBalance sets the "frozen_balance" field.
+func (u *UserUpsertOne) SetFrozenBalance(v float64) *UserUpsertOne {
+ return u.Update(func(s *UserUpsert) {
+ s.SetFrozenBalance(v)
+ })
+}
+
+// AddFrozenBalance adds v to the "frozen_balance" field.
+func (u *UserUpsertOne) AddFrozenBalance(v float64) *UserUpsertOne {
+ return u.Update(func(s *UserUpsert) {
+ s.AddFrozenBalance(v)
+ })
+}
+
+// UpdateFrozenBalance sets the "frozen_balance" field to the value that was provided on create.
+func (u *UserUpsertOne) UpdateFrozenBalance() *UserUpsertOne {
+ return u.Update(func(s *UserUpsert) {
+ s.UpdateFrozenBalance()
+ })
+}
+
// SetConcurrency sets the "concurrency" field.
func (u *UserUpsertOne) SetConcurrency(v int) *UserUpsertOne {
return u.Update(func(s *UserUpsert) {
@@ -2176,6 +2240,27 @@ func (u *UserUpsertBulk) UpdateBalance() *UserUpsertBulk {
})
}
+// SetFrozenBalance sets the "frozen_balance" field.
+func (u *UserUpsertBulk) SetFrozenBalance(v float64) *UserUpsertBulk {
+ return u.Update(func(s *UserUpsert) {
+ s.SetFrozenBalance(v)
+ })
+}
+
+// AddFrozenBalance adds v to the "frozen_balance" field.
+func (u *UserUpsertBulk) AddFrozenBalance(v float64) *UserUpsertBulk {
+ return u.Update(func(s *UserUpsert) {
+ s.AddFrozenBalance(v)
+ })
+}
+
+// UpdateFrozenBalance sets the "frozen_balance" field to the value that was provided on create.
+func (u *UserUpsertBulk) UpdateFrozenBalance() *UserUpsertBulk {
+ return u.Update(func(s *UserUpsert) {
+ s.UpdateFrozenBalance()
+ })
+}
+
// SetConcurrency sets the "concurrency" field.
func (u *UserUpsertBulk) SetConcurrency(v int) *UserUpsertBulk {
return u.Update(func(s *UserUpsert) {
diff --git a/backend/ent/user_update.go b/backend/ent/user_update.go
index 67d3f8e6bb..6df9b320da 100644
--- a/backend/ent/user_update.go
+++ b/backend/ent/user_update.go
@@ -129,6 +129,27 @@ func (_u *UserUpdate) AddBalance(v float64) *UserUpdate {
return _u
}
+// SetFrozenBalance sets the "frozen_balance" field.
+func (_u *UserUpdate) SetFrozenBalance(v float64) *UserUpdate {
+ _u.mutation.ResetFrozenBalance()
+ _u.mutation.SetFrozenBalance(v)
+ return _u
+}
+
+// SetNillableFrozenBalance sets the "frozen_balance" field if the given value is not nil.
+func (_u *UserUpdate) SetNillableFrozenBalance(v *float64) *UserUpdate {
+ if v != nil {
+ _u.SetFrozenBalance(*v)
+ }
+ return _u
+}
+
+// AddFrozenBalance adds value to the "frozen_balance" field.
+func (_u *UserUpdate) AddFrozenBalance(v float64) *UserUpdate {
+ _u.mutation.AddFrozenBalance(v)
+ return _u
+}
+
// SetConcurrency sets the "concurrency" field.
func (_u *UserUpdate) SetConcurrency(v int) *UserUpdate {
_u.mutation.ResetConcurrency()
@@ -997,6 +1018,12 @@ func (_u *UserUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if value, ok := _u.mutation.AddedBalance(); ok {
_spec.AddField(user.FieldBalance, field.TypeFloat64, value)
}
+ if value, ok := _u.mutation.FrozenBalance(); ok {
+ _spec.SetField(user.FieldFrozenBalance, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedFrozenBalance(); ok {
+ _spec.AddField(user.FieldFrozenBalance, field.TypeFloat64, value)
+ }
if value, ok := _u.mutation.Concurrency(); ok {
_spec.SetField(user.FieldConcurrency, field.TypeInt, value)
}
@@ -1778,6 +1805,27 @@ func (_u *UserUpdateOne) AddBalance(v float64) *UserUpdateOne {
return _u
}
+// SetFrozenBalance sets the "frozen_balance" field.
+func (_u *UserUpdateOne) SetFrozenBalance(v float64) *UserUpdateOne {
+ _u.mutation.ResetFrozenBalance()
+ _u.mutation.SetFrozenBalance(v)
+ return _u
+}
+
+// SetNillableFrozenBalance sets the "frozen_balance" field if the given value is not nil.
+func (_u *UserUpdateOne) SetNillableFrozenBalance(v *float64) *UserUpdateOne {
+ if v != nil {
+ _u.SetFrozenBalance(*v)
+ }
+ return _u
+}
+
+// AddFrozenBalance adds value to the "frozen_balance" field.
+func (_u *UserUpdateOne) AddFrozenBalance(v float64) *UserUpdateOne {
+ _u.mutation.AddFrozenBalance(v)
+ return _u
+}
+
// SetConcurrency sets the "concurrency" field.
func (_u *UserUpdateOne) SetConcurrency(v int) *UserUpdateOne {
_u.mutation.ResetConcurrency()
@@ -2676,6 +2724,12 @@ func (_u *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) {
if value, ok := _u.mutation.AddedBalance(); ok {
_spec.AddField(user.FieldBalance, field.TypeFloat64, value)
}
+ if value, ok := _u.mutation.FrozenBalance(); ok {
+ _spec.SetField(user.FieldFrozenBalance, field.TypeFloat64, value)
+ }
+ if value, ok := _u.mutation.AddedFrozenBalance(); ok {
+ _spec.AddField(user.FieldFrozenBalance, field.TypeFloat64, value)
+ }
if value, ok := _u.mutation.Concurrency(); ok {
_spec.SetField(user.FieldConcurrency, field.TypeInt, value)
}
diff --git a/backend/go.mod b/backend/go.mod
index d4e0af6c13..a06f06437d 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -1,6 +1,6 @@
module github.com/Wei-Shaw/sub2api
-go 1.26.4
+go 1.26.5
require (
entgo.io/ent v0.14.5
@@ -8,11 +8,10 @@ require (
github.com/alicebob/miniredis/v2 v2.38.0
github.com/alitto/pond/v2 v2.6.2
github.com/andybalholm/brotli v1.2.0
- github.com/aws/aws-sdk-go-v2 v1.41.3
+ github.com/aws/aws-sdk-go-v2 v1.41.5
github.com/aws/aws-sdk-go-v2/config v1.32.10
github.com/aws/aws-sdk-go-v2/credentials v1.19.10
- github.com/aws/aws-sdk-go-v2/service/s3 v1.96.2
- github.com/aws/smithy-go v1.24.2
+ github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3
github.com/cespare/xxhash/v2 v2.3.0
github.com/coder/websocket v1.8.14
github.com/dgraph-io/ristretto v0.2.0
@@ -39,6 +38,7 @@ require (
github.com/testcontainers/testcontainers-go/modules/redis v0.40.0
github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
+ github.com/tiktoken-go/tokenizer v0.8.0
github.com/wechatpay-apiv3/wechatpay-go v0.2.21
github.com/zeromicro/go-zero v1.9.4
go.uber.org/zap v1.24.0
@@ -59,20 +59,21 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
- github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect
+ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
- github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.18 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.10 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.18 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 // indirect
+ github.com/aws/smithy-go v1.24.2 // indirect
github.com/bmatcuk/doublestar v1.3.4 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/bytedance/sonic v1.9.1 // indirect
@@ -156,7 +157,6 @@ require (
github.com/testcontainers/testcontainers-go v0.40.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
- github.com/tiktoken-go/tokenizer v0.8.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
diff --git a/backend/go.sum b/backend/go.sum
index 1574798015..4738443bb9 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -24,34 +24,34 @@ github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwTo
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
-github.com/aws/aws-sdk-go-v2 v1.41.3 h1:4kQ/fa22KjDt13QCy1+bYADvdgcxpfH18f0zP542kZA=
-github.com/aws/aws-sdk-go-v2 v1.41.3/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q=
-github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c=
+github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY=
+github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 h1:eBMB84YGghSocM7PsjmmPffTa+1FBUeNvGvFou6V/4o=
+github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8/go.mod h1:lyw7GFp3qENLh7kwzf7iMzAxDn+NzjXEAGjKS2UOKqI=
github.com/aws/aws-sdk-go-v2/config v1.32.10 h1:9DMthfO6XWZYLfzZglAgW5Fyou2nRI5CuV44sTedKBI=
github.com/aws/aws-sdk-go-v2/config v1.32.10/go.mod h1:2rUIOnA2JaiqYmSKYmRJlcMWy6qTj1vuRFscppSBMcw=
github.com/aws/aws-sdk-go-v2/credentials v1.19.10 h1:EEhmEUFCE1Yhl7vDhNOI5OCL/iKMdkkYFTRpZXNw7m8=
github.com/aws/aws-sdk-go-v2/credentials v1.19.10/go.mod h1:RnnlFCAlxQCkN2Q379B67USkBMu1PipEEiibzYN5UTE=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 h1:Ii4s+Sq3yDfaMLpjrJsqD6SmG/Wq/P5L/hw2qa78UAY=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18/go.mod h1:6x81qnY++ovptLE6nWQeWrpXxbnlIex+4H4eYYGcqfc=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 h1:F43zk1vemYIqPAwhjTjYIz0irU2EY7sOb/F5eJ3HuyM=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18/go.mod h1:w1jdlZXrGKaJcNoL+Nnrj+k5wlpGXqnNrKoP22HvAug=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 h1:xCeWVjj0ki0l3nruoyP2slHsGArMxeiiaoPN5QZH6YQ=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18/go.mod h1:r/eLGuGCBw6l36ZRWiw6PaZwPXb6YOj+i/7MizNl5/k=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21/go.mod h1:p+hz+PRAYlY3zcpJhPwXlLC4C+kqn70WIHwnzAfs6ps=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
-github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.18 h1:eZioDaZGJ0tMM4gzmkNIO2aAoQd+je7Ug7TkvAzlmkU=
-github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.18/go.mod h1:CCXwUKAJdoWr6/NcxZ+zsiPr6oH/Q5aTooRGYieAyj4=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 h1:CeY9LUdur+Dxoeldqoun6y4WtJ3RQtzk0JMP2gfUay0=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5/go.mod h1:AZLZf2fMaahW5s/wMRciu1sYbdsikT/UHwbUjOdEVTc=
-github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.10 h1:fJvQ5mIBVfKtiyx0AHY6HeWcRX5LGANLpq8SVR+Uazs=
-github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.10/go.mod h1:Kzm5e6OmNH8VMkgK9t+ry5jEih4Y8whqs+1hrkxim1I=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 h1:LTRCYFlnnKFlKsyIQxKhJuDuA3ZkrDQMRYm6rXiHlLY=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18/go.mod h1:XhwkgGG6bHSd00nO/mexWTcTjgd6PjuvWQMqSn2UaEk=
-github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.18 h1:/A/xDuZAVD2BpsS2fftFRo/NoEKQJ8YTnJDEHBy2Gtg=
-github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.18/go.mod h1:hWe9b4f+djUQGmyiGEeOnZv69dtMSgpDRIvNMvuvzvY=
-github.com/aws/aws-sdk-go-v2/service/s3 v1.96.2 h1:M1A9AjcFwlxTLuf0Faj88L8Iqw0n/AJHjpZTQzMMsSc=
-github.com/aws/aws-sdk-go-v2/service/s3 v1.96.2/go.mod h1:KsdTV6Q9WKUZm2mNJnUFmIoXfZux91M3sr/a4REX8e0=
+github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22 h1:rWyie/PxDRIdhNf4DzRk0lvjVOqFJuNnO8WwaIRVxzQ=
+github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.22/go.mod h1:zd/JsJ4P7oGfUhXn1VyLqaRZwPmZwg44Jf2dS84Dm3Y=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI=
+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13 h1:JRaIgADQS/U6uXDqlPiefP32yXTda7Kqfx+LgspooZM=
+github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.13/go.mod h1:CEuVn5WqOMilYl+tbccq8+N2ieCy0gVn3OtRb0vBNNM=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21 h1:c31//R3xgIJMSC8S6hEVq+38DcvUlgFY0FM6mSI5oto=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.21/go.mod h1:r6+pf23ouCB718FUxaqzZdbpYFyDtehyZcmP5KL9FkA=
+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21 h1:ZlvrNcHSFFWURB8avufQq9gFsheUgjVD9536obIknfM=
+github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.21/go.mod h1:cv3TNhVrssKR0O/xxLJVRfd2oazSnZnkUeTf6ctUwfQ=
+github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3 h1:HwxWTbTrIHm5qY+CAEur0s/figc3qwvLWsNkF4RPToo=
+github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3/go.mod h1:uoA43SdFwacedBfSgfFSjjCvYe8aYBS7EnU5GZ/YKMM=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 h1:MzORe+J94I+hYu2a6XmV5yC9huoTv8NRcCrUNedDypQ=
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6/go.mod h1:hXzcHLARD7GeWnifd8j9RWqtfIgxj4/cAtIVIK7hg8g=
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 h1:7oGD8KPfBOJGXiCoRKrrrQkbvCp8N++u36hrLMPey6o=
@@ -166,8 +166,6 @@ github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
-github.com/google/subcommands v1.2.0 h1:vWQspBTo2nEqTUFita5/KeEWlUL8kQObDFbub/EN9oE=
-github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/wire v0.7.0 h1:JxUKI6+CVBgCO2WToKy/nQk0sS+amI9z9EjVmdaocj4=
@@ -222,8 +220,6 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
-github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
-github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mdelapenya/tlscert v0.2.0 h1:7H81W6Z/4weDvZBNOfQte5GpIMo0lGYEeWbkGp5LJHI=
@@ -257,8 +253,6 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
-github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
-github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
@@ -288,8 +282,6 @@ github.com/refraction-networking/utls v1.8.2 h1:j4Q1gJj0xngdeH+Ox/qND11aEfhpgoEv
github.com/refraction-networking/utls v1.8.2/go.mod h1:jkSOEkLqn+S/jtpEHPOsVv/4V4EVnelwbMQl4vCWXAM=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
-github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
-github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
@@ -322,8 +314,6 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
-github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
-github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
@@ -419,20 +409,14 @@ go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
-golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
-golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
golang.org/x/crypto v0.51.0 h1:IBPXwPfKxY7cWQZ38ZCIRPI50YLeevDLlLnyC5wRGTI=
golang.org/x/crypto v0.51.0/go.mod h1:8AdwkbraGNABw2kOX6YFPs3WM22XqI4EXEd8g+x7Oc8=
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY=
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
golang.org/x/image v0.39.0 h1:skVYidAEVKgn8lZ602XO75asgXBgLj9G/FE3RbuPFww=
golang.org/x/image v0.39.0/go.mod h1:sIbmppfU+xFLPIG0FoVUTvyBMmgng1/XAMhQ2ft0hpA=
-golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
-golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
-golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
-golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
@@ -446,22 +430,14 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
-golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
-golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY=
-golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4=
golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk=
-golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
-golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
-golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=
-golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/backend/internal/config/config.go b/backend/internal/config/config.go
index 99fedb5b1c..df3afb6c7e 100644
--- a/backend/internal/config/config.go
+++ b/backend/internal/config/config.go
@@ -29,7 +29,7 @@ const (
// DefaultCSPPolicy is the default Content-Security-Policy with nonce support
// __CSP_NONCE__ will be replaced with actual nonce at request time by the SecurityHeaders middleware
-const DefaultCSPPolicy = "default-src 'self'; script-src 'self' __CSP_NONCE__ https://challenges.cloudflare.com https://static.cloudflareinsights.com https://*.stripe.com https://static.airwallex.com https://checkout.airwallex.com https://static-demo.airwallex.com https://checkout-demo.airwallex.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://static.airwallex.com https://checkout.airwallex.com https://static-demo.airwallex.com https://checkout-demo.airwallex.com; img-src 'self' data: https:; font-src 'self' data: https://fonts.gstatic.com; connect-src 'self' https:; frame-src https://challenges.cloudflare.com https://*.stripe.com https://checkout.airwallex.com https://checkout-demo.airwallex.com; frame-ancestors 'none'; base-uri 'self'; form-action 'self'"
+const DefaultCSPPolicy = "default-src 'self'; script-src 'self' __CSP_NONCE__ https://challenges.cloudflare.com https://static.cloudflareinsights.com https://*.stripe.com https://static.airwallex.com https://checkout.airwallex.com https://static-demo.airwallex.com https://checkout-demo.airwallex.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://static.airwallex.com https://checkout.airwallex.com https://static-demo.airwallex.com https://checkout-demo.airwallex.com; img-src 'self' data: blob: https:; font-src 'self' data: https://fonts.gstatic.com; connect-src 'self' https:; frame-src https://challenges.cloudflare.com https://*.stripe.com https://checkout.airwallex.com https://checkout-demo.airwallex.com; frame-ancestors 'none'; base-uri 'self'; form-action 'self'"
// UMQ(用户消息队列)模式常量
const (
@@ -93,6 +93,7 @@ type Config struct {
Gemini GeminiConfig `mapstructure:"gemini"`
Update UpdateConfig `mapstructure:"update"`
Idempotency IdempotencyConfig `mapstructure:"idempotency"`
+ BatchImage BatchImageConfig `mapstructure:"batch_image"`
}
type LogConfig struct {
@@ -175,6 +176,56 @@ type IdempotencyConfig struct {
CleanupBatchSize int `mapstructure:"cleanup_batch_size"`
}
+type BatchImageConfig struct {
+ Enabled bool `mapstructure:"enabled"`
+ MaxItemsPerJobDefault int `mapstructure:"max_items_per_job_default"`
+ MaxItemsPerJobTrial int `mapstructure:"max_items_per_job_trial"`
+ MaxOutputImagesPerJob int `mapstructure:"max_output_images_per_job"`
+ MaxOutputImagesPerItem int `mapstructure:"max_output_images_per_item"`
+ MaxPromptCharsPerItem int `mapstructure:"max_prompt_chars_per_item"`
+ MaxReferenceImagesPerJob int `mapstructure:"max_reference_images_per_job"`
+ MaxReferenceInlineBytesPerJob int `mapstructure:"max_reference_inline_bytes_per_job"`
+ DefaultResponseMimeType string `mapstructure:"default_response_mime_type"`
+ DefaultImageSize string `mapstructure:"default_image_size"`
+ MaxDownloadItemsZip int `mapstructure:"max_download_items_zip"`
+ MaxDownloadBytesPerRequest int64 `mapstructure:"max_download_bytes_per_request"`
+ MaxDownloadDurationSeconds int `mapstructure:"max_download_duration_seconds"`
+ MaxDownloadConcurrencyPerUser int `mapstructure:"max_download_concurrency_per_user"`
+ InputRetentionAfterTerminalHours int `mapstructure:"input_retention_after_terminal_hours"`
+ OutputRetentionAfterTerminalHours int `mapstructure:"output_retention_after_terminal_hours"`
+ OutputRetentionMaxDays int `mapstructure:"output_retention_max_days"`
+ CleanupIntervalMinutes int `mapstructure:"cleanup_interval_minutes"`
+ CleanupBatchSize int `mapstructure:"cleanup_batch_size"`
+ QueueEnabled bool `mapstructure:"queue_enabled"`
+ QueueReadyKey string `mapstructure:"queue_ready_key"`
+ QueueDelayedKey string `mapstructure:"queue_delayed_key"`
+ QueueActiveKey string `mapstructure:"queue_active_key"`
+ InflightKeyPrefix string `mapstructure:"inflight_key_prefix"`
+ LockKeyPrefix string `mapstructure:"lock_key_prefix"`
+ IdempotencyKeyPrefix string `mapstructure:"idempotency_key_prefix"`
+ InflightTTLSeconds int `mapstructure:"inflight_ttl_seconds"`
+ JobLockTTLSeconds int `mapstructure:"job_lock_ttl_seconds"`
+ DefaultRequeueDelaySeconds int `mapstructure:"default_requeue_delay_seconds"`
+ ErrorRetryDelaySeconds int `mapstructure:"error_retry_delay_seconds"`
+ LockConflictDelaySeconds int `mapstructure:"lock_conflict_delay_seconds"`
+ StaleActiveAfterSeconds int `mapstructure:"stale_active_after_seconds"`
+ DelayedMoverIntervalSeconds int `mapstructure:"delayed_mover_interval_seconds"`
+ RecoveryIntervalSeconds int `mapstructure:"recovery_interval_seconds"`
+ DelayedMoveLimit int `mapstructure:"delayed_move_limit"`
+ RecoverLimit int `mapstructure:"recover_limit"`
+ VertexEnabled bool `mapstructure:"vertex_enabled"`
+ VertexProjectID string `mapstructure:"vertex_project_id"`
+ VertexLocation string `mapstructure:"vertex_location"`
+ // VertexManagedGCSBucket is a server-owned bucket for batch JSONL input/output.
+ // Disable Cloud Storage soft delete on this bucket to avoid retaining deleted batch objects.
+ VertexManagedGCSBucket string `mapstructure:"vertex_managed_gcs_bucket"`
+ VertexManagedGCSPrefix string `mapstructure:"vertex_managed_gcs_prefix"`
+ VertexInputRetentionHours int `mapstructure:"vertex_input_retention_hours"`
+ VertexOutputRetentionHours int `mapstructure:"vertex_output_retention_hours"`
+ VertexBatchPredictionBaseURL string `mapstructure:"vertex_batch_prediction_base_url"`
+ VertexGCSBaseURL string `mapstructure:"vertex_gcs_base_url"`
+}
+
type LinuxDoConnectConfig struct {
Enabled bool `mapstructure:"enabled"`
ClientID string `mapstructure:"client_id"`
@@ -1732,6 +1783,53 @@ func setDefaults() {
viper.SetDefault("redis.min_idle_conns", 128)
viper.SetDefault("redis.enable_tls", false)
+ // Batch Image queue
+ viper.SetDefault("batch_image.enabled", false)
+ viper.SetDefault("batch_image.max_items_per_job_default", 200)
+ viper.SetDefault("batch_image.max_items_per_job_trial", 50)
+ viper.SetDefault("batch_image.max_output_images_per_job", 200)
+ viper.SetDefault("batch_image.max_output_images_per_item", 4)
+ viper.SetDefault("batch_image.max_prompt_chars_per_item", 8000)
+ viper.SetDefault("batch_image.max_reference_images_per_job", 1000)
+ viper.SetDefault("batch_image.max_reference_inline_bytes_per_job", 134217728)
+ viper.SetDefault("batch_image.default_response_mime_type", "image/png")
+ viper.SetDefault("batch_image.default_image_size", "1K")
+ viper.SetDefault("batch_image.max_download_items_zip", 200)
+ viper.SetDefault("batch_image.max_download_bytes_per_request", 536870912)
+ viper.SetDefault("batch_image.max_download_duration_seconds", 600)
+ viper.SetDefault("batch_image.max_download_concurrency_per_user", 1)
+ viper.SetDefault("batch_image.input_retention_after_terminal_hours", 24)
+ viper.SetDefault("batch_image.output_retention_after_terminal_hours", 72)
+ viper.SetDefault("batch_image.output_retention_max_days", 7)
+ viper.SetDefault("batch_image.cleanup_interval_minutes", 30)
+ viper.SetDefault("batch_image.cleanup_batch_size", 100)
+ viper.SetDefault("batch_image.queue_enabled", false)
+ viper.SetDefault("batch_image.queue_ready_key", "batch_image:queue:ready")
+ viper.SetDefault("batch_image.queue_delayed_key", "batch_image:queue:delayed")
+ viper.SetDefault("batch_image.queue_active_key", "batch_image:queue:active")
+ viper.SetDefault("batch_image.inflight_key_prefix", "batch_image:queue:inflight:")
+ viper.SetDefault("batch_image.lock_key_prefix", "batch_image:queue:lock:")
+ viper.SetDefault("batch_image.idempotency_key_prefix", "batch_image:queue:idem:")
+ viper.SetDefault("batch_image.inflight_ttl_seconds", 604800)
+ viper.SetDefault("batch_image.job_lock_ttl_seconds", 300)
+ viper.SetDefault("batch_image.default_requeue_delay_seconds", 30)
+ viper.SetDefault("batch_image.error_retry_delay_seconds", 60)
+ viper.SetDefault("batch_image.lock_conflict_delay_seconds", 5)
+ viper.SetDefault("batch_image.stale_active_after_seconds", 600)
+ viper.SetDefault("batch_image.delayed_mover_interval_seconds", 5)
+ viper.SetDefault("batch_image.recovery_interval_seconds", 300)
+ viper.SetDefault("batch_image.delayed_move_limit", 100)
+ viper.SetDefault("batch_image.recover_limit", 100)
+ viper.SetDefault("batch_image.vertex_enabled", false)
+ viper.SetDefault("batch_image.vertex_project_id", "")
+ viper.SetDefault("batch_image.vertex_location", "global")
+ viper.SetDefault("batch_image.vertex_managed_gcs_bucket", "")
+ viper.SetDefault("batch_image.vertex_managed_gcs_prefix", "batch-image/{env}/{batch_id}")
+ viper.SetDefault("batch_image.vertex_input_retention_hours", 24)
+ viper.SetDefault("batch_image.vertex_output_retention_hours", 72)
+ viper.SetDefault("batch_image.vertex_batch_prediction_base_url", "")
+ viper.SetDefault("batch_image.vertex_gcs_base_url", "")
+
// Ops (vNext)
viper.SetDefault("ops.enabled", true)
viper.SetDefault("ops.use_preaggregated_tables", true)
@@ -2333,6 +2431,61 @@ func (c *Config) Validate() error {
if c.Redis.MinIdleConns > c.Redis.PoolSize {
return fmt.Errorf("redis.min_idle_conns cannot exceed redis.pool_size")
}
+ if c.BatchImage.QueueEnabled {
+ if strings.TrimSpace(c.BatchImage.QueueReadyKey) == "" {
+ return fmt.Errorf("batch_image.queue_ready_key must not be empty")
+ }
+ if strings.TrimSpace(c.BatchImage.QueueDelayedKey) == "" {
+ return fmt.Errorf("batch_image.queue_delayed_key must not be empty")
+ }
+ if strings.TrimSpace(c.BatchImage.QueueActiveKey) == "" {
+ return fmt.Errorf("batch_image.queue_active_key must not be empty")
+ }
+ if strings.TrimSpace(c.BatchImage.InflightKeyPrefix) == "" {
+ return fmt.Errorf("batch_image.inflight_key_prefix must not be empty")
+ }
+ if strings.TrimSpace(c.BatchImage.LockKeyPrefix) == "" {
+ return fmt.Errorf("batch_image.lock_key_prefix must not be empty")
+ }
+ if c.BatchImage.InflightTTLSeconds <= 0 {
+ return fmt.Errorf("batch_image.inflight_ttl_seconds must be positive")
+ }
+ if c.BatchImage.JobLockTTLSeconds <= 0 {
+ return fmt.Errorf("batch_image.job_lock_ttl_seconds must be positive")
+ }
+ if c.BatchImage.StaleActiveAfterSeconds <= 0 {
+ return fmt.Errorf("batch_image.stale_active_after_seconds must be positive")
+ }
+ if c.BatchImage.DelayedMoveLimit <= 0 {
+ return fmt.Errorf("batch_image.delayed_move_limit must be positive")
+ }
+ if c.BatchImage.RecoverLimit <= 0 {
+ return fmt.Errorf("batch_image.recover_limit must be positive")
+ }
+ }
+ if c.BatchImage.VertexEnabled {
+ if strings.TrimSpace(c.BatchImage.VertexManagedGCSBucket) == "" {
+ return fmt.Errorf("batch_image.vertex_managed_gcs_bucket must not be empty when vertex is enabled")
+ }
+ if strings.Contains(c.BatchImage.VertexManagedGCSBucket, "://") {
+ return fmt.Errorf("batch_image.vertex_managed_gcs_bucket must be a bucket name, not a URI")
+ }
+ if strings.TrimSpace(c.BatchImage.VertexLocation) == "" {
+ return fmt.Errorf("batch_image.vertex_location must not be empty when vertex is enabled")
+ }
+ if strings.TrimSpace(c.BatchImage.VertexManagedGCSPrefix) == "" {
+ return fmt.Errorf("batch_image.vertex_managed_gcs_prefix must not be empty when vertex is enabled")
+ }
+ if !strings.Contains(c.BatchImage.VertexManagedGCSPrefix, "{batch_id}") {
+ return fmt.Errorf("batch_image.vertex_managed_gcs_prefix must contain {batch_id}")
+ }
+ if c.BatchImage.VertexInputRetentionHours <= 0 {
+ return fmt.Errorf("batch_image.vertex_input_retention_hours must be positive")
+ }
+ if c.BatchImage.VertexOutputRetentionHours <= 0 {
+ return fmt.Errorf("batch_image.vertex_output_retention_hours must be positive")
+ }
+ }
if c.Dashboard.Enabled {
if c.Dashboard.StatsFreshTTLSeconds <= 0 {
return fmt.Errorf("dashboard_cache.stats_fresh_ttl_seconds must be positive")
diff --git a/backend/internal/config/config_test.go b/backend/internal/config/config_test.go
index 804155d1a9..32aff543af 100644
--- a/backend/internal/config/config_test.go
+++ b/backend/internal/config/config_test.go
@@ -270,6 +270,14 @@ func TestLoadDefaultIdempotencyConfig(t *testing.T) {
}
}
+func TestLoadDefaultBatchImageQueueDisabled(t *testing.T) {
+ resetViperWithJWTSecret(t)
+
+ cfg, err := Load()
+ require.NoError(t, err)
+ require.False(t, cfg.BatchImage.QueueEnabled)
+}
+
func TestLoadIdempotencyConfigFromEnv(t *testing.T) {
resetViperWithJWTSecret(t)
t.Setenv("IDEMPOTENCY_OBSERVE_ONLY", "false")
diff --git a/backend/internal/handler/admin/account_handler.go b/backend/internal/handler/admin/account_handler.go
index 8c91245fbf..a4b0773999 100644
--- a/backend/internal/handler/admin/account_handler.go
+++ b/backend/internal/handler/admin/account_handler.go
@@ -485,6 +485,8 @@ func (h *AccountHandler) List(c *gin.Context) {
search = search[:100]
}
lite := parseBoolQueryWithDefault(c.Query("lite"), false)
+ // 调度分需要跨候选池批量打分并读取负载,默认列表不计算;只有前端列可见时才显式开启。
+ includeSchedulerScore := parseBoolQueryWithDefault(c.Query("include_scheduler_score"), false)
var groupID int64
if groupIDStr := c.Query("group"); groupIDStr != "" {
@@ -520,7 +522,7 @@ func (h *AccountHandler) List(c *gin.Context) {
var windowCosts map[int64]float64
var activeSessions map[int64]int
var rpmCounts map[int64]int
- // 仅当前页存在 OpenAI 账号时才计算调度分数,避免为空结果付出池查询开销。
+ // 双重门控:用户要看该列,且当前页确实有 OpenAI 账号,才进入昂贵的候选池打分路径。
var schedulerScores map[int64]*AccountSchedulerScore
var schedulerGroupScores map[int64][]AccountSchedulerGroupScore
pageHasOpenAIAccounts := false
@@ -530,7 +532,7 @@ func (h *AccountHandler) List(c *gin.Context) {
break
}
}
- if pageHasOpenAIAccounts {
+ if includeSchedulerScore && pageHasOpenAIAccounts {
schedulerFilterPool := h.listAccountSchedulerScoreFilterPool(c.Request.Context(), platform, accountType, status, search, groupID, privacyMode)
schedulerScores, schedulerGroupScores = h.buildOpenAIAccountSchedulerScores(c.Request.Context(), accounts, schedulerFilterPool)
}
diff --git a/backend/internal/handler/admin/account_handler_list_test.go b/backend/internal/handler/admin/account_handler_list_test.go
index 29e36ad865..4b1bd7224c 100644
--- a/backend/internal/handler/admin/account_handler_list_test.go
+++ b/backend/internal/handler/admin/account_handler_list_test.go
@@ -92,7 +92,7 @@ func TestAccountHandlerListReturnsSchedulerScoresPerGroup(t *testing.T) {
}
rec := httptest.NewRecorder()
- req := httptest.NewRequest(http.MethodGet, "/api/v1/admin/accounts?page=1&page_size=20&platform=openai", nil)
+ req := httptest.NewRequest(http.MethodGet, "/api/v1/admin/accounts?page=1&page_size=20&platform=openai&include_scheduler_score=1", nil)
router.ServeHTTP(rec, req)
require.Equal(t, http.StatusOK, rec.Code)
@@ -147,6 +147,43 @@ func TestAccountHandlerListReturnsSchedulerScoresPerGroup(t *testing.T) {
require.Greater(t, high.SchedulerScores[0].BaseScore, low.SchedulerScores[0].BaseScore)
}
+func TestAccountHandlerListSkipsSchedulerScoresByDefault(t *testing.T) {
+ router, adminSvc := setupAccountListRouter()
+ now := time.Now().UTC()
+ adminSvc.accounts = []service.Account{
+ {
+ ID: 110,
+ Name: "openai-account",
+ Platform: service.PlatformOpenAI,
+ Type: service.AccountTypeAPIKey,
+ Status: service.StatusActive,
+ Schedulable: true,
+ Concurrency: 10,
+ Priority: 1,
+ CreatedAt: now,
+ UpdatedAt: now,
+ },
+ }
+
+ rec := httptest.NewRecorder()
+ req := httptest.NewRequest(http.MethodGet, "/api/v1/admin/accounts?page=1&page_size=20&platform=openai", nil)
+ router.ServeHTTP(rec, req)
+
+ require.Equal(t, http.StatusOK, rec.Code)
+ require.Zero(t, adminSvc.schedulerScoreFilterCalls)
+ require.Zero(t, adminSvc.openAISchedulerScorePoolCalls)
+
+ var payload struct {
+ Data struct {
+ Items []map[string]any `json:"items"`
+ } `json:"data"`
+ }
+ require.NoError(t, json.Unmarshal(rec.Body.Bytes(), &payload))
+ require.Len(t, payload.Data.Items, 1)
+ require.NotContains(t, payload.Data.Items[0], "scheduler_score")
+ require.NotContains(t, payload.Data.Items[0], "scheduler_scores")
+}
+
func TestAccountHandlerListKeepsSchedulerScoreScopedToFilter(t *testing.T) {
router, adminSvc := setupAccountListRouter()
now := time.Now().UTC()
@@ -188,7 +225,7 @@ func TestAccountHandlerListKeepsSchedulerScoreScopedToFilter(t *testing.T) {
adminSvc.openAISchedulerScorePoolAccounts = []service.Account{visibleAccount, hiddenGroupPeer}
rec := httptest.NewRecorder()
- req := httptest.NewRequest(http.MethodGet, "/api/v1/admin/accounts?page=1&page_size=1&platform=openai", nil)
+ req := httptest.NewRequest(http.MethodGet, "/api/v1/admin/accounts?page=1&page_size=1&platform=openai&include_scheduler_score=1", nil)
router.ServeHTTP(rec, req)
require.Equal(t, http.StatusOK, rec.Code)
@@ -246,7 +283,7 @@ func TestAccountHandlerListSchedulerScoreIgnoresPagination(t *testing.T) {
adminSvc.accountSchedulerScoreFilterAccounts = []service.Account{visibleAccount, hiddenFilterPeer}
rec := httptest.NewRecorder()
- req := httptest.NewRequest(http.MethodGet, "/api/v1/admin/accounts?page=1&page_size=1&platform=openai", nil)
+ req := httptest.NewRequest(http.MethodGet, "/api/v1/admin/accounts?page=1&page_size=1&platform=openai&include_scheduler_score=1", nil)
router.ServeHTTP(rec, req)
require.Equal(t, http.StatusOK, rec.Code)
diff --git a/backend/internal/handler/admin/admin_service_stub_test.go b/backend/internal/handler/admin/admin_service_stub_test.go
index 187925e33a..7a7cbb473e 100644
--- a/backend/internal/handler/admin/admin_service_stub_test.go
+++ b/backend/internal/handler/admin/admin_service_stub_test.go
@@ -16,6 +16,8 @@ type stubAdminService struct {
accounts []service.Account
accountSchedulerScoreFilterAccounts []service.Account
openAISchedulerScorePoolAccounts []service.Account
+ schedulerScoreFilterCalls int
+ openAISchedulerScorePoolCalls int
proxies []service.Proxy
proxyCounts []service.ProxyWithAccountCount
redeems []service.RedeemCode
@@ -351,6 +353,7 @@ func (s *stubAdminService) ListAccounts(ctx context.Context, page, pageSize int,
}
func (s *stubAdminService) ListAccountsForSchedulerScoreFilter(_ context.Context, platform, accountType, status, search string, groupID int64, privacyMode string) ([]service.Account, error) {
+ s.schedulerScoreFilterCalls++
if s.accountSchedulerScoreFilterAccounts != nil {
return s.accountSchedulerScoreFilterAccounts, nil
}
@@ -358,6 +361,7 @@ func (s *stubAdminService) ListAccountsForSchedulerScoreFilter(_ context.Context
}
func (s *stubAdminService) ListOpenAISchedulableAccountsForSchedulerScore(_ context.Context, groupID *int64) ([]service.Account, error) {
+ s.openAISchedulerScorePoolCalls++
accounts := s.openAISchedulerScorePoolAccounts
if accounts == nil {
accounts = s.accounts
diff --git a/backend/internal/handler/admin/dashboard_handler.go b/backend/internal/handler/admin/dashboard_handler.go
index e9fbb630fa..b42b395d33 100644
--- a/backend/internal/handler/admin/dashboard_handler.go
+++ b/backend/internal/handler/admin/dashboard_handler.go
@@ -675,6 +675,9 @@ func (h *DashboardHandler) GetUserBreakdown(c *gin.Context) {
}
}
+ // sort_by 由 repo 层 allowlist 校验;非法值静默回退默认排序(actual_cost)。
+ dim.SortBy = strings.TrimSpace(c.Query("sort_by"))
+
limit := 50
if v := c.Query("limit"); v != "" {
if n, err := strconv.Atoi(v); err == nil && n > 0 && n <= 200 {
diff --git a/backend/internal/handler/admin/dashboard_handler_user_breakdown_test.go b/backend/internal/handler/admin/dashboard_handler_user_breakdown_test.go
index b3a05111b3..3065eee3c4 100644
--- a/backend/internal/handler/admin/dashboard_handler_user_breakdown_test.go
+++ b/backend/internal/handler/admin/dashboard_handler_user_breakdown_test.go
@@ -59,7 +59,21 @@ func TestGetUserBreakdown_GroupIDFilter(t *testing.T) {
require.Equal(t, int64(42), repo.capturedDim.GroupID)
require.Empty(t, repo.capturedDim.Model)
require.Empty(t, repo.capturedDim.Endpoint)
- require.Equal(t, 50, repo.capturedLimit) // default limit
+ require.Equal(t, 50, repo.capturedLimit) // default limit
+ require.Empty(t, repo.capturedDim.SortBy) // no sort_by => empty (repo falls back to default)
+}
+
+func TestGetUserBreakdown_SortBy(t *testing.T) {
+ repo := &userBreakdownRepoCapture{}
+ router := newUserBreakdownRouter(repo)
+
+ req := httptest.NewRequest(http.MethodGet,
+ "/admin/dashboard/user-breakdown?start_date=2026-03-01&end_date=2026-03-16&sort_by=total_tokens", nil)
+ w := httptest.NewRecorder()
+ router.ServeHTTP(w, req)
+
+ require.Equal(t, http.StatusOK, w.Code)
+ require.Equal(t, "total_tokens", repo.capturedDim.SortBy)
}
func TestGetUserBreakdown_ModelFilter(t *testing.T) {
diff --git a/backend/internal/handler/admin/group_handler.go b/backend/internal/handler/admin/group_handler.go
index 0a98ad6784..56a0b29ed0 100644
--- a/backend/internal/handler/admin/group_handler.go
+++ b/backend/internal/handler/admin/group_handler.go
@@ -93,8 +93,13 @@ type CreateGroupRequest struct {
MonthlyLimitUSD optionalLimitField `json:"monthly_limit_usd"`
// 图片生成计费配置(antigravity 和 gemini 平台使用,负数表示清除配置)
AllowImageGeneration bool `json:"allow_image_generation"`
+ AllowBatchImageGeneration bool `json:"allow_batch_image_generation"`
ImageRateIndependent bool `json:"image_rate_independent"`
ImageRateMultiplier *float64 `json:"image_rate_multiplier"`
+ BatchImageDiscountMultiplier *float64 `json:"batch_image_discount_multiplier"`
+ BatchImageHoldMultiplier *float64 `json:"batch_image_hold_multiplier"`
+ VideoRateIndependent bool `json:"video_rate_independent"`
+ VideoRateMultiplier *float64 `json:"video_rate_multiplier"`
PeakRateEnabled bool `json:"peak_rate_enabled"`
PeakStart string `json:"peak_start"`
PeakEnd string `json:"peak_end"`
@@ -102,6 +107,9 @@ type CreateGroupRequest struct {
ImagePrice1K *float64 `json:"image_price_1k"`
ImagePrice2K *float64 `json:"image_price_2k"`
ImagePrice4K *float64 `json:"image_price_4k"`
+ VideoPrice480P *float64 `json:"video_price_480p"`
+ VideoPrice720P *float64 `json:"video_price_720p"`
+ VideoPrice1080P *float64 `json:"video_price_1080p"`
ClaudeCodeOnly bool `json:"claude_code_only"`
FallbackGroupID *int64 `json:"fallback_group_id"`
FallbackGroupIDOnInvalidRequest *int64 `json:"fallback_group_id_on_invalid_request"`
@@ -138,8 +146,13 @@ type UpdateGroupRequest struct {
MonthlyLimitUSD optionalLimitField `json:"monthly_limit_usd"`
// 图片生成计费配置(antigravity 和 gemini 平台使用,负数表示清除配置)
AllowImageGeneration *bool `json:"allow_image_generation"`
+ AllowBatchImageGeneration *bool `json:"allow_batch_image_generation"`
ImageRateIndependent *bool `json:"image_rate_independent"`
ImageRateMultiplier *float64 `json:"image_rate_multiplier"`
+ BatchImageDiscountMultiplier *float64 `json:"batch_image_discount_multiplier"`
+ BatchImageHoldMultiplier *float64 `json:"batch_image_hold_multiplier"`
+ VideoRateIndependent *bool `json:"video_rate_independent"`
+ VideoRateMultiplier *float64 `json:"video_rate_multiplier"`
PeakRateEnabled *bool `json:"peak_rate_enabled"`
PeakStart *string `json:"peak_start"`
PeakEnd *string `json:"peak_end"`
@@ -147,6 +160,9 @@ type UpdateGroupRequest struct {
ImagePrice1K *float64 `json:"image_price_1k"`
ImagePrice2K *float64 `json:"image_price_2k"`
ImagePrice4K *float64 `json:"image_price_4k"`
+ VideoPrice480P *float64 `json:"video_price_480p"`
+ VideoPrice720P *float64 `json:"video_price_720p"`
+ VideoPrice1080P *float64 `json:"video_price_1080p"`
ClaudeCodeOnly *bool `json:"claude_code_only"`
FallbackGroupID *int64 `json:"fallback_group_id"`
FallbackGroupIDOnInvalidRequest *int64 `json:"fallback_group_id_on_invalid_request"`
@@ -301,8 +317,13 @@ func (h *GroupHandler) Create(c *gin.Context) {
WeeklyLimitUSD: req.WeeklyLimitUSD.ToServiceInput(),
MonthlyLimitUSD: req.MonthlyLimitUSD.ToServiceInput(),
AllowImageGeneration: req.AllowImageGeneration,
+ AllowBatchImageGeneration: req.AllowBatchImageGeneration,
ImageRateIndependent: req.ImageRateIndependent,
ImageRateMultiplier: req.ImageRateMultiplier,
+ BatchImageDiscountMultiplier: req.BatchImageDiscountMultiplier,
+ BatchImageHoldMultiplier: req.BatchImageHoldMultiplier,
+ VideoRateIndependent: req.VideoRateIndependent,
+ VideoRateMultiplier: req.VideoRateMultiplier,
PeakRateEnabled: req.PeakRateEnabled,
PeakStart: req.PeakStart,
PeakEnd: req.PeakEnd,
@@ -310,6 +331,9 @@ func (h *GroupHandler) Create(c *gin.Context) {
ImagePrice1K: req.ImagePrice1K,
ImagePrice2K: req.ImagePrice2K,
ImagePrice4K: req.ImagePrice4K,
+ VideoPrice480P: req.VideoPrice480P,
+ VideoPrice720P: req.VideoPrice720P,
+ VideoPrice1080P: req.VideoPrice1080P,
ClaudeCodeOnly: req.ClaudeCodeOnly,
FallbackGroupID: req.FallbackGroupID,
FallbackGroupIDOnInvalidRequest: req.FallbackGroupIDOnInvalidRequest,
@@ -361,8 +385,13 @@ func (h *GroupHandler) Update(c *gin.Context) {
WeeklyLimitUSD: req.WeeklyLimitUSD.ToServiceInput(),
MonthlyLimitUSD: req.MonthlyLimitUSD.ToServiceInput(),
AllowImageGeneration: req.AllowImageGeneration,
+ AllowBatchImageGeneration: req.AllowBatchImageGeneration,
ImageRateIndependent: req.ImageRateIndependent,
ImageRateMultiplier: req.ImageRateMultiplier,
+ BatchImageDiscountMultiplier: req.BatchImageDiscountMultiplier,
+ BatchImageHoldMultiplier: req.BatchImageHoldMultiplier,
+ VideoRateIndependent: req.VideoRateIndependent,
+ VideoRateMultiplier: req.VideoRateMultiplier,
PeakRateEnabled: req.PeakRateEnabled,
PeakStart: req.PeakStart,
PeakEnd: req.PeakEnd,
@@ -370,6 +399,9 @@ func (h *GroupHandler) Update(c *gin.Context) {
ImagePrice1K: req.ImagePrice1K,
ImagePrice2K: req.ImagePrice2K,
ImagePrice4K: req.ImagePrice4K,
+ VideoPrice480P: req.VideoPrice480P,
+ VideoPrice720P: req.VideoPrice720P,
+ VideoPrice1080P: req.VideoPrice1080P,
ClaudeCodeOnly: req.ClaudeCodeOnly,
FallbackGroupID: req.FallbackGroupID,
FallbackGroupIDOnInvalidRequest: req.FallbackGroupIDOnInvalidRequest,
diff --git a/backend/internal/handler/admin/setting_handler.go b/backend/internal/handler/admin/setting_handler.go
index 529e46c575..1d506f505b 100644
--- a/backend/internal/handler/admin/setting_handler.go
+++ b/backend/internal/handler/admin/setting_handler.go
@@ -1,21 +1,16 @@
package admin
import (
- "context"
"crypto/rand"
"encoding/hex"
"encoding/json"
- "errors"
"fmt"
"log/slog"
- "net/http"
"regexp"
"strings"
- "github.com/Wei-Shaw/sub2api/internal/config"
"github.com/Wei-Shaw/sub2api/internal/handler/dto"
"github.com/Wei-Shaw/sub2api/internal/pkg/response"
- "github.com/Wei-Shaw/sub2api/internal/server/middleware"
"github.com/Wei-Shaw/sub2api/internal/service"
"github.com/gin-gonic/gin"
@@ -415,2556 +410,6 @@ func loginAgreementDocumentsToService(items []dto.LoginAgreementDocument) []serv
return result
}
-// UpdateSettingsRequest 更新设置请求
-type UpdateSettingsRequest struct {
- // 注册设置
- RegistrationEnabled bool `json:"registration_enabled"`
- EmailVerifyEnabled bool `json:"email_verify_enabled"`
- RegistrationEmailSuffixWhitelist []string `json:"registration_email_suffix_whitelist"`
- PromoCodeEnabled bool `json:"promo_code_enabled"`
- PasswordResetEnabled bool `json:"password_reset_enabled"`
- FrontendURL string `json:"frontend_url"`
- InvitationCodeEnabled bool `json:"invitation_code_enabled"`
- TotpEnabled bool `json:"totp_enabled"` // TOTP 双因素认证
- LoginAgreementEnabled bool `json:"login_agreement_enabled"`
- LoginAgreementMode string `json:"login_agreement_mode"`
- LoginAgreementUpdatedAt string `json:"login_agreement_updated_at"`
- LoginAgreementDocuments []dto.LoginAgreementDocument `json:"login_agreement_documents"`
-
- // 邮件服务设置
- SMTPHost string `json:"smtp_host"`
- SMTPPort int `json:"smtp_port"`
- SMTPUsername string `json:"smtp_username"`
- SMTPPassword string `json:"smtp_password"`
- SMTPFrom string `json:"smtp_from_email"`
- SMTPFromName string `json:"smtp_from_name"`
- SMTPUseTLS bool `json:"smtp_use_tls"`
-
- // Cloudflare Turnstile 设置
- TurnstileEnabled bool `json:"turnstile_enabled"`
- TurnstileSiteKey string `json:"turnstile_site_key"`
- TurnstileSecretKey string `json:"turnstile_secret_key"`
-
- // API Key IP 访问控制设置
- APIKeyACLTrustForwardedIP *bool `json:"api_key_acl_trust_forwarded_ip"`
-
- // LinuxDo Connect OAuth 登录
- LinuxDoConnectEnabled bool `json:"linuxdo_connect_enabled"`
- LinuxDoConnectClientID string `json:"linuxdo_connect_client_id"`
- LinuxDoConnectClientSecret string `json:"linuxdo_connect_client_secret"`
- LinuxDoConnectRedirectURL string `json:"linuxdo_connect_redirect_url"`
-
- // DingTalk Connect OAuth 登录
- DingTalkConnectEnabled bool `json:"dingtalk_connect_enabled"`
- DingTalkConnectClientID string `json:"dingtalk_connect_client_id"`
- DingTalkConnectClientSecret string `json:"dingtalk_connect_client_secret"`
- DingTalkConnectRedirectURL string `json:"dingtalk_connect_redirect_url"`
- DingTalkConnectCorpRestrictionPolicy string `json:"dingtalk_connect_corp_restriction_policy"`
- DingTalkConnectInternalCorpID string `json:"dingtalk_connect_internal_corp_id"`
- DingTalkConnectBypassRegistration bool `json:"dingtalk_connect_bypass_registration"`
- DingTalkConnectSyncCorpEmail bool `json:"dingtalk_connect_sync_corp_email"`
- DingTalkConnectSyncDisplayName bool `json:"dingtalk_connect_sync_display_name"`
- DingTalkConnectSyncDept bool `json:"dingtalk_connect_sync_dept"`
- DingTalkConnectSyncCorpEmailAttrKey string `json:"dingtalk_connect_sync_corp_email_attr_key"`
- DingTalkConnectSyncDisplayNameAttrKey string `json:"dingtalk_connect_sync_display_name_attr_key"`
- DingTalkConnectSyncDeptAttrKey string `json:"dingtalk_connect_sync_dept_attr_key"`
- DingTalkConnectSyncCorpEmailAttrName string `json:"dingtalk_connect_sync_corp_email_attr_name"`
- DingTalkConnectSyncDisplayNameAttrName string `json:"dingtalk_connect_sync_display_name_attr_name"`
- DingTalkConnectSyncDeptAttrName string `json:"dingtalk_connect_sync_dept_attr_name"`
-
- // WeChat Connect OAuth 登录
- WeChatConnectEnabled bool `json:"wechat_connect_enabled"`
- WeChatConnectAppID string `json:"wechat_connect_app_id"`
- WeChatConnectAppSecret string `json:"wechat_connect_app_secret"`
- WeChatConnectOpenAppID string `json:"wechat_connect_open_app_id"`
- WeChatConnectOpenAppSecret string `json:"wechat_connect_open_app_secret"`
- WeChatConnectMPAppID string `json:"wechat_connect_mp_app_id"`
- WeChatConnectMPAppSecret string `json:"wechat_connect_mp_app_secret"`
- WeChatConnectMobileAppID string `json:"wechat_connect_mobile_app_id"`
- WeChatConnectMobileAppSecret string `json:"wechat_connect_mobile_app_secret"`
- WeChatConnectOpenEnabled bool `json:"wechat_connect_open_enabled"`
- WeChatConnectMPEnabled bool `json:"wechat_connect_mp_enabled"`
- WeChatConnectMobileEnabled bool `json:"wechat_connect_mobile_enabled"`
- WeChatConnectMode string `json:"wechat_connect_mode"`
- WeChatConnectScopes string `json:"wechat_connect_scopes"`
- WeChatConnectRedirectURL string `json:"wechat_connect_redirect_url"`
- WeChatConnectFrontendRedirectURL string `json:"wechat_connect_frontend_redirect_url"`
-
- // Generic OIDC OAuth 登录
- OIDCConnectEnabled bool `json:"oidc_connect_enabled"`
- OIDCConnectProviderName string `json:"oidc_connect_provider_name"`
- OIDCConnectClientID string `json:"oidc_connect_client_id"`
- OIDCConnectClientSecret string `json:"oidc_connect_client_secret"`
- OIDCConnectIssuerURL string `json:"oidc_connect_issuer_url"`
- OIDCConnectDiscoveryURL string `json:"oidc_connect_discovery_url"`
- OIDCConnectAuthorizeURL string `json:"oidc_connect_authorize_url"`
- OIDCConnectTokenURL string `json:"oidc_connect_token_url"`
- OIDCConnectUserInfoURL string `json:"oidc_connect_userinfo_url"`
- OIDCConnectJWKSURL string `json:"oidc_connect_jwks_url"`
- OIDCConnectScopes string `json:"oidc_connect_scopes"`
- OIDCConnectRedirectURL string `json:"oidc_connect_redirect_url"`
- OIDCConnectFrontendRedirectURL string `json:"oidc_connect_frontend_redirect_url"`
- OIDCConnectTokenAuthMethod string `json:"oidc_connect_token_auth_method"`
- OIDCConnectUsePKCE *bool `json:"oidc_connect_use_pkce"`
- OIDCConnectValidateIDToken *bool `json:"oidc_connect_validate_id_token"`
- OIDCConnectAllowedSigningAlgs string `json:"oidc_connect_allowed_signing_algs"`
- OIDCConnectClockSkewSeconds int `json:"oidc_connect_clock_skew_seconds"`
- OIDCConnectRequireEmailVerified bool `json:"oidc_connect_require_email_verified"`
- OIDCConnectUserInfoEmailPath string `json:"oidc_connect_userinfo_email_path"`
- OIDCConnectUserInfoIDPath string `json:"oidc_connect_userinfo_id_path"`
- OIDCConnectUserInfoUsernamePath string `json:"oidc_connect_userinfo_username_path"`
-
- GitHubOAuthEnabled bool `json:"github_oauth_enabled"`
- GitHubOAuthClientID string `json:"github_oauth_client_id"`
- GitHubOAuthClientSecret string `json:"github_oauth_client_secret"`
- GitHubOAuthRedirectURL string `json:"github_oauth_redirect_url"`
- GitHubOAuthFrontendRedirectURL string `json:"github_oauth_frontend_redirect_url"`
- GoogleOAuthEnabled bool `json:"google_oauth_enabled"`
- GoogleOAuthClientID string `json:"google_oauth_client_id"`
- GoogleOAuthClientSecret string `json:"google_oauth_client_secret"`
- GoogleOAuthRedirectURL string `json:"google_oauth_redirect_url"`
- GoogleOAuthFrontendRedirectURL string `json:"google_oauth_frontend_redirect_url"`
-
- // OEM设置
- SiteName string `json:"site_name"`
- SiteLogo string `json:"site_logo"`
- SiteSubtitle string `json:"site_subtitle"`
- APIBaseURL string `json:"api_base_url"`
- ContactInfo string `json:"contact_info"`
- DocURL string `json:"doc_url"`
- HomeContent string `json:"home_content"`
- HideCcsImportButton bool `json:"hide_ccs_import_button"`
- PurchaseSubscriptionEnabled *bool `json:"purchase_subscription_enabled"`
- PurchaseSubscriptionURL *string `json:"purchase_subscription_url"`
- TableDefaultPageSize int `json:"table_default_page_size"`
- TablePageSizeOptions []int `json:"table_page_size_options"`
- CustomMenuItems *[]dto.CustomMenuItem `json:"custom_menu_items"`
- CustomEndpoints *[]dto.CustomEndpoint `json:"custom_endpoints"`
-
- // 默认配置
- DefaultConcurrency int `json:"default_concurrency"`
- DefaultBalance float64 `json:"default_balance"`
- AffiliateRebateRate *float64 `json:"affiliate_rebate_rate"`
- AffiliateRebateFreezeHours *int `json:"affiliate_rebate_freeze_hours"`
- AffiliateRebateDurationDays *int `json:"affiliate_rebate_duration_days"`
- AffiliateRebatePerInviteeCap *float64 `json:"affiliate_rebate_per_invitee_cap"`
- DefaultUserRPMLimit int `json:"default_user_rpm_limit"`
- DefaultSubscriptions []dto.DefaultSubscriptionSetting `json:"default_subscriptions"`
- AuthSourceDefaultEmailBalance *float64 `json:"auth_source_default_email_balance"`
- AuthSourceDefaultEmailConcurrency *int `json:"auth_source_default_email_concurrency"`
- AuthSourceDefaultEmailSubscriptions *[]dto.DefaultSubscriptionSetting `json:"auth_source_default_email_subscriptions"`
- AuthSourceDefaultEmailGrantOnSignup *bool `json:"auth_source_default_email_grant_on_signup"`
- AuthSourceDefaultEmailGrantOnFirstBind *bool `json:"auth_source_default_email_grant_on_first_bind"`
- AuthSourceDefaultLinuxDoBalance *float64 `json:"auth_source_default_linuxdo_balance"`
- AuthSourceDefaultLinuxDoConcurrency *int `json:"auth_source_default_linuxdo_concurrency"`
- AuthSourceDefaultLinuxDoSubscriptions *[]dto.DefaultSubscriptionSetting `json:"auth_source_default_linuxdo_subscriptions"`
- AuthSourceDefaultLinuxDoGrantOnSignup *bool `json:"auth_source_default_linuxdo_grant_on_signup"`
- AuthSourceDefaultLinuxDoGrantOnFirstBind *bool `json:"auth_source_default_linuxdo_grant_on_first_bind"`
- AuthSourceDefaultOIDCBalance *float64 `json:"auth_source_default_oidc_balance"`
- AuthSourceDefaultOIDCConcurrency *int `json:"auth_source_default_oidc_concurrency"`
- AuthSourceDefaultOIDCSubscriptions *[]dto.DefaultSubscriptionSetting `json:"auth_source_default_oidc_subscriptions"`
- AuthSourceDefaultOIDCGrantOnSignup *bool `json:"auth_source_default_oidc_grant_on_signup"`
- AuthSourceDefaultOIDCGrantOnFirstBind *bool `json:"auth_source_default_oidc_grant_on_first_bind"`
- AuthSourceDefaultWeChatBalance *float64 `json:"auth_source_default_wechat_balance"`
- AuthSourceDefaultWeChatConcurrency *int `json:"auth_source_default_wechat_concurrency"`
- AuthSourceDefaultWeChatSubscriptions *[]dto.DefaultSubscriptionSetting `json:"auth_source_default_wechat_subscriptions"`
- AuthSourceDefaultWeChatGrantOnSignup *bool `json:"auth_source_default_wechat_grant_on_signup"`
- AuthSourceDefaultWeChatGrantOnFirstBind *bool `json:"auth_source_default_wechat_grant_on_first_bind"`
- AuthSourceDefaultGitHubBalance *float64 `json:"auth_source_default_github_balance"`
- AuthSourceDefaultGitHubConcurrency *int `json:"auth_source_default_github_concurrency"`
- AuthSourceDefaultGitHubSubscriptions *[]dto.DefaultSubscriptionSetting `json:"auth_source_default_github_subscriptions"`
- AuthSourceDefaultGitHubGrantOnSignup *bool `json:"auth_source_default_github_grant_on_signup"`
- AuthSourceDefaultGitHubGrantOnFirstBind *bool `json:"auth_source_default_github_grant_on_first_bind"`
- AuthSourceDefaultGoogleBalance *float64 `json:"auth_source_default_google_balance"`
- AuthSourceDefaultGoogleConcurrency *int `json:"auth_source_default_google_concurrency"`
- AuthSourceDefaultGoogleSubscriptions *[]dto.DefaultSubscriptionSetting `json:"auth_source_default_google_subscriptions"`
- AuthSourceDefaultGoogleGrantOnSignup *bool `json:"auth_source_default_google_grant_on_signup"`
- AuthSourceDefaultGoogleGrantOnFirstBind *bool `json:"auth_source_default_google_grant_on_first_bind"`
- AuthSourceDefaultDingTalkBalance *float64 `json:"auth_source_default_dingtalk_balance"`
- AuthSourceDefaultDingTalkConcurrency *int `json:"auth_source_default_dingtalk_concurrency"`
- AuthSourceDefaultDingTalkSubscriptions *[]dto.DefaultSubscriptionSetting `json:"auth_source_default_dingtalk_subscriptions"`
- AuthSourceDefaultDingTalkGrantOnSignup *bool `json:"auth_source_default_dingtalk_grant_on_signup"`
- AuthSourceDefaultDingTalkGrantOnFirstBind *bool `json:"auth_source_default_dingtalk_grant_on_first_bind"`
- ForceEmailOnThirdPartySignup *bool `json:"force_email_on_third_party_signup"`
-
- // Model fallback configuration
- EnableModelFallback bool `json:"enable_model_fallback"`
- FallbackModelAnthropic string `json:"fallback_model_anthropic"`
- FallbackModelOpenAI string `json:"fallback_model_openai"`
- FallbackModelGemini string `json:"fallback_model_gemini"`
- FallbackModelAntigravity string `json:"fallback_model_antigravity"`
-
- // Identity patch configuration (Claude -> Gemini)
- EnableIdentityPatch bool `json:"enable_identity_patch"`
- IdentityPatchPrompt string `json:"identity_patch_prompt"`
-
- // Ops monitoring (vNext)
- OpsMonitoringEnabled *bool `json:"ops_monitoring_enabled"`
- OpsRealtimeMonitoringEnabled *bool `json:"ops_realtime_monitoring_enabled"`
- OpsQueryModeDefault *string `json:"ops_query_mode_default"`
- OpsMetricsIntervalSeconds *int `json:"ops_metrics_interval_seconds"`
-
- MinClaudeCodeVersion string `json:"min_claude_code_version"`
- MaxClaudeCodeVersion string `json:"max_claude_code_version"`
-
- // 分组隔离
- AllowUngroupedKeyScheduling bool `json:"allow_ungrouped_key_scheduling"`
-
- // Backend Mode
- BackendModeEnabled bool `json:"backend_mode_enabled"`
-
- // Gateway forwarding behavior
- EnableFingerprintUnification *bool `json:"enable_fingerprint_unification"`
- EnableMetadataPassthrough *bool `json:"enable_metadata_passthrough"`
- EnableCCHSigning *bool `json:"enable_cch_signing"`
- EnableClaudeOAuthSystemPromptInjection *bool `json:"enable_claude_oauth_system_prompt_injection"`
- ClaudeOAuthSystemPrompt *string `json:"claude_oauth_system_prompt"`
- ClaudeOAuthSystemPromptBlocks *string `json:"claude_oauth_system_prompt_blocks"`
- EnableAnthropicCacheTTL1hInjection *bool `json:"enable_anthropic_cache_ttl_1h_injection"`
- RewriteMessageCacheControl *bool `json:"rewrite_message_cache_control"`
- EnableClientDatelineNormalization *bool `json:"enable_client_dateline_normalization"`
- AntigravityUserAgentVersion *string `json:"antigravity_user_agent_version"`
- OpenAICodexUserAgent *string `json:"openai_codex_user_agent"`
-
- // codex_cli_only 加固(global-only)
- MinCodexVersion string `json:"min_codex_version"`
- MaxCodexVersion string `json:"max_codex_version"`
- CodexCLIOnlyBlacklist string `json:"codex_cli_only_blacklist"`
- CodexCLIOnlyWhitelist string `json:"codex_cli_only_whitelist"`
- CodexCLIOnlyAllowAppServerClients *bool `json:"codex_cli_only_allow_app_server_clients"`
- CodexCLIOnlyEngineFingerprintSignals string `json:"codex_cli_only_engine_fingerprint_signals"`
-
- // Payment visible method routing
- PaymentVisibleMethodAlipaySource *string `json:"payment_visible_method_alipay_source"`
- PaymentVisibleMethodWxpaySource *string `json:"payment_visible_method_wxpay_source"`
- PaymentVisibleMethodAlipayEnabled *bool `json:"payment_visible_method_alipay_enabled"`
- PaymentVisibleMethodWxpayEnabled *bool `json:"payment_visible_method_wxpay_enabled"`
-
- // OpenAI account scheduling
- OpenAIAdvancedSchedulerEnabled *bool `json:"openai_advanced_scheduler_enabled"`
- OpenAIAdvancedSchedulerStickyWeightedEnabled *bool `json:"openai_advanced_scheduler_sticky_weighted_enabled"`
- OpenAIAdvancedSchedulerSubscriptionPriorityEnabled *bool `json:"openai_advanced_scheduler_subscription_priority_enabled"`
- OpenAIAdvancedSchedulerLBTopK *string `json:"openai_advanced_scheduler_lb_top_k"`
- OpenAIAdvancedSchedulerWeightPriority *string `json:"openai_advanced_scheduler_weight_priority"`
- OpenAIAdvancedSchedulerWeightLoad *string `json:"openai_advanced_scheduler_weight_load"`
- OpenAIAdvancedSchedulerWeightQueue *string `json:"openai_advanced_scheduler_weight_queue"`
- OpenAIAdvancedSchedulerWeightErrorRate *string `json:"openai_advanced_scheduler_weight_error_rate"`
- OpenAIAdvancedSchedulerWeightTTFT *string `json:"openai_advanced_scheduler_weight_ttft"`
- OpenAIAdvancedSchedulerWeightReset *string `json:"openai_advanced_scheduler_weight_reset"`
- OpenAIAdvancedSchedulerWeightQuotaHeadroom *string `json:"openai_advanced_scheduler_weight_quota_headroom"`
- OpenAIAdvancedSchedulerWeightPreviousResponse *string `json:"openai_advanced_scheduler_weight_previous_response"`
- OpenAIAdvancedSchedulerWeightSessionSticky *string `json:"openai_advanced_scheduler_weight_session_sticky"`
-
- // 余额不足提醒
- BalanceLowNotifyEnabled *bool `json:"balance_low_notify_enabled"`
- BalanceLowNotifyThreshold *float64 `json:"balance_low_notify_threshold"`
- BalanceLowNotifyRechargeURL *string `json:"balance_low_notify_recharge_url"`
- SubscriptionExpiryNotifyEnabled *bool `json:"subscription_expiry_notify_enabled"`
- AccountQuotaNotifyEnabled *bool `json:"account_quota_notify_enabled"`
- AccountQuotaNotifyEmails *[]dto.NotifyEmailEntry `json:"account_quota_notify_emails"`
-
- // Payment configuration (integrated into settings, full replace)
- PaymentEnabled *bool `json:"payment_enabled"`
- PaymentMinAmount *float64 `json:"payment_min_amount"`
- PaymentMaxAmount *float64 `json:"payment_max_amount"`
- PaymentDailyLimit *float64 `json:"payment_daily_limit"`
- PaymentOrderTimeoutMin *int `json:"payment_order_timeout_minutes"`
- PaymentMaxPendingOrders *int `json:"payment_max_pending_orders"`
- PaymentEnabledTypes []string `json:"payment_enabled_types"`
- PaymentBalanceDisabled *bool `json:"payment_balance_disabled"`
- PaymentBalanceRechargeMultiplier *float64 `json:"payment_balance_recharge_multiplier"`
- PaymentSubscriptionUSDToCNYRate *float64 `json:"payment_subscription_usd_to_cny_rate"`
- PaymentRechargeFeeRate *float64 `json:"payment_recharge_fee_rate"`
- PaymentLoadBalanceStrat *string `json:"payment_load_balance_strategy"`
- PaymentProductNamePrefix *string `json:"payment_product_name_prefix"`
- PaymentProductNameSuffix *string `json:"payment_product_name_suffix"`
- PaymentHelpImageURL *string `json:"payment_help_image_url"`
- PaymentHelpText *string `json:"payment_help_text"`
-
- // Cancel rate limit
- PaymentCancelRateLimitEnabled *bool `json:"payment_cancel_rate_limit_enabled"`
- PaymentCancelRateLimitMax *int `json:"payment_cancel_rate_limit_max"`
- PaymentCancelRateLimitWindow *int `json:"payment_cancel_rate_limit_window"`
- PaymentCancelRateLimitUnit *string `json:"payment_cancel_rate_limit_unit"`
- PaymentCancelRateLimitMode *string `json:"payment_cancel_rate_limit_window_mode"`
-
- // Force Alipay mobile clients to use QR code payment instead of mobile redirect
- PaymentAlipayForceQRCode *bool `json:"payment_alipay_force_qrcode"`
-
- // Channel Monitor feature switch
- ChannelMonitorEnabled *bool `json:"channel_monitor_enabled"`
- ChannelMonitorDefaultIntervalSeconds *int `json:"channel_monitor_default_interval_seconds"`
-
- // Available Channels feature switch (user-facing)
- AvailableChannelsEnabled *bool `json:"available_channels_enabled"`
-
- // Affiliate (邀请返利) feature switch
- AffiliateEnabled *bool `json:"affiliate_enabled"`
-
- // 风控中心功能开关
- RiskControlEnabled *bool `json:"risk_control_enabled"`
-
- // cyber 会话屏蔽开关 + TTL
- CyberSessionBlockEnabled *bool `json:"cyber_session_block_enabled"`
- CyberSessionBlockTTLSeconds *int `json:"cyber_session_block_ttl_seconds"`
-
- // OpenAI fast/flex policy (optional, only updated when provided)
- OpenAIFastPolicySettings *dto.OpenAIFastPolicySettings `json:"openai_fast_policy_settings,omitempty"`
-
- // 系统全局 platform quota 默认值(整体替换语义:nil = 不修改,non-nil = 整体覆盖)。
- DefaultPlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"default_platform_quotas"`
-
- // auth-source 层 platform quota 覆盖(override 语义:nil = 不修改,non-nil = 整体覆盖该 source 的 quota 配置)。
- AuthSourceEmailPlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"auth_source_default_email_platform_quotas"`
- AuthSourceLinuxDoPlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"auth_source_default_linuxdo_platform_quotas"`
- AuthSourceOIDCPlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"auth_source_default_oidc_platform_quotas"`
- AuthSourceWeChatPlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"auth_source_default_wechat_platform_quotas"`
- AuthSourceGitHubPlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"auth_source_default_github_platform_quotas"`
- AuthSourceGooglePlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"auth_source_default_google_platform_quotas"`
- AuthSourceDingTalkPlatformQuotas map[string]*service.DefaultPlatformQuotaSetting `json:"auth_source_default_dingtalk_platform_quotas"`
-
- AllowUserViewErrorRequests *bool `json:"allow_user_view_error_requests"`
-}
-
-// UpdateSettings 更新系统设置
-// PUT /api/v1/admin/settings
-func (h *SettingHandler) UpdateSettings(c *gin.Context) {
- var req UpdateSettingsRequest
- if err := c.ShouldBindJSON(&req); err != nil {
- response.BadRequest(c, "Invalid request: "+err.Error())
- return
- }
-
- previousSettings, err := h.settingService.GetAllSettings(c.Request.Context())
- if err != nil {
- response.ErrorFrom(c, err)
- return
- }
- previousAuthSourceDefaults, err := h.settingService.GetAuthSourceDefaultSettings(c.Request.Context())
- if err != nil {
- response.ErrorFrom(c, err)
- return
- }
-
- // 验证参数
- if req.DefaultConcurrency < 1 {
- req.DefaultConcurrency = 1
- }
- if req.DefaultBalance < 0 {
- req.DefaultBalance = 0
- }
- affiliateRebateRate := previousSettings.AffiliateRebateRate
- if req.AffiliateRebateRate != nil {
- affiliateRebateRate = *req.AffiliateRebateRate
- }
- if affiliateRebateRate < service.AffiliateRebateRateMin {
- affiliateRebateRate = service.AffiliateRebateRateMin
- }
- if affiliateRebateRate > service.AffiliateRebateRateMax {
- affiliateRebateRate = service.AffiliateRebateRateMax
- }
- affiliateRebateFreezeHours := previousSettings.AffiliateRebateFreezeHours
- if req.AffiliateRebateFreezeHours != nil {
- affiliateRebateFreezeHours = *req.AffiliateRebateFreezeHours
- }
- if affiliateRebateFreezeHours < 0 {
- affiliateRebateFreezeHours = service.AffiliateRebateFreezeHoursDefault
- }
- if affiliateRebateFreezeHours > service.AffiliateRebateFreezeHoursMax {
- affiliateRebateFreezeHours = service.AffiliateRebateFreezeHoursMax
- }
- affiliateRebateDurationDays := previousSettings.AffiliateRebateDurationDays
- if req.AffiliateRebateDurationDays != nil {
- affiliateRebateDurationDays = *req.AffiliateRebateDurationDays
- }
- if affiliateRebateDurationDays < 0 {
- affiliateRebateDurationDays = service.AffiliateRebateDurationDaysDefault
- }
- if affiliateRebateDurationDays > service.AffiliateRebateDurationDaysMax {
- affiliateRebateDurationDays = service.AffiliateRebateDurationDaysMax
- }
- affiliateRebatePerInviteeCap := previousSettings.AffiliateRebatePerInviteeCap
- if req.AffiliateRebatePerInviteeCap != nil {
- affiliateRebatePerInviteeCap = *req.AffiliateRebatePerInviteeCap
- }
- if affiliateRebatePerInviteeCap < 0 {
- affiliateRebatePerInviteeCap = service.AffiliateRebatePerInviteeCapDefault
- }
- // 通用表格配置:兼容旧客户端未传字段时保留当前值。
- if req.TableDefaultPageSize <= 0 {
- req.TableDefaultPageSize = previousSettings.TableDefaultPageSize
- }
- if req.TablePageSizeOptions == nil {
- req.TablePageSizeOptions = previousSettings.TablePageSizeOptions
- }
- req.SMTPHost = strings.TrimSpace(req.SMTPHost)
- req.SMTPUsername = strings.TrimSpace(req.SMTPUsername)
- req.SMTPPassword = strings.TrimSpace(req.SMTPPassword)
- req.SMTPFrom = strings.TrimSpace(req.SMTPFrom)
- req.SMTPFromName = strings.TrimSpace(req.SMTPFromName)
- if req.SMTPPort <= 0 {
- req.SMTPPort = 587
- }
- req.DefaultSubscriptions = normalizeDefaultSubscriptions(req.DefaultSubscriptions)
- req.AuthSourceDefaultEmailSubscriptions = normalizeOptionalDefaultSubscriptions(req.AuthSourceDefaultEmailSubscriptions)
- req.AuthSourceDefaultLinuxDoSubscriptions = normalizeOptionalDefaultSubscriptions(req.AuthSourceDefaultLinuxDoSubscriptions)
- req.AuthSourceDefaultOIDCSubscriptions = normalizeOptionalDefaultSubscriptions(req.AuthSourceDefaultOIDCSubscriptions)
- req.AuthSourceDefaultWeChatSubscriptions = normalizeOptionalDefaultSubscriptions(req.AuthSourceDefaultWeChatSubscriptions)
- req.AuthSourceDefaultDingTalkSubscriptions = normalizeOptionalDefaultSubscriptions(req.AuthSourceDefaultDingTalkSubscriptions)
-
- // SMTP 配置保护:如果请求中 smtp_host 为空但数据库中已有配置,则保留已有 SMTP 配置
- // 防止前端加载设置失败时空表单覆盖已保存的 SMTP 配置
- if req.SMTPHost == "" && previousSettings.SMTPHost != "" {
- req.SMTPHost = previousSettings.SMTPHost
- req.SMTPPort = previousSettings.SMTPPort
- req.SMTPUsername = previousSettings.SMTPUsername
- req.SMTPFrom = previousSettings.SMTPFrom
- req.SMTPFromName = previousSettings.SMTPFromName
- req.SMTPUseTLS = previousSettings.SMTPUseTLS
- }
-
- // Turnstile 参数验证
- if req.TurnstileEnabled {
- // 检查必填字段
- if req.TurnstileSiteKey == "" {
- response.BadRequest(c, "Turnstile Site Key is required when enabled")
- return
- }
- // 如果未提供 secret key,使用已保存的值(留空保留当前值)
- if req.TurnstileSecretKey == "" {
- if previousSettings.TurnstileSecretKey == "" {
- response.BadRequest(c, "Turnstile Secret Key is required when enabled")
- return
- }
- req.TurnstileSecretKey = previousSettings.TurnstileSecretKey
- }
-
- // 当 site_key 或 secret_key 任一变化时验证(避免配置错误导致无法登录)
- siteKeyChanged := previousSettings.TurnstileSiteKey != req.TurnstileSiteKey
- secretKeyChanged := previousSettings.TurnstileSecretKey != req.TurnstileSecretKey
- if siteKeyChanged || secretKeyChanged {
- if err := h.turnstileService.ValidateSecretKey(c.Request.Context(), req.TurnstileSecretKey); err != nil {
- response.ErrorFrom(c, err)
- return
- }
- }
- }
-
- // TOTP 双因素认证参数验证
- // 只有手动配置了加密密钥才允许启用 TOTP 功能
- if req.TotpEnabled && !previousSettings.TotpEnabled {
- // 尝试启用 TOTP,检查加密密钥是否已手动配置
- if !h.settingService.IsTotpEncryptionKeyConfigured() {
- response.BadRequest(c, "Cannot enable TOTP: TOTP_ENCRYPTION_KEY environment variable must be configured first. Generate a key with 'openssl rand -hex 32' and set it in your environment.")
- return
- }
- }
- loginAgreementMode := strings.ToLower(strings.TrimSpace(req.LoginAgreementMode))
- if loginAgreementMode == "" {
- loginAgreementMode = strings.ToLower(strings.TrimSpace(previousSettings.LoginAgreementMode))
- }
- switch loginAgreementMode {
- case "", "modal":
- loginAgreementMode = "modal"
- case "checkbox":
- default:
- response.BadRequest(c, "Login agreement mode must be modal or checkbox")
- return
- }
- loginAgreementUpdatedAt := strings.TrimSpace(req.LoginAgreementUpdatedAt)
- if loginAgreementUpdatedAt == "" {
- loginAgreementUpdatedAt = strings.TrimSpace(previousSettings.LoginAgreementUpdatedAt)
- }
- loginAgreementDocuments := loginAgreementDocumentsToService(req.LoginAgreementDocuments)
- if len(loginAgreementDocuments) == 0 {
- loginAgreementDocuments = previousSettings.LoginAgreementDocuments
- }
- for _, doc := range loginAgreementDocuments {
- if strings.TrimSpace(doc.Title) == "" {
- response.BadRequest(c, "Login agreement document title is required")
- return
- }
- if len(doc.Title) > 80 {
- response.BadRequest(c, "Login agreement document title is too long (max 80 characters)")
- return
- }
- if len(doc.ContentMD) > 200*1024 {
- response.BadRequest(c, "Login agreement document content is too large (max 200KB)")
- return
- }
- }
- if req.LoginAgreementEnabled && len(loginAgreementDocuments) == 0 {
- response.BadRequest(c, "Login agreement documents are required when enabled")
- return
- }
-
- // LinuxDo Connect 参数验证
- if req.LinuxDoConnectEnabled {
- req.LinuxDoConnectClientID = strings.TrimSpace(req.LinuxDoConnectClientID)
- req.LinuxDoConnectClientSecret = strings.TrimSpace(req.LinuxDoConnectClientSecret)
- req.LinuxDoConnectRedirectURL = strings.TrimSpace(req.LinuxDoConnectRedirectURL)
-
- if req.LinuxDoConnectClientID == "" {
- response.BadRequest(c, "LinuxDo Client ID is required when enabled")
- return
- }
- if req.LinuxDoConnectRedirectURL == "" {
- response.BadRequest(c, "LinuxDo Redirect URL is required when enabled")
- return
- }
- if err := config.ValidateAbsoluteHTTPURL(req.LinuxDoConnectRedirectURL); err != nil {
- response.BadRequest(c, "LinuxDo Redirect URL must be an absolute http(s) URL")
- return
- }
-
- // 如果未提供 client_secret,则保留现有值(如有)。
- if req.LinuxDoConnectClientSecret == "" {
- if previousSettings.LinuxDoConnectClientSecret == "" {
- response.BadRequest(c, "LinuxDo Client Secret is required when enabled")
- return
- }
- req.LinuxDoConnectClientSecret = previousSettings.LinuxDoConnectClientSecret
- }
- }
-
- // DingTalk Connect 参数验证
- // 防御性:任何写入路径上把已废弃的 corp_restriction_policy=whitelist 入参 coerce 为 none,
- // 避免任何直连 admin API 的客户端把死值写回 DB(前端 UI 已无此选项)。
- req.DingTalkConnectCorpRestrictionPolicy = service.CoerceDingTalkCorpPolicyForWrite(req.DingTalkConnectCorpRestrictionPolicy)
-
- if req.DingTalkConnectEnabled {
- req.DingTalkConnectClientID = strings.TrimSpace(req.DingTalkConnectClientID)
- req.DingTalkConnectClientSecret = strings.TrimSpace(req.DingTalkConnectClientSecret)
- req.DingTalkConnectRedirectURL = strings.TrimSpace(req.DingTalkConnectRedirectURL)
- req.DingTalkConnectCorpRestrictionPolicy = strings.TrimSpace(req.DingTalkConnectCorpRestrictionPolicy)
- req.DingTalkConnectInternalCorpID = strings.TrimSpace(req.DingTalkConnectInternalCorpID)
-
- if req.DingTalkConnectClientID == "" {
- response.BadRequest(c, "DingTalk Client ID is required when enabled")
- return
- }
- if req.DingTalkConnectRedirectURL == "" {
- response.BadRequest(c, "DingTalk Redirect URL is required when enabled")
- return
- }
- if err := config.ValidateAbsoluteHTTPURL(req.DingTalkConnectRedirectURL); err != nil {
- response.BadRequest(c, "DingTalk Redirect URL must be an absolute http(s) URL")
- return
- }
-
- // 如果未提供 client_secret,则保留现有值(如有)。
- if req.DingTalkConnectClientSecret == "" {
- if previousSettings.DingTalkConnectClientSecret == "" {
- response.BadRequest(c, "DingTalk Client Secret is required when enabled")
- return
- }
- req.DingTalkConnectClientSecret = previousSettings.DingTalkConnectClientSecret
- }
-
- // Corp 策略校验(V1/V4 fail-closed)
- dingTalkCfg := config.DingTalkConnectConfig{
- Enabled: true,
- DingTalkAppKind: "internal_app", // 硬编码:settings 层仅支持 internal_app
- AppType: "internal", // 对于 internal_only 策略的默认值
- CorpRestrictionPolicy: req.DingTalkConnectCorpRestrictionPolicy,
- InternalCorpID: req.DingTalkConnectInternalCorpID,
- }
- // 若未填 corp_restriction_policy,保留已有配置
- if dingTalkCfg.CorpRestrictionPolicy == "" {
- dingTalkCfg.CorpRestrictionPolicy = previousSettings.DingTalkConnectCorpRestrictionPolicy
- }
- // 对于 internal_only 策略,app_type 必须为 internal(V1 校验)
- if dingTalkCfg.CorpRestrictionPolicy == "internal_only" {
- dingTalkCfg.AppType = "internal"
- } else {
- dingTalkCfg.AppType = "public"
- }
- if err := config.ValidateDingTalkConfig(dingTalkCfg); err != nil {
- response.ErrorWithDetails(c, http.StatusBadRequest, err.Error(), mapDingTalkValidateError(err), nil)
- return
- }
-
- // bypass_registration 仅在 internal_only 模式下有意义;其它策略下强制为 false,
- // 防止 admin 在切换 policy 时把 bypass 残留在 DB 中(前端 UI 也已隐藏该开关)。
- if dingTalkCfg.CorpRestrictionPolicy != "internal_only" {
- req.DingTalkConnectBypassRegistration = false
- // 身份同步三开关同理:仅 internal_only 模式下有意义,其它策略强制 false。
- req.DingTalkConnectSyncCorpEmail = false
- req.DingTalkConnectSyncDisplayName = false
- req.DingTalkConnectSyncDept = false
- }
- // 身份同步目标 attr key:trimSpace + 空值 fallback 到默认值
- req.DingTalkConnectSyncCorpEmailAttrKey = strings.TrimSpace(req.DingTalkConnectSyncCorpEmailAttrKey)
- if req.DingTalkConnectSyncCorpEmailAttrKey == "" {
- req.DingTalkConnectSyncCorpEmailAttrKey = "dingtalk_email"
- }
- req.DingTalkConnectSyncDisplayNameAttrKey = strings.TrimSpace(req.DingTalkConnectSyncDisplayNameAttrKey)
- if req.DingTalkConnectSyncDisplayNameAttrKey == "" {
- req.DingTalkConnectSyncDisplayNameAttrKey = "dingtalk_name"
- }
- req.DingTalkConnectSyncDeptAttrKey = strings.TrimSpace(req.DingTalkConnectSyncDeptAttrKey)
- if req.DingTalkConnectSyncDeptAttrKey == "" {
- req.DingTalkConnectSyncDeptAttrKey = "dingtalk_department"
- }
- // 身份同步目标 attr 显示名称:trim + 空值 fallback 到默认中文名
- req.DingTalkConnectSyncCorpEmailAttrName = strings.TrimSpace(req.DingTalkConnectSyncCorpEmailAttrName)
- if req.DingTalkConnectSyncCorpEmailAttrName == "" {
- req.DingTalkConnectSyncCorpEmailAttrName = "钉钉企业邮箱"
- }
- req.DingTalkConnectSyncDisplayNameAttrName = strings.TrimSpace(req.DingTalkConnectSyncDisplayNameAttrName)
- if req.DingTalkConnectSyncDisplayNameAttrName == "" {
- req.DingTalkConnectSyncDisplayNameAttrName = "钉钉姓名"
- }
- req.DingTalkConnectSyncDeptAttrName = strings.TrimSpace(req.DingTalkConnectSyncDeptAttrName)
- if req.DingTalkConnectSyncDeptAttrName == "" {
- req.DingTalkConnectSyncDeptAttrName = "钉钉部门"
- }
- }
-
- if req.WeChatConnectEnabled {
- req.WeChatConnectAppID = strings.TrimSpace(req.WeChatConnectAppID)
- req.WeChatConnectAppSecret = strings.TrimSpace(req.WeChatConnectAppSecret)
- req.WeChatConnectOpenAppID = strings.TrimSpace(req.WeChatConnectOpenAppID)
- req.WeChatConnectOpenAppSecret = strings.TrimSpace(req.WeChatConnectOpenAppSecret)
- req.WeChatConnectMPAppID = strings.TrimSpace(req.WeChatConnectMPAppID)
- req.WeChatConnectMPAppSecret = strings.TrimSpace(req.WeChatConnectMPAppSecret)
- req.WeChatConnectMobileAppID = strings.TrimSpace(req.WeChatConnectMobileAppID)
- req.WeChatConnectMobileAppSecret = strings.TrimSpace(req.WeChatConnectMobileAppSecret)
- req.WeChatConnectMode = strings.ToLower(strings.TrimSpace(req.WeChatConnectMode))
- req.WeChatConnectScopes = strings.TrimSpace(req.WeChatConnectScopes)
- req.WeChatConnectRedirectURL = strings.TrimSpace(req.WeChatConnectRedirectURL)
- req.WeChatConnectFrontendRedirectURL = strings.TrimSpace(req.WeChatConnectFrontendRedirectURL)
- req.WeChatConnectAppID = strings.TrimSpace(firstNonEmpty(req.WeChatConnectAppID, previousSettings.WeChatConnectAppID))
- req.WeChatConnectRedirectURL = strings.TrimSpace(firstNonEmpty(req.WeChatConnectRedirectURL, previousSettings.WeChatConnectRedirectURL))
- req.WeChatConnectFrontendRedirectURL = strings.TrimSpace(firstNonEmpty(req.WeChatConnectFrontendRedirectURL, previousSettings.WeChatConnectFrontendRedirectURL))
- if req.WeChatConnectMode == "" {
- req.WeChatConnectMode = strings.ToLower(strings.TrimSpace(previousSettings.WeChatConnectMode))
- }
- if req.WeChatConnectScopes == "" {
- req.WeChatConnectScopes = strings.TrimSpace(previousSettings.WeChatConnectScopes)
- }
-
- if req.WeChatConnectMPEnabled && req.WeChatConnectMobileEnabled {
- response.BadRequest(c, "WeChat Official Account and Mobile App cannot be enabled at the same time")
- return
- }
- if req.WeChatConnectMode != "" {
- switch req.WeChatConnectMode {
- case "open", "mp", "mobile":
- default:
- response.BadRequest(c, "WeChat mode must be open, mp, or mobile")
- return
- }
- }
- if !req.WeChatConnectOpenEnabled && !req.WeChatConnectMPEnabled && !req.WeChatConnectMobileEnabled {
- switch req.WeChatConnectMode {
- case "mp":
- req.WeChatConnectMPEnabled = true
- case "mobile":
- req.WeChatConnectMobileEnabled = true
- default:
- req.WeChatConnectOpenEnabled = true
- }
- }
- if req.WeChatConnectMode == "" {
- if req.WeChatConnectMPEnabled {
- req.WeChatConnectMode = "mp"
- } else if req.WeChatConnectMobileEnabled {
- req.WeChatConnectMode = "mobile"
- } else {
- req.WeChatConnectMode = "open"
- }
- }
-
- req.WeChatConnectOpenAppID = strings.TrimSpace(firstNonEmpty(req.WeChatConnectOpenAppID, req.WeChatConnectAppID, previousSettings.WeChatConnectOpenAppID, previousSettings.WeChatConnectAppID))
- req.WeChatConnectMPAppID = strings.TrimSpace(firstNonEmpty(req.WeChatConnectMPAppID, req.WeChatConnectAppID, previousSettings.WeChatConnectMPAppID, previousSettings.WeChatConnectAppID))
- req.WeChatConnectMobileAppID = strings.TrimSpace(firstNonEmpty(req.WeChatConnectMobileAppID, req.WeChatConnectAppID, previousSettings.WeChatConnectMobileAppID, previousSettings.WeChatConnectAppID))
-
- if req.WeChatConnectOpenAppSecret == "" {
- req.WeChatConnectOpenAppSecret = strings.TrimSpace(firstNonEmpty(previousSettings.WeChatConnectOpenAppSecret, previousSettings.WeChatConnectAppSecret, req.WeChatConnectAppSecret))
- }
- if req.WeChatConnectMPAppSecret == "" {
- req.WeChatConnectMPAppSecret = strings.TrimSpace(firstNonEmpty(previousSettings.WeChatConnectMPAppSecret, previousSettings.WeChatConnectAppSecret, req.WeChatConnectAppSecret))
- }
- if req.WeChatConnectMobileAppSecret == "" {
- req.WeChatConnectMobileAppSecret = strings.TrimSpace(firstNonEmpty(previousSettings.WeChatConnectMobileAppSecret, previousSettings.WeChatConnectAppSecret, req.WeChatConnectAppSecret))
- }
- if req.WeChatConnectAppSecret == "" {
- req.WeChatConnectAppSecret = strings.TrimSpace(firstNonEmpty(req.WeChatConnectOpenAppSecret, req.WeChatConnectMPAppSecret, req.WeChatConnectMobileAppSecret, previousSettings.WeChatConnectAppSecret))
- }
-
- if req.WeChatConnectOpenEnabled {
- if req.WeChatConnectOpenAppID == "" {
- response.BadRequest(c, "WeChat PC App ID is required when enabled")
- return
- }
- if req.WeChatConnectOpenAppSecret == "" {
- response.BadRequest(c, "WeChat PC App Secret is required when enabled")
- return
- }
- }
- if req.WeChatConnectMPEnabled {
- if req.WeChatConnectMPAppID == "" {
- response.BadRequest(c, "WeChat Official Account App ID is required when enabled")
- return
- }
- if req.WeChatConnectMPAppSecret == "" {
- response.BadRequest(c, "WeChat Official Account App Secret is required when enabled")
- return
- }
- }
- if req.WeChatConnectMobileEnabled {
- if req.WeChatConnectMobileAppID == "" {
- response.BadRequest(c, "WeChat Mobile App ID is required when enabled")
- return
- }
- if req.WeChatConnectMobileAppSecret == "" {
- response.BadRequest(c, "WeChat Mobile App Secret is required when enabled")
- return
- }
- }
-
- if req.WeChatConnectScopes == "" {
- if req.WeChatConnectMPEnabled {
- req.WeChatConnectScopes = service.DefaultWeChatConnectScopesForMode("mp")
- } else {
- req.WeChatConnectScopes = service.DefaultWeChatConnectScopesForMode(req.WeChatConnectMode)
- }
- }
- if req.WeChatConnectOpenEnabled || req.WeChatConnectMPEnabled {
- if req.WeChatConnectRedirectURL == "" {
- response.BadRequest(c, "WeChat Redirect URL is required when web oauth is enabled")
- return
- }
- if err := config.ValidateAbsoluteHTTPURL(req.WeChatConnectRedirectURL); err != nil {
- response.BadRequest(c, "WeChat Redirect URL must be an absolute http(s) URL")
- return
- }
- if req.WeChatConnectFrontendRedirectURL == "" {
- req.WeChatConnectFrontendRedirectURL = "/auth/wechat/callback"
- }
- if err := config.ValidateFrontendRedirectURL(req.WeChatConnectFrontendRedirectURL); err != nil {
- response.BadRequest(c, "WeChat Frontend Redirect URL is invalid")
- return
- }
- }
- }
-
- // Generic OIDC 参数验证
- oidcUsePKCE, oidcValidateIDToken, err := h.settingService.OIDCSecurityWriteDefaults(c.Request.Context())
- if err != nil {
- response.ErrorFrom(c, err)
- return
- }
- if req.OIDCConnectEnabled {
- req.OIDCConnectProviderName = strings.TrimSpace(req.OIDCConnectProviderName)
- req.OIDCConnectClientID = strings.TrimSpace(req.OIDCConnectClientID)
- req.OIDCConnectClientSecret = strings.TrimSpace(req.OIDCConnectClientSecret)
- req.OIDCConnectIssuerURL = strings.TrimSpace(req.OIDCConnectIssuerURL)
- req.OIDCConnectDiscoveryURL = strings.TrimSpace(req.OIDCConnectDiscoveryURL)
- req.OIDCConnectAuthorizeURL = strings.TrimSpace(req.OIDCConnectAuthorizeURL)
- req.OIDCConnectTokenURL = strings.TrimSpace(req.OIDCConnectTokenURL)
- req.OIDCConnectUserInfoURL = strings.TrimSpace(req.OIDCConnectUserInfoURL)
- req.OIDCConnectJWKSURL = strings.TrimSpace(req.OIDCConnectJWKSURL)
- req.OIDCConnectScopes = strings.TrimSpace(req.OIDCConnectScopes)
- req.OIDCConnectRedirectURL = strings.TrimSpace(req.OIDCConnectRedirectURL)
- req.OIDCConnectFrontendRedirectURL = strings.TrimSpace(req.OIDCConnectFrontendRedirectURL)
- req.OIDCConnectTokenAuthMethod = strings.ToLower(strings.TrimSpace(req.OIDCConnectTokenAuthMethod))
- req.OIDCConnectAllowedSigningAlgs = strings.TrimSpace(req.OIDCConnectAllowedSigningAlgs)
- req.OIDCConnectUserInfoEmailPath = strings.TrimSpace(req.OIDCConnectUserInfoEmailPath)
- req.OIDCConnectUserInfoIDPath = strings.TrimSpace(req.OIDCConnectUserInfoIDPath)
- req.OIDCConnectUserInfoUsernamePath = strings.TrimSpace(req.OIDCConnectUserInfoUsernamePath)
- req.OIDCConnectProviderName = strings.TrimSpace(firstNonEmpty(req.OIDCConnectProviderName, previousSettings.OIDCConnectProviderName, "OIDC"))
- req.OIDCConnectClientID = strings.TrimSpace(firstNonEmpty(req.OIDCConnectClientID, previousSettings.OIDCConnectClientID))
- req.OIDCConnectIssuerURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectIssuerURL, previousSettings.OIDCConnectIssuerURL))
- req.OIDCConnectDiscoveryURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectDiscoveryURL, previousSettings.OIDCConnectDiscoveryURL))
- req.OIDCConnectAuthorizeURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectAuthorizeURL, previousSettings.OIDCConnectAuthorizeURL))
- req.OIDCConnectTokenURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectTokenURL, previousSettings.OIDCConnectTokenURL))
- req.OIDCConnectUserInfoURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectUserInfoURL, previousSettings.OIDCConnectUserInfoURL))
- req.OIDCConnectJWKSURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectJWKSURL, previousSettings.OIDCConnectJWKSURL))
- req.OIDCConnectScopes = strings.TrimSpace(firstNonEmpty(req.OIDCConnectScopes, previousSettings.OIDCConnectScopes, "openid email profile"))
- req.OIDCConnectRedirectURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectRedirectURL, previousSettings.OIDCConnectRedirectURL))
- req.OIDCConnectFrontendRedirectURL = strings.TrimSpace(firstNonEmpty(req.OIDCConnectFrontendRedirectURL, previousSettings.OIDCConnectFrontendRedirectURL, "/auth/oidc/callback"))
- req.OIDCConnectTokenAuthMethod = strings.ToLower(strings.TrimSpace(firstNonEmpty(req.OIDCConnectTokenAuthMethod, previousSettings.OIDCConnectTokenAuthMethod, "client_secret_post")))
- req.OIDCConnectAllowedSigningAlgs = strings.TrimSpace(firstNonEmpty(req.OIDCConnectAllowedSigningAlgs, previousSettings.OIDCConnectAllowedSigningAlgs, "RS256,ES256,PS256"))
- req.OIDCConnectUserInfoEmailPath = strings.TrimSpace(firstNonEmpty(req.OIDCConnectUserInfoEmailPath, previousSettings.OIDCConnectUserInfoEmailPath))
- req.OIDCConnectUserInfoIDPath = strings.TrimSpace(firstNonEmpty(req.OIDCConnectUserInfoIDPath, previousSettings.OIDCConnectUserInfoIDPath))
- req.OIDCConnectUserInfoUsernamePath = strings.TrimSpace(firstNonEmpty(req.OIDCConnectUserInfoUsernamePath, previousSettings.OIDCConnectUserInfoUsernamePath))
- if req.OIDCConnectUsePKCE != nil {
- oidcUsePKCE = *req.OIDCConnectUsePKCE
- }
- if req.OIDCConnectValidateIDToken != nil {
- oidcValidateIDToken = *req.OIDCConnectValidateIDToken
- }
- if req.OIDCConnectClockSkewSeconds == 0 {
- req.OIDCConnectClockSkewSeconds = previousSettings.OIDCConnectClockSkewSeconds
- if req.OIDCConnectClockSkewSeconds == 0 {
- req.OIDCConnectClockSkewSeconds = 120
- }
- }
-
- if req.OIDCConnectClientID == "" {
- response.BadRequest(c, "OIDC Client ID is required when enabled")
- return
- }
- if req.OIDCConnectIssuerURL == "" {
- response.BadRequest(c, "OIDC Issuer URL is required when enabled")
- return
- }
- if err := config.ValidateAbsoluteHTTPURL(req.OIDCConnectIssuerURL); err != nil {
- response.BadRequest(c, "OIDC Issuer URL must be an absolute http(s) URL")
- return
- }
- if req.OIDCConnectDiscoveryURL != "" {
- if err := config.ValidateAbsoluteHTTPURL(req.OIDCConnectDiscoveryURL); err != nil {
- response.BadRequest(c, "OIDC Discovery URL must be an absolute http(s) URL")
- return
- }
- }
- if req.OIDCConnectAuthorizeURL != "" {
- if err := config.ValidateAbsoluteHTTPURL(req.OIDCConnectAuthorizeURL); err != nil {
- response.BadRequest(c, "OIDC Authorize URL must be an absolute http(s) URL")
- return
- }
- }
- if req.OIDCConnectTokenURL != "" {
- if err := config.ValidateAbsoluteHTTPURL(req.OIDCConnectTokenURL); err != nil {
- response.BadRequest(c, "OIDC Token URL must be an absolute http(s) URL")
- return
- }
- }
- if req.OIDCConnectUserInfoURL != "" {
- if err := config.ValidateAbsoluteHTTPURL(req.OIDCConnectUserInfoURL); err != nil {
- response.BadRequest(c, "OIDC UserInfo URL must be an absolute http(s) URL")
- return
- }
- }
- if req.OIDCConnectRedirectURL == "" {
- response.BadRequest(c, "OIDC Redirect URL is required when enabled")
- return
- }
- if err := config.ValidateAbsoluteHTTPURL(req.OIDCConnectRedirectURL); err != nil {
- response.BadRequest(c, "OIDC Redirect URL must be an absolute http(s) URL")
- return
- }
- if req.OIDCConnectFrontendRedirectURL == "" {
- response.BadRequest(c, "OIDC Frontend Redirect URL is required when enabled")
- return
- }
- if err := config.ValidateFrontendRedirectURL(req.OIDCConnectFrontendRedirectURL); err != nil {
- response.BadRequest(c, "OIDC Frontend Redirect URL is invalid")
- return
- }
- if !scopesContainOpenID(req.OIDCConnectScopes) {
- response.BadRequest(c, "OIDC scopes must contain openid")
- return
- }
- switch req.OIDCConnectTokenAuthMethod {
- case "", "client_secret_post", "client_secret_basic", "none":
- default:
- response.BadRequest(c, "OIDC Token Auth Method must be one of client_secret_post/client_secret_basic/none")
- return
- }
- if req.OIDCConnectClockSkewSeconds < 0 || req.OIDCConnectClockSkewSeconds > 600 {
- response.BadRequest(c, "OIDC clock skew seconds must be between 0 and 600")
- return
- }
- if oidcValidateIDToken && req.OIDCConnectAllowedSigningAlgs == "" {
- response.BadRequest(c, "OIDC Allowed Signing Algs is required when validate_id_token=true")
- return
- }
- if req.OIDCConnectJWKSURL != "" {
- if err := config.ValidateAbsoluteHTTPURL(req.OIDCConnectJWKSURL); err != nil {
- response.BadRequest(c, "OIDC JWKS URL must be an absolute http(s) URL")
- return
- }
- }
- if req.OIDCConnectTokenAuthMethod == "" || req.OIDCConnectTokenAuthMethod == "client_secret_post" || req.OIDCConnectTokenAuthMethod == "client_secret_basic" {
- if req.OIDCConnectClientSecret == "" {
- if previousSettings.OIDCConnectClientSecret == "" {
- response.BadRequest(c, "OIDC Client Secret is required when enabled")
- return
- }
- req.OIDCConnectClientSecret = previousSettings.OIDCConnectClientSecret
- }
- }
- }
-
- // “购买订阅”页面配置验证
- purchaseEnabled := previousSettings.PurchaseSubscriptionEnabled
- if req.PurchaseSubscriptionEnabled != nil {
- purchaseEnabled = *req.PurchaseSubscriptionEnabled
- }
- purchaseURL := previousSettings.PurchaseSubscriptionURL
- if req.PurchaseSubscriptionURL != nil {
- purchaseURL = strings.TrimSpace(*req.PurchaseSubscriptionURL)
- }
-
- // - 启用时要求 URL 合法且非空
- // - 禁用时允许为空;若提供了 URL 也做基本校验,避免误配置
- if purchaseEnabled {
- if purchaseURL == "" {
- response.BadRequest(c, "Purchase Subscription URL is required when enabled")
- return
- }
- if err := config.ValidateAbsoluteHTTPURL(purchaseURL); err != nil {
- response.BadRequest(c, "Purchase Subscription URL must be an absolute http(s) URL")
- return
- }
- } else if purchaseURL != "" {
- if err := config.ValidateAbsoluteHTTPURL(purchaseURL); err != nil {
- response.BadRequest(c, "Purchase Subscription URL must be an absolute http(s) URL")
- return
- }
- }
-
- // Frontend URL 验证
- req.FrontendURL = strings.TrimSpace(req.FrontendURL)
- if req.FrontendURL != "" {
- if err := config.ValidateAbsoluteHTTPURL(req.FrontendURL); err != nil {
- response.BadRequest(c, "Frontend URL must be an absolute http(s) URL")
- return
- }
- }
-
- // 自定义菜单项验证
- const (
- maxCustomMenuItems = 20
- maxMenuItemLabelLen = 50
- maxMenuItemURLLen = 2048
- maxMenuItemIconSVGLen = 10 * 1024 // 10KB
- maxMenuItemIDLen = 32
- )
-
- customMenuJSON := previousSettings.CustomMenuItems
- if req.CustomMenuItems != nil {
- items := *req.CustomMenuItems
- if len(items) > maxCustomMenuItems {
- response.BadRequest(c, "Too many custom menu items (max 20)")
- return
- }
- for i, item := range items {
- if strings.TrimSpace(item.Label) == "" {
- response.BadRequest(c, "Custom menu item label is required")
- return
- }
- if len(item.Label) > maxMenuItemLabelLen {
- response.BadRequest(c, "Custom menu item label is too long (max 50 characters)")
- return
- }
- urlTrimmed := strings.TrimSpace(item.URL)
- if strings.HasPrefix(urlTrimmed, "md:") {
- // Markdown page mode: URL = "md: