add initial application structure with configuration, logging, and health check endpoints

This commit is contained in:
kever
2026-01-15 22:11:33 +08:00
parent ed8c3d55b8
commit fe67f09e72
19 changed files with 333 additions and 318 deletions

View File

@@ -49,10 +49,10 @@ type EpicHeroInfo struct {
Remark string `json:"remark,omitempty"`
// RawJSON holds the value of the "raw_json" field.
RawJSON string `json:"raw_json,omitempty"`
// SetContentJSON holds the value of the "set_content_json" field.
SetContentJSON string `json:"set_content_json,omitempty"`
// SetUpdateTime holds the value of the "set_update_time" field.
SetUpdateTime *time.Time `json:"set_update_time,omitempty"`
// ContentJSONSet holds the value of the "content_json_set" field.
ContentJSONSet string `json:"content_json_set,omitempty"`
// UpdateTimeSet holds the value of the "update_time_set" field.
UpdateTimeSet *time.Time `json:"update_time_set,omitempty"`
selectValues sql.SelectValues
}
@@ -65,9 +65,9 @@ func (*EpicHeroInfo) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullBool)
case epicheroinfo.FieldID:
values[i] = new(sql.NullInt64)
case epicheroinfo.FieldHeroName, epicheroinfo.FieldHeroCode, epicheroinfo.FieldHeroAttrLv60, epicheroinfo.FieldCreator, epicheroinfo.FieldUpdater, epicheroinfo.FieldNickName, epicheroinfo.FieldRarity, epicheroinfo.FieldRole, epicheroinfo.FieldZodiac, epicheroinfo.FieldHeadImgURL, epicheroinfo.FieldAttribute, epicheroinfo.FieldRemark, epicheroinfo.FieldRawJSON, epicheroinfo.FieldSetContentJSON:
case epicheroinfo.FieldHeroName, epicheroinfo.FieldHeroCode, epicheroinfo.FieldHeroAttrLv60, epicheroinfo.FieldCreator, epicheroinfo.FieldUpdater, epicheroinfo.FieldNickName, epicheroinfo.FieldRarity, epicheroinfo.FieldRole, epicheroinfo.FieldZodiac, epicheroinfo.FieldHeadImgURL, epicheroinfo.FieldAttribute, epicheroinfo.FieldRemark, epicheroinfo.FieldRawJSON, epicheroinfo.FieldContentJSONSet:
values[i] = new(sql.NullString)
case epicheroinfo.FieldCreateTime, epicheroinfo.FieldUpdateTime, epicheroinfo.FieldSetUpdateTime:
case epicheroinfo.FieldCreateTime, epicheroinfo.FieldUpdateTime, epicheroinfo.FieldUpdateTimeSet:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
@@ -188,18 +188,18 @@ func (_m *EpicHeroInfo) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.RawJSON = value.String
}
case epicheroinfo.FieldSetContentJSON:
case epicheroinfo.FieldContentJSONSet:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field set_content_json", values[i])
return fmt.Errorf("unexpected type %T for field content_json_set", values[i])
} else if value.Valid {
_m.SetContentJSON = value.String
_m.ContentJSONSet = value.String
}
case epicheroinfo.FieldSetUpdateTime:
case epicheroinfo.FieldUpdateTimeSet:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field set_update_time", values[i])
return fmt.Errorf("unexpected type %T for field update_time_set", values[i])
} else if value.Valid {
_m.SetUpdateTime = new(time.Time)
*_m.SetUpdateTime = value.Time
_m.UpdateTimeSet = new(time.Time)
*_m.UpdateTimeSet = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
@@ -289,11 +289,11 @@ func (_m *EpicHeroInfo) String() string {
builder.WriteString("raw_json=")
builder.WriteString(_m.RawJSON)
builder.WriteString(", ")
builder.WriteString("set_content_json=")
builder.WriteString(_m.SetContentJSON)
builder.WriteString("content_json_set=")
builder.WriteString(_m.ContentJSONSet)
builder.WriteString(", ")
if v := _m.SetUpdateTime; v != nil {
builder.WriteString("set_update_time=")
if v := _m.UpdateTimeSet; v != nil {
builder.WriteString("update_time_set=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteByte(')')

View File

@@ -43,10 +43,10 @@ const (
FieldRemark = "remark"
// FieldRawJSON holds the string denoting the raw_json field in the database.
FieldRawJSON = "raw_json"
// FieldSetContentJSON holds the string denoting the set_content_json field in the database.
FieldSetContentJSON = "set_content_json"
// FieldSetUpdateTime holds the string denoting the set_update_time field in the database.
FieldSetUpdateTime = "set_update_time"
// FieldContentJSONSet holds the string denoting the content_json_set field in the database.
FieldContentJSONSet = "content_json_set"
// FieldUpdateTimeSet holds the string denoting the update_time_set field in the database.
FieldUpdateTimeSet = "update_time_set"
// Table holds the table name of the epicheroinfo in the database.
Table = "epic_hero_infos"
)
@@ -70,8 +70,8 @@ var Columns = []string{
FieldAttribute,
FieldRemark,
FieldRawJSON,
FieldSetContentJSON,
FieldSetUpdateTime,
FieldContentJSONSet,
FieldUpdateTimeSet,
}
// ValidColumn reports if the column name is valid (part of the table columns).
@@ -111,8 +111,8 @@ var (
RemarkValidator func(string) error
// RawJSONValidator is a validator for the "raw_json" field. It is called by the builders before save.
RawJSONValidator func(string) error
// SetContentJSONValidator is a validator for the "set_content_json" field. It is called by the builders before save.
SetContentJSONValidator func(string) error
// ContentJSONSetValidator is a validator for the "content_json_set" field. It is called by the builders before save.
ContentJSONSetValidator func(string) error
)
// OrderOption defines the ordering options for the EpicHeroInfo queries.
@@ -203,12 +203,12 @@ func ByRawJSON(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRawJSON, opts...).ToFunc()
}
// BySetContentJSON orders the results by the set_content_json field.
func BySetContentJSON(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSetContentJSON, opts...).ToFunc()
// ByContentJSONSet orders the results by the content_json_set field.
func ByContentJSONSet(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldContentJSONSet, opts...).ToFunc()
}
// BySetUpdateTime orders the results by the set_update_time field.
func BySetUpdateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSetUpdateTime, opts...).ToFunc()
// ByUpdateTimeSet orders the results by the update_time_set field.
func ByUpdateTimeSet(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateTimeSet, opts...).ToFunc()
}

View File

@@ -134,14 +134,14 @@ func RawJSON(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldRawJSON, v))
}
// SetContentJSON applies equality check predicate on the "set_content_json" field. It's identical to SetContentJSONEQ.
func SetContentJSON(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetContentJSON, v))
// ContentJSONSet applies equality check predicate on the "content_json_set" field. It's identical to ContentJSONSetEQ.
func ContentJSONSet(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldContentJSONSet, v))
}
// SetUpdateTime applies equality check predicate on the "set_update_time" field. It's identical to SetUpdateTimeEQ.
func SetUpdateTime(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetUpdateTime, v))
// UpdateTimeSet applies equality check predicate on the "update_time_set" field. It's identical to UpdateTimeSetEQ.
func UpdateTimeSet(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldUpdateTimeSet, v))
}
// HeroNameEQ applies the EQ predicate on the "hero_name" field.
@@ -1099,119 +1099,119 @@ func RawJSONContainsFold(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldContainsFold(FieldRawJSON, v))
}
// SetContentJSONEQ applies the EQ predicate on the "set_content_json" field.
func SetContentJSONEQ(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetContentJSON, v))
// ContentJSONSetEQ applies the EQ predicate on the "content_json_set" field.
func ContentJSONSetEQ(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldContentJSONSet, v))
}
// SetContentJSONNEQ applies the NEQ predicate on the "set_content_json" field.
func SetContentJSONNEQ(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNEQ(FieldSetContentJSON, v))
// ContentJSONSetNEQ applies the NEQ predicate on the "content_json_set" field.
func ContentJSONSetNEQ(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNEQ(FieldContentJSONSet, v))
}
// SetContentJSONIn applies the In predicate on the "set_content_json" field.
func SetContentJSONIn(vs ...string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldIn(FieldSetContentJSON, vs...))
// ContentJSONSetIn applies the In predicate on the "content_json_set" field.
func ContentJSONSetIn(vs ...string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldIn(FieldContentJSONSet, vs...))
}
// SetContentJSONNotIn applies the NotIn predicate on the "set_content_json" field.
func SetContentJSONNotIn(vs ...string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNotIn(FieldSetContentJSON, vs...))
// ContentJSONSetNotIn applies the NotIn predicate on the "content_json_set" field.
func ContentJSONSetNotIn(vs ...string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNotIn(FieldContentJSONSet, vs...))
}
// SetContentJSONGT applies the GT predicate on the "set_content_json" field.
func SetContentJSONGT(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGT(FieldSetContentJSON, v))
// ContentJSONSetGT applies the GT predicate on the "content_json_set" field.
func ContentJSONSetGT(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGT(FieldContentJSONSet, v))
}
// SetContentJSONGTE applies the GTE predicate on the "set_content_json" field.
func SetContentJSONGTE(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGTE(FieldSetContentJSON, v))
// ContentJSONSetGTE applies the GTE predicate on the "content_json_set" field.
func ContentJSONSetGTE(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGTE(FieldContentJSONSet, v))
}
// SetContentJSONLT applies the LT predicate on the "set_content_json" field.
func SetContentJSONLT(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLT(FieldSetContentJSON, v))
// ContentJSONSetLT applies the LT predicate on the "content_json_set" field.
func ContentJSONSetLT(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLT(FieldContentJSONSet, v))
}
// SetContentJSONLTE applies the LTE predicate on the "set_content_json" field.
func SetContentJSONLTE(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLTE(FieldSetContentJSON, v))
// ContentJSONSetLTE applies the LTE predicate on the "content_json_set" field.
func ContentJSONSetLTE(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLTE(FieldContentJSONSet, v))
}
// SetContentJSONContains applies the Contains predicate on the "set_content_json" field.
func SetContentJSONContains(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldContains(FieldSetContentJSON, v))
// ContentJSONSetContains applies the Contains predicate on the "content_json_set" field.
func ContentJSONSetContains(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldContains(FieldContentJSONSet, v))
}
// SetContentJSONHasPrefix applies the HasPrefix predicate on the "set_content_json" field.
func SetContentJSONHasPrefix(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldHasPrefix(FieldSetContentJSON, v))
// ContentJSONSetHasPrefix applies the HasPrefix predicate on the "content_json_set" field.
func ContentJSONSetHasPrefix(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldHasPrefix(FieldContentJSONSet, v))
}
// SetContentJSONHasSuffix applies the HasSuffix predicate on the "set_content_json" field.
func SetContentJSONHasSuffix(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldHasSuffix(FieldSetContentJSON, v))
// ContentJSONSetHasSuffix applies the HasSuffix predicate on the "content_json_set" field.
func ContentJSONSetHasSuffix(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldHasSuffix(FieldContentJSONSet, v))
}
// SetContentJSONEqualFold applies the EqualFold predicate on the "set_content_json" field.
func SetContentJSONEqualFold(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEqualFold(FieldSetContentJSON, v))
// ContentJSONSetEqualFold applies the EqualFold predicate on the "content_json_set" field.
func ContentJSONSetEqualFold(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEqualFold(FieldContentJSONSet, v))
}
// SetContentJSONContainsFold applies the ContainsFold predicate on the "set_content_json" field.
func SetContentJSONContainsFold(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldContainsFold(FieldSetContentJSON, v))
// ContentJSONSetContainsFold applies the ContainsFold predicate on the "content_json_set" field.
func ContentJSONSetContainsFold(v string) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldContainsFold(FieldContentJSONSet, v))
}
// SetUpdateTimeEQ applies the EQ predicate on the "set_update_time" field.
func SetUpdateTimeEQ(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldSetUpdateTime, v))
// UpdateTimeSetEQ applies the EQ predicate on the "update_time_set" field.
func UpdateTimeSetEQ(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldEQ(FieldUpdateTimeSet, v))
}
// SetUpdateTimeNEQ applies the NEQ predicate on the "set_update_time" field.
func SetUpdateTimeNEQ(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNEQ(FieldSetUpdateTime, v))
// UpdateTimeSetNEQ applies the NEQ predicate on the "update_time_set" field.
func UpdateTimeSetNEQ(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNEQ(FieldUpdateTimeSet, v))
}
// SetUpdateTimeIn applies the In predicate on the "set_update_time" field.
func SetUpdateTimeIn(vs ...time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldIn(FieldSetUpdateTime, vs...))
// UpdateTimeSetIn applies the In predicate on the "update_time_set" field.
func UpdateTimeSetIn(vs ...time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldIn(FieldUpdateTimeSet, vs...))
}
// SetUpdateTimeNotIn applies the NotIn predicate on the "set_update_time" field.
func SetUpdateTimeNotIn(vs ...time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNotIn(FieldSetUpdateTime, vs...))
// UpdateTimeSetNotIn applies the NotIn predicate on the "update_time_set" field.
func UpdateTimeSetNotIn(vs ...time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNotIn(FieldUpdateTimeSet, vs...))
}
// SetUpdateTimeGT applies the GT predicate on the "set_update_time" field.
func SetUpdateTimeGT(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGT(FieldSetUpdateTime, v))
// UpdateTimeSetGT applies the GT predicate on the "update_time_set" field.
func UpdateTimeSetGT(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGT(FieldUpdateTimeSet, v))
}
// SetUpdateTimeGTE applies the GTE predicate on the "set_update_time" field.
func SetUpdateTimeGTE(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGTE(FieldSetUpdateTime, v))
// UpdateTimeSetGTE applies the GTE predicate on the "update_time_set" field.
func UpdateTimeSetGTE(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldGTE(FieldUpdateTimeSet, v))
}
// SetUpdateTimeLT applies the LT predicate on the "set_update_time" field.
func SetUpdateTimeLT(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLT(FieldSetUpdateTime, v))
// UpdateTimeSetLT applies the LT predicate on the "update_time_set" field.
func UpdateTimeSetLT(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLT(FieldUpdateTimeSet, v))
}
// SetUpdateTimeLTE applies the LTE predicate on the "set_update_time" field.
func SetUpdateTimeLTE(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLTE(FieldSetUpdateTime, v))
// UpdateTimeSetLTE applies the LTE predicate on the "update_time_set" field.
func UpdateTimeSetLTE(v time.Time) predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldLTE(FieldUpdateTimeSet, v))
}
// SetUpdateTimeIsNil applies the IsNil predicate on the "set_update_time" field.
func SetUpdateTimeIsNil() predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldIsNull(FieldSetUpdateTime))
// UpdateTimeSetIsNil applies the IsNil predicate on the "update_time_set" field.
func UpdateTimeSetIsNil() predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldIsNull(FieldUpdateTimeSet))
}
// SetUpdateTimeNotNil applies the NotNil predicate on the "set_update_time" field.
func SetUpdateTimeNotNil() predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNotNull(FieldSetUpdateTime))
// UpdateTimeSetNotNil applies the NotNil predicate on the "update_time_set" field.
func UpdateTimeSetNotNil() predicate.EpicHeroInfo {
return predicate.EpicHeroInfo(sql.FieldNotNull(FieldUpdateTimeSet))
}
// And groups predicates with the AND operator between them.

