From 9d1838f75d257cec150e5e9003979ca7475f26ff Mon Sep 17 00:00:00 2001 From: syui Date: Thu, 11 Apr 2024 06:34:59 +0900 Subject: [PATCH] fix --- ent/migrate/schema.go | 4 +- ent/mutation.go | 92 +++++++++++++++++++++++++++++----- ent/ogent/oas_schemas_gen.go | 84 +++++++++++++++---------------- ent/ogent/responses.go | 20 ++++---- ent/openapi.json | 32 ++++++------ ent/schema/seven.go | 4 +- ent/sev.go | 20 ++++---- ent/sev/where.go | 86 +++++++------------------------- ent/sev_create.go | 24 ++++----- ent/sev_update.go | 96 +++++++++++++++++++++++++----------- 10 files changed, 260 insertions(+), 202 deletions(-) diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 2f6dfdb..f8ad6b8 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -98,8 +98,8 @@ var ( {Name: "count", Type: field.TypeInt, Nullable: true}, {Name: "handle", Type: field.TypeString, Nullable: true}, {Name: "did", Type: field.TypeString, Nullable: true}, - {Name: "uid", Type: field.TypeString, Nullable: true}, - {Name: "cid", Type: field.TypeString, Nullable: true}, + {Name: "uid", Type: field.TypeInt, Nullable: true}, + {Name: "cid", Type: field.TypeInt, Nullable: true}, {Name: "updated_at", Type: field.TypeTime, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "user_sev", Type: field.TypeInt}, diff --git a/ent/mutation.go b/ent/mutation.go index 2dd1072..5d9df2c 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -3063,8 +3063,10 @@ type SevMutation struct { addcount *int handle *string did *string - uid *string - cid *string + uid *int + adduid *int + cid *int + addcid *int updated_at *time.Time created_at *time.Time clearedFields map[string]struct{} @@ -3476,12 +3478,13 @@ func (m *SevMutation) ResetDid() { } // SetUID sets the "uid" field. -func (m *SevMutation) SetUID(s string) { - m.uid = &s +func (m *SevMutation) SetUID(i int) { + m.uid = &i + m.adduid = nil } // UID returns the value of the "uid" field in the mutation. -func (m *SevMutation) UID() (r string, exists bool) { +func (m *SevMutation) UID() (r int, exists bool) { v := m.uid if v == nil { return @@ -3492,7 +3495,7 @@ func (m *SevMutation) UID() (r string, exists bool) { // OldUID returns the old "uid" field's value of the Sev entity. // If the Sev 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 *SevMutation) OldUID(ctx context.Context) (v string, err error) { +func (m *SevMutation) OldUID(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldUID is only allowed on UpdateOne operations") } @@ -3506,9 +3509,28 @@ func (m *SevMutation) OldUID(ctx context.Context) (v string, err error) { return oldValue.UID, nil } +// AddUID adds i to the "uid" field. +func (m *SevMutation) AddUID(i int) { + if m.adduid != nil { + *m.adduid += i + } else { + m.adduid = &i + } +} + +// AddedUID returns the value that was added to the "uid" field in this mutation. +func (m *SevMutation) AddedUID() (r int, exists bool) { + v := m.adduid + if v == nil { + return + } + return *v, true +} + // ClearUID clears the value of the "uid" field. func (m *SevMutation) ClearUID() { m.uid = nil + m.adduid = nil m.clearedFields[sev.FieldUID] = struct{}{} } @@ -3521,16 +3543,18 @@ func (m *SevMutation) UIDCleared() bool { // ResetUID resets all changes to the "uid" field. func (m *SevMutation) ResetUID() { m.uid = nil + m.adduid = nil delete(m.clearedFields, sev.FieldUID) } // SetCid sets the "cid" field. -func (m *SevMutation) SetCid(s string) { - m.cid = &s +func (m *SevMutation) SetCid(i int) { + m.cid = &i + m.addcid = nil } // Cid returns the value of the "cid" field in the mutation. -func (m *SevMutation) Cid() (r string, exists bool) { +func (m *SevMutation) Cid() (r int, exists bool) { v := m.cid if v == nil { return @@ -3541,7 +3565,7 @@ func (m *SevMutation) Cid() (r string, exists bool) { // OldCid returns the old "cid" field's value of the Sev entity. // If the Sev 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 *SevMutation) OldCid(ctx context.Context) (v string, err error) { +func (m *SevMutation) OldCid(ctx context.Context) (v int, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldCid is only allowed on UpdateOne operations") } @@ -3555,9 +3579,28 @@ func (m *SevMutation) OldCid(ctx context.Context) (v string, err error) { return oldValue.Cid, nil } +// AddCid adds i to the "cid" field. +func (m *SevMutation) AddCid(i int) { + if m.addcid != nil { + *m.addcid += i + } else { + m.addcid = &i + } +} + +// AddedCid returns the value that was added to the "cid" field in this mutation. +func (m *SevMutation) AddedCid() (r int, exists bool) { + v := m.addcid + if v == nil { + return + } + return *v, true +} + // ClearCid clears the value of the "cid" field. func (m *SevMutation) ClearCid() { m.cid = nil + m.addcid = nil m.clearedFields[sev.FieldCid] = struct{}{} } @@ -3570,6 +3613,7 @@ func (m *SevMutation) CidCleared() bool { // ResetCid resets all changes to the "cid" field. func (m *SevMutation) ResetCid() { m.cid = nil + m.addcid = nil delete(m.clearedFields, sev.FieldCid) } @@ -3884,14 +3928,14 @@ func (m *SevMutation) SetField(name string, value ent.Value) error { m.SetDid(v) return nil case sev.FieldUID: - v, ok := value.(string) + v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetUID(v) return nil case sev.FieldCid: - v, ok := value.(string) + v, ok := value.(int) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } @@ -3922,6 +3966,12 @@ func (m *SevMutation) AddedFields() []string { if m.addcount != nil { fields = append(fields, sev.FieldCount) } + if m.adduid != nil { + fields = append(fields, sev.FieldUID) + } + if m.addcid != nil { + fields = append(fields, sev.FieldCid) + } return fields } @@ -3932,6 +3982,10 @@ func (m *SevMutation) AddedField(name string) (ent.Value, bool) { switch name { case sev.FieldCount: return m.AddedCount() + case sev.FieldUID: + return m.AddedUID() + case sev.FieldCid: + return m.AddedCid() } return nil, false } @@ -3948,6 +4002,20 @@ func (m *SevMutation) AddField(name string, value ent.Value) error { } m.AddCount(v) return nil + case sev.FieldUID: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddUID(v) + return nil + case sev.FieldCid: + v, ok := value.(int) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.AddCid(v) + return nil } return fmt.Errorf("unknown Sev numeric field %s", name) } diff --git a/ent/ogent/oas_schemas_gen.go b/ent/ogent/oas_schemas_gen.go index de264e8..eb628ad 100644 --- a/ent/ogent/oas_schemas_gen.go +++ b/ent/ogent/oas_schemas_gen.go @@ -1306,8 +1306,8 @@ type CreateSevReq struct { Count OptInt `json:"count"` Handle OptString `json:"handle"` Did OptString `json:"did"` - UID OptString `json:"uid"` - Cid OptString `json:"cid"` + UID OptInt `json:"uid"` + Cid OptInt `json:"cid"` UpdatedAt OptDateTime `json:"updated_at"` CreatedAt OptDateTime `json:"created_at"` Owner int `json:"owner"` @@ -1344,12 +1344,12 @@ func (s *CreateSevReq) GetDid() OptString { } // GetUID returns the value of UID. -func (s *CreateSevReq) GetUID() OptString { +func (s *CreateSevReq) GetUID() OptInt { return s.UID } // GetCid returns the value of Cid. -func (s *CreateSevReq) GetCid() OptString { +func (s *CreateSevReq) GetCid() OptInt { return s.Cid } @@ -1399,12 +1399,12 @@ func (s *CreateSevReq) SetDid(val OptString) { } // SetUID sets the value of UID. -func (s *CreateSevReq) SetUID(val OptString) { +func (s *CreateSevReq) SetUID(val OptInt) { s.UID = val } // SetCid sets the value of Cid. -func (s *CreateSevReq) SetCid(val OptString) { +func (s *CreateSevReq) SetCid(val OptInt) { s.Cid = val } @@ -4604,8 +4604,8 @@ type SevCreate struct { Count OptInt `json:"count"` Handle OptString `json:"handle"` Did OptString `json:"did"` - UID OptString `json:"uid"` - Cid OptString `json:"cid"` + UID OptInt `json:"uid"` + Cid OptInt `json:"cid"` UpdatedAt OptDateTime `json:"updated_at"` CreatedAt OptDateTime `json:"created_at"` } @@ -4636,12 +4636,12 @@ func (s *SevCreate) GetDid() OptString { } // GetUID returns the value of UID. -func (s *SevCreate) GetUID() OptString { +func (s *SevCreate) GetUID() OptInt { return s.UID } // GetCid returns the value of Cid. -func (s *SevCreate) GetCid() OptString { +func (s *SevCreate) GetCid() OptInt { return s.Cid } @@ -4681,12 +4681,12 @@ func (s *SevCreate) SetDid(val OptString) { } // SetUID sets the value of UID. -func (s *SevCreate) SetUID(val OptString) { +func (s *SevCreate) SetUID(val OptInt) { s.UID = val } // SetCid sets the value of Cid. -func (s *SevCreate) SetCid(val OptString) { +func (s *SevCreate) SetCid(val OptInt) { s.Cid = val } @@ -4709,8 +4709,8 @@ type SevList struct { Count OptInt `json:"count"` Handle OptString `json:"handle"` Did OptString `json:"did"` - UID OptString `json:"uid"` - Cid OptString `json:"cid"` + UID OptInt `json:"uid"` + Cid OptInt `json:"cid"` UpdatedAt OptDateTime `json:"updated_at"` CreatedAt OptDateTime `json:"created_at"` } @@ -4741,12 +4741,12 @@ func (s *SevList) GetDid() OptString { } // GetUID returns the value of UID. -func (s *SevList) GetUID() OptString { +func (s *SevList) GetUID() OptInt { return s.UID } // GetCid returns the value of Cid. -func (s *SevList) GetCid() OptString { +func (s *SevList) GetCid() OptInt { return s.Cid } @@ -4786,12 +4786,12 @@ func (s *SevList) SetDid(val OptString) { } // SetUID sets the value of UID. -func (s *SevList) SetUID(val OptString) { +func (s *SevList) SetUID(val OptInt) { s.UID = val } // SetCid sets the value of Cid. -func (s *SevList) SetCid(val OptString) { +func (s *SevList) SetCid(val OptInt) { s.Cid = val } @@ -5357,8 +5357,8 @@ type SevRead struct { Count OptInt `json:"count"` Handle OptString `json:"handle"` Did OptString `json:"did"` - UID OptString `json:"uid"` - Cid OptString `json:"cid"` + UID OptInt `json:"uid"` + Cid OptInt `json:"cid"` UpdatedAt OptDateTime `json:"updated_at"` CreatedAt OptDateTime `json:"created_at"` } @@ -5389,12 +5389,12 @@ func (s *SevRead) GetDid() OptString { } // GetUID returns the value of UID. -func (s *SevRead) GetUID() OptString { +func (s *SevRead) GetUID() OptInt { return s.UID } // GetCid returns the value of Cid. -func (s *SevRead) GetCid() OptString { +func (s *SevRead) GetCid() OptInt { return s.Cid } @@ -5434,12 +5434,12 @@ func (s *SevRead) SetDid(val OptString) { } // SetUID sets the value of UID. -func (s *SevRead) SetUID(val OptString) { +func (s *SevRead) SetUID(val OptInt) { s.UID = val } // SetCid sets the value of Cid. -func (s *SevRead) SetCid(val OptString) { +func (s *SevRead) SetCid(val OptInt) { s.Cid = val } @@ -5462,8 +5462,8 @@ type SevUpdate struct { Count OptInt `json:"count"` Handle OptString `json:"handle"` Did OptString `json:"did"` - UID OptString `json:"uid"` - Cid OptString `json:"cid"` + UID OptInt `json:"uid"` + Cid OptInt `json:"cid"` UpdatedAt OptDateTime `json:"updated_at"` CreatedAt OptDateTime `json:"created_at"` } @@ -5494,12 +5494,12 @@ func (s *SevUpdate) GetDid() OptString { } // GetUID returns the value of UID. -func (s *SevUpdate) GetUID() OptString { +func (s *SevUpdate) GetUID() OptInt { return s.UID } // GetCid returns the value of Cid. -func (s *SevUpdate) GetCid() OptString { +func (s *SevUpdate) GetCid() OptInt { return s.Cid } @@ -5539,12 +5539,12 @@ func (s *SevUpdate) SetDid(val OptString) { } // SetUID sets the value of UID. -func (s *SevUpdate) SetUID(val OptString) { +func (s *SevUpdate) SetUID(val OptInt) { s.UID = val } // SetCid sets the value of Cid. -func (s *SevUpdate) SetCid(val OptString) { +func (s *SevUpdate) SetCid(val OptInt) { s.Cid = val } @@ -7198,8 +7198,8 @@ type UpdateSevReq struct { Count OptInt `json:"count"` Handle OptString `json:"handle"` Did OptString `json:"did"` - UID OptString `json:"uid"` - Cid OptString `json:"cid"` + UID OptInt `json:"uid"` + Cid OptInt `json:"cid"` UpdatedAt OptDateTime `json:"updated_at"` Owner OptInt `json:"owner"` } @@ -7230,12 +7230,12 @@ func (s *UpdateSevReq) GetDid() OptString { } // GetUID returns the value of UID. -func (s *UpdateSevReq) GetUID() OptString { +func (s *UpdateSevReq) GetUID() OptInt { return s.UID } // GetCid returns the value of Cid. -func (s *UpdateSevReq) GetCid() OptString { +func (s *UpdateSevReq) GetCid() OptInt { return s.Cid } @@ -7275,12 +7275,12 @@ func (s *UpdateSevReq) SetDid(val OptString) { } // SetUID sets the value of UID. -func (s *UpdateSevReq) SetUID(val OptString) { +func (s *UpdateSevReq) SetUID(val OptInt) { s.UID = val } // SetCid sets the value of Cid. -func (s *UpdateSevReq) SetCid(val OptString) { +func (s *UpdateSevReq) SetCid(val OptInt) { s.Cid = val } @@ -9949,8 +9949,8 @@ type UserSevList struct { Count OptInt `json:"count"` Handle OptString `json:"handle"` Did OptString `json:"did"` - UID OptString `json:"uid"` - Cid OptString `json:"cid"` + UID OptInt `json:"uid"` + Cid OptInt `json:"cid"` UpdatedAt OptDateTime `json:"updated_at"` CreatedAt OptDateTime `json:"created_at"` } @@ -9981,12 +9981,12 @@ func (s *UserSevList) GetDid() OptString { } // GetUID returns the value of UID. -func (s *UserSevList) GetUID() OptString { +func (s *UserSevList) GetUID() OptInt { return s.UID } // GetCid returns the value of Cid. -func (s *UserSevList) GetCid() OptString { +func (s *UserSevList) GetCid() OptInt { return s.Cid } @@ -10026,12 +10026,12 @@ func (s *UserSevList) SetDid(val OptString) { } // SetUID sets the value of UID. -func (s *UserSevList) SetUID(val OptString) { +func (s *UserSevList) SetUID(val OptInt) { s.UID = val } // SetCid sets the value of Cid. -func (s *UserSevList) SetCid(val OptString) { +func (s *UserSevList) SetCid(val OptInt) { s.Cid = val } diff --git a/ent/ogent/responses.go b/ent/ogent/responses.go index d79b05f..335d0c8 100644 --- a/ent/ogent/responses.go +++ b/ent/ogent/responses.go @@ -647,8 +647,8 @@ func NewSevCreate(e *ent.Sev) *SevCreate { ret.Count = NewOptInt(e.Count) ret.Handle = NewOptString(e.Handle) ret.Did = NewOptString(e.Did) - ret.UID = NewOptString(e.UID) - ret.Cid = NewOptString(e.Cid) + ret.UID = NewOptInt(e.UID) + ret.Cid = NewOptInt(e.Cid) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret @@ -682,8 +682,8 @@ func NewSevList(e *ent.Sev) *SevList { ret.Count = NewOptInt(e.Count) ret.Handle = NewOptString(e.Handle) ret.Did = NewOptString(e.Did) - ret.UID = NewOptString(e.UID) - ret.Cid = NewOptString(e.Cid) + ret.UID = NewOptInt(e.UID) + ret.Cid = NewOptInt(e.Cid) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret @@ -717,8 +717,8 @@ func NewSevRead(e *ent.Sev) *SevRead { ret.Count = NewOptInt(e.Count) ret.Handle = NewOptString(e.Handle) ret.Did = NewOptString(e.Did) - ret.UID = NewOptString(e.UID) - ret.Cid = NewOptString(e.Cid) + ret.UID = NewOptInt(e.UID) + ret.Cid = NewOptInt(e.Cid) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret @@ -752,8 +752,8 @@ func NewSevUpdate(e *ent.Sev) *SevUpdate { ret.Count = NewOptInt(e.Count) ret.Handle = NewOptString(e.Handle) ret.Did = NewOptString(e.Did) - ret.UID = NewOptString(e.UID) - ret.Cid = NewOptString(e.Cid) + ret.UID = NewOptInt(e.UID) + ret.Cid = NewOptInt(e.Cid) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret @@ -1487,8 +1487,8 @@ func NewUserSevList(e *ent.Sev) *UserSevList { ret.Count = NewOptInt(e.Count) ret.Handle = NewOptString(e.Handle) ret.Did = NewOptString(e.Did) - ret.UID = NewOptString(e.UID) - ret.Cid = NewOptString(e.Cid) + ret.UID = NewOptInt(e.UID) + ret.Cid = NewOptInt(e.Cid) ret.UpdatedAt = NewOptDateTime(e.UpdatedAt) ret.CreatedAt = NewOptDateTime(e.CreatedAt) return &ret diff --git a/ent/openapi.json b/ent/openapi.json index 961d693..36aa7a8 100644 --- a/ent/openapi.json +++ b/ent/openapi.json @@ -1167,10 +1167,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", @@ -1337,10 +1337,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", @@ -3765,10 +3765,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", @@ -3807,10 +3807,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", @@ -3844,10 +3844,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", @@ -3881,10 +3881,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", @@ -3918,10 +3918,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", @@ -5559,10 +5559,10 @@ "type": "string" }, "uid": { - "type": "string" + "type": "integer" }, "cid": { - "type": "string" + "type": "integer" }, "updated_at": { "type": "string", diff --git a/ent/schema/seven.go b/ent/schema/seven.go index 4137b66..ce8a553 100644 --- a/ent/schema/seven.go +++ b/ent/schema/seven.go @@ -37,10 +37,10 @@ func (Sev) Fields() []ent.Field { field.String("did"). Optional(), - field.String("uid"). + field.Int("uid"). Optional(), - field.String("cid"). + field.Int("cid"). Optional(), field.Time("updated_at"). diff --git a/ent/sev.go b/ent/sev.go index 97b32c4..a74d423 100644 --- a/ent/sev.go +++ b/ent/sev.go @@ -31,9 +31,9 @@ type Sev struct { // Did holds the value of the "did" field. Did string `json:"did,omitempty"` // UID holds the value of the "uid" field. - UID string `json:"uid,omitempty"` + UID int `json:"uid,omitempty"` // Cid holds the value of the "cid" field. - Cid string `json:"cid,omitempty"` + Cid int `json:"cid,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // CreatedAt holds the value of the "created_at" field. @@ -74,9 +74,9 @@ func (*Sev) scanValues(columns []string) ([]any, error) { switch columns[i] { case sev.FieldLimit: values[i] = new(sql.NullBool) - case sev.FieldID, sev.FieldCount: + case sev.FieldID, sev.FieldCount, sev.FieldUID, sev.FieldCid: values[i] = new(sql.NullInt64) - case sev.FieldPassword, sev.FieldToken, sev.FieldHandle, sev.FieldDid, sev.FieldUID, sev.FieldCid: + case sev.FieldPassword, sev.FieldToken, sev.FieldHandle, sev.FieldDid: values[i] = new(sql.NullString) case sev.FieldUpdatedAt, sev.FieldCreatedAt: values[i] = new(sql.NullTime) @@ -140,16 +140,16 @@ func (s *Sev) assignValues(columns []string, values []any) error { s.Did = value.String } case sev.FieldUID: - if value, ok := values[i].(*sql.NullString); !ok { + if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field uid", values[i]) } else if value.Valid { - s.UID = value.String + s.UID = int(value.Int64) } case sev.FieldCid: - if value, ok := values[i].(*sql.NullString); !ok { + if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field cid", values[i]) } else if value.Valid { - s.Cid = value.String + s.Cid = int(value.Int64) } case sev.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { @@ -228,10 +228,10 @@ func (s *Sev) String() string { builder.WriteString(s.Did) builder.WriteString(", ") builder.WriteString("uid=") - builder.WriteString(s.UID) + builder.WriteString(fmt.Sprintf("%v", s.UID)) builder.WriteString(", ") builder.WriteString("cid=") - builder.WriteString(s.Cid) + builder.WriteString(fmt.Sprintf("%v", s.Cid)) builder.WriteString(", ") builder.WriteString("updated_at=") builder.WriteString(s.UpdatedAt.Format(time.ANSIC)) diff --git a/ent/sev/where.go b/ent/sev/where.go index eca2ecf..fbacf4d 100644 --- a/ent/sev/where.go +++ b/ent/sev/where.go @@ -86,12 +86,12 @@ func Did(v string) predicate.Sev { } // UID applies equality check predicate on the "uid" field. It's identical to UIDEQ. -func UID(v string) predicate.Sev { +func UID(v int) predicate.Sev { return predicate.Sev(sql.FieldEQ(FieldUID, v)) } // Cid applies equality check predicate on the "cid" field. It's identical to CidEQ. -func Cid(v string) predicate.Sev { +func Cid(v int) predicate.Sev { return predicate.Sev(sql.FieldEQ(FieldCid, v)) } @@ -466,60 +466,45 @@ func DidContainsFold(v string) predicate.Sev { } // UIDEQ applies the EQ predicate on the "uid" field. -func UIDEQ(v string) predicate.Sev { +func UIDEQ(v int) predicate.Sev { return predicate.Sev(sql.FieldEQ(FieldUID, v)) } // UIDNEQ applies the NEQ predicate on the "uid" field. -func UIDNEQ(v string) predicate.Sev { +func UIDNEQ(v int) predicate.Sev { return predicate.Sev(sql.FieldNEQ(FieldUID, v)) } // UIDIn applies the In predicate on the "uid" field. -func UIDIn(vs ...string) predicate.Sev { +func UIDIn(vs ...int) predicate.Sev { return predicate.Sev(sql.FieldIn(FieldUID, vs...)) } // UIDNotIn applies the NotIn predicate on the "uid" field. -func UIDNotIn(vs ...string) predicate.Sev { +func UIDNotIn(vs ...int) predicate.Sev { return predicate.Sev(sql.FieldNotIn(FieldUID, vs...)) } // UIDGT applies the GT predicate on the "uid" field. -func UIDGT(v string) predicate.Sev { +func UIDGT(v int) predicate.Sev { return predicate.Sev(sql.FieldGT(FieldUID, v)) } // UIDGTE applies the GTE predicate on the "uid" field. -func UIDGTE(v string) predicate.Sev { +func UIDGTE(v int) predicate.Sev { return predicate.Sev(sql.FieldGTE(FieldUID, v)) } // UIDLT applies the LT predicate on the "uid" field. -func UIDLT(v string) predicate.Sev { +func UIDLT(v int) predicate.Sev { return predicate.Sev(sql.FieldLT(FieldUID, v)) } // UIDLTE applies the LTE predicate on the "uid" field. -func UIDLTE(v string) predicate.Sev { +func UIDLTE(v int) predicate.Sev { return predicate.Sev(sql.FieldLTE(FieldUID, v)) } -// UIDContains applies the Contains predicate on the "uid" field. -func UIDContains(v string) predicate.Sev { - return predicate.Sev(sql.FieldContains(FieldUID, v)) -} - -// UIDHasPrefix applies the HasPrefix predicate on the "uid" field. -func UIDHasPrefix(v string) predicate.Sev { - return predicate.Sev(sql.FieldHasPrefix(FieldUID, v)) -} - -// UIDHasSuffix applies the HasSuffix predicate on the "uid" field. -func UIDHasSuffix(v string) predicate.Sev { - return predicate.Sev(sql.FieldHasSuffix(FieldUID, v)) -} - // UIDIsNil applies the IsNil predicate on the "uid" field. func UIDIsNil() predicate.Sev { return predicate.Sev(sql.FieldIsNull(FieldUID)) @@ -530,71 +515,46 @@ func UIDNotNil() predicate.Sev { return predicate.Sev(sql.FieldNotNull(FieldUID)) } -// UIDEqualFold applies the EqualFold predicate on the "uid" field. -func UIDEqualFold(v string) predicate.Sev { - return predicate.Sev(sql.FieldEqualFold(FieldUID, v)) -} - -// UIDContainsFold applies the ContainsFold predicate on the "uid" field. -func UIDContainsFold(v string) predicate.Sev { - return predicate.Sev(sql.FieldContainsFold(FieldUID, v)) -} - // CidEQ applies the EQ predicate on the "cid" field. -func CidEQ(v string) predicate.Sev { +func CidEQ(v int) predicate.Sev { return predicate.Sev(sql.FieldEQ(FieldCid, v)) } // CidNEQ applies the NEQ predicate on the "cid" field. -func CidNEQ(v string) predicate.Sev { +func CidNEQ(v int) predicate.Sev { return predicate.Sev(sql.FieldNEQ(FieldCid, v)) } // CidIn applies the In predicate on the "cid" field. -func CidIn(vs ...string) predicate.Sev { +func CidIn(vs ...int) predicate.Sev { return predicate.Sev(sql.FieldIn(FieldCid, vs...)) } // CidNotIn applies the NotIn predicate on the "cid" field. -func CidNotIn(vs ...string) predicate.Sev { +func CidNotIn(vs ...int) predicate.Sev { return predicate.Sev(sql.FieldNotIn(FieldCid, vs...)) } // CidGT applies the GT predicate on the "cid" field. -func CidGT(v string) predicate.Sev { +func CidGT(v int) predicate.Sev { return predicate.Sev(sql.FieldGT(FieldCid, v)) } // CidGTE applies the GTE predicate on the "cid" field. -func CidGTE(v string) predicate.Sev { +func CidGTE(v int) predicate.Sev { return predicate.Sev(sql.FieldGTE(FieldCid, v)) } // CidLT applies the LT predicate on the "cid" field. -func CidLT(v string) predicate.Sev { +func CidLT(v int) predicate.Sev { return predicate.Sev(sql.FieldLT(FieldCid, v)) } // CidLTE applies the LTE predicate on the "cid" field. -func CidLTE(v string) predicate.Sev { +func CidLTE(v int) predicate.Sev { return predicate.Sev(sql.FieldLTE(FieldCid, v)) } -// CidContains applies the Contains predicate on the "cid" field. -func CidContains(v string) predicate.Sev { - return predicate.Sev(sql.FieldContains(FieldCid, v)) -} - -// CidHasPrefix applies the HasPrefix predicate on the "cid" field. -func CidHasPrefix(v string) predicate.Sev { - return predicate.Sev(sql.FieldHasPrefix(FieldCid, v)) -} - -// CidHasSuffix applies the HasSuffix predicate on the "cid" field. -func CidHasSuffix(v string) predicate.Sev { - return predicate.Sev(sql.FieldHasSuffix(FieldCid, v)) -} - // CidIsNil applies the IsNil predicate on the "cid" field. func CidIsNil() predicate.Sev { return predicate.Sev(sql.FieldIsNull(FieldCid)) @@ -605,16 +565,6 @@ func CidNotNil() predicate.Sev { return predicate.Sev(sql.FieldNotNull(FieldCid)) } -// CidEqualFold applies the EqualFold predicate on the "cid" field. -func CidEqualFold(v string) predicate.Sev { - return predicate.Sev(sql.FieldEqualFold(FieldCid, v)) -} - -// CidContainsFold applies the ContainsFold predicate on the "cid" field. -func CidContainsFold(v string) predicate.Sev { - return predicate.Sev(sql.FieldContainsFold(FieldCid, v)) -} - // UpdatedAtEQ applies the EQ predicate on the "updated_at" field. func UpdatedAtEQ(v time.Time) predicate.Sev { return predicate.Sev(sql.FieldEQ(FieldUpdatedAt, v)) diff --git a/ent/sev_create.go b/ent/sev_create.go index 44a9239..cd07a06 100644 --- a/ent/sev_create.go +++ b/ent/sev_create.go @@ -98,29 +98,29 @@ func (sc *SevCreate) SetNillableDid(s *string) *SevCreate { } // SetUID sets the "uid" field. -func (sc *SevCreate) SetUID(s string) *SevCreate { - sc.mutation.SetUID(s) +func (sc *SevCreate) SetUID(i int) *SevCreate { + sc.mutation.SetUID(i) return sc } // SetNillableUID sets the "uid" field if the given value is not nil. -func (sc *SevCreate) SetNillableUID(s *string) *SevCreate { - if s != nil { - sc.SetUID(*s) +func (sc *SevCreate) SetNillableUID(i *int) *SevCreate { + if i != nil { + sc.SetUID(*i) } return sc } // SetCid sets the "cid" field. -func (sc *SevCreate) SetCid(s string) *SevCreate { - sc.mutation.SetCid(s) +func (sc *SevCreate) SetCid(i int) *SevCreate { + sc.mutation.SetCid(i) return sc } // SetNillableCid sets the "cid" field if the given value is not nil. -func (sc *SevCreate) SetNillableCid(s *string) *SevCreate { - if s != nil { - sc.SetCid(*s) +func (sc *SevCreate) SetNillableCid(i *int) *SevCreate { + if i != nil { + sc.SetCid(*i) } return sc } @@ -273,11 +273,11 @@ func (sc *SevCreate) createSpec() (*Sev, *sqlgraph.CreateSpec) { _node.Did = value } if value, ok := sc.mutation.UID(); ok { - _spec.SetField(sev.FieldUID, field.TypeString, value) + _spec.SetField(sev.FieldUID, field.TypeInt, value) _node.UID = value } if value, ok := sc.mutation.Cid(); ok { - _spec.SetField(sev.FieldCid, field.TypeString, value) + _spec.SetField(sev.FieldCid, field.TypeInt, value) _node.Cid = value } if value, ok := sc.mutation.UpdatedAt(); ok { diff --git a/ent/sev_update.go b/ent/sev_update.go index 2f03b39..a6baf55 100644 --- a/ent/sev_update.go +++ b/ent/sev_update.go @@ -137,19 +137,26 @@ func (su *SevUpdate) ClearDid() *SevUpdate { } // SetUID sets the "uid" field. -func (su *SevUpdate) SetUID(s string) *SevUpdate { - su.mutation.SetUID(s) +func (su *SevUpdate) SetUID(i int) *SevUpdate { + su.mutation.ResetUID() + su.mutation.SetUID(i) return su } // SetNillableUID sets the "uid" field if the given value is not nil. -func (su *SevUpdate) SetNillableUID(s *string) *SevUpdate { - if s != nil { - su.SetUID(*s) +func (su *SevUpdate) SetNillableUID(i *int) *SevUpdate { + if i != nil { + su.SetUID(*i) } return su } +// AddUID adds i to the "uid" field. +func (su *SevUpdate) AddUID(i int) *SevUpdate { + su.mutation.AddUID(i) + return su +} + // ClearUID clears the value of the "uid" field. func (su *SevUpdate) ClearUID() *SevUpdate { su.mutation.ClearUID() @@ -157,19 +164,26 @@ func (su *SevUpdate) ClearUID() *SevUpdate { } // SetCid sets the "cid" field. -func (su *SevUpdate) SetCid(s string) *SevUpdate { - su.mutation.SetCid(s) +func (su *SevUpdate) SetCid(i int) *SevUpdate { + su.mutation.ResetCid() + su.mutation.SetCid(i) return su } // SetNillableCid sets the "cid" field if the given value is not nil. -func (su *SevUpdate) SetNillableCid(s *string) *SevUpdate { - if s != nil { - su.SetCid(*s) +func (su *SevUpdate) SetNillableCid(i *int) *SevUpdate { + if i != nil { + su.SetCid(*i) } return su } +// AddCid adds i to the "cid" field. +func (su *SevUpdate) AddCid(i int) *SevUpdate { + su.mutation.AddCid(i) + return su +} + // ClearCid clears the value of the "cid" field. func (su *SevUpdate) ClearCid() *SevUpdate { su.mutation.ClearCid() @@ -299,16 +313,22 @@ func (su *SevUpdate) sqlSave(ctx context.Context) (n int, err error) { _spec.ClearField(sev.FieldDid, field.TypeString) } if value, ok := su.mutation.UID(); ok { - _spec.SetField(sev.FieldUID, field.TypeString, value) + _spec.SetField(sev.FieldUID, field.TypeInt, value) + } + if value, ok := su.mutation.AddedUID(); ok { + _spec.AddField(sev.FieldUID, field.TypeInt, value) } if su.mutation.UIDCleared() { - _spec.ClearField(sev.FieldUID, field.TypeString) + _spec.ClearField(sev.FieldUID, field.TypeInt) } if value, ok := su.mutation.Cid(); ok { - _spec.SetField(sev.FieldCid, field.TypeString, value) + _spec.SetField(sev.FieldCid, field.TypeInt, value) + } + if value, ok := su.mutation.AddedCid(); ok { + _spec.AddField(sev.FieldCid, field.TypeInt, value) } if su.mutation.CidCleared() { - _spec.ClearField(sev.FieldCid, field.TypeString) + _spec.ClearField(sev.FieldCid, field.TypeInt) } if value, ok := su.mutation.UpdatedAt(); ok { _spec.SetField(sev.FieldUpdatedAt, field.TypeTime, value) @@ -476,19 +496,26 @@ func (suo *SevUpdateOne) ClearDid() *SevUpdateOne { } // SetUID sets the "uid" field. -func (suo *SevUpdateOne) SetUID(s string) *SevUpdateOne { - suo.mutation.SetUID(s) +func (suo *SevUpdateOne) SetUID(i int) *SevUpdateOne { + suo.mutation.ResetUID() + suo.mutation.SetUID(i) return suo } // SetNillableUID sets the "uid" field if the given value is not nil. -func (suo *SevUpdateOne) SetNillableUID(s *string) *SevUpdateOne { - if s != nil { - suo.SetUID(*s) +func (suo *SevUpdateOne) SetNillableUID(i *int) *SevUpdateOne { + if i != nil { + suo.SetUID(*i) } return suo } +// AddUID adds i to the "uid" field. +func (suo *SevUpdateOne) AddUID(i int) *SevUpdateOne { + suo.mutation.AddUID(i) + return suo +} + // ClearUID clears the value of the "uid" field. func (suo *SevUpdateOne) ClearUID() *SevUpdateOne { suo.mutation.ClearUID() @@ -496,19 +523,26 @@ func (suo *SevUpdateOne) ClearUID() *SevUpdateOne { } // SetCid sets the "cid" field. -func (suo *SevUpdateOne) SetCid(s string) *SevUpdateOne { - suo.mutation.SetCid(s) +func (suo *SevUpdateOne) SetCid(i int) *SevUpdateOne { + suo.mutation.ResetCid() + suo.mutation.SetCid(i) return suo } // SetNillableCid sets the "cid" field if the given value is not nil. -func (suo *SevUpdateOne) SetNillableCid(s *string) *SevUpdateOne { - if s != nil { - suo.SetCid(*s) +func (suo *SevUpdateOne) SetNillableCid(i *int) *SevUpdateOne { + if i != nil { + suo.SetCid(*i) } return suo } +// AddCid adds i to the "cid" field. +func (suo *SevUpdateOne) AddCid(i int) *SevUpdateOne { + suo.mutation.AddCid(i) + return suo +} + // ClearCid clears the value of the "cid" field. func (suo *SevUpdateOne) ClearCid() *SevUpdateOne { suo.mutation.ClearCid() @@ -668,16 +702,22 @@ func (suo *SevUpdateOne) sqlSave(ctx context.Context) (_node *Sev, err error) { _spec.ClearField(sev.FieldDid, field.TypeString) } if value, ok := suo.mutation.UID(); ok { - _spec.SetField(sev.FieldUID, field.TypeString, value) + _spec.SetField(sev.FieldUID, field.TypeInt, value) + } + if value, ok := suo.mutation.AddedUID(); ok { + _spec.AddField(sev.FieldUID, field.TypeInt, value) } if suo.mutation.UIDCleared() { - _spec.ClearField(sev.FieldUID, field.TypeString) + _spec.ClearField(sev.FieldUID, field.TypeInt) } if value, ok := suo.mutation.Cid(); ok { - _spec.SetField(sev.FieldCid, field.TypeString, value) + _spec.SetField(sev.FieldCid, field.TypeInt, value) + } + if value, ok := suo.mutation.AddedCid(); ok { + _spec.AddField(sev.FieldCid, field.TypeInt, value) } if suo.mutation.CidCleared() { - _spec.ClearField(sev.FieldCid, field.TypeString) + _spec.ClearField(sev.FieldCid, field.TypeInt) } if value, ok := suo.mutation.UpdatedAt(); ok { _spec.SetField(sev.FieldUpdatedAt, field.TypeTime, value)