| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- // Code generated by ent, DO NOT EDIT.
- package proxy
- import (
- "time"
- "entgo.io/ent"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- )
- const (
- // Label holds the string label denoting the proxy type in the database.
- Label = "proxy"
- // 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"
- // FieldProtocol holds the string denoting the protocol field in the database.
- FieldProtocol = "protocol"
- // FieldHost holds the string denoting the host field in the database.
- FieldHost = "host"
- // FieldPort holds the string denoting the port field in the database.
- FieldPort = "port"
- // FieldUsername holds the string denoting the username field in the database.
- FieldUsername = "username"
- // FieldPassword holds the string denoting the password field in the database.
- FieldPassword = "password"
- // FieldStatus holds the string denoting the status field in the database.
- FieldStatus = "status"
- // FieldExpiresAt holds the string denoting the expires_at field in the database.
- FieldExpiresAt = "expires_at"
- // FieldFallbackMode holds the string denoting the fallback_mode field in the database.
- FieldFallbackMode = "fallback_mode"
- // FieldBackupProxyID holds the string denoting the backup_proxy_id field in the database.
- FieldBackupProxyID = "backup_proxy_id"
- // FieldExpiryWarnDays holds the string denoting the expiry_warn_days field in the database.
- FieldExpiryWarnDays = "expiry_warn_days"
- // EdgeAccounts holds the string denoting the accounts edge name in mutations.
- EdgeAccounts = "accounts"
- // EdgePrimaryProxies holds the string denoting the primary_proxies edge name in mutations.
- EdgePrimaryProxies = "primary_proxies"
- // EdgeBackupProxy holds the string denoting the backup_proxy edge name in mutations.
- EdgeBackupProxy = "backup_proxy"
- // Table holds the table name of the proxy in the database.
- Table = "proxies"
- // AccountsTable is the table that holds the accounts relation/edge.
- AccountsTable = "accounts"
- // AccountsInverseTable is the table name for the Account entity.
- // It exists in this package in order to avoid circular dependency with the "account" package.
- AccountsInverseTable = "accounts"
- // AccountsColumn is the table column denoting the accounts relation/edge.
- AccountsColumn = "proxy_id"
- // PrimaryProxiesTable is the table that holds the primary_proxies relation/edge.
- PrimaryProxiesTable = "proxies"
- // PrimaryProxiesColumn is the table column denoting the primary_proxies relation/edge.
- PrimaryProxiesColumn = "backup_proxy_id"
- // BackupProxyTable is the table that holds the backup_proxy relation/edge.
- BackupProxyTable = "proxies"
- // BackupProxyColumn is the table column denoting the backup_proxy relation/edge.
- BackupProxyColumn = "backup_proxy_id"
- )
- // Columns holds all SQL columns for proxy fields.
- var Columns = []string{
- FieldID,
- FieldCreatedAt,
- FieldUpdatedAt,
- FieldDeletedAt,
- FieldName,
- FieldProtocol,
- FieldHost,
- FieldPort,
- FieldUsername,
- FieldPassword,
- FieldStatus,
- FieldExpiresAt,
- FieldFallbackMode,
- FieldBackupProxyID,
- FieldExpiryWarnDays,
- }
- // 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
- // ProtocolValidator is a validator for the "protocol" field. It is called by the builders before save.
- ProtocolValidator func(string) error
- // HostValidator is a validator for the "host" field. It is called by the builders before save.
- HostValidator func(string) error
- // UsernameValidator is a validator for the "username" field. It is called by the builders before save.
- UsernameValidator func(string) error
- // PasswordValidator is a validator for the "password" field. It is called by the builders before save.
- PasswordValidator func(string) error
- // 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
- // DefaultFallbackMode holds the default value on creation for the "fallback_mode" field.
- DefaultFallbackMode string
- // FallbackModeValidator is a validator for the "fallback_mode" field. It is called by the builders before save.
- FallbackModeValidator func(string) error
- // DefaultExpiryWarnDays holds the default value on creation for the "expiry_warn_days" field.
- DefaultExpiryWarnDays int
- )
- // OrderOption defines the ordering options for the Proxy 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()
- }
- // ByProtocol orders the results by the protocol field.
- func ByProtocol(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldProtocol, opts...).ToFunc()
- }
- // ByHost orders the results by the host field.
- func ByHost(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldHost, opts...).ToFunc()
- }
- // ByPort orders the results by the port field.
- func ByPort(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldPort, opts...).ToFunc()
- }
- // ByUsername orders the results by the username field.
- func ByUsername(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldUsername, opts...).ToFunc()
- }
- // ByPassword orders the results by the password field.
- func ByPassword(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldPassword, opts...).ToFunc()
- }
- // ByStatus orders the results by the status field.
- func ByStatus(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldStatus, opts...).ToFunc()
- }
- // ByExpiresAt orders the results by the expires_at field.
- func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
- }
- // ByFallbackMode orders the results by the fallback_mode field.
- func ByFallbackMode(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldFallbackMode, opts...).ToFunc()
- }
- // ByBackupProxyID orders the results by the backup_proxy_id field.
- func ByBackupProxyID(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldBackupProxyID, opts...).ToFunc()
- }
- // ByExpiryWarnDays orders the results by the expiry_warn_days field.
- func ByExpiryWarnDays(opts ...sql.OrderTermOption) OrderOption {
- return sql.OrderByField(FieldExpiryWarnDays, opts...).ToFunc()
- }
- // ByAccountsCount orders the results by accounts count.
- func ByAccountsCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newAccountsStep(), opts...)
- }
- }
- // ByAccounts orders the results by accounts terms.
- func ByAccounts(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newAccountsStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- // ByPrimaryProxiesCount orders the results by primary_proxies count.
- func ByPrimaryProxiesCount(opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborsCount(s, newPrimaryProxiesStep(), opts...)
- }
- }
- // ByPrimaryProxies orders the results by primary_proxies terms.
- func ByPrimaryProxies(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newPrimaryProxiesStep(), append([]sql.OrderTerm{term}, terms...)...)
- }
- }
- // ByBackupProxyField orders the results by backup_proxy field.
- func ByBackupProxyField(field string, opts ...sql.OrderTermOption) OrderOption {
- return func(s *sql.Selector) {
- sqlgraph.OrderByNeighborTerms(s, newBackupProxyStep(), sql.OrderByField(field, opts...))
- }
- }
- func newAccountsStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(AccountsInverseTable, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, true, AccountsTable, AccountsColumn),
- )
- }
- func newPrimaryProxiesStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(Table, FieldID),
- sqlgraph.Edge(sqlgraph.O2M, true, PrimaryProxiesTable, PrimaryProxiesColumn),
- )
- }
- func newBackupProxyStep() *sqlgraph.Step {
- return sqlgraph.NewStep(
- sqlgraph.From(Table, FieldID),
- sqlgraph.To(Table, FieldID),
- sqlgraph.Edge(sqlgraph.M2O, false, BackupProxyTable, BackupProxyColumn),
- )
- }
|