212 lines
7.2 KiB
Go
212 lines
7.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
|
|
"code.icod.de/dalu/gomanager/ent/project"
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
// Project is the model entity for the Project schema.
|
|
type Project struct {
|
|
config `json:"-"`
|
|
// ID of the ent.
|
|
ID int `json:"id,omitempty"`
|
|
// CreateTime holds the value of the "create_time" field.
|
|
CreateTime time.Time `json:"create_time,omitempty"`
|
|
// User holds the value of the "user" field.
|
|
User string `json:"user,omitempty"`
|
|
// Group holds the value of the "group" field.
|
|
Group string `json:"group,omitempty"`
|
|
// RootPath holds the value of the "root_path" field.
|
|
RootPath string `json:"root_path,omitempty"`
|
|
// ServiceName holds the value of the "service_name" field.
|
|
ServiceName string `json:"service_name,omitempty"`
|
|
// BinaryPath holds the value of the "binary_path" field.
|
|
BinaryPath string `json:"binary_path,omitempty"`
|
|
// MoveToTarget holds the value of the "move_to_target" field.
|
|
MoveToTarget bool `json:"move_to_target,omitempty"`
|
|
// BinaryTargetPath holds the value of the "binary_target_path" field.
|
|
BinaryTargetPath string `json:"binary_target_path,omitempty"`
|
|
// Edges holds the relations/edges for other nodes in the graph.
|
|
// The values are being populated by the ProjectQuery when eager-loading is set.
|
|
Edges ProjectEdges `json:"edges"`
|
|
selectValues sql.SelectValues
|
|
}
|
|
|
|
// ProjectEdges holds the relations/edges for other nodes in the graph.
|
|
type ProjectEdges struct {
|
|
// Logentries holds the value of the logentries edge.
|
|
Logentries []*Logentry `json:"logentries,omitempty"`
|
|
// loadedTypes holds the information for reporting if a
|
|
// type was loaded (or requested) in eager-loading or not.
|
|
loadedTypes [1]bool
|
|
}
|
|
|
|
// LogentriesOrErr returns the Logentries value or an error if the edge
|
|
// was not loaded in eager-loading.
|
|
func (e ProjectEdges) LogentriesOrErr() ([]*Logentry, error) {
|
|
if e.loadedTypes[0] {
|
|
return e.Logentries, nil
|
|
}
|
|
return nil, &NotLoadedError{edge: "logentries"}
|
|
}
|
|
|
|
// scanValues returns the types for scanning values from sql.Rows.
|
|
func (*Project) scanValues(columns []string) ([]any, error) {
|
|
values := make([]any, len(columns))
|
|
for i := range columns {
|
|
switch columns[i] {
|
|
case project.FieldMoveToTarget:
|
|
values[i] = new(sql.NullBool)
|
|
case project.FieldID:
|
|
values[i] = new(sql.NullInt64)
|
|
case project.FieldUser, project.FieldGroup, project.FieldRootPath, project.FieldServiceName, project.FieldBinaryPath, project.FieldBinaryTargetPath:
|
|
values[i] = new(sql.NullString)
|
|
case project.FieldCreateTime:
|
|
values[i] = new(sql.NullTime)
|
|
default:
|
|
values[i] = new(sql.UnknownType)
|
|
}
|
|
}
|
|
return values, nil
|
|
}
|
|
|
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
|
// to the Project fields.
|
|
func (pr *Project) 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 project.FieldID:
|
|
value, ok := values[i].(*sql.NullInt64)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field id", value)
|
|
}
|
|
pr.ID = int(value.Int64)
|
|
case project.FieldCreateTime:
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
return fmt.Errorf("unexpected type %T for field create_time", values[i])
|
|
} else if value.Valid {
|
|
pr.CreateTime = value.Time
|
|
}
|
|
case project.FieldUser:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field user", values[i])
|
|
} else if value.Valid {
|
|
pr.User = value.String
|
|
}
|
|
case project.FieldGroup:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field group", values[i])
|
|
} else if value.Valid {
|
|
pr.Group = value.String
|
|
}
|
|
case project.FieldRootPath:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field root_path", values[i])
|
|
} else if value.Valid {
|
|
pr.RootPath = value.String
|
|
}
|
|
case project.FieldServiceName:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field service_name", values[i])
|
|
} else if value.Valid {
|
|
pr.ServiceName = value.String
|
|
}
|
|
case project.FieldBinaryPath:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field binary_path", values[i])
|
|
} else if value.Valid {
|
|
pr.BinaryPath = value.String
|
|
}
|
|
case project.FieldMoveToTarget:
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
return fmt.Errorf("unexpected type %T for field move_to_target", values[i])
|
|
} else if value.Valid {
|
|
pr.MoveToTarget = value.Bool
|
|
}
|
|
case project.FieldBinaryTargetPath:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field binary_target_path", values[i])
|
|
} else if value.Valid {
|
|
pr.BinaryTargetPath = value.String
|
|
}
|
|
default:
|
|
pr.selectValues.Set(columns[i], values[i])
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Value returns the ent.Value that was dynamically selected and assigned to the Project.
|
|
// This includes values selected through modifiers, order, etc.
|
|
func (pr *Project) Value(name string) (ent.Value, error) {
|
|
return pr.selectValues.Get(name)
|
|
}
|
|
|
|
// QueryLogentries queries the "logentries" edge of the Project entity.
|
|
func (pr *Project) QueryLogentries() *LogentryQuery {
|
|
return NewProjectClient(pr.config).QueryLogentries(pr)
|
|
}
|
|
|
|
// Update returns a builder for updating this Project.
|
|
// Note that you need to call Project.Unwrap() before calling this method if this Project
|
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
|
func (pr *Project) Update() *ProjectUpdateOne {
|
|
return NewProjectClient(pr.config).UpdateOne(pr)
|
|
}
|
|
|
|
// Unwrap unwraps the Project 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 *Project) Unwrap() *Project {
|
|
_tx, ok := pr.config.driver.(*txDriver)
|
|
if !ok {
|
|
panic("ent: Project is not a transactional entity")
|
|
}
|
|
pr.config.driver = _tx.drv
|
|
return pr
|
|
}
|
|
|
|
// String implements the fmt.Stringer.
|
|
func (pr *Project) String() string {
|
|
var builder strings.Builder
|
|
builder.WriteString("Project(")
|
|
builder.WriteString(fmt.Sprintf("id=%v, ", pr.ID))
|
|
builder.WriteString("create_time=")
|
|
builder.WriteString(pr.CreateTime.Format(time.ANSIC))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("user=")
|
|
builder.WriteString(pr.User)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("group=")
|
|
builder.WriteString(pr.Group)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("root_path=")
|
|
builder.WriteString(pr.RootPath)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("service_name=")
|
|
builder.WriteString(pr.ServiceName)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("binary_path=")
|
|
builder.WriteString(pr.BinaryPath)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("move_to_target=")
|
|
builder.WriteString(fmt.Sprintf("%v", pr.MoveToTarget))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("binary_target_path=")
|
|
builder.WriteString(pr.BinaryTargetPath)
|
|
builder.WriteByte(')')
|
|
return builder.String()
|
|
}
|
|
|
|
// Projects is a parsable slice of Project.
|
|
type Projects []*Project
|