feat(sora): 新增 Sora 平台支持并修复高危安全和性能问题

新增功能:
- 新增 Sora 账号管理和 OAuth 认证
- 新增 Sora 视频/图片生成 API 网关
- 新增 Sora 任务调度和缓存机制
- 新增 Sora 使用统计和计费支持
- 前端增加 Sora 平台配置界面

安全修复(代码审核):
- [SEC-001] 限制媒体下载响应体大小(图片 20MB、视频 200MB),防止 DoS 攻击
- [SEC-002] 限制 SDK API 响应大小(1MB),防止内存耗尽
- [SEC-003] 修复 SSRF 风险,添加 URL 验证并强制使用代理配置

BUG 修复(代码审核):
- [BUG-001] 修复 for 循环内 defer 累积导致的资源泄漏
- [BUG-002] 修复图片并发槽位获取失败时已持有锁未释放的永久泄漏

性能优化(代码审核):
- [PERF-001] 添加 Sentinel Token 缓存(3 分钟有效期),减少 PoW 计算开销

技术细节:
- 使用 io.LimitReader 限制所有外部输入的大小
- 添加 urlvalidator 验证防止 SSRF 攻击
- 使用 sync.Map 实现线程安全的包级缓存
- 优化并发槽位管理,添加 releaseAll 模式防止泄漏

影响范围:
- 后端:新增 Sora 相关数据模型、服务、网关和管理接口
- 前端:新增 Sora 平台配置、账号管理和监控界面
- 配置:新增 Sora 相关配置项和环境变量

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yangjianbo
2026-01-29 16:18:38 +08:00
parent bece1b5201
commit 13262a5698
97 changed files with 29541 additions and 68 deletions

View File

@@ -0,0 +1,124 @@
// Code generated by ent, DO NOT EDIT.
package soracachefile
import (
"time"
"entgo.io/ent/dialect/sql"
)
const (
// Label holds the string label denoting the soracachefile type in the database.
Label = "sora_cache_file"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldTaskID holds the string denoting the task_id field in the database.
FieldTaskID = "task_id"
// FieldAccountID holds the string denoting the account_id field in the database.
FieldAccountID = "account_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldMediaType holds the string denoting the media_type field in the database.
FieldMediaType = "media_type"
// FieldOriginalURL holds the string denoting the original_url field in the database.
FieldOriginalURL = "original_url"
// FieldCachePath holds the string denoting the cache_path field in the database.
FieldCachePath = "cache_path"
// FieldCacheURL holds the string denoting the cache_url field in the database.
FieldCacheURL = "cache_url"
// FieldSizeBytes holds the string denoting the size_bytes field in the database.
FieldSizeBytes = "size_bytes"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the soracachefile in the database.
Table = "sora_cache_files"
)
// Columns holds all SQL columns for soracachefile fields.
var Columns = []string{
FieldID,
FieldTaskID,
FieldAccountID,
FieldUserID,
FieldMediaType,
FieldOriginalURL,
FieldCachePath,
FieldCacheURL,
FieldSizeBytes,
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 (
// TaskIDValidator is a validator for the "task_id" field. It is called by the builders before save.
TaskIDValidator func(string) error
// MediaTypeValidator is a validator for the "media_type" field. It is called by the builders before save.
MediaTypeValidator func(string) error
// DefaultSizeBytes holds the default value on creation for the "size_bytes" field.
DefaultSizeBytes int64
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
)
// OrderOption defines the ordering options for the SoraCacheFile 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()
}
// ByTaskID orders the results by the task_id field.
func ByTaskID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTaskID, opts...).ToFunc()
}
// ByAccountID orders the results by the account_id field.
func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAccountID, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// ByMediaType orders the results by the media_type field.
func ByMediaType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldMediaType, opts...).ToFunc()
}
// ByOriginalURL orders the results by the original_url field.
func ByOriginalURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOriginalURL, opts...).ToFunc()
}
// ByCachePath orders the results by the cache_path field.
func ByCachePath(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCachePath, opts...).ToFunc()
}
// ByCacheURL orders the results by the cache_url field.
func ByCacheURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCacheURL, opts...).ToFunc()
}
// BySizeBytes orders the results by the size_bytes field.
func BySizeBytes(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSizeBytes, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}

View File

