1
0
This commit is contained in:
2024-04-11 06:34:59 +09:00
parent ba014bc014
commit 9d1838f75d
10 changed files with 260 additions and 202 deletions

View File

@ -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)
}