pcmt/ent/setup.go
surtur 50e7596672
All checks were successful
continuous-integration/drone/push Build is passing
chore(ent): re-run go generate
2023-08-07 21:31:46 +02:00

106 lines
3.0 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"git.dotya.ml/mirre-mt/pcmt/ent/setup"
"github.com/google/uuid"
)
// Setup is the model entity for the Setup schema.
type Setup struct {
config `json:"-"`
// ID of the ent.
ID uuid.UUID `json:"id,omitempty"`
// SetUpAt holds the value of the "set_up_at" field.
SetUpAt time.Time `json:"set_up_at,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Setup) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case setup.FieldSetUpAt:
values[i] = new(sql.NullTime)
case setup.FieldID:
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 Setup fields.
func (s *Setup) 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 setup.FieldID:
if value, ok := values[i].(*uuid.UUID); !ok {
return fmt.Errorf("unexpected type %T for field id", values[i])
} else if value != nil {
s.ID = *value
}
case setup.FieldSetUpAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field set_up_at", values[i])
} else if value.Valid {
s.SetUpAt = value.Time
}
default:
s.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Setup.
// This includes values selected through modifiers, order, etc.
func (s *Setup) Value(name string) (ent.Value, error) {
return s.selectValues.Get(name)
}
// Update returns a builder for updating this Setup.
// Note that you need to call Setup.Unwrap() before calling this method if this Setup
// was returned from a transaction, and the transaction was committed or rolled back.
func (s *Setup) Update() *SetupUpdateOne {
return NewSetupClient(s.config).UpdateOne(s)
}
// Unwrap unwraps the Setup 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 *Setup) Unwrap() *Setup {
_tx, ok := s.config.driver.(*txDriver)
if !ok {
panic("ent: Setup is not a transactional entity")
}
s.config.driver = _tx.drv
return s
}
// String implements the fmt.Stringer.
func (s *Setup) String() string {
var builder strings.Builder
builder.WriteString("Setup(")
builder.WriteString(fmt.Sprintf("id=%v, ", s.ID))
builder.WriteString("set_up_at=")
builder.WriteString(s.SetUpAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// Setups is a parsable slice of Setup.
type Setups []*Setup