Compare commits
4 commits
master
...
schema_upd
Author | SHA1 | Date | |
---|---|---|---|
|
e14a58d5c1 | ||
|
893be19257 | ||
|
1589a47083 | ||
|
142108529d |
49 changed files with 235 additions and 1099 deletions
|
@ -795,6 +795,13 @@ func (c *Client) CreateAlert(machineID string, alertList []*models.Alert) ([]str
|
|||
alertIDs = append(alertIDs, ids...)
|
||||
}
|
||||
|
||||
if owner != nil {
|
||||
err = owner.Update().SetLastPush(time.Now().UTC()).Exec(c.CTX)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("machine '%s': %w", machineID, err)
|
||||
}
|
||||
}
|
||||
|
||||
return alertIDs, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ type Alert struct {
|
|||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||
// Scenario holds the value of the "scenario" field.
|
||||
Scenario string `json:"scenario,omitempty"`
|
||||
// BucketId holds the value of the "bucketId" field.
|
||||
|
@ -168,15 +168,13 @@ func (a *Alert) assignValues(columns []string, values []any) error {
|
|||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
} else if value.Valid {
|
||||
a.CreatedAt = new(time.Time)
|
||||
*a.CreatedAt = value.Time
|
||||
a.CreatedAt = value.Time
|
||||
}
|
||||
case alert.FieldUpdatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||
} else if value.Valid {
|
||||
a.UpdatedAt = new(time.Time)
|
||||
*a.UpdatedAt = value.Time
|
||||
a.UpdatedAt = value.Time
|
||||
}
|
||||
case alert.FieldScenario:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
|
@ -367,15 +365,11 @@ func (a *Alert) String() string {
|
|||
var builder strings.Builder
|
||||
builder.WriteString("Alert(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", a.ID))
|
||||
if v := a.CreatedAt; v != nil {
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(a.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := a.UpdatedAt; v != nil {
|
||||
builder.WriteString("updated_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(a.UpdatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("scenario=")
|
||||
builder.WriteString(a.Scenario)
|
||||
|
|
|
@ -152,8 +152,6 @@ func ValidColumn(column string) bool {
|
|||
var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
|
||||
UpdateDefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
|
|
|
@ -210,16 +210,6 @@ func CreatedAtLTE(v time.Time) predicate.Alert {
|
|||
return predicate.Alert(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.Alert {
|
||||
return predicate.Alert(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.Alert {
|
||||
return predicate.Alert(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.Alert {
|
||||
return predicate.Alert(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
|
@ -260,16 +250,6 @@ func UpdatedAtLTE(v time.Time) predicate.Alert {
|
|||
return predicate.Alert(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.Alert {
|
||||
return predicate.Alert(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.Alert {
|
||||
return predicate.Alert(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// ScenarioEQ applies the EQ predicate on the "scenario" field.
|
||||
func ScenarioEQ(v string) predicate.Alert {
|
||||
return predicate.Alert(sql.FieldEQ(FieldScenario, v))
|
||||
|
|
|
@ -473,6 +473,12 @@ func (ac *AlertCreate) defaults() {
|
|||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (ac *AlertCreate) check() error {
|
||||
if _, ok := ac.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Alert.created_at"`)}
|
||||
}
|
||||
if _, ok := ac.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Alert.updated_at"`)}
|
||||
}
|
||||
if _, ok := ac.mutation.Scenario(); !ok {
|
||||
return &ValidationError{Name: "scenario", err: errors.New(`ent: missing required field "Alert.scenario"`)}
|
||||
}
|
||||
|
@ -507,11 +513,11 @@ func (ac *AlertCreate) createSpec() (*Alert, *sqlgraph.CreateSpec) {
|
|||
)
|
||||
if value, ok := ac.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(alert.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = &value
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := ac.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value)
|
||||
_node.UpdatedAt = &value
|
||||
_node.UpdatedAt = value
|
||||
}
|
||||
if value, ok := ac.mutation.Scenario(); ok {
|
||||
_spec.SetField(alert.FieldScenario, field.TypeString, value)
|
||||
|
|
|
@ -32,30 +32,12 @@ func (au *AlertUpdate) Where(ps ...predicate.Alert) *AlertUpdate {
|
|||
return au
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (au *AlertUpdate) SetCreatedAt(t time.Time) *AlertUpdate {
|
||||
au.mutation.SetCreatedAt(t)
|
||||
return au
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (au *AlertUpdate) ClearCreatedAt() *AlertUpdate {
|
||||
au.mutation.ClearCreatedAt()
|
||||
return au
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (au *AlertUpdate) SetUpdatedAt(t time.Time) *AlertUpdate {
|
||||
au.mutation.SetUpdatedAt(t)
|
||||
return au
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (au *AlertUpdate) ClearUpdatedAt() *AlertUpdate {
|
||||
au.mutation.ClearUpdatedAt()
|
||||
return au
|
||||
}
|
||||
|
||||
// SetScenario sets the "scenario" field.
|
||||
func (au *AlertUpdate) SetScenario(s string) *AlertUpdate {
|
||||
au.mutation.SetScenario(s)
|
||||
|
@ -660,11 +642,7 @@ func (au *AlertUpdate) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (au *AlertUpdate) defaults() {
|
||||
if _, ok := au.mutation.CreatedAt(); !ok && !au.mutation.CreatedAtCleared() {
|
||||
v := alert.UpdateDefaultCreatedAt()
|
||||
au.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := au.mutation.UpdatedAt(); !ok && !au.mutation.UpdatedAtCleared() {
|
||||
if _, ok := au.mutation.UpdatedAt(); !ok {
|
||||
v := alert.UpdateDefaultUpdatedAt()
|
||||
au.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -679,18 +657,9 @@ func (au *AlertUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := au.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(alert.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if au.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(alert.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := au.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if au.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(alert.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := au.mutation.Scenario(); ok {
|
||||
_spec.SetField(alert.FieldScenario, field.TypeString, value)
|
||||
}
|
||||
|
@ -1007,30 +976,12 @@ type AlertUpdateOne struct {
|
|||
mutation *AlertMutation
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (auo *AlertUpdateOne) SetCreatedAt(t time.Time) *AlertUpdateOne {
|
||||
auo.mutation.SetCreatedAt(t)
|
||||
return auo
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (auo *AlertUpdateOne) ClearCreatedAt() *AlertUpdateOne {
|
||||
auo.mutation.ClearCreatedAt()
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (auo *AlertUpdateOne) SetUpdatedAt(t time.Time) *AlertUpdateOne {
|
||||
auo.mutation.SetUpdatedAt(t)
|
||||
return auo
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (auo *AlertUpdateOne) ClearUpdatedAt() *AlertUpdateOne {
|
||||
auo.mutation.ClearUpdatedAt()
|
||||
return auo
|
||||
}
|
||||
|
||||
// SetScenario sets the "scenario" field.
|
||||
func (auo *AlertUpdateOne) SetScenario(s string) *AlertUpdateOne {
|
||||
auo.mutation.SetScenario(s)
|
||||
|
@ -1648,11 +1599,7 @@ func (auo *AlertUpdateOne) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (auo *AlertUpdateOne) defaults() {
|
||||
if _, ok := auo.mutation.CreatedAt(); !ok && !auo.mutation.CreatedAtCleared() {
|
||||
v := alert.UpdateDefaultCreatedAt()
|
||||
auo.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := auo.mutation.UpdatedAt(); !ok && !auo.mutation.UpdatedAtCleared() {
|
||||
if _, ok := auo.mutation.UpdatedAt(); !ok {
|
||||
v := alert.UpdateDefaultUpdatedAt()
|
||||
auo.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -1684,18 +1631,9 @@ func (auo *AlertUpdateOne) sqlSave(ctx context.Context) (_node *Alert, err error
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := auo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(alert.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if auo.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(alert.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := auo.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(alert.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if auo.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(alert.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := auo.mutation.Scenario(); ok {
|
||||
_spec.SetField(alert.FieldScenario, field.TypeString, value)
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ type Bouncer struct {
|
|||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
// Name holds the value of the "name" field.
|
||||
Name string `json:"name"`
|
||||
// APIKey holds the value of the "api_key" field.
|
||||
|
@ -80,15 +80,13 @@ func (b *Bouncer) assignValues(columns []string, values []any) error {
|
|||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
} else if value.Valid {
|
||||
b.CreatedAt = new(time.Time)
|
||||
*b.CreatedAt = value.Time
|
||||
b.CreatedAt = value.Time
|
||||
}
|
||||
case bouncer.FieldUpdatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||
} else if value.Valid {
|
||||
b.UpdatedAt = new(time.Time)
|
||||
*b.UpdatedAt = value.Time
|
||||
b.UpdatedAt = value.Time
|
||||
}
|
||||
case bouncer.FieldName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
|
@ -180,15 +178,11 @@ func (b *Bouncer) String() string {
|
|||
var builder strings.Builder
|
||||
builder.WriteString("Bouncer(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", b.ID))
|
||||
if v := b.CreatedAt; v != nil {
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(b.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := b.UpdatedAt; v != nil {
|
||||
builder.WriteString("updated_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(b.UpdatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("name=")
|
||||
builder.WriteString(b.Name)
|
||||
|
|
|
@ -68,8 +68,6 @@ func ValidColumn(column string) bool {
|
|||
var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
|
||||
UpdateDefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
|
|
|
@ -149,16 +149,6 @@ func CreatedAtLTE(v time.Time) predicate.Bouncer {
|
|||
return predicate.Bouncer(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.Bouncer {
|
||||
return predicate.Bouncer(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.Bouncer {
|
||||
return predicate.Bouncer(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.Bouncer {
|
||||
return predicate.Bouncer(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
|
@ -199,16 +189,6 @@ func UpdatedAtLTE(v time.Time) predicate.Bouncer {
|
|||
return predicate.Bouncer(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.Bouncer {
|
||||
return predicate.Bouncer(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.Bouncer {
|
||||
return predicate.Bouncer(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.Bouncer {
|
||||
return predicate.Bouncer(sql.FieldEQ(FieldName, v))
|
||||
|
|
|
@ -213,6 +213,12 @@ func (bc *BouncerCreate) defaults() {
|
|||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (bc *BouncerCreate) check() error {
|
||||
if _, ok := bc.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Bouncer.created_at"`)}
|
||||
}
|
||||
if _, ok := bc.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Bouncer.updated_at"`)}
|
||||
}
|
||||
if _, ok := bc.mutation.Name(); !ok {
|
||||
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Bouncer.name"`)}
|
||||
}
|
||||
|
@ -256,11 +262,11 @@ func (bc *BouncerCreate) createSpec() (*Bouncer, *sqlgraph.CreateSpec) {
|
|||
)
|
||||
if value, ok := bc.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(bouncer.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = &value
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := bc.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value)
|
||||
_node.UpdatedAt = &value
|
||||
_node.UpdatedAt = value
|
||||
}
|
||||
if value, ok := bc.mutation.Name(); ok {
|
||||
_spec.SetField(bouncer.FieldName, field.TypeString, value)
|
||||
|
|
|
@ -34,9 +34,11 @@ func (bu *BouncerUpdate) SetCreatedAt(t time.Time) *BouncerUpdate {
|
|||
return bu
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (bu *BouncerUpdate) ClearCreatedAt() *BouncerUpdate {
|
||||
bu.mutation.ClearCreatedAt()
|
||||
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||||
func (bu *BouncerUpdate) SetNillableCreatedAt(t *time.Time) *BouncerUpdate {
|
||||
if t != nil {
|
||||
bu.SetCreatedAt(*t)
|
||||
}
|
||||
return bu
|
||||
}
|
||||
|
||||
|
@ -46,12 +48,6 @@ func (bu *BouncerUpdate) SetUpdatedAt(t time.Time) *BouncerUpdate {
|
|||
return bu
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (bu *BouncerUpdate) ClearUpdatedAt() *BouncerUpdate {
|
||||
bu.mutation.ClearUpdatedAt()
|
||||
return bu
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (bu *BouncerUpdate) SetName(s string) *BouncerUpdate {
|
||||
bu.mutation.SetName(s)
|
||||
|
@ -237,11 +233,7 @@ func (bu *BouncerUpdate) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (bu *BouncerUpdate) defaults() {
|
||||
if _, ok := bu.mutation.CreatedAt(); !ok && !bu.mutation.CreatedAtCleared() {
|
||||
v := bouncer.UpdateDefaultCreatedAt()
|
||||
bu.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := bu.mutation.UpdatedAt(); !ok && !bu.mutation.UpdatedAtCleared() {
|
||||
if _, ok := bu.mutation.UpdatedAt(); !ok {
|
||||
v := bouncer.UpdateDefaultUpdatedAt()
|
||||
bu.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -259,15 +251,9 @@ func (bu *BouncerUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
if value, ok := bu.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(bouncer.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if bu.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(bouncer.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := bu.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if bu.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(bouncer.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := bu.mutation.Name(); ok {
|
||||
_spec.SetField(bouncer.FieldName, field.TypeString, value)
|
||||
}
|
||||
|
@ -333,9 +319,11 @@ func (buo *BouncerUpdateOne) SetCreatedAt(t time.Time) *BouncerUpdateOne {
|
|||
return buo
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (buo *BouncerUpdateOne) ClearCreatedAt() *BouncerUpdateOne {
|
||||
buo.mutation.ClearCreatedAt()
|
||||
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||||
func (buo *BouncerUpdateOne) SetNillableCreatedAt(t *time.Time) *BouncerUpdateOne {
|
||||
if t != nil {
|
||||
buo.SetCreatedAt(*t)
|
||||
}
|
||||
return buo
|
||||
}
|
||||
|
||||
|
@ -345,12 +333,6 @@ func (buo *BouncerUpdateOne) SetUpdatedAt(t time.Time) *BouncerUpdateOne {
|
|||
return buo
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (buo *BouncerUpdateOne) ClearUpdatedAt() *BouncerUpdateOne {
|
||||
buo.mutation.ClearUpdatedAt()
|
||||
return buo
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (buo *BouncerUpdateOne) SetName(s string) *BouncerUpdateOne {
|
||||
buo.mutation.SetName(s)
|
||||
|
@ -549,11 +531,7 @@ func (buo *BouncerUpdateOne) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (buo *BouncerUpdateOne) defaults() {
|
||||
if _, ok := buo.mutation.CreatedAt(); !ok && !buo.mutation.CreatedAtCleared() {
|
||||
v := bouncer.UpdateDefaultCreatedAt()
|
||||
buo.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := buo.mutation.UpdatedAt(); !ok && !buo.mutation.UpdatedAtCleared() {
|
||||
if _, ok := buo.mutation.UpdatedAt(); !ok {
|
||||
v := bouncer.UpdateDefaultUpdatedAt()
|
||||
buo.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -588,15 +566,9 @@ func (buo *BouncerUpdateOne) sqlSave(ctx context.Context) (_node *Bouncer, err e
|
|||
if value, ok := buo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(bouncer.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if buo.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(bouncer.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := buo.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(bouncer.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if buo.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(bouncer.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := buo.mutation.Name(); ok {
|
||||
_spec.SetField(bouncer.FieldName, field.TypeString, value)
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ type ConfigItem struct {
|
|||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt *time.Time `json:"created_at"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
UpdatedAt *time.Time `json:"updated_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
// Name holds the value of the "name" field.
|
||||
Name string `json:"name"`
|
||||
// Value holds the value of the "value" field.
|
||||
|
@ -64,15 +64,13 @@ func (ci *ConfigItem) assignValues(columns []string, values []any) error {
|
|||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
} else if value.Valid {
|
||||
ci.CreatedAt = new(time.Time)
|
||||
*ci.CreatedAt = value.Time
|
||||
ci.CreatedAt = value.Time
|
||||
}
|
||||
case configitem.FieldUpdatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||
} else if value.Valid {
|
||||
ci.UpdatedAt = new(time.Time)
|
||||
*ci.UpdatedAt = value.Time
|
||||
ci.UpdatedAt = value.Time
|
||||
}
|
||||
case configitem.FieldName:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
|
@ -122,15 +120,11 @@ func (ci *ConfigItem) String() string {
|
|||
var builder strings.Builder
|
||||
builder.WriteString("ConfigItem(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", ci.ID))
|
||||
if v := ci.CreatedAt; v != nil {
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(ci.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := ci.UpdatedAt; v != nil {
|
||||
builder.WriteString("updated_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(ci.UpdatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("name=")
|
||||
builder.WriteString(ci.Name)
|
||||
|
|
|
@ -47,8 +47,6 @@ func ValidColumn(column string) bool {
|
|||
var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
|
||||
UpdateDefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
|
|
|
@ -114,16 +114,6 @@ func CreatedAtLTE(v time.Time) predicate.ConfigItem {
|
|||
return predicate.ConfigItem(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.ConfigItem {
|
||||
return predicate.ConfigItem(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.ConfigItem {
|
||||
return predicate.ConfigItem(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.ConfigItem {
|
||||
return predicate.ConfigItem(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
|
@ -164,16 +154,6 @@ func UpdatedAtLTE(v time.Time) predicate.ConfigItem {
|
|||
return predicate.ConfigItem(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.ConfigItem {
|
||||
return predicate.ConfigItem(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.ConfigItem {
|
||||
return predicate.ConfigItem(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.ConfigItem {
|
||||
return predicate.ConfigItem(sql.FieldEQ(FieldName, v))
|
||||
|
|
|
@ -107,6 +107,12 @@ func (cic *ConfigItemCreate) defaults() {
|
|||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (cic *ConfigItemCreate) check() error {
|
||||
if _, ok := cic.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ConfigItem.created_at"`)}
|
||||
}
|
||||
if _, ok := cic.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ConfigItem.updated_at"`)}
|
||||
}
|
||||
if _, ok := cic.mutation.Name(); !ok {
|
||||
return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "ConfigItem.name"`)}
|
||||
}
|
||||
|
@ -141,11 +147,11 @@ func (cic *ConfigItemCreate) createSpec() (*ConfigItem, *sqlgraph.CreateSpec) {
|
|||
)
|
||||
if value, ok := cic.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(configitem.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = &value
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := cic.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(configitem.FieldUpdatedAt, field.TypeTime, value)
|
||||
_node.UpdatedAt = &value
|
||||
_node.UpdatedAt = value
|
||||
}
|
||||
if value, ok := cic.mutation.Name(); ok {
|
||||
_spec.SetField(configitem.FieldName, field.TypeString, value)
|
||||
|
|
|
@ -28,30 +28,12 @@ func (ciu *ConfigItemUpdate) Where(ps ...predicate.ConfigItem) *ConfigItemUpdate
|
|||
return ciu
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (ciu *ConfigItemUpdate) SetCreatedAt(t time.Time) *ConfigItemUpdate {
|
||||
ciu.mutation.SetCreatedAt(t)
|
||||
return ciu
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (ciu *ConfigItemUpdate) ClearCreatedAt() *ConfigItemUpdate {
|
||||
ciu.mutation.ClearCreatedAt()
|
||||
return ciu
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (ciu *ConfigItemUpdate) SetUpdatedAt(t time.Time) *ConfigItemUpdate {
|
||||
ciu.mutation.SetUpdatedAt(t)
|
||||
return ciu
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (ciu *ConfigItemUpdate) ClearUpdatedAt() *ConfigItemUpdate {
|
||||
ciu.mutation.ClearUpdatedAt()
|
||||
return ciu
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (ciu *ConfigItemUpdate) SetName(s string) *ConfigItemUpdate {
|
||||
ciu.mutation.SetName(s)
|
||||
|
@ -115,11 +97,7 @@ func (ciu *ConfigItemUpdate) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (ciu *ConfigItemUpdate) defaults() {
|
||||
if _, ok := ciu.mutation.CreatedAt(); !ok && !ciu.mutation.CreatedAtCleared() {
|
||||
v := configitem.UpdateDefaultCreatedAt()
|
||||
ciu.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := ciu.mutation.UpdatedAt(); !ok && !ciu.mutation.UpdatedAtCleared() {
|
||||
if _, ok := ciu.mutation.UpdatedAt(); !ok {
|
||||
v := configitem.UpdateDefaultUpdatedAt()
|
||||
ciu.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -134,18 +112,9 @@ func (ciu *ConfigItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := ciu.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(configitem.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if ciu.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(configitem.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := ciu.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(configitem.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if ciu.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(configitem.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := ciu.mutation.Name(); ok {
|
||||
_spec.SetField(configitem.FieldName, field.TypeString, value)
|
||||
}
|
||||
|
@ -172,30 +141,12 @@ type ConfigItemUpdateOne struct {
|
|||
mutation *ConfigItemMutation
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (ciuo *ConfigItemUpdateOne) SetCreatedAt(t time.Time) *ConfigItemUpdateOne {
|
||||
ciuo.mutation.SetCreatedAt(t)
|
||||
return ciuo
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (ciuo *ConfigItemUpdateOne) ClearCreatedAt() *ConfigItemUpdateOne {
|
||||
ciuo.mutation.ClearCreatedAt()
|
||||
return ciuo
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (ciuo *ConfigItemUpdateOne) SetUpdatedAt(t time.Time) *ConfigItemUpdateOne {
|
||||
ciuo.mutation.SetUpdatedAt(t)
|
||||
return ciuo
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (ciuo *ConfigItemUpdateOne) ClearUpdatedAt() *ConfigItemUpdateOne {
|
||||
ciuo.mutation.ClearUpdatedAt()
|
||||
return ciuo
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (ciuo *ConfigItemUpdateOne) SetName(s string) *ConfigItemUpdateOne {
|
||||
ciuo.mutation.SetName(s)
|
||||
|
@ -272,11 +223,7 @@ func (ciuo *ConfigItemUpdateOne) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (ciuo *ConfigItemUpdateOne) defaults() {
|
||||
if _, ok := ciuo.mutation.CreatedAt(); !ok && !ciuo.mutation.CreatedAtCleared() {
|
||||
v := configitem.UpdateDefaultCreatedAt()
|
||||
ciuo.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := ciuo.mutation.UpdatedAt(); !ok && !ciuo.mutation.UpdatedAtCleared() {
|
||||
if _, ok := ciuo.mutation.UpdatedAt(); !ok {
|
||||
v := configitem.UpdateDefaultUpdatedAt()
|
||||
ciuo.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -308,18 +255,9 @@ func (ciuo *ConfigItemUpdateOne) sqlSave(ctx context.Context) (_node *ConfigItem
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := ciuo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(configitem.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if ciuo.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(configitem.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := ciuo.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(configitem.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if ciuo.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(configitem.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := ciuo.mutation.Name(); ok {
|
||||
_spec.SetField(configitem.FieldName, field.TypeString, value)
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ type Decision struct {
|
|||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||
// Until holds the value of the "until" field.
|
||||
Until *time.Time `json:"until,omitempty"`
|
||||
// Scenario holds the value of the "scenario" field.
|
||||
|
@ -116,15 +116,13 @@ func (d *Decision) assignValues(columns []string, values []any) error {
|
|||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
} else if value.Valid {
|
||||
d.CreatedAt = new(time.Time)
|
||||
*d.CreatedAt = value.Time
|
||||
d.CreatedAt = value.Time
|
||||
}
|
||||
case decision.FieldUpdatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||
} else if value.Valid {
|
||||
d.UpdatedAt = new(time.Time)
|
||||
*d.UpdatedAt = value.Time
|
||||
d.UpdatedAt = value.Time
|
||||
}
|
||||
case decision.FieldUntil:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
|
@ -252,15 +250,11 @@ func (d *Decision) String() string {
|
|||
var builder strings.Builder
|
||||
builder.WriteString("Decision(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", d.ID))
|
||||
if v := d.CreatedAt; v != nil {
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(d.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := d.UpdatedAt; v != nil {
|
||||
builder.WriteString("updated_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(d.UpdatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := d.Until; v != nil {
|
||||
builder.WriteString("until=")
|
||||
|
|
|
@ -93,8 +93,6 @@ func ValidColumn(column string) bool {
|
|||
var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
|
||||
UpdateDefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
|
|
|
@ -175,16 +175,6 @@ func CreatedAtLTE(v time.Time) predicate.Decision {
|
|||
return predicate.Decision(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.Decision {
|
||||
return predicate.Decision(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.Decision {
|
||||
return predicate.Decision(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.Decision {
|
||||
return predicate.Decision(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
|
@ -225,16 +215,6 @@ func UpdatedAtLTE(v time.Time) predicate.Decision {
|
|||
return predicate.Decision(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.Decision {
|
||||
return predicate.Decision(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.Decision {
|
||||
return predicate.Decision(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UntilEQ applies the EQ predicate on the "until" field.
|
||||
func UntilEQ(v time.Time) predicate.Decision {
|
||||
return predicate.Decision(sql.FieldEQ(FieldUntil, v))
|
||||
|
|
|
@ -275,6 +275,12 @@ func (dc *DecisionCreate) defaults() {
|
|||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (dc *DecisionCreate) check() error {
|
||||
if _, ok := dc.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Decision.created_at"`)}
|
||||
}
|
||||
if _, ok := dc.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Decision.updated_at"`)}
|
||||
}
|
||||
if _, ok := dc.mutation.Scenario(); !ok {
|
||||
return &ValidationError{Name: "scenario", err: errors.New(`ent: missing required field "Decision.scenario"`)}
|
||||
}
|
||||
|
@ -321,11 +327,11 @@ func (dc *DecisionCreate) createSpec() (*Decision, *sqlgraph.CreateSpec) {
|
|||
)
|
||||
if value, ok := dc.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(decision.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = &value
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := dc.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(decision.FieldUpdatedAt, field.TypeTime, value)
|
||||
_node.UpdatedAt = &value
|
||||
_node.UpdatedAt = value
|
||||
}
|
||||
if value, ok := dc.mutation.Until(); ok {
|
||||
_spec.SetField(decision.FieldUntil, field.TypeTime, value)
|
||||
|
|
|
@ -29,30 +29,12 @@ func (du *DecisionUpdate) Where(ps ...predicate.Decision) *DecisionUpdate {
|
|||
return du
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (du *DecisionUpdate) SetCreatedAt(t time.Time) *DecisionUpdate {
|
||||
du.mutation.SetCreatedAt(t)
|
||||
return du
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (du *DecisionUpdate) ClearCreatedAt() *DecisionUpdate {
|
||||
du.mutation.ClearCreatedAt()
|
||||
return du
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (du *DecisionUpdate) SetUpdatedAt(t time.Time) *DecisionUpdate {
|
||||
du.mutation.SetUpdatedAt(t)
|
||||
return du
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (du *DecisionUpdate) ClearUpdatedAt() *DecisionUpdate {
|
||||
du.mutation.ClearUpdatedAt()
|
||||
return du
|
||||
}
|
||||
|
||||
// SetUntil sets the "until" field.
|
||||
func (du *DecisionUpdate) SetUntil(t time.Time) *DecisionUpdate {
|
||||
du.mutation.SetUntil(t)
|
||||
|
@ -392,11 +374,7 @@ func (du *DecisionUpdate) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (du *DecisionUpdate) defaults() {
|
||||
if _, ok := du.mutation.CreatedAt(); !ok && !du.mutation.CreatedAtCleared() {
|
||||
v := decision.UpdateDefaultCreatedAt()
|
||||
du.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := du.mutation.UpdatedAt(); !ok && !du.mutation.UpdatedAtCleared() {
|
||||
if _, ok := du.mutation.UpdatedAt(); !ok {
|
||||
v := decision.UpdateDefaultUpdatedAt()
|
||||
du.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -411,18 +389,9 @@ func (du *DecisionUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := du.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(decision.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if du.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(decision.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := du.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(decision.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if du.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(decision.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := du.mutation.Until(); ok {
|
||||
_spec.SetField(decision.FieldUntil, field.TypeTime, value)
|
||||
}
|
||||
|
@ -547,30 +516,12 @@ type DecisionUpdateOne struct {
|
|||
mutation *DecisionMutation
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (duo *DecisionUpdateOne) SetCreatedAt(t time.Time) *DecisionUpdateOne {
|
||||
duo.mutation.SetCreatedAt(t)
|
||||
return duo
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (duo *DecisionUpdateOne) ClearCreatedAt() *DecisionUpdateOne {
|
||||
duo.mutation.ClearCreatedAt()
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (duo *DecisionUpdateOne) SetUpdatedAt(t time.Time) *DecisionUpdateOne {
|
||||
duo.mutation.SetUpdatedAt(t)
|
||||
return duo
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (duo *DecisionUpdateOne) ClearUpdatedAt() *DecisionUpdateOne {
|
||||
duo.mutation.ClearUpdatedAt()
|
||||
return duo
|
||||
}
|
||||
|
||||
// SetUntil sets the "until" field.
|
||||
func (duo *DecisionUpdateOne) SetUntil(t time.Time) *DecisionUpdateOne {
|
||||
duo.mutation.SetUntil(t)
|
||||
|
@ -923,11 +874,7 @@ func (duo *DecisionUpdateOne) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (duo *DecisionUpdateOne) defaults() {
|
||||
if _, ok := duo.mutation.CreatedAt(); !ok && !duo.mutation.CreatedAtCleared() {
|
||||
v := decision.UpdateDefaultCreatedAt()
|
||||
duo.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := duo.mutation.UpdatedAt(); !ok && !duo.mutation.UpdatedAtCleared() {
|
||||
if _, ok := duo.mutation.UpdatedAt(); !ok {
|
||||
v := decision.UpdateDefaultUpdatedAt()
|
||||
duo.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -959,18 +906,9 @@ func (duo *DecisionUpdateOne) sqlSave(ctx context.Context) (_node *Decision, err
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := duo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(decision.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if duo.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(decision.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := duo.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(decision.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if duo.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(decision.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := duo.mutation.Until(); ok {
|
||||
_spec.SetField(decision.FieldUntil, field.TypeTime, value)
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ type Event struct {
|
|||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||
// Time holds the value of the "time" field.
|
||||
Time time.Time `json:"time,omitempty"`
|
||||
// Serialized holds the value of the "serialized" field.
|
||||
|
@ -92,15 +92,13 @@ func (e *Event) assignValues(columns []string, values []any) error {
|
|||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
} else if value.Valid {
|
||||
e.CreatedAt = new(time.Time)
|
||||
*e.CreatedAt = value.Time
|
||||
e.CreatedAt = value.Time
|
||||
}
|
||||
case event.FieldUpdatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||
} else if value.Valid {
|
||||
e.UpdatedAt = new(time.Time)
|
||||
*e.UpdatedAt = value.Time
|
||||
e.UpdatedAt = value.Time
|
||||
}
|
||||
case event.FieldTime:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
|
@ -161,15 +159,11 @@ func (e *Event) String() string {
|
|||
var builder strings.Builder
|
||||
builder.WriteString("Event(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", e.ID))
|
||||
if v := e.CreatedAt; v != nil {
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(e.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := e.UpdatedAt; v != nil {
|
||||
builder.WriteString("updated_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(e.UpdatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("time=")
|
||||
builder.WriteString(e.Time.Format(time.ANSIC))
|
||||
|
|
|
@ -60,8 +60,6 @@ func ValidColumn(column string) bool {
|
|||
var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
|
||||
UpdateDefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
|
|
|
@ -120,16 +120,6 @@ func CreatedAtLTE(v time.Time) predicate.Event {
|
|||
return predicate.Event(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.Event {
|
||||
return predicate.Event(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.Event {
|
||||
return predicate.Event(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.Event {
|
||||
return predicate.Event(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
|
@ -170,16 +160,6 @@ func UpdatedAtLTE(v time.Time) predicate.Event {
|
|||
return predicate.Event(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.Event {
|
||||
return predicate.Event(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.Event {
|
||||
return predicate.Event(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// TimeEQ applies the EQ predicate on the "time" field.
|
||||
func TimeEQ(v time.Time) predicate.Event {
|
||||
return predicate.Event(sql.FieldEQ(FieldTime, v))
|
||||
|
|
|
@ -141,6 +141,12 @@ func (ec *EventCreate) defaults() {
|
|||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (ec *EventCreate) check() error {
|
||||
if _, ok := ec.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Event.created_at"`)}
|
||||
}
|
||||
if _, ok := ec.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Event.updated_at"`)}
|
||||
}
|
||||
if _, ok := ec.mutation.Time(); !ok {
|
||||
return &ValidationError{Name: "time", err: errors.New(`ent: missing required field "Event.time"`)}
|
||||
}
|
||||
|
@ -180,11 +186,11 @@ func (ec *EventCreate) createSpec() (*Event, *sqlgraph.CreateSpec) {
|
|||
)
|
||||
if value, ok := ec.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(event.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = &value
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := ec.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(event.FieldUpdatedAt, field.TypeTime, value)
|
||||
_node.UpdatedAt = &value
|
||||
_node.UpdatedAt = value
|
||||
}
|
||||
if value, ok := ec.mutation.Time(); ok {
|
||||
_spec.SetField(event.FieldTime, field.TypeTime, value)
|
||||
|
|
|
@ -29,30 +29,12 @@ func (eu *EventUpdate) Where(ps ...predicate.Event) *EventUpdate {
|
|||
return eu
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (eu *EventUpdate) SetCreatedAt(t time.Time) *EventUpdate {
|
||||
eu.mutation.SetCreatedAt(t)
|
||||
return eu
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (eu *EventUpdate) ClearCreatedAt() *EventUpdate {
|
||||
eu.mutation.ClearCreatedAt()
|
||||
return eu
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (eu *EventUpdate) SetUpdatedAt(t time.Time) *EventUpdate {
|
||||
eu.mutation.SetUpdatedAt(t)
|
||||
return eu
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (eu *EventUpdate) ClearUpdatedAt() *EventUpdate {
|
||||
eu.mutation.ClearUpdatedAt()
|
||||
return eu
|
||||
}
|
||||
|
||||
// SetTime sets the "time" field.
|
||||
func (eu *EventUpdate) SetTime(t time.Time) *EventUpdate {
|
||||
eu.mutation.SetTime(t)
|
||||
|
@ -161,11 +143,7 @@ func (eu *EventUpdate) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (eu *EventUpdate) defaults() {
|
||||
if _, ok := eu.mutation.CreatedAt(); !ok && !eu.mutation.CreatedAtCleared() {
|
||||
v := event.UpdateDefaultCreatedAt()
|
||||
eu.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := eu.mutation.UpdatedAt(); !ok && !eu.mutation.UpdatedAtCleared() {
|
||||
if _, ok := eu.mutation.UpdatedAt(); !ok {
|
||||
v := event.UpdateDefaultUpdatedAt()
|
||||
eu.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -193,18 +171,9 @@ func (eu *EventUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := eu.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(event.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if eu.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(event.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := eu.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(event.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if eu.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(event.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := eu.mutation.Time(); ok {
|
||||
_spec.SetField(event.FieldTime, field.TypeTime, value)
|
||||
}
|
||||
|
@ -260,30 +229,12 @@ type EventUpdateOne struct {
|
|||
mutation *EventMutation
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (euo *EventUpdateOne) SetCreatedAt(t time.Time) *EventUpdateOne {
|
||||
euo.mutation.SetCreatedAt(t)
|
||||
return euo
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (euo *EventUpdateOne) ClearCreatedAt() *EventUpdateOne {
|
||||
euo.mutation.ClearCreatedAt()
|
||||
return euo
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (euo *EventUpdateOne) SetUpdatedAt(t time.Time) *EventUpdateOne {
|
||||
euo.mutation.SetUpdatedAt(t)
|
||||
return euo
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (euo *EventUpdateOne) ClearUpdatedAt() *EventUpdateOne {
|
||||
euo.mutation.ClearUpdatedAt()
|
||||
return euo
|
||||
}
|
||||
|
||||
// SetTime sets the "time" field.
|
||||
func (euo *EventUpdateOne) SetTime(t time.Time) *EventUpdateOne {
|
||||
euo.mutation.SetTime(t)
|
||||
|
@ -405,11 +356,7 @@ func (euo *EventUpdateOne) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (euo *EventUpdateOne) defaults() {
|
||||
if _, ok := euo.mutation.CreatedAt(); !ok && !euo.mutation.CreatedAtCleared() {
|
||||
v := event.UpdateDefaultCreatedAt()
|
||||
euo.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := euo.mutation.UpdatedAt(); !ok && !euo.mutation.UpdatedAtCleared() {
|
||||
if _, ok := euo.mutation.UpdatedAt(); !ok {
|
||||
v := event.UpdateDefaultUpdatedAt()
|
||||
euo.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -454,18 +401,9 @@ func (euo *EventUpdateOne) sqlSave(ctx context.Context) (_node *Event, err error
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := euo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(event.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if euo.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(event.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := euo.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(event.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if euo.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(event.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := euo.mutation.Time(); ok {
|
||||
_spec.SetField(event.FieldTime, field.TypeTime, value)
|
||||
}
|
||||
|
|
|
@ -28,20 +28,6 @@ func (lu *LockUpdate) Where(ps ...predicate.Lock) *LockUpdate {
|
|||
return lu
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (lu *LockUpdate) SetName(s string) *LockUpdate {
|
||||
lu.mutation.SetName(s)
|
||||
return lu
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (lu *LockUpdate) SetNillableName(s *string) *LockUpdate {
|
||||
if s != nil {
|
||||
lu.SetName(*s)
|
||||
}
|
||||
return lu
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (lu *LockUpdate) SetCreatedAt(t time.Time) *LockUpdate {
|
||||
lu.mutation.SetCreatedAt(t)
|
||||
|
@ -97,9 +83,6 @@ func (lu *LockUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := lu.mutation.Name(); ok {
|
||||
_spec.SetField(lock.FieldName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := lu.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(lock.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
|
@ -123,20 +106,6 @@ type LockUpdateOne struct {
|
|||
mutation *LockMutation
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (luo *LockUpdateOne) SetName(s string) *LockUpdateOne {
|
||||
luo.mutation.SetName(s)
|
||||
return luo
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (luo *LockUpdateOne) SetNillableName(s *string) *LockUpdateOne {
|
||||
if s != nil {
|
||||
luo.SetName(*s)
|
||||
}
|
||||
return luo
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (luo *LockUpdateOne) SetCreatedAt(t time.Time) *LockUpdateOne {
|
||||
luo.mutation.SetCreatedAt(t)
|
||||
|
@ -222,9 +191,6 @@ func (luo *LockUpdateOne) sqlSave(ctx context.Context) (_node *Lock, err error)
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := luo.mutation.Name(); ok {
|
||||
_spec.SetField(lock.FieldName, field.TypeString, value)
|
||||
}
|
||||
if value, ok := luo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(lock.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@ type Machine struct {
|
|||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||
// LastPush holds the value of the "last_push" field.
|
||||
LastPush *time.Time `json:"last_push,omitempty"`
|
||||
// LastHeartbeat holds the value of the "last_heartbeat" field.
|
||||
|
@ -103,15 +103,13 @@ func (m *Machine) assignValues(columns []string, values []any) error {
|
|||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
} else if value.Valid {
|
||||
m.CreatedAt = new(time.Time)
|
||||
*m.CreatedAt = value.Time
|
||||
m.CreatedAt = value.Time
|
||||
}
|
||||
case machine.FieldUpdatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||
} else if value.Valid {
|
||||
m.UpdatedAt = new(time.Time)
|
||||
*m.UpdatedAt = value.Time
|
||||
m.UpdatedAt = value.Time
|
||||
}
|
||||
case machine.FieldLastPush:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
|
@ -216,15 +214,11 @@ func (m *Machine) String() string {
|
|||
var builder strings.Builder
|
||||
builder.WriteString("Machine(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", m.ID))
|
||||
if v := m.CreatedAt; v != nil {
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(m.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := m.UpdatedAt; v != nil {
|
||||
builder.WriteString("updated_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(m.UpdatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := m.LastPush; v != nil {
|
||||
builder.WriteString("last_push=")
|
||||
|
|
|
@ -81,20 +81,14 @@ func ValidColumn(column string) bool {
|
|||
var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
|
||||
UpdateDefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
UpdateDefaultUpdatedAt func() time.Time
|
||||
// DefaultLastPush holds the default value on creation for the "last_push" field.
|
||||
DefaultLastPush func() time.Time
|
||||
// UpdateDefaultLastPush holds the default value on update for the "last_push" field.
|
||||
UpdateDefaultLastPush func() time.Time
|
||||
// DefaultLastHeartbeat holds the default value on creation for the "last_heartbeat" field.
|
||||
DefaultLastHeartbeat func() time.Time
|
||||
// UpdateDefaultLastHeartbeat holds the default value on update for the "last_heartbeat" field.
|
||||
UpdateDefaultLastHeartbeat func() time.Time
|
||||
// ScenariosValidator is a validator for the "scenarios" field. It is called by the builders before save.
|
||||
ScenariosValidator func(string) error
|
||||
// DefaultIsValidated holds the default value on creation for the "isValidated" field.
|
||||
|
|
|
@ -155,16 +155,6 @@ func CreatedAtLTE(v time.Time) predicate.Machine {
|
|||
return predicate.Machine(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.Machine {
|
||||
return predicate.Machine(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.Machine {
|
||||
return predicate.Machine(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.Machine {
|
||||
return predicate.Machine(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
|
@ -205,16 +195,6 @@ func UpdatedAtLTE(v time.Time) predicate.Machine {
|
|||
return predicate.Machine(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.Machine {
|
||||
return predicate.Machine(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.Machine {
|
||||
return predicate.Machine(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// LastPushEQ applies the EQ predicate on the "last_push" field.
|
||||
func LastPushEQ(v time.Time) predicate.Machine {
|
||||
return predicate.Machine(sql.FieldEQ(FieldLastPush, v))
|
||||
|
|
|
@ -243,6 +243,12 @@ func (mc *MachineCreate) defaults() {
|
|||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (mc *MachineCreate) check() error {
|
||||
if _, ok := mc.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Machine.created_at"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Machine.updated_at"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.MachineId(); !ok {
|
||||
return &ValidationError{Name: "machineId", err: errors.New(`ent: missing required field "Machine.machineId"`)}
|
||||
}
|
||||
|
@ -291,11 +297,11 @@ func (mc *MachineCreate) createSpec() (*Machine, *sqlgraph.CreateSpec) {
|
|||
)
|
||||
if value, ok := mc.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(machine.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = &value
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := mc.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(machine.FieldUpdatedAt, field.TypeTime, value)
|
||||
_node.UpdatedAt = &value
|
||||
_node.UpdatedAt = value
|
||||
}
|
||||
if value, ok := mc.mutation.LastPush(); ok {
|
||||
_spec.SetField(machine.FieldLastPush, field.TypeTime, value)
|
||||
|
|
|
@ -29,36 +29,26 @@ func (mu *MachineUpdate) Where(ps ...predicate.Machine) *MachineUpdate {
|
|||
return mu
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (mu *MachineUpdate) SetCreatedAt(t time.Time) *MachineUpdate {
|
||||
mu.mutation.SetCreatedAt(t)
|
||||
return mu
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (mu *MachineUpdate) ClearCreatedAt() *MachineUpdate {
|
||||
mu.mutation.ClearCreatedAt()
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (mu *MachineUpdate) SetUpdatedAt(t time.Time) *MachineUpdate {
|
||||
mu.mutation.SetUpdatedAt(t)
|
||||
return mu
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (mu *MachineUpdate) ClearUpdatedAt() *MachineUpdate {
|
||||
mu.mutation.ClearUpdatedAt()
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetLastPush sets the "last_push" field.
|
||||
func (mu *MachineUpdate) SetLastPush(t time.Time) *MachineUpdate {
|
||||
mu.mutation.SetLastPush(t)
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetNillableLastPush sets the "last_push" field if the given value is not nil.
|
||||
func (mu *MachineUpdate) SetNillableLastPush(t *time.Time) *MachineUpdate {
|
||||
if t != nil {
|
||||
mu.SetLastPush(*t)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// ClearLastPush clears the value of the "last_push" field.
|
||||
func (mu *MachineUpdate) ClearLastPush() *MachineUpdate {
|
||||
mu.mutation.ClearLastPush()
|
||||
|
@ -71,26 +61,20 @@ func (mu *MachineUpdate) SetLastHeartbeat(t time.Time) *MachineUpdate {
|
|||
return mu
|
||||
}
|
||||
|
||||
// SetNillableLastHeartbeat sets the "last_heartbeat" field if the given value is not nil.
|
||||
func (mu *MachineUpdate) SetNillableLastHeartbeat(t *time.Time) *MachineUpdate {
|
||||
if t != nil {
|
||||
mu.SetLastHeartbeat(*t)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// ClearLastHeartbeat clears the value of the "last_heartbeat" field.
|
||||
func (mu *MachineUpdate) ClearLastHeartbeat() *MachineUpdate {
|
||||
mu.mutation.ClearLastHeartbeat()
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetMachineId sets the "machineId" field.
|
||||
func (mu *MachineUpdate) SetMachineId(s string) *MachineUpdate {
|
||||
mu.mutation.SetMachineId(s)
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetNillableMachineId sets the "machineId" field if the given value is not nil.
|
||||
func (mu *MachineUpdate) SetNillableMachineId(s *string) *MachineUpdate {
|
||||
if s != nil {
|
||||
mu.SetMachineId(*s)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (mu *MachineUpdate) SetPassword(s string) *MachineUpdate {
|
||||
mu.mutation.SetPassword(s)
|
||||
|
@ -278,22 +262,10 @@ func (mu *MachineUpdate) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (mu *MachineUpdate) defaults() {
|
||||
if _, ok := mu.mutation.CreatedAt(); !ok && !mu.mutation.CreatedAtCleared() {
|
||||
v := machine.UpdateDefaultCreatedAt()
|
||||
mu.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := mu.mutation.UpdatedAt(); !ok && !mu.mutation.UpdatedAtCleared() {
|
||||
if _, ok := mu.mutation.UpdatedAt(); !ok {
|
||||
v := machine.UpdateDefaultUpdatedAt()
|
||||
mu.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
if _, ok := mu.mutation.LastPush(); !ok && !mu.mutation.LastPushCleared() {
|
||||
v := machine.UpdateDefaultLastPush()
|
||||
mu.mutation.SetLastPush(v)
|
||||
}
|
||||
if _, ok := mu.mutation.LastHeartbeat(); !ok && !mu.mutation.LastHeartbeatCleared() {
|
||||
v := machine.UpdateDefaultLastHeartbeat()
|
||||
mu.mutation.SetLastHeartbeat(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
|
@ -318,18 +290,9 @@ func (mu *MachineUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := mu.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(machine.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if mu.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(machine.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := mu.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(machine.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if mu.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(machine.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := mu.mutation.LastPush(); ok {
|
||||
_spec.SetField(machine.FieldLastPush, field.TypeTime, value)
|
||||
}
|
||||
|
@ -342,9 +305,6 @@ func (mu *MachineUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
if mu.mutation.LastHeartbeatCleared() {
|
||||
_spec.ClearField(machine.FieldLastHeartbeat, field.TypeTime)
|
||||
}
|
||||
if value, ok := mu.mutation.MachineId(); ok {
|
||||
_spec.SetField(machine.FieldMachineId, field.TypeString, value)
|
||||
}
|
||||
if value, ok := mu.mutation.Password(); ok {
|
||||
_spec.SetField(machine.FieldPassword, field.TypeString, value)
|
||||
}
|
||||
|
@ -440,36 +400,26 @@ type MachineUpdateOne struct {
|
|||
mutation *MachineMutation
|
||||
}
|
||||
|
||||
// SetCreatedAt sets the "created_at" field.
|
||||
func (muo *MachineUpdateOne) SetCreatedAt(t time.Time) *MachineUpdateOne {
|
||||
muo.mutation.SetCreatedAt(t)
|
||||
return muo
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (muo *MachineUpdateOne) ClearCreatedAt() *MachineUpdateOne {
|
||||
muo.mutation.ClearCreatedAt()
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
func (muo *MachineUpdateOne) SetUpdatedAt(t time.Time) *MachineUpdateOne {
|
||||
muo.mutation.SetUpdatedAt(t)
|
||||
return muo
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (muo *MachineUpdateOne) ClearUpdatedAt() *MachineUpdateOne {
|
||||
muo.mutation.ClearUpdatedAt()
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetLastPush sets the "last_push" field.
|
||||
func (muo *MachineUpdateOne) SetLastPush(t time.Time) *MachineUpdateOne {
|
||||
muo.mutation.SetLastPush(t)
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetNillableLastPush sets the "last_push" field if the given value is not nil.
|
||||
func (muo *MachineUpdateOne) SetNillableLastPush(t *time.Time) *MachineUpdateOne {
|
||||
if t != nil {
|
||||
muo.SetLastPush(*t)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// ClearLastPush clears the value of the "last_push" field.
|
||||
func (muo *MachineUpdateOne) ClearLastPush() *MachineUpdateOne {
|
||||
muo.mutation.ClearLastPush()
|
||||
|
@ -482,26 +432,20 @@ func (muo *MachineUpdateOne) SetLastHeartbeat(t time.Time) *MachineUpdateOne {
|
|||
return muo
|
||||
}
|
||||
|
||||
// SetNillableLastHeartbeat sets the "last_heartbeat" field if the given value is not nil.
|
||||
func (muo *MachineUpdateOne) SetNillableLastHeartbeat(t *time.Time) *MachineUpdateOne {
|
||||
if t != nil {
|
||||
muo.SetLastHeartbeat(*t)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// ClearLastHeartbeat clears the value of the "last_heartbeat" field.
|
||||
func (muo *MachineUpdateOne) ClearLastHeartbeat() *MachineUpdateOne {
|
||||
muo.mutation.ClearLastHeartbeat()
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetMachineId sets the "machineId" field.
|
||||
func (muo *MachineUpdateOne) SetMachineId(s string) *MachineUpdateOne {
|
||||
muo.mutation.SetMachineId(s)
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetNillableMachineId sets the "machineId" field if the given value is not nil.
|
||||
func (muo *MachineUpdateOne) SetNillableMachineId(s *string) *MachineUpdateOne {
|
||||
if s != nil {
|
||||
muo.SetMachineId(*s)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetPassword sets the "password" field.
|
||||
func (muo *MachineUpdateOne) SetPassword(s string) *MachineUpdateOne {
|
||||
muo.mutation.SetPassword(s)
|
||||
|
@ -702,22 +646,10 @@ func (muo *MachineUpdateOne) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (muo *MachineUpdateOne) defaults() {
|
||||
if _, ok := muo.mutation.CreatedAt(); !ok && !muo.mutation.CreatedAtCleared() {
|
||||
v := machine.UpdateDefaultCreatedAt()
|
||||
muo.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := muo.mutation.UpdatedAt(); !ok && !muo.mutation.UpdatedAtCleared() {
|
||||
if _, ok := muo.mutation.UpdatedAt(); !ok {
|
||||
v := machine.UpdateDefaultUpdatedAt()
|
||||
muo.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
if _, ok := muo.mutation.LastPush(); !ok && !muo.mutation.LastPushCleared() {
|
||||
v := machine.UpdateDefaultLastPush()
|
||||
muo.mutation.SetLastPush(v)
|
||||
}
|
||||
if _, ok := muo.mutation.LastHeartbeat(); !ok && !muo.mutation.LastHeartbeatCleared() {
|
||||
v := machine.UpdateDefaultLastHeartbeat()
|
||||
muo.mutation.SetLastHeartbeat(v)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
|
@ -759,18 +691,9 @@ func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err e
|
|||
}
|
||||
}
|
||||
}
|
||||
if value, ok := muo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(machine.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if muo.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(machine.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := muo.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(machine.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if muo.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(machine.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := muo.mutation.LastPush(); ok {
|
||||
_spec.SetField(machine.FieldLastPush, field.TypeTime, value)
|
||||
}
|
||||
|
@ -783,9 +706,6 @@ func (muo *MachineUpdateOne) sqlSave(ctx context.Context) (_node *Machine, err e
|
|||
if muo.mutation.LastHeartbeatCleared() {
|
||||
_spec.ClearField(machine.FieldLastHeartbeat, field.TypeTime)
|
||||
}
|
||||
if value, ok := muo.mutation.MachineId(); ok {
|
||||
_spec.SetField(machine.FieldMachineId, field.TypeString, value)
|
||||
}
|
||||
if value, ok := muo.mutation.Password(); ok {
|
||||
_spec.SetField(machine.FieldPassword, field.TypeString, value)
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ type Meta struct {
|
|||
// ID of the ent.
|
||||
ID int `json:"id,omitempty"`
|
||||
// CreatedAt holds the value of the "created_at" field.
|
||||
CreatedAt *time.Time `json:"created_at,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||
// UpdatedAt holds the value of the "updated_at" field.
|
||||
UpdatedAt *time.Time `json:"updated_at,omitempty"`
|
||||
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||
// Key holds the value of the "key" field.
|
||||
Key string `json:"key,omitempty"`
|
||||
// Value holds the value of the "value" field.
|
||||
|
@ -92,15 +92,13 @@ func (m *Meta) assignValues(columns []string, values []any) error {
|
|||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||
} else if value.Valid {
|
||||
m.CreatedAt = new(time.Time)
|
||||
*m.CreatedAt = value.Time
|
||||
m.CreatedAt = value.Time
|
||||
}
|
||||
case meta.FieldUpdatedAt:
|
||||
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||
} else if value.Valid {
|
||||
m.UpdatedAt = new(time.Time)
|
||||
*m.UpdatedAt = value.Time
|
||||
m.UpdatedAt = value.Time
|
||||
}
|
||||
case meta.FieldKey:
|
||||
if value, ok := values[i].(*sql.NullString); !ok {
|
||||
|
@ -161,15 +159,11 @@ func (m *Meta) String() string {
|
|||
var builder strings.Builder
|
||||
builder.WriteString("Meta(")
|
||||
builder.WriteString(fmt.Sprintf("id=%v, ", m.ID))
|
||||
if v := m.CreatedAt; v != nil {
|
||||
builder.WriteString("created_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(m.CreatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
if v := m.UpdatedAt; v != nil {
|
||||
builder.WriteString("updated_at=")
|
||||
builder.WriteString(v.Format(time.ANSIC))
|
||||
}
|
||||
builder.WriteString(m.UpdatedAt.Format(time.ANSIC))
|
||||
builder.WriteString(", ")
|
||||
builder.WriteString("key=")
|
||||
builder.WriteString(m.Key)
|
||||
|
|
|
@ -60,8 +60,6 @@ func ValidColumn(column string) bool {
|
|||
var (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// UpdateDefaultCreatedAt holds the default value on update for the "created_at" field.
|
||||
UpdateDefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
|
|
|
@ -120,16 +120,6 @@ func CreatedAtLTE(v time.Time) predicate.Meta {
|
|||
return predicate.Meta(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
|
||||
func CreatedAtIsNil() predicate.Meta {
|
||||
return predicate.Meta(sql.FieldIsNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
|
||||
func CreatedAtNotNil() predicate.Meta {
|
||||
return predicate.Meta(sql.FieldNotNull(FieldCreatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.Meta {
|
||||
return predicate.Meta(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
|
@ -170,16 +160,6 @@ func UpdatedAtLTE(v time.Time) predicate.Meta {
|
|||
return predicate.Meta(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||
func UpdatedAtIsNil() predicate.Meta {
|
||||
return predicate.Meta(sql.FieldIsNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||
func UpdatedAtNotNil() predicate.Meta {
|
||||
return predicate.Meta(sql.FieldNotNull(FieldUpdatedAt))
|
||||
}
|
||||
|
||||
// KeyEQ applies the EQ predicate on the "key" field.
|
||||
func KeyEQ(v string) predicate.Meta {
|
||||
return predicate.Meta(sql.FieldEQ(FieldKey, v))
|
||||
|
|
|
@ -141,6 +141,12 @@ func (mc *MetaCreate) defaults() {
|
|||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (mc *MetaCreate) check() error {
|
||||
if _, ok := mc.mutation.CreatedAt(); !ok {
|
||||
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Meta.created_at"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.UpdatedAt(); !ok {
|
||||
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Meta.updated_at"`)}
|
||||
}
|
||||
if _, ok := mc.mutation.Key(); !ok {
|
||||
return &ValidationError{Name: "key", err: errors.New(`ent: missing required field "Meta.key"`)}
|
||||
}
|
||||
|
@ -180,11 +186,11 @@ func (mc *MetaCreate) createSpec() (*Meta, *sqlgraph.CreateSpec) {
|
|||
)
|
||||
if value, ok := mc.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(meta.FieldCreatedAt, field.TypeTime, value)
|
||||
_node.CreatedAt = &value
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if value, ok := mc.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(meta.FieldUpdatedAt, field.TypeTime, value)
|
||||
_node.UpdatedAt = &value
|
||||
_node.UpdatedAt = value
|
||||
}
|
||||
if value, ok := mc.mutation.Key(); ok {
|
||||
_spec.SetField(meta.FieldKey, field.TypeString, value)
|
||||
|
|
|
@ -35,9 +35,11 @@ func (mu *MetaUpdate) SetCreatedAt(t time.Time) *MetaUpdate {
|
|||
return mu
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (mu *MetaUpdate) ClearCreatedAt() *MetaUpdate {
|
||||
mu.mutation.ClearCreatedAt()
|
||||
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||||
func (mu *MetaUpdate) SetNillableCreatedAt(t *time.Time) *MetaUpdate {
|
||||
if t != nil {
|
||||
mu.SetCreatedAt(*t)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
|
@ -47,12 +49,6 @@ func (mu *MetaUpdate) SetUpdatedAt(t time.Time) *MetaUpdate {
|
|||
return mu
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (mu *MetaUpdate) ClearUpdatedAt() *MetaUpdate {
|
||||
mu.mutation.ClearUpdatedAt()
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetKey sets the "key" field.
|
||||
func (mu *MetaUpdate) SetKey(s string) *MetaUpdate {
|
||||
mu.mutation.SetKey(s)
|
||||
|
@ -161,11 +157,7 @@ func (mu *MetaUpdate) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (mu *MetaUpdate) defaults() {
|
||||
if _, ok := mu.mutation.CreatedAt(); !ok && !mu.mutation.CreatedAtCleared() {
|
||||
v := meta.UpdateDefaultCreatedAt()
|
||||
mu.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := mu.mutation.UpdatedAt(); !ok && !mu.mutation.UpdatedAtCleared() {
|
||||
if _, ok := mu.mutation.UpdatedAt(); !ok {
|
||||
v := meta.UpdateDefaultUpdatedAt()
|
||||
mu.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -196,15 +188,9 @@ func (mu *MetaUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
if value, ok := mu.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(meta.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if mu.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(meta.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := mu.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(meta.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if mu.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(meta.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := mu.mutation.Key(); ok {
|
||||
_spec.SetField(meta.FieldKey, field.TypeString, value)
|
||||
}
|
||||
|
@ -266,9 +252,11 @@ func (muo *MetaUpdateOne) SetCreatedAt(t time.Time) *MetaUpdateOne {
|
|||
return muo
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (muo *MetaUpdateOne) ClearCreatedAt() *MetaUpdateOne {
|
||||
muo.mutation.ClearCreatedAt()
|
||||
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||||
func (muo *MetaUpdateOne) SetNillableCreatedAt(t *time.Time) *MetaUpdateOne {
|
||||
if t != nil {
|
||||
muo.SetCreatedAt(*t)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
|
@ -278,12 +266,6 @@ func (muo *MetaUpdateOne) SetUpdatedAt(t time.Time) *MetaUpdateOne {
|
|||
return muo
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (muo *MetaUpdateOne) ClearUpdatedAt() *MetaUpdateOne {
|
||||
muo.mutation.ClearUpdatedAt()
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetKey sets the "key" field.
|
||||
func (muo *MetaUpdateOne) SetKey(s string) *MetaUpdateOne {
|
||||
muo.mutation.SetKey(s)
|
||||
|
@ -405,11 +387,7 @@ func (muo *MetaUpdateOne) ExecX(ctx context.Context) {
|
|||
|
||||
// defaults sets the default values of the builder before save.
|
||||
func (muo *MetaUpdateOne) defaults() {
|
||||
if _, ok := muo.mutation.CreatedAt(); !ok && !muo.mutation.CreatedAtCleared() {
|
||||
v := meta.UpdateDefaultCreatedAt()
|
||||
muo.mutation.SetCreatedAt(v)
|
||||
}
|
||||
if _, ok := muo.mutation.UpdatedAt(); !ok && !muo.mutation.UpdatedAtCleared() {
|
||||
if _, ok := muo.mutation.UpdatedAt(); !ok {
|
||||
v := meta.UpdateDefaultUpdatedAt()
|
||||
muo.mutation.SetUpdatedAt(v)
|
||||
}
|
||||
|
@ -457,15 +435,9 @@ func (muo *MetaUpdateOne) sqlSave(ctx context.Context) (_node *Meta, err error)
|
|||
if value, ok := muo.mutation.CreatedAt(); ok {
|
||||
_spec.SetField(meta.FieldCreatedAt, field.TypeTime, value)
|
||||
}
|
||||
if muo.mutation.CreatedAtCleared() {
|
||||
_spec.ClearField(meta.FieldCreatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := muo.mutation.UpdatedAt(); ok {
|
||||
_spec.SetField(meta.FieldUpdatedAt, field.TypeTime, value)
|
||||
}
|
||||
if muo.mutation.UpdatedAtCleared() {
|
||||
_spec.ClearField(meta.FieldUpdatedAt, field.TypeTime)
|
||||
}
|
||||
if value, ok := muo.mutation.Key(); ok {
|
||||
_spec.SetField(meta.FieldKey, field.TypeString, value)
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ var (
|
|||
// AlertsColumns holds the columns for the "alerts" table.
|
||||
AlertsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "scenario", Type: field.TypeString},
|
||||
{Name: "bucket_id", Type: field.TypeString, Nullable: true, Default: ""},
|
||||
{Name: "message", Type: field.TypeString, Nullable: true, Default: ""},
|
||||
|
@ -60,8 +60,8 @@ var (
|
|||
// BouncersColumns holds the columns for the "bouncers" table.
|
||||
BouncersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "name", Type: field.TypeString, Unique: true},
|
||||
{Name: "api_key", Type: field.TypeString},
|
||||
{Name: "revoked", Type: field.TypeBool},
|
||||
|
@ -81,8 +81,8 @@ var (
|
|||
// ConfigItemsColumns holds the columns for the "config_items" table.
|
||||
ConfigItemsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "name", Type: field.TypeString, Unique: true},
|
||||
{Name: "value", Type: field.TypeString},
|
||||
}
|
||||
|
@ -95,8 +95,8 @@ var (
|
|||
// DecisionsColumns holds the columns for the "decisions" table.
|
||||
DecisionsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "until", Type: field.TypeTime, Nullable: true, SchemaType: map[string]string{"mysql": "datetime"}},
|
||||
{Name: "scenario", Type: field.TypeString},
|
||||
{Name: "type", Type: field.TypeString},
|
||||
|
@ -151,8 +151,8 @@ var (
|
|||
// EventsColumns holds the columns for the "events" table.
|
||||
EventsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "time", Type: field.TypeTime},
|
||||
{Name: "serialized", Type: field.TypeString, Size: 8191},
|
||||
{Name: "alert_events", Type: field.TypeInt, Nullable: true},
|
||||
|
@ -193,8 +193,8 @@ var (
|
|||
// MachinesColumns holds the columns for the "machines" table.
|
||||
MachinesColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "last_push", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "last_heartbeat", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "machine_id", Type: field.TypeString, Unique: true},
|
||||
|
@ -215,8 +215,8 @@ var (
|
|||
// MetaColumns holds the columns for the "meta" table.
|
||||
MetaColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "created_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "key", Type: field.TypeString},
|
||||
{Name: "value", Type: field.TypeString, Size: 4095},
|
||||
{Name: "alert_metas", Type: field.TypeInt, Nullable: true},
|
||||
|
|
|
@ -206,7 +206,7 @@ func (m *AlertMutation) CreatedAt() (r time.Time, exists bool) {
|
|||
// OldCreatedAt returns the old "created_at" field's value of the Alert entity.
|
||||
// If the Alert 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 *AlertMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *AlertMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -220,22 +220,9 @@ func (m *AlertMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err err
|
|||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *AlertMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[alert.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *AlertMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[alert.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *AlertMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, alert.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
|
@ -255,7 +242,7 @@ func (m *AlertMutation) UpdatedAt() (r time.Time, exists bool) {
|
|||
// OldUpdatedAt returns the old "updated_at" field's value of the Alert entity.
|
||||
// If the Alert 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 *AlertMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *AlertMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -269,22 +256,9 @@ func (m *AlertMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err err
|
|||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *AlertMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[alert.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *AlertMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[alert.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *AlertMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, alert.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// SetScenario sets the "scenario" field.
|
||||
|
@ -2039,12 +2013,6 @@ func (m *AlertMutation) AddField(name string, value ent.Value) error {
|
|||
// mutation.
|
||||
func (m *AlertMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(alert.FieldCreatedAt) {
|
||||
fields = append(fields, alert.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(alert.FieldUpdatedAt) {
|
||||
fields = append(fields, alert.FieldUpdatedAt)
|
||||
}
|
||||
if m.FieldCleared(alert.FieldBucketId) {
|
||||
fields = append(fields, alert.FieldBucketId)
|
||||
}
|
||||
|
@ -2116,12 +2084,6 @@ func (m *AlertMutation) FieldCleared(name string) bool {
|
|||
// error if the field is not defined in the schema.
|
||||
func (m *AlertMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case alert.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case alert.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
case alert.FieldBucketId:
|
||||
m.ClearBucketId()
|
||||
return nil
|
||||
|
@ -2552,7 +2514,7 @@ func (m *BouncerMutation) CreatedAt() (r time.Time, exists bool) {
|
|||
// OldCreatedAt returns the old "created_at" field's value of the Bouncer entity.
|
||||
// If the Bouncer 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 *BouncerMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *BouncerMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -2566,22 +2528,9 @@ func (m *BouncerMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err e
|
|||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *BouncerMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[bouncer.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *BouncerMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[bouncer.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *BouncerMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, bouncer.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
|
@ -2601,7 +2550,7 @@ func (m *BouncerMutation) UpdatedAt() (r time.Time, exists bool) {
|
|||
// OldUpdatedAt returns the old "updated_at" field's value of the Bouncer entity.
|
||||
// If the Bouncer 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 *BouncerMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *BouncerMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -2615,22 +2564,9 @@ func (m *BouncerMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err e
|
|||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *BouncerMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[bouncer.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *BouncerMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[bouncer.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *BouncerMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, bouncer.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
|
@ -3254,12 +3190,6 @@ func (m *BouncerMutation) AddField(name string, value ent.Value) error {
|
|||
// mutation.
|
||||
func (m *BouncerMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(bouncer.FieldCreatedAt) {
|
||||
fields = append(fields, bouncer.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(bouncer.FieldUpdatedAt) {
|
||||
fields = append(fields, bouncer.FieldUpdatedAt)
|
||||
}
|
||||
if m.FieldCleared(bouncer.FieldIPAddress) {
|
||||
fields = append(fields, bouncer.FieldIPAddress)
|
||||
}
|
||||
|
@ -3286,12 +3216,6 @@ func (m *BouncerMutation) FieldCleared(name string) bool {
|
|||
// error if the field is not defined in the schema.
|
||||
func (m *BouncerMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case bouncer.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case bouncer.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
case bouncer.FieldIPAddress:
|
||||
m.ClearIPAddress()
|
||||
return nil
|
||||
|
@ -3528,7 +3452,7 @@ func (m *ConfigItemMutation) CreatedAt() (r time.Time, exists bool) {
|
|||
// OldCreatedAt returns the old "created_at" field's value of the ConfigItem entity.
|
||||
// If the ConfigItem 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 *ConfigItemMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *ConfigItemMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -3542,22 +3466,9 @@ func (m *ConfigItemMutation) OldCreatedAt(ctx context.Context) (v *time.Time, er
|
|||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *ConfigItemMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[configitem.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *ConfigItemMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[configitem.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *ConfigItemMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, configitem.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
|
@ -3577,7 +3488,7 @@ func (m *ConfigItemMutation) UpdatedAt() (r time.Time, exists bool) {
|
|||
// OldUpdatedAt returns the old "updated_at" field's value of the ConfigItem entity.
|
||||
// If the ConfigItem 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 *ConfigItemMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *ConfigItemMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -3591,22 +3502,9 @@ func (m *ConfigItemMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, er
|
|||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *ConfigItemMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[configitem.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *ConfigItemMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[configitem.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *ConfigItemMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, configitem.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
|
@ -3827,14 +3725,7 @@ func (m *ConfigItemMutation) AddField(name string, value ent.Value) error {
|
|||
// ClearedFields returns all nullable fields that were cleared during this
|
||||
// mutation.
|
||||
func (m *ConfigItemMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(configitem.FieldCreatedAt) {
|
||||
fields = append(fields, configitem.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(configitem.FieldUpdatedAt) {
|
||||
fields = append(fields, configitem.FieldUpdatedAt)
|
||||
}
|
||||
return fields
|
||||
return nil
|
||||
}
|
||||
|
||||
// FieldCleared returns a boolean indicating if a field with the given name was
|
||||
|
@ -3847,14 +3738,6 @@ func (m *ConfigItemMutation) FieldCleared(name string) bool {
|
|||
// ClearField clears the value of the field with the given name. It returns an
|
||||
// error if the field is not defined in the schema.
|
||||
func (m *ConfigItemMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case configitem.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case configitem.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown ConfigItem nullable field %s", name)
|
||||
}
|
||||
|
||||
|
@ -4075,7 +3958,7 @@ func (m *DecisionMutation) CreatedAt() (r time.Time, exists bool) {
|
|||
// OldCreatedAt returns the old "created_at" field's value of the Decision entity.
|
||||
// If the Decision 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 *DecisionMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *DecisionMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -4089,22 +3972,9 @@ func (m *DecisionMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err
|
|||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *DecisionMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[decision.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *DecisionMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[decision.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *DecisionMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, decision.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
|
@ -4124,7 +3994,7 @@ func (m *DecisionMutation) UpdatedAt() (r time.Time, exists bool) {
|
|||
// OldUpdatedAt returns the old "updated_at" field's value of the Decision entity.
|
||||
// If the Decision 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 *DecisionMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *DecisionMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -4138,22 +4008,9 @@ func (m *DecisionMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err
|
|||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *DecisionMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[decision.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *DecisionMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[decision.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *DecisionMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, decision.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// SetUntil sets the "until" field.
|
||||
|
@ -5287,12 +5144,6 @@ func (m *DecisionMutation) AddField(name string, value ent.Value) error {
|
|||
// mutation.
|
||||
func (m *DecisionMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(decision.FieldCreatedAt) {
|
||||
fields = append(fields, decision.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(decision.FieldUpdatedAt) {
|
||||
fields = append(fields, decision.FieldUpdatedAt)
|
||||
}
|
||||
if m.FieldCleared(decision.FieldUntil) {
|
||||
fields = append(fields, decision.FieldUntil)
|
||||
}
|
||||
|
@ -5331,12 +5182,6 @@ func (m *DecisionMutation) FieldCleared(name string) bool {
|
|||
// error if the field is not defined in the schema.
|
||||
func (m *DecisionMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case decision.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case decision.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
case decision.FieldUntil:
|
||||
m.ClearUntil()
|
||||
return nil
|
||||
|
@ -5628,7 +5473,7 @@ func (m *EventMutation) CreatedAt() (r time.Time, exists bool) {
|
|||
// OldCreatedAt returns the old "created_at" field's value of the Event entity.
|
||||
// If the Event 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 *EventMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *EventMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -5642,22 +5487,9 @@ func (m *EventMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err err
|
|||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *EventMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[event.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *EventMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[event.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *EventMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, event.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
|
@ -5677,7 +5509,7 @@ func (m *EventMutation) UpdatedAt() (r time.Time, exists bool) {
|
|||
// OldUpdatedAt returns the old "updated_at" field's value of the Event entity.
|
||||
// If the Event 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 *EventMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *EventMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -5691,22 +5523,9 @@ func (m *EventMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err err
|
|||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *EventMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[event.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *EventMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[event.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *EventMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, event.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// SetTime sets the "time" field.
|
||||
|
@ -6034,12 +5853,6 @@ func (m *EventMutation) AddField(name string, value ent.Value) error {
|
|||
// mutation.
|
||||
func (m *EventMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(event.FieldCreatedAt) {
|
||||
fields = append(fields, event.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(event.FieldUpdatedAt) {
|
||||
fields = append(fields, event.FieldUpdatedAt)
|
||||
}
|
||||
if m.FieldCleared(event.FieldAlertEvents) {
|
||||
fields = append(fields, event.FieldAlertEvents)
|
||||
}
|
||||
|
@ -6057,12 +5870,6 @@ func (m *EventMutation) FieldCleared(name string) bool {
|
|||
// error if the field is not defined in the schema.
|
||||
func (m *EventMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case event.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case event.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
case event.FieldAlertEvents:
|
||||
m.ClearAlertEvents()
|
||||
return nil
|
||||
|
@ -6689,7 +6496,7 @@ func (m *MachineMutation) CreatedAt() (r time.Time, exists bool) {
|
|||
// OldCreatedAt returns the old "created_at" field's value of the Machine entity.
|
||||
// If the Machine 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 *MachineMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *MachineMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -6703,22 +6510,9 @@ func (m *MachineMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err e
|
|||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *MachineMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[machine.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *MachineMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[machine.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *MachineMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, machine.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
|
@ -6738,7 +6532,7 @@ func (m *MachineMutation) UpdatedAt() (r time.Time, exists bool) {
|
|||
// OldUpdatedAt returns the old "updated_at" field's value of the Machine entity.
|
||||
// If the Machine 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 *MachineMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *MachineMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -6752,22 +6546,9 @@ func (m *MachineMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err e
|
|||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *MachineMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[machine.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *MachineMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[machine.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *MachineMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, machine.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// SetLastPush sets the "last_push" field.
|
||||
|
@ -7508,12 +7289,6 @@ func (m *MachineMutation) AddField(name string, value ent.Value) error {
|
|||
// mutation.
|
||||
func (m *MachineMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(machine.FieldCreatedAt) {
|
||||
fields = append(fields, machine.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(machine.FieldUpdatedAt) {
|
||||
fields = append(fields, machine.FieldUpdatedAt)
|
||||
}
|
||||
if m.FieldCleared(machine.FieldLastPush) {
|
||||
fields = append(fields, machine.FieldLastPush)
|
||||
}
|
||||
|
@ -7543,12 +7318,6 @@ func (m *MachineMutation) FieldCleared(name string) bool {
|
|||
// error if the field is not defined in the schema.
|
||||
func (m *MachineMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case machine.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case machine.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
case machine.FieldLastPush:
|
||||
m.ClearLastPush()
|
||||
return nil
|
||||
|
@ -7829,7 +7598,7 @@ func (m *MetaMutation) CreatedAt() (r time.Time, exists bool) {
|
|||
// OldCreatedAt returns the old "created_at" field's value of the Meta entity.
|
||||
// If the Meta 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 *MetaMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *MetaMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -7843,22 +7612,9 @@ func (m *MetaMutation) OldCreatedAt(ctx context.Context) (v *time.Time, err erro
|
|||
return oldValue.CreatedAt, nil
|
||||
}
|
||||
|
||||
// ClearCreatedAt clears the value of the "created_at" field.
|
||||
func (m *MetaMutation) ClearCreatedAt() {
|
||||
m.created_at = nil
|
||||
m.clearedFields[meta.FieldCreatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
|
||||
func (m *MetaMutation) CreatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[meta.FieldCreatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetCreatedAt resets all changes to the "created_at" field.
|
||||
func (m *MetaMutation) ResetCreatedAt() {
|
||||
m.created_at = nil
|
||||
delete(m.clearedFields, meta.FieldCreatedAt)
|
||||
}
|
||||
|
||||
// SetUpdatedAt sets the "updated_at" field.
|
||||
|
@ -7878,7 +7634,7 @@ func (m *MetaMutation) UpdatedAt() (r time.Time, exists bool) {
|
|||
// OldUpdatedAt returns the old "updated_at" field's value of the Meta entity.
|
||||
// If the Meta 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 *MetaMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err error) {
|
||||
func (m *MetaMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
|
||||
}
|
||||
|
@ -7892,22 +7648,9 @@ func (m *MetaMutation) OldUpdatedAt(ctx context.Context) (v *time.Time, err erro
|
|||
return oldValue.UpdatedAt, nil
|
||||
}
|
||||
|
||||
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||
func (m *MetaMutation) ClearUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
m.clearedFields[meta.FieldUpdatedAt] = struct{}{}
|
||||
}
|
||||
|
||||
// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
|
||||
func (m *MetaMutation) UpdatedAtCleared() bool {
|
||||
_, ok := m.clearedFields[meta.FieldUpdatedAt]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetUpdatedAt resets all changes to the "updated_at" field.
|
||||
func (m *MetaMutation) ResetUpdatedAt() {
|
||||
m.updated_at = nil
|
||||
delete(m.clearedFields, meta.FieldUpdatedAt)
|
||||
}
|
||||
|
||||
// SetKey sets the "key" field.
|
||||
|
@ -8235,12 +7978,6 @@ func (m *MetaMutation) AddField(name string, value ent.Value) error {
|
|||
// mutation.
|
||||
func (m *MetaMutation) ClearedFields() []string {
|
||||
var fields []string
|
||||
if m.FieldCleared(meta.FieldCreatedAt) {
|
||||
fields = append(fields, meta.FieldCreatedAt)
|
||||
}
|
||||
if m.FieldCleared(meta.FieldUpdatedAt) {
|
||||
fields = append(fields, meta.FieldUpdatedAt)
|
||||
}
|
||||
if m.FieldCleared(meta.FieldAlertMetas) {
|
||||
fields = append(fields, meta.FieldAlertMetas)
|
||||
}
|
||||
|
@ -8258,12 +7995,6 @@ func (m *MetaMutation) FieldCleared(name string) bool {
|
|||
// error if the field is not defined in the schema.
|
||||
func (m *MetaMutation) ClearField(name string) error {
|
||||
switch name {
|
||||
case meta.FieldCreatedAt:
|
||||
m.ClearCreatedAt()
|
||||
return nil
|
||||
case meta.FieldUpdatedAt:
|
||||
m.ClearUpdatedAt()
|
||||
return nil
|
||||
case meta.FieldAlertMetas:
|
||||
m.ClearAlertMetas()
|
||||
return nil
|
||||
|
|
|
@ -26,8 +26,6 @@ func init() {
|
|||
alertDescCreatedAt := alertFields[0].Descriptor()
|
||||
// alert.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
alert.DefaultCreatedAt = alertDescCreatedAt.Default.(func() time.Time)
|
||||
// alert.UpdateDefaultCreatedAt holds the default value on update for the created_at field.
|
||||
alert.UpdateDefaultCreatedAt = alertDescCreatedAt.UpdateDefault.(func() time.Time)
|
||||
// alertDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
alertDescUpdatedAt := alertFields[1].Descriptor()
|
||||
// alert.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
|
@ -64,8 +62,6 @@ func init() {
|
|||
bouncerDescCreatedAt := bouncerFields[0].Descriptor()
|
||||
// bouncer.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
bouncer.DefaultCreatedAt = bouncerDescCreatedAt.Default.(func() time.Time)
|
||||
// bouncer.UpdateDefaultCreatedAt holds the default value on update for the created_at field.
|
||||
bouncer.UpdateDefaultCreatedAt = bouncerDescCreatedAt.UpdateDefault.(func() time.Time)
|
||||
// bouncerDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
bouncerDescUpdatedAt := bouncerFields[1].Descriptor()
|
||||
// bouncer.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
|
@ -94,8 +90,6 @@ func init() {
|
|||
configitemDescCreatedAt := configitemFields[0].Descriptor()
|
||||
// configitem.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
configitem.DefaultCreatedAt = configitemDescCreatedAt.Default.(func() time.Time)
|
||||
// configitem.UpdateDefaultCreatedAt holds the default value on update for the created_at field.
|
||||
configitem.UpdateDefaultCreatedAt = configitemDescCreatedAt.UpdateDefault.(func() time.Time)
|
||||
// configitemDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
configitemDescUpdatedAt := configitemFields[1].Descriptor()
|
||||
// configitem.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
|
@ -108,8 +102,6 @@ func init() {
|
|||
decisionDescCreatedAt := decisionFields[0].Descriptor()
|
||||
// decision.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
decision.DefaultCreatedAt = decisionDescCreatedAt.Default.(func() time.Time)
|
||||
// decision.UpdateDefaultCreatedAt holds the default value on update for the created_at field.
|
||||
decision.UpdateDefaultCreatedAt = decisionDescCreatedAt.UpdateDefault.(func() time.Time)
|
||||
// decisionDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
decisionDescUpdatedAt := decisionFields[1].Descriptor()
|
||||
// decision.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
|
@ -126,8 +118,6 @@ func init() {
|
|||
eventDescCreatedAt := eventFields[0].Descriptor()
|
||||
// event.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
event.DefaultCreatedAt = eventDescCreatedAt.Default.(func() time.Time)
|
||||
// event.UpdateDefaultCreatedAt holds the default value on update for the created_at field.
|
||||
event.UpdateDefaultCreatedAt = eventDescCreatedAt.UpdateDefault.(func() time.Time)
|
||||
// eventDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
eventDescUpdatedAt := eventFields[1].Descriptor()
|
||||
// event.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
|
@ -150,8 +140,6 @@ func init() {
|
|||
machineDescCreatedAt := machineFields[0].Descriptor()
|
||||
// machine.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
machine.DefaultCreatedAt = machineDescCreatedAt.Default.(func() time.Time)
|
||||
// machine.UpdateDefaultCreatedAt holds the default value on update for the created_at field.
|
||||
machine.UpdateDefaultCreatedAt = machineDescCreatedAt.UpdateDefault.(func() time.Time)
|
||||
// machineDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
machineDescUpdatedAt := machineFields[1].Descriptor()
|
||||
// machine.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
|
@ -162,14 +150,10 @@ func init() {
|
|||
machineDescLastPush := machineFields[2].Descriptor()
|
||||
// machine.DefaultLastPush holds the default value on creation for the last_push field.
|
||||
machine.DefaultLastPush = machineDescLastPush.Default.(func() time.Time)
|
||||
// machine.UpdateDefaultLastPush holds the default value on update for the last_push field.
|
||||
machine.UpdateDefaultLastPush = machineDescLastPush.UpdateDefault.(func() time.Time)
|
||||
// machineDescLastHeartbeat is the schema descriptor for last_heartbeat field.
|
||||
machineDescLastHeartbeat := machineFields[3].Descriptor()
|
||||
// machine.DefaultLastHeartbeat holds the default value on creation for the last_heartbeat field.
|
||||
machine.DefaultLastHeartbeat = machineDescLastHeartbeat.Default.(func() time.Time)
|
||||
// machine.UpdateDefaultLastHeartbeat holds the default value on update for the last_heartbeat field.
|
||||
machine.UpdateDefaultLastHeartbeat = machineDescLastHeartbeat.UpdateDefault.(func() time.Time)
|
||||
// machineDescScenarios is the schema descriptor for scenarios field.
|
||||
machineDescScenarios := machineFields[7].Descriptor()
|
||||
// machine.ScenariosValidator is a validator for the "scenarios" field. It is called by the builders before save.
|
||||
|
@ -188,8 +172,6 @@ func init() {
|
|||
metaDescCreatedAt := metaFields[0].Descriptor()
|
||||
// meta.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||
meta.DefaultCreatedAt = metaDescCreatedAt.Default.(func() time.Time)
|
||||
// meta.UpdateDefaultCreatedAt holds the default value on update for the created_at field.
|
||||
meta.UpdateDefaultCreatedAt = metaDescCreatedAt.UpdateDefault.(func() time.Time)
|
||||
// metaDescUpdatedAt is the schema descriptor for updated_at field.
|
||||
metaDescUpdatedAt := metaFields[1].Descriptor()
|
||||
// meta.DefaultUpdatedAt holds the default value on creation for the updated_at field.
|
||||
|
|
|
@ -19,10 +19,10 @@ func (Alert) Fields() []ent.Field {
|
|||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
Immutable(),
|
||||
field.Time("updated_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
UpdateDefault(types.UtcNow),
|
||||
field.String("scenario"),
|
||||
field.String("bucketId").Default("").Optional(),
|
||||
field.String("message").Default("").Optional(),
|
||||
|
|
|
@ -16,10 +16,10 @@ func (Bouncer) Fields() []ent.Field {
|
|||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional().StructTag(`json:"created_at"`),
|
||||
StructTag(`json:"created_at"`),
|
||||
field.Time("updated_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional().StructTag(`json:"updated_at"`),
|
||||
UpdateDefault(types.UtcNow).StructTag(`json:"updated_at"`),
|
||||
field.String("name").Unique().StructTag(`json:"name"`),
|
||||
field.String("api_key").Sensitive(), // hash of api_key
|
||||
field.Bool("revoked").StructTag(`json:"revoked"`),
|
||||
|
|
|
@ -11,21 +11,20 @@ type ConfigItem struct {
|
|||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Bouncer.
|
||||
func (ConfigItem) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional().StructTag(`json:"created_at"`),
|
||||
Immutable().
|
||||
StructTag(`json:"created_at"`),
|
||||
field.Time("updated_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional().StructTag(`json:"updated_at"`),
|
||||
UpdateDefault(types.UtcNow).StructTag(`json:"updated_at"`),
|
||||
field.String("name").Unique().StructTag(`json:"name"`),
|
||||
field.String("value").StructTag(`json:"value"`), // a json object
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Bouncer.
|
||||
func (ConfigItem) Edges() []ent.Edge {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@ func (Decision) Fields() []ent.Field {
|
|||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
Immutable(),
|
||||
field.Time("updated_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
UpdateDefault(types.UtcNow),
|
||||
field.Time("until").Nillable().Optional().SchemaType(map[string]string{
|
||||
dialect.MySQL: "datetime",
|
||||
}),
|
||||
|
|
|
@ -18,10 +18,10 @@ func (Event) Fields() []ent.Field {
|
|||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
Immutable(),
|
||||
field.Time("updated_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
UpdateDefault(types.UtcNow),
|
||||
field.Time("time"),
|
||||
field.String("serialized").MaxLen(8191),
|
||||
field.Int("alert_events").Optional(),
|
||||
|
|
|
@ -12,7 +12,7 @@ type Lock struct {
|
|||
|
||||
func (Lock) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("name").Unique().StructTag(`json:"name"`),
|
||||
field.String("name").Unique().Immutable().StructTag(`json:"name"`),
|
||||
field.Time("created_at").Default(types.UtcNow).StructTag(`json:"created_at"`),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,17 +17,19 @@ func (Machine) Fields() []ent.Field {
|
|||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
Immutable(),
|
||||
field.Time("updated_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
UpdateDefault(types.UtcNow),
|
||||
field.Time("last_push").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
Nillable().Optional(),
|
||||
field.Time("last_heartbeat").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
field.String("machineId").Unique(),
|
||||
Nillable().Optional(),
|
||||
field.String("machineId").
|
||||
Unique().
|
||||
Immutable(),
|
||||
field.String("password").Sensitive(),
|
||||
field.String("ipAddress"),
|
||||
field.String("scenarios").MaxLen(100000).Optional(),
|
||||
|
|
|
@ -17,11 +17,10 @@ type Meta struct {
|
|||
func (Meta) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Time("created_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
Default(types.UtcNow),
|
||||
field.Time("updated_at").
|
||||
Default(types.UtcNow).
|
||||
UpdateDefault(types.UtcNow).Nillable().Optional(),
|
||||
UpdateDefault(types.UtcNow),
|
||||
field.String("key"),
|
||||
field.String("value").MaxLen(4095),
|
||||
field.Int("alert_metas").Optional(),
|
||||
|
|
|
@ -134,14 +134,6 @@ func (c *Client) BulkDeleteWatchers(machines []*ent.Machine) (int, error) {
|
|||
return nbDeleted, nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateMachineLastPush(machineID string) error {
|
||||
_, err := c.Ent.Machine.Update().Where(machine.MachineIdEQ(machineID)).SetLastPush(time.Now().UTC()).Save(c.CTX)
|
||||
if err != nil {
|
||||
return errors.Wrapf(UpdateFail, "updating machine last_push: %s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateMachineLastHeartBeat(machineID string) error {
|
||||
_, err := c.Ent.Machine.Update().Where(machine.MachineIdEQ(machineID)).SetLastHeartbeat(time.Now().UTC()).Save(c.CTX)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue