pcmt/ent/setup.go
leo b1ab686493
All checks were successful
continuous-integration/drone/push Build is passing
go: add db module for preps/checks
2023-05-05 22:52:59 +02:00

96 lines
2.7 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"strings"
"time"
"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"`
}
// 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:
return nil, fmt.Errorf("unexpected column %q for type Setup", columns[i])
}
}
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
}
}
}
return nil
}
// 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