|
@@ -42,6 +42,7 @@ import (
|
|
|
"wechat-api/ent/usagestatisticmonth"
|
|
|
"wechat-api/ent/usagetotal"
|
|
|
"wechat-api/ent/whatsapp"
|
|
|
+ "wechat-api/ent/whatsappchannel"
|
|
|
"wechat-api/ent/workexperience"
|
|
|
"wechat-api/ent/wpchatroom"
|
|
|
"wechat-api/ent/wpchatroommember"
|
|
@@ -95,6 +96,7 @@ const (
|
|
|
TypeUsageStatisticMonth = "UsageStatisticMonth"
|
|
|
TypeUsageTotal = "UsageTotal"
|
|
|
TypeWhatsapp = "Whatsapp"
|
|
|
+ TypeWhatsappChannel = "WhatsappChannel"
|
|
|
TypeWorkExperience = "WorkExperience"
|
|
|
TypeWpChatroom = "WpChatroom"
|
|
|
TypeWpChatroomMember = "WpChatroomMember"
|
|
@@ -36957,12 +36959,15 @@ type WhatsappMutation struct {
|
|
|
status *uint8
|
|
|
addstatus *int8
|
|
|
deleted_at *time.Time
|
|
|
- ak *string
|
|
|
- sk *string
|
|
|
+ wa_id *uint64
|
|
|
+ addwa_id *int64
|
|
|
callback *string
|
|
|
account *string
|
|
|
nickname *string
|
|
|
phone *string
|
|
|
+ phone_name *string
|
|
|
+ phone_status *int8
|
|
|
+ addphone_status *int8
|
|
|
organization_id *uint64
|
|
|
addorganization_id *int64
|
|
|
api_base *string
|
|
@@ -37278,89 +37283,74 @@ func (m *WhatsappMutation) ResetDeletedAt() {
|
|
|
delete(m.clearedFields, whatsapp.FieldDeletedAt)
|
|
|
}
|
|
|
|
|
|
-// SetAk sets the "ak" field.
|
|
|
-func (m *WhatsappMutation) SetAk(s string) {
|
|
|
- m.ak = &s
|
|
|
+// SetWaID sets the "wa_id" field.
|
|
|
+func (m *WhatsappMutation) SetWaID(u uint64) {
|
|
|
+ m.wa_id = &u
|
|
|
+ m.addwa_id = nil
|
|
|
}
|
|
|
|
|
|
-// Ak returns the value of the "ak" field in the mutation.
|
|
|
-func (m *WhatsappMutation) Ak() (r string, exists bool) {
|
|
|
- v := m.ak
|
|
|
+// WaID returns the value of the "wa_id" field in the mutation.
|
|
|
+func (m *WhatsappMutation) WaID() (r uint64, exists bool) {
|
|
|
+ v := m.wa_id
|
|
|
if v == nil {
|
|
|
return
|
|
|
}
|
|
|
return *v, true
|
|
|
}
|
|
|
|
|
|
-// OldAk returns the old "ak" field's value of the Whatsapp entity.
|
|
|
+// OldWaID returns the old "wa_id" field's value of the Whatsapp entity.
|
|
|
// If the Whatsapp 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 *WhatsappMutation) OldAk(ctx context.Context) (v string, err error) {
|
|
|
+func (m *WhatsappMutation) OldWaID(ctx context.Context) (v uint64, err error) {
|
|
|
if !m.op.Is(OpUpdateOne) {
|
|
|
- return v, errors.New("OldAk is only allowed on UpdateOne operations")
|
|
|
+ return v, errors.New("OldWaID is only allowed on UpdateOne operations")
|
|
|
}
|
|
|
if m.id == nil || m.oldValue == nil {
|
|
|
- return v, errors.New("OldAk requires an ID field in the mutation")
|
|
|
+ return v, errors.New("OldWaID requires an ID field in the mutation")
|
|
|
}
|
|
|
oldValue, err := m.oldValue(ctx)
|
|
|
if err != nil {
|
|
|
- return v, fmt.Errorf("querying old value for OldAk: %w", err)
|
|
|
+ return v, fmt.Errorf("querying old value for OldWaID: %w", err)
|
|
|
}
|
|
|
- return oldValue.Ak, nil
|
|
|
-}
|
|
|
-
|
|
|
-// ClearAk clears the value of the "ak" field.
|
|
|
-func (m *WhatsappMutation) ClearAk() {
|
|
|
- m.ak = nil
|
|
|
- m.clearedFields[whatsapp.FieldAk] = struct{}{}
|
|
|
-}
|
|
|
-
|
|
|
-// AkCleared returns if the "ak" field was cleared in this mutation.
|
|
|
-func (m *WhatsappMutation) AkCleared() bool {
|
|
|
- _, ok := m.clearedFields[whatsapp.FieldAk]
|
|
|
- return ok
|
|
|
+ return oldValue.WaID, nil
|
|
|
}
|
|
|
|
|
|
-// ResetAk resets all changes to the "ak" field.
|
|
|
-func (m *WhatsappMutation) ResetAk() {
|
|
|
- m.ak = nil
|
|
|
- delete(m.clearedFields, whatsapp.FieldAk)
|
|
|
-}
|
|
|
-
|
|
|
-// SetSk sets the "sk" field.
|
|
|
-func (m *WhatsappMutation) SetSk(s string) {
|
|
|
- m.sk = &s
|
|
|
+// AddWaID adds u to the "wa_id" field.
|
|
|
+func (m *WhatsappMutation) AddWaID(u int64) {
|
|
|
+ if m.addwa_id != nil {
|
|
|
+ *m.addwa_id += u
|
|
|
+ } else {
|
|
|
+ m.addwa_id = &u
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-// Sk returns the value of the "sk" field in the mutation.
|
|
|
-func (m *WhatsappMutation) Sk() (r string, exists bool) {
|
|
|
- v := m.sk
|
|
|
+// AddedWaID returns the value that was added to the "wa_id" field in this mutation.
|
|
|
+func (m *WhatsappMutation) AddedWaID() (r int64, exists bool) {
|
|
|
+ v := m.addwa_id
|
|
|
if v == nil {
|
|
|
return
|
|
|
}
|
|
|
return *v, true
|
|
|
}
|
|
|
|
|
|
-// OldSk returns the old "sk" field's value of the Whatsapp entity.
|
|
|
-// If the Whatsapp 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 *WhatsappMutation) OldSk(ctx context.Context) (v string, err error) {
|
|
|
- if !m.op.Is(OpUpdateOne) {
|
|
|
- return v, errors.New("OldSk is only allowed on UpdateOne operations")
|
|
|
- }
|
|
|
- if m.id == nil || m.oldValue == nil {
|
|
|
- return v, errors.New("OldSk requires an ID field in the mutation")
|
|
|
- }
|
|
|
- oldValue, err := m.oldValue(ctx)
|
|
|
- if err != nil {
|
|
|
- return v, fmt.Errorf("querying old value for OldSk: %w", err)
|
|
|
- }
|
|
|
- return oldValue.Sk, nil
|
|
|
+// ClearWaID clears the value of the "wa_id" field.
|
|
|
+func (m *WhatsappMutation) ClearWaID() {
|
|
|
+ m.wa_id = nil
|
|
|
+ m.addwa_id = nil
|
|
|
+ m.clearedFields[whatsapp.FieldWaID] = struct{}{}
|
|
|
}
|
|
|
|
|
|
-// ResetSk resets all changes to the "sk" field.
|
|
|
-func (m *WhatsappMutation) ResetSk() {
|
|
|
- m.sk = nil
|
|
|
+// WaIDCleared returns if the "wa_id" field was cleared in this mutation.
|
|
|
+func (m *WhatsappMutation) WaIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[whatsapp.FieldWaID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetWaID resets all changes to the "wa_id" field.
|
|
|
+func (m *WhatsappMutation) ResetWaID() {
|
|
|
+ m.wa_id = nil
|
|
|
+ m.addwa_id = nil
|
|
|
+ delete(m.clearedFields, whatsapp.FieldWaID)
|
|
|
}
|
|
|
|
|
|
// SetCallback sets the "callback" field.
|
|
@@ -37412,6 +37402,42 @@ func (m *WhatsappMutation) ResetCallback() {
|
|
|
delete(m.clearedFields, whatsapp.FieldCallback)
|
|
|
}
|
|
|
|
|
|
+// SetAgentID sets the "agent_id" field.
|
|
|
+func (m *WhatsappMutation) SetAgentID(u uint64) {
|
|
|
+ m.agent = &u
|
|
|
+}
|
|
|
+
|
|
|
+// AgentID returns the value of the "agent_id" field in the mutation.
|
|
|
+func (m *WhatsappMutation) AgentID() (r uint64, exists bool) {
|
|
|
+ v := m.agent
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAgentID returns the old "agent_id" field's value of the Whatsapp entity.
|
|
|
+// If the Whatsapp 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 *WhatsappMutation) OldAgentID(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAgentID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAgentID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAgentID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AgentID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAgentID resets all changes to the "agent_id" field.
|
|
|
+func (m *WhatsappMutation) ResetAgentID() {
|
|
|
+ m.agent = nil
|
|
|
+}
|
|
|
+
|
|
|
// SetAccount sets the "account" field.
|
|
|
func (m *WhatsappMutation) SetAccount(s string) {
|
|
|
m.account = &s
|
|
@@ -37533,6 +37559,98 @@ func (m *WhatsappMutation) ResetPhone() {
|
|
|
m.phone = nil
|
|
|
}
|
|
|
|
|
|
+// SetPhoneName sets the "phone_name" field.
|
|
|
+func (m *WhatsappMutation) SetPhoneName(s string) {
|
|
|
+ m.phone_name = &s
|
|
|
+}
|
|
|
+
|
|
|
+// PhoneName returns the value of the "phone_name" field in the mutation.
|
|
|
+func (m *WhatsappMutation) PhoneName() (r string, exists bool) {
|
|
|
+ v := m.phone_name
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldPhoneName returns the old "phone_name" field's value of the Whatsapp entity.
|
|
|
+// If the Whatsapp 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 *WhatsappMutation) OldPhoneName(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldPhoneName is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldPhoneName requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldPhoneName: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.PhoneName, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ResetPhoneName resets all changes to the "phone_name" field.
|
|
|
+func (m *WhatsappMutation) ResetPhoneName() {
|
|
|
+ m.phone_name = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetPhoneStatus sets the "phone_status" field.
|
|
|
+func (m *WhatsappMutation) SetPhoneStatus(i int8) {
|
|
|
+ m.phone_status = &i
|
|
|
+ m.addphone_status = nil
|
|
|
+}
|
|
|
+
|
|
|
+// PhoneStatus returns the value of the "phone_status" field in the mutation.
|
|
|
+func (m *WhatsappMutation) PhoneStatus() (r int8, exists bool) {
|
|
|
+ v := m.phone_status
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldPhoneStatus returns the old "phone_status" field's value of the Whatsapp entity.
|
|
|
+// If the Whatsapp 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 *WhatsappMutation) OldPhoneStatus(ctx context.Context) (v int8, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldPhoneStatus is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldPhoneStatus requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldPhoneStatus: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.PhoneStatus, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddPhoneStatus adds i to the "phone_status" field.
|
|
|
+func (m *WhatsappMutation) AddPhoneStatus(i int8) {
|
|
|
+ if m.addphone_status != nil {
|
|
|
+ *m.addphone_status += i
|
|
|
+ } else {
|
|
|
+ m.addphone_status = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedPhoneStatus returns the value that was added to the "phone_status" field in this mutation.
|
|
|
+func (m *WhatsappMutation) AddedPhoneStatus() (r int8, exists bool) {
|
|
|
+ v := m.addphone_status
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetPhoneStatus resets all changes to the "phone_status" field.
|
|
|
+func (m *WhatsappMutation) ResetPhoneStatus() {
|
|
|
+ m.phone_status = nil
|
|
|
+ m.addphone_status = nil
|
|
|
+}
|
|
|
+
|
|
|
// SetOrganizationID sets the "organization_id" field.
|
|
|
func (m *WhatsappMutation) SetOrganizationID(u uint64) {
|
|
|
m.organization_id = &u
|
|
@@ -37603,42 +37721,6 @@ func (m *WhatsappMutation) ResetOrganizationID() {
|
|
|
delete(m.clearedFields, whatsapp.FieldOrganizationID)
|
|
|
}
|
|
|
|
|
|
-// SetAgentID sets the "agent_id" field.
|
|
|
-func (m *WhatsappMutation) SetAgentID(u uint64) {
|
|
|
- m.agent = &u
|
|
|
-}
|
|
|
-
|
|
|
-// AgentID returns the value of the "agent_id" field in the mutation.
|
|
|
-func (m *WhatsappMutation) AgentID() (r uint64, exists bool) {
|
|
|
- v := m.agent
|
|
|
- if v == nil {
|
|
|
- return
|
|
|
- }
|
|
|
- return *v, true
|
|
|
-}
|
|
|
-
|
|
|
-// OldAgentID returns the old "agent_id" field's value of the Whatsapp entity.
|
|
|
-// If the Whatsapp 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 *WhatsappMutation) OldAgentID(ctx context.Context) (v uint64, err error) {
|
|
|
- if !m.op.Is(OpUpdateOne) {
|
|
|
- return v, errors.New("OldAgentID is only allowed on UpdateOne operations")
|
|
|
- }
|
|
|
- if m.id == nil || m.oldValue == nil {
|
|
|
- return v, errors.New("OldAgentID requires an ID field in the mutation")
|
|
|
- }
|
|
|
- oldValue, err := m.oldValue(ctx)
|
|
|
- if err != nil {
|
|
|
- return v, fmt.Errorf("querying old value for OldAgentID: %w", err)
|
|
|
- }
|
|
|
- return oldValue.AgentID, nil
|
|
|
-}
|
|
|
-
|
|
|
-// ResetAgentID resets all changes to the "agent_id" field.
|
|
|
-func (m *WhatsappMutation) ResetAgentID() {
|
|
|
- m.agent = nil
|
|
|
-}
|
|
|
-
|
|
|
// SetAPIBase sets the "api_base" field.
|
|
|
func (m *WhatsappMutation) SetAPIBase(s string) {
|
|
|
m.api_base = &s
|
|
@@ -38058,7 +38140,7 @@ func (m *WhatsappMutation) Type() string {
|
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
|
// AddedFields().
|
|
|
func (m *WhatsappMutation) Fields() []string {
|
|
|
- fields := make([]string, 0, 18)
|
|
|
+ fields := make([]string, 0, 19)
|
|
|
if m.created_at != nil {
|
|
|
fields = append(fields, whatsapp.FieldCreatedAt)
|
|
|
}
|
|
@@ -38071,15 +38153,15 @@ func (m *WhatsappMutation) Fields() []string {
|
|
|
if m.deleted_at != nil {
|
|
|
fields = append(fields, whatsapp.FieldDeletedAt)
|
|
|
}
|
|
|
- if m.ak != nil {
|
|
|
- fields = append(fields, whatsapp.FieldAk)
|
|
|
- }
|
|
|
- if m.sk != nil {
|
|
|
- fields = append(fields, whatsapp.FieldSk)
|
|
|
+ if m.wa_id != nil {
|
|
|
+ fields = append(fields, whatsapp.FieldWaID)
|
|
|
}
|
|
|
if m.callback != nil {
|
|
|
fields = append(fields, whatsapp.FieldCallback)
|
|
|
}
|
|
|
+ if m.agent != nil {
|
|
|
+ fields = append(fields, whatsapp.FieldAgentID)
|
|
|
+ }
|
|
|
if m.account != nil {
|
|
|
fields = append(fields, whatsapp.FieldAccount)
|
|
|
}
|
|
@@ -38089,12 +38171,15 @@ func (m *WhatsappMutation) Fields() []string {
|
|
|
if m.phone != nil {
|
|
|
fields = append(fields, whatsapp.FieldPhone)
|
|
|
}
|
|
|
+ if m.phone_name != nil {
|
|
|
+ fields = append(fields, whatsapp.FieldPhoneName)
|
|
|
+ }
|
|
|
+ if m.phone_status != nil {
|
|
|
+ fields = append(fields, whatsapp.FieldPhoneStatus)
|
|
|
+ }
|
|
|
if m.organization_id != nil {
|
|
|
fields = append(fields, whatsapp.FieldOrganizationID)
|
|
|
}
|
|
|
- if m.agent != nil {
|
|
|
- fields = append(fields, whatsapp.FieldAgentID)
|
|
|
- }
|
|
|
if m.api_base != nil {
|
|
|
fields = append(fields, whatsapp.FieldAPIBase)
|
|
|
}
|
|
@@ -38129,22 +38214,24 @@ func (m *WhatsappMutation) Field(name string) (ent.Value, bool) {
|
|
|
return m.Status()
|
|
|
case whatsapp.FieldDeletedAt:
|
|
|
return m.DeletedAt()
|
|
|
- case whatsapp.FieldAk:
|
|
|
- return m.Ak()
|
|
|
- case whatsapp.FieldSk:
|
|
|
- return m.Sk()
|
|
|
+ case whatsapp.FieldWaID:
|
|
|
+ return m.WaID()
|
|
|
case whatsapp.FieldCallback:
|
|
|
return m.Callback()
|
|
|
+ case whatsapp.FieldAgentID:
|
|
|
+ return m.AgentID()
|
|
|
case whatsapp.FieldAccount:
|
|
|
return m.Account()
|
|
|
case whatsapp.FieldNickname:
|
|
|
return m.Nickname()
|
|
|
case whatsapp.FieldPhone:
|
|
|
return m.Phone()
|
|
|
+ case whatsapp.FieldPhoneName:
|
|
|
+ return m.PhoneName()
|
|
|
+ case whatsapp.FieldPhoneStatus:
|
|
|
+ return m.PhoneStatus()
|
|
|
case whatsapp.FieldOrganizationID:
|
|
|
return m.OrganizationID()
|
|
|
- case whatsapp.FieldAgentID:
|
|
|
- return m.AgentID()
|
|
|
case whatsapp.FieldAPIBase:
|
|
|
return m.APIBase()
|
|
|
case whatsapp.FieldAPIKey:
|
|
@@ -38174,22 +38261,24 @@ func (m *WhatsappMutation) OldField(ctx context.Context, name string) (ent.Value
|
|
|
return m.OldStatus(ctx)
|
|
|
case whatsapp.FieldDeletedAt:
|
|
|
return m.OldDeletedAt(ctx)
|
|
|
- case whatsapp.FieldAk:
|
|
|
- return m.OldAk(ctx)
|
|
|
- case whatsapp.FieldSk:
|
|
|
- return m.OldSk(ctx)
|
|
|
+ case whatsapp.FieldWaID:
|
|
|
+ return m.OldWaID(ctx)
|
|
|
case whatsapp.FieldCallback:
|
|
|
return m.OldCallback(ctx)
|
|
|
+ case whatsapp.FieldAgentID:
|
|
|
+ return m.OldAgentID(ctx)
|
|
|
case whatsapp.FieldAccount:
|
|
|
return m.OldAccount(ctx)
|
|
|
case whatsapp.FieldNickname:
|
|
|
return m.OldNickname(ctx)
|
|
|
case whatsapp.FieldPhone:
|
|
|
return m.OldPhone(ctx)
|
|
|
+ case whatsapp.FieldPhoneName:
|
|
|
+ return m.OldPhoneName(ctx)
|
|
|
+ case whatsapp.FieldPhoneStatus:
|
|
|
+ return m.OldPhoneStatus(ctx)
|
|
|
case whatsapp.FieldOrganizationID:
|
|
|
return m.OldOrganizationID(ctx)
|
|
|
- case whatsapp.FieldAgentID:
|
|
|
- return m.OldAgentID(ctx)
|
|
|
case whatsapp.FieldAPIBase:
|
|
|
return m.OldAPIBase(ctx)
|
|
|
case whatsapp.FieldAPIKey:
|
|
@@ -38239,26 +38328,26 @@ func (m *WhatsappMutation) SetField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.SetDeletedAt(v)
|
|
|
return nil
|
|
|
- case whatsapp.FieldAk:
|
|
|
- v, ok := value.(string)
|
|
|
+ case whatsapp.FieldWaID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
if !ok {
|
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
}
|
|
|
- m.SetAk(v)
|
|
|
+ m.SetWaID(v)
|
|
|
return nil
|
|
|
- case whatsapp.FieldSk:
|
|
|
+ case whatsapp.FieldCallback:
|
|
|
v, ok := value.(string)
|
|
|
if !ok {
|
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
}
|
|
|
- m.SetSk(v)
|
|
|
+ m.SetCallback(v)
|
|
|
return nil
|
|
|
- case whatsapp.FieldCallback:
|
|
|
- v, ok := value.(string)
|
|
|
+ case whatsapp.FieldAgentID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
if !ok {
|
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
}
|
|
|
- m.SetCallback(v)
|
|
|
+ m.SetAgentID(v)
|
|
|
return nil
|
|
|
case whatsapp.FieldAccount:
|
|
|
v, ok := value.(string)
|
|
@@ -38281,19 +38370,26 @@ func (m *WhatsappMutation) SetField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.SetPhone(v)
|
|
|
return nil
|
|
|
- case whatsapp.FieldOrganizationID:
|
|
|
- v, ok := value.(uint64)
|
|
|
+ case whatsapp.FieldPhoneName:
|
|
|
+ v, ok := value.(string)
|
|
|
if !ok {
|
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
}
|
|
|
- m.SetOrganizationID(v)
|
|
|
+ m.SetPhoneName(v)
|
|
|
return nil
|
|
|
- case whatsapp.FieldAgentID:
|
|
|
+ case whatsapp.FieldPhoneStatus:
|
|
|
+ v, ok := value.(int8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetPhoneStatus(v)
|
|
|
+ return nil
|
|
|
+ case whatsapp.FieldOrganizationID:
|
|
|
v, ok := value.(uint64)
|
|
|
if !ok {
|
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
}
|
|
|
- m.SetAgentID(v)
|
|
|
+ m.SetOrganizationID(v)
|
|
|
return nil
|
|
|
case whatsapp.FieldAPIBase:
|
|
|
v, ok := value.(string)
|
|
@@ -38348,6 +38444,12 @@ func (m *WhatsappMutation) AddedFields() []string {
|
|
|
if m.addstatus != nil {
|
|
|
fields = append(fields, whatsapp.FieldStatus)
|
|
|
}
|
|
|
+ if m.addwa_id != nil {
|
|
|
+ fields = append(fields, whatsapp.FieldWaID)
|
|
|
+ }
|
|
|
+ if m.addphone_status != nil {
|
|
|
+ fields = append(fields, whatsapp.FieldPhoneStatus)
|
|
|
+ }
|
|
|
if m.addorganization_id != nil {
|
|
|
fields = append(fields, whatsapp.FieldOrganizationID)
|
|
|
}
|
|
@@ -38361,6 +38463,10 @@ func (m *WhatsappMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
switch name {
|
|
|
case whatsapp.FieldStatus:
|
|
|
return m.AddedStatus()
|
|
|
+ case whatsapp.FieldWaID:
|
|
|
+ return m.AddedWaID()
|
|
|
+ case whatsapp.FieldPhoneStatus:
|
|
|
+ return m.AddedPhoneStatus()
|
|
|
case whatsapp.FieldOrganizationID:
|
|
|
return m.AddedOrganizationID()
|
|
|
}
|
|
@@ -38379,6 +38485,20 @@ func (m *WhatsappMutation) AddField(name string, value ent.Value) error {
|
|
|
}
|
|
|
m.AddStatus(v)
|
|
|
return nil
|
|
|
+ case whatsapp.FieldWaID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddWaID(v)
|
|
|
+ return nil
|
|
|
+ case whatsapp.FieldPhoneStatus:
|
|
|
+ v, ok := value.(int8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddPhoneStatus(v)
|
|
|
+ return nil
|
|
|
case whatsapp.FieldOrganizationID:
|
|
|
v, ok := value.(int64)
|
|
|
if !ok {
|
|
@@ -38400,8 +38520,8 @@ func (m *WhatsappMutation) ClearedFields() []string {
|
|
|
if m.FieldCleared(whatsapp.FieldDeletedAt) {
|
|
|
fields = append(fields, whatsapp.FieldDeletedAt)
|
|
|
}
|
|
|
- if m.FieldCleared(whatsapp.FieldAk) {
|
|
|
- fields = append(fields, whatsapp.FieldAk)
|
|
|
+ if m.FieldCleared(whatsapp.FieldWaID) {
|
|
|
+ fields = append(fields, whatsapp.FieldWaID)
|
|
|
}
|
|
|
if m.FieldCleared(whatsapp.FieldCallback) {
|
|
|
fields = append(fields, whatsapp.FieldCallback)
|
|
@@ -38450,8 +38570,8 @@ func (m *WhatsappMutation) ClearField(name string) error {
|
|
|
case whatsapp.FieldDeletedAt:
|
|
|
m.ClearDeletedAt()
|
|
|
return nil
|
|
|
- case whatsapp.FieldAk:
|
|
|
- m.ClearAk()
|
|
|
+ case whatsapp.FieldWaID:
|
|
|
+ m.ClearWaID()
|
|
|
return nil
|
|
|
case whatsapp.FieldCallback:
|
|
|
m.ClearCallback()
|
|
@@ -38500,15 +38620,15 @@ func (m *WhatsappMutation) ResetField(name string) error {
|
|
|
case whatsapp.FieldDeletedAt:
|
|
|
m.ResetDeletedAt()
|
|
|
return nil
|
|
|
- case whatsapp.FieldAk:
|
|
|
- m.ResetAk()
|
|
|
- return nil
|
|
|
- case whatsapp.FieldSk:
|
|
|
- m.ResetSk()
|
|
|
+ case whatsapp.FieldWaID:
|
|
|
+ m.ResetWaID()
|
|
|
return nil
|
|
|
case whatsapp.FieldCallback:
|
|
|
m.ResetCallback()
|
|
|
return nil
|
|
|
+ case whatsapp.FieldAgentID:
|
|
|
+ m.ResetAgentID()
|
|
|
+ return nil
|
|
|
case whatsapp.FieldAccount:
|
|
|
m.ResetAccount()
|
|
|
return nil
|
|
@@ -38518,12 +38638,15 @@ func (m *WhatsappMutation) ResetField(name string) error {
|
|
|
case whatsapp.FieldPhone:
|
|
|
m.ResetPhone()
|
|
|
return nil
|
|
|
+ case whatsapp.FieldPhoneName:
|
|
|
+ m.ResetPhoneName()
|
|
|
+ return nil
|
|
|
+ case whatsapp.FieldPhoneStatus:
|
|
|
+ m.ResetPhoneStatus()
|
|
|
+ return nil
|
|
|
case whatsapp.FieldOrganizationID:
|
|
|
m.ResetOrganizationID()
|
|
|
return nil
|
|
|
- case whatsapp.FieldAgentID:
|
|
|
- m.ResetAgentID()
|
|
|
- return nil
|
|
|
case whatsapp.FieldAPIBase:
|
|
|
m.ResetAPIBase()
|
|
|
return nil
|
|
@@ -38620,6 +38743,1220 @@ func (m *WhatsappMutation) ResetEdge(name string) error {
|
|
|
return fmt.Errorf("unknown Whatsapp edge %s", name)
|
|
|
}
|
|
|
|
|
|
+// WhatsappChannelMutation represents an operation that mutates the WhatsappChannel nodes in the graph.
|
|
|
+type WhatsappChannelMutation struct {
|
|
|
+ config
|
|
|
+ op Op
|
|
|
+ typ string
|
|
|
+ id *uint64
|
|
|
+ created_at *time.Time
|
|
|
+ updated_at *time.Time
|
|
|
+ status *uint8
|
|
|
+ addstatus *int8
|
|
|
+ deleted_at *time.Time
|
|
|
+ ak *string
|
|
|
+ sk *string
|
|
|
+ wa_id *uint64
|
|
|
+ addwa_id *int64
|
|
|
+ wa_name *string
|
|
|
+ waba_id *uint64
|
|
|
+ addwaba_id *int64
|
|
|
+ business_id *uint64
|
|
|
+ addbusiness_id *int64
|
|
|
+ organization_id *uint64
|
|
|
+ addorganization_id *int64
|
|
|
+ verify_account *string
|
|
|
+ clearedFields map[string]struct{}
|
|
|
+ done bool
|
|
|
+ oldValue func(context.Context) (*WhatsappChannel, error)
|
|
|
+ predicates []predicate.WhatsappChannel
|
|
|
+}
|
|
|
+
|
|
|
+var _ ent.Mutation = (*WhatsappChannelMutation)(nil)
|
|
|
+
|
|
|
+// whatsappchannelOption allows management of the mutation configuration using functional options.
|
|
|
+type whatsappchannelOption func(*WhatsappChannelMutation)
|
|
|
+
|
|
|
+// newWhatsappChannelMutation creates new mutation for the WhatsappChannel entity.
|
|
|
+func newWhatsappChannelMutation(c config, op Op, opts ...whatsappchannelOption) *WhatsappChannelMutation {
|
|
|
+ m := &WhatsappChannelMutation{
|
|
|
+ config: c,
|
|
|
+ op: op,
|
|
|
+ typ: TypeWhatsappChannel,
|
|
|
+ clearedFields: make(map[string]struct{}),
|
|
|
+ }
|
|
|
+ for _, opt := range opts {
|
|
|
+ opt(m)
|
|
|
+ }
|
|
|
+ return m
|
|
|
+}
|
|
|
+
|
|
|
+// withWhatsappChannelID sets the ID field of the mutation.
|
|
|
+func withWhatsappChannelID(id uint64) whatsappchannelOption {
|
|
|
+ return func(m *WhatsappChannelMutation) {
|
|
|
+ var (
|
|
|
+ err error
|
|
|
+ once sync.Once
|
|
|
+ value *WhatsappChannel
|
|
|
+ )
|
|
|
+ m.oldValue = func(ctx context.Context) (*WhatsappChannel, error) {
|
|
|
+ once.Do(func() {
|
|
|
+ if m.done {
|
|
|
+ err = errors.New("querying old values post mutation is not allowed")
|
|
|
+ } else {
|
|
|
+ value, err = m.Client().WhatsappChannel.Get(ctx, id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return value, err
|
|
|
+ }
|
|
|
+ m.id = &id
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// withWhatsappChannel sets the old WhatsappChannel of the mutation.
|
|
|
+func withWhatsappChannel(node *WhatsappChannel) whatsappchannelOption {
|
|
|
+ return func(m *WhatsappChannelMutation) {
|
|
|
+ m.oldValue = func(context.Context) (*WhatsappChannel, error) {
|
|
|
+ return node, nil
|
|
|
+ }
|
|
|
+ m.id = &node.ID
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// Client returns a new `ent.Client` from the mutation. If the mutation was
|
|
|
+// executed in a transaction (ent.Tx), a transactional client is returned.
|
|
|
+func (m WhatsappChannelMutation) Client() *Client {
|
|
|
+ client := &Client{config: m.config}
|
|
|
+ client.init()
|
|
|
+ return client
|
|
|
+}
|
|
|
+
|
|
|
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
|
|
|
+// it returns an error otherwise.
|
|
|
+func (m WhatsappChannelMutation) Tx() (*Tx, error) {
|
|
|
+ if _, ok := m.driver.(*txDriver); !ok {
|
|
|
+ return nil, errors.New("ent: mutation is not running in a transaction")
|
|
|
+ }
|
|
|
+ tx := &Tx{config: m.config}
|
|
|
+ tx.init()
|
|
|
+ return tx, nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetID sets the value of the id field. Note that this
|
|
|
+// operation is only accepted on creation of WhatsappChannel entities.
|
|
|
+func (m *WhatsappChannelMutation) SetID(id uint64) {
|
|
|
+ m.id = &id
|
|
|
+}
|
|
|
+
|
|
|
+// ID returns the ID value in the mutation. Note that the ID is only available
|
|
|
+// if it was provided to the builder or after it was returned from the database.
|
|
|
+func (m *WhatsappChannelMutation) ID() (id uint64, exists bool) {
|
|
|
+ if m.id == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *m.id, true
|
|
|
+}
|
|
|
+
|
|
|
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
|
|
|
+// That means, if the mutation is applied within a transaction with an isolation level such
|
|
|
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
|
|
|
+// or updated by the mutation.
|
|
|
+func (m *WhatsappChannelMutation) IDs(ctx context.Context) ([]uint64, error) {
|
|
|
+ switch {
|
|
|
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
|
|
|
+ id, exists := m.ID()
|
|
|
+ if exists {
|
|
|
+ return []uint64{id}, nil
|
|
|
+ }
|
|
|
+ fallthrough
|
|
|
+ case m.op.Is(OpUpdate | OpDelete):
|
|
|
+ return m.Client().WhatsappChannel.Query().Where(m.predicates...).IDs(ctx)
|
|
|
+ default:
|
|
|
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// SetCreatedAt sets the "created_at" field.
|
|
|
+func (m *WhatsappChannelMutation) SetCreatedAt(t time.Time) {
|
|
|
+ m.created_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) CreatedAt() (r time.Time, exists bool) {
|
|
|
+ v := m.created_at
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldCreatedAt returns the old "created_at" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) 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")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.CreatedAt, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ResetCreatedAt resets all changes to the "created_at" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetCreatedAt() {
|
|
|
+ m.created_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetUpdatedAt sets the "updated_at" field.
|
|
|
+func (m *WhatsappChannelMutation) SetUpdatedAt(t time.Time) {
|
|
|
+ m.updated_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) UpdatedAt() (r time.Time, exists bool) {
|
|
|
+ v := m.updated_at
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldUpdatedAt returns the old "updated_at" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) 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")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.UpdatedAt, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ResetUpdatedAt resets all changes to the "updated_at" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetUpdatedAt() {
|
|
|
+ m.updated_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetStatus sets the "status" field.
|
|
|
+func (m *WhatsappChannelMutation) SetStatus(u uint8) {
|
|
|
+ m.status = &u
|
|
|
+ m.addstatus = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns the value of the "status" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) Status() (r uint8, exists bool) {
|
|
|
+ v := m.status
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldStatus returns the old "status" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldStatus(ctx context.Context) (v uint8, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldStatus is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldStatus requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldStatus: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Status, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddStatus adds u to the "status" field.
|
|
|
+func (m *WhatsappChannelMutation) AddStatus(u int8) {
|
|
|
+ if m.addstatus != nil {
|
|
|
+ *m.addstatus += u
|
|
|
+ } else {
|
|
|
+ m.addstatus = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedStatus returns the value that was added to the "status" field in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedStatus() (r int8, exists bool) {
|
|
|
+ v := m.addstatus
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ClearStatus clears the value of the "status" field.
|
|
|
+func (m *WhatsappChannelMutation) ClearStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ m.clearedFields[whatsappchannel.FieldStatus] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCleared returns if the "status" field was cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) StatusCleared() bool {
|
|
|
+ _, ok := m.clearedFields[whatsappchannel.FieldStatus]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetStatus resets all changes to the "status" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ delete(m.clearedFields, whatsappchannel.FieldStatus)
|
|
|
+}
|
|
|
+
|
|
|
+// SetDeletedAt sets the "deleted_at" field.
|
|
|
+func (m *WhatsappChannelMutation) SetDeletedAt(t time.Time) {
|
|
|
+ m.deleted_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) DeletedAt() (r time.Time, exists bool) {
|
|
|
+ v := m.deleted_at
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldDeletedAt returns the old "deleted_at" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldDeletedAt requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.DeletedAt, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearDeletedAt clears the value of the "deleted_at" field.
|
|
|
+func (m *WhatsappChannelMutation) ClearDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ m.clearedFields[whatsappchannel.FieldDeletedAt] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) DeletedAtCleared() bool {
|
|
|
+ _, ok := m.clearedFields[whatsappchannel.FieldDeletedAt]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetDeletedAt resets all changes to the "deleted_at" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ delete(m.clearedFields, whatsappchannel.FieldDeletedAt)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAk sets the "ak" field.
|
|
|
+func (m *WhatsappChannelMutation) SetAk(s string) {
|
|
|
+ m.ak = &s
|
|
|
+}
|
|
|
+
|
|
|
+// Ak returns the value of the "ak" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) Ak() (r string, exists bool) {
|
|
|
+ v := m.ak
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAk returns the old "ak" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldAk(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAk is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAk requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAk: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Ak, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearAk clears the value of the "ak" field.
|
|
|
+func (m *WhatsappChannelMutation) ClearAk() {
|
|
|
+ m.ak = nil
|
|
|
+ m.clearedFields[whatsappchannel.FieldAk] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// AkCleared returns if the "ak" field was cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AkCleared() bool {
|
|
|
+ _, ok := m.clearedFields[whatsappchannel.FieldAk]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAk resets all changes to the "ak" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetAk() {
|
|
|
+ m.ak = nil
|
|
|
+ delete(m.clearedFields, whatsappchannel.FieldAk)
|
|
|
+}
|
|
|
+
|
|
|
+// SetSk sets the "sk" field.
|
|
|
+func (m *WhatsappChannelMutation) SetSk(s string) {
|
|
|
+ m.sk = &s
|
|
|
+}
|
|
|
+
|
|
|
+// Sk returns the value of the "sk" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) Sk() (r string, exists bool) {
|
|
|
+ v := m.sk
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldSk returns the old "sk" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldSk(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldSk is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldSk requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldSk: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Sk, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ResetSk resets all changes to the "sk" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetSk() {
|
|
|
+ m.sk = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetWaID sets the "wa_id" field.
|
|
|
+func (m *WhatsappChannelMutation) SetWaID(u uint64) {
|
|
|
+ m.wa_id = &u
|
|
|
+ m.addwa_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// WaID returns the value of the "wa_id" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) WaID() (r uint64, exists bool) {
|
|
|
+ v := m.wa_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldWaID returns the old "wa_id" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldWaID(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldWaID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldWaID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldWaID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.WaID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddWaID adds u to the "wa_id" field.
|
|
|
+func (m *WhatsappChannelMutation) AddWaID(u int64) {
|
|
|
+ if m.addwa_id != nil {
|
|
|
+ *m.addwa_id += u
|
|
|
+ } else {
|
|
|
+ m.addwa_id = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedWaID returns the value that was added to the "wa_id" field in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedWaID() (r int64, exists bool) {
|
|
|
+ v := m.addwa_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ClearWaID clears the value of the "wa_id" field.
|
|
|
+func (m *WhatsappChannelMutation) ClearWaID() {
|
|
|
+ m.wa_id = nil
|
|
|
+ m.addwa_id = nil
|
|
|
+ m.clearedFields[whatsappchannel.FieldWaID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// WaIDCleared returns if the "wa_id" field was cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) WaIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[whatsappchannel.FieldWaID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetWaID resets all changes to the "wa_id" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetWaID() {
|
|
|
+ m.wa_id = nil
|
|
|
+ m.addwa_id = nil
|
|
|
+ delete(m.clearedFields, whatsappchannel.FieldWaID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetWaName sets the "wa_name" field.
|
|
|
+func (m *WhatsappChannelMutation) SetWaName(s string) {
|
|
|
+ m.wa_name = &s
|
|
|
+}
|
|
|
+
|
|
|
+// WaName returns the value of the "wa_name" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) WaName() (r string, exists bool) {
|
|
|
+ v := m.wa_name
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldWaName returns the old "wa_name" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldWaName(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldWaName is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldWaName requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldWaName: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.WaName, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearWaName clears the value of the "wa_name" field.
|
|
|
+func (m *WhatsappChannelMutation) ClearWaName() {
|
|
|
+ m.wa_name = nil
|
|
|
+ m.clearedFields[whatsappchannel.FieldWaName] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// WaNameCleared returns if the "wa_name" field was cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) WaNameCleared() bool {
|
|
|
+ _, ok := m.clearedFields[whatsappchannel.FieldWaName]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetWaName resets all changes to the "wa_name" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetWaName() {
|
|
|
+ m.wa_name = nil
|
|
|
+ delete(m.clearedFields, whatsappchannel.FieldWaName)
|
|
|
+}
|
|
|
+
|
|
|
+// SetWabaID sets the "waba_id" field.
|
|
|
+func (m *WhatsappChannelMutation) SetWabaID(u uint64) {
|
|
|
+ m.waba_id = &u
|
|
|
+ m.addwaba_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// WabaID returns the value of the "waba_id" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) WabaID() (r uint64, exists bool) {
|
|
|
+ v := m.waba_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldWabaID returns the old "waba_id" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldWabaID(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldWabaID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldWabaID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldWabaID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.WabaID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddWabaID adds u to the "waba_id" field.
|
|
|
+func (m *WhatsappChannelMutation) AddWabaID(u int64) {
|
|
|
+ if m.addwaba_id != nil {
|
|
|
+ *m.addwaba_id += u
|
|
|
+ } else {
|
|
|
+ m.addwaba_id = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedWabaID returns the value that was added to the "waba_id" field in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedWabaID() (r int64, exists bool) {
|
|
|
+ v := m.addwaba_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetWabaID resets all changes to the "waba_id" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetWabaID() {
|
|
|
+ m.waba_id = nil
|
|
|
+ m.addwaba_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetBusinessID sets the "business_id" field.
|
|
|
+func (m *WhatsappChannelMutation) SetBusinessID(u uint64) {
|
|
|
+ m.business_id = &u
|
|
|
+ m.addbusiness_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// BusinessID returns the value of the "business_id" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) BusinessID() (r uint64, exists bool) {
|
|
|
+ v := m.business_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldBusinessID returns the old "business_id" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldBusinessID(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldBusinessID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldBusinessID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldBusinessID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.BusinessID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddBusinessID adds u to the "business_id" field.
|
|
|
+func (m *WhatsappChannelMutation) AddBusinessID(u int64) {
|
|
|
+ if m.addbusiness_id != nil {
|
|
|
+ *m.addbusiness_id += u
|
|
|
+ } else {
|
|
|
+ m.addbusiness_id = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedBusinessID returns the value that was added to the "business_id" field in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedBusinessID() (r int64, exists bool) {
|
|
|
+ v := m.addbusiness_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetBusinessID resets all changes to the "business_id" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetBusinessID() {
|
|
|
+ m.business_id = nil
|
|
|
+ m.addbusiness_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetOrganizationID sets the "organization_id" field.
|
|
|
+func (m *WhatsappChannelMutation) SetOrganizationID(u uint64) {
|
|
|
+ m.organization_id = &u
|
|
|
+ m.addorganization_id = nil
|
|
|
+}
|
|
|
+
|
|
|
+// OrganizationID returns the value of the "organization_id" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) OrganizationID() (r uint64, exists bool) {
|
|
|
+ v := m.organization_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldOrganizationID returns the old "organization_id" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldOrganizationID(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldOrganizationID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldOrganizationID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldOrganizationID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.OrganizationID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddOrganizationID adds u to the "organization_id" field.
|
|
|
+func (m *WhatsappChannelMutation) AddOrganizationID(u int64) {
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ *m.addorganization_id += u
|
|
|
+ } else {
|
|
|
+ m.addorganization_id = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedOrganizationID returns the value that was added to the "organization_id" field in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedOrganizationID() (r int64, exists bool) {
|
|
|
+ v := m.addorganization_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ClearOrganizationID clears the value of the "organization_id" field.
|
|
|
+func (m *WhatsappChannelMutation) ClearOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ m.clearedFields[whatsappchannel.FieldOrganizationID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) OrganizationIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[whatsappchannel.FieldOrganizationID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetOrganizationID resets all changes to the "organization_id" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ delete(m.clearedFields, whatsappchannel.FieldOrganizationID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetVerifyAccount sets the "verify_account" field.
|
|
|
+func (m *WhatsappChannelMutation) SetVerifyAccount(s string) {
|
|
|
+ m.verify_account = &s
|
|
|
+}
|
|
|
+
|
|
|
+// VerifyAccount returns the value of the "verify_account" field in the mutation.
|
|
|
+func (m *WhatsappChannelMutation) VerifyAccount() (r string, exists bool) {
|
|
|
+ v := m.verify_account
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldVerifyAccount returns the old "verify_account" field's value of the WhatsappChannel entity.
|
|
|
+// If the WhatsappChannel 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 *WhatsappChannelMutation) OldVerifyAccount(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldVerifyAccount is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldVerifyAccount requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldVerifyAccount: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.VerifyAccount, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ResetVerifyAccount resets all changes to the "verify_account" field.
|
|
|
+func (m *WhatsappChannelMutation) ResetVerifyAccount() {
|
|
|
+ m.verify_account = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Where appends a list predicates to the WhatsappChannelMutation builder.
|
|
|
+func (m *WhatsappChannelMutation) Where(ps ...predicate.WhatsappChannel) {
|
|
|
+ m.predicates = append(m.predicates, ps...)
|
|
|
+}
|
|
|
+
|
|
|
+// WhereP appends storage-level predicates to the WhatsappChannelMutation builder. Using this method,
|
|
|
+// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
|
+func (m *WhatsappChannelMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
|
+ p := make([]predicate.WhatsappChannel, len(ps))
|
|
|
+ for i := range ps {
|
|
|
+ p[i] = ps[i]
|
|
|
+ }
|
|
|
+ m.Where(p...)
|
|
|
+}
|
|
|
+
|
|
|
+// Op returns the operation name.
|
|
|
+func (m *WhatsappChannelMutation) Op() Op {
|
|
|
+ return m.op
|
|
|
+}
|
|
|
+
|
|
|
+// SetOp allows setting the mutation operation.
|
|
|
+func (m *WhatsappChannelMutation) SetOp(op Op) {
|
|
|
+ m.op = op
|
|
|
+}
|
|
|
+
|
|
|
+// Type returns the node type of this mutation (WhatsappChannel).
|
|
|
+func (m *WhatsappChannelMutation) Type() string {
|
|
|
+ return m.typ
|
|
|
+}
|
|
|
+
|
|
|
+// Fields returns all fields that were changed during this mutation. Note that in
|
|
|
+// order to get all numeric fields that were incremented/decremented, call
|
|
|
+// AddedFields().
|
|
|
+func (m *WhatsappChannelMutation) Fields() []string {
|
|
|
+ fields := make([]string, 0, 12)
|
|
|
+ if m.created_at != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldCreatedAt)
|
|
|
+ }
|
|
|
+ if m.updated_at != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldUpdatedAt)
|
|
|
+ }
|
|
|
+ if m.status != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.deleted_at != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.ak != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldAk)
|
|
|
+ }
|
|
|
+ if m.sk != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldSk)
|
|
|
+ }
|
|
|
+ if m.wa_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldWaID)
|
|
|
+ }
|
|
|
+ if m.wa_name != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldWaName)
|
|
|
+ }
|
|
|
+ if m.waba_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldWabaID)
|
|
|
+ }
|
|
|
+ if m.business_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldBusinessID)
|
|
|
+ }
|
|
|
+ if m.organization_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.verify_account != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldVerifyAccount)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+// Field returns the value of a field with the given name. The second boolean
|
|
|
+// return value indicates that this field was not set, or was not defined in the
|
|
|
+// schema.
|
|
|
+func (m *WhatsappChannelMutation) Field(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case whatsappchannel.FieldCreatedAt:
|
|
|
+ return m.CreatedAt()
|
|
|
+ case whatsappchannel.FieldUpdatedAt:
|
|
|
+ return m.UpdatedAt()
|
|
|
+ case whatsappchannel.FieldStatus:
|
|
|
+ return m.Status()
|
|
|
+ case whatsappchannel.FieldDeletedAt:
|
|
|
+ return m.DeletedAt()
|
|
|
+ case whatsappchannel.FieldAk:
|
|
|
+ return m.Ak()
|
|
|
+ case whatsappchannel.FieldSk:
|
|
|
+ return m.Sk()
|
|
|
+ case whatsappchannel.FieldWaID:
|
|
|
+ return m.WaID()
|
|
|
+ case whatsappchannel.FieldWaName:
|
|
|
+ return m.WaName()
|
|
|
+ case whatsappchannel.FieldWabaID:
|
|
|
+ return m.WabaID()
|
|
|
+ case whatsappchannel.FieldBusinessID:
|
|
|
+ return m.BusinessID()
|
|
|
+ case whatsappchannel.FieldOrganizationID:
|
|
|
+ return m.OrganizationID()
|
|
|
+ case whatsappchannel.FieldVerifyAccount:
|
|
|
+ return m.VerifyAccount()
|
|
|
+ }
|
|
|
+ return nil, false
|
|
|
+}
|
|
|
+
|
|
|
+// OldField returns the old value of the field from the database. An error is
|
|
|
+// returned if the mutation operation is not UpdateOne, or the query to the
|
|
|
+// database failed.
|
|
|
+func (m *WhatsappChannelMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
|
+ switch name {
|
|
|
+ case whatsappchannel.FieldCreatedAt:
|
|
|
+ return m.OldCreatedAt(ctx)
|
|
|
+ case whatsappchannel.FieldUpdatedAt:
|
|
|
+ return m.OldUpdatedAt(ctx)
|
|
|
+ case whatsappchannel.FieldStatus:
|
|
|
+ return m.OldStatus(ctx)
|
|
|
+ case whatsappchannel.FieldDeletedAt:
|
|
|
+ return m.OldDeletedAt(ctx)
|
|
|
+ case whatsappchannel.FieldAk:
|
|
|
+ return m.OldAk(ctx)
|
|
|
+ case whatsappchannel.FieldSk:
|
|
|
+ return m.OldSk(ctx)
|
|
|
+ case whatsappchannel.FieldWaID:
|
|
|
+ return m.OldWaID(ctx)
|
|
|
+ case whatsappchannel.FieldWaName:
|
|
|
+ return m.OldWaName(ctx)
|
|
|
+ case whatsappchannel.FieldWabaID:
|
|
|
+ return m.OldWabaID(ctx)
|
|
|
+ case whatsappchannel.FieldBusinessID:
|
|
|
+ return m.OldBusinessID(ctx)
|
|
|
+ case whatsappchannel.FieldOrganizationID:
|
|
|
+ return m.OldOrganizationID(ctx)
|
|
|
+ case whatsappchannel.FieldVerifyAccount:
|
|
|
+ return m.OldVerifyAccount(ctx)
|
|
|
+ }
|
|
|
+ return nil, fmt.Errorf("unknown WhatsappChannel field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// SetField sets the value of a field with the given name. It returns an error if
|
|
|
+// the field is not defined in the schema, or if the type mismatched the field
|
|
|
+// type.
|
|
|
+func (m *WhatsappChannelMutation) SetField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case whatsappchannel.FieldCreatedAt:
|
|
|
+ v, ok := value.(time.Time)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetCreatedAt(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldUpdatedAt:
|
|
|
+ v, ok := value.(time.Time)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetUpdatedAt(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldStatus:
|
|
|
+ v, ok := value.(uint8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetStatus(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldDeletedAt:
|
|
|
+ v, ok := value.(time.Time)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetDeletedAt(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldAk:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAk(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldSk:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetSk(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWaID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetWaID(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWaName:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetWaName(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWabaID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetWabaID(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldBusinessID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetBusinessID(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldOrganizationID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldVerifyAccount:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetVerifyAccount(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown WhatsappChannel field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedFields returns all numeric fields that were incremented/decremented during
|
|
|
+// this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.addstatus != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.addwa_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldWaID)
|
|
|
+ }
|
|
|
+ if m.addwaba_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldWabaID)
|
|
|
+ }
|
|
|
+ if m.addbusiness_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldBusinessID)
|
|
|
+ }
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ fields = append(fields, whatsappchannel.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+// AddedField returns the numeric value that was incremented/decremented on a field
|
|
|
+// with the given name. The second boolean return value indicates that this field
|
|
|
+// was not set, or was not defined in the schema.
|
|
|
+func (m *WhatsappChannelMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case whatsappchannel.FieldStatus:
|
|
|
+ return m.AddedStatus()
|
|
|
+ case whatsappchannel.FieldWaID:
|
|
|
+ return m.AddedWaID()
|
|
|
+ case whatsappchannel.FieldWabaID:
|
|
|
+ return m.AddedWabaID()
|
|
|
+ case whatsappchannel.FieldBusinessID:
|
|
|
+ return m.AddedBusinessID()
|
|
|
+ case whatsappchannel.FieldOrganizationID:
|
|
|
+ return m.AddedOrganizationID()
|
|
|
+ }
|
|
|
+ return nil, false
|
|
|
+}
|
|
|
+
|
|
|
+// AddField adds the value to the field with the given name. It returns an error if
|
|
|
+// the field is not defined in the schema, or if the type mismatched the field
|
|
|
+// type.
|
|
|
+func (m *WhatsappChannelMutation) AddField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case whatsappchannel.FieldStatus:
|
|
|
+ v, ok := value.(int8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddStatus(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWaID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddWaID(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWabaID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddWabaID(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldBusinessID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddBusinessID(v)
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldOrganizationID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown WhatsappChannel numeric field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedFields returns all nullable fields that were cleared during this
|
|
|
+// mutation.
|
|
|
+func (m *WhatsappChannelMutation) ClearedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.FieldCleared(whatsappchannel.FieldStatus) {
|
|
|
+ fields = append(fields, whatsappchannel.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(whatsappchannel.FieldDeletedAt) {
|
|
|
+ fields = append(fields, whatsappchannel.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(whatsappchannel.FieldAk) {
|
|
|
+ fields = append(fields, whatsappchannel.FieldAk)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(whatsappchannel.FieldWaID) {
|
|
|
+ fields = append(fields, whatsappchannel.FieldWaID)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(whatsappchannel.FieldWaName) {
|
|
|
+ fields = append(fields, whatsappchannel.FieldWaName)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(whatsappchannel.FieldOrganizationID) {
|
|
|
+ fields = append(fields, whatsappchannel.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+// FieldCleared returns a boolean indicating if a field with the given name was
|
|
|
+// cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) FieldCleared(name string) bool {
|
|
|
+ _, ok := m.clearedFields[name]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// 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 *WhatsappChannelMutation) ClearField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case whatsappchannel.FieldStatus:
|
|
|
+ m.ClearStatus()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldDeletedAt:
|
|
|
+ m.ClearDeletedAt()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldAk:
|
|
|
+ m.ClearAk()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWaID:
|
|
|
+ m.ClearWaID()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWaName:
|
|
|
+ m.ClearWaName()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldOrganizationID:
|
|
|
+ m.ClearOrganizationID()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown WhatsappChannel nullable field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// ResetField resets all changes in the mutation for the field with the given name.
|
|
|
+// It returns an error if the field is not defined in the schema.
|
|
|
+func (m *WhatsappChannelMutation) ResetField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case whatsappchannel.FieldCreatedAt:
|
|
|
+ m.ResetCreatedAt()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldUpdatedAt:
|
|
|
+ m.ResetUpdatedAt()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldStatus:
|
|
|
+ m.ResetStatus()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldDeletedAt:
|
|
|
+ m.ResetDeletedAt()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldAk:
|
|
|
+ m.ResetAk()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldSk:
|
|
|
+ m.ResetSk()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWaID:
|
|
|
+ m.ResetWaID()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWaName:
|
|
|
+ m.ResetWaName()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldWabaID:
|
|
|
+ m.ResetWabaID()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldBusinessID:
|
|
|
+ m.ResetBusinessID()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldOrganizationID:
|
|
|
+ m.ResetOrganizationID()
|
|
|
+ return nil
|
|
|
+ case whatsappchannel.FieldVerifyAccount:
|
|
|
+ m.ResetVerifyAccount()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown WhatsappChannel field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedEdges() []string {
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
+ return edges
|
|
|
+}
|
|
|
+
|
|
|
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
|
|
|
+// name in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) RemovedEdges() []string {
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
+ return edges
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
|
|
+// the given name in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) RemovedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) ClearedEdges() []string {
|
|
|
+ edges := make([]string, 0, 0)
|
|
|
+ return edges
|
|
|
+}
|
|
|
+
|
|
|
+// EdgeCleared returns a boolean which indicates if the edge with the given name
|
|
|
+// was cleared in this mutation.
|
|
|
+func (m *WhatsappChannelMutation) EdgeCleared(name string) bool {
|
|
|
+ return false
|
|
|
+}
|
|
|
+
|
|
|
+// ClearEdge clears the value of the edge with the given name. It returns an error
|
|
|
+// if that edge is not defined in the schema.
|
|
|
+func (m *WhatsappChannelMutation) ClearEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown WhatsappChannel unique edge %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// ResetEdge resets all changes to the edge with the given name in this mutation.
|
|
|
+// It returns an error if the edge is not defined in the schema.
|
|
|
+func (m *WhatsappChannelMutation) ResetEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown WhatsappChannel edge %s", name)
|
|
|
+}
|
|
|
+
|
|
|
// WorkExperienceMutation represents an operation that mutates the WorkExperience nodes in the graph.
|
|
|
type WorkExperienceMutation struct {
|
|
|
config
|