mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 15:10:49 +08:00
feat: prowlarr refactor and support prowlarr seed ratio
This commit is contained in:
@@ -20,7 +20,7 @@ type Indexers struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
// Implementation holds the value of the "implementation" field.
|
||||
Implementation string `json:"implementation,omitempty"`
|
||||
// Settings holds the value of the "settings" field.
|
||||
// deprecated, use api_key and url
|
||||
Settings string `json:"settings,omitempty"`
|
||||
// EnableRss holds the value of the "enable_rss" field.
|
||||
EnableRss bool `json:"enable_rss,omitempty"`
|
||||
@@ -29,7 +29,17 @@ type Indexers struct {
|
||||
// minimal seed ratio requied, before removing torrent
|
||||
SeedRatio float32 `json:"seed_ratio,omitempty"`
|
||||
// Disabled holds the value of the "disabled" field.
|
||||
Disabled bool `json:"disabled,omitempty"`
|
||||
Disabled bool `json:"disabled,omitempty"`
|
||||
// TvSearch holds the value of the "tv_search" field.
|
||||
TvSearch bool `json:"tv_search,omitempty"`
|
||||
// MovieSearch holds the value of the "movie_search" field.
|
||||
MovieSearch bool `json:"movie_search,omitempty"`
|
||||
// APIKey holds the value of the "api_key" field.
|
||||
APIKey string `json:"api_key,omitempty"`
|
||||
// URL holds the value of the "url" field.
|
||||
URL string `json:"url,omitempty"`
|
||||
// synced from prowlarr
|
||||
Synced bool `json:"synced,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
@@ -38,13 +48,13 @@ func (*Indexers) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case indexers.FieldEnableRss, indexers.FieldDisabled:
|
||||
case indexers.FieldEnableRss, indexers.FieldDisabled, indexers.FieldTvSearch, indexers.FieldMovieSearch, indexers.FieldSynced:
|
||||
values[i] = new(sql.NullBool)
|
||||
case indexers.FieldSeedRatio:
|
||||
values[i] = new(sql.NullFloat64)
|
||||
case indexers.FieldID, indexers.FieldPriority:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case indexers.FieldName, indexers.FieldImplementation, indexers.FieldSettings:
|
||||
case indexers.FieldName, indexers.FieldImplementation, indexers.FieldSettings, indexers.FieldAPIKey, indexers.FieldURL:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
@@ -109,6 +119,36 @@ func (i *Indexers) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
i.Disabled = value.Bool
|
||||
}
|
||||
case indexers.FieldTvSearch:
|
||||
if value, ok := values[j].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field tv_search", values[j])
|
||||
} else if value.Valid {
|
||||
i.TvSearch = value.Bool
|
||||
}
|
||||
case indexers.FieldMovieSearch:
|
||||
if value, ok := values[j].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field movie_search", values[j])
|
||||
} else if value.Valid {
|
||||
i.MovieSearch = value.Bool
|
||||
}
|
||||
case indexers.FieldAPIKey:
|
||||
if value, ok := values[j].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field api_key", values[j])
|
||||
} else if value.Valid {
|
||||
i.APIKey = value.String
|
||||
}
|
||||
case indexers.FieldURL:
|
||||
if value, ok := values[j].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field url", values[j])
|
||||
} else if value.Valid {
|
||||
i.URL = value.String
|
||||
}
|
||||
case indexers.FieldSynced:
|
||||
if value, ok := values[j].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field synced", values[j])
|
||||
} else if value.Valid {
|
||||
i.Synced = value.Bool
|
||||
}
|
||||
default:
|
||||
i.selectValues.Set(columns[j], values[j])
|
||||
}
|
||||
@@ -165,6 +205,21 @@ func (i *Indexers) String() string {
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("disabled=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.Disabled))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("tv_search=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.TvSearch))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("movie_search=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.MovieSearch))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("api_key=")
|
||||
builder.WriteString(i.APIKey)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("url=")
|
||||
builder.WriteString(i.URL)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("synced=")
|
||||
builder.WriteString(fmt.Sprintf("%v", i.Synced))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
@@ -25,6 +25,16 @@ const (
|
||||
FieldSeedRatio = "seed_ratio"
|
||||
// FieldDisabled holds the string denoting the disabled field in the database.
|
||||
FieldDisabled = "disabled"
|
||||
// FieldTvSearch holds the string denoting the tv_search field in the database.
|
||||
FieldTvSearch = "tv_search"
|
||||
// FieldMovieSearch holds the string denoting the movie_search field in the database.
|
||||
FieldMovieSearch = "movie_search"
|
||||
// FieldAPIKey holds the string denoting the api_key field in the database.
|
||||
FieldAPIKey = "api_key"
|
||||
// FieldURL holds the string denoting the url field in the database.
|
||||
FieldURL = "url"
|
||||
// FieldSynced holds the string denoting the synced field in the database.
|
||||
FieldSynced = "synced"
|
||||
// Table holds the table name of the indexers in the database.
|
||||
Table = "indexers"
|
||||
)
|
||||
@@ -39,6 +49,11 @@ var Columns = []string{
|
||||
FieldPriority,
|
||||
FieldSeedRatio,
|
||||
FieldDisabled,
|
||||
FieldTvSearch,
|
||||
FieldMovieSearch,
|
||||
FieldAPIKey,
|
||||
FieldURL,
|
||||
FieldSynced,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
@@ -52,6 +67,8 @@ func ValidColumn(column string) bool {
|
||||
}
|
||||
|
||||
var (
|
||||
// DefaultSettings holds the default value on creation for the "settings" field.
|
||||
DefaultSettings string
|
||||
// DefaultEnableRss holds the default value on creation for the "enable_rss" field.
|
||||
DefaultEnableRss bool
|
||||
// DefaultPriority holds the default value on creation for the "priority" field.
|
||||
@@ -60,6 +77,12 @@ var (
|
||||
DefaultSeedRatio float32
|
||||
// DefaultDisabled holds the default value on creation for the "disabled" field.
|
||||
DefaultDisabled bool
|
||||
// DefaultTvSearch holds the default value on creation for the "tv_search" field.
|
||||
DefaultTvSearch bool
|
||||
// DefaultMovieSearch holds the default value on creation for the "movie_search" field.
|
||||
DefaultMovieSearch bool
|
||||
// DefaultSynced holds the default value on creation for the "synced" field.
|
||||
DefaultSynced bool
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Indexers queries.
|
||||
@@ -104,3 +127,28 @@ func BySeedRatio(opts ...sql.OrderTermOption) OrderOption {
|
||||
func ByDisabled(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDisabled, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTvSearch orders the results by the tv_search field.
|
||||
func ByTvSearch(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTvSearch, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMovieSearch orders the results by the movie_search field.
|
||||
func ByMovieSearch(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMovieSearch, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByAPIKey orders the results by the api_key field.
|
||||
func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByURL orders the results by the url field.
|
||||
func ByURL(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldURL, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySynced orders the results by the synced field.
|
||||
func BySynced(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSynced, opts...).ToFunc()
|
||||
}
|
||||
|
||||
@@ -88,6 +88,31 @@ func Disabled(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldDisabled, v))
|
||||
}
|
||||
|
||||
// TvSearch applies equality check predicate on the "tv_search" field. It's identical to TvSearchEQ.
|
||||
func TvSearch(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldTvSearch, v))
|
||||
}
|
||||
|
||||
// MovieSearch applies equality check predicate on the "movie_search" field. It's identical to MovieSearchEQ.
|
||||
func MovieSearch(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldMovieSearch, v))
|
||||
}
|
||||
|
||||
// APIKey applies equality check predicate on the "api_key" field. It's identical to APIKeyEQ.
|
||||
func APIKey(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// URL applies equality check predicate on the "url" field. It's identical to URLEQ.
|
||||
func URL(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldURL, v))
|
||||
}
|
||||
|
||||
// Synced applies equality check predicate on the "synced" field. It's identical to SyncedEQ.
|
||||
func Synced(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldSynced, v))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldName, v))
|
||||
@@ -273,6 +298,16 @@ func SettingsHasSuffix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasSuffix(FieldSettings, v))
|
||||
}
|
||||
|
||||
// SettingsIsNil applies the IsNil predicate on the "settings" field.
|
||||
func SettingsIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldSettings))
|
||||
}
|
||||
|
||||
// SettingsNotNil applies the NotNil predicate on the "settings" field.
|
||||
func SettingsNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldSettings))
|
||||
}
|
||||
|
||||
// SettingsEqualFold applies the EqualFold predicate on the "settings" field.
|
||||
func SettingsEqualFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEqualFold(FieldSettings, v))
|
||||
@@ -403,6 +438,216 @@ func DisabledNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldDisabled))
|
||||
}
|
||||
|
||||
// TvSearchEQ applies the EQ predicate on the "tv_search" field.
|
||||
func TvSearchEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldTvSearch, v))
|
||||
}
|
||||
|
||||
// TvSearchNEQ applies the NEQ predicate on the "tv_search" field.
|
||||
func TvSearchNEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldTvSearch, v))
|
||||
}
|
||||
|
||||
// TvSearchIsNil applies the IsNil predicate on the "tv_search" field.
|
||||
func TvSearchIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldTvSearch))
|
||||
}
|
||||
|
||||
// TvSearchNotNil applies the NotNil predicate on the "tv_search" field.
|
||||
func TvSearchNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldTvSearch))
|
||||
}
|
||||
|
||||
// MovieSearchEQ applies the EQ predicate on the "movie_search" field.
|
||||
func MovieSearchEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldMovieSearch, v))
|
||||
}
|
||||
|
||||
// MovieSearchNEQ applies the NEQ predicate on the "movie_search" field.
|
||||
func MovieSearchNEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldMovieSearch, v))
|
||||
}
|
||||
|
||||
// MovieSearchIsNil applies the IsNil predicate on the "movie_search" field.
|
||||
func MovieSearchIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldMovieSearch))
|
||||
}
|
||||
|
||||
// MovieSearchNotNil applies the NotNil predicate on the "movie_search" field.
|
||||
func MovieSearchNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldMovieSearch))
|
||||
}
|
||||
|
||||
// APIKeyEQ applies the EQ predicate on the "api_key" field.
|
||||
func APIKeyEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyNEQ applies the NEQ predicate on the "api_key" field.
|
||||
func APIKeyNEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyIn applies the In predicate on the "api_key" field.
|
||||
func APIKeyIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIn(FieldAPIKey, vs...))
|
||||
}
|
||||
|
||||
// APIKeyNotIn applies the NotIn predicate on the "api_key" field.
|
||||
func APIKeyNotIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotIn(FieldAPIKey, vs...))
|
||||
}
|
||||
|
||||
// APIKeyGT applies the GT predicate on the "api_key" field.
|
||||
func APIKeyGT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGT(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyGTE applies the GTE predicate on the "api_key" field.
|
||||
func APIKeyGTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGTE(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyLT applies the LT predicate on the "api_key" field.
|
||||
func APIKeyLT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLT(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyLTE applies the LTE predicate on the "api_key" field.
|
||||
func APIKeyLTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLTE(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyContains applies the Contains predicate on the "api_key" field.
|
||||
func APIKeyContains(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContains(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyHasPrefix applies the HasPrefix predicate on the "api_key" field.
|
||||
func APIKeyHasPrefix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasPrefix(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyHasSuffix applies the HasSuffix predicate on the "api_key" field.
|
||||
func APIKeyHasSuffix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasSuffix(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyIsNil applies the IsNil predicate on the "api_key" field.
|
||||
func APIKeyIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldAPIKey))
|
||||
}
|
||||
|
||||
// APIKeyNotNil applies the NotNil predicate on the "api_key" field.
|
||||
func APIKeyNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldAPIKey))
|
||||
}
|
||||
|
||||
// APIKeyEqualFold applies the EqualFold predicate on the "api_key" field.
|
||||
func APIKeyEqualFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEqualFold(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// APIKeyContainsFold applies the ContainsFold predicate on the "api_key" field.
|
||||
func APIKeyContainsFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContainsFold(FieldAPIKey, v))
|
||||
}
|
||||
|
||||
// URLEQ applies the EQ predicate on the "url" field.
|
||||
func URLEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLNEQ applies the NEQ predicate on the "url" field.
|
||||
func URLNEQ(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLIn applies the In predicate on the "url" field.
|
||||
func URLIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIn(FieldURL, vs...))
|
||||
}
|
||||
|
||||
// URLNotIn applies the NotIn predicate on the "url" field.
|
||||
func URLNotIn(vs ...string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotIn(FieldURL, vs...))
|
||||
}
|
||||
|
||||
// URLGT applies the GT predicate on the "url" field.
|
||||
func URLGT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGT(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLGTE applies the GTE predicate on the "url" field.
|
||||
func URLGTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldGTE(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLLT applies the LT predicate on the "url" field.
|
||||
func URLLT(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLT(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLLTE applies the LTE predicate on the "url" field.
|
||||
func URLLTE(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldLTE(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLContains applies the Contains predicate on the "url" field.
|
||||
func URLContains(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContains(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLHasPrefix applies the HasPrefix predicate on the "url" field.
|
||||
func URLHasPrefix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasPrefix(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLHasSuffix applies the HasSuffix predicate on the "url" field.
|
||||
func URLHasSuffix(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldHasSuffix(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLIsNil applies the IsNil predicate on the "url" field.
|
||||
func URLIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldURL))
|
||||
}
|
||||
|
||||
// URLNotNil applies the NotNil predicate on the "url" field.
|
||||
func URLNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldURL))
|
||||
}
|
||||
|
||||
// URLEqualFold applies the EqualFold predicate on the "url" field.
|
||||
func URLEqualFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEqualFold(FieldURL, v))
|
||||
}
|
||||
|
||||
// URLContainsFold applies the ContainsFold predicate on the "url" field.
|
||||
func URLContainsFold(v string) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldContainsFold(FieldURL, v))
|
||||
}
|
||||
|
||||
// SyncedEQ applies the EQ predicate on the "synced" field.
|
||||
func SyncedEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldEQ(FieldSynced, v))
|
||||
}
|
||||
|
||||
// SyncedNEQ applies the NEQ predicate on the "synced" field.
|
||||
func SyncedNEQ(v bool) predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNEQ(FieldSynced, v))
|
||||
}
|
||||
|
||||
// SyncedIsNil applies the IsNil predicate on the "synced" field.
|
||||
func SyncedIsNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldIsNull(FieldSynced))
|
||||
}
|
||||
|
||||
// SyncedNotNil applies the NotNil predicate on the "synced" field.
|
||||
func SyncedNotNil() predicate.Indexers {
|
||||
return predicate.Indexers(sql.FieldNotNull(FieldSynced))
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Indexers) predicate.Indexers {
|
||||
return predicate.Indexers(sql.AndPredicates(predicates...))
|
||||
|
||||
@@ -37,6 +37,14 @@ func (ic *IndexersCreate) SetSettings(s string) *IndexersCreate {
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableSettings sets the "settings" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableSettings(s *string) *IndexersCreate {
|
||||
if s != nil {
|
||||
ic.SetSettings(*s)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
func (ic *IndexersCreate) SetEnableRss(b bool) *IndexersCreate {
|
||||
ic.mutation.SetEnableRss(b)
|
||||
@@ -93,6 +101,76 @@ func (ic *IndexersCreate) SetNillableDisabled(b *bool) *IndexersCreate {
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (ic *IndexersCreate) SetTvSearch(b bool) *IndexersCreate {
|
||||
ic.mutation.SetTvSearch(b)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableTvSearch sets the "tv_search" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableTvSearch(b *bool) *IndexersCreate {
|
||||
if b != nil {
|
||||
ic.SetTvSearch(*b)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (ic *IndexersCreate) SetMovieSearch(b bool) *IndexersCreate {
|
||||
ic.mutation.SetMovieSearch(b)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableMovieSearch sets the "movie_search" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableMovieSearch(b *bool) *IndexersCreate {
|
||||
if b != nil {
|
||||
ic.SetMovieSearch(*b)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (ic *IndexersCreate) SetAPIKey(s string) *IndexersCreate {
|
||||
ic.mutation.SetAPIKey(s)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableAPIKey(s *string) *IndexersCreate {
|
||||
if s != nil {
|
||||
ic.SetAPIKey(*s)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (ic *IndexersCreate) SetURL(s string) *IndexersCreate {
|
||||
ic.mutation.SetURL(s)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableURL sets the "url" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableURL(s *string) *IndexersCreate {
|
||||
if s != nil {
|
||||
ic.SetURL(*s)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (ic *IndexersCreate) SetSynced(b bool) *IndexersCreate {
|
||||
ic.mutation.SetSynced(b)
|
||||
return ic
|
||||
}
|
||||
|
||||
// SetNillableSynced sets the "synced" field if the given value is not nil.
|
||||
func (ic *IndexersCreate) SetNillableSynced(b *bool) *IndexersCreate {
|
||||
if b != nil {
|
||||
ic.SetSynced(*b)
|
||||
}
|
||||
return ic
|
||||
}
|
||||
|
||||
// Mutation returns the IndexersMutation object of the builder.
|
||||
func (ic *IndexersCreate) Mutation() *IndexersMutation {
|
||||
return ic.mutation
|
||||
@@ -128,6 +206,10 @@ func (ic *IndexersCreate) ExecX(ctx context.Context) {
|
||||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (ic *IndexersCreate) defaults() {
|
||||
if _, ok := ic.mutation.Settings(); !ok {
|
||||
v := indexers.DefaultSettings
|
||||
ic.mutation.SetSettings(v)
|
||||
}
|
||||
if _, ok := ic.mutation.EnableRss(); !ok {
|
||||
v := indexers.DefaultEnableRss
|
||||
ic.mutation.SetEnableRss(v)
|
||||
@@ -144,6 +226,18 @@ func (ic *IndexersCreate) defaults() {
|
||||
v := indexers.DefaultDisabled
|
||||
ic.mutation.SetDisabled(v)
|
||||
}
|
||||
if _, ok := ic.mutation.TvSearch(); !ok {
|
||||
v := indexers.DefaultTvSearch
|
||||
ic.mutation.SetTvSearch(v)
|
||||
}
|
||||
if _, ok := ic.mutation.MovieSearch(); !ok {
|
||||
v := indexers.DefaultMovieSearch
|
||||
ic.mutation.SetMovieSearch(v)
|
||||
}
|
||||
if _, ok := ic.mutation.Synced(); !ok {
|
||||
v := indexers.DefaultSynced
|
||||
ic.mutation.SetSynced(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
@@ -154,9 +248,6 @@ func (ic *IndexersCreate) check() error {
|
||||
if _, ok := ic.mutation.Implementation(); !ok {
|
||||
return &ValidationError{Name: "implementation", err: errors.New(`ent: missing required field "Indexers.implementation"`)}
|
||||
}
|
||||
if _, ok := ic.mutation.Settings(); !ok {
|
||||
return &ValidationError{Name: "settings", err: errors.New(`ent: missing required field "Indexers.settings"`)}
|
||||
}
|
||||
if _, ok := ic.mutation.EnableRss(); !ok {
|
||||
return &ValidationError{Name: "enable_rss", err: errors.New(`ent: missing required field "Indexers.enable_rss"`)}
|
||||
}
|
||||
@@ -217,6 +308,26 @@ func (ic *IndexersCreate) createSpec() (*Indexers, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(indexers.FieldDisabled, field.TypeBool, value)
|
||||
_node.Disabled = value
|
||||
}
|
||||
if value, ok := ic.mutation.TvSearch(); ok {
|
||||
_spec.SetField(indexers.FieldTvSearch, field.TypeBool, value)
|
||||
_node.TvSearch = value
|
||||
}
|
||||
if value, ok := ic.mutation.MovieSearch(); ok {
|
||||
_spec.SetField(indexers.FieldMovieSearch, field.TypeBool, value)
|
||||
_node.MovieSearch = value
|
||||
}
|
||||
if value, ok := ic.mutation.APIKey(); ok {
|
||||
_spec.SetField(indexers.FieldAPIKey, field.TypeString, value)
|
||||
_node.APIKey = value
|
||||
}
|
||||
if value, ok := ic.mutation.URL(); ok {
|
||||
_spec.SetField(indexers.FieldURL, field.TypeString, value)
|
||||
_node.URL = value
|
||||
}
|
||||
if value, ok := ic.mutation.Synced(); ok {
|
||||
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
||||
_node.Synced = value
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,12 @@ func (iu *IndexersUpdate) SetNillableSettings(s *string) *IndexersUpdate {
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearSettings clears the value of the "settings" field.
|
||||
func (iu *IndexersUpdate) ClearSettings() *IndexersUpdate {
|
||||
iu.mutation.ClearSettings()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
func (iu *IndexersUpdate) SetEnableRss(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetEnableRss(b)
|
||||
@@ -151,6 +157,106 @@ func (iu *IndexersUpdate) ClearDisabled() *IndexersUpdate {
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (iu *IndexersUpdate) SetTvSearch(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetTvSearch(b)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableTvSearch sets the "tv_search" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableTvSearch(b *bool) *IndexersUpdate {
|
||||
if b != nil {
|
||||
iu.SetTvSearch(*b)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearTvSearch clears the value of the "tv_search" field.
|
||||
func (iu *IndexersUpdate) ClearTvSearch() *IndexersUpdate {
|
||||
iu.mutation.ClearTvSearch()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (iu *IndexersUpdate) SetMovieSearch(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetMovieSearch(b)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableMovieSearch sets the "movie_search" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableMovieSearch(b *bool) *IndexersUpdate {
|
||||
if b != nil {
|
||||
iu.SetMovieSearch(*b)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearMovieSearch clears the value of the "movie_search" field.
|
||||
func (iu *IndexersUpdate) ClearMovieSearch() *IndexersUpdate {
|
||||
iu.mutation.ClearMovieSearch()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (iu *IndexersUpdate) SetAPIKey(s string) *IndexersUpdate {
|
||||
iu.mutation.SetAPIKey(s)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableAPIKey(s *string) *IndexersUpdate {
|
||||
if s != nil {
|
||||
iu.SetAPIKey(*s)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearAPIKey clears the value of the "api_key" field.
|
||||
func (iu *IndexersUpdate) ClearAPIKey() *IndexersUpdate {
|
||||
iu.mutation.ClearAPIKey()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (iu *IndexersUpdate) SetURL(s string) *IndexersUpdate {
|
||||
iu.mutation.SetURL(s)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableURL sets the "url" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableURL(s *string) *IndexersUpdate {
|
||||
if s != nil {
|
||||
iu.SetURL(*s)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearURL clears the value of the "url" field.
|
||||
func (iu *IndexersUpdate) ClearURL() *IndexersUpdate {
|
||||
iu.mutation.ClearURL()
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (iu *IndexersUpdate) SetSynced(b bool) *IndexersUpdate {
|
||||
iu.mutation.SetSynced(b)
|
||||
return iu
|
||||
}
|
||||
|
||||
// SetNillableSynced sets the "synced" field if the given value is not nil.
|
||||
func (iu *IndexersUpdate) SetNillableSynced(b *bool) *IndexersUpdate {
|
||||
if b != nil {
|
||||
iu.SetSynced(*b)
|
||||
}
|
||||
return iu
|
||||
}
|
||||
|
||||
// ClearSynced clears the value of the "synced" field.
|
||||
func (iu *IndexersUpdate) ClearSynced() *IndexersUpdate {
|
||||
iu.mutation.ClearSynced()
|
||||
return iu
|
||||
}
|
||||
|
||||
// Mutation returns the IndexersMutation object of the builder.
|
||||
func (iu *IndexersUpdate) Mutation() *IndexersMutation {
|
||||
return iu.mutation
|
||||
@@ -201,6 +307,9 @@ func (iu *IndexersUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if value, ok := iu.mutation.Settings(); ok {
|
||||
_spec.SetField(indexers.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
if iu.mutation.SettingsCleared() {
|
||||
_spec.ClearField(indexers.FieldSettings, field.TypeString)
|
||||
}
|
||||
if value, ok := iu.mutation.EnableRss(); ok {
|
||||
_spec.SetField(indexers.FieldEnableRss, field.TypeBool, value)
|
||||
}
|
||||
@@ -225,6 +334,36 @@ func (iu *IndexersUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if iu.mutation.DisabledCleared() {
|
||||
_spec.ClearField(indexers.FieldDisabled, field.TypeBool)
|
||||
}
|
||||
if value, ok := iu.mutation.TvSearch(); ok {
|
||||
_spec.SetField(indexers.FieldTvSearch, field.TypeBool, value)
|
||||
}
|
||||
if iu.mutation.TvSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldTvSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iu.mutation.MovieSearch(); ok {
|
||||
_spec.SetField(indexers.FieldMovieSearch, field.TypeBool, value)
|
||||
}
|
||||
if iu.mutation.MovieSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldMovieSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iu.mutation.APIKey(); ok {
|
||||
_spec.SetField(indexers.FieldAPIKey, field.TypeString, value)
|
||||
}
|
||||
if iu.mutation.APIKeyCleared() {
|
||||
_spec.ClearField(indexers.FieldAPIKey, field.TypeString)
|
||||
}
|
||||
if value, ok := iu.mutation.URL(); ok {
|
||||
_spec.SetField(indexers.FieldURL, field.TypeString, value)
|
||||
}
|
||||
if iu.mutation.URLCleared() {
|
||||
_spec.ClearField(indexers.FieldURL, field.TypeString)
|
||||
}
|
||||
if value, ok := iu.mutation.Synced(); ok {
|
||||
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
||||
}
|
||||
if iu.mutation.SyncedCleared() {
|
||||
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
||||
}
|
||||
if n, err = sqlgraph.UpdateNodes(ctx, iu.driver, _spec); err != nil {
|
||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||
err = &NotFoundError{indexers.Label}
|
||||
@@ -287,6 +426,12 @@ func (iuo *IndexersUpdateOne) SetNillableSettings(s *string) *IndexersUpdateOne
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearSettings clears the value of the "settings" field.
|
||||
func (iuo *IndexersUpdateOne) ClearSettings() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearSettings()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
func (iuo *IndexersUpdateOne) SetEnableRss(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetEnableRss(b)
|
||||
@@ -369,6 +514,106 @@ func (iuo *IndexersUpdateOne) ClearDisabled() *IndexersUpdateOne {
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (iuo *IndexersUpdateOne) SetTvSearch(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetTvSearch(b)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableTvSearch sets the "tv_search" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableTvSearch(b *bool) *IndexersUpdateOne {
|
||||
if b != nil {
|
||||
iuo.SetTvSearch(*b)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearTvSearch clears the value of the "tv_search" field.
|
||||
func (iuo *IndexersUpdateOne) ClearTvSearch() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearTvSearch()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (iuo *IndexersUpdateOne) SetMovieSearch(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetMovieSearch(b)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableMovieSearch sets the "movie_search" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableMovieSearch(b *bool) *IndexersUpdateOne {
|
||||
if b != nil {
|
||||
iuo.SetMovieSearch(*b)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearMovieSearch clears the value of the "movie_search" field.
|
||||
func (iuo *IndexersUpdateOne) ClearMovieSearch() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearMovieSearch()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (iuo *IndexersUpdateOne) SetAPIKey(s string) *IndexersUpdateOne {
|
||||
iuo.mutation.SetAPIKey(s)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableAPIKey sets the "api_key" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableAPIKey(s *string) *IndexersUpdateOne {
|
||||
if s != nil {
|
||||
iuo.SetAPIKey(*s)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearAPIKey clears the value of the "api_key" field.
|
||||
func (iuo *IndexersUpdateOne) ClearAPIKey() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearAPIKey()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (iuo *IndexersUpdateOne) SetURL(s string) *IndexersUpdateOne {
|
||||
iuo.mutation.SetURL(s)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableURL sets the "url" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableURL(s *string) *IndexersUpdateOne {
|
||||
if s != nil {
|
||||
iuo.SetURL(*s)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearURL clears the value of the "url" field.
|
||||
func (iuo *IndexersUpdateOne) ClearURL() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearURL()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (iuo *IndexersUpdateOne) SetSynced(b bool) *IndexersUpdateOne {
|
||||
iuo.mutation.SetSynced(b)
|
||||
return iuo
|
||||
}
|
||||
|
||||
// SetNillableSynced sets the "synced" field if the given value is not nil.
|
||||
func (iuo *IndexersUpdateOne) SetNillableSynced(b *bool) *IndexersUpdateOne {
|
||||
if b != nil {
|
||||
iuo.SetSynced(*b)
|
||||
}
|
||||
return iuo
|
||||
}
|
||||
|
||||
// ClearSynced clears the value of the "synced" field.
|
||||
func (iuo *IndexersUpdateOne) ClearSynced() *IndexersUpdateOne {
|
||||
iuo.mutation.ClearSynced()
|
||||
return iuo
|
||||
}
|
||||
|
||||
// Mutation returns the IndexersMutation object of the builder.
|
||||
func (iuo *IndexersUpdateOne) Mutation() *IndexersMutation {
|
||||
return iuo.mutation
|
||||
@@ -449,6 +694,9 @@ func (iuo *IndexersUpdateOne) sqlSave(ctx context.Context) (_node *Indexers, err
|
||||
if value, ok := iuo.mutation.Settings(); ok {
|
||||
_spec.SetField(indexers.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
if iuo.mutation.SettingsCleared() {
|
||||
_spec.ClearField(indexers.FieldSettings, field.TypeString)
|
||||
}
|
||||
if value, ok := iuo.mutation.EnableRss(); ok {
|
||||
_spec.SetField(indexers.FieldEnableRss, field.TypeBool, value)
|
||||
}
|
||||
@@ -473,6 +721,36 @@ func (iuo *IndexersUpdateOne) sqlSave(ctx context.Context) (_node *Indexers, err
|
||||
if iuo.mutation.DisabledCleared() {
|
||||
_spec.ClearField(indexers.FieldDisabled, field.TypeBool)
|
||||
}
|
||||
if value, ok := iuo.mutation.TvSearch(); ok {
|
||||
_spec.SetField(indexers.FieldTvSearch, field.TypeBool, value)
|
||||
}
|
||||
if iuo.mutation.TvSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldTvSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iuo.mutation.MovieSearch(); ok {
|
||||
_spec.SetField(indexers.FieldMovieSearch, field.TypeBool, value)
|
||||
}
|
||||
if iuo.mutation.MovieSearchCleared() {
|
||||
_spec.ClearField(indexers.FieldMovieSearch, field.TypeBool)
|
||||
}
|
||||
if value, ok := iuo.mutation.APIKey(); ok {
|
||||
_spec.SetField(indexers.FieldAPIKey, field.TypeString, value)
|
||||
}
|
||||
if iuo.mutation.APIKeyCleared() {
|
||||
_spec.ClearField(indexers.FieldAPIKey, field.TypeString)
|
||||
}
|
||||
if value, ok := iuo.mutation.URL(); ok {
|
||||
_spec.SetField(indexers.FieldURL, field.TypeString, value)
|
||||
}
|
||||
if iuo.mutation.URLCleared() {
|
||||
_spec.ClearField(indexers.FieldURL, field.TypeString)
|
||||
}
|
||||
if value, ok := iuo.mutation.Synced(); ok {
|
||||
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
||||
}
|
||||
if iuo.mutation.SyncedCleared() {
|
||||
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
||||
}
|
||||
_node = &Indexers{config: iuo.config}
|
||||
_spec.Assign = _node.assignValues
|
||||
_spec.ScanValues = _node.scanValues
|
||||
|
||||
@@ -113,11 +113,16 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "name", Type: field.TypeString},
|
||||
{Name: "implementation", Type: field.TypeString},
|
||||
{Name: "settings", Type: field.TypeString},
|
||||
{Name: "settings", Type: field.TypeString, Nullable: true, Default: ""},
|
||||
{Name: "enable_rss", Type: field.TypeBool, Default: true},
|
||||
{Name: "priority", Type: field.TypeInt, Default: 50},
|
||||
{Name: "seed_ratio", Type: field.TypeFloat32, Nullable: true, Default: 0},
|
||||
{Name: "disabled", Type: field.TypeBool, Nullable: true, Default: false},
|
||||
{Name: "tv_search", Type: field.TypeBool, Nullable: true, Default: true},
|
||||
{Name: "movie_search", Type: field.TypeBool, Nullable: true, Default: true},
|
||||
{Name: "api_key", Type: field.TypeString, Nullable: true},
|
||||
{Name: "url", Type: field.TypeString, Nullable: true},
|
||||
{Name: "synced", Type: field.TypeBool, Nullable: true, Default: false},
|
||||
}
|
||||
// IndexersTable holds the schema information for the "indexers" table.
|
||||
IndexersTable = &schema.Table{
|
||||
|
||||
386
ent/mutation.go
386
ent/mutation.go
@@ -4346,6 +4346,11 @@ type IndexersMutation struct {
|
||||
seed_ratio *float32
|
||||
addseed_ratio *float32
|
||||
disabled *bool
|
||||
tv_search *bool
|
||||
movie_search *bool
|
||||
api_key *string
|
||||
url *string
|
||||
synced *bool
|
||||
clearedFields map[string]struct{}
|
||||
done bool
|
||||
oldValue func(context.Context) (*Indexers, error)
|
||||
@@ -4553,9 +4558,22 @@ func (m *IndexersMutation) OldSettings(ctx context.Context) (v string, err error
|
||||
return oldValue.Settings, nil
|
||||
}
|
||||
|
||||
// ClearSettings clears the value of the "settings" field.
|
||||
func (m *IndexersMutation) ClearSettings() {
|
||||
m.settings = nil
|
||||
m.clearedFields[indexers.FieldSettings] = struct{}{}
|
||||
}
|
||||
|
||||
// SettingsCleared returns if the "settings" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) SettingsCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldSettings]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetSettings resets all changes to the "settings" field.
|
||||
func (m *IndexersMutation) ResetSettings() {
|
||||
m.settings = nil
|
||||
delete(m.clearedFields, indexers.FieldSettings)
|
||||
}
|
||||
|
||||
// SetEnableRss sets the "enable_rss" field.
|
||||
@@ -4769,6 +4787,251 @@ func (m *IndexersMutation) ResetDisabled() {
|
||||
delete(m.clearedFields, indexers.FieldDisabled)
|
||||
}
|
||||
|
||||
// SetTvSearch sets the "tv_search" field.
|
||||
func (m *IndexersMutation) SetTvSearch(b bool) {
|
||||
m.tv_search = &b
|
||||
}
|
||||
|
||||
// TvSearch returns the value of the "tv_search" field in the mutation.
|
||||
func (m *IndexersMutation) TvSearch() (r bool, exists bool) {
|
||||
v := m.tv_search
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldTvSearch returns the old "tv_search" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldTvSearch(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldTvSearch is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldTvSearch requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldTvSearch: %w", err)
|
||||
}
|
||||
return oldValue.TvSearch, nil
|
||||
}
|
||||
|
||||
// ClearTvSearch clears the value of the "tv_search" field.
|
||||
func (m *IndexersMutation) ClearTvSearch() {
|
||||
m.tv_search = nil
|
||||
m.clearedFields[indexers.FieldTvSearch] = struct{}{}
|
||||
}
|
||||
|
||||
// TvSearchCleared returns if the "tv_search" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) TvSearchCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldTvSearch]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetTvSearch resets all changes to the "tv_search" field.
|
||||
func (m *IndexersMutation) ResetTvSearch() {
|
||||
m.tv_search = nil
|
||||
delete(m.clearedFields, indexers.FieldTvSearch)
|
||||
}
|
||||
|
||||
// SetMovieSearch sets the "movie_search" field.
|
||||
func (m *IndexersMutation) SetMovieSearch(b bool) {
|
||||
m.movie_search = &b
|
||||
}
|
||||
|
||||
// MovieSearch returns the value of the "movie_search" field in the mutation.
|
||||
func (m *IndexersMutation) MovieSearch() (r bool, exists bool) {
|
||||
v := m.movie_search
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldMovieSearch returns the old "movie_search" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldMovieSearch(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldMovieSearch is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldMovieSearch requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldMovieSearch: %w", err)
|
||||
}
|
||||
return oldValue.MovieSearch, nil
|
||||
}
|
||||
|
||||
// ClearMovieSearch clears the value of the "movie_search" field.
|
||||
func (m *IndexersMutation) ClearMovieSearch() {
|
||||
m.movie_search = nil
|
||||
m.clearedFields[indexers.FieldMovieSearch] = struct{}{}
|
||||
}
|
||||
|
||||
// MovieSearchCleared returns if the "movie_search" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) MovieSearchCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldMovieSearch]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetMovieSearch resets all changes to the "movie_search" field.
|
||||
func (m *IndexersMutation) ResetMovieSearch() {
|
||||
m.movie_search = nil
|
||||
delete(m.clearedFields, indexers.FieldMovieSearch)
|
||||
}
|
||||
|
||||
// SetAPIKey sets the "api_key" field.
|
||||
func (m *IndexersMutation) SetAPIKey(s string) {
|
||||
m.api_key = &s
|
||||
}
|
||||
|
||||
// APIKey returns the value of the "api_key" field in the mutation.
|
||||
func (m *IndexersMutation) APIKey() (r string, exists bool) {
|
||||
v := m.api_key
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldAPIKey returns the old "api_key" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldAPIKey(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldAPIKey is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldAPIKey requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldAPIKey: %w", err)
|
||||
}
|
||||
return oldValue.APIKey, nil
|
||||
}
|
||||
|
||||
// ClearAPIKey clears the value of the "api_key" field.
|
||||
func (m *IndexersMutation) ClearAPIKey() {
|
||||
m.api_key = nil
|
||||
m.clearedFields[indexers.FieldAPIKey] = struct{}{}
|
||||
}
|
||||
|
||||
// APIKeyCleared returns if the "api_key" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) APIKeyCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldAPIKey]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetAPIKey resets all changes to the "api_key" field.
|
||||
func (m *IndexersMutation) ResetAPIKey() {
|
||||
m.api_key = nil
|
||||
delete(m.clearedFields, indexers.FieldAPIKey)
|
||||
}
|
||||
|
||||
// SetURL sets the "url" field.
|
||||
func (m *IndexersMutation) SetURL(s string) {
|
||||
m.url = &s
|
||||
}
|
||||
|
||||
// URL returns the value of the "url" field in the mutation.
|
||||
func (m *IndexersMutation) URL() (r string, exists bool) {
|
||||
v := m.url
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldURL returns the old "url" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldURL(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldURL is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldURL requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldURL: %w", err)
|
||||
}
|
||||
return oldValue.URL, nil
|
||||
}
|
||||
|
||||
// ClearURL clears the value of the "url" field.
|
||||
func (m *IndexersMutation) ClearURL() {
|
||||
m.url = nil
|
||||
m.clearedFields[indexers.FieldURL] = struct{}{}
|
||||
}
|
||||
|
||||
// URLCleared returns if the "url" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) URLCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldURL]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetURL resets all changes to the "url" field.
|
||||
func (m *IndexersMutation) ResetURL() {
|
||||
m.url = nil
|
||||
delete(m.clearedFields, indexers.FieldURL)
|
||||
}
|
||||
|
||||
// SetSynced sets the "synced" field.
|
||||
func (m *IndexersMutation) SetSynced(b bool) {
|
||||
m.synced = &b
|
||||
}
|
||||
|
||||
// Synced returns the value of the "synced" field in the mutation.
|
||||
func (m *IndexersMutation) Synced() (r bool, exists bool) {
|
||||
v := m.synced
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldSynced returns the old "synced" field's value of the Indexers entity.
|
||||
// If the Indexers object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *IndexersMutation) OldSynced(ctx context.Context) (v bool, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldSynced is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldSynced requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldSynced: %w", err)
|
||||
}
|
||||
return oldValue.Synced, nil
|
||||
}
|
||||
|
||||
// ClearSynced clears the value of the "synced" field.
|
||||
func (m *IndexersMutation) ClearSynced() {
|
||||
m.synced = nil
|
||||
m.clearedFields[indexers.FieldSynced] = struct{}{}
|
||||
}
|
||||
|
||||
// SyncedCleared returns if the "synced" field was cleared in this mutation.
|
||||
func (m *IndexersMutation) SyncedCleared() bool {
|
||||
_, ok := m.clearedFields[indexers.FieldSynced]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetSynced resets all changes to the "synced" field.
|
||||
func (m *IndexersMutation) ResetSynced() {
|
||||
m.synced = nil
|
||||
delete(m.clearedFields, indexers.FieldSynced)
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the IndexersMutation builder.
|
||||
func (m *IndexersMutation) Where(ps ...predicate.Indexers) {
|
||||
m.predicates = append(m.predicates, ps...)
|
||||
@@ -4803,7 +5066,7 @@ func (m *IndexersMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *IndexersMutation) Fields() []string {
|
||||
fields := make([]string, 0, 7)
|
||||
fields := make([]string, 0, 12)
|
||||
if m.name != nil {
|
||||
fields = append(fields, indexers.FieldName)
|
||||
}
|
||||
@@ -4825,6 +5088,21 @@ func (m *IndexersMutation) Fields() []string {
|
||||
if m.disabled != nil {
|
||||
fields = append(fields, indexers.FieldDisabled)
|
||||
}
|
||||
if m.tv_search != nil {
|
||||
fields = append(fields, indexers.FieldTvSearch)
|
||||
}
|
||||
if m.movie_search != nil {
|
||||
fields = append(fields, indexers.FieldMovieSearch)
|
||||
}
|
||||
if m.api_key != nil {
|
||||
fields = append(fields, indexers.FieldAPIKey)
|
||||
}
|
||||
if m.url != nil {
|
||||
fields = append(fields, indexers.FieldURL)
|
||||
}
|
||||
if m.synced != nil {
|
||||
fields = append(fields, indexers.FieldSynced)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -4847,6 +5125,16 @@ func (m *IndexersMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.SeedRatio()
|
||||
case indexers.FieldDisabled:
|
||||
return m.Disabled()
|
||||
case indexers.FieldTvSearch:
|
||||
return m.TvSearch()
|
||||
case indexers.FieldMovieSearch:
|
||||
return m.MovieSearch()
|
||||
case indexers.FieldAPIKey:
|
||||
return m.APIKey()
|
||||
case indexers.FieldURL:
|
||||
return m.URL()
|
||||
case indexers.FieldSynced:
|
||||
return m.Synced()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -4870,6 +5158,16 @@ func (m *IndexersMutation) OldField(ctx context.Context, name string) (ent.Value
|
||||
return m.OldSeedRatio(ctx)
|
||||
case indexers.FieldDisabled:
|
||||
return m.OldDisabled(ctx)
|
||||
case indexers.FieldTvSearch:
|
||||
return m.OldTvSearch(ctx)
|
||||
case indexers.FieldMovieSearch:
|
||||
return m.OldMovieSearch(ctx)
|
||||
case indexers.FieldAPIKey:
|
||||
return m.OldAPIKey(ctx)
|
||||
case indexers.FieldURL:
|
||||
return m.OldURL(ctx)
|
||||
case indexers.FieldSynced:
|
||||
return m.OldSynced(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Indexers field %s", name)
|
||||
}
|
||||
@@ -4928,6 +5226,41 @@ func (m *IndexersMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetDisabled(v)
|
||||
return nil
|
||||
case indexers.FieldTvSearch:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetTvSearch(v)
|
||||
return nil
|
||||
case indexers.FieldMovieSearch:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetMovieSearch(v)
|
||||
return nil
|
||||
case indexers.FieldAPIKey:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetAPIKey(v)
|
||||
return nil
|
||||
case indexers.FieldURL:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetURL(v)
|
||||
return nil
|
||||
case indexers.FieldSynced:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetSynced(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Indexers field %s", name)
|
||||
}
|
||||
@@ -4985,12 +5318,30 @@ func (m *IndexersMutation) AddField(name string, value ent.Value) error {
|
||||
// mutation.
|
||||
func (m *IndexersMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(indexers.FieldSettings) {
|
||||
fields = append(fields, indexers.FieldSettings)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldSeedRatio) {
|
||||
fields = append(fields, indexers.FieldSeedRatio)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldDisabled) {
|
||||
fields = append(fields, indexers.FieldDisabled)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldTvSearch) {
|
||||
fields = append(fields, indexers.FieldTvSearch)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldMovieSearch) {
|
||||
fields = append(fields, indexers.FieldMovieSearch)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldAPIKey) {
|
||||
fields = append(fields, indexers.FieldAPIKey)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldURL) {
|
||||
fields = append(fields, indexers.FieldURL)
|
||||
}
|
||||
if m.FieldCleared(indexers.FieldSynced) {
|
||||
fields = append(fields, indexers.FieldSynced)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -5005,12 +5356,30 @@ func (m *IndexersMutation) FieldCleared(name string) bool {
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *IndexersMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case indexers.FieldSettings:
|
||||
m.ClearSettings()
|
||||
return nil
|
||||
case indexers.FieldSeedRatio:
|
||||
m.ClearSeedRatio()
|
||||
return nil
|
||||
case indexers.FieldDisabled:
|
||||
m.ClearDisabled()
|
||||
return nil
|
||||
case indexers.FieldTvSearch:
|
||||
m.ClearTvSearch()
|
||||
return nil
|
||||
case indexers.FieldMovieSearch:
|
||||
m.ClearMovieSearch()
|
||||
return nil
|
||||
case indexers.FieldAPIKey:
|
||||
m.ClearAPIKey()
|
||||
return nil
|
||||
case indexers.FieldURL:
|
||||
m.ClearURL()
|
||||
return nil
|
||||
case indexers.FieldSynced:
|
||||
m.ClearSynced()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Indexers nullable field %s", name)
|
||||
}
|
||||
@@ -5040,6 +5409,21 @@ func (m *IndexersMutation) ResetField(name string) error {
|
||||
case indexers.FieldDisabled:
|
||||
m.ResetDisabled()
|
||||
return nil
|
||||
case indexers.FieldTvSearch:
|
||||
m.ResetTvSearch()
|
||||
return nil
|
||||
case indexers.FieldMovieSearch:
|
||||
m.ResetMovieSearch()
|
||||
return nil
|
||||
case indexers.FieldAPIKey:
|
||||
m.ResetAPIKey()
|
||||
return nil
|
||||
case indexers.FieldURL:
|
||||
m.ResetURL()
|
||||
return nil
|
||||
case indexers.FieldSynced:
|
||||
m.ResetSynced()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Indexers field %s", name)
|
||||
}
|
||||
|
||||
@@ -71,6 +71,10 @@ func init() {
|
||||
history.DefaultSize = historyDescSize.Default.(int)
|
||||
indexersFields := schema.Indexers{}.Fields()
|
||||
_ = indexersFields
|
||||
// indexersDescSettings is the schema descriptor for settings field.
|
||||
indexersDescSettings := indexersFields[2].Descriptor()
|
||||
// indexers.DefaultSettings holds the default value on creation for the settings field.
|
||||
indexers.DefaultSettings = indexersDescSettings.Default.(string)
|
||||
// indexersDescEnableRss is the schema descriptor for enable_rss field.
|
||||
indexersDescEnableRss := indexersFields[3].Descriptor()
|
||||
// indexers.DefaultEnableRss holds the default value on creation for the enable_rss field.
|
||||
@@ -87,6 +91,18 @@ func init() {
|
||||
indexersDescDisabled := indexersFields[6].Descriptor()
|
||||
// indexers.DefaultDisabled holds the default value on creation for the disabled field.
|
||||
indexers.DefaultDisabled = indexersDescDisabled.Default.(bool)
|
||||
// indexersDescTvSearch is the schema descriptor for tv_search field.
|
||||
indexersDescTvSearch := indexersFields[7].Descriptor()
|
||||
// indexers.DefaultTvSearch holds the default value on creation for the tv_search field.
|
||||
indexers.DefaultTvSearch = indexersDescTvSearch.Default.(bool)
|
||||
// indexersDescMovieSearch is the schema descriptor for movie_search field.
|
||||
indexersDescMovieSearch := indexersFields[8].Descriptor()
|
||||
// indexers.DefaultMovieSearch holds the default value on creation for the movie_search field.
|
||||
indexers.DefaultMovieSearch = indexersDescMovieSearch.Default.(bool)
|
||||
// indexersDescSynced is the schema descriptor for synced field.
|
||||
indexersDescSynced := indexersFields[11].Descriptor()
|
||||
// indexers.DefaultSynced holds the default value on creation for the synced field.
|
||||
indexers.DefaultSynced = indexersDescSynced.Default.(bool)
|
||||
mediaFields := schema.Media{}.Fields()
|
||||
_ = mediaFields
|
||||
// mediaDescCreatedAt is the schema descriptor for created_at field.
|
||||
|
||||
@@ -15,11 +15,16 @@ func (Indexers) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("name"),
|
||||
field.String("implementation"),
|
||||
field.String("settings"),
|
||||
field.String("settings").Optional().Default("").Comment("deprecated, use api_key and url"),
|
||||
field.Bool("enable_rss").Default(true),
|
||||
field.Int("priority").Default(50),
|
||||
field.Float32("seed_ratio").Optional().Default(0).Comment("minimal seed ratio requied, before removing torrent"),
|
||||
field.Bool("disabled").Optional().Default(false),
|
||||
field.Bool("tv_search").Optional().Default(true),
|
||||
field.Bool("movie_search").Optional().Default(true),
|
||||
field.String("api_key").Optional(),
|
||||
field.String("url").Optional(),
|
||||
field.Bool("synced").Optional().Default(false).Comment("synced from prowlarr"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user