// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "polaris/ent/downloadclients" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" ) // DownloadClients is the model entity for the DownloadClients schema. type DownloadClients struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` // Enable holds the value of the "enable" field. Enable bool `json:"enable,omitempty"` // Name holds the value of the "name" field. Name string `json:"name,omitempty"` // Implementation holds the value of the "implementation" field. Implementation downloadclients.Implementation `json:"implementation,omitempty"` // URL holds the value of the "url" field. URL string `json:"url,omitempty"` // User holds the value of the "user" field. User string `json:"user,omitempty"` // Password holds the value of the "password" field. Password string `json:"password,omitempty"` // Settings holds the value of the "settings" field. Settings string `json:"settings,omitempty"` // Priority1 holds the value of the "priority1" field. Priority1 int `json:"priority1,omitempty"` // use stun server to do nat traversal, enable download client to do uploading successfully UseNatTraversal bool `json:"use_nat_traversal,omitempty"` // RemoveCompletedDownloads holds the value of the "remove_completed_downloads" field. RemoveCompletedDownloads bool `json:"remove_completed_downloads,omitempty"` // RemoveFailedDownloads holds the value of the "remove_failed_downloads" field. RemoveFailedDownloads bool `json:"remove_failed_downloads,omitempty"` // Tags holds the value of the "tags" field. Tags string `json:"tags,omitempty"` // CreateTime holds the value of the "create_time" field. CreateTime time.Time `json:"create_time,omitempty"` selectValues sql.SelectValues } // scanValues returns the types for scanning values from sql.Rows. func (*DownloadClients) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case downloadclients.FieldEnable, downloadclients.FieldUseNatTraversal, downloadclients.FieldRemoveCompletedDownloads, downloadclients.FieldRemoveFailedDownloads: values[i] = new(sql.NullBool) case downloadclients.FieldID, downloadclients.FieldPriority1: values[i] = new(sql.NullInt64) case downloadclients.FieldName, downloadclients.FieldImplementation, downloadclients.FieldURL, downloadclients.FieldUser, downloadclients.FieldPassword, downloadclients.FieldSettings, downloadclients.FieldTags: values[i] = new(sql.NullString) case downloadclients.FieldCreateTime: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the DownloadClients fields. func (dc *DownloadClients) assignValues(columns []string, values []any) error { if m, n := len(values), len(columns); m < n { return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) } for i := range columns { switch columns[i] { case downloadclients.FieldID: value, ok := values[i].(*sql.NullInt64) if !ok { return fmt.Errorf("unexpected type %T for field id", value) } dc.ID = int(value.Int64) case downloadclients.FieldEnable: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field enable", values[i]) } else if value.Valid { dc.Enable = value.Bool } case downloadclients.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { dc.Name = value.String } case downloadclients.FieldImplementation: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field implementation", values[i]) } else if value.Valid { dc.Implementation = downloadclients.Implementation(value.String) } case downloadclients.FieldURL: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field url", values[i]) } else if value.Valid { dc.URL = value.String } case downloadclients.FieldUser: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field user", values[i]) } else if value.Valid { dc.User = value.String } case downloadclients.FieldPassword: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field password", values[i]) } else if value.Valid { dc.Password = value.String } case downloadclients.FieldSettings: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field settings", values[i]) } else if value.Valid { dc.Settings = value.String } case downloadclients.FieldPriority1: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field priority1", values[i]) } else if value.Valid { dc.Priority1 = int(value.Int64) } case downloadclients.FieldUseNatTraversal: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field use_nat_traversal", values[i]) } else if value.Valid { dc.UseNatTraversal = value.Bool } case downloadclients.FieldRemoveCompletedDownloads: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field remove_completed_downloads", values[i]) } else if value.Valid { dc.RemoveCompletedDownloads = value.Bool } case downloadclients.FieldRemoveFailedDownloads: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field remove_failed_downloads", values[i]) } else if value.Valid { dc.RemoveFailedDownloads = value.Bool } case downloadclients.FieldTags: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field tags", values[i]) } else if value.Valid { 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: dc.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the DownloadClients. // This includes values selected through modifiers, order, etc. func (dc *DownloadClients) Value(name string) (ent.Value, error) { return dc.selectValues.Get(name) } // Update returns a builder for updating this DownloadClients. // Note that you need to call DownloadClients.Unwrap() before calling this method if this DownloadClients // was returned from a transaction, and the transaction was committed or rolled back. func (dc *DownloadClients) Update() *DownloadClientsUpdateOne { return NewDownloadClientsClient(dc.config).UpdateOne(dc) } // Unwrap unwraps the DownloadClients entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (dc *DownloadClients) Unwrap() *DownloadClients { _tx, ok := dc.config.driver.(*txDriver) if !ok { panic("ent: DownloadClients is not a transactional entity") } dc.config.driver = _tx.drv return dc } // String implements the fmt.Stringer. func (dc *DownloadClients) String() string { var builder strings.Builder builder.WriteString("DownloadClients(") builder.WriteString(fmt.Sprintf("id=%v, ", dc.ID)) builder.WriteString("enable=") builder.WriteString(fmt.Sprintf("%v", dc.Enable)) builder.WriteString(", ") builder.WriteString("name=") builder.WriteString(dc.Name) builder.WriteString(", ") builder.WriteString("implementation=") builder.WriteString(fmt.Sprintf("%v", dc.Implementation)) builder.WriteString(", ") builder.WriteString("url=") builder.WriteString(dc.URL) builder.WriteString(", ") builder.WriteString("user=") builder.WriteString(dc.User) builder.WriteString(", ") builder.WriteString("password=") builder.WriteString(dc.Password) builder.WriteString(", ") builder.WriteString("settings=") builder.WriteString(dc.Settings) builder.WriteString(", ") builder.WriteString("priority1=") builder.WriteString(fmt.Sprintf("%v", dc.Priority1)) builder.WriteString(", ") builder.WriteString("use_nat_traversal=") builder.WriteString(fmt.Sprintf("%v", dc.UseNatTraversal)) builder.WriteString(", ") builder.WriteString("remove_completed_downloads=") builder.WriteString(fmt.Sprintf("%v", dc.RemoveCompletedDownloads)) builder.WriteString(", ") builder.WriteString("remove_failed_downloads=") builder.WriteString(fmt.Sprintf("%v", dc.RemoveFailedDownloads)) builder.WriteString(", ") builder.WriteString("tags=") builder.WriteString(dc.Tags) builder.WriteString(", ") builder.WriteString("create_time=") builder.WriteString(dc.CreateTime.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() } // DownloadClientsSlice is a parsable slice of DownloadClients. type DownloadClientsSlice []*DownloadClients