Files
sub2api/backend/ent/usagelog/where.go
IanShaw 45bd9ac705 运维监控系统安全加固和功能优化 (#21)
* fix(ops): 修复运维监控系统的关键安全和稳定性问题

## 修复内容

### P0 严重问题
1. **DNS Rebinding防护** (ops_alert_service.go)
   - 实现IP钉住机制防止验证后的DNS rebinding攻击
   - 自定义Transport.DialContext强制只允许拨号到验证过的公网IP
   - 扩展IP黑名单,包括云metadata地址(169.254.169.254)
   - 添加完整的单元测试覆盖

2. **OpsAlertService生命周期管理** (wire.go)
   - 在ProvideOpsMetricsCollector中添加opsAlertService.Start()调用
   - 确保stopCtx正确初始化,避免nil指针问题
   - 实现防御式启动,保证服务启动顺序

3. **数据库查询排序** (ops_repo.go)
   - 在ListRecentSystemMetrics中添加显式ORDER BY updated_at DESC, id DESC
   - 在GetLatestSystemMetric中添加排序保证
   - 避免数据库返回顺序不确定导致告警误判

### P1 重要问题
4. **并发安全** (ops_metrics_collector.go)
   - 为lastGCPauseTotal字段添加sync.Mutex保护
   - 防止数据竞争

5. **Goroutine泄漏** (ops_error_logger.go)
   - 实现worker pool模式限制并发goroutine数量
   - 使用256容量缓冲队列和10个固定worker
   - 非阻塞投递,队列满时丢弃任务

6. **生命周期控制** (ops_alert_service.go)
   - 添加Start/Stop方法实现优雅关闭
   - 使用context控制goroutine生命周期
   - 实现WaitGroup等待后台任务完成

7. **Webhook URL验证** (ops_alert_service.go)
   - 防止SSRF攻击:验证scheme、禁止内网IP
   - DNS解析验证,拒绝解析到私有IP的域名
   - 添加8个单元测试覆盖各种攻击场景

8. **资源泄漏** (ops_repo.go)
   - 修复多处defer rows.Close()问题
   - 简化冗余的defer func()包装

9. **HTTP超时控制** (ops_alert_service.go)
   - 创建带10秒超时的http.Client
   - 添加buildWebhookHTTPClient辅助函数
   - 防止HTTP请求无限期挂起

10. **数据库查询优化** (ops_repo.go)
    - 将GetWindowStats的4次独立查询合并为1次CTE查询
    - 减少网络往返和表扫描次数
    - 显著提升性能

11. **重试机制** (ops_alert_service.go)
    - 实现邮件发送重试:最多3次,指数退避(1s/2s/4s)
    - 添加webhook备用通道
    - 实现完整的错误处理和日志记录

12. **魔法数字** (ops_repo.go, ops_metrics_collector.go)
    - 提取硬编码数字为有意义的常量
    - 提高代码可读性和可维护性

## 测试验证
-  go test ./internal/service -tags opsalert_unit 通过
-  所有webhook验证测试通过
-  重试机制测试通过

## 影响范围
- 运维监控系统安全性显著提升
- 系统稳定性和性能优化
- 无破坏性变更,向后兼容

* feat(ops): 运维监控系统V2 - 完整实现

## 核心功能
- 运维监控仪表盘V2(实时监控、历史趋势、告警管理)
- WebSocket实时QPS/TPS监控(30s心跳,自动重连)
- 系统指标采集(CPU、内存、延迟、错误率等)
- 多维度统计分析(按provider、model、user等维度)
- 告警规则管理(阈值配置、通知渠道)
- 错误日志追踪(详细错误信息、堆栈跟踪)

## 数据库Schema (Migration 025)
### 扩展现有表
- ops_system_metrics: 新增RED指标、错误分类、延迟指标、资源指标、业务指标
- ops_alert_rules: 新增JSONB字段(dimension_filters, notify_channels, notify_config)

### 新增表
- ops_dimension_stats: 多维度统计数据
- ops_data_retention_config: 数据保留策略配置

### 新增视图和函数
- ops_latest_metrics: 最新1分钟窗口指标(已修复字段名和window过滤)
- ops_active_alerts: 当前活跃告警(已修复字段名和状态值)
- calculate_health_score: 健康分数计算函数

## 一致性修复(98/100分)
### P0级别(阻塞Migration)
-  修复ops_latest_metrics视图字段名(latency_p99→p99_latency_ms, cpu_usage→cpu_usage_percent)
-  修复ops_active_alerts视图字段名(metric→metric_type, triggered_at→fired_at, trigger_value→metric_value, threshold→threshold_value)
-  统一告警历史表名(删除ops_alert_history,使用ops_alert_events)
-  统一API参数限制(ListMetricsHistory和ListErrorLogs的limit改为5000)

### P1级别(功能完整性)
-  修复ops_latest_metrics视图未过滤window_minutes(添加WHERE m.window_minutes = 1)
-  修复数据回填UPDATE逻辑(QPS计算改为request_count/(window_minutes*60.0))
-  添加ops_alert_rules JSONB字段后端支持(Go结构体+序列化)

### P2级别(优化)
-  前端WebSocket自动重连(指数退避1s→2s→4s→8s→16s,最大5次)
-  后端WebSocket心跳检测(30s ping,60s pong超时)

## 技术实现
### 后端 (Go)
- Handler层: ops_handler.go(REST API), ops_ws_handler.go(WebSocket)
- Service层: ops_service.go(核心逻辑), ops_cache.go(缓存), ops_alerts.go(告警)
- Repository层: ops_repo.go(数据访问), ops.go(模型定义)
- 路由: admin.go(新增ops相关路由)
- 依赖注入: wire_gen.go(自动生成)

### 前端 (Vue3 + TypeScript)
- 组件: OpsDashboardV2.vue(仪表盘主组件)
- API: ops.ts(REST API + WebSocket封装)
- 路由: index.ts(新增/admin/ops路由)
- 国际化: en.ts, zh.ts(中英文支持)

## 测试验证
-  所有Go测试通过
-  Migration可正常执行
-  WebSocket连接稳定
-  前后端数据结构对齐

* refactor: 代码清理和测试优化

## 测试文件优化
- 简化integration test fixtures和断言
- 优化test helper函数
- 统一测试数据格式

## 代码清理
- 移除未使用的代码和注释
- 简化concurrency_cache实现
- 优化middleware错误处理

## 小修复
- 修复gateway_handler和openai_gateway_handler的小问题
- 统一代码风格和格式

变更统计: 27个文件,292行新增,322行删除(净减少30行)

* fix(ops): 运维监控系统安全加固和功能优化

## 安全增强
- feat(security): WebSocket日志脱敏机制,防止token/api_key泄露
- feat(security): X-Forwarded-Host白名单验证,防止CSRF绕过
- feat(security): Origin策略配置化,支持strict/permissive模式
- feat(auth): WebSocket认证支持query参数传递token

## 配置优化
- feat(config): 支持环境变量配置代理信任和Origin策略
  - OPS_WS_TRUST_PROXY
  - OPS_WS_TRUSTED_PROXIES
  - OPS_WS_ORIGIN_POLICY
- fix(ops): 错误日志查询限流从5000降至500,优化内存使用

## 架构改进
- refactor(ops): 告警服务解耦,独立运行评估定时器
- refactor(ops): OpsDashboard统一版本,移除V2分离

## 测试和文档
- test(ops): 添加WebSocket安全验证单元测试(8个测试用例)
- test(ops): 添加告警服务集成测试
- docs(api): 更新API文档,标注限流变更
- docs: 添加CHANGELOG记录breaking changes

## 修复文件
Backend:
- backend/internal/server/middleware/logger.go
- backend/internal/handler/admin/ops_handler.go
- backend/internal/handler/admin/ops_ws_handler.go
- backend/internal/server/middleware/admin_auth.go
- backend/internal/service/ops_alert_service.go
- backend/internal/service/ops_metrics_collector.go
- backend/internal/service/wire.go

Frontend:
- frontend/src/views/admin/ops/OpsDashboard.vue
- frontend/src/router/index.ts
- frontend/src/api/admin/ops.ts

Tests:
- backend/internal/handler/admin/ops_ws_handler_test.go (新增)
- backend/internal/service/ops_alert_service_integration_test.go (新增)

Docs:
- CHANGELOG.md (新增)
- docs/API-运维监控中心2.0.md (更新)

* fix(migrations): 修复calculate_health_score函数类型匹配问题

在ops_latest_metrics视图中添加显式类型转换,确保参数类型与函数签名匹配

* fix(lint): 修复golangci-lint检查发现的所有问题

- 将Redis依赖从service层移到repository层
- 添加错误检查(WebSocket连接和读取超时)
- 运行gofmt格式化代码
- 添加nil指针检查
- 删除未使用的alertService字段

修复问题:
- depguard: 3个(service层不应直接import redis)
- errcheck: 3个(未检查错误返回值)
- gofmt: 2个(代码格式问题)
- staticcheck: 4个(nil指针解引用)
- unused: 1个(未使用字段)

代码统计:
- 修改文件:11个
- 删除代码:490行
- 新增代码:105行
- 净减少:385行
2026-01-02 20:01:12 +08:00

1272 lines
47 KiB
Go

// Code generated by ent, DO NOT EDIT.
package usagelog
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ID filters vertices based on their ID field.
func ID(id int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldID, id))
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func UserID(v int64) predicate.UsageLog {
return predicate.UsageLog(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.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldAPIKeyID, v))
}
// AccountID applies equality check predicate on the "account_id" field. It's identical to AccountIDEQ.
func AccountID(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldAccountID, v))
}
// RequestID applies equality check predicate on the "request_id" field. It's identical to RequestIDEQ.
func RequestID(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldRequestID, v))
}
// Model applies equality check predicate on the "model" field. It's identical to ModelEQ.
func Model(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldModel, v))
}
// GroupID applies equality check predicate on the "group_id" field. It's identical to GroupIDEQ.
func GroupID(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldGroupID, v))
}
// SubscriptionID applies equality check predicate on the "subscription_id" field. It's identical to SubscriptionIDEQ.
func SubscriptionID(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldSubscriptionID, v))
}
// InputTokens applies equality check predicate on the "input_tokens" field. It's identical to InputTokensEQ.
func InputTokens(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldInputTokens, v))
}
// OutputTokens applies equality check predicate on the "output_tokens" field. It's identical to OutputTokensEQ.
func OutputTokens(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldOutputTokens, v))
}
// CacheCreationTokens applies equality check predicate on the "cache_creation_tokens" field. It's identical to CacheCreationTokensEQ.
func CacheCreationTokens(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreationTokens, v))
}
// CacheReadTokens applies equality check predicate on the "cache_read_tokens" field. It's identical to CacheReadTokensEQ.
func CacheReadTokens(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheReadTokens, v))
}
// CacheCreation5mTokens applies equality check predicate on the "cache_creation_5m_tokens" field. It's identical to CacheCreation5mTokensEQ.
func CacheCreation5mTokens(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreation5mTokens, v))
}
// CacheCreation1hTokens applies equality check predicate on the "cache_creation_1h_tokens" field. It's identical to CacheCreation1hTokensEQ.
func CacheCreation1hTokens(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreation1hTokens, v))
}
// InputCost applies equality check predicate on the "input_cost" field. It's identical to InputCostEQ.
func InputCost(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldInputCost, v))
}
// OutputCost applies equality check predicate on the "output_cost" field. It's identical to OutputCostEQ.
func OutputCost(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldOutputCost, v))
}
// CacheCreationCost applies equality check predicate on the "cache_creation_cost" field. It's identical to CacheCreationCostEQ.
func CacheCreationCost(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreationCost, v))
}
// CacheReadCost applies equality check predicate on the "cache_read_cost" field. It's identical to CacheReadCostEQ.
func CacheReadCost(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheReadCost, v))
}
// TotalCost applies equality check predicate on the "total_cost" field. It's identical to TotalCostEQ.
func TotalCost(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldTotalCost, v))
}
// ActualCost applies equality check predicate on the "actual_cost" field. It's identical to ActualCostEQ.
func ActualCost(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldActualCost, v))
}
// RateMultiplier applies equality check predicate on the "rate_multiplier" field. It's identical to RateMultiplierEQ.
func RateMultiplier(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldRateMultiplier, v))
}
// BillingType applies equality check predicate on the "billing_type" field. It's identical to BillingTypeEQ.
func BillingType(v int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldBillingType, v))
}
// Stream applies equality check predicate on the "stream" field. It's identical to StreamEQ.
func Stream(v bool) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldStream, v))
}
// DurationMs applies equality check predicate on the "duration_ms" field. It's identical to DurationMsEQ.
func DurationMs(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldDurationMs, v))
}
// FirstTokenMs applies equality check predicate on the "first_token_ms" field. It's identical to FirstTokenMsEQ.
func FirstTokenMs(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldFirstTokenMs, v))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCreatedAt, v))
}
// UserIDEQ applies the EQ predicate on the "user_id" field.
func UserIDEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldUserID, v))
}
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
func UserIDNEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldUserID, v))
}
// UserIDIn applies the In predicate on the "user_id" field.
func UserIDIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldUserID, vs...))
}
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
func UserIDNotIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldUserID, vs...))
}
// APIKeyIDEQ applies the EQ predicate on the "api_key_id" field.
func APIKeyIDEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldAPIKeyID, v))
}
// APIKeyIDNEQ applies the NEQ predicate on the "api_key_id" field.
func APIKeyIDNEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldAPIKeyID, v))
}
// APIKeyIDIn applies the In predicate on the "api_key_id" field.
func APIKeyIDIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldAPIKeyID, vs...))
}
// APIKeyIDNotIn applies the NotIn predicate on the "api_key_id" field.
func APIKeyIDNotIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldAPIKeyID, vs...))
}
// AccountIDEQ applies the EQ predicate on the "account_id" field.
func AccountIDEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldAccountID, v))
}
// AccountIDNEQ applies the NEQ predicate on the "account_id" field.
func AccountIDNEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldAccountID, v))
}
// AccountIDIn applies the In predicate on the "account_id" field.
func AccountIDIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldAccountID, vs...))
}
// AccountIDNotIn applies the NotIn predicate on the "account_id" field.
func AccountIDNotIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldAccountID, vs...))
}
// RequestIDEQ applies the EQ predicate on the "request_id" field.
func RequestIDEQ(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldRequestID, v))
}
// RequestIDNEQ applies the NEQ predicate on the "request_id" field.
func RequestIDNEQ(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldRequestID, v))
}
// RequestIDIn applies the In predicate on the "request_id" field.
func RequestIDIn(vs ...string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldRequestID, vs...))
}
// RequestIDNotIn applies the NotIn predicate on the "request_id" field.
func RequestIDNotIn(vs ...string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldRequestID, vs...))
}
// RequestIDGT applies the GT predicate on the "request_id" field.
func RequestIDGT(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldRequestID, v))
}
// RequestIDGTE applies the GTE predicate on the "request_id" field.
func RequestIDGTE(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldRequestID, v))
}
// RequestIDLT applies the LT predicate on the "request_id" field.
func RequestIDLT(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldRequestID, v))
}
// RequestIDLTE applies the LTE predicate on the "request_id" field.
func RequestIDLTE(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldRequestID, v))
}
// RequestIDContains applies the Contains predicate on the "request_id" field.
func RequestIDContains(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldContains(FieldRequestID, v))
}
// RequestIDHasPrefix applies the HasPrefix predicate on the "request_id" field.
func RequestIDHasPrefix(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldHasPrefix(FieldRequestID, v))
}
// RequestIDHasSuffix applies the HasSuffix predicate on the "request_id" field.
func RequestIDHasSuffix(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldHasSuffix(FieldRequestID, v))
}
// RequestIDEqualFold applies the EqualFold predicate on the "request_id" field.
func RequestIDEqualFold(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEqualFold(FieldRequestID, v))
}
// RequestIDContainsFold applies the ContainsFold predicate on the "request_id" field.
func RequestIDContainsFold(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldContainsFold(FieldRequestID, v))
}
// ModelEQ applies the EQ predicate on the "model" field.
func ModelEQ(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldModel, v))
}
// ModelNEQ applies the NEQ predicate on the "model" field.
func ModelNEQ(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldModel, v))
}
// ModelIn applies the In predicate on the "model" field.
func ModelIn(vs ...string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldModel, vs...))
}
// ModelNotIn applies the NotIn predicate on the "model" field.
func ModelNotIn(vs ...string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldModel, vs...))
}
// ModelGT applies the GT predicate on the "model" field.
func ModelGT(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldModel, v))
}
// ModelGTE applies the GTE predicate on the "model" field.
func ModelGTE(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldModel, v))
}
// ModelLT applies the LT predicate on the "model" field.
func ModelLT(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldModel, v))
}
// ModelLTE applies the LTE predicate on the "model" field.
func ModelLTE(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldModel, v))
}
// ModelContains applies the Contains predicate on the "model" field.
func ModelContains(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldContains(FieldModel, v))
}
// ModelHasPrefix applies the HasPrefix predicate on the "model" field.
func ModelHasPrefix(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldHasPrefix(FieldModel, v))
}
// ModelHasSuffix applies the HasSuffix predicate on the "model" field.
func ModelHasSuffix(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldHasSuffix(FieldModel, v))
}
// ModelEqualFold applies the EqualFold predicate on the "model" field.
func ModelEqualFold(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEqualFold(FieldModel, v))
}
// ModelContainsFold applies the ContainsFold predicate on the "model" field.
func ModelContainsFold(v string) predicate.UsageLog {
return predicate.UsageLog(sql.FieldContainsFold(FieldModel, v))
}
// GroupIDEQ applies the EQ predicate on the "group_id" field.
func GroupIDEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldGroupID, v))
}
// GroupIDNEQ applies the NEQ predicate on the "group_id" field.
func GroupIDNEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldGroupID, v))
}
// GroupIDIn applies the In predicate on the "group_id" field.
func GroupIDIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldGroupID, vs...))
}
// GroupIDNotIn applies the NotIn predicate on the "group_id" field.
func GroupIDNotIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldGroupID, vs...))
}
// GroupIDIsNil applies the IsNil predicate on the "group_id" field.
func GroupIDIsNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldIsNull(FieldGroupID))
}
// GroupIDNotNil applies the NotNil predicate on the "group_id" field.
func GroupIDNotNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotNull(FieldGroupID))
}
// SubscriptionIDEQ applies the EQ predicate on the "subscription_id" field.
func SubscriptionIDEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldSubscriptionID, v))
}
// SubscriptionIDNEQ applies the NEQ predicate on the "subscription_id" field.
func SubscriptionIDNEQ(v int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldSubscriptionID, v))
}
// SubscriptionIDIn applies the In predicate on the "subscription_id" field.
func SubscriptionIDIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldSubscriptionID, vs...))
}
// SubscriptionIDNotIn applies the NotIn predicate on the "subscription_id" field.
func SubscriptionIDNotIn(vs ...int64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldSubscriptionID, vs...))
}
// SubscriptionIDIsNil applies the IsNil predicate on the "subscription_id" field.
func SubscriptionIDIsNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldIsNull(FieldSubscriptionID))
}
// SubscriptionIDNotNil applies the NotNil predicate on the "subscription_id" field.
func SubscriptionIDNotNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotNull(FieldSubscriptionID))
}
// InputTokensEQ applies the EQ predicate on the "input_tokens" field.
func InputTokensEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldInputTokens, v))
}
// InputTokensNEQ applies the NEQ predicate on the "input_tokens" field.
func InputTokensNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldInputTokens, v))
}
// InputTokensIn applies the In predicate on the "input_tokens" field.
func InputTokensIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldInputTokens, vs...))
}
// InputTokensNotIn applies the NotIn predicate on the "input_tokens" field.
func InputTokensNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldInputTokens, vs...))
}
// InputTokensGT applies the GT predicate on the "input_tokens" field.
func InputTokensGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldInputTokens, v))
}
// InputTokensGTE applies the GTE predicate on the "input_tokens" field.
func InputTokensGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldInputTokens, v))
}
// InputTokensLT applies the LT predicate on the "input_tokens" field.
func InputTokensLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldInputTokens, v))
}
// InputTokensLTE applies the LTE predicate on the "input_tokens" field.
func InputTokensLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldInputTokens, v))
}
// OutputTokensEQ applies the EQ predicate on the "output_tokens" field.
func OutputTokensEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldOutputTokens, v))
}
// OutputTokensNEQ applies the NEQ predicate on the "output_tokens" field.
func OutputTokensNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldOutputTokens, v))
}
// OutputTokensIn applies the In predicate on the "output_tokens" field.
func OutputTokensIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldOutputTokens, vs...))
}
// OutputTokensNotIn applies the NotIn predicate on the "output_tokens" field.
func OutputTokensNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldOutputTokens, vs...))
}
// OutputTokensGT applies the GT predicate on the "output_tokens" field.
func OutputTokensGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldOutputTokens, v))
}
// OutputTokensGTE applies the GTE predicate on the "output_tokens" field.
func OutputTokensGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldOutputTokens, v))
}
// OutputTokensLT applies the LT predicate on the "output_tokens" field.
func OutputTokensLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldOutputTokens, v))
}
// OutputTokensLTE applies the LTE predicate on the "output_tokens" field.
func OutputTokensLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldOutputTokens, v))
}
// CacheCreationTokensEQ applies the EQ predicate on the "cache_creation_tokens" field.
func CacheCreationTokensEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreationTokens, v))
}
// CacheCreationTokensNEQ applies the NEQ predicate on the "cache_creation_tokens" field.
func CacheCreationTokensNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldCacheCreationTokens, v))
}
// CacheCreationTokensIn applies the In predicate on the "cache_creation_tokens" field.
func CacheCreationTokensIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldCacheCreationTokens, vs...))
}
// CacheCreationTokensNotIn applies the NotIn predicate on the "cache_creation_tokens" field.
func CacheCreationTokensNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldCacheCreationTokens, vs...))
}
// CacheCreationTokensGT applies the GT predicate on the "cache_creation_tokens" field.
func CacheCreationTokensGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldCacheCreationTokens, v))
}
// CacheCreationTokensGTE applies the GTE predicate on the "cache_creation_tokens" field.
func CacheCreationTokensGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldCacheCreationTokens, v))
}
// CacheCreationTokensLT applies the LT predicate on the "cache_creation_tokens" field.
func CacheCreationTokensLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldCacheCreationTokens, v))
}
// CacheCreationTokensLTE applies the LTE predicate on the "cache_creation_tokens" field.
func CacheCreationTokensLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldCacheCreationTokens, v))
}
// CacheReadTokensEQ applies the EQ predicate on the "cache_read_tokens" field.
func CacheReadTokensEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheReadTokens, v))
}
// CacheReadTokensNEQ applies the NEQ predicate on the "cache_read_tokens" field.
func CacheReadTokensNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldCacheReadTokens, v))
}
// CacheReadTokensIn applies the In predicate on the "cache_read_tokens" field.
func CacheReadTokensIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldCacheReadTokens, vs...))
}
// CacheReadTokensNotIn applies the NotIn predicate on the "cache_read_tokens" field.
func CacheReadTokensNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldCacheReadTokens, vs...))
}
// CacheReadTokensGT applies the GT predicate on the "cache_read_tokens" field.
func CacheReadTokensGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldCacheReadTokens, v))
}
// CacheReadTokensGTE applies the GTE predicate on the "cache_read_tokens" field.
func CacheReadTokensGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldCacheReadTokens, v))
}
// CacheReadTokensLT applies the LT predicate on the "cache_read_tokens" field.
func CacheReadTokensLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldCacheReadTokens, v))
}
// CacheReadTokensLTE applies the LTE predicate on the "cache_read_tokens" field.
func CacheReadTokensLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldCacheReadTokens, v))
}
// CacheCreation5mTokensEQ applies the EQ predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreation5mTokens, v))
}
// CacheCreation5mTokensNEQ applies the NEQ predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldCacheCreation5mTokens, v))
}
// CacheCreation5mTokensIn applies the In predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldCacheCreation5mTokens, vs...))
}
// CacheCreation5mTokensNotIn applies the NotIn predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldCacheCreation5mTokens, vs...))
}
// CacheCreation5mTokensGT applies the GT predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldCacheCreation5mTokens, v))
}
// CacheCreation5mTokensGTE applies the GTE predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldCacheCreation5mTokens, v))
}
// CacheCreation5mTokensLT applies the LT predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldCacheCreation5mTokens, v))
}
// CacheCreation5mTokensLTE applies the LTE predicate on the "cache_creation_5m_tokens" field.
func CacheCreation5mTokensLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldCacheCreation5mTokens, v))
}
// CacheCreation1hTokensEQ applies the EQ predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreation1hTokens, v))
}
// CacheCreation1hTokensNEQ applies the NEQ predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldCacheCreation1hTokens, v))
}
// CacheCreation1hTokensIn applies the In predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldCacheCreation1hTokens, vs...))
}
// CacheCreation1hTokensNotIn applies the NotIn predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldCacheCreation1hTokens, vs...))
}
// CacheCreation1hTokensGT applies the GT predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldCacheCreation1hTokens, v))
}
// CacheCreation1hTokensGTE applies the GTE predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldCacheCreation1hTokens, v))
}
// CacheCreation1hTokensLT applies the LT predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldCacheCreation1hTokens, v))
}
// CacheCreation1hTokensLTE applies the LTE predicate on the "cache_creation_1h_tokens" field.
func CacheCreation1hTokensLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldCacheCreation1hTokens, v))
}
// InputCostEQ applies the EQ predicate on the "input_cost" field.
func InputCostEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldInputCost, v))
}
// InputCostNEQ applies the NEQ predicate on the "input_cost" field.
func InputCostNEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldInputCost, v))
}
// InputCostIn applies the In predicate on the "input_cost" field.
func InputCostIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldInputCost, vs...))
}
// InputCostNotIn applies the NotIn predicate on the "input_cost" field.
func InputCostNotIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldInputCost, vs...))
}
// InputCostGT applies the GT predicate on the "input_cost" field.
func InputCostGT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldInputCost, v))
}
// InputCostGTE applies the GTE predicate on the "input_cost" field.
func InputCostGTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldInputCost, v))
}
// InputCostLT applies the LT predicate on the "input_cost" field.
func InputCostLT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldInputCost, v))
}
// InputCostLTE applies the LTE predicate on the "input_cost" field.
func InputCostLTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldInputCost, v))
}
// OutputCostEQ applies the EQ predicate on the "output_cost" field.
func OutputCostEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldOutputCost, v))
}
// OutputCostNEQ applies the NEQ predicate on the "output_cost" field.
func OutputCostNEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldOutputCost, v))
}
// OutputCostIn applies the In predicate on the "output_cost" field.
func OutputCostIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldOutputCost, vs...))
}
// OutputCostNotIn applies the NotIn predicate on the "output_cost" field.
func OutputCostNotIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldOutputCost, vs...))
}
// OutputCostGT applies the GT predicate on the "output_cost" field.
func OutputCostGT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldOutputCost, v))
}
// OutputCostGTE applies the GTE predicate on the "output_cost" field.
func OutputCostGTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldOutputCost, v))
}
// OutputCostLT applies the LT predicate on the "output_cost" field.
func OutputCostLT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldOutputCost, v))
}
// OutputCostLTE applies the LTE predicate on the "output_cost" field.
func OutputCostLTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldOutputCost, v))
}
// CacheCreationCostEQ applies the EQ predicate on the "cache_creation_cost" field.
func CacheCreationCostEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheCreationCost, v))
}
// CacheCreationCostNEQ applies the NEQ predicate on the "cache_creation_cost" field.
func CacheCreationCostNEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldCacheCreationCost, v))
}
// CacheCreationCostIn applies the In predicate on the "cache_creation_cost" field.
func CacheCreationCostIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldCacheCreationCost, vs...))
}
// CacheCreationCostNotIn applies the NotIn predicate on the "cache_creation_cost" field.
func CacheCreationCostNotIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldCacheCreationCost, vs...))
}
// CacheCreationCostGT applies the GT predicate on the "cache_creation_cost" field.
func CacheCreationCostGT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldCacheCreationCost, v))
}
// CacheCreationCostGTE applies the GTE predicate on the "cache_creation_cost" field.
func CacheCreationCostGTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldCacheCreationCost, v))
}
// CacheCreationCostLT applies the LT predicate on the "cache_creation_cost" field.
func CacheCreationCostLT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldCacheCreationCost, v))
}
// CacheCreationCostLTE applies the LTE predicate on the "cache_creation_cost" field.
func CacheCreationCostLTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldCacheCreationCost, v))
}
// CacheReadCostEQ applies the EQ predicate on the "cache_read_cost" field.
func CacheReadCostEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCacheReadCost, v))
}
// CacheReadCostNEQ applies the NEQ predicate on the "cache_read_cost" field.
func CacheReadCostNEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldCacheReadCost, v))
}
// CacheReadCostIn applies the In predicate on the "cache_read_cost" field.
func CacheReadCostIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldCacheReadCost, vs...))
}
// CacheReadCostNotIn applies the NotIn predicate on the "cache_read_cost" field.
func CacheReadCostNotIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldCacheReadCost, vs...))
}
// CacheReadCostGT applies the GT predicate on the "cache_read_cost" field.
func CacheReadCostGT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldCacheReadCost, v))
}
// CacheReadCostGTE applies the GTE predicate on the "cache_read_cost" field.
func CacheReadCostGTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldCacheReadCost, v))
}
// CacheReadCostLT applies the LT predicate on the "cache_read_cost" field.
func CacheReadCostLT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldCacheReadCost, v))
}
// CacheReadCostLTE applies the LTE predicate on the "cache_read_cost" field.
func CacheReadCostLTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldCacheReadCost, v))
}
// TotalCostEQ applies the EQ predicate on the "total_cost" field.
func TotalCostEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldTotalCost, v))
}
// TotalCostNEQ applies the NEQ predicate on the "total_cost" field.
func TotalCostNEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldTotalCost, v))
}
// TotalCostIn applies the In predicate on the "total_cost" field.
func TotalCostIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldTotalCost, vs...))
}
// TotalCostNotIn applies the NotIn predicate on the "total_cost" field.
func TotalCostNotIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldTotalCost, vs...))
}
// TotalCostGT applies the GT predicate on the "total_cost" field.
func TotalCostGT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldTotalCost, v))
}
// TotalCostGTE applies the GTE predicate on the "total_cost" field.
func TotalCostGTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldTotalCost, v))
}
// TotalCostLT applies the LT predicate on the "total_cost" field.
func TotalCostLT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldTotalCost, v))
}
// TotalCostLTE applies the LTE predicate on the "total_cost" field.
func TotalCostLTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldTotalCost, v))
}
// ActualCostEQ applies the EQ predicate on the "actual_cost" field.
func ActualCostEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldActualCost, v))
}
// ActualCostNEQ applies the NEQ predicate on the "actual_cost" field.
func ActualCostNEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldActualCost, v))
}
// ActualCostIn applies the In predicate on the "actual_cost" field.
func ActualCostIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldActualCost, vs...))
}
// ActualCostNotIn applies the NotIn predicate on the "actual_cost" field.
func ActualCostNotIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldActualCost, vs...))
}
// ActualCostGT applies the GT predicate on the "actual_cost" field.
func ActualCostGT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldActualCost, v))
}
// ActualCostGTE applies the GTE predicate on the "actual_cost" field.
func ActualCostGTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldActualCost, v))
}
// ActualCostLT applies the LT predicate on the "actual_cost" field.
func ActualCostLT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldActualCost, v))
}
// ActualCostLTE applies the LTE predicate on the "actual_cost" field.
func ActualCostLTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldActualCost, v))
}
// RateMultiplierEQ applies the EQ predicate on the "rate_multiplier" field.
func RateMultiplierEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldRateMultiplier, v))
}
// RateMultiplierNEQ applies the NEQ predicate on the "rate_multiplier" field.
func RateMultiplierNEQ(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldRateMultiplier, v))
}
// RateMultiplierIn applies the In predicate on the "rate_multiplier" field.
func RateMultiplierIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldRateMultiplier, vs...))
}
// RateMultiplierNotIn applies the NotIn predicate on the "rate_multiplier" field.
func RateMultiplierNotIn(vs ...float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldRateMultiplier, vs...))
}
// RateMultiplierGT applies the GT predicate on the "rate_multiplier" field.
func RateMultiplierGT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldRateMultiplier, v))
}
// RateMultiplierGTE applies the GTE predicate on the "rate_multiplier" field.
func RateMultiplierGTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldRateMultiplier, v))
}
// RateMultiplierLT applies the LT predicate on the "rate_multiplier" field.
func RateMultiplierLT(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldRateMultiplier, v))
}
// RateMultiplierLTE applies the LTE predicate on the "rate_multiplier" field.
func RateMultiplierLTE(v float64) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldRateMultiplier, v))
}
// BillingTypeEQ applies the EQ predicate on the "billing_type" field.
func BillingTypeEQ(v int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldBillingType, v))
}
// BillingTypeNEQ applies the NEQ predicate on the "billing_type" field.
func BillingTypeNEQ(v int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldBillingType, v))
}
// BillingTypeIn applies the In predicate on the "billing_type" field.
func BillingTypeIn(vs ...int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldBillingType, vs...))
}
// BillingTypeNotIn applies the NotIn predicate on the "billing_type" field.
func BillingTypeNotIn(vs ...int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldBillingType, vs...))
}
// BillingTypeGT applies the GT predicate on the "billing_type" field.
func BillingTypeGT(v int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldBillingType, v))
}
// BillingTypeGTE applies the GTE predicate on the "billing_type" field.
func BillingTypeGTE(v int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldBillingType, v))
}
// BillingTypeLT applies the LT predicate on the "billing_type" field.
func BillingTypeLT(v int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldBillingType, v))
}
// BillingTypeLTE applies the LTE predicate on the "billing_type" field.
func BillingTypeLTE(v int8) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldBillingType, v))
}
// StreamEQ applies the EQ predicate on the "stream" field.
func StreamEQ(v bool) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldStream, v))
}
// StreamNEQ applies the NEQ predicate on the "stream" field.
func StreamNEQ(v bool) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldStream, v))
}
// DurationMsEQ applies the EQ predicate on the "duration_ms" field.
func DurationMsEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldDurationMs, v))
}
// DurationMsNEQ applies the NEQ predicate on the "duration_ms" field.
func DurationMsNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldDurationMs, v))
}
// DurationMsIn applies the In predicate on the "duration_ms" field.
func DurationMsIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldDurationMs, vs...))
}
// DurationMsNotIn applies the NotIn predicate on the "duration_ms" field.
func DurationMsNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldDurationMs, vs...))
}
// DurationMsGT applies the GT predicate on the "duration_ms" field.
func DurationMsGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldDurationMs, v))
}
// DurationMsGTE applies the GTE predicate on the "duration_ms" field.
func DurationMsGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldDurationMs, v))
}
// DurationMsLT applies the LT predicate on the "duration_ms" field.
func DurationMsLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldDurationMs, v))
}
// DurationMsLTE applies the LTE predicate on the "duration_ms" field.
func DurationMsLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldDurationMs, v))
}
// DurationMsIsNil applies the IsNil predicate on the "duration_ms" field.
func DurationMsIsNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldIsNull(FieldDurationMs))
}
// DurationMsNotNil applies the NotNil predicate on the "duration_ms" field.
func DurationMsNotNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotNull(FieldDurationMs))
}
// FirstTokenMsEQ applies the EQ predicate on the "first_token_ms" field.
func FirstTokenMsEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldFirstTokenMs, v))
}
// FirstTokenMsNEQ applies the NEQ predicate on the "first_token_ms" field.
func FirstTokenMsNEQ(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldFirstTokenMs, v))
}
// FirstTokenMsIn applies the In predicate on the "first_token_ms" field.
func FirstTokenMsIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldFirstTokenMs, vs...))
}
// FirstTokenMsNotIn applies the NotIn predicate on the "first_token_ms" field.
func FirstTokenMsNotIn(vs ...int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldFirstTokenMs, vs...))
}
// FirstTokenMsGT applies the GT predicate on the "first_token_ms" field.
func FirstTokenMsGT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldFirstTokenMs, v))
}
// FirstTokenMsGTE applies the GTE predicate on the "first_token_ms" field.
func FirstTokenMsGTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldFirstTokenMs, v))
}
// FirstTokenMsLT applies the LT predicate on the "first_token_ms" field.
func FirstTokenMsLT(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldFirstTokenMs, v))
}
// FirstTokenMsLTE applies the LTE predicate on the "first_token_ms" field.
func FirstTokenMsLTE(v int) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldFirstTokenMs, v))
}
// FirstTokenMsIsNil applies the IsNil predicate on the "first_token_ms" field.
func FirstTokenMsIsNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldIsNull(FieldFirstTokenMs))
}
// FirstTokenMsNotNil applies the NotNil predicate on the "first_token_ms" field.
func FirstTokenMsNotNil() predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotNull(FieldFirstTokenMs))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.UsageLog {
return predicate.UsageLog(sql.FieldLTE(FieldCreatedAt, v))
}
// HasUser applies the HasEdge predicate on the "user" edge.
func HasUser() predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasUserWith applies the HasEdge predicate on the "user" edge with a given conditions (other predicates).
func HasUserWith(preds ...predicate.User) predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := newUserStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasAPIKey applies the HasEdge predicate on the "api_key" edge.
func HasAPIKey() predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, APIKeyTable, APIKeyColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasAPIKeyWith applies the HasEdge predicate on the "api_key" edge with a given conditions (other predicates).
func HasAPIKeyWith(preds ...predicate.APIKey) predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := newAPIKeyStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasAccount applies the HasEdge predicate on the "account" edge.
func HasAccount() predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasAccountWith applies the HasEdge predicate on the "account" edge with a given conditions (other predicates).
func HasAccountWith(preds ...predicate.Account) predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := newAccountStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasGroup applies the HasEdge predicate on the "group" edge.
func HasGroup() predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasGroupWith applies the HasEdge predicate on the "group" edge with a given conditions (other predicates).
func HasGroupWith(preds ...predicate.Group) predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := newGroupStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasSubscription applies the HasEdge predicate on the "subscription" edge.
func HasSubscription() predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, SubscriptionTable, SubscriptionColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasSubscriptionWith applies the HasEdge predicate on the "subscription" edge with a given conditions (other predicates).
func HasSubscriptionWith(preds ...predicate.UserSubscription) predicate.UsageLog {
return predicate.UsageLog(func(s *sql.Selector) {
step := newSubscriptionStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.UsageLog) predicate.UsageLog {
return predicate.UsageLog(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.UsageLog) predicate.UsageLog {
return predicate.UsageLog(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.UsageLog) predicate.UsageLog {
return predicate.UsageLog(sql.NotPredicates(p))
}