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:
160
backend/ent/sorausagestat/sorausagestat.go
Normal file
160
backend/ent/sorausagestat/sorausagestat.go
Normal file
@@ -0,0 +1,160 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package sorausagestat
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the sorausagestat type in the database.
|
||||
Label = "sora_usage_stat"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// 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"
|
||||
// FieldAccountID holds the string denoting the account_id field in the database.
|
||||
FieldAccountID = "account_id"
|
||||
// FieldImageCount holds the string denoting the image_count field in the database.
|
||||
FieldImageCount = "image_count"
|
||||
// FieldVideoCount holds the string denoting the video_count field in the database.
|
||||
FieldVideoCount = "video_count"
|
||||
// FieldErrorCount holds the string denoting the error_count field in the database.
|
||||
FieldErrorCount = "error_count"
|
||||
// FieldLastErrorAt holds the string denoting the last_error_at field in the database.
|
||||
FieldLastErrorAt = "last_error_at"
|
||||
// FieldTodayImageCount holds the string denoting the today_image_count field in the database.
|
||||
FieldTodayImageCount = "today_image_count"
|
||||
// FieldTodayVideoCount holds the string denoting the today_video_count field in the database.
|
||||
FieldTodayVideoCount = "today_video_count"
|
||||
// FieldTodayErrorCount holds the string denoting the today_error_count field in the database.
|
||||
FieldTodayErrorCount = "today_error_count"
|
||||
// FieldTodayDate holds the string denoting the today_date field in the database.
|
||||
FieldTodayDate = "today_date"
|
||||
// FieldConsecutiveErrorCount holds the string denoting the consecutive_error_count field in the database.
|
||||
FieldConsecutiveErrorCount = "consecutive_error_count"
|
||||
// Table holds the table name of the sorausagestat in the database.
|
||||
Table = "sora_usage_stats"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for sorausagestat fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
FieldAccountID,
|
||||
FieldImageCount,
|
||||
FieldVideoCount,
|
||||
FieldErrorCount,
|
||||
FieldLastErrorAt,
|
||||
FieldTodayImageCount,
|
||||
FieldTodayVideoCount,
|
||||
FieldTodayErrorCount,
|
||||
FieldTodayDate,
|
||||
FieldConsecutiveErrorCount,
|
||||
}
|
||||
|
||||
// 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 (
|
||||
// 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
|
||||
// DefaultImageCount holds the default value on creation for the "image_count" field.
|
||||
DefaultImageCount int
|
||||
// DefaultVideoCount holds the default value on creation for the "video_count" field.
|
||||
DefaultVideoCount int
|
||||
// DefaultErrorCount holds the default value on creation for the "error_count" field.
|
||||
DefaultErrorCount int
|
||||
// DefaultTodayImageCount holds the default value on creation for the "today_image_count" field.
|
||||
DefaultTodayImageCount int
|
||||
// DefaultTodayVideoCount holds the default value on creation for the "today_video_count" field.
|
||||
DefaultTodayVideoCount int
|
||||
// DefaultTodayErrorCount holds the default value on creation for the "today_error_count" field.
|
||||
DefaultTodayErrorCount int
|
||||
// DefaultConsecutiveErrorCount holds the default value on creation for the "consecutive_error_count" field.
|
||||
DefaultConsecutiveErrorCount int
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the SoraUsageStat 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()
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
// ByAccountID orders the results by the account_id field.
|
||||
func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAccountID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByImageCount orders the results by the image_count field.
|
||||
func ByImageCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldImageCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByVideoCount orders the results by the video_count field.
|
||||
func ByVideoCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldVideoCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByErrorCount orders the results by the error_count field.
|
||||
func ByErrorCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldErrorCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLastErrorAt orders the results by the last_error_at field.
|
||||
func ByLastErrorAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLastErrorAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTodayImageCount orders the results by the today_image_count field.
|
||||
func ByTodayImageCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTodayImageCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTodayVideoCount orders the results by the today_video_count field.
|
||||
func ByTodayVideoCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTodayVideoCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTodayErrorCount orders the results by the today_error_count field.
|
||||
func ByTodayErrorCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTodayErrorCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTodayDate orders the results by the today_date field.
|
||||
func ByTodayDate(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTodayDate, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByConsecutiveErrorCount orders the results by the consecutive_error_count field.
|
||||
func ByConsecutiveErrorCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldConsecutiveErrorCount, opts...).ToFunc()
|
||||
}
|
||||
630
backend/ent/sorausagestat/where.go
Normal file
630
backend/ent/sorausagestat/where.go
Normal file
@@ -0,0 +1,630 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package sorausagestat
|
||||
|
||||
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.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(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.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// AccountID applies equality check predicate on the "account_id" field. It's identical to AccountIDEQ.
|
||||
func AccountID(v int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// ImageCount applies equality check predicate on the "image_count" field. It's identical to ImageCountEQ.
|
||||
func ImageCount(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldImageCount, v))
|
||||
}
|
||||
|
||||
// VideoCount applies equality check predicate on the "video_count" field. It's identical to VideoCountEQ.
|
||||
func VideoCount(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldVideoCount, v))
|
||||
}
|
||||
|
||||
// ErrorCount applies equality check predicate on the "error_count" field. It's identical to ErrorCountEQ.
|
||||
func ErrorCount(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldErrorCount, v))
|
||||
}
|
||||
|
||||
// LastErrorAt applies equality check predicate on the "last_error_at" field. It's identical to LastErrorAtEQ.
|
||||
func LastErrorAt(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldLastErrorAt, v))
|
||||
}
|
||||
|
||||
// TodayImageCount applies equality check predicate on the "today_image_count" field. It's identical to TodayImageCountEQ.
|
||||
func TodayImageCount(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayImageCount, v))
|
||||
}
|
||||
|
||||
// TodayVideoCount applies equality check predicate on the "today_video_count" field. It's identical to TodayVideoCountEQ.
|
||||
func TodayVideoCount(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayVideoCount, v))
|
||||
}
|
||||
|
||||
// TodayErrorCount applies equality check predicate on the "today_error_count" field. It's identical to TodayErrorCountEQ.
|
||||
func TodayErrorCount(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayErrorCount, v))
|
||||
}
|
||||
|
||||
// TodayDate applies equality check predicate on the "today_date" field. It's identical to TodayDateEQ.
|
||||
func TodayDate(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayDate, v))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCount applies equality check predicate on the "consecutive_error_count" field. It's identical to ConsecutiveErrorCountEQ.
|
||||
func ConsecutiveErrorCount(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldConsecutiveErrorCount, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||||
func CreatedAtNEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||||
func CreatedAtGT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||||
func CreatedAtGTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||||
func CreatedAtLT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||||
func CreatedAtLTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||||
func UpdatedAtNEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||||
func UpdatedAtGT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||||
func UpdatedAtGTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||||
func UpdatedAtLT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||||
func UpdatedAtLTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// AccountIDEQ applies the EQ predicate on the "account_id" field.
|
||||
func AccountIDEQ(v int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// AccountIDNEQ applies the NEQ predicate on the "account_id" field.
|
||||
func AccountIDNEQ(v int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// AccountIDIn applies the In predicate on the "account_id" field.
|
||||
func AccountIDIn(vs ...int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldAccountID, vs...))
|
||||
}
|
||||
|
||||
// AccountIDNotIn applies the NotIn predicate on the "account_id" field.
|
||||
func AccountIDNotIn(vs ...int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldAccountID, vs...))
|
||||
}
|
||||
|
||||
// AccountIDGT applies the GT predicate on the "account_id" field.
|
||||
func AccountIDGT(v int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// AccountIDGTE applies the GTE predicate on the "account_id" field.
|
||||
func AccountIDGTE(v int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// AccountIDLT applies the LT predicate on the "account_id" field.
|
||||
func AccountIDLT(v int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// AccountIDLTE applies the LTE predicate on the "account_id" field.
|
||||
func AccountIDLTE(v int64) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldAccountID, v))
|
||||
}
|
||||
|
||||
// ImageCountEQ applies the EQ predicate on the "image_count" field.
|
||||
func ImageCountEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldImageCount, v))
|
||||
}
|
||||
|
||||
// ImageCountNEQ applies the NEQ predicate on the "image_count" field.
|
||||
func ImageCountNEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldImageCount, v))
|
||||
}
|
||||
|
||||
// ImageCountIn applies the In predicate on the "image_count" field.
|
||||
func ImageCountIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldImageCount, vs...))
|
||||
}
|
||||
|
||||
// ImageCountNotIn applies the NotIn predicate on the "image_count" field.
|
||||
func ImageCountNotIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldImageCount, vs...))
|
||||
}
|
||||
|
||||
// ImageCountGT applies the GT predicate on the "image_count" field.
|
||||
func ImageCountGT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldImageCount, v))
|
||||
}
|
||||
|
||||
// ImageCountGTE applies the GTE predicate on the "image_count" field.
|
||||
func ImageCountGTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldImageCount, v))
|
||||
}
|
||||
|
||||
// ImageCountLT applies the LT predicate on the "image_count" field.
|
||||
func ImageCountLT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldImageCount, v))
|
||||
}
|
||||
|
||||
// ImageCountLTE applies the LTE predicate on the "image_count" field.
|
||||
func ImageCountLTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldImageCount, v))
|
||||
}
|
||||
|
||||
// VideoCountEQ applies the EQ predicate on the "video_count" field.
|
||||
func VideoCountEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldVideoCount, v))
|
||||
}
|
||||
|
||||
// VideoCountNEQ applies the NEQ predicate on the "video_count" field.
|
||||
func VideoCountNEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldVideoCount, v))
|
||||
}
|
||||
|
||||
// VideoCountIn applies the In predicate on the "video_count" field.
|
||||
func VideoCountIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldVideoCount, vs...))
|
||||
}
|
||||
|
||||
// VideoCountNotIn applies the NotIn predicate on the "video_count" field.
|
||||
func VideoCountNotIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldVideoCount, vs...))
|
||||
}
|
||||
|
||||
// VideoCountGT applies the GT predicate on the "video_count" field.
|
||||
func VideoCountGT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldVideoCount, v))
|
||||
}
|
||||
|
||||
// VideoCountGTE applies the GTE predicate on the "video_count" field.
|
||||
func VideoCountGTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldVideoCount, v))
|
||||
}
|
||||
|
||||
// VideoCountLT applies the LT predicate on the "video_count" field.
|
||||
func VideoCountLT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldVideoCount, v))
|
||||
}
|
||||
|
||||
// VideoCountLTE applies the LTE predicate on the "video_count" field.
|
||||
func VideoCountLTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldVideoCount, v))
|
||||
}
|
||||
|
||||
// ErrorCountEQ applies the EQ predicate on the "error_count" field.
|
||||
func ErrorCountEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldErrorCount, v))
|
||||
}
|
||||
|
||||
// ErrorCountNEQ applies the NEQ predicate on the "error_count" field.
|
||||
func ErrorCountNEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldErrorCount, v))
|
||||
}
|
||||
|
||||
// ErrorCountIn applies the In predicate on the "error_count" field.
|
||||
func ErrorCountIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldErrorCount, vs...))
|
||||
}
|
||||
|
||||
// ErrorCountNotIn applies the NotIn predicate on the "error_count" field.
|
||||
func ErrorCountNotIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldErrorCount, vs...))
|
||||
}
|
||||
|
||||
// ErrorCountGT applies the GT predicate on the "error_count" field.
|
||||
func ErrorCountGT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldErrorCount, v))
|
||||
}
|
||||
|
||||
// ErrorCountGTE applies the GTE predicate on the "error_count" field.
|
||||
func ErrorCountGTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldErrorCount, v))
|
||||
}
|
||||
|
||||
// ErrorCountLT applies the LT predicate on the "error_count" field.
|
||||
func ErrorCountLT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldErrorCount, v))
|
||||
}
|
||||
|
||||
// ErrorCountLTE applies the LTE predicate on the "error_count" field.
|
||||
func ErrorCountLTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldErrorCount, v))
|
||||
}
|
||||
|
||||
// LastErrorAtEQ applies the EQ predicate on the "last_error_at" field.
|
||||
func LastErrorAtEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldLastErrorAt, v))
|
||||
}
|
||||
|
||||
// LastErrorAtNEQ applies the NEQ predicate on the "last_error_at" field.
|
||||
func LastErrorAtNEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldLastErrorAt, v))
|
||||
}
|
||||
|
||||
// LastErrorAtIn applies the In predicate on the "last_error_at" field.
|
||||
func LastErrorAtIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldLastErrorAt, vs...))
|
||||
}
|
||||
|
||||
// LastErrorAtNotIn applies the NotIn predicate on the "last_error_at" field.
|
||||
func LastErrorAtNotIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldLastErrorAt, vs...))
|
||||
}
|
||||
|
||||
// LastErrorAtGT applies the GT predicate on the "last_error_at" field.
|
||||
func LastErrorAtGT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldLastErrorAt, v))
|
||||
}
|
||||
|
||||
// LastErrorAtGTE applies the GTE predicate on the "last_error_at" field.
|
||||
func LastErrorAtGTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldLastErrorAt, v))
|
||||
}
|
||||
|
||||
// LastErrorAtLT applies the LT predicate on the "last_error_at" field.
|
||||
func LastErrorAtLT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldLastErrorAt, v))
|
||||
}
|
||||
|
||||
// LastErrorAtLTE applies the LTE predicate on the "last_error_at" field.
|
||||
func LastErrorAtLTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldLastErrorAt, v))
|
||||
}
|
||||
|
||||
// LastErrorAtIsNil applies the IsNil predicate on the "last_error_at" field.
|
||||
func LastErrorAtIsNil() predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIsNull(FieldLastErrorAt))
|
||||
}
|
||||
|
||||
// LastErrorAtNotNil applies the NotNil predicate on the "last_error_at" field.
|
||||
func LastErrorAtNotNil() predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotNull(FieldLastErrorAt))
|
||||
}
|
||||
|
||||
// TodayImageCountEQ applies the EQ predicate on the "today_image_count" field.
|
||||
func TodayImageCountEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayImageCount, v))
|
||||
}
|
||||
|
||||
// TodayImageCountNEQ applies the NEQ predicate on the "today_image_count" field.
|
||||
func TodayImageCountNEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldTodayImageCount, v))
|
||||
}
|
||||
|
||||
// TodayImageCountIn applies the In predicate on the "today_image_count" field.
|
||||
func TodayImageCountIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldTodayImageCount, vs...))
|
||||
}
|
||||
|
||||
// TodayImageCountNotIn applies the NotIn predicate on the "today_image_count" field.
|
||||
func TodayImageCountNotIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldTodayImageCount, vs...))
|
||||
}
|
||||
|
||||
// TodayImageCountGT applies the GT predicate on the "today_image_count" field.
|
||||
func TodayImageCountGT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldTodayImageCount, v))
|
||||
}
|
||||
|
||||
// TodayImageCountGTE applies the GTE predicate on the "today_image_count" field.
|
||||
func TodayImageCountGTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldTodayImageCount, v))
|
||||
}
|
||||
|
||||
// TodayImageCountLT applies the LT predicate on the "today_image_count" field.
|
||||
func TodayImageCountLT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldTodayImageCount, v))
|
||||
}
|
||||
|
||||
// TodayImageCountLTE applies the LTE predicate on the "today_image_count" field.
|
||||
func TodayImageCountLTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldTodayImageCount, v))
|
||||
}
|
||||
|
||||
// TodayVideoCountEQ applies the EQ predicate on the "today_video_count" field.
|
||||
func TodayVideoCountEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayVideoCount, v))
|
||||
}
|
||||
|
||||
// TodayVideoCountNEQ applies the NEQ predicate on the "today_video_count" field.
|
||||
func TodayVideoCountNEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldTodayVideoCount, v))
|
||||
}
|
||||
|
||||
// TodayVideoCountIn applies the In predicate on the "today_video_count" field.
|
||||
func TodayVideoCountIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldTodayVideoCount, vs...))
|
||||
}
|
||||
|
||||
// TodayVideoCountNotIn applies the NotIn predicate on the "today_video_count" field.
|
||||
func TodayVideoCountNotIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldTodayVideoCount, vs...))
|
||||
}
|
||||
|
||||
// TodayVideoCountGT applies the GT predicate on the "today_video_count" field.
|
||||
func TodayVideoCountGT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldTodayVideoCount, v))
|
||||
}
|
||||
|
||||
// TodayVideoCountGTE applies the GTE predicate on the "today_video_count" field.
|
||||
func TodayVideoCountGTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldTodayVideoCount, v))
|
||||
}
|
||||
|
||||
// TodayVideoCountLT applies the LT predicate on the "today_video_count" field.
|
||||
func TodayVideoCountLT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldTodayVideoCount, v))
|
||||
}
|
||||
|
||||
// TodayVideoCountLTE applies the LTE predicate on the "today_video_count" field.
|
||||
func TodayVideoCountLTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldTodayVideoCount, v))
|
||||
}
|
||||
|
||||
// TodayErrorCountEQ applies the EQ predicate on the "today_error_count" field.
|
||||
func TodayErrorCountEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayErrorCount, v))
|
||||
}
|
||||
|
||||
// TodayErrorCountNEQ applies the NEQ predicate on the "today_error_count" field.
|
||||
func TodayErrorCountNEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldTodayErrorCount, v))
|
||||
}
|
||||
|
||||
// TodayErrorCountIn applies the In predicate on the "today_error_count" field.
|
||||
func TodayErrorCountIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldTodayErrorCount, vs...))
|
||||
}
|
||||
|
||||
// TodayErrorCountNotIn applies the NotIn predicate on the "today_error_count" field.
|
||||
func TodayErrorCountNotIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldTodayErrorCount, vs...))
|
||||
}
|
||||
|
||||
// TodayErrorCountGT applies the GT predicate on the "today_error_count" field.
|
||||
func TodayErrorCountGT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldTodayErrorCount, v))
|
||||
}
|
||||
|
||||
// TodayErrorCountGTE applies the GTE predicate on the "today_error_count" field.
|
||||
func TodayErrorCountGTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldTodayErrorCount, v))
|
||||
}
|
||||
|
||||
// TodayErrorCountLT applies the LT predicate on the "today_error_count" field.
|
||||
func TodayErrorCountLT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldTodayErrorCount, v))
|
||||
}
|
||||
|
||||
// TodayErrorCountLTE applies the LTE predicate on the "today_error_count" field.
|
||||
func TodayErrorCountLTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldTodayErrorCount, v))
|
||||
}
|
||||
|
||||
// TodayDateEQ applies the EQ predicate on the "today_date" field.
|
||||
func TodayDateEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldTodayDate, v))
|
||||
}
|
||||
|
||||
// TodayDateNEQ applies the NEQ predicate on the "today_date" field.
|
||||
func TodayDateNEQ(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldTodayDate, v))
|
||||
}
|
||||
|
||||
// TodayDateIn applies the In predicate on the "today_date" field.
|
||||
func TodayDateIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldTodayDate, vs...))
|
||||
}
|
||||
|
||||
// TodayDateNotIn applies the NotIn predicate on the "today_date" field.
|
||||
func TodayDateNotIn(vs ...time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldTodayDate, vs...))
|
||||
}
|
||||
|
||||
// TodayDateGT applies the GT predicate on the "today_date" field.
|
||||
func TodayDateGT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldTodayDate, v))
|
||||
}
|
||||
|
||||
// TodayDateGTE applies the GTE predicate on the "today_date" field.
|
||||
func TodayDateGTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldTodayDate, v))
|
||||
}
|
||||
|
||||
// TodayDateLT applies the LT predicate on the "today_date" field.
|
||||
func TodayDateLT(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldTodayDate, v))
|
||||
}
|
||||
|
||||
// TodayDateLTE applies the LTE predicate on the "today_date" field.
|
||||
func TodayDateLTE(v time.Time) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldTodayDate, v))
|
||||
}
|
||||
|
||||
// TodayDateIsNil applies the IsNil predicate on the "today_date" field.
|
||||
func TodayDateIsNil() predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIsNull(FieldTodayDate))
|
||||
}
|
||||
|
||||
// TodayDateNotNil applies the NotNil predicate on the "today_date" field.
|
||||
func TodayDateNotNil() predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotNull(FieldTodayDate))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountEQ applies the EQ predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldEQ(FieldConsecutiveErrorCount, v))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountNEQ applies the NEQ predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountNEQ(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNEQ(FieldConsecutiveErrorCount, v))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountIn applies the In predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldIn(FieldConsecutiveErrorCount, vs...))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountNotIn applies the NotIn predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountNotIn(vs ...int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldNotIn(FieldConsecutiveErrorCount, vs...))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountGT applies the GT predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountGT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGT(FieldConsecutiveErrorCount, v))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountGTE applies the GTE predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountGTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldGTE(FieldConsecutiveErrorCount, v))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountLT applies the LT predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountLT(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLT(FieldConsecutiveErrorCount, v))
|
||||
}
|
||||
|
||||
// ConsecutiveErrorCountLTE applies the LTE predicate on the "consecutive_error_count" field.
|
||||
func ConsecutiveErrorCountLTE(v int) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.FieldLTE(FieldConsecutiveErrorCount, v))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.SoraUsageStat) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.SoraUsageStat) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.SoraUsageStat) predicate.SoraUsageStat {
|
||||
return predicate.SoraUsageStat(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user