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