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