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