mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 15:10:49 +08:00
refactor code
This commit is contained in:
@@ -142,6 +142,8 @@ var (
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "name", Type: field.TypeString, Unique: true},
|
||||
{Name: "implementation", Type: field.TypeEnum, Enums: []string{"webdav", "local"}},
|
||||
{Name: "tv_path", Type: field.TypeString, Nullable: true},
|
||||
{Name: "movie_path", Type: field.TypeString, Nullable: true},
|
||||
{Name: "settings", Type: field.TypeString, Nullable: true},
|
||||
{Name: "deleted", Type: field.TypeBool, Default: false},
|
||||
{Name: "default", Type: field.TypeBool, Default: false},
|
||||
|
||||
148
ent/mutation.go
148
ent/mutation.go
@@ -5327,6 +5327,8 @@ type StorageMutation struct {
|
||||
id *int
|
||||
name *string
|
||||
implementation *storage.Implementation
|
||||
tv_path *string
|
||||
movie_path *string
|
||||
settings *string
|
||||
deleted *bool
|
||||
_default *bool
|
||||
@@ -5506,6 +5508,104 @@ func (m *StorageMutation) ResetImplementation() {
|
||||
m.implementation = nil
|
||||
}
|
||||
|
||||
// SetTvPath sets the "tv_path" field.
|
||||
func (m *StorageMutation) SetTvPath(s string) {
|
||||
m.tv_path = &s
|
||||
}
|
||||
|
||||
// TvPath returns the value of the "tv_path" field in the mutation.
|
||||
func (m *StorageMutation) TvPath() (r string, exists bool) {
|
||||
v := m.tv_path
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldTvPath returns the old "tv_path" 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) OldTvPath(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldTvPath is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldTvPath requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldTvPath: %w", err)
|
||||
}
|
||||
return oldValue.TvPath, nil
|
||||
}
|
||||
|
||||
// ClearTvPath clears the value of the "tv_path" field.
|
||||
func (m *StorageMutation) ClearTvPath() {
|
||||
m.tv_path = nil
|
||||
m.clearedFields[storage.FieldTvPath] = struct{}{}
|
||||
}
|
||||
|
||||
// TvPathCleared returns if the "tv_path" field was cleared in this mutation.
|
||||
func (m *StorageMutation) TvPathCleared() bool {
|
||||
_, ok := m.clearedFields[storage.FieldTvPath]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetTvPath resets all changes to the "tv_path" field.
|
||||
func (m *StorageMutation) ResetTvPath() {
|
||||
m.tv_path = nil
|
||||
delete(m.clearedFields, storage.FieldTvPath)
|
||||
}
|
||||
|
||||
// SetMoviePath sets the "movie_path" field.
|
||||
func (m *StorageMutation) SetMoviePath(s string) {
|
||||
m.movie_path = &s
|
||||
}
|
||||
|
||||
// MoviePath returns the value of the "movie_path" field in the mutation.
|
||||
func (m *StorageMutation) MoviePath() (r string, exists bool) {
|
||||
v := m.movie_path
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldMoviePath returns the old "movie_path" 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) OldMoviePath(ctx context.Context) (v string, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldMoviePath is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldMoviePath requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldMoviePath: %w", err)
|
||||
}
|
||||
return oldValue.MoviePath, nil
|
||||
}
|
||||
|
||||
// ClearMoviePath clears the value of the "movie_path" field.
|
||||
func (m *StorageMutation) ClearMoviePath() {
|
||||
m.movie_path = nil
|
||||
m.clearedFields[storage.FieldMoviePath] = struct{}{}
|
||||
}
|
||||
|
||||
// MoviePathCleared returns if the "movie_path" field was cleared in this mutation.
|
||||
func (m *StorageMutation) MoviePathCleared() bool {
|
||||
_, ok := m.clearedFields[storage.FieldMoviePath]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetMoviePath resets all changes to the "movie_path" field.
|
||||
func (m *StorageMutation) ResetMoviePath() {
|
||||
m.movie_path = nil
|
||||
delete(m.clearedFields, storage.FieldMoviePath)
|
||||
}
|
||||
|
||||
// SetSettings sets the "settings" field.
|
||||
func (m *StorageMutation) SetSettings(s string) {
|
||||
m.settings = &s
|
||||
@@ -5661,13 +5761,19 @@ func (m *StorageMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *StorageMutation) Fields() []string {
|
||||
fields := make([]string, 0, 5)
|
||||
fields := make([]string, 0, 7)
|
||||
if m.name != nil {
|
||||
fields = append(fields, storage.FieldName)
|
||||
}
|
||||
if m.implementation != nil {
|
||||
fields = append(fields, storage.FieldImplementation)
|
||||
}
|
||||
if m.tv_path != nil {
|
||||
fields = append(fields, storage.FieldTvPath)
|
||||
}
|
||||
if m.movie_path != nil {
|
||||
fields = append(fields, storage.FieldMoviePath)
|
||||
}
|
||||
if m.settings != nil {
|
||||
fields = append(fields, storage.FieldSettings)
|
||||
}
|
||||
@@ -5689,6 +5795,10 @@ func (m *StorageMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.Name()
|
||||
case storage.FieldImplementation:
|
||||
return m.Implementation()
|
||||
case storage.FieldTvPath:
|
||||
return m.TvPath()
|
||||
case storage.FieldMoviePath:
|
||||
return m.MoviePath()
|
||||
case storage.FieldSettings:
|
||||
return m.Settings()
|
||||
case storage.FieldDeleted:
|
||||
@@ -5708,6 +5818,10 @@ func (m *StorageMutation) OldField(ctx context.Context, name string) (ent.Value,
|
||||
return m.OldName(ctx)
|
||||
case storage.FieldImplementation:
|
||||
return m.OldImplementation(ctx)
|
||||
case storage.FieldTvPath:
|
||||
return m.OldTvPath(ctx)
|
||||
case storage.FieldMoviePath:
|
||||
return m.OldMoviePath(ctx)
|
||||
case storage.FieldSettings:
|
||||
return m.OldSettings(ctx)
|
||||
case storage.FieldDeleted:
|
||||
@@ -5737,6 +5851,20 @@ func (m *StorageMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetImplementation(v)
|
||||
return nil
|
||||
case storage.FieldTvPath:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetTvPath(v)
|
||||
return nil
|
||||
case storage.FieldMoviePath:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetMoviePath(v)
|
||||
return nil
|
||||
case storage.FieldSettings:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
@@ -5788,6 +5916,12 @@ func (m *StorageMutation) AddField(name string, value ent.Value) error {
|
||||
// mutation.
|
||||
func (m *StorageMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(storage.FieldTvPath) {
|
||||
fields = append(fields, storage.FieldTvPath)
|
||||
}
|
||||
if m.FieldCleared(storage.FieldMoviePath) {
|
||||
fields = append(fields, storage.FieldMoviePath)
|
||||
}
|
||||
if m.FieldCleared(storage.FieldSettings) {
|
||||
fields = append(fields, storage.FieldSettings)
|
||||
}
|
||||
@@ -5805,6 +5939,12 @@ func (m *StorageMutation) FieldCleared(name string) bool {
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *StorageMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case storage.FieldTvPath:
|
||||
m.ClearTvPath()
|
||||
return nil
|
||||
case storage.FieldMoviePath:
|
||||
m.ClearMoviePath()
|
||||
return nil
|
||||
case storage.FieldSettings:
|
||||
m.ClearSettings()
|
||||
return nil
|
||||
@@ -5822,6 +5962,12 @@ func (m *StorageMutation) ResetField(name string) error {
|
||||
case storage.FieldImplementation:
|
||||
m.ResetImplementation()
|
||||
return nil
|
||||
case storage.FieldTvPath:
|
||||
m.ResetTvPath()
|
||||
return nil
|
||||
case storage.FieldMoviePath:
|
||||
m.ResetMoviePath()
|
||||
return nil
|
||||
case storage.FieldSettings:
|
||||
m.ResetSettings()
|
||||
return nil
|
||||
|
||||
@@ -84,11 +84,11 @@ func init() {
|
||||
storageFields := schema.Storage{}.Fields()
|
||||
_ = storageFields
|
||||
// storageDescDeleted is the schema descriptor for deleted field.
|
||||
storageDescDeleted := storageFields[3].Descriptor()
|
||||
storageDescDeleted := storageFields[5].Descriptor()
|
||||
// storage.DefaultDeleted holds the default value on creation for the deleted field.
|
||||
storage.DefaultDeleted = storageDescDeleted.Default.(bool)
|
||||
// storageDescDefault is the schema descriptor for default field.
|
||||
storageDescDefault := storageFields[4].Descriptor()
|
||||
storageDescDefault := storageFields[6].Descriptor()
|
||||
// storage.DefaultDefault holds the default value on creation for the default field.
|
||||
storage.DefaultDefault = storageDescDefault.Default.(bool)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ func (Storage) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("name").Unique(),
|
||||
field.Enum("implementation").Values("webdav", "local"),
|
||||
field.String("tv_path").Optional(),
|
||||
field.String("movie_path").Optional(),
|
||||
field.String("settings").Optional(),
|
||||
field.Bool("deleted").Default(false),
|
||||
field.Bool("default").Default(false),
|
||||
|
||||
@@ -20,6 +20,10 @@ type Storage struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
// Implementation holds the value of the "implementation" field.
|
||||
Implementation storage.Implementation `json:"implementation,omitempty"`
|
||||
// TvPath holds the value of the "tv_path" field.
|
||||
TvPath string `json:"tv_path,omitempty"`
|
||||
// MoviePath holds the value of the "movie_path" field.
|
||||
MoviePath string `json:"movie_path,omitempty"`
|
||||
// Settings holds the value of the "settings" field.
|
||||
Settings string `json:"settings,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
@@ -38,7 +42,7 @@ func (*Storage) scanValues(columns []string) ([]any, error) {
|
||||
values[i] = new(sql.NullBool)
|
||||
case storage.FieldID:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case storage.FieldName, storage.FieldImplementation, storage.FieldSettings:
|
||||
case storage.FieldName, storage.FieldImplementation, storage.FieldTvPath, storage.FieldMoviePath, storage.FieldSettings:
|
||||
values[i] = new(sql.NullString)
|
||||
default:
|
||||
values[i] = new(sql.UnknownType)
|
||||
@@ -73,6 +77,18 @@ func (s *Storage) assignValues(columns []string, values []any) error {
|
||||
} else if value.Valid {
|
||||
s.Implementation = storage.Implementation(value.String)
|
||||
}
|
||||
case storage.FieldTvPath:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field tv_path", values[i])
|
||||
} else if value.Valid {
|
||||
s.TvPath = value.String
|
||||
}
|
||||
case storage.FieldMoviePath:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field movie_path", values[i])
|
||||
} else if value.Valid {
|
||||
s.MoviePath = value.String
|
||||
}
|
||||
case storage.FieldSettings:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field settings", values[i])
|
||||
@@ -133,6 +149,12 @@ func (s *Storage) String() string {
|
||||
builder.WriteString("implementation=")
|
||||
builder.WriteString(fmt.Sprintf("%v", s.Implementation))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("tv_path=")
|
||||
builder.WriteString(s.TvPath)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("movie_path=")
|
||||
builder.WriteString(s.MoviePath)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("settings=")
|
||||
builder.WriteString(s.Settings)
|
||||
builder.WriteString(", ")
|
||||
|
||||
@@ -17,6 +17,10 @@ const (
|
||||
FieldName = "name"
|
||||
// FieldImplementation holds the string denoting the implementation field in the database.
|
||||
FieldImplementation = "implementation"
|
||||
// FieldTvPath holds the string denoting the tv_path field in the database.
|
||||
FieldTvPath = "tv_path"
|
||||
// FieldMoviePath holds the string denoting the movie_path field in the database.
|
||||
FieldMoviePath = "movie_path"
|
||||
// FieldSettings holds the string denoting the settings field in the database.
|
||||
FieldSettings = "settings"
|
||||
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||
@@ -32,6 +36,8 @@ var Columns = []string{
|
||||
FieldID,
|
||||
FieldName,
|
||||
FieldImplementation,
|
||||
FieldTvPath,
|
||||
FieldMoviePath,
|
||||
FieldSettings,
|
||||
FieldDeleted,
|
||||
FieldDefault,
|
||||
@@ -95,6 +101,16 @@ func ByImplementation(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldImplementation, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByTvPath orders the results by the tv_path field.
|
||||
func ByTvPath(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldTvPath, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMoviePath orders the results by the movie_path field.
|
||||
func ByMoviePath(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMoviePath, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// BySettings orders the results by the settings field.
|
||||
func BySettings(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldSettings, opts...).ToFunc()
|
||||
|
||||
@@ -58,6 +58,16 @@ func Name(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// TvPath applies equality check predicate on the "tv_path" field. It's identical to TvPathEQ.
|
||||
func TvPath(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEQ(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// MoviePath applies equality check predicate on the "movie_path" field. It's identical to MoviePathEQ.
|
||||
func MoviePath(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEQ(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// Settings applies equality check predicate on the "settings" field. It's identical to SettingsEQ.
|
||||
func Settings(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEQ(FieldSettings, v))
|
||||
@@ -158,6 +168,156 @@ func ImplementationNotIn(vs ...Implementation) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldNotIn(FieldImplementation, vs...))
|
||||
}
|
||||
|
||||
// TvPathEQ applies the EQ predicate on the "tv_path" field.
|
||||
func TvPathEQ(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEQ(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathNEQ applies the NEQ predicate on the "tv_path" field.
|
||||
func TvPathNEQ(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldNEQ(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathIn applies the In predicate on the "tv_path" field.
|
||||
func TvPathIn(vs ...string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldIn(FieldTvPath, vs...))
|
||||
}
|
||||
|
||||
// TvPathNotIn applies the NotIn predicate on the "tv_path" field.
|
||||
func TvPathNotIn(vs ...string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldNotIn(FieldTvPath, vs...))
|
||||
}
|
||||
|
||||
// TvPathGT applies the GT predicate on the "tv_path" field.
|
||||
func TvPathGT(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldGT(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathGTE applies the GTE predicate on the "tv_path" field.
|
||||
func TvPathGTE(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldGTE(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathLT applies the LT predicate on the "tv_path" field.
|
||||
func TvPathLT(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldLT(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathLTE applies the LTE predicate on the "tv_path" field.
|
||||
func TvPathLTE(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldLTE(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathContains applies the Contains predicate on the "tv_path" field.
|
||||
func TvPathContains(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldContains(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathHasPrefix applies the HasPrefix predicate on the "tv_path" field.
|
||||
func TvPathHasPrefix(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldHasPrefix(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathHasSuffix applies the HasSuffix predicate on the "tv_path" field.
|
||||
func TvPathHasSuffix(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldHasSuffix(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathIsNil applies the IsNil predicate on the "tv_path" field.
|
||||
func TvPathIsNil() predicate.Storage {
|
||||
return predicate.Storage(sql.FieldIsNull(FieldTvPath))
|
||||
}
|
||||
|
||||
// TvPathNotNil applies the NotNil predicate on the "tv_path" field.
|
||||
func TvPathNotNil() predicate.Storage {
|
||||
return predicate.Storage(sql.FieldNotNull(FieldTvPath))
|
||||
}
|
||||
|
||||
// TvPathEqualFold applies the EqualFold predicate on the "tv_path" field.
|
||||
func TvPathEqualFold(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEqualFold(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// TvPathContainsFold applies the ContainsFold predicate on the "tv_path" field.
|
||||
func TvPathContainsFold(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldContainsFold(FieldTvPath, v))
|
||||
}
|
||||
|
||||
// MoviePathEQ applies the EQ predicate on the "movie_path" field.
|
||||
func MoviePathEQ(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEQ(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathNEQ applies the NEQ predicate on the "movie_path" field.
|
||||
func MoviePathNEQ(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldNEQ(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathIn applies the In predicate on the "movie_path" field.
|
||||
func MoviePathIn(vs ...string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldIn(FieldMoviePath, vs...))
|
||||
}
|
||||
|
||||
// MoviePathNotIn applies the NotIn predicate on the "movie_path" field.
|
||||
func MoviePathNotIn(vs ...string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldNotIn(FieldMoviePath, vs...))
|
||||
}
|
||||
|
||||
// MoviePathGT applies the GT predicate on the "movie_path" field.
|
||||
func MoviePathGT(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldGT(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathGTE applies the GTE predicate on the "movie_path" field.
|
||||
func MoviePathGTE(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldGTE(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathLT applies the LT predicate on the "movie_path" field.
|
||||
func MoviePathLT(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldLT(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathLTE applies the LTE predicate on the "movie_path" field.
|
||||
func MoviePathLTE(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldLTE(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathContains applies the Contains predicate on the "movie_path" field.
|
||||
func MoviePathContains(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldContains(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathHasPrefix applies the HasPrefix predicate on the "movie_path" field.
|
||||
func MoviePathHasPrefix(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldHasPrefix(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathHasSuffix applies the HasSuffix predicate on the "movie_path" field.
|
||||
func MoviePathHasSuffix(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldHasSuffix(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathIsNil applies the IsNil predicate on the "movie_path" field.
|
||||
func MoviePathIsNil() predicate.Storage {
|
||||
return predicate.Storage(sql.FieldIsNull(FieldMoviePath))
|
||||
}
|
||||
|
||||
// MoviePathNotNil applies the NotNil predicate on the "movie_path" field.
|
||||
func MoviePathNotNil() predicate.Storage {
|
||||
return predicate.Storage(sql.FieldNotNull(FieldMoviePath))
|
||||
}
|
||||
|
||||
// MoviePathEqualFold applies the EqualFold predicate on the "movie_path" field.
|
||||
func MoviePathEqualFold(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEqualFold(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// MoviePathContainsFold applies the ContainsFold predicate on the "movie_path" field.
|
||||
func MoviePathContainsFold(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldContainsFold(FieldMoviePath, v))
|
||||
}
|
||||
|
||||
// SettingsEQ applies the EQ predicate on the "settings" field.
|
||||
func SettingsEQ(v string) predicate.Storage {
|
||||
return predicate.Storage(sql.FieldEQ(FieldSettings, v))
|
||||
|
||||
@@ -31,6 +31,34 @@ func (sc *StorageCreate) SetImplementation(s storage.Implementation) *StorageCre
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetTvPath sets the "tv_path" field.
|
||||
func (sc *StorageCreate) SetTvPath(s string) *StorageCreate {
|
||||
sc.mutation.SetTvPath(s)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableTvPath sets the "tv_path" field if the given value is not nil.
|
||||
func (sc *StorageCreate) SetNillableTvPath(s *string) *StorageCreate {
|
||||
if s != nil {
|
||||
sc.SetTvPath(*s)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetMoviePath sets the "movie_path" field.
|
||||
func (sc *StorageCreate) SetMoviePath(s string) *StorageCreate {
|
||||
sc.mutation.SetMoviePath(s)
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetNillableMoviePath sets the "movie_path" field if the given value is not nil.
|
||||
func (sc *StorageCreate) SetNillableMoviePath(s *string) *StorageCreate {
|
||||
if s != nil {
|
||||
sc.SetMoviePath(*s)
|
||||
}
|
||||
return sc
|
||||
}
|
||||
|
||||
// SetSettings sets the "settings" field.
|
||||
func (sc *StorageCreate) SetSettings(s string) *StorageCreate {
|
||||
sc.mutation.SetSettings(s)
|
||||
@@ -171,6 +199,14 @@ func (sc *StorageCreate) createSpec() (*Storage, *sqlgraph.CreateSpec) {
|
||||
_spec.SetField(storage.FieldImplementation, field.TypeEnum, value)
|
||||
_node.Implementation = value
|
||||
}
|
||||
if value, ok := sc.mutation.TvPath(); ok {
|
||||
_spec.SetField(storage.FieldTvPath, field.TypeString, value)
|
||||
_node.TvPath = value
|
||||
}
|
||||
if value, ok := sc.mutation.MoviePath(); ok {
|
||||
_spec.SetField(storage.FieldMoviePath, field.TypeString, value)
|
||||
_node.MoviePath = value
|
||||
}
|
||||
if value, ok := sc.mutation.Settings(); ok {
|
||||
_spec.SetField(storage.FieldSettings, field.TypeString, value)
|
||||
_node.Settings = value
|
||||
|
||||
@@ -55,6 +55,46 @@ func (su *StorageUpdate) SetNillableImplementation(s *storage.Implementation) *S
|
||||
return su
|
||||
}
|
||||
|
||||
// SetTvPath sets the "tv_path" field.
|
||||
func (su *StorageUpdate) SetTvPath(s string) *StorageUpdate {
|
||||
su.mutation.SetTvPath(s)
|
||||
return su
|
||||
}
|
||||
|
||||
// SetNillableTvPath sets the "tv_path" field if the given value is not nil.
|
||||
func (su *StorageUpdate) SetNillableTvPath(s *string) *StorageUpdate {
|
||||
if s != nil {
|
||||
su.SetTvPath(*s)
|
||||
}
|
||||
return su
|
||||
}
|
||||
|
||||
// ClearTvPath clears the value of the "tv_path" field.
|
||||
func (su *StorageUpdate) ClearTvPath() *StorageUpdate {
|
||||
su.mutation.ClearTvPath()
|
||||
return su
|
||||
}
|
||||
|
||||
// SetMoviePath sets the "movie_path" field.
|
||||
func (su *StorageUpdate) SetMoviePath(s string) *StorageUpdate {
|
||||
su.mutation.SetMoviePath(s)
|
||||
return su
|
||||
}
|
||||
|
||||
// SetNillableMoviePath sets the "movie_path" field if the given value is not nil.
|
||||
func (su *StorageUpdate) SetNillableMoviePath(s *string) *StorageUpdate {
|
||||
if s != nil {
|
||||
su.SetMoviePath(*s)
|
||||
}
|
||||
return su
|
||||
}
|
||||
|
||||
// ClearMoviePath clears the value of the "movie_path" field.
|
||||
func (su *StorageUpdate) ClearMoviePath() *StorageUpdate {
|
||||
su.mutation.ClearMoviePath()
|
||||
return su
|
||||
}
|
||||
|
||||
// SetSettings sets the "settings" field.
|
||||
func (su *StorageUpdate) SetSettings(s string) *StorageUpdate {
|
||||
su.mutation.SetSettings(s)
|
||||
@@ -163,6 +203,18 @@ func (su *StorageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if value, ok := su.mutation.Implementation(); ok {
|
||||
_spec.SetField(storage.FieldImplementation, field.TypeEnum, value)
|
||||
}
|
||||
if value, ok := su.mutation.TvPath(); ok {
|
||||
_spec.SetField(storage.FieldTvPath, field.TypeString, value)
|
||||
}
|
||||
if su.mutation.TvPathCleared() {
|
||||
_spec.ClearField(storage.FieldTvPath, field.TypeString)
|
||||
}
|
||||
if value, ok := su.mutation.MoviePath(); ok {
|
||||
_spec.SetField(storage.FieldMoviePath, field.TypeString, value)
|
||||
}
|
||||
if su.mutation.MoviePathCleared() {
|
||||
_spec.ClearField(storage.FieldMoviePath, field.TypeString)
|
||||
}
|
||||
if value, ok := su.mutation.Settings(); ok {
|
||||
_spec.SetField(storage.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
@@ -223,6 +275,46 @@ func (suo *StorageUpdateOne) SetNillableImplementation(s *storage.Implementation
|
||||
return suo
|
||||
}
|
||||
|
||||
// SetTvPath sets the "tv_path" field.
|
||||
func (suo *StorageUpdateOne) SetTvPath(s string) *StorageUpdateOne {
|
||||
suo.mutation.SetTvPath(s)
|
||||
return suo
|
||||
}
|
||||
|
||||
// SetNillableTvPath sets the "tv_path" field if the given value is not nil.
|
||||
func (suo *StorageUpdateOne) SetNillableTvPath(s *string) *StorageUpdateOne {
|
||||
if s != nil {
|
||||
suo.SetTvPath(*s)
|
||||
}
|
||||
return suo
|
||||
}
|
||||
|
||||
// ClearTvPath clears the value of the "tv_path" field.
|
||||
func (suo *StorageUpdateOne) ClearTvPath() *StorageUpdateOne {
|
||||
suo.mutation.ClearTvPath()
|
||||
return suo
|
||||
}
|
||||
|
||||
// SetMoviePath sets the "movie_path" field.
|
||||
func (suo *StorageUpdateOne) SetMoviePath(s string) *StorageUpdateOne {
|
||||
suo.mutation.SetMoviePath(s)
|
||||
return suo
|
||||
}
|
||||
|
||||
// SetNillableMoviePath sets the "movie_path" field if the given value is not nil.
|
||||
func (suo *StorageUpdateOne) SetNillableMoviePath(s *string) *StorageUpdateOne {
|
||||
if s != nil {
|
||||
suo.SetMoviePath(*s)
|
||||
}
|
||||
return suo
|
||||
}
|
||||
|
||||
// ClearMoviePath clears the value of the "movie_path" field.
|
||||
func (suo *StorageUpdateOne) ClearMoviePath() *StorageUpdateOne {
|
||||
suo.mutation.ClearMoviePath()
|
||||
return suo
|
||||
}
|
||||
|
||||
// SetSettings sets the "settings" field.
|
||||
func (suo *StorageUpdateOne) SetSettings(s string) *StorageUpdateOne {
|
||||
suo.mutation.SetSettings(s)
|
||||
@@ -361,6 +453,18 @@ func (suo *StorageUpdateOne) sqlSave(ctx context.Context) (_node *Storage, err e
|
||||
if value, ok := suo.mutation.Implementation(); ok {
|
||||
_spec.SetField(storage.FieldImplementation, field.TypeEnum, value)
|
||||
}
|
||||
if value, ok := suo.mutation.TvPath(); ok {
|
||||
_spec.SetField(storage.FieldTvPath, field.TypeString, value)
|
||||
}
|
||||
if suo.mutation.TvPathCleared() {
|
||||
_spec.ClearField(storage.FieldTvPath, field.TypeString)
|
||||
}
|
||||
if value, ok := suo.mutation.MoviePath(); ok {
|
||||
_spec.SetField(storage.FieldMoviePath, field.TypeString, value)
|
||||
}
|
||||
if suo.mutation.MoviePathCleared() {
|
||||
_spec.ClearField(storage.FieldMoviePath, field.TypeString)
|
||||
}
|
||||
if value, ok := suo.mutation.Settings(); ok {
|
||||
_spec.SetField(storage.FieldSettings, field.TypeString, value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user