// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "strings" "time" "entgo.io/ent/dialect/sql" "github.com/FrankenBotDev/FrankenAPI/ent/supportresponse" ) // SupportResponse is the model entity for the SupportResponse schema. type SupportResponse 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"` // Writer holds the value of the "writer" field. Writer string `json:"writer,omitempty"` // Message holds the value of the "message" field. Message string `json:"message,omitempty"` // Type holds the value of the "type" field. Type string `json:"type,omitempty"` // Rtcchannel holds the value of the "rtcchannel" field. Rtcchannel string `json:"rtcchannel,omitempty"` // Isread holds the value of the "isread" field. Isread bool `json:"isread,omitempty"` // Created holds the value of the "created" field. Created time.Time `json:"created,omitempty"` } // scanValues returns the types for scanning values from sql.Rows. func (*SupportResponse) scanValues(columns []string) ([]interface{}, error) { values := make([]interface{}, len(columns)) for i := range columns { switch columns[i] { case supportresponse.FieldIsread: values[i] = new(sql.NullBool) case supportresponse.FieldID: values[i] = new(sql.NullInt64) case supportresponse.FieldRefid, supportresponse.FieldWriter, supportresponse.FieldMessage, supportresponse.FieldType, supportresponse.FieldRtcchannel: values[i] = new(sql.NullString) case supportresponse.FieldCreated: values[i] = new(sql.NullTime) default: return nil, fmt.Errorf("unexpected column %q for type SupportResponse", columns[i]) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the SupportResponse fields. func (sr *SupportResponse) 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 supportresponse.FieldID: value, ok := values[i].(*sql.NullInt64) if !ok { return fmt.Errorf("unexpected type %T for field id", value) } sr.ID = int(value.Int64) case supportresponse.FieldRefid: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field refid", values[i]) } else if value.Valid { sr.Refid = value.String } case supportresponse.FieldWriter: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field writer", values[i]) } else if value.Valid { sr.Writer = value.String } case supportresponse.FieldMessage: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field message", values[i]) } else if value.Valid { sr.Message = value.String } case supportresponse.FieldType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field type", values[i]) } else if value.Valid { sr.Type = value.String } case supportresponse.FieldRtcchannel: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field rtcchannel", values[i]) } else if value.Valid { sr.Rtcchannel = value.String } case supportresponse.FieldIsread: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field isread", values[i]) } else if value.Valid { sr.Isread = value.Bool } case supportresponse.FieldCreated: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created", values[i]) } else if value.Valid { sr.Created = value.Time } } } return nil } // Update returns a builder for updating this SupportResponse. // Note that you need to call SupportResponse.Unwrap() before calling this method if this SupportResponse // was returned from a transaction, and the transaction was committed or rolled back. func (sr *SupportResponse) Update() *SupportResponseUpdateOne { return (&SupportResponseClient{config: sr.config}).UpdateOne(sr) } // Unwrap unwraps the SupportResponse 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 (sr *SupportResponse) Unwrap() *SupportResponse { _tx, ok := sr.config.driver.(*txDriver) if !ok { panic("ent: SupportResponse is not a transactional entity") } sr.config.driver = _tx.drv return sr } // String implements the fmt.Stringer. func (sr *SupportResponse) String() string { var builder strings.Builder builder.WriteString("SupportResponse(") builder.WriteString(fmt.Sprintf("id=%v, ", sr.ID)) builder.WriteString("refid=") builder.WriteString(sr.Refid) builder.WriteString(", ") builder.WriteString("writer=") builder.WriteString(sr.Writer) builder.WriteString(", ") builder.WriteString("message=") builder.WriteString(sr.Message) builder.WriteString(", ") builder.WriteString("type=") builder.WriteString(sr.Type) builder.WriteString(", ") builder.WriteString("rtcchannel=") builder.WriteString(sr.Rtcchannel) builder.WriteString(", ") builder.WriteString("isread=") builder.WriteString(fmt.Sprintf("%v", sr.Isread)) builder.WriteString(", ") builder.WriteString("created=") builder.WriteString(sr.Created.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() } // SupportResponses is a parsable slice of SupportResponse. type SupportResponses []*SupportResponse func (sr SupportResponses) config(cfg config) { for _i := range sr { sr[_i].config = cfg } }