@@ -0,0 +1,610 @@
// Code generated by ent, DO NOT EDIT.
package soracachefile
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.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldID, id))
}
// TaskID applies equality check predicate on the "task_id" field. It's identical to TaskIDEQ.
func TaskID(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldTaskID, v))
}
// AccountID applies equality check predicate on the "account_id" field. It's identical to AccountIDEQ.
func AccountID(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldAccountID, v))
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func UserID(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldUserID, v))
}
// MediaType applies equality check predicate on the "media_type" field. It's identical to MediaTypeEQ.
func MediaType(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldMediaType, v))
}
// OriginalURL applies equality check predicate on the "original_url" field. It's identical to OriginalURLEQ.
func OriginalURL(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldOriginalURL, v))
}
// CachePath applies equality check predicate on the "cache_path" field. It's identical to CachePathEQ.
func CachePath(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldCachePath, v))
}
// CacheURL applies equality check predicate on the "cache_url" field. It's identical to CacheURLEQ.
func CacheURL(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldCacheURL, v))
}
// SizeBytes applies equality check predicate on the "size_bytes" field. It's identical to SizeBytesEQ.
func SizeBytes(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldSizeBytes, v))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldCreatedAt, v))
}
// TaskIDEQ applies the EQ predicate on the "task_id" field.
func TaskIDEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldTaskID, v))
}
// TaskIDNEQ applies the NEQ predicate on the "task_id" field.
func TaskIDNEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldTaskID, v))
}
// TaskIDIn applies the In predicate on the "task_id" field.
func TaskIDIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldTaskID, vs...))
}
// TaskIDNotIn applies the NotIn predicate on the "task_id" field.
func TaskIDNotIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldTaskID, vs...))
}
// TaskIDGT applies the GT predicate on the "task_id" field.
func TaskIDGT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldTaskID, v))
}
// TaskIDGTE applies the GTE predicate on the "task_id" field.
func TaskIDGTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldTaskID, v))
}
// TaskIDLT applies the LT predicate on the "task_id" field.
func TaskIDLT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldTaskID, v))
}
// TaskIDLTE applies the LTE predicate on the "task_id" field.
func TaskIDLTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldTaskID, v))
}
// TaskIDContains applies the Contains predicate on the "task_id" field.
func TaskIDContains(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContains(FieldTaskID, v))
}
// TaskIDHasPrefix applies the HasPrefix predicate on the "task_id" field.
func TaskIDHasPrefix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasPrefix(FieldTaskID, v))
}
// TaskIDHasSuffix applies the HasSuffix predicate on the "task_id" field.
func TaskIDHasSuffix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasSuffix(FieldTaskID, v))
}
// TaskIDIsNil applies the IsNil predicate on the "task_id" field.
func TaskIDIsNil() predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIsNull(FieldTaskID))
}
// TaskIDNotNil applies the NotNil predicate on the "task_id" field.
func TaskIDNotNil() predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotNull(FieldTaskID))
}
// TaskIDEqualFold applies the EqualFold predicate on the "task_id" field.
func TaskIDEqualFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEqualFold(FieldTaskID, v))
}
// TaskIDContainsFold applies the ContainsFold predicate on the "task_id" field.
func TaskIDContainsFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContainsFold(FieldTaskID, v))
}
// AccountIDEQ applies the EQ predicate on the "account_id" field.
func AccountIDEQ(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldAccountID, v))
}
// AccountIDNEQ applies the NEQ predicate on the "account_id" field.
func AccountIDNEQ(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldAccountID, v))
}
// AccountIDIn applies the In predicate on the "account_id" field.
func AccountIDIn(vs ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldAccountID, vs...))
}
// AccountIDNotIn applies the NotIn predicate on the "account_id" field.
func AccountIDNotIn(vs ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldAccountID, vs...))
}
// AccountIDGT applies the GT predicate on the "account_id" field.
func AccountIDGT(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldAccountID, v))
}
// AccountIDGTE applies the GTE predicate on the "account_id" field.
func AccountIDGTE(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldAccountID, v))
}
// AccountIDLT applies the LT predicate on the "account_id" field.
func AccountIDLT(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldAccountID, v))
}
// AccountIDLTE applies the LTE predicate on the "account_id" field.
func AccountIDLTE(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldAccountID, v))
}
// UserIDEQ applies the EQ predicate on the "user_id" field.
func UserIDEQ(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldUserID, v))
}
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
func UserIDNEQ(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldUserID, v))
}
// UserIDIn applies the In predicate on the "user_id" field.
func UserIDIn(vs ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldUserID, vs...))
}
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
func UserIDNotIn(vs ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldUserID, vs...))
}
// UserIDGT applies the GT predicate on the "user_id" field.
func UserIDGT(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldUserID, v))
}
// UserIDGTE applies the GTE predicate on the "user_id" field.
func UserIDGTE(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldUserID, v))
}
// UserIDLT applies the LT predicate on the "user_id" field.
func UserIDLT(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldUserID, v))
}
// UserIDLTE applies the LTE predicate on the "user_id" field.
func UserIDLTE(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldUserID, v))
}
// MediaTypeEQ applies the EQ predicate on the "media_type" field.
func MediaTypeEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldMediaType, v))
}
// MediaTypeNEQ applies the NEQ predicate on the "media_type" field.
func MediaTypeNEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldMediaType, v))
}
// MediaTypeIn applies the In predicate on the "media_type" field.
func MediaTypeIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldMediaType, vs...))
}
// MediaTypeNotIn applies the NotIn predicate on the "media_type" field.
func MediaTypeNotIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldMediaType, vs...))
}
// MediaTypeGT applies the GT predicate on the "media_type" field.
func MediaTypeGT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldMediaType, v))
}
// MediaTypeGTE applies the GTE predicate on the "media_type" field.
func MediaTypeGTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldMediaType, v))
}
// MediaTypeLT applies the LT predicate on the "media_type" field.
func MediaTypeLT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldMediaType, v))
}
// MediaTypeLTE applies the LTE predicate on the "media_type" field.
func MediaTypeLTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldMediaType, v))
}
// MediaTypeContains applies the Contains predicate on the "media_type" field.
func MediaTypeContains(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContains(FieldMediaType, v))
}
// MediaTypeHasPrefix applies the HasPrefix predicate on the "media_type" field.
func MediaTypeHasPrefix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasPrefix(FieldMediaType, v))
}
// MediaTypeHasSuffix applies the HasSuffix predicate on the "media_type" field.
func MediaTypeHasSuffix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasSuffix(FieldMediaType, v))
}
// MediaTypeEqualFold applies the EqualFold predicate on the "media_type" field.
func MediaTypeEqualFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEqualFold(FieldMediaType, v))
}
// MediaTypeContainsFold applies the ContainsFold predicate on the "media_type" field.
func MediaTypeContainsFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContainsFold(FieldMediaType, v))
}
// OriginalURLEQ applies the EQ predicate on the "original_url" field.
func OriginalURLEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldOriginalURL, v))
}
// OriginalURLNEQ applies the NEQ predicate on the "original_url" field.
func OriginalURLNEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldOriginalURL, v))
}
// OriginalURLIn applies the In predicate on the "original_url" field.
func OriginalURLIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldOriginalURL, vs...))
}
// OriginalURLNotIn applies the NotIn predicate on the "original_url" field.
func OriginalURLNotIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldOriginalURL, vs...))
}
// OriginalURLGT applies the GT predicate on the "original_url" field.
func OriginalURLGT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldOriginalURL, v))
}
// OriginalURLGTE applies the GTE predicate on the "original_url" field.
func OriginalURLGTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldOriginalURL, v))
}
// OriginalURLLT applies the LT predicate on the "original_url" field.
func OriginalURLLT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldOriginalURL, v))
}
// OriginalURLLTE applies the LTE predicate on the "original_url" field.
func OriginalURLLTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldOriginalURL, v))
}
// OriginalURLContains applies the Contains predicate on the "original_url" field.
func OriginalURLContains(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContains(FieldOriginalURL, v))
}
// OriginalURLHasPrefix applies the HasPrefix predicate on the "original_url" field.
func OriginalURLHasPrefix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasPrefix(FieldOriginalURL, v))
}
// OriginalURLHasSuffix applies the HasSuffix predicate on the "original_url" field.
func OriginalURLHasSuffix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasSuffix(FieldOriginalURL, v))
}
// OriginalURLEqualFold applies the EqualFold predicate on the "original_url" field.
func OriginalURLEqualFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEqualFold(FieldOriginalURL, v))
}
// OriginalURLContainsFold applies the ContainsFold predicate on the "original_url" field.
func OriginalURLContainsFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContainsFold(FieldOriginalURL, v))
}
// CachePathEQ applies the EQ predicate on the "cache_path" field.
func CachePathEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldCachePath, v))
}
// CachePathNEQ applies the NEQ predicate on the "cache_path" field.
func CachePathNEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldCachePath, v))
}
// CachePathIn applies the In predicate on the "cache_path" field.
func CachePathIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldCachePath, vs...))
}
// CachePathNotIn applies the NotIn predicate on the "cache_path" field.
func CachePathNotIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldCachePath, vs...))
}
// CachePathGT applies the GT predicate on the "cache_path" field.
func CachePathGT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldCachePath, v))
}
// CachePathGTE applies the GTE predicate on the "cache_path" field.
func CachePathGTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldCachePath, v))
}
// CachePathLT applies the LT predicate on the "cache_path" field.
func CachePathLT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldCachePath, v))
}
// CachePathLTE applies the LTE predicate on the "cache_path" field.
func CachePathLTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldCachePath, v))
}
// CachePathContains applies the Contains predicate on the "cache_path" field.
func CachePathContains(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContains(FieldCachePath, v))
}
// CachePathHasPrefix applies the HasPrefix predicate on the "cache_path" field.
func CachePathHasPrefix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasPrefix(FieldCachePath, v))
}
// CachePathHasSuffix applies the HasSuffix predicate on the "cache_path" field.
func CachePathHasSuffix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasSuffix(FieldCachePath, v))
}
// CachePathEqualFold applies the EqualFold predicate on the "cache_path" field.
func CachePathEqualFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEqualFold(FieldCachePath, v))
}
// CachePathContainsFold applies the ContainsFold predicate on the "cache_path" field.
func CachePathContainsFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContainsFold(FieldCachePath, v))
}
// CacheURLEQ applies the EQ predicate on the "cache_url" field.
func CacheURLEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldCacheURL, v))
}
// CacheURLNEQ applies the NEQ predicate on the "cache_url" field.
func CacheURLNEQ(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldCacheURL, v))
}
// CacheURLIn applies the In predicate on the "cache_url" field.
func CacheURLIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldCacheURL, vs...))
}
// CacheURLNotIn applies the NotIn predicate on the "cache_url" field.
func CacheURLNotIn(vs ...string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldCacheURL, vs...))
}
// CacheURLGT applies the GT predicate on the "cache_url" field.
func CacheURLGT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldCacheURL, v))
}
// CacheURLGTE applies the GTE predicate on the "cache_url" field.
func CacheURLGTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldCacheURL, v))
}
// CacheURLLT applies the LT predicate on the "cache_url" field.
func CacheURLLT(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldCacheURL, v))
}
// CacheURLLTE applies the LTE predicate on the "cache_url" field.
func CacheURLLTE(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldCacheURL, v))
}
// CacheURLContains applies the Contains predicate on the "cache_url" field.
func CacheURLContains(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContains(FieldCacheURL, v))
}
// CacheURLHasPrefix applies the HasPrefix predicate on the "cache_url" field.
func CacheURLHasPrefix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasPrefix(FieldCacheURL, v))
}
// CacheURLHasSuffix applies the HasSuffix predicate on the "cache_url" field.
func CacheURLHasSuffix(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldHasSuffix(FieldCacheURL, v))
}
// CacheURLEqualFold applies the EqualFold predicate on the "cache_url" field.
func CacheURLEqualFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEqualFold(FieldCacheURL, v))
}
// CacheURLContainsFold applies the ContainsFold predicate on the "cache_url" field.
func CacheURLContainsFold(v string) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldContainsFold(FieldCacheURL, v))
}
// SizeBytesEQ applies the EQ predicate on the "size_bytes" field.
func SizeBytesEQ(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldSizeBytes, v))
}
// SizeBytesNEQ applies the NEQ predicate on the "size_bytes" field.
func SizeBytesNEQ(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldSizeBytes, v))
}
// SizeBytesIn applies the In predicate on the "size_bytes" field.
func SizeBytesIn(vs ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldSizeBytes, vs...))
}
// SizeBytesNotIn applies the NotIn predicate on the "size_bytes" field.
func SizeBytesNotIn(vs ...int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldSizeBytes, vs...))
}
// SizeBytesGT applies the GT predicate on the "size_bytes" field.
func SizeBytesGT(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldSizeBytes, v))
}
// SizeBytesGTE applies the GTE predicate on the "size_bytes" field.
func SizeBytesGTE(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldSizeBytes, v))
}
// SizeBytesLT applies the LT predicate on the "size_bytes" field.
func SizeBytesLT(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldSizeBytes, v))
}
// SizeBytesLTE applies the LTE predicate on the "size_bytes" field.
func SizeBytesLTE(v int64) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldSizeBytes, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.FieldLTE(FieldCreatedAt, v))
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.SoraCacheFile) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.SoraCacheFile) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.SoraCacheFile) predicate.SoraCacheFile {
return predicate.SoraCacheFile(sql.NotPredicates(p))
}