add initial application structure with configuration, logging, and health check endpoints
This commit is contained in:
257
internal/ent/epicartifactinfo.go
Normal file
257
internal/ent/epicartifactinfo.go
Normal file
@@ -0,0 +1,257 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"epic-ent/internal/ent/epicartifactinfo"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
)
|
||||
|
||||
// EpicArtifactInfo is the model entity for the EpicArtifactInfo schema.
|
||||
type EpicArtifactInfo struct {
|
||||
config `json:"-"`
|
||||
// ID of the ent.
|
||||
ID int64 `json:"id,omitempty"`
|
||||
// ArtifactName holds the value of the "artifact_name" field.
|
||||
ArtifactName string `json:"artifact_name,omitempty"`
|
||||
// ArtifactCode holds the value of the "artifact_code" field.
|
||||
ArtifactCode string `json:"artifact_code,omitempty"`
|
||||
// Creator holds the value of the "creator" field.
|
||||
Creator string `json:"creator,omitempty"`
|
||||
// CreateTime holds the value of the "create_time" field.
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
// Updater holds the value of the "updater" field.
|
||||
Updater string `json:"updater,omitempty"`
|
||||
// UpdateTime holds the value of the "update_time" field.
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
// Deleted holds the value of the "deleted" field.
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
// StatsHealth holds the value of the "stats_health" field.
|
||||
StatsHealth int `json:"stats_health,omitempty"`
|
||||
// StatsAttack holds the value of the "stats_attack" field.
|
||||
StatsAttack int `json:"stats_attack,omitempty"`
|
||||
// StatsDefense holds the value of the "stats_defense" field.
|
||||
StatsDefense int `json:"stats_defense,omitempty"`
|
||||
// Rarity holds the value of the "rarity" field.
|
||||
Rarity string `json:"rarity,omitempty"`
|
||||
// Role holds the value of the "role" field.
|
||||
Role string `json:"role,omitempty"`
|
||||
// ArtifactNameEn holds the value of the "artifact_name_en" field.
|
||||
ArtifactNameEn string `json:"artifact_name_en,omitempty"`
|
||||
// ImageURL holds the value of the "image_url" field.
|
||||
ImageURL string `json:"image_url,omitempty"`
|
||||
selectValues sql.SelectValues
|
||||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*EpicArtifactInfo) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case epicartifactinfo.FieldDeleted:
|
||||
values[i] = new(sql.NullBool)
|
||||
case epicartifactinfo.FieldID, epicartifactinfo.FieldStatsHealth, epicartifactinfo.FieldStatsAttack, epicartifactinfo.FieldStatsDefense:
|
||||
values[i] = new(sql.NullInt64)
|
||||
case epicartifactinfo.FieldArtifactName, epicartifactinfo.FieldArtifactCode, epicartifactinfo.FieldCreator, epicartifactinfo.FieldUpdater, epicartifactinfo.FieldRarity, epicartifactinfo.FieldRole, epicartifactinfo.FieldArtifactNameEn, epicartifactinfo.FieldImageURL:
|
||||
values[i] = new(sql.NullString)
|
||||
case epicartifactinfo.FieldCreateTime, epicartifactinfo.FieldUpdateTime:
|
||||
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 EpicArtifactInfo fields.
|
||||
func (_m *EpicArtifactInfo) 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 epicartifactinfo.FieldID:
|
||||
value, ok := values[i].(*sql.NullInt64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field id", value)
|
||||
}
|
||||
_m.ID = int64(value.Int64)
|
||||
case epicartifactinfo.FieldArtifactName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifact_name", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ArtifactName = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldArtifactCode:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifact_code", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ArtifactCode = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldCreator:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field creator", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Creator = value.String
|
||||
}
|
||||
case epicartifactinfo.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 {
|
||||
_m.CreateTime = new(time.Time)
|
||||
*_m.CreateTime = value.Time
|
||||
}
|
||||
case epicartifactinfo.FieldUpdater:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updater", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Updater = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldUpdateTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field update_time", values[i])
|
||||
} else if value.Valid {
|
||||
_m.UpdateTime = new(time.Time)
|
||||
*_m.UpdateTime = value.Time
|
||||
}
|
||||
case epicartifactinfo.FieldDeleted:
|
||||
if value, ok := values[i].(*sql.NullBool); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Deleted = value.Bool
|
||||
}
|
||||
case epicartifactinfo.FieldStatsHealth:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field stats_health", values[i])
|
||||
} else if value.Valid {
|
||||
_m.StatsHealth = int(value.Int64)
|
||||
}
|
||||
case epicartifactinfo.FieldStatsAttack:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field stats_attack", values[i])
|
||||
} else if value.Valid {
|
||||
_m.StatsAttack = int(value.Int64)
|
||||
}
|
||||
case epicartifactinfo.FieldStatsDefense:
|
||||
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field stats_defense", values[i])
|
||||
} else if value.Valid {
|
||||
_m.StatsDefense = int(value.Int64)
|
||||
}
|
||||
case epicartifactinfo.FieldRarity:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field rarity", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Rarity = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldRole:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field role", values[i])
|
||||
} else if value.Valid {
|
||||
_m.Role = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldArtifactNameEn:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field artifact_name_en", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ArtifactNameEn = value.String
|
||||
}
|
||||
case epicartifactinfo.FieldImageURL:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field image_url", values[i])
|
||||
} else if value.Valid {
|
||||
_m.ImageURL = value.String
|
||||
}
|
||||
default:
|
||||
_m.selectValues.Set(columns[i], values[i])
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns the ent.Value that was dynamically selected and assigned to the EpicArtifactInfo.
|
||||
// This includes values selected through modifiers, order, etc.
|
||||
func (_m *EpicArtifactInfo) Value(name string) (ent.Value, error) {
|
||||
return _m.selectValues.Get(name)
|
||||
}
|
||||
|
||||
// Update returns a builder for updating this EpicArtifactInfo.
|
||||
// Note that you need to call EpicArtifactInfo.Unwrap() before calling this method if this EpicArtifactInfo
|
||||
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||
func (_m *EpicArtifactInfo) Update() *EpicArtifactInfoUpdateOne {
|
||||
return NewEpicArtifactInfoClient(_m.config).UpdateOne(_m)
|
||||
}
|
||||
|
||||
// Unwrap unwraps the EpicArtifactInfo 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 (_m *EpicArtifactInfo) Unwrap() *EpicArtifactInfo {
|
||||
_tx, ok := _m.config.driver.(*txDriver)
|
||||
if !ok {
|
||||
panic("ent: EpicArtifactInfo is not a transactional entity")
|
||||
}
|
||||
_m.config.driver = _tx.drv
|
||||
return _m
|
||||
}
|
||||
|
||||
// String implements the fmt.Stringer.
|
||||
func (_m *EpicArtifactInfo) String() string {
|
||||
var builder strings.Builder
|
||||
builder.WriteString("EpicArtifactInfo(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
||||
builder.WriteString("artifact_name=")
|
||||
builder.WriteString(_m.ArtifactName)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("artifact_code=")
|
||||
builder.WriteString(_m.ArtifactCode)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("creator=")
|
||||
builder.WriteString(_m.Creator)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.CreateTime; v != nil {
|
||||
builder.WriteString("create_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("updater=")
|
||||
builder.WriteString(_m.Updater)
|
||||
builder.WriteString(", ")
|
||||
if v := _m.UpdateTime; v != nil {
|
||||
builder.WriteString("update_time=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("deleted=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("stats_health=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.StatsHealth))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("stats_attack=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.StatsAttack))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("stats_defense=")
|
||||
builder.WriteString(fmt.Sprintf("%v", _m.StatsDefense))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("rarity=")
|
||||
builder.WriteString(_m.Rarity)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("role=")
|
||||
builder.WriteString(_m.Role)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("artifact_name_en=")
|
||||
builder.WriteString(_m.ArtifactNameEn)
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("image_url=")
|
||||
builder.WriteString(_m.ImageURL)
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// EpicArtifactInfos is a parsable slice of EpicArtifactInfo.
|
||||
type EpicArtifactInfos []*EpicArtifactInfo
|
||||
Reference in New Issue
Block a user