View File

@@ -132,22 +132,22 @@ func (_c *EpicHeroInfoCreate) SetRawJSON(v string) *EpicHeroInfoCreate {
return _c
}
// SetSetContentJSON sets the "set_content_json" field.
func (_c *EpicHeroInfoCreate) SetSetContentJSON(v string) *EpicHeroInfoCreate {
_c.mutation.SetSetContentJSON(v)
// SetContentJSONSet sets the "content_json_set" field.
func (_c *EpicHeroInfoCreate) SetContentJSONSet(v string) *EpicHeroInfoCreate {
_c.mutation.SetContentJSONSet(v)
return _c
}
// SetSetUpdateTime sets the "set_update_time" field.
func (_c *EpicHeroInfoCreate) SetSetUpdateTime(v time.Time) *EpicHeroInfoCreate {
_c.mutation.SetSetUpdateTime(v)
// SetUpdateTimeSet sets the "update_time_set" field.
func (_c *EpicHeroInfoCreate) SetUpdateTimeSet(v time.Time) *EpicHeroInfoCreate {
_c.mutation.SetUpdateTimeSet(v)
return _c
}
// SetNillableSetUpdateTime sets the "set_update_time" field if the given value is not nil.
func (_c *EpicHeroInfoCreate) SetNillableSetUpdateTime(v *time.Time) *EpicHeroInfoCreate {
// SetNillableUpdateTimeSet sets the "update_time_set" field if the given value is not nil.
func (_c *EpicHeroInfoCreate) SetNillableUpdateTimeSet(v *time.Time) *EpicHeroInfoCreate {
if v != nil {
_c.SetSetUpdateTime(*v)
_c.SetUpdateTimeSet(*v)
}
return _c
}
@@ -299,12 +299,12 @@ func (_c *EpicHeroInfoCreate) check() error {
return &ValidationError{Name: "raw_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.raw_json": %w`, err)}
}
}
if _, ok := _c.mutation.SetContentJSON(); !ok {
return &ValidationError{Name: "set_content_json", err: errors.New(`ent: missing required field "EpicHeroInfo.set_content_json"`)}
if _, ok := _c.mutation.ContentJSONSet(); !ok {
return &ValidationError{Name: "content_json_set", err: errors.New(`ent: missing required field "EpicHeroInfo.content_json_set"`)}
}
if v, ok := _c.mutation.SetContentJSON(); ok {
if err := epicheroinfo.SetContentJSONValidator(v); err != nil {
return &ValidationError{Name: "set_content_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.set_content_json": %w`, err)}
if v, ok := _c.mutation.ContentJSONSet(); ok {
if err := epicheroinfo.ContentJSONSetValidator(v); err != nil {
return &ValidationError{Name: "content_json_set", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.content_json_set": %w`, err)}
}
}
return nil
@@ -403,13 +403,13 @@ func (_c *EpicHeroInfoCreate) createSpec() (*EpicHeroInfo, *sqlgraph.CreateSpec)
_spec.SetField(epicheroinfo.FieldRawJSON, field.TypeString, value)
_node.RawJSON = value
}
if value, ok := _c.mutation.SetContentJSON(); ok {
_spec.SetField(epicheroinfo.FieldSetContentJSON, field.TypeString, value)
_node.SetContentJSON = value
if value, ok := _c.mutation.ContentJSONSet(); ok {
_spec.SetField(epicheroinfo.FieldContentJSONSet, field.TypeString, value)
_node.ContentJSONSet = value
}
if value, ok := _c.mutation.SetUpdateTime(); ok {
_spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value)
_node.SetUpdateTime = &value
if value, ok := _c.mutation.UpdateTimeSet(); ok {
_spec.SetField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime, value)
_node.UpdateTimeSet = &value
}
return _node, _spec
}

View File

@@ -264,37 +264,37 @@ func (_u *EpicHeroInfoUpdate) SetNillableRawJSON(v *string) *EpicHeroInfoUpdate
return _u
}
// SetSetContentJSON sets the "set_content_json" field.
func (_u *EpicHeroInfoUpdate) SetSetContentJSON(v string) *EpicHeroInfoUpdate {
_u.mutation.SetSetContentJSON(v)
// SetContentJSONSet sets the "content_json_set" field.
func (_u *EpicHeroInfoUpdate) SetContentJSONSet(v string) *EpicHeroInfoUpdate {
_u.mutation.SetContentJSONSet(v)
return _u
}
// SetNillableSetContentJSON sets the "set_content_json" field if the given value is not nil.
func (_u *EpicHeroInfoUpdate) SetNillableSetContentJSON(v *string) *EpicHeroInfoUpdate {
// SetNillableContentJSONSet sets the "content_json_set" field if the given value is not nil.
func (_u *EpicHeroInfoUpdate) SetNillableContentJSONSet(v *string) *EpicHeroInfoUpdate {
if v != nil {
_u.SetSetContentJSON(*v)
_u.SetContentJSONSet(*v)
}
return _u
}
// SetSetUpdateTime sets the "set_update_time" field.
func (_u *EpicHeroInfoUpdate) SetSetUpdateTime(v time.Time) *EpicHeroInfoUpdate {
_u.mutation.SetSetUpdateTime(v)
// SetUpdateTimeSet sets the "update_time_set" field.
func (_u *EpicHeroInfoUpdate) SetUpdateTimeSet(v time.Time) *EpicHeroInfoUpdate {
_u.mutation.SetUpdateTimeSet(v)
return _u
}
// SetNillableSetUpdateTime sets the "set_update_time" field if the given value is not nil.
func (_u *EpicHeroInfoUpdate) SetNillableSetUpdateTime(v *time.Time) *EpicHeroInfoUpdate {
// SetNillableUpdateTimeSet sets the "update_time_set" field if the given value is not nil.
func (_u *EpicHeroInfoUpdate) SetNillableUpdateTimeSet(v *time.Time) *EpicHeroInfoUpdate {
if v != nil {
_u.SetSetUpdateTime(*v)
_u.SetUpdateTimeSet(*v)
}
return _u
}
// ClearSetUpdateTime clears the value of the "set_update_time" field.
func (_u *EpicHeroInfoUpdate) ClearSetUpdateTime() *EpicHeroInfoUpdate {
_u.mutation.ClearSetUpdateTime()
// ClearUpdateTimeSet clears the value of the "update_time_set" field.
func (_u *EpicHeroInfoUpdate) ClearUpdateTimeSet() *EpicHeroInfoUpdate {
_u.mutation.ClearUpdateTimeSet()
return _u
}
@@ -397,9 +397,9 @@ func (_u *EpicHeroInfoUpdate) check() error {
return &ValidationError{Name: "raw_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.raw_json": %w`, err)}
}
}
if v, ok := _u.mutation.SetContentJSON(); ok {
if err := epicheroinfo.SetContentJSONValidator(v); err != nil {
return &ValidationError{Name: "set_content_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.set_content_json": %w`, err)}
if v, ok := _u.mutation.ContentJSONSet(); ok {
if err := epicheroinfo.ContentJSONSetValidator(v); err != nil {
return &ValidationError{Name: "content_json_set", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.content_json_set": %w`, err)}
}
}
return nil
@@ -471,14 +471,14 @@ func (_u *EpicHeroInfoUpdate) sqlSave(ctx context.Context) (_node int, err error
if value, ok := _u.mutation.RawJSON(); ok {
_spec.SetField(epicheroinfo.FieldRawJSON, field.TypeString, value)
}
if value, ok := _u.mutation.SetContentJSON(); ok {
_spec.SetField(epicheroinfo.FieldSetContentJSON, field.TypeString, value)
if value, ok := _u.mutation.ContentJSONSet(); ok {
_spec.SetField(epicheroinfo.FieldContentJSONSet, field.TypeString, value)
}
if value, ok := _u.mutation.SetUpdateTime(); ok {
_spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value)
if value, ok := _u.mutation.UpdateTimeSet(); ok {
_spec.SetField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime, value)
}
if _u.mutation.SetUpdateTimeCleared() {
_spec.ClearField(epicheroinfo.FieldSetUpdateTime, field.TypeTime)
if _u.mutation.UpdateTimeSetCleared() {
_spec.ClearField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime)
}
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
@@ -736,37 +736,37 @@ func (_u *EpicHeroInfoUpdateOne) SetNillableRawJSON(v *string) *EpicHeroInfoUpda
return _u
}
// SetSetContentJSON sets the "set_content_json" field.
func (_u *EpicHeroInfoUpdateOne) SetSetContentJSON(v string) *EpicHeroInfoUpdateOne {
_u.mutation.SetSetContentJSON(v)
// SetContentJSONSet sets the "content_json_set" field.
func (_u *EpicHeroInfoUpdateOne) SetContentJSONSet(v string) *EpicHeroInfoUpdateOne {
_u.mutation.SetContentJSONSet(v)
return _u
}
// SetNillableSetContentJSON sets the "set_content_json" field if the given value is not nil.
func (_u *EpicHeroInfoUpdateOne) SetNillableSetContentJSON(v *string) *EpicHeroInfoUpdateOne {
// SetNillableContentJSONSet sets the "content_json_set" field if the given value is not nil.
func (_u *EpicHeroInfoUpdateOne) SetNillableContentJSONSet(v *string) *EpicHeroInfoUpdateOne {
if v != nil {
_u.SetSetContentJSON(*v)
_u.SetContentJSONSet(*v)
}
return _u
}
// SetSetUpdateTime sets the "set_update_time" field.
func (_u *EpicHeroInfoUpdateOne) SetSetUpdateTime(v time.Time) *EpicHeroInfoUpdateOne {
_u.mutation.SetSetUpdateTime(v)
// SetUpdateTimeSet sets the "update_time_set" field.
func (_u *EpicHeroInfoUpdateOne) SetUpdateTimeSet(v time.Time) *EpicHeroInfoUpdateOne {
_u.mutation.SetUpdateTimeSet(v)
return _u
}
// SetNillableSetUpdateTime sets the "set_update_time" field if the given value is not nil.
func (_u *EpicHeroInfoUpdateOne) SetNillableSetUpdateTime(v *time.Time) *EpicHeroInfoUpdateOne {
// SetNillableUpdateTimeSet sets the "update_time_set" field if the given value is not nil.
func (_u *EpicHeroInfoUpdateOne) SetNillableUpdateTimeSet(v *time.Time) *EpicHeroInfoUpdateOne {
if v != nil {
_u.SetSetUpdateTime(*v)
_u.SetUpdateTimeSet(*v)
}
return _u
}
// ClearSetUpdateTime clears the value of the "set_update_time" field.
func (_u *EpicHeroInfoUpdateOne) ClearSetUpdateTime() *EpicHeroInfoUpdateOne {
_u.mutation.ClearSetUpdateTime()
// ClearUpdateTimeSet clears the value of the "update_time_set" field.
func (_u *EpicHeroInfoUpdateOne) ClearUpdateTimeSet() *EpicHeroInfoUpdateOne {
_u.mutation.ClearUpdateTimeSet()
return _u
}
@@ -882,9 +882,9 @@ func (_u *EpicHeroInfoUpdateOne) check() error {
return &ValidationError{Name: "raw_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.raw_json": %w`, err)}
}
}
if v, ok := _u.mutation.SetContentJSON(); ok {
if err := epicheroinfo.SetContentJSONValidator(v); err != nil {
return &ValidationError{Name: "set_content_json", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.set_content_json": %w`, err)}
if v, ok := _u.mutation.ContentJSONSet(); ok {
if err := epicheroinfo.ContentJSONSetValidator(v); err != nil {
return &ValidationError{Name: "content_json_set", err: fmt.Errorf(`ent: validator failed for field "EpicHeroInfo.content_json_set": %w`, err)}
}
}
return nil
@@ -973,14 +973,14 @@ func (_u *EpicHeroInfoUpdateOne) sqlSave(ctx context.Context) (_node *EpicHeroIn
if value, ok := _u.mutation.RawJSON(); ok {
_spec.SetField(epicheroinfo.FieldRawJSON, field.TypeString, value)
}
if value, ok := _u.mutation.SetContentJSON(); ok {
_spec.SetField(epicheroinfo.FieldSetContentJSON, field.TypeString, value)
if value, ok := _u.mutation.ContentJSONSet(); ok {
_spec.SetField(epicheroinfo.FieldContentJSONSet, field.TypeString, value)
}
if value, ok := _u.mutation.SetUpdateTime(); ok {
_spec.SetField(epicheroinfo.FieldSetUpdateTime, field.TypeTime, value)
if value, ok := _u.mutation.UpdateTimeSet(); ok {
_spec.SetField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime, value)
}
if _u.mutation.SetUpdateTimeCleared() {
_spec.ClearField(epicheroinfo.FieldSetUpdateTime, field.TypeTime)
if _u.mutation.UpdateTimeSetCleared() {
_spec.ClearField(epicheroinfo.FieldUpdateTimeSet, field.TypeTime)
}
_node = &EpicHeroInfo{config: _u.config}
_spec.Assign = _node.assignValues

View File

@@ -105,8 +105,8 @@ var (
{Name: "attribute", Type: field.TypeString, Size: 255},
{Name: "remark", Type: field.TypeString, Size: 255},
{Name: "raw_json", Type: field.TypeString, Size: 255},
{Name: "set_content_json", Type: field.TypeString, Size: 255},
{Name: "set_update_time", Type: field.TypeTime, Nullable: true},
{Name: "content_json_set", Type: field.TypeString, Size: 255},
{Name: "update_time_set", Type: field.TypeTime, Nullable: true},
}
// EpicHeroInfosTable holds the schema information for the "epic_hero_infos" table.
EpicHeroInfosTable = &schema.Table{

View File

@@ -3564,8 +3564,8 @@ type EpicHeroInfoMutation struct {
attribute *string
remark *string
raw_json *string
set_content_json *string
set_update_time *time.Time
content_json_set *string
update_time_set *time.Time
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*EpicHeroInfo, error)
@@ -4278,89 +4278,89 @@ func (m *EpicHeroInfoMutation) ResetRawJSON() {
m.raw_json = nil
}
// SetSetContentJSON sets the "set_content_json" field.
func (m *EpicHeroInfoMutation) SetSetContentJSON(s string) {
m.set_content_json = &s
// SetContentJSONSet sets the "content_json_set" field.
func (m *EpicHeroInfoMutation) SetContentJSONSet(s string) {
m.content_json_set = &s
}
// SetContentJSON returns the value of the "set_content_json" field in the mutation.
func (m *EpicHeroInfoMutation) SetContentJSON() (r string, exists bool) {
v := m.set_content_json
// ContentJSONSet returns the value of the "content_json_set" field in the mutation.
func (m *EpicHeroInfoMutation) ContentJSONSet() (r string, exists bool) {
v := m.content_json_set
if v == nil {
return
}
return *v, true
}
// OldSetContentJSON returns the old "set_content_json" field's value of the EpicHeroInfo entity.
// OldContentJSONSet returns the old "content_json_set" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldSetContentJSON(ctx context.Context) (v string, err error) {
func (m *EpicHeroInfoMutation) OldContentJSONSet(ctx context.Context) (v string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSetContentJSON is only allowed on UpdateOne operations")
return v, errors.New("OldContentJSONSet is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSetContentJSON requires an ID field in the mutation")
return v, errors.New("OldContentJSONSet requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSetContentJSON: %w", err)
return v, fmt.Errorf("querying old value for OldContentJSONSet: %w", err)
}
return oldValue.SetContentJSON, nil
return oldValue.ContentJSONSet, nil
}
// ResetSetContentJSON resets all changes to the "set_content_json" field.
func (m *EpicHeroInfoMutation) ResetSetContentJSON() {
m.set_content_json = nil
// ResetContentJSONSet resets all changes to the "content_json_set" field.
func (m *EpicHeroInfoMutation) ResetContentJSONSet() {
m.content_json_set = nil
}
// SetSetUpdateTime sets the "set_update_time" field.
func (m *EpicHeroInfoMutation) SetSetUpdateTime(t time.Time) {
m.set_update_time = &t
// SetUpdateTimeSet sets the "update_time_set" field.
func (m *EpicHeroInfoMutation) SetUpdateTimeSet(t time.Time) {
m.update_time_set = &t
}
// SetUpdateTime returns the value of the "set_update_time" field in the mutation.
func (m *EpicHeroInfoMutation) SetUpdateTime() (r time.Time, exists bool) {
v := m.set_update_time
// UpdateTimeSet returns the value of the "update_time_set" field in the mutation.
func (m *EpicHeroInfoMutation) UpdateTimeSet() (r time.Time, exists bool) {
v := m.update_time_set
if v == nil {
return
}
return *v, true
}
// OldSetUpdateTime returns the old "set_update_time" field's value of the EpicHeroInfo entity.
// OldUpdateTimeSet returns the old "update_time_set" field's value of the EpicHeroInfo entity.
// If the EpicHeroInfo object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *EpicHeroInfoMutation) OldSetUpdateTime(ctx context.Context) (v *time.Time, err error) {
func (m *EpicHeroInfoMutation) OldUpdateTimeSet(ctx context.Context) (v *time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldSetUpdateTime is only allowed on UpdateOne operations")
return v, errors.New("OldUpdateTimeSet is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldSetUpdateTime requires an ID field in the mutation")
return v, errors.New("OldUpdateTimeSet requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldSetUpdateTime: %w", err)
return v, fmt.Errorf("querying old value for OldUpdateTimeSet: %w", err)
}
return oldValue.SetUpdateTime, nil
return oldValue.UpdateTimeSet, nil
}
// ClearSetUpdateTime clears the value of the "set_update_time" field.
func (m *EpicHeroInfoMutation) ClearSetUpdateTime() {
m.set_update_time = nil
m.clearedFields[epicheroinfo.FieldSetUpdateTime] = struct{}{}
// ClearUpdateTimeSet clears the value of the "update_time_set" field.
func (m *EpicHeroInfoMutation) ClearUpdateTimeSet() {
m.update_time_set = nil
m.clearedFields[epicheroinfo.FieldUpdateTimeSet] = struct{}{}
}
// SetUpdateTimeCleared returns if the "set_update_time" field was cleared in this mutation.
func (m *EpicHeroInfoMutation) SetUpdateTimeCleared() bool {
_, ok := m.clearedFields[epicheroinfo.FieldSetUpdateTime]
// UpdateTimeSetCleared returns if the "update_time_set" field was cleared in this mutation.
func (m *EpicHeroInfoMutation) UpdateTimeSetCleared() bool {
_, ok := m.clearedFields[epicheroinfo.FieldUpdateTimeSet]
return ok
}
// ResetSetUpdateTime resets all changes to the "set_update_time" field.
func (m *EpicHeroInfoMutation) ResetSetUpdateTime() {
m.set_update_time = nil
delete(m.clearedFields, epicheroinfo.FieldSetUpdateTime)
// ResetUpdateTimeSet resets all changes to the "update_time_set" field.
func (m *EpicHeroInfoMutation) ResetUpdateTimeSet() {
m.update_time_set = nil
delete(m.clearedFields, epicheroinfo.FieldUpdateTimeSet)
}
// Where appends a list predicates to the EpicHeroInfoMutation builder.
@@ -4446,11 +4446,11 @@ func (m *EpicHeroInfoMutation) Fields() []string {
if m.raw_json != nil {
fields = append(fields, epicheroinfo.FieldRawJSON)
}
if m.set_content_json != nil {
fields = append(fields, epicheroinfo.FieldSetContentJSON)
if m.content_json_set != nil {
fields = append(fields, epicheroinfo.FieldContentJSONSet)
}
if m.set_update_time != nil {
fields = append(fields, epicheroinfo.FieldSetUpdateTime)
if m.update_time_set != nil {
fields = append(fields, epicheroinfo.FieldUpdateTimeSet)
}
return fields
}
@@ -4492,10 +4492,10 @@ func (m *EpicHeroInfoMutation) Field(name string) (ent.Value, bool) {
return m.Remark()
case epicheroinfo.FieldRawJSON:
return m.RawJSON()
case epicheroinfo.FieldSetContentJSON:
return m.SetContentJSON()
case epicheroinfo.FieldSetUpdateTime:
return m.SetUpdateTime()
case epicheroinfo.FieldContentJSONSet:
return m.ContentJSONSet()
case epicheroinfo.FieldUpdateTimeSet:
return m.UpdateTimeSet()
}
return nil, false
}
@@ -4537,10 +4537,10 @@ func (m *EpicHeroInfoMutation) OldField(ctx context.Context, name string) (ent.V
return m.OldRemark(ctx)
case epicheroinfo.FieldRawJSON:
return m.OldRawJSON(ctx)
case epicheroinfo.FieldSetContentJSON:
return m.OldSetContentJSON(ctx)
case epicheroinfo.FieldSetUpdateTime:
return m.OldSetUpdateTime(ctx)
case epicheroinfo.FieldContentJSONSet:
return m.OldContentJSONSet(ctx)
case epicheroinfo.FieldUpdateTimeSet:
return m.OldUpdateTimeSet(ctx)
}
return nil, fmt.Errorf("unknown EpicHeroInfo field %s", name)
}
@@ -4662,19 +4662,19 @@ func (m *EpicHeroInfoMutation) SetField(name string, value ent.Value) error {
}
m.SetRawJSON(v)
return nil
case epicheroinfo.FieldSetContentJSON:
case epicheroinfo.FieldContentJSONSet:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSetContentJSON(v)
m.SetContentJSONSet(v)
return nil
case epicheroinfo.FieldSetUpdateTime:
case epicheroinfo.FieldUpdateTimeSet:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSetUpdateTime(v)
m.SetUpdateTimeSet(v)
return nil
}
return fmt.Errorf("unknown EpicHeroInfo field %s", name)
@@ -4712,8 +4712,8 @@ func (m *EpicHeroInfoMutation) ClearedFields() []string {
if m.FieldCleared(epicheroinfo.FieldUpdateTime) {
fields = append(fields, epicheroinfo.FieldUpdateTime)
}
if m.FieldCleared(epicheroinfo.FieldSetUpdateTime) {
fields = append(fields, epicheroinfo.FieldSetUpdateTime)
if m.FieldCleared(epicheroinfo.FieldUpdateTimeSet) {
fields = append(fields, epicheroinfo.FieldUpdateTimeSet)
}
return fields
}
@@ -4735,8 +4735,8 @@ func (m *EpicHeroInfoMutation) ClearField(name string) error {
case epicheroinfo.FieldUpdateTime:
m.ClearUpdateTime()
return nil
case epicheroinfo.FieldSetUpdateTime:
m.ClearSetUpdateTime()
case epicheroinfo.FieldUpdateTimeSet:
m.ClearUpdateTimeSet()
return nil
}
return fmt.Errorf("unknown EpicHeroInfo nullable field %s", name)
@@ -4794,11 +4794,11 @@ func (m *EpicHeroInfoMutation) ResetField(name string) error {
case epicheroinfo.FieldRawJSON:
m.ResetRawJSON()
return nil
case epicheroinfo.FieldSetContentJSON:
m.ResetSetContentJSON()
case epicheroinfo.FieldContentJSONSet:
m.ResetContentJSONSet()
return nil
case epicheroinfo.FieldSetUpdateTime:
m.ResetSetUpdateTime()
case epicheroinfo.FieldUpdateTimeSet:
m.ResetUpdateTimeSet()
return nil
}
return fmt.Errorf("unknown EpicHeroInfo field %s", name)

View File

@@ -165,10 +165,10 @@ func init() {
epicheroinfoDescRawJSON := epicheroinfoFields[16].Descriptor()
// epicheroinfo.RawJSONValidator is a validator for the "raw_json" field. It is called by the builders before save.
epicheroinfo.RawJSONValidator = epicheroinfoDescRawJSON.Validators[0].(func(string) error)
// epicheroinfoDescSetContentJSON is the schema descriptor for set_content_json field.
epicheroinfoDescSetContentJSON := epicheroinfoFields[17].Descriptor()
// epicheroinfo.SetContentJSONValidator is a validator for the "set_content_json" field. It is called by the builders before save.
epicheroinfo.SetContentJSONValidator = epicheroinfoDescSetContentJSON.Validators[0].(func(string) error)
// epicheroinfoDescContentJSONSet is the schema descriptor for content_json_set field.
epicheroinfoDescContentJSONSet := epicheroinfoFields[17].Descriptor()
// epicheroinfo.ContentJSONSetValidator is a validator for the "content_json_set" field. It is called by the builders before save.
epicheroinfo.ContentJSONSetValidator = epicheroinfoDescContentJSONSet.Validators[0].(func(string) error)
epicherouserbuildFields := entity.EpicHeroUserBuild{}.Fields()
_ = epicherouserbuildFields
// epicherouserbuildDescArtifactCode is the schema descriptor for artifact_code field.