mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 15:10:49 +08:00
feat: add create_time to db
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"polaris/ent/downloadclients"
|
"polaris/ent/downloadclients"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
@@ -37,7 +38,9 @@ type DownloadClients struct {
|
|||||||
// RemoveFailedDownloads holds the value of the "remove_failed_downloads" field.
|
// RemoveFailedDownloads holds the value of the "remove_failed_downloads" field.
|
||||||
RemoveFailedDownloads bool `json:"remove_failed_downloads,omitempty"`
|
RemoveFailedDownloads bool `json:"remove_failed_downloads,omitempty"`
|
||||||
// Tags holds the value of the "tags" field.
|
// Tags holds the value of the "tags" field.
|
||||||
Tags string `json:"tags,omitempty"`
|
Tags string `json:"tags,omitempty"`
|
||||||
|
// CreateTime holds the value of the "create_time" field.
|
||||||
|
CreateTime time.Time `json:"create_time,omitempty"`
|
||||||
selectValues sql.SelectValues
|
selectValues sql.SelectValues
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +55,8 @@ func (*DownloadClients) scanValues(columns []string) ([]any, error) {
|
|||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case downloadclients.FieldName, downloadclients.FieldImplementation, downloadclients.FieldURL, downloadclients.FieldUser, downloadclients.FieldPassword, downloadclients.FieldSettings, downloadclients.FieldTags:
|
case downloadclients.FieldName, downloadclients.FieldImplementation, downloadclients.FieldURL, downloadclients.FieldUser, downloadclients.FieldPassword, downloadclients.FieldSettings, downloadclients.FieldTags:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
|
case downloadclients.FieldCreateTime:
|
||||||
|
values[i] = new(sql.NullTime)
|
||||||
default:
|
default:
|
||||||
values[i] = new(sql.UnknownType)
|
values[i] = new(sql.UnknownType)
|
||||||
}
|
}
|
||||||
@@ -139,6 +144,12 @@ func (dc *DownloadClients) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
dc.Tags = value.String
|
dc.Tags = value.String
|
||||||
}
|
}
|
||||||
|
case downloadclients.FieldCreateTime:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
dc.CreateTime = value.Time
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
dc.selectValues.Set(columns[i], values[i])
|
dc.selectValues.Set(columns[i], values[i])
|
||||||
}
|
}
|
||||||
@@ -207,6 +218,9 @@ func (dc *DownloadClients) String() string {
|
|||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("tags=")
|
builder.WriteString("tags=")
|
||||||
builder.WriteString(dc.Tags)
|
builder.WriteString(dc.Tags)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("create_time=")
|
||||||
|
builder.WriteString(dc.CreateTime.Format(time.ANSIC))
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package downloadclients
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
)
|
)
|
||||||
@@ -35,6 +36,8 @@ const (
|
|||||||
FieldRemoveFailedDownloads = "remove_failed_downloads"
|
FieldRemoveFailedDownloads = "remove_failed_downloads"
|
||||||
// FieldTags holds the string denoting the tags field in the database.
|
// FieldTags holds the string denoting the tags field in the database.
|
||||||
FieldTags = "tags"
|
FieldTags = "tags"
|
||||||
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||||
|
FieldCreateTime = "create_time"
|
||||||
// Table holds the table name of the downloadclients in the database.
|
// Table holds the table name of the downloadclients in the database.
|
||||||
Table = "download_clients"
|
Table = "download_clients"
|
||||||
)
|
)
|
||||||
@@ -53,6 +56,7 @@ var Columns = []string{
|
|||||||
FieldRemoveCompletedDownloads,
|
FieldRemoveCompletedDownloads,
|
||||||
FieldRemoveFailedDownloads,
|
FieldRemoveFailedDownloads,
|
||||||
FieldTags,
|
FieldTags,
|
||||||
|
FieldCreateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
@@ -82,6 +86,8 @@ var (
|
|||||||
DefaultRemoveFailedDownloads bool
|
DefaultRemoveFailedDownloads bool
|
||||||
// DefaultTags holds the default value on creation for the "tags" field.
|
// DefaultTags holds the default value on creation for the "tags" field.
|
||||||
DefaultTags string
|
DefaultTags string
|
||||||
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
||||||
|
DefaultCreateTime func() time.Time
|
||||||
)
|
)
|
||||||
|
|
||||||
// Implementation defines the type for the "implementation" enum field.
|
// Implementation defines the type for the "implementation" enum field.
|
||||||
@@ -170,3 +176,8 @@ func ByRemoveFailedDownloads(opts ...sql.OrderTermOption) OrderOption {
|
|||||||
func ByTags(opts ...sql.OrderTermOption) OrderOption {
|
func ByTags(opts ...sql.OrderTermOption) OrderOption {
|
||||||
return sql.OrderByField(FieldTags, opts...).ToFunc()
|
return sql.OrderByField(FieldTags, opts...).ToFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ByCreateTime orders the results by the create_time field.
|
||||||
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package downloadclients
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"polaris/ent/predicate"
|
"polaris/ent/predicate"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
)
|
)
|
||||||
@@ -103,6 +104,11 @@ func Tags(v string) predicate.DownloadClients {
|
|||||||
return predicate.DownloadClients(sql.FieldEQ(FieldTags, v))
|
return predicate.DownloadClients(sql.FieldEQ(FieldTags, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||||
|
func CreateTime(v time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
// EnableEQ applies the EQ predicate on the "enable" field.
|
// EnableEQ applies the EQ predicate on the "enable" field.
|
||||||
func EnableEQ(v bool) predicate.DownloadClients {
|
func EnableEQ(v bool) predicate.DownloadClients {
|
||||||
return predicate.DownloadClients(sql.FieldEQ(FieldEnable, v))
|
return predicate.DownloadClients(sql.FieldEQ(FieldEnable, v))
|
||||||
@@ -583,6 +589,56 @@ func TagsContainsFold(v string) predicate.DownloadClients {
|
|||||||
return predicate.DownloadClients(sql.FieldContainsFold(FieldTags, v))
|
return predicate.DownloadClients(sql.FieldContainsFold(FieldTags, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeEQ(v time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeNEQ(v time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldNEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||||
|
func CreateTimeIn(vs ...time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotIn(vs ...time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||||
|
func CreateTimeGT(v time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldGT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeGTE(v time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldGTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||||
|
func CreateTimeLT(v time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldLT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeLTE(v time.Time) predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldLTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeIsNil() predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldIsNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotNil() predicate.DownloadClients {
|
||||||
|
return predicate.DownloadClients(sql.FieldNotNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
// And groups predicates with the AND operator between them.
|
// And groups predicates with the AND operator between them.
|
||||||
func And(predicates ...predicate.DownloadClients) predicate.DownloadClients {
|
func And(predicates ...predicate.DownloadClients) predicate.DownloadClients {
|
||||||
return predicate.DownloadClients(sql.AndPredicates(predicates...))
|
return predicate.DownloadClients(sql.AndPredicates(predicates...))
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"polaris/ent/downloadclients"
|
"polaris/ent/downloadclients"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
@@ -141,6 +142,20 @@ func (dcc *DownloadClientsCreate) SetNillableTags(s *string) *DownloadClientsCre
|
|||||||
return dcc
|
return dcc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (dcc *DownloadClientsCreate) SetCreateTime(t time.Time) *DownloadClientsCreate {
|
||||||
|
dcc.mutation.SetCreateTime(t)
|
||||||
|
return dcc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||||
|
func (dcc *DownloadClientsCreate) SetNillableCreateTime(t *time.Time) *DownloadClientsCreate {
|
||||||
|
if t != nil {
|
||||||
|
dcc.SetCreateTime(*t)
|
||||||
|
}
|
||||||
|
return dcc
|
||||||
|
}
|
||||||
|
|
||||||
// Mutation returns the DownloadClientsMutation object of the builder.
|
// Mutation returns the DownloadClientsMutation object of the builder.
|
||||||
func (dcc *DownloadClientsCreate) Mutation() *DownloadClientsMutation {
|
func (dcc *DownloadClientsCreate) Mutation() *DownloadClientsMutation {
|
||||||
return dcc.mutation
|
return dcc.mutation
|
||||||
@@ -204,6 +219,10 @@ func (dcc *DownloadClientsCreate) defaults() {
|
|||||||
v := downloadclients.DefaultTags
|
v := downloadclients.DefaultTags
|
||||||
dcc.mutation.SetTags(v)
|
dcc.mutation.SetTags(v)
|
||||||
}
|
}
|
||||||
|
if _, ok := dcc.mutation.CreateTime(); !ok {
|
||||||
|
v := downloadclients.DefaultCreateTime()
|
||||||
|
dcc.mutation.SetCreateTime(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check runs all checks and user-defined validators on the builder.
|
// check runs all checks and user-defined validators on the builder.
|
||||||
@@ -321,6 +340,10 @@ func (dcc *DownloadClientsCreate) createSpec() (*DownloadClients, *sqlgraph.Crea
|
|||||||
_spec.SetField(downloadclients.FieldTags, field.TypeString, value)
|
_spec.SetField(downloadclients.FieldTags, field.TypeString, value)
|
||||||
_node.Tags = value
|
_node.Tags = value
|
||||||
}
|
}
|
||||||
|
if value, ok := dcc.mutation.CreateTime(); ok {
|
||||||
|
_spec.SetField(downloadclients.FieldCreateTime, field.TypeTime, value)
|
||||||
|
_node.CreateTime = value
|
||||||
|
}
|
||||||
return _node, _spec
|
return _node, _spec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -283,6 +283,9 @@ func (dcu *DownloadClientsUpdate) sqlSave(ctx context.Context) (n int, err error
|
|||||||
if value, ok := dcu.mutation.Tags(); ok {
|
if value, ok := dcu.mutation.Tags(); ok {
|
||||||
_spec.SetField(downloadclients.FieldTags, field.TypeString, value)
|
_spec.SetField(downloadclients.FieldTags, field.TypeString, value)
|
||||||
}
|
}
|
||||||
|
if dcu.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(downloadclients.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if n, err = sqlgraph.UpdateNodes(ctx, dcu.driver, _spec); err != nil {
|
if n, err = sqlgraph.UpdateNodes(ctx, dcu.driver, _spec); err != nil {
|
||||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
err = &NotFoundError{downloadclients.Label}
|
err = &NotFoundError{downloadclients.Label}
|
||||||
@@ -589,6 +592,9 @@ func (dcuo *DownloadClientsUpdateOne) sqlSave(ctx context.Context) (_node *Downl
|
|||||||
if value, ok := dcuo.mutation.Tags(); ok {
|
if value, ok := dcuo.mutation.Tags(); ok {
|
||||||
_spec.SetField(downloadclients.FieldTags, field.TypeString, value)
|
_spec.SetField(downloadclients.FieldTags, field.TypeString, value)
|
||||||
}
|
}
|
||||||
|
if dcuo.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(downloadclients.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
_node = &DownloadClients{config: dcuo.config}
|
_node = &DownloadClients{config: dcuo.config}
|
||||||
_spec.Assign = _node.assignValues
|
_spec.Assign = _node.assignValues
|
||||||
_spec.ScanValues = _node.scanValues
|
_spec.ScanValues = _node.scanValues
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"polaris/ent/episode"
|
"polaris/ent/episode"
|
||||||
"polaris/ent/media"
|
"polaris/ent/media"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
@@ -35,6 +36,8 @@ type Episode struct {
|
|||||||
Monitored bool `json:"monitored"`
|
Monitored bool `json:"monitored"`
|
||||||
// TargetFile holds the value of the "target_file" field.
|
// TargetFile holds the value of the "target_file" field.
|
||||||
TargetFile string `json:"target_file,omitempty"`
|
TargetFile string `json:"target_file,omitempty"`
|
||||||
|
// CreateTime holds the value of the "create_time" field.
|
||||||
|
CreateTime time.Time `json:"create_time,omitempty"`
|
||||||
// Edges holds the relations/edges for other nodes in the graph.
|
// Edges holds the relations/edges for other nodes in the graph.
|
||||||
// The values are being populated by the EpisodeQuery when eager-loading is set.
|
// The values are being populated by the EpisodeQuery when eager-loading is set.
|
||||||
Edges EpisodeEdges `json:"edges"`
|
Edges EpisodeEdges `json:"edges"`
|
||||||
@@ -72,6 +75,8 @@ func (*Episode) scanValues(columns []string) ([]any, error) {
|
|||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case episode.FieldTitle, episode.FieldOverview, episode.FieldAirDate, episode.FieldStatus, episode.FieldTargetFile:
|
case episode.FieldTitle, episode.FieldOverview, episode.FieldAirDate, episode.FieldStatus, episode.FieldTargetFile:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
|
case episode.FieldCreateTime:
|
||||||
|
values[i] = new(sql.NullTime)
|
||||||
default:
|
default:
|
||||||
values[i] = new(sql.UnknownType)
|
values[i] = new(sql.UnknownType)
|
||||||
}
|
}
|
||||||
@@ -147,6 +152,12 @@ func (e *Episode) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
e.TargetFile = value.String
|
e.TargetFile = value.String
|
||||||
}
|
}
|
||||||
|
case episode.FieldCreateTime:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
e.CreateTime = value.Time
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
e.selectValues.Set(columns[i], values[i])
|
e.selectValues.Set(columns[i], values[i])
|
||||||
}
|
}
|
||||||
@@ -214,6 +225,9 @@ func (e *Episode) String() string {
|
|||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("target_file=")
|
builder.WriteString("target_file=")
|
||||||
builder.WriteString(e.TargetFile)
|
builder.WriteString(e.TargetFile)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("create_time=")
|
||||||
|
builder.WriteString(e.CreateTime.Format(time.ANSIC))
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package episode
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
@@ -32,6 +33,8 @@ const (
|
|||||||
FieldMonitored = "monitored"
|
FieldMonitored = "monitored"
|
||||||
// FieldTargetFile holds the string denoting the target_file field in the database.
|
// FieldTargetFile holds the string denoting the target_file field in the database.
|
||||||
FieldTargetFile = "target_file"
|
FieldTargetFile = "target_file"
|
||||||
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||||
|
FieldCreateTime = "create_time"
|
||||||
// EdgeMedia holds the string denoting the media edge name in mutations.
|
// EdgeMedia holds the string denoting the media edge name in mutations.
|
||||||
EdgeMedia = "media"
|
EdgeMedia = "media"
|
||||||
// Table holds the table name of the episode in the database.
|
// Table holds the table name of the episode in the database.
|
||||||
@@ -57,6 +60,7 @@ var Columns = []string{
|
|||||||
FieldStatus,
|
FieldStatus,
|
||||||
FieldMonitored,
|
FieldMonitored,
|
||||||
FieldTargetFile,
|
FieldTargetFile,
|
||||||
|
FieldCreateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
@@ -72,6 +76,8 @@ func ValidColumn(column string) bool {
|
|||||||
var (
|
var (
|
||||||
// DefaultMonitored holds the default value on creation for the "monitored" field.
|
// DefaultMonitored holds the default value on creation for the "monitored" field.
|
||||||
DefaultMonitored bool
|
DefaultMonitored bool
|
||||||
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
||||||
|
DefaultCreateTime func() time.Time
|
||||||
)
|
)
|
||||||
|
|
||||||
// Status defines the type for the "status" enum field.
|
// Status defines the type for the "status" enum field.
|
||||||
@@ -154,6 +160,11 @@ func ByTargetFile(opts ...sql.OrderTermOption) OrderOption {
|
|||||||
return sql.OrderByField(FieldTargetFile, opts...).ToFunc()
|
return sql.OrderByField(FieldTargetFile, opts...).ToFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ByCreateTime orders the results by the create_time field.
|
||||||
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
// ByMediaField orders the results by media field.
|
// ByMediaField orders the results by media field.
|
||||||
func ByMediaField(field string, opts ...sql.OrderTermOption) OrderOption {
|
func ByMediaField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||||
return func(s *sql.Selector) {
|
return func(s *sql.Selector) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package episode
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"polaris/ent/predicate"
|
"polaris/ent/predicate"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
@@ -94,6 +95,11 @@ func TargetFile(v string) predicate.Episode {
|
|||||||
return predicate.Episode(sql.FieldEQ(FieldTargetFile, v))
|
return predicate.Episode(sql.FieldEQ(FieldTargetFile, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||||
|
func CreateTime(v time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
// MediaIDEQ applies the EQ predicate on the "media_id" field.
|
// MediaIDEQ applies the EQ predicate on the "media_id" field.
|
||||||
func MediaIDEQ(v int) predicate.Episode {
|
func MediaIDEQ(v int) predicate.Episode {
|
||||||
return predicate.Episode(sql.FieldEQ(FieldMediaID, v))
|
return predicate.Episode(sql.FieldEQ(FieldMediaID, v))
|
||||||
@@ -504,6 +510,56 @@ func TargetFileContainsFold(v string) predicate.Episode {
|
|||||||
return predicate.Episode(sql.FieldContainsFold(FieldTargetFile, v))
|
return predicate.Episode(sql.FieldContainsFold(FieldTargetFile, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeEQ(v time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeNEQ(v time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldNEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||||
|
func CreateTimeIn(vs ...time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotIn(vs ...time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||||
|
func CreateTimeGT(v time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldGT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeGTE(v time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldGTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||||
|
func CreateTimeLT(v time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldLT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeLTE(v time.Time) predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldLTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeIsNil() predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldIsNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotNil() predicate.Episode {
|
||||||
|
return predicate.Episode(sql.FieldNotNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
// HasMedia applies the HasEdge predicate on the "media" edge.
|
// HasMedia applies the HasEdge predicate on the "media" edge.
|
||||||
func HasMedia() predicate.Episode {
|
func HasMedia() predicate.Episode {
|
||||||
return predicate.Episode(func(s *sql.Selector) {
|
return predicate.Episode(func(s *sql.Selector) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"polaris/ent/episode"
|
"polaris/ent/episode"
|
||||||
"polaris/ent/media"
|
"polaris/ent/media"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
@@ -106,6 +107,20 @@ func (ec *EpisodeCreate) SetNillableTargetFile(s *string) *EpisodeCreate {
|
|||||||
return ec
|
return ec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (ec *EpisodeCreate) SetCreateTime(t time.Time) *EpisodeCreate {
|
||||||
|
ec.mutation.SetCreateTime(t)
|
||||||
|
return ec
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||||
|
func (ec *EpisodeCreate) SetNillableCreateTime(t *time.Time) *EpisodeCreate {
|
||||||
|
if t != nil {
|
||||||
|
ec.SetCreateTime(*t)
|
||||||
|
}
|
||||||
|
return ec
|
||||||
|
}
|
||||||
|
|
||||||
// SetMedia sets the "media" edge to the Media entity.
|
// SetMedia sets the "media" edge to the Media entity.
|
||||||
func (ec *EpisodeCreate) SetMedia(m *Media) *EpisodeCreate {
|
func (ec *EpisodeCreate) SetMedia(m *Media) *EpisodeCreate {
|
||||||
return ec.SetMediaID(m.ID)
|
return ec.SetMediaID(m.ID)
|
||||||
@@ -154,6 +169,10 @@ func (ec *EpisodeCreate) defaults() {
|
|||||||
v := episode.DefaultMonitored
|
v := episode.DefaultMonitored
|
||||||
ec.mutation.SetMonitored(v)
|
ec.mutation.SetMonitored(v)
|
||||||
}
|
}
|
||||||
|
if _, ok := ec.mutation.CreateTime(); !ok {
|
||||||
|
v := episode.DefaultCreateTime()
|
||||||
|
ec.mutation.SetCreateTime(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check runs all checks and user-defined validators on the builder.
|
// check runs all checks and user-defined validators on the builder.
|
||||||
@@ -242,6 +261,10 @@ func (ec *EpisodeCreate) createSpec() (*Episode, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(episode.FieldTargetFile, field.TypeString, value)
|
_spec.SetField(episode.FieldTargetFile, field.TypeString, value)
|
||||||
_node.TargetFile = value
|
_node.TargetFile = value
|
||||||
}
|
}
|
||||||
|
if value, ok := ec.mutation.CreateTime(); ok {
|
||||||
|
_spec.SetField(episode.FieldCreateTime, field.TypeTime, value)
|
||||||
|
_node.CreateTime = value
|
||||||
|
}
|
||||||
if nodes := ec.mutation.MediaIDs(); len(nodes) > 0 {
|
if nodes := ec.mutation.MediaIDs(); len(nodes) > 0 {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.M2O,
|
Rel: sqlgraph.M2O,
|
||||||
|
|||||||
@@ -278,6 +278,9 @@ func (eu *EpisodeUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
if eu.mutation.TargetFileCleared() {
|
if eu.mutation.TargetFileCleared() {
|
||||||
_spec.ClearField(episode.FieldTargetFile, field.TypeString)
|
_spec.ClearField(episode.FieldTargetFile, field.TypeString)
|
||||||
}
|
}
|
||||||
|
if eu.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(episode.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if eu.mutation.MediaCleared() {
|
if eu.mutation.MediaCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.M2O,
|
Rel: sqlgraph.M2O,
|
||||||
@@ -607,6 +610,9 @@ func (euo *EpisodeUpdateOne) sqlSave(ctx context.Context) (_node *Episode, err e
|
|||||||
if euo.mutation.TargetFileCleared() {
|
if euo.mutation.TargetFileCleared() {
|
||||||
_spec.ClearField(episode.FieldTargetFile, field.TypeString)
|
_spec.ClearField(episode.FieldTargetFile, field.TypeString)
|
||||||
}
|
}
|
||||||
|
if euo.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(episode.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if euo.mutation.MediaCleared() {
|
if euo.mutation.MediaCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.M2O,
|
Rel: sqlgraph.M2O,
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ type History struct {
|
|||||||
// torrent hash
|
// torrent hash
|
||||||
Hash string `json:"hash,omitempty"`
|
Hash string `json:"hash,omitempty"`
|
||||||
// Status holds the value of the "status" field.
|
// Status holds the value of the "status" field.
|
||||||
Status history.Status `json:"status,omitempty"`
|
Status history.Status `json:"status,omitempty"`
|
||||||
|
// CreateTime holds the value of the "create_time" field.
|
||||||
|
CreateTime time.Time `json:"create_time,omitempty"`
|
||||||
selectValues sql.SelectValues
|
selectValues sql.SelectValues
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ func (*History) scanValues(columns []string) ([]any, error) {
|
|||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case history.FieldSourceTitle, history.FieldTargetDir, history.FieldLink, history.FieldHash, history.FieldStatus:
|
case history.FieldSourceTitle, history.FieldTargetDir, history.FieldLink, history.FieldHash, history.FieldStatus:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
case history.FieldDate:
|
case history.FieldDate, history.FieldCreateTime:
|
||||||
values[i] = new(sql.NullTime)
|
values[i] = new(sql.NullTime)
|
||||||
default:
|
default:
|
||||||
values[i] = new(sql.UnknownType)
|
values[i] = new(sql.UnknownType)
|
||||||
@@ -153,6 +155,12 @@ func (h *History) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
h.Status = history.Status(value.String)
|
h.Status = history.Status(value.String)
|
||||||
}
|
}
|
||||||
|
case history.FieldCreateTime:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
h.CreateTime = value.Time
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
h.selectValues.Set(columns[i], values[i])
|
h.selectValues.Set(columns[i], values[i])
|
||||||
}
|
}
|
||||||
@@ -224,6 +232,9 @@ func (h *History) String() string {
|
|||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("status=")
|
builder.WriteString("status=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", h.Status))
|
builder.WriteString(fmt.Sprintf("%v", h.Status))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("create_time=")
|
||||||
|
builder.WriteString(h.CreateTime.Format(time.ANSIC))
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package history
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
)
|
)
|
||||||
@@ -37,6 +38,8 @@ const (
|
|||||||
FieldHash = "hash"
|
FieldHash = "hash"
|
||||||
// FieldStatus holds the string denoting the status field in the database.
|
// FieldStatus holds the string denoting the status field in the database.
|
||||||
FieldStatus = "status"
|
FieldStatus = "status"
|
||||||
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||||
|
FieldCreateTime = "create_time"
|
||||||
// Table holds the table name of the history in the database.
|
// Table holds the table name of the history in the database.
|
||||||
Table = "histories"
|
Table = "histories"
|
||||||
)
|
)
|
||||||
@@ -56,6 +59,7 @@ var Columns = []string{
|
|||||||
FieldLink,
|
FieldLink,
|
||||||
FieldHash,
|
FieldHash,
|
||||||
FieldStatus,
|
FieldStatus,
|
||||||
|
FieldCreateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
@@ -71,6 +75,8 @@ func ValidColumn(column string) bool {
|
|||||||
var (
|
var (
|
||||||
// DefaultSize holds the default value on creation for the "size" field.
|
// DefaultSize holds the default value on creation for the "size" field.
|
||||||
DefaultSize int
|
DefaultSize int
|
||||||
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
||||||
|
DefaultCreateTime func() time.Time
|
||||||
)
|
)
|
||||||
|
|
||||||
// Status defines the type for the "status" enum field.
|
// Status defines the type for the "status" enum field.
|
||||||
@@ -162,3 +168,8 @@ func ByHash(opts ...sql.OrderTermOption) OrderOption {
|
|||||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ByCreateTime orders the results by the create_time field.
|
||||||
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ func Hash(v string) predicate.History {
|
|||||||
return predicate.History(sql.FieldEQ(FieldHash, v))
|
return predicate.History(sql.FieldEQ(FieldHash, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||||
|
func CreateTime(v time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
// MediaIDEQ applies the EQ predicate on the "media_id" field.
|
// MediaIDEQ applies the EQ predicate on the "media_id" field.
|
||||||
func MediaIDEQ(v int) predicate.History {
|
func MediaIDEQ(v int) predicate.History {
|
||||||
return predicate.History(sql.FieldEQ(FieldMediaID, v))
|
return predicate.History(sql.FieldEQ(FieldMediaID, v))
|
||||||
@@ -684,6 +689,56 @@ func StatusNotIn(vs ...Status) predicate.History {
|
|||||||
return predicate.History(sql.FieldNotIn(FieldStatus, vs...))
|
return predicate.History(sql.FieldNotIn(FieldStatus, vs...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeEQ(v time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeNEQ(v time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldNEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||||
|
func CreateTimeIn(vs ...time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotIn(vs ...time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||||
|
func CreateTimeGT(v time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldGT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeGTE(v time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldGTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||||
|
func CreateTimeLT(v time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldLT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeLTE(v time.Time) predicate.History {
|
||||||
|
return predicate.History(sql.FieldLTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeIsNil() predicate.History {
|
||||||
|
return predicate.History(sql.FieldIsNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotNil() predicate.History {
|
||||||
|
return predicate.History(sql.FieldNotNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
// And groups predicates with the AND operator between them.
|
// And groups predicates with the AND operator between them.
|
||||||
func And(predicates ...predicate.History) predicate.History {
|
func And(predicates ...predicate.History) predicate.History {
|
||||||
return predicate.History(sql.AndPredicates(predicates...))
|
return predicate.History(sql.AndPredicates(predicates...))
|
||||||
|
|||||||
@@ -140,6 +140,20 @@ func (hc *HistoryCreate) SetStatus(h history.Status) *HistoryCreate {
|
|||||||
return hc
|
return hc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (hc *HistoryCreate) SetCreateTime(t time.Time) *HistoryCreate {
|
||||||
|
hc.mutation.SetCreateTime(t)
|
||||||
|
return hc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||||
|
func (hc *HistoryCreate) SetNillableCreateTime(t *time.Time) *HistoryCreate {
|
||||||
|
if t != nil {
|
||||||
|
hc.SetCreateTime(*t)
|
||||||
|
}
|
||||||
|
return hc
|
||||||
|
}
|
||||||
|
|
||||||
// Mutation returns the HistoryMutation object of the builder.
|
// Mutation returns the HistoryMutation object of the builder.
|
||||||
func (hc *HistoryCreate) Mutation() *HistoryMutation {
|
func (hc *HistoryCreate) Mutation() *HistoryMutation {
|
||||||
return hc.mutation
|
return hc.mutation
|
||||||
@@ -179,6 +193,10 @@ func (hc *HistoryCreate) defaults() {
|
|||||||
v := history.DefaultSize
|
v := history.DefaultSize
|
||||||
hc.mutation.SetSize(v)
|
hc.mutation.SetSize(v)
|
||||||
}
|
}
|
||||||
|
if _, ok := hc.mutation.CreateTime(); !ok {
|
||||||
|
v := history.DefaultCreateTime()
|
||||||
|
hc.mutation.SetCreateTime(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check runs all checks and user-defined validators on the builder.
|
// check runs all checks and user-defined validators on the builder.
|
||||||
@@ -280,6 +298,10 @@ func (hc *HistoryCreate) createSpec() (*History, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
||||||
_node.Status = value
|
_node.Status = value
|
||||||
}
|
}
|
||||||
|
if value, ok := hc.mutation.CreateTime(); ok {
|
||||||
|
_spec.SetField(history.FieldCreateTime, field.TypeTime, value)
|
||||||
|
_node.CreateTime = value
|
||||||
|
}
|
||||||
return _node, _spec
|
return _node, _spec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -394,6 +394,9 @@ func (hu *HistoryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
if value, ok := hu.mutation.Status(); ok {
|
if value, ok := hu.mutation.Status(); ok {
|
||||||
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
||||||
}
|
}
|
||||||
|
if hu.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(history.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if n, err = sqlgraph.UpdateNodes(ctx, hu.driver, _spec); err != nil {
|
if n, err = sqlgraph.UpdateNodes(ctx, hu.driver, _spec); err != nil {
|
||||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
err = &NotFoundError{history.Label}
|
err = &NotFoundError{history.Label}
|
||||||
@@ -809,6 +812,9 @@ func (huo *HistoryUpdateOne) sqlSave(ctx context.Context) (_node *History, err e
|
|||||||
if value, ok := huo.mutation.Status(); ok {
|
if value, ok := huo.mutation.Status(); ok {
|
||||||
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
_spec.SetField(history.FieldStatus, field.TypeEnum, value)
|
||||||
}
|
}
|
||||||
|
if huo.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(history.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
_node = &History{config: huo.config}
|
_node = &History{config: huo.config}
|
||||||
_spec.Assign = _node.assignValues
|
_spec.Assign = _node.assignValues
|
||||||
_spec.ScanValues = _node.scanValues
|
_spec.ScanValues = _node.scanValues
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"polaris/ent/indexers"
|
"polaris/ent/indexers"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
@@ -39,7 +40,9 @@ type Indexers struct {
|
|||||||
// URL holds the value of the "url" field.
|
// URL holds the value of the "url" field.
|
||||||
URL string `json:"url,omitempty"`
|
URL string `json:"url,omitempty"`
|
||||||
// synced from prowlarr
|
// synced from prowlarr
|
||||||
Synced bool `json:"synced,omitempty"`
|
Synced bool `json:"synced,omitempty"`
|
||||||
|
// CreateTime holds the value of the "create_time" field.
|
||||||
|
CreateTime time.Time `json:"create_time,omitempty"`
|
||||||
selectValues sql.SelectValues
|
selectValues sql.SelectValues
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +59,8 @@ func (*Indexers) scanValues(columns []string) ([]any, error) {
|
|||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case indexers.FieldName, indexers.FieldImplementation, indexers.FieldSettings, indexers.FieldAPIKey, indexers.FieldURL:
|
case indexers.FieldName, indexers.FieldImplementation, indexers.FieldSettings, indexers.FieldAPIKey, indexers.FieldURL:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
|
case indexers.FieldCreateTime:
|
||||||
|
values[i] = new(sql.NullTime)
|
||||||
default:
|
default:
|
||||||
values[i] = new(sql.UnknownType)
|
values[i] = new(sql.UnknownType)
|
||||||
}
|
}
|
||||||
@@ -149,6 +154,12 @@ func (i *Indexers) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
i.Synced = value.Bool
|
i.Synced = value.Bool
|
||||||
}
|
}
|
||||||
|
case indexers.FieldCreateTime:
|
||||||
|
if value, ok := values[j].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field create_time", values[j])
|
||||||
|
} else if value.Valid {
|
||||||
|
i.CreateTime = value.Time
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
i.selectValues.Set(columns[j], values[j])
|
i.selectValues.Set(columns[j], values[j])
|
||||||
}
|
}
|
||||||
@@ -220,6 +231,9 @@ func (i *Indexers) String() string {
|
|||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("synced=")
|
builder.WriteString("synced=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", i.Synced))
|
builder.WriteString(fmt.Sprintf("%v", i.Synced))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("create_time=")
|
||||||
|
builder.WriteString(i.CreateTime.Format(time.ANSIC))
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
package indexers
|
package indexers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -35,6 +37,8 @@ const (
|
|||||||
FieldURL = "url"
|
FieldURL = "url"
|
||||||
// FieldSynced holds the string denoting the synced field in the database.
|
// FieldSynced holds the string denoting the synced field in the database.
|
||||||
FieldSynced = "synced"
|
FieldSynced = "synced"
|
||||||
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||||
|
FieldCreateTime = "create_time"
|
||||||
// Table holds the table name of the indexers in the database.
|
// Table holds the table name of the indexers in the database.
|
||||||
Table = "indexers"
|
Table = "indexers"
|
||||||
)
|
)
|
||||||
@@ -54,6 +58,7 @@ var Columns = []string{
|
|||||||
FieldAPIKey,
|
FieldAPIKey,
|
||||||
FieldURL,
|
FieldURL,
|
||||||
FieldSynced,
|
FieldSynced,
|
||||||
|
FieldCreateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
@@ -83,6 +88,8 @@ var (
|
|||||||
DefaultMovieSearch bool
|
DefaultMovieSearch bool
|
||||||
// DefaultSynced holds the default value on creation for the "synced" field.
|
// DefaultSynced holds the default value on creation for the "synced" field.
|
||||||
DefaultSynced bool
|
DefaultSynced bool
|
||||||
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
||||||
|
DefaultCreateTime func() time.Time
|
||||||
)
|
)
|
||||||
|
|
||||||
// OrderOption defines the ordering options for the Indexers queries.
|
// OrderOption defines the ordering options for the Indexers queries.
|
||||||
@@ -152,3 +159,8 @@ func ByURL(opts ...sql.OrderTermOption) OrderOption {
|
|||||||
func BySynced(opts ...sql.OrderTermOption) OrderOption {
|
func BySynced(opts ...sql.OrderTermOption) OrderOption {
|
||||||
return sql.OrderByField(FieldSynced, opts...).ToFunc()
|
return sql.OrderByField(FieldSynced, opts...).ToFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ByCreateTime orders the results by the create_time field.
|
||||||
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package indexers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"polaris/ent/predicate"
|
"polaris/ent/predicate"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
)
|
)
|
||||||
@@ -113,6 +114,11 @@ func Synced(v bool) predicate.Indexers {
|
|||||||
return predicate.Indexers(sql.FieldEQ(FieldSynced, v))
|
return predicate.Indexers(sql.FieldEQ(FieldSynced, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||||
|
func CreateTime(v time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
// NameEQ applies the EQ predicate on the "name" field.
|
// NameEQ applies the EQ predicate on the "name" field.
|
||||||
func NameEQ(v string) predicate.Indexers {
|
func NameEQ(v string) predicate.Indexers {
|
||||||
return predicate.Indexers(sql.FieldEQ(FieldName, v))
|
return predicate.Indexers(sql.FieldEQ(FieldName, v))
|
||||||
@@ -648,6 +654,56 @@ func SyncedNotNil() predicate.Indexers {
|
|||||||
return predicate.Indexers(sql.FieldNotNull(FieldSynced))
|
return predicate.Indexers(sql.FieldNotNull(FieldSynced))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeEQ(v time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeNEQ(v time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldNEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||||
|
func CreateTimeIn(vs ...time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotIn(vs ...time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||||
|
func CreateTimeGT(v time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldGT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeGTE(v time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldGTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||||
|
func CreateTimeLT(v time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldLT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeLTE(v time.Time) predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldLTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeIsNil() predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldIsNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotNil() predicate.Indexers {
|
||||||
|
return predicate.Indexers(sql.FieldNotNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
// And groups predicates with the AND operator between them.
|
// And groups predicates with the AND operator between them.
|
||||||
func And(predicates ...predicate.Indexers) predicate.Indexers {
|
func And(predicates ...predicate.Indexers) predicate.Indexers {
|
||||||
return predicate.Indexers(sql.AndPredicates(predicates...))
|
return predicate.Indexers(sql.AndPredicates(predicates...))
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"polaris/ent/indexers"
|
"polaris/ent/indexers"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
@@ -171,6 +172,20 @@ func (ic *IndexersCreate) SetNillableSynced(b *bool) *IndexersCreate {
|
|||||||
return ic
|
return ic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (ic *IndexersCreate) SetCreateTime(t time.Time) *IndexersCreate {
|
||||||
|
ic.mutation.SetCreateTime(t)
|
||||||
|
return ic
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||||
|
func (ic *IndexersCreate) SetNillableCreateTime(t *time.Time) *IndexersCreate {
|
||||||
|
if t != nil {
|
||||||
|
ic.SetCreateTime(*t)
|
||||||
|
}
|
||||||
|
return ic
|
||||||
|
}
|
||||||
|
|
||||||
// Mutation returns the IndexersMutation object of the builder.
|
// Mutation returns the IndexersMutation object of the builder.
|
||||||
func (ic *IndexersCreate) Mutation() *IndexersMutation {
|
func (ic *IndexersCreate) Mutation() *IndexersMutation {
|
||||||
return ic.mutation
|
return ic.mutation
|
||||||
@@ -238,6 +253,10 @@ func (ic *IndexersCreate) defaults() {
|
|||||||
v := indexers.DefaultSynced
|
v := indexers.DefaultSynced
|
||||||
ic.mutation.SetSynced(v)
|
ic.mutation.SetSynced(v)
|
||||||
}
|
}
|
||||||
|
if _, ok := ic.mutation.CreateTime(); !ok {
|
||||||
|
v := indexers.DefaultCreateTime()
|
||||||
|
ic.mutation.SetCreateTime(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check runs all checks and user-defined validators on the builder.
|
// check runs all checks and user-defined validators on the builder.
|
||||||
@@ -328,6 +347,10 @@ func (ic *IndexersCreate) createSpec() (*Indexers, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
_spec.SetField(indexers.FieldSynced, field.TypeBool, value)
|
||||||
_node.Synced = value
|
_node.Synced = value
|
||||||
}
|
}
|
||||||
|
if value, ok := ic.mutation.CreateTime(); ok {
|
||||||
|
_spec.SetField(indexers.FieldCreateTime, field.TypeTime, value)
|
||||||
|
_node.CreateTime = value
|
||||||
|
}
|
||||||
return _node, _spec
|
return _node, _spec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -364,6 +364,9 @@ func (iu *IndexersUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
if iu.mutation.SyncedCleared() {
|
if iu.mutation.SyncedCleared() {
|
||||||
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
||||||
}
|
}
|
||||||
|
if iu.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(indexers.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if n, err = sqlgraph.UpdateNodes(ctx, iu.driver, _spec); err != nil {
|
if n, err = sqlgraph.UpdateNodes(ctx, iu.driver, _spec); err != nil {
|
||||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
err = &NotFoundError{indexers.Label}
|
err = &NotFoundError{indexers.Label}
|
||||||
@@ -751,6 +754,9 @@ func (iuo *IndexersUpdateOne) sqlSave(ctx context.Context) (_node *Indexers, err
|
|||||||
if iuo.mutation.SyncedCleared() {
|
if iuo.mutation.SyncedCleared() {
|
||||||
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
_spec.ClearField(indexers.FieldSynced, field.TypeBool)
|
||||||
}
|
}
|
||||||
|
if iuo.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(indexers.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
_node = &Indexers{config: iuo.config}
|
_node = &Indexers{config: iuo.config}
|
||||||
_spec.Assign = _node.assignValues
|
_spec.Assign = _node.assignValues
|
||||||
_spec.ScanValues = _node.scanValues
|
_spec.ScanValues = _node.scanValues
|
||||||
|
|||||||
13
ent/media.go
13
ent/media.go
@@ -51,6 +51,8 @@ type Media struct {
|
|||||||
Extras schema.MediaExtras `json:"extras,omitempty"`
|
Extras schema.MediaExtras `json:"extras,omitempty"`
|
||||||
// AlternativeTitles holds the value of the "alternative_titles" field.
|
// AlternativeTitles holds the value of the "alternative_titles" field.
|
||||||
AlternativeTitles []schema.AlternativeTilte `json:"alternative_titles,omitempty"`
|
AlternativeTitles []schema.AlternativeTilte `json:"alternative_titles,omitempty"`
|
||||||
|
// CreateTime holds the value of the "create_time" field.
|
||||||
|
CreateTime time.Time `json:"create_time,omitempty"`
|
||||||
// Edges holds the relations/edges for other nodes in the graph.
|
// Edges holds the relations/edges for other nodes in the graph.
|
||||||
// The values are being populated by the MediaQuery when eager-loading is set.
|
// The values are being populated by the MediaQuery when eager-loading is set.
|
||||||
Edges MediaEdges `json:"edges"`
|
Edges MediaEdges `json:"edges"`
|
||||||
@@ -88,7 +90,7 @@ func (*Media) scanValues(columns []string) ([]any, error) {
|
|||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case media.FieldImdbID, media.FieldMediaType, media.FieldNameCn, media.FieldNameEn, media.FieldOriginalName, media.FieldOverview, media.FieldAirDate, media.FieldResolution, media.FieldTargetDir:
|
case media.FieldImdbID, media.FieldMediaType, media.FieldNameCn, media.FieldNameEn, media.FieldOriginalName, media.FieldOverview, media.FieldAirDate, media.FieldResolution, media.FieldTargetDir:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
case media.FieldCreatedAt:
|
case media.FieldCreatedAt, media.FieldCreateTime:
|
||||||
values[i] = new(sql.NullTime)
|
values[i] = new(sql.NullTime)
|
||||||
default:
|
default:
|
||||||
values[i] = new(sql.UnknownType)
|
values[i] = new(sql.UnknownType)
|
||||||
@@ -213,6 +215,12 @@ func (m *Media) assignValues(columns []string, values []any) error {
|
|||||||
return fmt.Errorf("unmarshal field alternative_titles: %w", err)
|
return fmt.Errorf("unmarshal field alternative_titles: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case media.FieldCreateTime:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
m.CreateTime = value.Time
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
m.selectValues.Set(columns[i], values[i])
|
m.selectValues.Set(columns[i], values[i])
|
||||||
}
|
}
|
||||||
@@ -301,6 +309,9 @@ func (m *Media) String() string {
|
|||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("alternative_titles=")
|
builder.WriteString("alternative_titles=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", m.AlternativeTitles))
|
builder.WriteString(fmt.Sprintf("%v", m.AlternativeTitles))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("create_time=")
|
||||||
|
builder.WriteString(m.CreateTime.Format(time.ANSIC))
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ const (
|
|||||||
FieldExtras = "extras"
|
FieldExtras = "extras"
|
||||||
// FieldAlternativeTitles holds the string denoting the alternative_titles field in the database.
|
// FieldAlternativeTitles holds the string denoting the alternative_titles field in the database.
|
||||||
FieldAlternativeTitles = "alternative_titles"
|
FieldAlternativeTitles = "alternative_titles"
|
||||||
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||||
|
FieldCreateTime = "create_time"
|
||||||
// EdgeEpisodes holds the string denoting the episodes edge name in mutations.
|
// EdgeEpisodes holds the string denoting the episodes edge name in mutations.
|
||||||
EdgeEpisodes = "episodes"
|
EdgeEpisodes = "episodes"
|
||||||
// Table holds the table name of the media in the database.
|
// Table holds the table name of the media in the database.
|
||||||
@@ -79,6 +81,7 @@ var Columns = []string{
|
|||||||
FieldLimiter,
|
FieldLimiter,
|
||||||
FieldExtras,
|
FieldExtras,
|
||||||
FieldAlternativeTitles,
|
FieldAlternativeTitles,
|
||||||
|
FieldCreateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
@@ -98,6 +101,8 @@ var (
|
|||||||
DefaultAirDate string
|
DefaultAirDate string
|
||||||
// DefaultDownloadHistoryEpisodes holds the default value on creation for the "download_history_episodes" field.
|
// DefaultDownloadHistoryEpisodes holds the default value on creation for the "download_history_episodes" field.
|
||||||
DefaultDownloadHistoryEpisodes bool
|
DefaultDownloadHistoryEpisodes bool
|
||||||
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
||||||
|
DefaultCreateTime func() time.Time
|
||||||
)
|
)
|
||||||
|
|
||||||
// MediaType defines the type for the "media_type" enum field.
|
// MediaType defines the type for the "media_type" enum field.
|
||||||
@@ -224,6 +229,11 @@ func ByDownloadHistoryEpisodes(opts ...sql.OrderTermOption) OrderOption {
|
|||||||
return sql.OrderByField(FieldDownloadHistoryEpisodes, opts...).ToFunc()
|
return sql.OrderByField(FieldDownloadHistoryEpisodes, opts...).ToFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ByCreateTime orders the results by the create_time field.
|
||||||
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
// ByEpisodesCount orders the results by episodes count.
|
// ByEpisodesCount orders the results by episodes count.
|
||||||
func ByEpisodesCount(opts ...sql.OrderTermOption) OrderOption {
|
func ByEpisodesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||||
return func(s *sql.Selector) {
|
return func(s *sql.Selector) {
|
||||||
|
|||||||
@@ -110,6 +110,11 @@ func DownloadHistoryEpisodes(v bool) predicate.Media {
|
|||||||
return predicate.Media(sql.FieldEQ(FieldDownloadHistoryEpisodes, v))
|
return predicate.Media(sql.FieldEQ(FieldDownloadHistoryEpisodes, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||||
|
func CreateTime(v time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
// TmdbIDEQ applies the EQ predicate on the "tmdb_id" field.
|
// TmdbIDEQ applies the EQ predicate on the "tmdb_id" field.
|
||||||
func TmdbIDEQ(v int) predicate.Media {
|
func TmdbIDEQ(v int) predicate.Media {
|
||||||
return predicate.Media(sql.FieldEQ(FieldTmdbID, v))
|
return predicate.Media(sql.FieldEQ(FieldTmdbID, v))
|
||||||
@@ -805,6 +810,56 @@ func AlternativeTitlesNotNil() predicate.Media {
|
|||||||
return predicate.Media(sql.FieldNotNull(FieldAlternativeTitles))
|
return predicate.Media(sql.FieldNotNull(FieldAlternativeTitles))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeEQ(v time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeNEQ(v time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldNEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||||
|
func CreateTimeIn(vs ...time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotIn(vs ...time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||||
|
func CreateTimeGT(v time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldGT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeGTE(v time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldGTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||||
|
func CreateTimeLT(v time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldLT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeLTE(v time.Time) predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldLTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeIsNil() predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldIsNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotNil() predicate.Media {
|
||||||
|
return predicate.Media(sql.FieldNotNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
// HasEpisodes applies the HasEdge predicate on the "episodes" edge.
|
// HasEpisodes applies the HasEdge predicate on the "episodes" edge.
|
||||||
func HasEpisodes() predicate.Media {
|
func HasEpisodes() predicate.Media {
|
||||||
return predicate.Media(func(s *sql.Selector) {
|
return predicate.Media(func(s *sql.Selector) {
|
||||||
|
|||||||
@@ -190,6 +190,20 @@ func (mc *MediaCreate) SetAlternativeTitles(st []schema.AlternativeTilte) *Media
|
|||||||
return mc
|
return mc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (mc *MediaCreate) SetCreateTime(t time.Time) *MediaCreate {
|
||||||
|
mc.mutation.SetCreateTime(t)
|
||||||
|
return mc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||||
|
func (mc *MediaCreate) SetNillableCreateTime(t *time.Time) *MediaCreate {
|
||||||
|
if t != nil {
|
||||||
|
mc.SetCreateTime(*t)
|
||||||
|
}
|
||||||
|
return mc
|
||||||
|
}
|
||||||
|
|
||||||
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by IDs.
|
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by IDs.
|
||||||
func (mc *MediaCreate) AddEpisodeIDs(ids ...int) *MediaCreate {
|
func (mc *MediaCreate) AddEpisodeIDs(ids ...int) *MediaCreate {
|
||||||
mc.mutation.AddEpisodeIDs(ids...)
|
mc.mutation.AddEpisodeIDs(ids...)
|
||||||
@@ -256,6 +270,10 @@ func (mc *MediaCreate) defaults() {
|
|||||||
v := media.DefaultDownloadHistoryEpisodes
|
v := media.DefaultDownloadHistoryEpisodes
|
||||||
mc.mutation.SetDownloadHistoryEpisodes(v)
|
mc.mutation.SetDownloadHistoryEpisodes(v)
|
||||||
}
|
}
|
||||||
|
if _, ok := mc.mutation.CreateTime(); !ok {
|
||||||
|
v := media.DefaultCreateTime()
|
||||||
|
mc.mutation.SetCreateTime(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check runs all checks and user-defined validators on the builder.
|
// check runs all checks and user-defined validators on the builder.
|
||||||
@@ -387,6 +405,10 @@ func (mc *MediaCreate) createSpec() (*Media, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(media.FieldAlternativeTitles, field.TypeJSON, value)
|
_spec.SetField(media.FieldAlternativeTitles, field.TypeJSON, value)
|
||||||
_node.AlternativeTitles = value
|
_node.AlternativeTitles = value
|
||||||
}
|
}
|
||||||
|
if value, ok := mc.mutation.CreateTime(); ok {
|
||||||
|
_spec.SetField(media.FieldCreateTime, field.TypeTime, value)
|
||||||
|
_node.CreateTime = value
|
||||||
|
}
|
||||||
if nodes := mc.mutation.EpisodesIDs(); len(nodes) > 0 {
|
if nodes := mc.mutation.EpisodesIDs(); len(nodes) > 0 {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
|
|||||||
@@ -484,6 +484,9 @@ func (mu *MediaUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
if mu.mutation.AlternativeTitlesCleared() {
|
if mu.mutation.AlternativeTitlesCleared() {
|
||||||
_spec.ClearField(media.FieldAlternativeTitles, field.TypeJSON)
|
_spec.ClearField(media.FieldAlternativeTitles, field.TypeJSON)
|
||||||
}
|
}
|
||||||
|
if mu.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(media.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if mu.mutation.EpisodesCleared() {
|
if mu.mutation.EpisodesCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
@@ -1032,6 +1035,9 @@ func (muo *MediaUpdateOne) sqlSave(ctx context.Context) (_node *Media, err error
|
|||||||
if muo.mutation.AlternativeTitlesCleared() {
|
if muo.mutation.AlternativeTitlesCleared() {
|
||||||
_spec.ClearField(media.FieldAlternativeTitles, field.TypeJSON)
|
_spec.ClearField(media.FieldAlternativeTitles, field.TypeJSON)
|
||||||
}
|
}
|
||||||
|
if muo.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(media.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if muo.mutation.EpisodesCleared() {
|
if muo.mutation.EpisodesCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ var (
|
|||||||
{Name: "remove_completed_downloads", Type: field.TypeBool, Default: true},
|
{Name: "remove_completed_downloads", Type: field.TypeBool, Default: true},
|
||||||
{Name: "remove_failed_downloads", Type: field.TypeBool, Default: true},
|
{Name: "remove_failed_downloads", Type: field.TypeBool, Default: true},
|
||||||
{Name: "tags", Type: field.TypeString, Default: ""},
|
{Name: "tags", Type: field.TypeString, Default: ""},
|
||||||
|
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||||
}
|
}
|
||||||
// DownloadClientsTable holds the schema information for the "download_clients" table.
|
// DownloadClientsTable holds the schema information for the "download_clients" table.
|
||||||
DownloadClientsTable = &schema.Table{
|
DownloadClientsTable = &schema.Table{
|
||||||
@@ -53,6 +54,7 @@ var (
|
|||||||
{Name: "status", Type: field.TypeEnum, Enums: []string{"missing", "downloading", "downloaded"}, Default: "missing"},
|
{Name: "status", Type: field.TypeEnum, Enums: []string{"missing", "downloading", "downloaded"}, Default: "missing"},
|
||||||
{Name: "monitored", Type: field.TypeBool, Default: false},
|
{Name: "monitored", Type: field.TypeBool, Default: false},
|
||||||
{Name: "target_file", Type: field.TypeString, Nullable: true},
|
{Name: "target_file", Type: field.TypeString, Nullable: true},
|
||||||
|
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||||
{Name: "media_id", Type: field.TypeInt, Nullable: true},
|
{Name: "media_id", Type: field.TypeInt, Nullable: true},
|
||||||
}
|
}
|
||||||
// EpisodesTable holds the schema information for the "episodes" table.
|
// EpisodesTable holds the schema information for the "episodes" table.
|
||||||
@@ -63,7 +65,7 @@ var (
|
|||||||
ForeignKeys: []*schema.ForeignKey{
|
ForeignKeys: []*schema.ForeignKey{
|
||||||
{
|
{
|
||||||
Symbol: "episodes_media_episodes",
|
Symbol: "episodes_media_episodes",
|
||||||
Columns: []*schema.Column{EpisodesColumns[9]},
|
Columns: []*schema.Column{EpisodesColumns[10]},
|
||||||
RefColumns: []*schema.Column{MediaColumns[0]},
|
RefColumns: []*schema.Column{MediaColumns[0]},
|
||||||
OnDelete: schema.SetNull,
|
OnDelete: schema.SetNull,
|
||||||
},
|
},
|
||||||
@@ -84,6 +86,7 @@ var (
|
|||||||
{Name: "link", Type: field.TypeString, Nullable: true},
|
{Name: "link", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "hash", Type: field.TypeString, Nullable: true},
|
{Name: "hash", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "status", Type: field.TypeEnum, Enums: []string{"running", "success", "fail", "uploading", "seeding", "removed"}},
|
{Name: "status", Type: field.TypeEnum, Enums: []string{"running", "success", "fail", "uploading", "seeding", "removed"}},
|
||||||
|
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||||
}
|
}
|
||||||
// HistoriesTable holds the schema information for the "histories" table.
|
// HistoriesTable holds the schema information for the "histories" table.
|
||||||
HistoriesTable = &schema.Table{
|
HistoriesTable = &schema.Table{
|
||||||
@@ -122,6 +125,7 @@ var (
|
|||||||
{Name: "api_key", Type: field.TypeString, Nullable: true},
|
{Name: "api_key", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "url", Type: field.TypeString, Nullable: true},
|
{Name: "url", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "synced", Type: field.TypeBool, Nullable: true, Default: false},
|
{Name: "synced", Type: field.TypeBool, Nullable: true, Default: false},
|
||||||
|
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||||
}
|
}
|
||||||
// IndexersTable holds the schema information for the "indexers" table.
|
// IndexersTable holds the schema information for the "indexers" table.
|
||||||
IndexersTable = &schema.Table{
|
IndexersTable = &schema.Table{
|
||||||
@@ -148,6 +152,7 @@ var (
|
|||||||
{Name: "limiter", Type: field.TypeJSON, Nullable: true},
|
{Name: "limiter", Type: field.TypeJSON, Nullable: true},
|
||||||
{Name: "extras", Type: field.TypeJSON, Nullable: true},
|
{Name: "extras", Type: field.TypeJSON, Nullable: true},
|
||||||
{Name: "alternative_titles", Type: field.TypeJSON, Nullable: true},
|
{Name: "alternative_titles", Type: field.TypeJSON, Nullable: true},
|
||||||
|
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||||
}
|
}
|
||||||
// MediaTable holds the schema information for the "media" table.
|
// MediaTable holds the schema information for the "media" table.
|
||||||
MediaTable = &schema.Table{
|
MediaTable = &schema.Table{
|
||||||
@@ -191,6 +196,7 @@ var (
|
|||||||
{Name: "settings", Type: field.TypeString, Nullable: true},
|
{Name: "settings", Type: field.TypeString, Nullable: true},
|
||||||
{Name: "deleted", Type: field.TypeBool, Default: false},
|
{Name: "deleted", Type: field.TypeBool, Default: false},
|
||||||
{Name: "default", Type: field.TypeBool, Default: false},
|
{Name: "default", Type: field.TypeBool, Default: false},
|
||||||
|
{Name: "create_time", Type: field.TypeTime, Nullable: true},
|
||||||
}
|
}
|
||||||
// StoragesTable holds the schema information for the "storages" table.
|
// StoragesTable holds the schema information for the "storages" table.
|
||||||
StoragesTable = &schema.Table{
|
StoragesTable = &schema.Table{
|
||||||
|
|||||||
455
ent/mutation.go
455
ent/mutation.go
@@ -520,6 +520,7 @@ type DownloadClientsMutation struct {
|
|||||||
remove_completed_downloads *bool
|
remove_completed_downloads *bool
|
||||||
remove_failed_downloads *bool
|
remove_failed_downloads *bool
|
||||||
tags *string
|
tags *string
|
||||||
|
create_time *time.Time
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
done bool
|
done bool
|
||||||
oldValue func(context.Context) (*DownloadClients, error)
|
oldValue func(context.Context) (*DownloadClients, error)
|
||||||
@@ -1040,6 +1041,55 @@ func (m *DownloadClientsMutation) ResetTags() {
|
|||||||
m.tags = nil
|
m.tags = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (m *DownloadClientsMutation) SetCreateTime(t time.Time) {
|
||||||
|
m.create_time = &t
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||||
|
func (m *DownloadClientsMutation) CreateTime() (r time.Time, exists bool) {
|
||||||
|
v := m.create_time
|
||||||
|
if v == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return *v, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// OldCreateTime returns the old "create_time" field's value of the DownloadClients entity.
|
||||||
|
// If the DownloadClients 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 *DownloadClientsMutation) OldCreateTime(ctx context.Context) (v time.Time, err error) {
|
||||||
|
if !m.op.Is(OpUpdateOne) {
|
||||||
|
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||||
|
}
|
||||||
|
if m.id == nil || m.oldValue == nil {
|
||||||
|
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||||
|
}
|
||||||
|
oldValue, err := m.oldValue(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||||
|
}
|
||||||
|
return oldValue.CreateTime, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearCreateTime clears the value of the "create_time" field.
|
||||||
|
func (m *DownloadClientsMutation) ClearCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
m.clearedFields[downloadclients.FieldCreateTime] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
|
||||||
|
func (m *DownloadClientsMutation) CreateTimeCleared() bool {
|
||||||
|
_, ok := m.clearedFields[downloadclients.FieldCreateTime]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResetCreateTime resets all changes to the "create_time" field.
|
||||||
|
func (m *DownloadClientsMutation) ResetCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
delete(m.clearedFields, downloadclients.FieldCreateTime)
|
||||||
|
}
|
||||||
|
|
||||||
// Where appends a list predicates to the DownloadClientsMutation builder.
|
// Where appends a list predicates to the DownloadClientsMutation builder.
|
||||||
func (m *DownloadClientsMutation) Where(ps ...predicate.DownloadClients) {
|
func (m *DownloadClientsMutation) Where(ps ...predicate.DownloadClients) {
|
||||||
m.predicates = append(m.predicates, ps...)
|
m.predicates = append(m.predicates, ps...)
|
||||||
@@ -1074,7 +1124,7 @@ func (m *DownloadClientsMutation) Type() string {
|
|||||||
// order to get all numeric fields that were incremented/decremented, call
|
// order to get all numeric fields that were incremented/decremented, call
|
||||||
// AddedFields().
|
// AddedFields().
|
||||||
func (m *DownloadClientsMutation) Fields() []string {
|
func (m *DownloadClientsMutation) Fields() []string {
|
||||||
fields := make([]string, 0, 11)
|
fields := make([]string, 0, 12)
|
||||||
if m.enable != nil {
|
if m.enable != nil {
|
||||||
fields = append(fields, downloadclients.FieldEnable)
|
fields = append(fields, downloadclients.FieldEnable)
|
||||||
}
|
}
|
||||||
@@ -1108,6 +1158,9 @@ func (m *DownloadClientsMutation) Fields() []string {
|
|||||||
if m.tags != nil {
|
if m.tags != nil {
|
||||||
fields = append(fields, downloadclients.FieldTags)
|
fields = append(fields, downloadclients.FieldTags)
|
||||||
}
|
}
|
||||||
|
if m.create_time != nil {
|
||||||
|
fields = append(fields, downloadclients.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1138,6 +1191,8 @@ func (m *DownloadClientsMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.RemoveFailedDownloads()
|
return m.RemoveFailedDownloads()
|
||||||
case downloadclients.FieldTags:
|
case downloadclients.FieldTags:
|
||||||
return m.Tags()
|
return m.Tags()
|
||||||
|
case downloadclients.FieldCreateTime:
|
||||||
|
return m.CreateTime()
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -1169,6 +1224,8 @@ func (m *DownloadClientsMutation) OldField(ctx context.Context, name string) (en
|
|||||||
return m.OldRemoveFailedDownloads(ctx)
|
return m.OldRemoveFailedDownloads(ctx)
|
||||||
case downloadclients.FieldTags:
|
case downloadclients.FieldTags:
|
||||||
return m.OldTags(ctx)
|
return m.OldTags(ctx)
|
||||||
|
case downloadclients.FieldCreateTime:
|
||||||
|
return m.OldCreateTime(ctx)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown DownloadClients field %s", name)
|
return nil, fmt.Errorf("unknown DownloadClients field %s", name)
|
||||||
}
|
}
|
||||||
@@ -1255,6 +1312,13 @@ func (m *DownloadClientsMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetTags(v)
|
m.SetTags(v)
|
||||||
return nil
|
return nil
|
||||||
|
case downloadclients.FieldCreateTime:
|
||||||
|
v, ok := value.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
|
}
|
||||||
|
m.SetCreateTime(v)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown DownloadClients field %s", name)
|
return fmt.Errorf("unknown DownloadClients field %s", name)
|
||||||
}
|
}
|
||||||
@@ -1299,7 +1363,11 @@ func (m *DownloadClientsMutation) AddField(name string, value ent.Value) error {
|
|||||||
// ClearedFields returns all nullable fields that were cleared during this
|
// ClearedFields returns all nullable fields that were cleared during this
|
||||||
// mutation.
|
// mutation.
|
||||||
func (m *DownloadClientsMutation) ClearedFields() []string {
|
func (m *DownloadClientsMutation) ClearedFields() []string {
|
||||||
return nil
|
var fields []string
|
||||||
|
if m.FieldCleared(downloadclients.FieldCreateTime) {
|
||||||
|
fields = append(fields, downloadclients.FieldCreateTime)
|
||||||
|
}
|
||||||
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
// FieldCleared returns a boolean indicating if a field with the given name was
|
// FieldCleared returns a boolean indicating if a field with the given name was
|
||||||
@@ -1312,6 +1380,11 @@ func (m *DownloadClientsMutation) FieldCleared(name string) bool {
|
|||||||
// ClearField clears the value of the field with the given name. It returns an
|
// ClearField clears the value of the field with the given name. It returns an
|
||||||
// error if the field is not defined in the schema.
|
// error if the field is not defined in the schema.
|
||||||
func (m *DownloadClientsMutation) ClearField(name string) error {
|
func (m *DownloadClientsMutation) ClearField(name string) error {
|
||||||
|
switch name {
|
||||||
|
case downloadclients.FieldCreateTime:
|
||||||
|
m.ClearCreateTime()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return fmt.Errorf("unknown DownloadClients nullable field %s", name)
|
return fmt.Errorf("unknown DownloadClients nullable field %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,6 +1425,9 @@ func (m *DownloadClientsMutation) ResetField(name string) error {
|
|||||||
case downloadclients.FieldTags:
|
case downloadclients.FieldTags:
|
||||||
m.ResetTags()
|
m.ResetTags()
|
||||||
return nil
|
return nil
|
||||||
|
case downloadclients.FieldCreateTime:
|
||||||
|
m.ResetCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown DownloadClients field %s", name)
|
return fmt.Errorf("unknown DownloadClients field %s", name)
|
||||||
}
|
}
|
||||||
@@ -1420,6 +1496,7 @@ type EpisodeMutation struct {
|
|||||||
status *episode.Status
|
status *episode.Status
|
||||||
monitored *bool
|
monitored *bool
|
||||||
target_file *string
|
target_file *string
|
||||||
|
create_time *time.Time
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
media *int
|
media *int
|
||||||
clearedmedia bool
|
clearedmedia bool
|
||||||
@@ -1916,6 +1993,55 @@ func (m *EpisodeMutation) ResetTargetFile() {
|
|||||||
delete(m.clearedFields, episode.FieldTargetFile)
|
delete(m.clearedFields, episode.FieldTargetFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (m *EpisodeMutation) SetCreateTime(t time.Time) {
|
||||||
|
m.create_time = &t
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||||
|
func (m *EpisodeMutation) CreateTime() (r time.Time, exists bool) {
|
||||||
|
v := m.create_time
|
||||||
|
if v == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return *v, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// OldCreateTime returns the old "create_time" field's value of the Episode entity.
|
||||||
|
// If the Episode 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 *EpisodeMutation) OldCreateTime(ctx context.Context) (v time.Time, err error) {
|
||||||
|
if !m.op.Is(OpUpdateOne) {
|
||||||
|
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||||
|
}
|
||||||
|
if m.id == nil || m.oldValue == nil {
|
||||||
|
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||||
|
}
|
||||||
|
oldValue, err := m.oldValue(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||||
|
}
|
||||||
|
return oldValue.CreateTime, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearCreateTime clears the value of the "create_time" field.
|
||||||
|
func (m *EpisodeMutation) ClearCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
m.clearedFields[episode.FieldCreateTime] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
|
||||||
|
func (m *EpisodeMutation) CreateTimeCleared() bool {
|
||||||
|
_, ok := m.clearedFields[episode.FieldCreateTime]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResetCreateTime resets all changes to the "create_time" field.
|
||||||
|
func (m *EpisodeMutation) ResetCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
delete(m.clearedFields, episode.FieldCreateTime)
|
||||||
|
}
|
||||||
|
|
||||||
// ClearMedia clears the "media" edge to the Media entity.
|
// ClearMedia clears the "media" edge to the Media entity.
|
||||||
func (m *EpisodeMutation) ClearMedia() {
|
func (m *EpisodeMutation) ClearMedia() {
|
||||||
m.clearedmedia = true
|
m.clearedmedia = true
|
||||||
@@ -1977,7 +2103,7 @@ func (m *EpisodeMutation) Type() string {
|
|||||||
// order to get all numeric fields that were incremented/decremented, call
|
// order to get all numeric fields that were incremented/decremented, call
|
||||||
// AddedFields().
|
// AddedFields().
|
||||||
func (m *EpisodeMutation) Fields() []string {
|
func (m *EpisodeMutation) Fields() []string {
|
||||||
fields := make([]string, 0, 9)
|
fields := make([]string, 0, 10)
|
||||||
if m.media != nil {
|
if m.media != nil {
|
||||||
fields = append(fields, episode.FieldMediaID)
|
fields = append(fields, episode.FieldMediaID)
|
||||||
}
|
}
|
||||||
@@ -2005,6 +2131,9 @@ func (m *EpisodeMutation) Fields() []string {
|
|||||||
if m.target_file != nil {
|
if m.target_file != nil {
|
||||||
fields = append(fields, episode.FieldTargetFile)
|
fields = append(fields, episode.FieldTargetFile)
|
||||||
}
|
}
|
||||||
|
if m.create_time != nil {
|
||||||
|
fields = append(fields, episode.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2031,6 +2160,8 @@ func (m *EpisodeMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.Monitored()
|
return m.Monitored()
|
||||||
case episode.FieldTargetFile:
|
case episode.FieldTargetFile:
|
||||||
return m.TargetFile()
|
return m.TargetFile()
|
||||||
|
case episode.FieldCreateTime:
|
||||||
|
return m.CreateTime()
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -2058,6 +2189,8 @@ func (m *EpisodeMutation) OldField(ctx context.Context, name string) (ent.Value,
|
|||||||
return m.OldMonitored(ctx)
|
return m.OldMonitored(ctx)
|
||||||
case episode.FieldTargetFile:
|
case episode.FieldTargetFile:
|
||||||
return m.OldTargetFile(ctx)
|
return m.OldTargetFile(ctx)
|
||||||
|
case episode.FieldCreateTime:
|
||||||
|
return m.OldCreateTime(ctx)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown Episode field %s", name)
|
return nil, fmt.Errorf("unknown Episode field %s", name)
|
||||||
}
|
}
|
||||||
@@ -2130,6 +2263,13 @@ func (m *EpisodeMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetTargetFile(v)
|
m.SetTargetFile(v)
|
||||||
return nil
|
return nil
|
||||||
|
case episode.FieldCreateTime:
|
||||||
|
v, ok := value.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
|
}
|
||||||
|
m.SetCreateTime(v)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Episode field %s", name)
|
return fmt.Errorf("unknown Episode field %s", name)
|
||||||
}
|
}
|
||||||
@@ -2193,6 +2333,9 @@ func (m *EpisodeMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(episode.FieldTargetFile) {
|
if m.FieldCleared(episode.FieldTargetFile) {
|
||||||
fields = append(fields, episode.FieldTargetFile)
|
fields = append(fields, episode.FieldTargetFile)
|
||||||
}
|
}
|
||||||
|
if m.FieldCleared(episode.FieldCreateTime) {
|
||||||
|
fields = append(fields, episode.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2213,6 +2356,9 @@ func (m *EpisodeMutation) ClearField(name string) error {
|
|||||||
case episode.FieldTargetFile:
|
case episode.FieldTargetFile:
|
||||||
m.ClearTargetFile()
|
m.ClearTargetFile()
|
||||||
return nil
|
return nil
|
||||||
|
case episode.FieldCreateTime:
|
||||||
|
m.ClearCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Episode nullable field %s", name)
|
return fmt.Errorf("unknown Episode nullable field %s", name)
|
||||||
}
|
}
|
||||||
@@ -2248,6 +2394,9 @@ func (m *EpisodeMutation) ResetField(name string) error {
|
|||||||
case episode.FieldTargetFile:
|
case episode.FieldTargetFile:
|
||||||
m.ResetTargetFile()
|
m.ResetTargetFile()
|
||||||
return nil
|
return nil
|
||||||
|
case episode.FieldCreateTime:
|
||||||
|
m.ResetCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Episode field %s", name)
|
return fmt.Errorf("unknown Episode field %s", name)
|
||||||
}
|
}
|
||||||
@@ -2350,6 +2499,7 @@ type HistoryMutation struct {
|
|||||||
link *string
|
link *string
|
||||||
hash *string
|
hash *string
|
||||||
status *history.Status
|
status *history.Status
|
||||||
|
create_time *time.Time
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
done bool
|
done bool
|
||||||
oldValue func(context.Context) (*History, error)
|
oldValue func(context.Context) (*History, error)
|
||||||
@@ -3083,6 +3233,55 @@ func (m *HistoryMutation) ResetStatus() {
|
|||||||
m.status = nil
|
m.status = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (m *HistoryMutation) SetCreateTime(t time.Time) {
|
||||||
|
m.create_time = &t
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||||
|
func (m *HistoryMutation) CreateTime() (r time.Time, exists bool) {
|
||||||
|
v := m.create_time
|
||||||
|
if v == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return *v, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// OldCreateTime returns the old "create_time" field's value of the History entity.
|
||||||
|
// If the History 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 *HistoryMutation) OldCreateTime(ctx context.Context) (v time.Time, err error) {
|
||||||
|
if !m.op.Is(OpUpdateOne) {
|
||||||
|
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||||
|
}
|
||||||
|
if m.id == nil || m.oldValue == nil {
|
||||||
|
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||||
|
}
|
||||||
|
oldValue, err := m.oldValue(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||||
|
}
|
||||||
|
return oldValue.CreateTime, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearCreateTime clears the value of the "create_time" field.
|
||||||
|
func (m *HistoryMutation) ClearCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
m.clearedFields[history.FieldCreateTime] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
|
||||||
|
func (m *HistoryMutation) CreateTimeCleared() bool {
|
||||||
|
_, ok := m.clearedFields[history.FieldCreateTime]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResetCreateTime resets all changes to the "create_time" field.
|
||||||
|
func (m *HistoryMutation) ResetCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
delete(m.clearedFields, history.FieldCreateTime)
|
||||||
|
}
|
||||||
|
|
||||||
// Where appends a list predicates to the HistoryMutation builder.
|
// Where appends a list predicates to the HistoryMutation builder.
|
||||||
func (m *HistoryMutation) Where(ps ...predicate.History) {
|
func (m *HistoryMutation) Where(ps ...predicate.History) {
|
||||||
m.predicates = append(m.predicates, ps...)
|
m.predicates = append(m.predicates, ps...)
|
||||||
@@ -3117,7 +3316,7 @@ func (m *HistoryMutation) Type() string {
|
|||||||
// order to get all numeric fields that were incremented/decremented, call
|
// order to get all numeric fields that were incremented/decremented, call
|
||||||
// AddedFields().
|
// AddedFields().
|
||||||
func (m *HistoryMutation) Fields() []string {
|
func (m *HistoryMutation) Fields() []string {
|
||||||
fields := make([]string, 0, 12)
|
fields := make([]string, 0, 13)
|
||||||
if m.media_id != nil {
|
if m.media_id != nil {
|
||||||
fields = append(fields, history.FieldMediaID)
|
fields = append(fields, history.FieldMediaID)
|
||||||
}
|
}
|
||||||
@@ -3154,6 +3353,9 @@ func (m *HistoryMutation) Fields() []string {
|
|||||||
if m.status != nil {
|
if m.status != nil {
|
||||||
fields = append(fields, history.FieldStatus)
|
fields = append(fields, history.FieldStatus)
|
||||||
}
|
}
|
||||||
|
if m.create_time != nil {
|
||||||
|
fields = append(fields, history.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3186,6 +3388,8 @@ func (m *HistoryMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.Hash()
|
return m.Hash()
|
||||||
case history.FieldStatus:
|
case history.FieldStatus:
|
||||||
return m.Status()
|
return m.Status()
|
||||||
|
case history.FieldCreateTime:
|
||||||
|
return m.CreateTime()
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -3219,6 +3423,8 @@ func (m *HistoryMutation) OldField(ctx context.Context, name string) (ent.Value,
|
|||||||
return m.OldHash(ctx)
|
return m.OldHash(ctx)
|
||||||
case history.FieldStatus:
|
case history.FieldStatus:
|
||||||
return m.OldStatus(ctx)
|
return m.OldStatus(ctx)
|
||||||
|
case history.FieldCreateTime:
|
||||||
|
return m.OldCreateTime(ctx)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown History field %s", name)
|
return nil, fmt.Errorf("unknown History field %s", name)
|
||||||
}
|
}
|
||||||
@@ -3312,6 +3518,13 @@ func (m *HistoryMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetStatus(v)
|
m.SetStatus(v)
|
||||||
return nil
|
return nil
|
||||||
|
case history.FieldCreateTime:
|
||||||
|
v, ok := value.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
|
}
|
||||||
|
m.SetCreateTime(v)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown History field %s", name)
|
return fmt.Errorf("unknown History field %s", name)
|
||||||
}
|
}
|
||||||
@@ -3423,6 +3636,9 @@ func (m *HistoryMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(history.FieldHash) {
|
if m.FieldCleared(history.FieldHash) {
|
||||||
fields = append(fields, history.FieldHash)
|
fields = append(fields, history.FieldHash)
|
||||||
}
|
}
|
||||||
|
if m.FieldCleared(history.FieldCreateTime) {
|
||||||
|
fields = append(fields, history.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3455,6 +3671,9 @@ func (m *HistoryMutation) ClearField(name string) error {
|
|||||||
case history.FieldHash:
|
case history.FieldHash:
|
||||||
m.ClearHash()
|
m.ClearHash()
|
||||||
return nil
|
return nil
|
||||||
|
case history.FieldCreateTime:
|
||||||
|
m.ClearCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown History nullable field %s", name)
|
return fmt.Errorf("unknown History nullable field %s", name)
|
||||||
}
|
}
|
||||||
@@ -3499,6 +3718,9 @@ func (m *HistoryMutation) ResetField(name string) error {
|
|||||||
case history.FieldStatus:
|
case history.FieldStatus:
|
||||||
m.ResetStatus()
|
m.ResetStatus()
|
||||||
return nil
|
return nil
|
||||||
|
case history.FieldCreateTime:
|
||||||
|
m.ResetCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown History field %s", name)
|
return fmt.Errorf("unknown History field %s", name)
|
||||||
}
|
}
|
||||||
@@ -4244,6 +4466,7 @@ type IndexersMutation struct {
|
|||||||
api_key *string
|
api_key *string
|
||||||
url *string
|
url *string
|
||||||
synced *bool
|
synced *bool
|
||||||
|
create_time *time.Time
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
done bool
|
done bool
|
||||||
oldValue func(context.Context) (*Indexers, error)
|
oldValue func(context.Context) (*Indexers, error)
|
||||||
@@ -4925,6 +5148,55 @@ func (m *IndexersMutation) ResetSynced() {
|
|||||||
delete(m.clearedFields, indexers.FieldSynced)
|
delete(m.clearedFields, indexers.FieldSynced)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (m *IndexersMutation) SetCreateTime(t time.Time) {
|
||||||
|
m.create_time = &t
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||||
|
func (m *IndexersMutation) CreateTime() (r time.Time, exists bool) {
|
||||||
|
v := m.create_time
|
||||||
|
if v == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return *v, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// OldCreateTime returns the old "create_time" 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) OldCreateTime(ctx context.Context) (v time.Time, err error) {
|
||||||
|
if !m.op.Is(OpUpdateOne) {
|
||||||
|
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||||
|
}
|
||||||
|
if m.id == nil || m.oldValue == nil {
|
||||||
|
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||||
|
}
|
||||||
|
oldValue, err := m.oldValue(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||||
|
}
|
||||||
|
return oldValue.CreateTime, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearCreateTime clears the value of the "create_time" field.
|
||||||
|
func (m *IndexersMutation) ClearCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
m.clearedFields[indexers.FieldCreateTime] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
|
||||||
|
func (m *IndexersMutation) CreateTimeCleared() bool {
|
||||||
|
_, ok := m.clearedFields[indexers.FieldCreateTime]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResetCreateTime resets all changes to the "create_time" field.
|
||||||
|
func (m *IndexersMutation) ResetCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
delete(m.clearedFields, indexers.FieldCreateTime)
|
||||||
|
}
|
||||||
|
|
||||||
// Where appends a list predicates to the IndexersMutation builder.
|
// Where appends a list predicates to the IndexersMutation builder.
|
||||||
func (m *IndexersMutation) Where(ps ...predicate.Indexers) {
|
func (m *IndexersMutation) Where(ps ...predicate.Indexers) {
|
||||||
m.predicates = append(m.predicates, ps...)
|
m.predicates = append(m.predicates, ps...)
|
||||||
@@ -4959,7 +5231,7 @@ func (m *IndexersMutation) Type() string {
|
|||||||
// order to get all numeric fields that were incremented/decremented, call
|
// order to get all numeric fields that were incremented/decremented, call
|
||||||
// AddedFields().
|
// AddedFields().
|
||||||
func (m *IndexersMutation) Fields() []string {
|
func (m *IndexersMutation) Fields() []string {
|
||||||
fields := make([]string, 0, 12)
|
fields := make([]string, 0, 13)
|
||||||
if m.name != nil {
|
if m.name != nil {
|
||||||
fields = append(fields, indexers.FieldName)
|
fields = append(fields, indexers.FieldName)
|
||||||
}
|
}
|
||||||
@@ -4996,6 +5268,9 @@ func (m *IndexersMutation) Fields() []string {
|
|||||||
if m.synced != nil {
|
if m.synced != nil {
|
||||||
fields = append(fields, indexers.FieldSynced)
|
fields = append(fields, indexers.FieldSynced)
|
||||||
}
|
}
|
||||||
|
if m.create_time != nil {
|
||||||
|
fields = append(fields, indexers.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5028,6 +5303,8 @@ func (m *IndexersMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.URL()
|
return m.URL()
|
||||||
case indexers.FieldSynced:
|
case indexers.FieldSynced:
|
||||||
return m.Synced()
|
return m.Synced()
|
||||||
|
case indexers.FieldCreateTime:
|
||||||
|
return m.CreateTime()
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -5061,6 +5338,8 @@ func (m *IndexersMutation) OldField(ctx context.Context, name string) (ent.Value
|
|||||||
return m.OldURL(ctx)
|
return m.OldURL(ctx)
|
||||||
case indexers.FieldSynced:
|
case indexers.FieldSynced:
|
||||||
return m.OldSynced(ctx)
|
return m.OldSynced(ctx)
|
||||||
|
case indexers.FieldCreateTime:
|
||||||
|
return m.OldCreateTime(ctx)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown Indexers field %s", name)
|
return nil, fmt.Errorf("unknown Indexers field %s", name)
|
||||||
}
|
}
|
||||||
@@ -5154,6 +5433,13 @@ func (m *IndexersMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetSynced(v)
|
m.SetSynced(v)
|
||||||
return nil
|
return nil
|
||||||
|
case indexers.FieldCreateTime:
|
||||||
|
v, ok := value.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
|
}
|
||||||
|
m.SetCreateTime(v)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Indexers field %s", name)
|
return fmt.Errorf("unknown Indexers field %s", name)
|
||||||
}
|
}
|
||||||
@@ -5235,6 +5521,9 @@ func (m *IndexersMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(indexers.FieldSynced) {
|
if m.FieldCleared(indexers.FieldSynced) {
|
||||||
fields = append(fields, indexers.FieldSynced)
|
fields = append(fields, indexers.FieldSynced)
|
||||||
}
|
}
|
||||||
|
if m.FieldCleared(indexers.FieldCreateTime) {
|
||||||
|
fields = append(fields, indexers.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5273,6 +5562,9 @@ func (m *IndexersMutation) ClearField(name string) error {
|
|||||||
case indexers.FieldSynced:
|
case indexers.FieldSynced:
|
||||||
m.ClearSynced()
|
m.ClearSynced()
|
||||||
return nil
|
return nil
|
||||||
|
case indexers.FieldCreateTime:
|
||||||
|
m.ClearCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Indexers nullable field %s", name)
|
return fmt.Errorf("unknown Indexers nullable field %s", name)
|
||||||
}
|
}
|
||||||
@@ -5317,6 +5609,9 @@ func (m *IndexersMutation) ResetField(name string) error {
|
|||||||
case indexers.FieldSynced:
|
case indexers.FieldSynced:
|
||||||
m.ResetSynced()
|
m.ResetSynced()
|
||||||
return nil
|
return nil
|
||||||
|
case indexers.FieldCreateTime:
|
||||||
|
m.ResetCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Indexers field %s", name)
|
return fmt.Errorf("unknown Indexers field %s", name)
|
||||||
}
|
}
|
||||||
@@ -5394,6 +5689,7 @@ type MediaMutation struct {
|
|||||||
extras *schema.MediaExtras
|
extras *schema.MediaExtras
|
||||||
alternative_titles *[]schema.AlternativeTilte
|
alternative_titles *[]schema.AlternativeTilte
|
||||||
appendalternative_titles []schema.AlternativeTilte
|
appendalternative_titles []schema.AlternativeTilte
|
||||||
|
create_time *time.Time
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
episodes map[int]struct{}
|
episodes map[int]struct{}
|
||||||
removedepisodes map[int]struct{}
|
removedepisodes map[int]struct{}
|
||||||
@@ -6225,6 +6521,55 @@ func (m *MediaMutation) ResetAlternativeTitles() {
|
|||||||
delete(m.clearedFields, media.FieldAlternativeTitles)
|
delete(m.clearedFields, media.FieldAlternativeTitles)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (m *MediaMutation) SetCreateTime(t time.Time) {
|
||||||
|
m.create_time = &t
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||||
|
func (m *MediaMutation) CreateTime() (r time.Time, exists bool) {
|
||||||
|
v := m.create_time
|
||||||
|
if v == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return *v, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// OldCreateTime returns the old "create_time" field's value of the Media entity.
|
||||||
|
// If the Media 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 *MediaMutation) OldCreateTime(ctx context.Context) (v time.Time, err error) {
|
||||||
|
if !m.op.Is(OpUpdateOne) {
|
||||||
|
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||||
|
}
|
||||||
|
if m.id == nil || m.oldValue == nil {
|
||||||
|
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||||
|
}
|
||||||
|
oldValue, err := m.oldValue(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||||
|
}
|
||||||
|
return oldValue.CreateTime, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearCreateTime clears the value of the "create_time" field.
|
||||||
|
func (m *MediaMutation) ClearCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
m.clearedFields[media.FieldCreateTime] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
|
||||||
|
func (m *MediaMutation) CreateTimeCleared() bool {
|
||||||
|
_, ok := m.clearedFields[media.FieldCreateTime]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResetCreateTime resets all changes to the "create_time" field.
|
||||||
|
func (m *MediaMutation) ResetCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
delete(m.clearedFields, media.FieldCreateTime)
|
||||||
|
}
|
||||||
|
|
||||||
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by ids.
|
// AddEpisodeIDs adds the "episodes" edge to the Episode entity by ids.
|
||||||
func (m *MediaMutation) AddEpisodeIDs(ids ...int) {
|
func (m *MediaMutation) AddEpisodeIDs(ids ...int) {
|
||||||
if m.episodes == nil {
|
if m.episodes == nil {
|
||||||
@@ -6313,7 +6658,7 @@ func (m *MediaMutation) Type() string {
|
|||||||
// order to get all numeric fields that were incremented/decremented, call
|
// order to get all numeric fields that were incremented/decremented, call
|
||||||
// AddedFields().
|
// AddedFields().
|
||||||
func (m *MediaMutation) Fields() []string {
|
func (m *MediaMutation) Fields() []string {
|
||||||
fields := make([]string, 0, 16)
|
fields := make([]string, 0, 17)
|
||||||
if m.tmdb_id != nil {
|
if m.tmdb_id != nil {
|
||||||
fields = append(fields, media.FieldTmdbID)
|
fields = append(fields, media.FieldTmdbID)
|
||||||
}
|
}
|
||||||
@@ -6362,6 +6707,9 @@ func (m *MediaMutation) Fields() []string {
|
|||||||
if m.alternative_titles != nil {
|
if m.alternative_titles != nil {
|
||||||
fields = append(fields, media.FieldAlternativeTitles)
|
fields = append(fields, media.FieldAlternativeTitles)
|
||||||
}
|
}
|
||||||
|
if m.create_time != nil {
|
||||||
|
fields = append(fields, media.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6402,6 +6750,8 @@ func (m *MediaMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.Extras()
|
return m.Extras()
|
||||||
case media.FieldAlternativeTitles:
|
case media.FieldAlternativeTitles:
|
||||||
return m.AlternativeTitles()
|
return m.AlternativeTitles()
|
||||||
|
case media.FieldCreateTime:
|
||||||
|
return m.CreateTime()
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -6443,6 +6793,8 @@ func (m *MediaMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
|||||||
return m.OldExtras(ctx)
|
return m.OldExtras(ctx)
|
||||||
case media.FieldAlternativeTitles:
|
case media.FieldAlternativeTitles:
|
||||||
return m.OldAlternativeTitles(ctx)
|
return m.OldAlternativeTitles(ctx)
|
||||||
|
case media.FieldCreateTime:
|
||||||
|
return m.OldCreateTime(ctx)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown Media field %s", name)
|
return nil, fmt.Errorf("unknown Media field %s", name)
|
||||||
}
|
}
|
||||||
@@ -6564,6 +6916,13 @@ func (m *MediaMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetAlternativeTitles(v)
|
m.SetAlternativeTitles(v)
|
||||||
return nil
|
return nil
|
||||||
|
case media.FieldCreateTime:
|
||||||
|
v, ok := value.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
|
}
|
||||||
|
m.SetCreateTime(v)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Media field %s", name)
|
return fmt.Errorf("unknown Media field %s", name)
|
||||||
}
|
}
|
||||||
@@ -6642,6 +7001,9 @@ func (m *MediaMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(media.FieldAlternativeTitles) {
|
if m.FieldCleared(media.FieldAlternativeTitles) {
|
||||||
fields = append(fields, media.FieldAlternativeTitles)
|
fields = append(fields, media.FieldAlternativeTitles)
|
||||||
}
|
}
|
||||||
|
if m.FieldCleared(media.FieldCreateTime) {
|
||||||
|
fields = append(fields, media.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6677,6 +7039,9 @@ func (m *MediaMutation) ClearField(name string) error {
|
|||||||
case media.FieldAlternativeTitles:
|
case media.FieldAlternativeTitles:
|
||||||
m.ClearAlternativeTitles()
|
m.ClearAlternativeTitles()
|
||||||
return nil
|
return nil
|
||||||
|
case media.FieldCreateTime:
|
||||||
|
m.ClearCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Media nullable field %s", name)
|
return fmt.Errorf("unknown Media nullable field %s", name)
|
||||||
}
|
}
|
||||||
@@ -6733,6 +7098,9 @@ func (m *MediaMutation) ResetField(name string) error {
|
|||||||
case media.FieldAlternativeTitles:
|
case media.FieldAlternativeTitles:
|
||||||
m.ResetAlternativeTitles()
|
m.ResetAlternativeTitles()
|
||||||
return nil
|
return nil
|
||||||
|
case media.FieldCreateTime:
|
||||||
|
m.ResetCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Media field %s", name)
|
return fmt.Errorf("unknown Media field %s", name)
|
||||||
}
|
}
|
||||||
@@ -7702,6 +8070,7 @@ type StorageMutation struct {
|
|||||||
settings *string
|
settings *string
|
||||||
deleted *bool
|
deleted *bool
|
||||||
_default *bool
|
_default *bool
|
||||||
|
create_time *time.Time
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
done bool
|
done bool
|
||||||
oldValue func(context.Context) (*Storage, error)
|
oldValue func(context.Context) (*Storage, error)
|
||||||
@@ -8097,6 +8466,55 @@ func (m *StorageMutation) ResetDefault() {
|
|||||||
m._default = nil
|
m._default = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (m *StorageMutation) SetCreateTime(t time.Time) {
|
||||||
|
m.create_time = &t
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTime returns the value of the "create_time" field in the mutation.
|
||||||
|
func (m *StorageMutation) CreateTime() (r time.Time, exists bool) {
|
||||||
|
v := m.create_time
|
||||||
|
if v == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return *v, true
|
||||||
|
}
|
||||||
|
|
||||||
|
// OldCreateTime returns the old "create_time" field's value of the Storage entity.
|
||||||
|
// If the Storage 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 *StorageMutation) OldCreateTime(ctx context.Context) (v time.Time, err error) {
|
||||||
|
if !m.op.Is(OpUpdateOne) {
|
||||||
|
return v, errors.New("OldCreateTime is only allowed on UpdateOne operations")
|
||||||
|
}
|
||||||
|
if m.id == nil || m.oldValue == nil {
|
||||||
|
return v, errors.New("OldCreateTime requires an ID field in the mutation")
|
||||||
|
}
|
||||||
|
oldValue, err := m.oldValue(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return v, fmt.Errorf("querying old value for OldCreateTime: %w", err)
|
||||||
|
}
|
||||||
|
return oldValue.CreateTime, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearCreateTime clears the value of the "create_time" field.
|
||||||
|
func (m *StorageMutation) ClearCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
m.clearedFields[storage.FieldCreateTime] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
|
||||||
|
func (m *StorageMutation) CreateTimeCleared() bool {
|
||||||
|
_, ok := m.clearedFields[storage.FieldCreateTime]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResetCreateTime resets all changes to the "create_time" field.
|
||||||
|
func (m *StorageMutation) ResetCreateTime() {
|
||||||
|
m.create_time = nil
|
||||||
|
delete(m.clearedFields, storage.FieldCreateTime)
|
||||||
|
}
|
||||||
|
|
||||||
// Where appends a list predicates to the StorageMutation builder.
|
// Where appends a list predicates to the StorageMutation builder.
|
||||||
func (m *StorageMutation) Where(ps ...predicate.Storage) {
|
func (m *StorageMutation) Where(ps ...predicate.Storage) {
|
||||||
m.predicates = append(m.predicates, ps...)
|
m.predicates = append(m.predicates, ps...)
|
||||||
@@ -8131,7 +8549,7 @@ func (m *StorageMutation) Type() string {
|
|||||||
// order to get all numeric fields that were incremented/decremented, call
|
// order to get all numeric fields that were incremented/decremented, call
|
||||||
// AddedFields().
|
// AddedFields().
|
||||||
func (m *StorageMutation) Fields() []string {
|
func (m *StorageMutation) Fields() []string {
|
||||||
fields := make([]string, 0, 7)
|
fields := make([]string, 0, 8)
|
||||||
if m.name != nil {
|
if m.name != nil {
|
||||||
fields = append(fields, storage.FieldName)
|
fields = append(fields, storage.FieldName)
|
||||||
}
|
}
|
||||||
@@ -8153,6 +8571,9 @@ func (m *StorageMutation) Fields() []string {
|
|||||||
if m._default != nil {
|
if m._default != nil {
|
||||||
fields = append(fields, storage.FieldDefault)
|
fields = append(fields, storage.FieldDefault)
|
||||||
}
|
}
|
||||||
|
if m.create_time != nil {
|
||||||
|
fields = append(fields, storage.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8175,6 +8596,8 @@ func (m *StorageMutation) Field(name string) (ent.Value, bool) {
|
|||||||
return m.Deleted()
|
return m.Deleted()
|
||||||
case storage.FieldDefault:
|
case storage.FieldDefault:
|
||||||
return m.Default()
|
return m.Default()
|
||||||
|
case storage.FieldCreateTime:
|
||||||
|
return m.CreateTime()
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -8198,6 +8621,8 @@ func (m *StorageMutation) OldField(ctx context.Context, name string) (ent.Value,
|
|||||||
return m.OldDeleted(ctx)
|
return m.OldDeleted(ctx)
|
||||||
case storage.FieldDefault:
|
case storage.FieldDefault:
|
||||||
return m.OldDefault(ctx)
|
return m.OldDefault(ctx)
|
||||||
|
case storage.FieldCreateTime:
|
||||||
|
return m.OldCreateTime(ctx)
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("unknown Storage field %s", name)
|
return nil, fmt.Errorf("unknown Storage field %s", name)
|
||||||
}
|
}
|
||||||
@@ -8256,6 +8681,13 @@ func (m *StorageMutation) SetField(name string, value ent.Value) error {
|
|||||||
}
|
}
|
||||||
m.SetDefault(v)
|
m.SetDefault(v)
|
||||||
return nil
|
return nil
|
||||||
|
case storage.FieldCreateTime:
|
||||||
|
v, ok := value.(time.Time)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||||
|
}
|
||||||
|
m.SetCreateTime(v)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Storage field %s", name)
|
return fmt.Errorf("unknown Storage field %s", name)
|
||||||
}
|
}
|
||||||
@@ -8295,6 +8727,9 @@ func (m *StorageMutation) ClearedFields() []string {
|
|||||||
if m.FieldCleared(storage.FieldSettings) {
|
if m.FieldCleared(storage.FieldSettings) {
|
||||||
fields = append(fields, storage.FieldSettings)
|
fields = append(fields, storage.FieldSettings)
|
||||||
}
|
}
|
||||||
|
if m.FieldCleared(storage.FieldCreateTime) {
|
||||||
|
fields = append(fields, storage.FieldCreateTime)
|
||||||
|
}
|
||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8318,6 +8753,9 @@ func (m *StorageMutation) ClearField(name string) error {
|
|||||||
case storage.FieldSettings:
|
case storage.FieldSettings:
|
||||||
m.ClearSettings()
|
m.ClearSettings()
|
||||||
return nil
|
return nil
|
||||||
|
case storage.FieldCreateTime:
|
||||||
|
m.ClearCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Storage nullable field %s", name)
|
return fmt.Errorf("unknown Storage nullable field %s", name)
|
||||||
}
|
}
|
||||||
@@ -8347,6 +8785,9 @@ func (m *StorageMutation) ResetField(name string) error {
|
|||||||
case storage.FieldDefault:
|
case storage.FieldDefault:
|
||||||
m.ResetDefault()
|
m.ResetDefault()
|
||||||
return nil
|
return nil
|
||||||
|
case storage.FieldCreateTime:
|
||||||
|
m.ResetCreateTime()
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("unknown Storage field %s", name)
|
return fmt.Errorf("unknown Storage field %s", name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,18 +57,30 @@ func init() {
|
|||||||
downloadclientsDescTags := downloadclientsFields[10].Descriptor()
|
downloadclientsDescTags := downloadclientsFields[10].Descriptor()
|
||||||
// downloadclients.DefaultTags holds the default value on creation for the tags field.
|
// downloadclients.DefaultTags holds the default value on creation for the tags field.
|
||||||
downloadclients.DefaultTags = downloadclientsDescTags.Default.(string)
|
downloadclients.DefaultTags = downloadclientsDescTags.Default.(string)
|
||||||
|
// downloadclientsDescCreateTime is the schema descriptor for create_time field.
|
||||||
|
downloadclientsDescCreateTime := downloadclientsFields[11].Descriptor()
|
||||||
|
// downloadclients.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||||
|
downloadclients.DefaultCreateTime = downloadclientsDescCreateTime.Default.(func() time.Time)
|
||||||
episodeFields := schema.Episode{}.Fields()
|
episodeFields := schema.Episode{}.Fields()
|
||||||
_ = episodeFields
|
_ = episodeFields
|
||||||
// episodeDescMonitored is the schema descriptor for monitored field.
|
// episodeDescMonitored is the schema descriptor for monitored field.
|
||||||
episodeDescMonitored := episodeFields[7].Descriptor()
|
episodeDescMonitored := episodeFields[7].Descriptor()
|
||||||
// episode.DefaultMonitored holds the default value on creation for the monitored field.
|
// episode.DefaultMonitored holds the default value on creation for the monitored field.
|
||||||
episode.DefaultMonitored = episodeDescMonitored.Default.(bool)
|
episode.DefaultMonitored = episodeDescMonitored.Default.(bool)
|
||||||
|
// episodeDescCreateTime is the schema descriptor for create_time field.
|
||||||
|
episodeDescCreateTime := episodeFields[9].Descriptor()
|
||||||
|
// episode.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||||
|
episode.DefaultCreateTime = episodeDescCreateTime.Default.(func() time.Time)
|
||||||
historyFields := schema.History{}.Fields()
|
historyFields := schema.History{}.Fields()
|
||||||
_ = historyFields
|
_ = historyFields
|
||||||
// historyDescSize is the schema descriptor for size field.
|
// historyDescSize is the schema descriptor for size field.
|
||||||
historyDescSize := historyFields[6].Descriptor()
|
historyDescSize := historyFields[6].Descriptor()
|
||||||
// history.DefaultSize holds the default value on creation for the size field.
|
// history.DefaultSize holds the default value on creation for the size field.
|
||||||
history.DefaultSize = historyDescSize.Default.(int)
|
history.DefaultSize = historyDescSize.Default.(int)
|
||||||
|
// historyDescCreateTime is the schema descriptor for create_time field.
|
||||||
|
historyDescCreateTime := historyFields[12].Descriptor()
|
||||||
|
// history.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||||
|
history.DefaultCreateTime = historyDescCreateTime.Default.(func() time.Time)
|
||||||
indexersFields := schema.Indexers{}.Fields()
|
indexersFields := schema.Indexers{}.Fields()
|
||||||
_ = indexersFields
|
_ = indexersFields
|
||||||
// indexersDescSettings is the schema descriptor for settings field.
|
// indexersDescSettings is the schema descriptor for settings field.
|
||||||
@@ -103,6 +115,10 @@ func init() {
|
|||||||
indexersDescSynced := indexersFields[11].Descriptor()
|
indexersDescSynced := indexersFields[11].Descriptor()
|
||||||
// indexers.DefaultSynced holds the default value on creation for the synced field.
|
// indexers.DefaultSynced holds the default value on creation for the synced field.
|
||||||
indexers.DefaultSynced = indexersDescSynced.Default.(bool)
|
indexers.DefaultSynced = indexersDescSynced.Default.(bool)
|
||||||
|
// indexersDescCreateTime is the schema descriptor for create_time field.
|
||||||
|
indexersDescCreateTime := indexersFields[12].Descriptor()
|
||||||
|
// indexers.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||||
|
indexers.DefaultCreateTime = indexersDescCreateTime.Default.(func() time.Time)
|
||||||
mediaFields := schema.Media{}.Fields()
|
mediaFields := schema.Media{}.Fields()
|
||||||
_ = mediaFields
|
_ = mediaFields
|
||||||
// mediaDescCreatedAt is the schema descriptor for created_at field.
|
// mediaDescCreatedAt is the schema descriptor for created_at field.
|
||||||
@@ -117,6 +133,10 @@ func init() {
|
|||||||
mediaDescDownloadHistoryEpisodes := mediaFields[12].Descriptor()
|
mediaDescDownloadHistoryEpisodes := mediaFields[12].Descriptor()
|
||||||
// media.DefaultDownloadHistoryEpisodes holds the default value on creation for the download_history_episodes field.
|
// media.DefaultDownloadHistoryEpisodes holds the default value on creation for the download_history_episodes field.
|
||||||
media.DefaultDownloadHistoryEpisodes = mediaDescDownloadHistoryEpisodes.Default.(bool)
|
media.DefaultDownloadHistoryEpisodes = mediaDescDownloadHistoryEpisodes.Default.(bool)
|
||||||
|
// mediaDescCreateTime is the schema descriptor for create_time field.
|
||||||
|
mediaDescCreateTime := mediaFields[16].Descriptor()
|
||||||
|
// media.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||||
|
media.DefaultCreateTime = mediaDescCreateTime.Default.(func() time.Time)
|
||||||
notificationclientFields := schema.NotificationClient{}.Fields()
|
notificationclientFields := schema.NotificationClient{}.Fields()
|
||||||
_ = notificationclientFields
|
_ = notificationclientFields
|
||||||
// notificationclientDescEnabled is the schema descriptor for enabled field.
|
// notificationclientDescEnabled is the schema descriptor for enabled field.
|
||||||
@@ -133,4 +153,8 @@ func init() {
|
|||||||
storageDescDefault := storageFields[6].Descriptor()
|
storageDescDefault := storageFields[6].Descriptor()
|
||||||
// storage.DefaultDefault holds the default value on creation for the default field.
|
// storage.DefaultDefault holds the default value on creation for the default field.
|
||||||
storage.DefaultDefault = storageDescDefault.Default.(bool)
|
storage.DefaultDefault = storageDescDefault.Default.(bool)
|
||||||
|
// storageDescCreateTime is the schema descriptor for create_time field.
|
||||||
|
storageDescCreateTime := storageFields[7].Descriptor()
|
||||||
|
// storage.DefaultCreateTime holds the default value on creation for the create_time field.
|
||||||
|
storage.DefaultCreateTime = storageDescCreateTime.Default.(func() time.Time)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package schema
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
@@ -34,6 +35,7 @@ func (DownloadClients) Fields() []ent.Field {
|
|||||||
field.Bool("remove_completed_downloads").Default(true),
|
field.Bool("remove_completed_downloads").Default(true),
|
||||||
field.Bool("remove_failed_downloads").Default(true),
|
field.Bool("remove_failed_downloads").Default(true),
|
||||||
field.String("tags").Default(""),
|
field.String("tags").Default(""),
|
||||||
|
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
@@ -23,6 +25,7 @@ func (Episode) Fields() []ent.Field {
|
|||||||
field.Enum("status").Values("missing", "downloading", "downloaded").Default("missing"),
|
field.Enum("status").Values("missing", "downloading", "downloaded").Default("missing"),
|
||||||
field.Bool("monitored").Default(false).StructTag("json:\"monitored\""), //whether this episode is monitored
|
field.Bool("monitored").Default(false).StructTag("json:\"monitored\""), //whether this episode is monitored
|
||||||
field.String("target_file").Optional(),
|
field.String("target_file").Optional(),
|
||||||
|
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
)
|
)
|
||||||
@@ -26,6 +28,7 @@ func (History) Fields() []ent.Field {
|
|||||||
field.String("link").Optional().Comment("deprecated, use hash instead"), //should be magnet link
|
field.String("link").Optional().Comment("deprecated, use hash instead"), //should be magnet link
|
||||||
field.String("hash").Optional().Comment("torrent hash"),
|
field.String("hash").Optional().Comment("torrent hash"),
|
||||||
field.Enum("status").Values("running", "success", "fail", "uploading", "seeding", "removed"),
|
field.Enum("status").Values("running", "success", "fail", "uploading", "seeding", "removed"),
|
||||||
|
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||||
//field.String("saved").Optional().Comment("deprecated"), //deprecated
|
//field.String("saved").Optional().Comment("deprecated"), //deprecated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
)
|
)
|
||||||
@@ -25,6 +27,7 @@ func (Indexers) Fields() []ent.Field {
|
|||||||
field.String("api_key").Optional(),
|
field.String("api_key").Optional(),
|
||||||
field.String("url").Optional(),
|
field.String("url").Optional(),
|
||||||
field.Bool("synced").Optional().Default(false).Comment("synced from prowlarr"),
|
field.Bool("synced").Optional().Default(false).Comment("synced from prowlarr"),
|
||||||
|
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ func (Media) Fields() []ent.Field {
|
|||||||
field.JSON("limiter", MediaLimiter{}).Optional(),
|
field.JSON("limiter", MediaLimiter{}).Optional(),
|
||||||
field.JSON("extras", MediaExtras{}).Optional(),
|
field.JSON("extras", MediaExtras{}).Optional(),
|
||||||
field.JSON("alternative_titles", []AlternativeTilte{}).Optional(),
|
field.JSON("alternative_titles", []AlternativeTilte{}).Optional(),
|
||||||
|
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package schema
|
package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
)
|
)
|
||||||
@@ -20,6 +22,7 @@ func (Storage) Fields() []ent.Field {
|
|||||||
field.String("settings").Optional(),
|
field.String("settings").Optional(),
|
||||||
field.Bool("deleted").Default(false),
|
field.Bool("deleted").Default(false),
|
||||||
field.Bool("default").Default(false),
|
field.Bool("default").Default(false),
|
||||||
|
field.Time("create_time").Optional().Default(time.Now).Immutable(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"polaris/ent/storage"
|
"polaris/ent/storage"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
@@ -29,7 +30,9 @@ type Storage struct {
|
|||||||
// Deleted holds the value of the "deleted" field.
|
// Deleted holds the value of the "deleted" field.
|
||||||
Deleted bool `json:"deleted,omitempty"`
|
Deleted bool `json:"deleted,omitempty"`
|
||||||
// Default holds the value of the "default" field.
|
// Default holds the value of the "default" field.
|
||||||
Default bool `json:"default,omitempty"`
|
Default bool `json:"default,omitempty"`
|
||||||
|
// CreateTime holds the value of the "create_time" field.
|
||||||
|
CreateTime time.Time `json:"create_time,omitempty"`
|
||||||
selectValues sql.SelectValues
|
selectValues sql.SelectValues
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +47,8 @@ func (*Storage) scanValues(columns []string) ([]any, error) {
|
|||||||
values[i] = new(sql.NullInt64)
|
values[i] = new(sql.NullInt64)
|
||||||
case storage.FieldName, storage.FieldImplementation, storage.FieldTvPath, storage.FieldMoviePath, storage.FieldSettings:
|
case storage.FieldName, storage.FieldImplementation, storage.FieldTvPath, storage.FieldMoviePath, storage.FieldSettings:
|
||||||
values[i] = new(sql.NullString)
|
values[i] = new(sql.NullString)
|
||||||
|
case storage.FieldCreateTime:
|
||||||
|
values[i] = new(sql.NullTime)
|
||||||
default:
|
default:
|
||||||
values[i] = new(sql.UnknownType)
|
values[i] = new(sql.UnknownType)
|
||||||
}
|
}
|
||||||
@@ -107,6 +112,12 @@ func (s *Storage) assignValues(columns []string, values []any) error {
|
|||||||
} else if value.Valid {
|
} else if value.Valid {
|
||||||
s.Default = value.Bool
|
s.Default = value.Bool
|
||||||
}
|
}
|
||||||
|
case storage.FieldCreateTime:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
s.CreateTime = value.Time
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
s.selectValues.Set(columns[i], values[i])
|
s.selectValues.Set(columns[i], values[i])
|
||||||
}
|
}
|
||||||
@@ -163,6 +174,9 @@ func (s *Storage) String() string {
|
|||||||
builder.WriteString(", ")
|
builder.WriteString(", ")
|
||||||
builder.WriteString("default=")
|
builder.WriteString("default=")
|
||||||
builder.WriteString(fmt.Sprintf("%v", s.Default))
|
builder.WriteString(fmt.Sprintf("%v", s.Default))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("create_time=")
|
||||||
|
builder.WriteString(s.CreateTime.Format(time.ANSIC))
|
||||||
builder.WriteByte(')')
|
builder.WriteByte(')')
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
)
|
)
|
||||||
@@ -27,6 +28,8 @@ const (
|
|||||||
FieldDeleted = "deleted"
|
FieldDeleted = "deleted"
|
||||||
// FieldDefault holds the string denoting the default field in the database.
|
// FieldDefault holds the string denoting the default field in the database.
|
||||||
FieldDefault = "default"
|
FieldDefault = "default"
|
||||||
|
// FieldCreateTime holds the string denoting the create_time field in the database.
|
||||||
|
FieldCreateTime = "create_time"
|
||||||
// Table holds the table name of the storage in the database.
|
// Table holds the table name of the storage in the database.
|
||||||
Table = "storages"
|
Table = "storages"
|
||||||
)
|
)
|
||||||
@@ -41,6 +44,7 @@ var Columns = []string{
|
|||||||
FieldSettings,
|
FieldSettings,
|
||||||
FieldDeleted,
|
FieldDeleted,
|
||||||
FieldDefault,
|
FieldDefault,
|
||||||
|
FieldCreateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
@@ -58,6 +62,8 @@ var (
|
|||||||
DefaultDeleted bool
|
DefaultDeleted bool
|
||||||
// DefaultDefault holds the default value on creation for the "default" field.
|
// DefaultDefault holds the default value on creation for the "default" field.
|
||||||
DefaultDefault bool
|
DefaultDefault bool
|
||||||
|
// DefaultCreateTime holds the default value on creation for the "create_time" field.
|
||||||
|
DefaultCreateTime func() time.Time
|
||||||
)
|
)
|
||||||
|
|
||||||
// Implementation defines the type for the "implementation" enum field.
|
// Implementation defines the type for the "implementation" enum field.
|
||||||
@@ -126,3 +132,8 @@ func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
|||||||
func ByDefault(opts ...sql.OrderTermOption) OrderOption {
|
func ByDefault(opts ...sql.OrderTermOption) OrderOption {
|
||||||
return sql.OrderByField(FieldDefault, opts...).ToFunc()
|
return sql.OrderByField(FieldDefault, opts...).ToFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ByCreateTime orders the results by the create_time field.
|
||||||
|
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"polaris/ent/predicate"
|
"polaris/ent/predicate"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
)
|
)
|
||||||
@@ -83,6 +84,11 @@ func Default(v bool) predicate.Storage {
|
|||||||
return predicate.Storage(sql.FieldEQ(FieldDefault, v))
|
return predicate.Storage(sql.FieldEQ(FieldDefault, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
|
||||||
|
func CreateTime(v time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
// NameEQ applies the EQ predicate on the "name" field.
|
// NameEQ applies the EQ predicate on the "name" field.
|
||||||
func NameEQ(v string) predicate.Storage {
|
func NameEQ(v string) predicate.Storage {
|
||||||
return predicate.Storage(sql.FieldEQ(FieldName, v))
|
return predicate.Storage(sql.FieldEQ(FieldName, v))
|
||||||
@@ -413,6 +419,56 @@ func DefaultNEQ(v bool) predicate.Storage {
|
|||||||
return predicate.Storage(sql.FieldNEQ(FieldDefault, v))
|
return predicate.Storage(sql.FieldNEQ(FieldDefault, v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeEQ(v time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||||
|
func CreateTimeNEQ(v time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldNEQ(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||||
|
func CreateTimeIn(vs ...time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotIn(vs ...time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldNotIn(FieldCreateTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||||
|
func CreateTimeGT(v time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldGT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeGTE(v time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldGTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||||
|
func CreateTimeLT(v time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldLT(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||||
|
func CreateTimeLTE(v time.Time) predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldLTE(FieldCreateTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeIsNil() predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldIsNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||||
|
func CreateTimeNotNil() predicate.Storage {
|
||||||
|
return predicate.Storage(sql.FieldNotNull(FieldCreateTime))
|
||||||
|
}
|
||||||
|
|
||||||
// And groups predicates with the AND operator between them.
|
// And groups predicates with the AND operator between them.
|
||||||
func And(predicates ...predicate.Storage) predicate.Storage {
|
func And(predicates ...predicate.Storage) predicate.Storage {
|
||||||
return predicate.Storage(sql.AndPredicates(predicates...))
|
return predicate.Storage(sql.AndPredicates(predicates...))
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"polaris/ent/storage"
|
"polaris/ent/storage"
|
||||||
|
"time"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
@@ -101,6 +102,20 @@ func (sc *StorageCreate) SetNillableDefault(b *bool) *StorageCreate {
|
|||||||
return sc
|
return sc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetCreateTime sets the "create_time" field.
|
||||||
|
func (sc *StorageCreate) SetCreateTime(t time.Time) *StorageCreate {
|
||||||
|
sc.mutation.SetCreateTime(t)
|
||||||
|
return sc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreateTime sets the "create_time" field if the given value is not nil.
|
||||||
|
func (sc *StorageCreate) SetNillableCreateTime(t *time.Time) *StorageCreate {
|
||||||
|
if t != nil {
|
||||||
|
sc.SetCreateTime(*t)
|
||||||
|
}
|
||||||
|
return sc
|
||||||
|
}
|
||||||
|
|
||||||
// Mutation returns the StorageMutation object of the builder.
|
// Mutation returns the StorageMutation object of the builder.
|
||||||
func (sc *StorageCreate) Mutation() *StorageMutation {
|
func (sc *StorageCreate) Mutation() *StorageMutation {
|
||||||
return sc.mutation
|
return sc.mutation
|
||||||
@@ -144,6 +159,10 @@ func (sc *StorageCreate) defaults() {
|
|||||||
v := storage.DefaultDefault
|
v := storage.DefaultDefault
|
||||||
sc.mutation.SetDefault(v)
|
sc.mutation.SetDefault(v)
|
||||||
}
|
}
|
||||||
|
if _, ok := sc.mutation.CreateTime(); !ok {
|
||||||
|
v := storage.DefaultCreateTime()
|
||||||
|
sc.mutation.SetCreateTime(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check runs all checks and user-defined validators on the builder.
|
// check runs all checks and user-defined validators on the builder.
|
||||||
@@ -219,6 +238,10 @@ func (sc *StorageCreate) createSpec() (*Storage, *sqlgraph.CreateSpec) {
|
|||||||
_spec.SetField(storage.FieldDefault, field.TypeBool, value)
|
_spec.SetField(storage.FieldDefault, field.TypeBool, value)
|
||||||
_node.Default = value
|
_node.Default = value
|
||||||
}
|
}
|
||||||
|
if value, ok := sc.mutation.CreateTime(); ok {
|
||||||
|
_spec.SetField(storage.FieldCreateTime, field.TypeTime, value)
|
||||||
|
_node.CreateTime = value
|
||||||
|
}
|
||||||
return _node, _spec
|
return _node, _spec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ func (su *StorageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||||||
if value, ok := su.mutation.Default(); ok {
|
if value, ok := su.mutation.Default(); ok {
|
||||||
_spec.SetField(storage.FieldDefault, field.TypeBool, value)
|
_spec.SetField(storage.FieldDefault, field.TypeBool, value)
|
||||||
}
|
}
|
||||||
|
if su.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(storage.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil {
|
if n, err = sqlgraph.UpdateNodes(ctx, su.driver, _spec); err != nil {
|
||||||
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
err = &NotFoundError{storage.Label}
|
err = &NotFoundError{storage.Label}
|
||||||
@@ -477,6 +480,9 @@ func (suo *StorageUpdateOne) sqlSave(ctx context.Context) (_node *Storage, err e
|
|||||||
if value, ok := suo.mutation.Default(); ok {
|
if value, ok := suo.mutation.Default(); ok {
|
||||||
_spec.SetField(storage.FieldDefault, field.TypeBool, value)
|
_spec.SetField(storage.FieldDefault, field.TypeBool, value)
|
||||||
}
|
}
|
||||||
|
if suo.mutation.CreateTimeCleared() {
|
||||||
|
_spec.ClearField(storage.FieldCreateTime, field.TypeTime)
|
||||||
|
}
|
||||||
_node = &Storage{config: suo.config}
|
_node = &Storage{config: suo.config}
|
||||||
_spec.Assign = _node.assignValues
|
_spec.Assign = _node.assignValues
|
||||||
_spec.ScanValues = _node.scanValues
|
_spec.ScanValues = _node.scanValues
|
||||||
|
|||||||
10
go.mod
10
go.mod
@@ -10,7 +10,7 @@ require (
|
|||||||
github.com/mattn/go-sqlite3 v1.14.22 // indirect
|
github.com/mattn/go-sqlite3 v1.14.22 // indirect
|
||||||
github.com/robfig/cron v1.2.0
|
github.com/robfig/cron v1.2.0
|
||||||
go.uber.org/zap v1.27.0
|
go.uber.org/zap v1.27.0
|
||||||
golang.org/x/net v0.38.0
|
golang.org/x/net v0.39.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -110,7 +110,7 @@ require (
|
|||||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
go.opentelemetry.io/otel v1.28.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||||
golang.org/x/sync v0.12.0 // indirect
|
golang.org/x/sync v0.13.0 // indirect
|
||||||
golang.org/x/time v0.5.0 // indirect
|
golang.org/x/time v0.5.0 // indirect
|
||||||
google.golang.org/appengine v1.6.8 // indirect
|
google.golang.org/appengine v1.6.8 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
@@ -165,11 +165,11 @@ require (
|
|||||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
github.com/zclconf/go-cty v1.8.0 // indirect
|
github.com/zclconf/go-cty v1.8.0 // indirect
|
||||||
golang.org/x/arch v0.8.0 // indirect
|
golang.org/x/arch v0.8.0 // indirect
|
||||||
golang.org/x/crypto v0.36.0
|
golang.org/x/crypto v0.37.0
|
||||||
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948
|
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948
|
||||||
golang.org/x/mod v0.24.0 // indirect
|
golang.org/x/mod v0.24.0 // indirect
|
||||||
golang.org/x/sys v0.31.0
|
golang.org/x/sys v0.32.0
|
||||||
golang.org/x/text v0.23.0 // indirect
|
golang.org/x/text v0.24.0 // indirect
|
||||||
google.golang.org/protobuf v1.36.5 // indirect
|
google.golang.org/protobuf v1.36.5 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
|
|||||||
20
go.sum
20
go.sum
@@ -530,8 +530,8 @@ golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf
|
|||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
|
||||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20220428152302-39d4317da171/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
|
golang.org/x/exp v0.0.0-20220428152302-39d4317da171/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
|
||||||
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=
|
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA=
|
||||||
@@ -572,8 +572,8 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
|||||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
|
||||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@@ -589,8 +589,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
|||||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
|
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
|
||||||
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
@@ -618,8 +618,8 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
@@ -643,8 +643,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
|||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
|
||||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
|
||||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
|||||||
Reference in New Issue
Block a user