179 lines
5.7 KiB
Go
179 lines
5.7 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"github.com/FrankenBotDev/FrankenAPI/ent/actions"
|
|
)
|
|
|
|
// Actions is the model entity for the Actions schema.
|
|
type Actions struct {
|
|
config `json:"-"`
|
|
// ID of the ent.
|
|
ID int `json:"id,omitempty"`
|
|
// Refid holds the value of the "refid" field.
|
|
Refid string `json:"refid,omitempty"`
|
|
// Commiter holds the value of the "commiter" field.
|
|
Commiter string `json:"commiter,omitempty"`
|
|
// Serverid holds the value of the "serverid" field.
|
|
Serverid string `json:"serverid,omitempty"`
|
|
// Target holds the value of the "target" field.
|
|
Target string `json:"target,omitempty"`
|
|
// Type holds the value of the "type" field.
|
|
Type string `json:"type,omitempty"`
|
|
// Duration holds the value of the "duration" field.
|
|
Duration string `json:"duration,omitempty"`
|
|
// Reason holds the value of the "reason" field.
|
|
Reason string `json:"reason,omitempty"`
|
|
// Temp holds the value of the "temp" field.
|
|
Temp bool `json:"temp,omitempty"`
|
|
}
|
|
|
|
// scanValues returns the types for scanning values from sql.Rows.
|
|
func (*Actions) scanValues(columns []string) ([]interface{}, error) {
|
|
values := make([]interface{}, len(columns))
|
|
for i := range columns {
|
|
switch columns[i] {
|
|
case actions.FieldTemp:
|
|
values[i] = new(sql.NullBool)
|
|
case actions.FieldID:
|
|
values[i] = new(sql.NullInt64)
|
|
case actions.FieldRefid, actions.FieldCommiter, actions.FieldServerid, actions.FieldTarget, actions.FieldType, actions.FieldDuration, actions.FieldReason:
|
|
values[i] = new(sql.NullString)
|
|
default:
|
|
return nil, fmt.Errorf("unexpected column %q for type Actions", columns[i])
|
|
}
|
|
}
|
|
return values, nil
|
|
}
|
|
|
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
|
// to the Actions fields.
|
|
func (a *Actions) 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 actions.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 actions.FieldRefid:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field refid", values[i])
|
|
} else if value.Valid {
|
|
a.Refid = value.String
|
|
}
|
|
case actions.FieldCommiter:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field commiter", values[i])
|
|
} else if value.Valid {
|
|
a.Commiter = value.String
|
|
}
|
|
case actions.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 actions.FieldTarget:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field target", values[i])
|
|
} else if value.Valid {
|
|
a.Target = value.String
|
|
}
|
|
case actions.FieldType:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field type", values[i])
|
|
} else if value.Valid {
|
|
a.Type = value.String
|
|
}
|
|
case actions.FieldDuration:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field duration", values[i])
|
|
} else if value.Valid {
|
|
a.Duration = value.String
|
|
}
|
|
case actions.FieldReason:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field reason", values[i])
|
|
} else if value.Valid {
|
|
a.Reason = value.String
|
|
}
|
|
case actions.FieldTemp:
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
return fmt.Errorf("unexpected type %T for field temp", values[i])
|
|
} else if value.Valid {
|
|
a.Temp = value.Bool
|
|
}
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Update returns a builder for updating this Actions.
|
|
// Note that you need to call Actions.Unwrap() before calling this method if this Actions
|
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
|
func (a *Actions) Update() *ActionsUpdateOne {
|
|
return (&ActionsClient{config: a.config}).UpdateOne(a)
|
|
}
|
|
|
|
// Unwrap unwraps the Actions 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 *Actions) Unwrap() *Actions {
|
|
_tx, ok := a.config.driver.(*txDriver)
|
|
if !ok {
|
|
panic("ent: Actions is not a transactional entity")
|
|
}
|
|
a.config.driver = _tx.drv
|
|
return a
|
|
}
|
|
|
|
// String implements the fmt.Stringer.
|
|
func (a *Actions) String() string {
|
|
var builder strings.Builder
|
|
builder.WriteString("Actions(")
|
|
builder.WriteString(fmt.Sprintf("id=%v, ", a.ID))
|
|
builder.WriteString("refid=")
|
|
builder.WriteString(a.Refid)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("commiter=")
|
|
builder.WriteString(a.Commiter)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("serverid=")
|
|
builder.WriteString(a.Serverid)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("target=")
|
|
builder.WriteString(a.Target)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("type=")
|
|
builder.WriteString(a.Type)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("duration=")
|
|
builder.WriteString(a.Duration)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("reason=")
|
|
builder.WriteString(a.Reason)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("temp=")
|
|
builder.WriteString(fmt.Sprintf("%v", a.Temp))
|
|
builder.WriteByte(')')
|
|
return builder.String()
|
|
}
|
|
|
|
// ActionsSlice is a parsable slice of Actions.
|
|
type ActionsSlice []*Actions
|
|
|
|
func (a ActionsSlice) config(cfg config) {
|
|
for _i := range a {
|
|
a[_i].config = cfg
|
|
}
|
|
}
|