| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- // Code generated by ent, DO NOT EDIT.
- package account
- import (
- "fmt"
- "time"
- "entgo.io/ent"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- )
- const (
- // Label holds the string label denoting the account type in the database.
- Label = "account"
- // 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"
- // FieldDeletedAt holds the string denoting the deleted_at field in the database.
- FieldDeletedAt = "deleted_at"
- // FieldName holds the string denoting the name field in the database.
- FieldName = "name"
- // FieldNotes holds the string denoting the notes field in the database.
- FieldNotes = "notes"
- // FieldPlatform holds the string denoting the platform field in the database.
- FieldPlatform = "platform"
- // FieldType holds the string denoting the type field in the database.
- FieldType = "type"
- // FieldCredentials holds the string denoting the credentials field in the database.
- FieldCredentials = "credentials"
- // FieldExtra holds the string denoting the extra field in the database.
- FieldExtra = "extra"
- // FieldProxyID holds the string denoting the proxy_id field in the database.
- FieldProxyID = "proxy_id"
- // FieldProxyFallbackOriginID holds the string denoting the proxy_fallback_origin_id field in the database.
- FieldProxyFallbackOriginID = "proxy_fallback_origin_id"
- // FieldConcurrency holds the string denoting the concurrency field in the database.
- FieldConcurrency = "concurrency"
- // FieldLoadFactor holds the string denoting the load_factor field in the database.
- FieldLoadFactor = "load_factor"
- // FieldPriority holds the string denoting the priority field in the database.
- FieldPriority = "priority"
- // FieldRateMultiplier holds the string denoting the rate_multiplier field in the database.
- FieldRateMultiplier = "rate_multiplier"
- // FieldStatus holds the string denoting the status field in the database.
- FieldStatus = "status"
- // FieldErrorMessage holds the string denoting the error_message field in the database.
- FieldErrorMessage = "error_message"
- // FieldLastUsedAt holds the string denoting the last_used_at field in the database.
- FieldLastUsedAt = "last_used_at"
- // FieldExpiresAt holds the string denoting the expires_at field in the database.
- FieldExpiresAt = "expires_at"
- // FieldAutoPauseOnExpired holds the string denoting the auto_pause_on_expired field in the database.
- FieldAutoPauseOnExpired = "auto_pause_on_expired"
- // FieldSchedulable holds the string denoting the schedulable field in the database.
- FieldSchedulable = "schedulable"
- // FieldRateLimitedAt holds the string denoting the rate_limited_at field in the database.
- FieldRateLimitedAt = "rate_limited_at"
- // FieldRateLimitResetAt holds the string denoting the rate_limit_reset_at field in the database.
- FieldRateLimitResetAt = "rate_limit_reset_at"
- // FieldOverloadUntil holds the string denoting the overload_until field in the database.
- FieldOverloadUntil = "overload_until"
- // FieldTempUnschedulableUntil holds the string denoting the temp_unschedulable_until field in the database.
- FieldTempUnschedulableUntil = "temp_unschedulable_until"
- // FieldTempUnschedulableReason holds the string denoting the temp_unschedulable_reason field in the database.
- FieldTempUnschedulableReason = "temp_unschedulable_reason"
- // FieldSessionWindowStart holds the string denoting the session_window_start field in the database.
- FieldSessionWindowStart = "session_window_start"
- // FieldSessionWindowEnd holds the string denoting the session_window_end field in the database.
- FieldSessionWindowEnd = "session_window_end"
- // FieldSessionWindowStatus holds the string denoting the session_window_status field in the database.
- FieldSessionWindowStatus = "session_window_status"
- // FieldParentAccountID holds the string denoting the parent_account_id field in the database.
- FieldParentAccountID = "parent_account_id"
- // FieldQuotaDimension holds the string denoting the quota_dimension field in the database.
- FieldQuotaDimension = "quota_dimension"
- // EdgeGroups holds the string denoting the groups edge name in mutations.
- EdgeGroups = "groups"
- // EdgeProxy holds the string denoting the proxy edge name in mutations.
- EdgeProxy = "proxy"
- // EdgeParent holds the string denoting the parent edge name in mutations.
- EdgeParent = "parent"
- // EdgeChildren holds the string denoting the children edge name in mutations.
- EdgeChildren = "children"
- // EdgeUsageLogs holds the string denoting the usage_logs edge name in mutations.
- EdgeUsageLogs = "usage_logs"
- // EdgeAccountGroups holds the string denoting the account_groups edge name in mutations.
- EdgeAccountGroups = "account_groups"
- // Table holds the table name of the account in the database.
- Table = "accounts"
- // GroupsTable is the table that holds the groups relation/edge. The primary key declared below.
- GroupsTable = "account_groups"
- // GroupsInverseTable is the table name for the Group entity.
- // It exists in this package in order to avoid circular dependency with the "group" package.
- GroupsInverseTable = "groups"
- // ProxyTable is the table that holds the proxy relation/edge.
- ProxyTable = "accounts"
- // ProxyInverseTable is the table name for the Proxy entity.
- // It exists in this package in order to avoid circular dependency with the "proxy" package.
- ProxyInverseTable = "proxies"
- // ProxyColumn is the table column denoting the proxy relation/edge.
- ProxyColumn = "proxy_id"
- // ParentTable is the table that holds the parent relation/edge.
- ParentTable = "accounts"
- // ParentColumn is the table column denoting the parent relation/edge.
- ParentColumn = "parent_account_id"
- // ChildrenTable is the table that holds the children relation/edge.
- ChildrenTable = "accounts"
- // ChildrenColumn is the table column denoting the children relation/edge.
- ChildrenColumn = "parent_account_id"
- // UsageLogsTable is the table that holds the usage_logs relation/edge.
- UsageLogsTable = "usage_logs"
- // UsageLogsInverseTable is the table name for the UsageLog entity.
- // It exists in this package in order to avoid circular dependency with the "usagelog" package.
- UsageLogsInverseTable = "usage_logs"
- // UsageLogsColumn is the table column denoting the usage_logs relation/edge.
- UsageLogsColumn = "account_id"
- // AccountGroupsTable is the table that holds the account_groups relation/edge.
- AccountGroupsTable = "account_groups"
- // AccountGroupsInverseTable is the table name for the AccountGroup entity.
- // It exists in this package in order to avoid circular dependency with the "accountgroup" package.
- AccountGroupsInverseTable = "account_groups"
- // AccountGroupsColumn is the table column denoting the account_groups relation/edge.
- AccountGroupsColumn = "account_id"
- )
- // Columns holds all SQL columns for account fields.
- var Columns = []string{
- FieldID,
- FieldCreatedAt,
- FieldUpdatedAt,
- FieldDeletedAt,
- FieldName,
- FieldNotes,
- FieldPlatform,
- FieldType,
- FieldCredentials,
- FieldExtra,
- FieldProxyID,
- FieldProxyFallbackOriginID,
- FieldConcurrency,
- FieldLoadFactor,
- FieldPriority,
- FieldRateMultiplier,
- FieldStatus,
- FieldErrorMessage,
- FieldLastUsedAt,
- FieldExpiresAt,
- FieldAutoPauseOnExpired,
- FieldSchedulable,
- FieldRateLimitedAt,
- FieldRateLimitResetAt,
- FieldOverloadUntil,
- FieldTempUnschedulableUntil,
- FieldTempUnschedulableReason,
- FieldSessionWindowStart,
- FieldSessionWindowEnd,
- FieldSessionWindowStatus,
- FieldParentAccountID,
- FieldQuotaDimension,
- }
- var (
- // GroupsPrimaryKey and GroupsColumn2 are the table columns denoting the
- // primary key for the groups relation (M2M).
- GroupsPrimaryKey = []string{"account_id", "group_id"}
- )
- // 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
- }
- // Note that the variables below are initialized by the runtime
- // package on the initialization of the application. Therefore,
- // it should be imported in the main as follows:
- //
- // import _ "github.com/Wei-Shaw/sub2api/ent/runtime"
- var (
- Hooks [1]ent.Hook
- Interceptors [1]ent.Interceptor
- // 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
- // PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
- PlatformValidator func(string) error
- // TypeValidator is a validator for the "type" field. It is called by the builders before save.
- TypeValidator func(string) error
- // DefaultCredentials holds the default value on creation for the "credentials" field.
- DefaultCredentials func() map[string]interface{}
- // DefaultExtra holds the default value on creation for the "extra" field.
- DefaultExtra func() map[string]interface{}
- // DefaultConcurrency holds the default value on creation for the "concurrency" field.
- DefaultConcurrency int
- // DefaultPriority holds the default value on creation for the "priority" field.
- DefaultPriority int
- // DefaultRateMultiplier holds the default value on creation for the "rate_multiplier" field.
- DefaultRateMultiplier float64
- // DefaultStatus holds the default value on creation for the "status" field.
- DefaultStatus string
- // StatusValidator is a validator for the "status" field. It is called by the builders before save.
- StatusValidator func(string) error
- // DefaultAutoPauseOnExpired holds the default value on creation for the "auto_pause_on_expired" field.
- DefaultAutoPauseOnExpired bool
- // DefaultSchedulable holds the default value on creation for the "schedulable" field.
- DefaultSchedulable bool
- // SessionWindowStatusValidator is a validator for the "session_window_status" field. It is called by the builders before save.
- SessionWindowStatusValidator func(string) error
- )
- // QuotaDimension defines the type for the "quota_dimension" enum field.
- type QuotaDimension string
- // QuotaDimensionGlobal is the default value of the QuotaDimension enum.
- const DefaultQuotaDimension = QuotaDimensionGlobal
- // QuotaDimension values.
- const (
- QuotaDimensionGlobal QuotaDimension = "global"
- QuotaDimensionSpark QuotaDimension = "spark"
- )
- func (qd QuotaDimension) String() string {
- return string(qd)
- }
- // QuotaDimensionValidator is a validator for the "quota_dimension" field enum values. It is called by the builders before save.
- func QuotaDimensionValidator(qd QuotaDimension) error {
- switch qd {
- case QuotaDimensionGlobal, QuotaDimensionSpark:
- return nil
- default:
- return fmt.Errorf("account: invalid enum value for quota_dimension field: %q", qd)
- }
- }
- // OrderOption defines the ordering options for the Account 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()
- }
- // ByDeletedAt orders the results by the deleted_at field.
- func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
- }
- // ByName orders the results by the name field.
- func ByName(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldName, opts...).ToFunc()
- }
- // ByNotes orders the results by the notes field.
- func ByNotes(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldNotes, opts...).ToFunc()
- }
- // ByPlatform orders the results by the platform field.
- func ByPlatform(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldPlatform, opts...).ToFunc()
- }
- // ByType orders the results by the type field.
- func ByType(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldType, opts...).ToFunc()
- }
- // ByProxyID orders the results by the proxy_id field.
- func ByProxyID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldProxyID, opts...).ToFunc()
- }
- // ByProxyFallbackOriginID orders the results by the proxy_fallback_origin_id field.
- func ByProxyFallbackOriginID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldProxyFallbackOriginID, opts...).ToFunc()
- }
- // ByConcurrency orders the results by the concurrency field.
- func ByConcurrency(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldConcurrency, opts...).ToFunc()
- }
- // ByLoadFactor orders the results by the load_factor field.
- func ByLoadFactor(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldLoadFactor, opts...).ToFunc()
- }
- // ByPriority orders the results by the priority field.
- func ByPriority(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldPriority, opts...).ToFunc()
- }
- // ByRateMultiplier orders the results by the rate_multiplier field.
- func ByRateMultiplier(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldRateMultiplier, opts...).ToFunc()
- }
- // ByStatus orders the results by the status field.
- func ByStatus(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldStatus, opts...).ToFunc()
- }
- // ByErrorMessage orders the results by the error_message field.
- func ByErrorMessage(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldErrorMessage, opts...).ToFunc()
- }
- // ByLastUsedAt orders the results by the last_used_at field.
- func ByLastUsedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldLastUsedAt, opts...).ToFunc()
- }
- // ByExpiresAt orders the results by the expires_at field.
- func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
- }
- // ByAutoPauseOnExpired orders the results by the auto_pause_on_expired field.
- func ByAutoPauseOnExpired(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldAutoPauseOnExpired, opts...).ToFunc()
- }
- // BySchedulable orders the results by the schedulable field.
- func BySchedulable(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldSchedulable, opts...).ToFunc()
- }
- // ByRateLimitedAt orders the results by the rate_limited_at field.
- func ByRateLimitedAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldRateLimitedAt, opts...).ToFunc()
- }
- // ByRateLimitResetAt orders the results by the rate_limit_reset_at field.
- func ByRateLimitResetAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldRateLimitResetAt, opts...).ToFunc()
- }
- // ByOverloadUntil orders the results by the overload_until field.
- func ByOverloadUntil(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldOverloadUntil, opts...).ToFunc()
- }
- // ByTempUnschedulableUntil orders the results by the temp_unschedulable_until field.
- func ByTempUnschedulableUntil(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldTempUnschedulableUntil, opts...).ToFunc()
- }
- // ByTempUnschedulableReason orders the results by the temp_unschedulable_reason field.
- func ByTempUnschedulableReason(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldTempUnschedulableReason, opts...).ToFunc()
- }
- // BySessionWindowStart orders the results by the session_window_start field.
- func BySessionWindowStart(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldSessionWindowStart, opts...).ToFunc()
- }
- // BySessionWindowEnd orders the results by the session_window_end field.
- func BySessionWindowEnd(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldSessionWindowEnd, opts...).ToFunc()
- }
- // BySessionWindowStatus orders the results by the session_window_status field.
- func BySessionWindowStatus(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldSessionWindowStatus, opts...).ToFunc()
- }
- // ByParentAccountID orders the results by the parent_account_id field.
- func ByParentAccountID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldParentAccountID, opts...).ToFunc()
- }
- // ByQuotaDimension orders the results by the quota_dimension field.
- func ByQuotaDimension(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldQuotaDimension, opts...).ToFunc()
- }
- // ByGroupsCount orders the results by groups count.
- func ByGroupsCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newGroupsStep(), opts...)
- }
- }
- // ByGroups orders the results by groups terms.
- func ByGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- // ByProxyField orders the results by proxy field.
- func ByProxyField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newProxyStep(), sql.OrderByField(field, opts...))
- }
- }
- // ByParentField orders the results by parent field.
- func ByParentField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newParentStep(), sql.OrderByField(field, opts...))
- }
- }
- // ByChildrenCount orders the results by children count.
- func ByChildrenCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newChildrenStep(), opts...)
- }
- }
- // ByChildren orders the results by children terms.
- func ByChildren(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newChildrenStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- // ByUsageLogsCount orders the results by usage_logs count.
- func ByUsageLogsCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newUsageLogsStep(), opts...)
- }
- }
- // ByUsageLogs orders the results by usage_logs terms.
- func ByUsageLogs(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newUsageLogsStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- // ByAccountGroupsCount orders the results by account_groups count.
- func ByAccountGroupsCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newAccountGroupsStep(), opts...)
- }
- }
- // ByAccountGroups orders the results by account_groups terms.
- func ByAccountGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newAccountGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- func newGroupsStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(GroupsInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.M2M, false, GroupsTable, GroupsPrimaryKey...),
- )
- }
- func newProxyStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(ProxyInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, ProxyTable, ProxyColumn),
- )
- }
- func newParentStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(Table, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),
- )
- }
- func newChildrenStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(Table, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, ChildrenTable, ChildrenColumn),
- )
- }
- func newUsageLogsStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(UsageLogsInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, false, UsageLogsTable, UsageLogsColumn),
- )
- }
- func newAccountGroupsStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(AccountGroupsInverseTable, AccountGroupsColumn),
- sqlgraph.Edge(sqlgraph.O2M, true, AccountGroupsTable, AccountGroupsColumn),
- )
- }
|