// Code generated by ent, DO NOT EDIT. package ent import ( "fmt" "football_api/ent/profile" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" ) // Profile is the model entity for the Profile schema. type Profile struct { config `json:"-"` // ID of the ent. ID uuid.UUID `json:"id,omitempty"` // DisplayName holds the value of the "display_name" field. DisplayName string `json:"display_name,omitempty"` // UserID holds the value of the "user_id" field. UserID uuid.UUID `json:"user_id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` selectValues sql.SelectValues } // scanValues returns the types for scanning values from sql.Rows. func (*Profile) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case profile.FieldDisplayName: values[i] = new(sql.NullString) case profile.FieldCreatedAt, profile.FieldUpdatedAt: values[i] = new(sql.NullTime) case profile.FieldID, profile.FieldUserID: values[i] = new(uuid.UUID) default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Profile fields. func (pr *Profile) assignValues(columns []string, values []any) 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 profile.FieldID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { pr.ID = *value } case profile.FieldDisplayName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field display_name", values[i]) } else if value.Valid { pr.DisplayName = value.String } case profile.FieldUserID: if value, ok := values[i].(*uuid.UUID); !ok { return fmt.Errorf("unexpected type %T for field user_id", values[i]) } else if value != nil { pr.UserID = *value } case profile.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { pr.CreatedAt = value.Time } case profile.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { pr.UpdatedAt = value.Time } default: pr.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Profile. // This includes values selected through modifiers, order, etc. func (pr *Profile) Value(name string) (ent.Value, error) { return pr.selectValues.Get(name) } // Update returns a builder for updating this Profile. // Note that you need to call Profile.Unwrap() before calling this method if this Profile // was returned from a transaction, and the transaction was committed or rolled back. func (pr *Profile) Update() *ProfileUpdateOne { return NewProfileClient(pr.config).UpdateOne(pr) } // Unwrap unwraps the Profile 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 (pr *Profile) Unwrap() *Profile { _tx, ok := pr.config.driver.(*txDriver) if !ok { panic("ent: Profile is not a transactional entity") } pr.config.driver = _tx.drv return pr } // String implements the fmt.Stringer. func (pr *Profile) String() string { var builder strings.Builder builder.WriteString("Profile(") builder.WriteString(fmt.Sprintf("id=%v, ", pr.ID)) builder.WriteString("display_name=") builder.WriteString(pr.DisplayName) builder.WriteString(", ") builder.WriteString("user_id=") builder.WriteString(fmt.Sprintf("%v", pr.UserID)) builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(pr.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(pr.UpdatedAt.Format(time.ANSIC)) builder.WriteByte(')') return builder.String() } // Profiles is a parsable slice of Profile. type Profiles []*Profile