Sub2API v1.0 - AI API 网关(二开初始版本,基于上游 Wei-Shaw/sub2api)
Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,353 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package channelmonitor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the channelmonitor type in the database.
|
||||
Label = "channel_monitor"
|
||||
// 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"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
// FieldProvider holds the string denoting the provider field in the database.
|
||||
FieldProvider = "provider"
|
||||
// FieldCheckMode holds the string denoting the check_mode field in the database.
|
||||
FieldCheckMode = "check_mode"
|
||||
// FieldAccountID holds the string denoting the account_id field in the database.
|
||||
FieldAccountID = "account_id"
|
||||
// FieldAPIMode holds the string denoting the api_mode field in the database.
|
||||
FieldAPIMode = "api_mode"
|
||||
// FieldEndpoint holds the string denoting the endpoint field in the database.
|
||||
FieldEndpoint = "endpoint"
|
||||
// FieldAPIKeyEncrypted holds the string denoting the api_key_encrypted field in the database.
|
||||
FieldAPIKeyEncrypted = "api_key_encrypted"
|
||||
// FieldPrimaryModel holds the string denoting the primary_model field in the database.
|
||||
FieldPrimaryModel = "primary_model"
|
||||
// FieldExtraModels holds the string denoting the extra_models field in the database.
|
||||
FieldExtraModels = "extra_models"
|
||||
// FieldGroupName holds the string denoting the group_name field in the database.
|
||||
FieldGroupName = "group_name"
|
||||
// FieldEnabled holds the string denoting the enabled field in the database.
|
||||
FieldEnabled = "enabled"
|
||||
// FieldIntervalSeconds holds the string denoting the interval_seconds field in the database.
|
||||
FieldIntervalSeconds = "interval_seconds"
|
||||
// FieldJitterSeconds holds the string denoting the jitter_seconds field in the database.
|
||||
FieldJitterSeconds = "jitter_seconds"
|
||||
// FieldLastCheckedAt holds the string denoting the last_checked_at field in the database.
|
||||
FieldLastCheckedAt = "last_checked_at"
|
||||
// FieldCreatedBy holds the string denoting the created_by field in the database.
|
||||
FieldCreatedBy = "created_by"
|
||||
// FieldTemplateID holds the string denoting the template_id field in the database.
|
||||
FieldTemplateID = "template_id"
|
||||
// FieldExtraHeaders holds the string denoting the extra_headers field in the database.
|
||||
FieldExtraHeaders = "extra_headers"
|
||||
// FieldBodyOverrideMode holds the string denoting the body_override_mode field in the database.
|
||||
FieldBodyOverrideMode = "body_override_mode"
|
||||
// FieldBodyOverride holds the string denoting the body_override field in the database.
|
||||
FieldBodyOverride = "body_override"
|
||||
// EdgeHistory holds the string denoting the history edge name in mutations.
|
||||
EdgeHistory = "history"
|
||||
// EdgeDailyRollups holds the string denoting the daily_rollups edge name in mutations.
|
||||
EdgeDailyRollups = "daily_rollups"
|
||||
// EdgeRequestTemplate holds the string denoting the request_template edge name in mutations.
|
||||
EdgeRequestTemplate = "request_template"
|
||||
// Table holds the table name of the channelmonitor in the database.
|
||||
Table = "channel_monitors"
|
||||
// HistoryTable is the table that holds the history relation/edge.
|
||||
HistoryTable = "channel_monitor_histories"
|
||||
// HistoryInverseTable is the table name for the ChannelMonitorHistory entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "channelmonitorhistory" package.
|
||||
HistoryInverseTable = "channel_monitor_histories"
|
||||
// HistoryColumn is the table column denoting the history relation/edge.
|
||||
HistoryColumn = "monitor_id"
|
||||
// DailyRollupsTable is the table that holds the daily_rollups relation/edge.
|
||||
DailyRollupsTable = "channel_monitor_daily_rollups"
|
||||
// DailyRollupsInverseTable is the table name for the ChannelMonitorDailyRollup entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "channelmonitordailyrollup" package.
|
||||
DailyRollupsInverseTable = "channel_monitor_daily_rollups"
|
||||
// DailyRollupsColumn is the table column denoting the daily_rollups relation/edge.
|
||||
DailyRollupsColumn = "monitor_id"
|
||||
// RequestTemplateTable is the table that holds the request_template relation/edge.
|
||||
RequestTemplateTable = "channel_monitors"
|
||||
// RequestTemplateInverseTable is the table name for the ChannelMonitorRequestTemplate entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "channelmonitorrequesttemplate" package.
|
||||
RequestTemplateInverseTable = "channel_monitor_request_templates"
|
||||
// RequestTemplateColumn is the table column denoting the request_template relation/edge.
|
||||
RequestTemplateColumn = "template_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for channelmonitor fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
FieldName,
|
||||
FieldProvider,
|
||||
FieldCheckMode,
|
||||
FieldAccountID,
|
||||
FieldAPIMode,
|
||||
FieldEndpoint,
|
||||
FieldAPIKeyEncrypted,
|
||||
FieldPrimaryModel,
|
||||
FieldExtraModels,
|
||||
FieldGroupName,
|
||||
FieldEnabled,
|
||||
FieldIntervalSeconds,
|
||||
FieldJitterSeconds,
|
||||
FieldLastCheckedAt,
|
||||
FieldCreatedBy,
|
||||
FieldTemplateID,
|
||||
FieldExtraHeaders,
|
||||
FieldBodyOverrideMode,
|
||||
FieldBodyOverride,
|
||||
}
|
||||
|
||||
// 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
|
||||
// NameValidator is a validator for the "name" field. It is called by the builders before save.
|
||||
NameValidator func(string) error
|
||||
// DefaultCheckMode holds the default value on creation for the "check_mode" field.
|
||||
DefaultCheckMode string
|
||||
// CheckModeValidator is a validator for the "check_mode" field. It is called by the builders before save.
|
||||
CheckModeValidator func(string) error
|
||||
// DefaultAPIMode holds the default value on creation for the "api_mode" field.
|
||||
DefaultAPIMode string
|
||||
// APIModeValidator is a validator for the "api_mode" field. It is called by the builders before save.
|
||||
APIModeValidator func(string) error
|
||||
// EndpointValidator is a validator for the "endpoint" field. It is called by the builders before save.
|
||||
EndpointValidator func(string) error
|
||||
// APIKeyEncryptedValidator is a validator for the "api_key_encrypted" field. It is called by the builders before save.
|
||||
APIKeyEncryptedValidator func(string) error
|
||||
// PrimaryModelValidator is a validator for the "primary_model" field. It is called by the builders before save.
|
||||
PrimaryModelValidator func(string) error
|
||||
// DefaultExtraModels holds the default value on creation for the "extra_models" field.
|
||||
DefaultExtraModels []string
|
||||
// DefaultGroupName holds the default value on creation for the "group_name" field.
|
||||
DefaultGroupName string
|
||||
// GroupNameValidator is a validator for the "group_name" field. It is called by the builders before save.
|
||||
GroupNameValidator func(string) error
|
||||
// DefaultEnabled holds the default value on creation for the "enabled" field.
|
||||
DefaultEnabled bool
|
||||
// IntervalSecondsValidator is a validator for the "interval_seconds" field. It is called by the builders before save.
|
||||
IntervalSecondsValidator func(int) error
|
||||
// DefaultJitterSeconds holds the default value on creation for the "jitter_seconds" field.
|
||||
DefaultJitterSeconds int
|
||||
// JitterSecondsValidator is a validator for the "jitter_seconds" field. It is called by the builders before save.
|
||||
JitterSecondsValidator func(int) error
|
||||
// DefaultExtraHeaders holds the default value on creation for the "extra_headers" field.
|
||||
DefaultExtraHeaders map[string]string
|
||||
// DefaultBodyOverrideMode holds the default value on creation for the "body_override_mode" field.
|
||||
DefaultBodyOverrideMode string
|
||||
// BodyOverrideModeValidator is a validator for the "body_override_mode" field. It is called by the builders before save.
|
||||
BodyOverrideModeValidator func(string) error
|
||||
)
|
||||
|
||||
// Provider defines the type for the "provider" enum field.
|
||||
type Provider string
|
||||
|
||||
// Provider values.
|
||||
const (
|
||||
ProviderOpenai Provider = "openai"
|
||||
ProviderAnthropic Provider = "anthropic"
|
||||
ProviderGemini Provider = "gemini"
|
||||
ProviderGrok Provider = "grok"
|
||||
ProviderAntigravity Provider = "antigravity"
|
||||
ProviderKimi Provider = "kimi"
|
||||
ProviderZhipu Provider = "zhipu"
|
||||
ProviderDeepseek Provider = "deepseek"
|
||||
)
|
||||
|
||||
func (pr Provider) String() string {
|
||||
return string(pr)
|
||||
}
|
||||
|
||||
// ProviderValidator is a validator for the "provider" field enum values. It is called by the builders before save.
|
||||
func ProviderValidator(pr Provider) error {
|
||||
switch pr {
|
||||
case ProviderOpenai, ProviderAnthropic, ProviderGemini, ProviderGrok, ProviderAntigravity, ProviderKimi, ProviderZhipu, ProviderDeepseek:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("channelmonitor: invalid enum value for provider field: %q", pr)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the ChannelMonitor 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()
|
||||
}
|
||||
|
||||
// ByName orders the results by the name field.
|
||||
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByProvider orders the results by the provider field.
|
||||
func ByProvider(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldProvider, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCheckMode orders the results by the check_mode field.
|
||||
func ByCheckMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCheckMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAccountID orders the results by the account_id field.
|
||||
func ByAccountID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAccountID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAPIMode orders the results by the api_mode field.
|
||||
func ByAPIMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAPIMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEndpoint orders the results by the endpoint field.
|
||||
func ByEndpoint(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEndpoint, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAPIKeyEncrypted orders the results by the api_key_encrypted field.
|
||||
func ByAPIKeyEncrypted(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAPIKeyEncrypted, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPrimaryModel orders the results by the primary_model field.
|
||||
func ByPrimaryModel(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPrimaryModel, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGroupName orders the results by the group_name field.
|
||||
func ByGroupName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGroupName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByEnabled orders the results by the enabled field.
|
||||
func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldEnabled, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByIntervalSeconds orders the results by the interval_seconds field.
|
||||
func ByIntervalSeconds(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldIntervalSeconds, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByJitterSeconds orders the results by the jitter_seconds field.
|
||||
func ByJitterSeconds(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldJitterSeconds, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLastCheckedAt orders the results by the last_checked_at field.
|
||||
func ByLastCheckedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLastCheckedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCreatedBy orders the results by the created_by field.
|
||||
func ByCreatedBy(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedBy, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTemplateID orders the results by the template_id field.
|
||||
func ByTemplateID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTemplateID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBodyOverrideMode orders the results by the body_override_mode field.
|
||||
func ByBodyOverrideMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBodyOverrideMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByHistoryCount orders the results by history count.
|
||||
func ByHistoryCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newHistoryStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByHistory orders the results by history terms.
|
||||
func ByHistory(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newHistoryStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByDailyRollupsCount orders the results by daily_rollups count.
|
||||
func ByDailyRollupsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newDailyRollupsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByDailyRollups orders the results by daily_rollups terms.
|
||||
func ByDailyRollups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newDailyRollupsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByRequestTemplateField orders the results by request_template field.
|
||||
func ByRequestTemplateField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newRequestTemplateStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newHistoryStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(HistoryInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, HistoryTable, HistoryColumn),
|
||||
)
|
||||
}
|
||||
func newDailyRollupsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(DailyRollupsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, DailyRollupsTable, DailyRollupsColumn),
|
||||
)
|
||||
}
|
||||
func newRequestTemplateStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(RequestTemplateInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, false, RequestTemplateTable, RequestTemplateColumn),
|
||||
)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user