// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "entgo.io/ent/dialect/sql" "github.com/FrankenBotDev/FrankenAPI/ent/support" ) // Support is the model entity for the Support schema. type Support struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` // Refid holds the value of the "refid" field. Refid string `json:"refid,omitempty"` // Serverid holds the value of the "serverid" field. Serverid string `json:"serverid,omitempty"` // Creator holds the value of the "creator" field. Creator string `json:"creator,omitempty"` // Status holds the value of the "status" field. Status string `json:"status,omitempty"` // Title holds the value of the "title" field. Title string `json:"title,omitempty"` // Description holds the value of the "description" field. Description string `json:"description,omitempty"` } // scanValues returns the types for scanning values from sql.Rows. func (*Support) scanValues(columns []string) ([]interface{}, error) { values := make([]interface{}, len(columns)) for i := range columns { switch columns[i] { case support.FieldID: values[i] = new(sql.NullInt64) case support.FieldRefid, support.FieldServerid, support.FieldCreator, support.FieldStatus, support.FieldTitle, support.FieldDescription: values[i] = new(sql.NullString) default: return nil, fmt.Errorf("unexpected column %q for type Support", columns[i]) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Support fields. func (s *Support) assignValues(columns []string, values []interface{}) 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 support.FieldID: value, ok := values[i].(*sql.NullInt64) if !ok { return fmt.Errorf("unexpected type %T for field id", value) } s.ID = int(value.Int64) case support.FieldRefid: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field refid", values[i]) } else if value.Valid { s.Refid = value.String } case support.FieldServerid: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field serverid", values[i]) } else if value.Valid { s.Serverid = value.String } case support.FieldCreator: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field creator", values[i]) } else if value.Valid { s.Creator = value.String } case support.FieldStatus: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field status", values[i]) } else if value.Valid { s.Status = value.String } case support.FieldTitle: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field title", values[i]) } else if value.Valid { s.Title = value.String } case support.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { s.Description = value.String } } } return nil } // Update returns a builder for updating this Support. // Note that you need to call Support.Unwrap() before calling this method if this Support // was returned from a transaction, and the transaction was committed or rolled back. func (s *Support) Update() *SupportUpdateOne { return (&SupportClient{config: s.config}).UpdateOne(s) } // Unwrap unwraps the Support 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 (s *Support) Unwrap() *Support { _tx, ok := s.config.driver.(*txDriver) if !ok { panic("ent: Support is not a transactional entity") } s.config.driver = _tx.drv return s } // String implements the fmt.Stringer. func (s *Support) String() string { var builder strings.Builder builder.WriteString("Support(") builder.WriteString(fmt.Sprintf("id=%v, ", s.ID)) builder.WriteString("refid=") builder.WriteString(s.Refid) builder.WriteString(", ") builder.WriteString("serverid=") builder.WriteString(s.Serverid) builder.WriteString(", ") builder.WriteString("creator=") builder.WriteString(s.Creator) builder.WriteString(", ") builder.WriteString("status=") builder.WriteString(s.Status) builder.WriteString(", ") builder.WriteString("title=") builder.WriteString(s.Title) builder.WriteString(", ") builder.WriteString("description=") builder.WriteString(s.Description) builder.WriteByte(')') return builder.String() } // Supports is a parsable slice of Support. type Supports []*Support func (s Supports) config(cfg config) { for _i := range s { s[_i].config = cfg } }