|
@@ -33,6 +33,9 @@ import (
|
|
|
"wechat-api/ent/token"
|
|
|
"wechat-api/ent/tutorial"
|
|
|
"wechat-api/ent/usagedetail"
|
|
|
+ "wechat-api/ent/usagestatisticday"
|
|
|
+ "wechat-api/ent/usagestatistichour"
|
|
|
+ "wechat-api/ent/usagestatisticmonth"
|
|
|
"wechat-api/ent/usagetotal"
|
|
|
"wechat-api/ent/workexperience"
|
|
|
"wechat-api/ent/wpchatroom"
|
|
@@ -55,37 +58,40 @@ const (
|
|
|
OpUpdateOne = ent.OpUpdateOne
|
|
|
|
|
|
// Node types.
|
|
|
- TypeAgent = "Agent"
|
|
|
- TypeAgentBase = "AgentBase"
|
|
|
- TypeAliyunAvatar = "AliyunAvatar"
|
|
|
- TypeAllocAgent = "AllocAgent"
|
|
|
- TypeBatchMsg = "BatchMsg"
|
|
|
- TypeCategory = "Category"
|
|
|
- TypeChatRecords = "ChatRecords"
|
|
|
- TypeChatSession = "ChatSession"
|
|
|
- TypeContact = "Contact"
|
|
|
- TypeEmployee = "Employee"
|
|
|
- TypeEmployeeConfig = "EmployeeConfig"
|
|
|
- TypeLabel = "Label"
|
|
|
- TypeLabelRelationship = "LabelRelationship"
|
|
|
- TypeMessage = "Message"
|
|
|
- TypeMessageRecords = "MessageRecords"
|
|
|
- TypeMsg = "Msg"
|
|
|
- TypeServer = "Server"
|
|
|
- TypeSopNode = "SopNode"
|
|
|
- TypeSopStage = "SopStage"
|
|
|
- TypeSopTask = "SopTask"
|
|
|
- TypeToken = "Token"
|
|
|
- TypeTutorial = "Tutorial"
|
|
|
- TypeUsageDetail = "UsageDetail"
|
|
|
- TypeUsageTotal = "UsageTotal"
|
|
|
- TypeWorkExperience = "WorkExperience"
|
|
|
- TypeWpChatroom = "WpChatroom"
|
|
|
- TypeWpChatroomMember = "WpChatroomMember"
|
|
|
- TypeWx = "Wx"
|
|
|
- TypeWxCard = "WxCard"
|
|
|
- TypeWxCardUser = "WxCardUser"
|
|
|
- TypeWxCardVisit = "WxCardVisit"
|
|
|
+ TypeAgent = "Agent"
|
|
|
+ TypeAgentBase = "AgentBase"
|
|
|
+ TypeAliyunAvatar = "AliyunAvatar"
|
|
|
+ TypeAllocAgent = "AllocAgent"
|
|
|
+ TypeBatchMsg = "BatchMsg"
|
|
|
+ TypeCategory = "Category"
|
|
|
+ TypeChatRecords = "ChatRecords"
|
|
|
+ TypeChatSession = "ChatSession"
|
|
|
+ TypeContact = "Contact"
|
|
|
+ TypeEmployee = "Employee"
|
|
|
+ TypeEmployeeConfig = "EmployeeConfig"
|
|
|
+ TypeLabel = "Label"
|
|
|
+ TypeLabelRelationship = "LabelRelationship"
|
|
|
+ TypeMessage = "Message"
|
|
|
+ TypeMessageRecords = "MessageRecords"
|
|
|
+ TypeMsg = "Msg"
|
|
|
+ TypeServer = "Server"
|
|
|
+ TypeSopNode = "SopNode"
|
|
|
+ TypeSopStage = "SopStage"
|
|
|
+ TypeSopTask = "SopTask"
|
|
|
+ TypeToken = "Token"
|
|
|
+ TypeTutorial = "Tutorial"
|
|
|
+ TypeUsageDetail = "UsageDetail"
|
|
|
+ TypeUsageStatisticDay = "UsageStatisticDay"
|
|
|
+ TypeUsageStatisticHour = "UsageStatisticHour"
|
|
|
+ TypeUsageStatisticMonth = "UsageStatisticMonth"
|
|
|
+ TypeUsageTotal = "UsageTotal"
|
|
|
+ TypeWorkExperience = "WorkExperience"
|
|
|
+ TypeWpChatroom = "WpChatroom"
|
|
|
+ TypeWpChatroomMember = "WpChatroomMember"
|
|
|
+ TypeWx = "Wx"
|
|
|
+ TypeWxCard = "WxCard"
|
|
|
+ TypeWxCardUser = "WxCardUser"
|
|
|
+ TypeWxCardVisit = "WxCardVisit"
|
|
|
)
|
|
|
|
|
|
// AgentMutation represents an operation that mutates the Agent nodes in the graph.
|
|
@@ -26747,6 +26753,5082 @@ func (m *UsageDetailMutation) ResetEdge(name string) error {
|
|
|
return fmt.Errorf("unknown UsageDetail edge %s", name)
|
|
|
}
|
|
|
|
|
|
+// UsageStatisticDayMutation represents an operation that mutates the UsageStatisticDay nodes in the graph.
|
|
|
+type UsageStatisticDayMutation struct {
|
|
|
+ config
|
|
|
+ op Op
|
|
|
+ typ string
|
|
|
+ id *uint64
|
|
|
+ created_at *time.Time
|
|
|
+ updated_at *time.Time
|
|
|
+ status *uint8
|
|
|
+ addstatus *int8
|
|
|
+ deleted_at *time.Time
|
|
|
+ addtime *uint64
|
|
|
+ addaddtime *int64
|
|
|
+ _type *int
|
|
|
+ add_type *int
|
|
|
+ bot_id *string
|
|
|
+ organization_id *uint64
|
|
|
+ addorganization_id *int64
|
|
|
+ ai_response *uint64
|
|
|
+ addai_response *int64
|
|
|
+ sop_run *uint64
|
|
|
+ addsop_run *int64
|
|
|
+ total_friend *uint64
|
|
|
+ addtotal_friend *int64
|
|
|
+ total_group *uint64
|
|
|
+ addtotal_group *int64
|
|
|
+ account_balance *uint64
|
|
|
+ addaccount_balance *int64
|
|
|
+ consume_token *uint64
|
|
|
+ addconsume_token *int64
|
|
|
+ active_user *uint64
|
|
|
+ addactive_user *int64
|
|
|
+ new_user *int64
|
|
|
+ addnew_user *int64
|
|
|
+ label_dist *[]custom_types.LabelDist
|
|
|
+ appendlabel_dist []custom_types.LabelDist
|
|
|
+ clearedFields map[string]struct{}
|
|
|
+ done bool
|
|
|
+ oldValue func(context.Context) (*UsageStatisticDay, error)
|
|
|
+ predicates []predicate.UsageStatisticDay
|
|
|
+}
|
|
|
+
|
|
|
+var _ ent.Mutation = (*UsageStatisticDayMutation)(nil)
|
|
|
+
|
|
|
+// usagestatisticdayOption allows management of the mutation configuration using functional options.
|
|
|
+type usagestatisticdayOption func(*UsageStatisticDayMutation)
|
|
|
+
|
|
|
+// newUsageStatisticDayMutation creates new mutation for the UsageStatisticDay entity.
|
|
|
+func newUsageStatisticDayMutation(c config, op Op, opts ...usagestatisticdayOption) *UsageStatisticDayMutation {
|
|
|
+ m := &UsageStatisticDayMutation{
|
|
|
+ config: c,
|
|
|
+ op: op,
|
|
|
+ typ: TypeUsageStatisticDay,
|
|
|
+ clearedFields: make(map[string]struct{}),
|
|
|
+ }
|
|
|
+ for _, opt := range opts {
|
|
|
+ opt(m)
|
|
|
+ }
|
|
|
+ return m
|
|
|
+}
|
|
|
+
|
|
|
+// withUsageStatisticDayID sets the ID field of the mutation.
|
|
|
+func withUsageStatisticDayID(id uint64) usagestatisticdayOption {
|
|
|
+ return func(m *UsageStatisticDayMutation) {
|
|
|
+ var (
|
|
|
+ err error
|
|
|
+ once sync.Once
|
|
|
+ value *UsageStatisticDay
|
|
|
+ )
|
|
|
+ m.oldValue = func(ctx context.Context) (*UsageStatisticDay, error) {
|
|
|
+ once.Do(func() {
|
|
|
+ if m.done {
|
|
|
+ err = errors.New("querying old values post mutation is not allowed")
|
|
|
+ } else {
|
|
|
+ value, err = m.Client().UsageStatisticDay.Get(ctx, id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return value, err
|
|
|
+ }
|
|
|
+ m.id = &id
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// withUsageStatisticDay sets the old UsageStatisticDay of the mutation.
|
|
|
+func withUsageStatisticDay(node *UsageStatisticDay) usagestatisticdayOption {
|
|
|
+ return func(m *UsageStatisticDayMutation) {
|
|
|
+ m.oldValue = func(context.Context) (*UsageStatisticDay, 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 UsageStatisticDayMutation) 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 UsageStatisticDayMutation) 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 UsageStatisticDay entities.
|
|
|
+func (m *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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().UsageStatisticDay.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 *UsageStatisticDayMutation) SetCreatedAt(t time.Time) {
|
|
|
+ m.created_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) ResetCreatedAt() {
|
|
|
+ m.created_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetUpdatedAt sets the "updated_at" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetUpdatedAt(t time.Time) {
|
|
|
+ m.updated_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) ResetUpdatedAt() {
|
|
|
+ m.updated_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetStatus sets the "status" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetStatus(u uint8) {
|
|
|
+ m.status = &u
|
|
|
+ m.addstatus = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns the value of the "status" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) ClearStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ m.clearedFields[usagestatisticday.FieldStatus] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCleared returns if the "status" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) StatusCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticday.FieldStatus]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetStatus resets all changes to the "status" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ delete(m.clearedFields, usagestatisticday.FieldStatus)
|
|
|
+}
|
|
|
+
|
|
|
+// SetDeletedAt sets the "deleted_at" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetDeletedAt(t time.Time) {
|
|
|
+ m.deleted_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) ClearDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ m.clearedFields[usagestatisticday.FieldDeletedAt] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) DeletedAtCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticday.FieldDeletedAt]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetDeletedAt resets all changes to the "deleted_at" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ delete(m.clearedFields, usagestatisticday.FieldDeletedAt)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAddtime sets the "addtime" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetAddtime(u uint64) {
|
|
|
+ m.addtime = &u
|
|
|
+ m.addaddtime = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Addtime returns the value of the "addtime" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) Addtime() (r uint64, exists bool) {
|
|
|
+ v := m.addtime
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAddtime returns the old "addtime" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldAddtime(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAddtime is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAddtime requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAddtime: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Addtime, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAddtime adds u to the "addtime" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddAddtime(u int64) {
|
|
|
+ if m.addaddtime != nil {
|
|
|
+ *m.addaddtime += u
|
|
|
+ } else {
|
|
|
+ m.addaddtime = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAddtime returns the value that was added to the "addtime" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedAddtime() (r int64, exists bool) {
|
|
|
+ v := m.addaddtime
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAddtime resets all changes to the "addtime" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetAddtime() {
|
|
|
+ m.addtime = nil
|
|
|
+ m.addaddtime = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetType sets the "type" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetType(i int) {
|
|
|
+ m._type = &i
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetType returns the value of the "type" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) GetType() (r int, exists bool) {
|
|
|
+ v := m._type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldType returns the old "type" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldType(ctx context.Context) (v int, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldType is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldType requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldType: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Type, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddType adds i to the "type" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddType(i int) {
|
|
|
+ if m.add_type != nil {
|
|
|
+ *m.add_type += i
|
|
|
+ } else {
|
|
|
+ m.add_type = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedType returns the value that was added to the "type" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedType() (r int, exists bool) {
|
|
|
+ v := m.add_type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetType resets all changes to the "type" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetType() {
|
|
|
+ m._type = nil
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetBotID sets the "bot_id" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetBotID(s string) {
|
|
|
+ m.bot_id = &s
|
|
|
+}
|
|
|
+
|
|
|
+// BotID returns the value of the "bot_id" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) BotID() (r string, exists bool) {
|
|
|
+ v := m.bot_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldBotID returns the old "bot_id" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldBotID(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldBotID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldBotID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldBotID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.BotID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearBotID clears the value of the "bot_id" field.
|
|
|
+func (m *UsageStatisticDayMutation) ClearBotID() {
|
|
|
+ m.bot_id = nil
|
|
|
+ m.clearedFields[usagestatisticday.FieldBotID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// BotIDCleared returns if the "bot_id" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) BotIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticday.FieldBotID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetBotID resets all changes to the "bot_id" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetBotID() {
|
|
|
+ m.bot_id = nil
|
|
|
+ delete(m.clearedFields, usagestatisticday.FieldBotID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetOrganizationID sets the "organization_id" field.
|
|
|
+func (m *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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 UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) ClearOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ m.clearedFields[usagestatisticday.FieldOrganizationID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) OrganizationIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticday.FieldOrganizationID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetOrganizationID resets all changes to the "organization_id" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ delete(m.clearedFields, usagestatisticday.FieldOrganizationID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAiResponse sets the "ai_response" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetAiResponse(u uint64) {
|
|
|
+ m.ai_response = &u
|
|
|
+ m.addai_response = nil
|
|
|
+}
|
|
|
+
|
|
|
+// AiResponse returns the value of the "ai_response" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AiResponse() (r uint64, exists bool) {
|
|
|
+ v := m.ai_response
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAiResponse returns the old "ai_response" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldAiResponse(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAiResponse is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAiResponse requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAiResponse: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AiResponse, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAiResponse adds u to the "ai_response" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddAiResponse(u int64) {
|
|
|
+ if m.addai_response != nil {
|
|
|
+ *m.addai_response += u
|
|
|
+ } else {
|
|
|
+ m.addai_response = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAiResponse returns the value that was added to the "ai_response" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedAiResponse() (r int64, exists bool) {
|
|
|
+ v := m.addai_response
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAiResponse resets all changes to the "ai_response" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetAiResponse() {
|
|
|
+ m.ai_response = nil
|
|
|
+ m.addai_response = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetSopRun sets the "sop_run" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetSopRun(u uint64) {
|
|
|
+ m.sop_run = &u
|
|
|
+ m.addsop_run = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SopRun returns the value of the "sop_run" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) SopRun() (r uint64, exists bool) {
|
|
|
+ v := m.sop_run
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldSopRun returns the old "sop_run" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldSopRun(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldSopRun is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldSopRun requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldSopRun: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.SopRun, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddSopRun adds u to the "sop_run" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddSopRun(u int64) {
|
|
|
+ if m.addsop_run != nil {
|
|
|
+ *m.addsop_run += u
|
|
|
+ } else {
|
|
|
+ m.addsop_run = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedSopRun returns the value that was added to the "sop_run" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedSopRun() (r int64, exists bool) {
|
|
|
+ v := m.addsop_run
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetSopRun resets all changes to the "sop_run" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetSopRun() {
|
|
|
+ m.sop_run = nil
|
|
|
+ m.addsop_run = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetTotalFriend sets the "total_friend" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetTotalFriend(u uint64) {
|
|
|
+ m.total_friend = &u
|
|
|
+ m.addtotal_friend = nil
|
|
|
+}
|
|
|
+
|
|
|
+// TotalFriend returns the value of the "total_friend" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) TotalFriend() (r uint64, exists bool) {
|
|
|
+ v := m.total_friend
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldTotalFriend returns the old "total_friend" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldTotalFriend(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldTotalFriend is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldTotalFriend requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldTotalFriend: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.TotalFriend, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddTotalFriend adds u to the "total_friend" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddTotalFriend(u int64) {
|
|
|
+ if m.addtotal_friend != nil {
|
|
|
+ *m.addtotal_friend += u
|
|
|
+ } else {
|
|
|
+ m.addtotal_friend = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedTotalFriend returns the value that was added to the "total_friend" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedTotalFriend() (r int64, exists bool) {
|
|
|
+ v := m.addtotal_friend
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetTotalFriend resets all changes to the "total_friend" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetTotalFriend() {
|
|
|
+ m.total_friend = nil
|
|
|
+ m.addtotal_friend = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetTotalGroup sets the "total_group" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetTotalGroup(u uint64) {
|
|
|
+ m.total_group = &u
|
|
|
+ m.addtotal_group = nil
|
|
|
+}
|
|
|
+
|
|
|
+// TotalGroup returns the value of the "total_group" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) TotalGroup() (r uint64, exists bool) {
|
|
|
+ v := m.total_group
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldTotalGroup returns the old "total_group" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldTotalGroup(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldTotalGroup is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldTotalGroup requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldTotalGroup: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.TotalGroup, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddTotalGroup adds u to the "total_group" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddTotalGroup(u int64) {
|
|
|
+ if m.addtotal_group != nil {
|
|
|
+ *m.addtotal_group += u
|
|
|
+ } else {
|
|
|
+ m.addtotal_group = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedTotalGroup returns the value that was added to the "total_group" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedTotalGroup() (r int64, exists bool) {
|
|
|
+ v := m.addtotal_group
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetTotalGroup resets all changes to the "total_group" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetTotalGroup() {
|
|
|
+ m.total_group = nil
|
|
|
+ m.addtotal_group = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetAccountBalance sets the "account_balance" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetAccountBalance(u uint64) {
|
|
|
+ m.account_balance = &u
|
|
|
+ m.addaccount_balance = nil
|
|
|
+}
|
|
|
+
|
|
|
+// AccountBalance returns the value of the "account_balance" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AccountBalance() (r uint64, exists bool) {
|
|
|
+ v := m.account_balance
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAccountBalance returns the old "account_balance" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldAccountBalance(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAccountBalance is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAccountBalance requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAccountBalance: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AccountBalance, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAccountBalance adds u to the "account_balance" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddAccountBalance(u int64) {
|
|
|
+ if m.addaccount_balance != nil {
|
|
|
+ *m.addaccount_balance += u
|
|
|
+ } else {
|
|
|
+ m.addaccount_balance = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAccountBalance returns the value that was added to the "account_balance" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedAccountBalance() (r int64, exists bool) {
|
|
|
+ v := m.addaccount_balance
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAccountBalance resets all changes to the "account_balance" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetAccountBalance() {
|
|
|
+ m.account_balance = nil
|
|
|
+ m.addaccount_balance = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetConsumeToken sets the "consume_token" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetConsumeToken(u uint64) {
|
|
|
+ m.consume_token = &u
|
|
|
+ m.addconsume_token = nil
|
|
|
+}
|
|
|
+
|
|
|
+// ConsumeToken returns the value of the "consume_token" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) ConsumeToken() (r uint64, exists bool) {
|
|
|
+ v := m.consume_token
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldConsumeToken returns the old "consume_token" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldConsumeToken(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldConsumeToken is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldConsumeToken requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldConsumeToken: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ConsumeToken, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddConsumeToken adds u to the "consume_token" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddConsumeToken(u int64) {
|
|
|
+ if m.addconsume_token != nil {
|
|
|
+ *m.addconsume_token += u
|
|
|
+ } else {
|
|
|
+ m.addconsume_token = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedConsumeToken returns the value that was added to the "consume_token" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedConsumeToken() (r int64, exists bool) {
|
|
|
+ v := m.addconsume_token
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetConsumeToken resets all changes to the "consume_token" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetConsumeToken() {
|
|
|
+ m.consume_token = nil
|
|
|
+ m.addconsume_token = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetActiveUser sets the "active_user" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetActiveUser(u uint64) {
|
|
|
+ m.active_user = &u
|
|
|
+ m.addactive_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// ActiveUser returns the value of the "active_user" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) ActiveUser() (r uint64, exists bool) {
|
|
|
+ v := m.active_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldActiveUser returns the old "active_user" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldActiveUser(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldActiveUser is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldActiveUser requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldActiveUser: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ActiveUser, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddActiveUser adds u to the "active_user" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddActiveUser(u int64) {
|
|
|
+ if m.addactive_user != nil {
|
|
|
+ *m.addactive_user += u
|
|
|
+ } else {
|
|
|
+ m.addactive_user = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedActiveUser returns the value that was added to the "active_user" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedActiveUser() (r int64, exists bool) {
|
|
|
+ v := m.addactive_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetActiveUser resets all changes to the "active_user" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetActiveUser() {
|
|
|
+ m.active_user = nil
|
|
|
+ m.addactive_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetNewUser sets the "new_user" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetNewUser(i int64) {
|
|
|
+ m.new_user = &i
|
|
|
+ m.addnew_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewUser returns the value of the "new_user" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) NewUser() (r int64, exists bool) {
|
|
|
+ v := m.new_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldNewUser returns the old "new_user" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldNewUser(ctx context.Context) (v int64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldNewUser is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldNewUser requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldNewUser: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.NewUser, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddNewUser adds i to the "new_user" field.
|
|
|
+func (m *UsageStatisticDayMutation) AddNewUser(i int64) {
|
|
|
+ if m.addnew_user != nil {
|
|
|
+ *m.addnew_user += i
|
|
|
+ } else {
|
|
|
+ m.addnew_user = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedNewUser returns the value that was added to the "new_user" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedNewUser() (r int64, exists bool) {
|
|
|
+ v := m.addnew_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetNewUser resets all changes to the "new_user" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetNewUser() {
|
|
|
+ m.new_user = nil
|
|
|
+ m.addnew_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetLabelDist sets the "label_dist" field.
|
|
|
+func (m *UsageStatisticDayMutation) SetLabelDist(ctd []custom_types.LabelDist) {
|
|
|
+ m.label_dist = &ctd
|
|
|
+ m.appendlabel_dist = nil
|
|
|
+}
|
|
|
+
|
|
|
+// LabelDist returns the value of the "label_dist" field in the mutation.
|
|
|
+func (m *UsageStatisticDayMutation) LabelDist() (r []custom_types.LabelDist, exists bool) {
|
|
|
+ v := m.label_dist
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldLabelDist returns the old "label_dist" field's value of the UsageStatisticDay entity.
|
|
|
+// If the UsageStatisticDay 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 *UsageStatisticDayMutation) OldLabelDist(ctx context.Context) (v []custom_types.LabelDist, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldLabelDist is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldLabelDist requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldLabelDist: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.LabelDist, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AppendLabelDist adds ctd to the "label_dist" field.
|
|
|
+func (m *UsageStatisticDayMutation) AppendLabelDist(ctd []custom_types.LabelDist) {
|
|
|
+ m.appendlabel_dist = append(m.appendlabel_dist, ctd...)
|
|
|
+}
|
|
|
+
|
|
|
+// AppendedLabelDist returns the list of values that were appended to the "label_dist" field in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AppendedLabelDist() ([]custom_types.LabelDist, bool) {
|
|
|
+ if len(m.appendlabel_dist) == 0 {
|
|
|
+ return nil, false
|
|
|
+ }
|
|
|
+ return m.appendlabel_dist, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetLabelDist resets all changes to the "label_dist" field.
|
|
|
+func (m *UsageStatisticDayMutation) ResetLabelDist() {
|
|
|
+ m.label_dist = nil
|
|
|
+ m.appendlabel_dist = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Where appends a list predicates to the UsageStatisticDayMutation builder.
|
|
|
+func (m *UsageStatisticDayMutation) Where(ps ...predicate.UsageStatisticDay) {
|
|
|
+ m.predicates = append(m.predicates, ps...)
|
|
|
+}
|
|
|
+
|
|
|
+// WhereP appends storage-level predicates to the UsageStatisticDayMutation builder. Using this method,
|
|
|
+// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
|
+func (m *UsageStatisticDayMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
|
+ p := make([]predicate.UsageStatisticDay, len(ps))
|
|
|
+ for i := range ps {
|
|
|
+ p[i] = ps[i]
|
|
|
+ }
|
|
|
+ m.Where(p...)
|
|
|
+}
|
|
|
+
|
|
|
+// Op returns the operation name.
|
|
|
+func (m *UsageStatisticDayMutation) Op() Op {
|
|
|
+ return m.op
|
|
|
+}
|
|
|
+
|
|
|
+// SetOp allows setting the mutation operation.
|
|
|
+func (m *UsageStatisticDayMutation) SetOp(op Op) {
|
|
|
+ m.op = op
|
|
|
+}
|
|
|
+
|
|
|
+// Type returns the node type of this mutation (UsageStatisticDay).
|
|
|
+func (m *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) Fields() []string {
|
|
|
+ fields := make([]string, 0, 17)
|
|
|
+ if m.created_at != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldCreatedAt)
|
|
|
+ }
|
|
|
+ if m.updated_at != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldUpdatedAt)
|
|
|
+ }
|
|
|
+ if m.status != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.deleted_at != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.addtime != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldAddtime)
|
|
|
+ }
|
|
|
+ if m._type != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldType)
|
|
|
+ }
|
|
|
+ if m.bot_id != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldBotID)
|
|
|
+ }
|
|
|
+ if m.organization_id != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.ai_response != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldAiResponse)
|
|
|
+ }
|
|
|
+ if m.sop_run != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldSopRun)
|
|
|
+ }
|
|
|
+ if m.total_friend != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldTotalFriend)
|
|
|
+ }
|
|
|
+ if m.total_group != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldTotalGroup)
|
|
|
+ }
|
|
|
+ if m.account_balance != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldAccountBalance)
|
|
|
+ }
|
|
|
+ if m.consume_token != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldConsumeToken)
|
|
|
+ }
|
|
|
+ if m.active_user != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldActiveUser)
|
|
|
+ }
|
|
|
+ if m.new_user != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldNewUser)
|
|
|
+ }
|
|
|
+ if m.label_dist != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldLabelDist)
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticDayMutation) Field(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticday.FieldCreatedAt:
|
|
|
+ return m.CreatedAt()
|
|
|
+ case usagestatisticday.FieldUpdatedAt:
|
|
|
+ return m.UpdatedAt()
|
|
|
+ case usagestatisticday.FieldStatus:
|
|
|
+ return m.Status()
|
|
|
+ case usagestatisticday.FieldDeletedAt:
|
|
|
+ return m.DeletedAt()
|
|
|
+ case usagestatisticday.FieldAddtime:
|
|
|
+ return m.Addtime()
|
|
|
+ case usagestatisticday.FieldType:
|
|
|
+ return m.GetType()
|
|
|
+ case usagestatisticday.FieldBotID:
|
|
|
+ return m.BotID()
|
|
|
+ case usagestatisticday.FieldOrganizationID:
|
|
|
+ return m.OrganizationID()
|
|
|
+ case usagestatisticday.FieldAiResponse:
|
|
|
+ return m.AiResponse()
|
|
|
+ case usagestatisticday.FieldSopRun:
|
|
|
+ return m.SopRun()
|
|
|
+ case usagestatisticday.FieldTotalFriend:
|
|
|
+ return m.TotalFriend()
|
|
|
+ case usagestatisticday.FieldTotalGroup:
|
|
|
+ return m.TotalGroup()
|
|
|
+ case usagestatisticday.FieldAccountBalance:
|
|
|
+ return m.AccountBalance()
|
|
|
+ case usagestatisticday.FieldConsumeToken:
|
|
|
+ return m.ConsumeToken()
|
|
|
+ case usagestatisticday.FieldActiveUser:
|
|
|
+ return m.ActiveUser()
|
|
|
+ case usagestatisticday.FieldNewUser:
|
|
|
+ return m.NewUser()
|
|
|
+ case usagestatisticday.FieldLabelDist:
|
|
|
+ return m.LabelDist()
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticDayMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticday.FieldCreatedAt:
|
|
|
+ return m.OldCreatedAt(ctx)
|
|
|
+ case usagestatisticday.FieldUpdatedAt:
|
|
|
+ return m.OldUpdatedAt(ctx)
|
|
|
+ case usagestatisticday.FieldStatus:
|
|
|
+ return m.OldStatus(ctx)
|
|
|
+ case usagestatisticday.FieldDeletedAt:
|
|
|
+ return m.OldDeletedAt(ctx)
|
|
|
+ case usagestatisticday.FieldAddtime:
|
|
|
+ return m.OldAddtime(ctx)
|
|
|
+ case usagestatisticday.FieldType:
|
|
|
+ return m.OldType(ctx)
|
|
|
+ case usagestatisticday.FieldBotID:
|
|
|
+ return m.OldBotID(ctx)
|
|
|
+ case usagestatisticday.FieldOrganizationID:
|
|
|
+ return m.OldOrganizationID(ctx)
|
|
|
+ case usagestatisticday.FieldAiResponse:
|
|
|
+ return m.OldAiResponse(ctx)
|
|
|
+ case usagestatisticday.FieldSopRun:
|
|
|
+ return m.OldSopRun(ctx)
|
|
|
+ case usagestatisticday.FieldTotalFriend:
|
|
|
+ return m.OldTotalFriend(ctx)
|
|
|
+ case usagestatisticday.FieldTotalGroup:
|
|
|
+ return m.OldTotalGroup(ctx)
|
|
|
+ case usagestatisticday.FieldAccountBalance:
|
|
|
+ return m.OldAccountBalance(ctx)
|
|
|
+ case usagestatisticday.FieldConsumeToken:
|
|
|
+ return m.OldConsumeToken(ctx)
|
|
|
+ case usagestatisticday.FieldActiveUser:
|
|
|
+ return m.OldActiveUser(ctx)
|
|
|
+ case usagestatisticday.FieldNewUser:
|
|
|
+ return m.OldNewUser(ctx)
|
|
|
+ case usagestatisticday.FieldLabelDist:
|
|
|
+ return m.OldLabelDist(ctx)
|
|
|
+ }
|
|
|
+ return nil, fmt.Errorf("unknown UsageStatisticDay 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 *UsageStatisticDayMutation) SetField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticday.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 usagestatisticday.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 usagestatisticday.FieldStatus:
|
|
|
+ v, ok := value.(uint8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetStatus(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.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 usagestatisticday.FieldAddtime:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAddtime(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetType(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldBotID:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetBotID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldOrganizationID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAiResponse:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAiResponse(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldSopRun:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetSopRun(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldTotalFriend:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetTotalFriend(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldTotalGroup:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetTotalGroup(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAccountBalance:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAccountBalance(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldConsumeToken:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetConsumeToken(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldActiveUser:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetActiveUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldNewUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetNewUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldLabelDist:
|
|
|
+ v, ok := value.([]custom_types.LabelDist)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetLabelDist(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticDay field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedFields returns all numeric fields that were incremented/decremented during
|
|
|
+// this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) AddedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.addstatus != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.addaddtime != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldAddtime)
|
|
|
+ }
|
|
|
+ if m.add_type != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldType)
|
|
|
+ }
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.addai_response != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldAiResponse)
|
|
|
+ }
|
|
|
+ if m.addsop_run != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldSopRun)
|
|
|
+ }
|
|
|
+ if m.addtotal_friend != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldTotalFriend)
|
|
|
+ }
|
|
|
+ if m.addtotal_group != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldTotalGroup)
|
|
|
+ }
|
|
|
+ if m.addaccount_balance != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldAccountBalance)
|
|
|
+ }
|
|
|
+ if m.addconsume_token != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldConsumeToken)
|
|
|
+ }
|
|
|
+ if m.addactive_user != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldActiveUser)
|
|
|
+ }
|
|
|
+ if m.addnew_user != nil {
|
|
|
+ fields = append(fields, usagestatisticday.FieldNewUser)
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticDayMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticday.FieldStatus:
|
|
|
+ return m.AddedStatus()
|
|
|
+ case usagestatisticday.FieldAddtime:
|
|
|
+ return m.AddedAddtime()
|
|
|
+ case usagestatisticday.FieldType:
|
|
|
+ return m.AddedType()
|
|
|
+ case usagestatisticday.FieldOrganizationID:
|
|
|
+ return m.AddedOrganizationID()
|
|
|
+ case usagestatisticday.FieldAiResponse:
|
|
|
+ return m.AddedAiResponse()
|
|
|
+ case usagestatisticday.FieldSopRun:
|
|
|
+ return m.AddedSopRun()
|
|
|
+ case usagestatisticday.FieldTotalFriend:
|
|
|
+ return m.AddedTotalFriend()
|
|
|
+ case usagestatisticday.FieldTotalGroup:
|
|
|
+ return m.AddedTotalGroup()
|
|
|
+ case usagestatisticday.FieldAccountBalance:
|
|
|
+ return m.AddedAccountBalance()
|
|
|
+ case usagestatisticday.FieldConsumeToken:
|
|
|
+ return m.AddedConsumeToken()
|
|
|
+ case usagestatisticday.FieldActiveUser:
|
|
|
+ return m.AddedActiveUser()
|
|
|
+ case usagestatisticday.FieldNewUser:
|
|
|
+ return m.AddedNewUser()
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticDayMutation) AddField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticday.FieldStatus:
|
|
|
+ v, ok := value.(int8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddStatus(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAddtime:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAddtime(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddType(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldOrganizationID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAiResponse:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAiResponse(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldSopRun:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddSopRun(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldTotalFriend:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddTotalFriend(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldTotalGroup:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddTotalGroup(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAccountBalance:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAccountBalance(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldConsumeToken:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddConsumeToken(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldActiveUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddActiveUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldNewUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddNewUser(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticDay numeric field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedFields returns all nullable fields that were cleared during this
|
|
|
+// mutation.
|
|
|
+func (m *UsageStatisticDayMutation) ClearedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.FieldCleared(usagestatisticday.FieldStatus) {
|
|
|
+ fields = append(fields, usagestatisticday.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatisticday.FieldDeletedAt) {
|
|
|
+ fields = append(fields, usagestatisticday.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatisticday.FieldBotID) {
|
|
|
+ fields = append(fields, usagestatisticday.FieldBotID)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatisticday.FieldOrganizationID) {
|
|
|
+ fields = append(fields, usagestatisticday.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+// FieldCleared returns a boolean indicating if a field with the given name was
|
|
|
+// cleared in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) ClearField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticday.FieldStatus:
|
|
|
+ m.ClearStatus()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldDeletedAt:
|
|
|
+ m.ClearDeletedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldBotID:
|
|
|
+ m.ClearBotID()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldOrganizationID:
|
|
|
+ m.ClearOrganizationID()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticDay 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 *UsageStatisticDayMutation) ResetField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticday.FieldCreatedAt:
|
|
|
+ m.ResetCreatedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldUpdatedAt:
|
|
|
+ m.ResetUpdatedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldStatus:
|
|
|
+ m.ResetStatus()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldDeletedAt:
|
|
|
+ m.ResetDeletedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAddtime:
|
|
|
+ m.ResetAddtime()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldType:
|
|
|
+ m.ResetType()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldBotID:
|
|
|
+ m.ResetBotID()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldOrganizationID:
|
|
|
+ m.ResetOrganizationID()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAiResponse:
|
|
|
+ m.ResetAiResponse()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldSopRun:
|
|
|
+ m.ResetSopRun()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldTotalFriend:
|
|
|
+ m.ResetTotalFriend()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldTotalGroup:
|
|
|
+ m.ResetTotalGroup()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldAccountBalance:
|
|
|
+ m.ResetAccountBalance()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldConsumeToken:
|
|
|
+ m.ResetConsumeToken()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldActiveUser:
|
|
|
+ m.ResetActiveUser()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldNewUser:
|
|
|
+ m.ResetNewUser()
|
|
|
+ return nil
|
|
|
+ case usagestatisticday.FieldLabelDist:
|
|
|
+ m.ResetLabelDist()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticDay field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) RemovedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
+func (m *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) 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 *UsageStatisticDayMutation) ClearEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown UsageStatisticDay 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 *UsageStatisticDayMutation) ResetEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown UsageStatisticDay edge %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// UsageStatisticHourMutation represents an operation that mutates the UsageStatisticHour nodes in the graph.
|
|
|
+type UsageStatisticHourMutation struct {
|
|
|
+ config
|
|
|
+ op Op
|
|
|
+ typ string
|
|
|
+ id *uint64
|
|
|
+ created_at *time.Time
|
|
|
+ updated_at *time.Time
|
|
|
+ status *uint8
|
|
|
+ addstatus *int8
|
|
|
+ deleted_at *time.Time
|
|
|
+ addtime *uint64
|
|
|
+ addaddtime *int64
|
|
|
+ _type *int
|
|
|
+ add_type *int
|
|
|
+ bot_id *string
|
|
|
+ organization_id *uint64
|
|
|
+ addorganization_id *int64
|
|
|
+ ai_response *uint64
|
|
|
+ addai_response *int64
|
|
|
+ sop_run *uint64
|
|
|
+ addsop_run *int64
|
|
|
+ total_friend *uint64
|
|
|
+ addtotal_friend *int64
|
|
|
+ total_group *uint64
|
|
|
+ addtotal_group *int64
|
|
|
+ account_balance *uint64
|
|
|
+ addaccount_balance *int64
|
|
|
+ consume_token *uint64
|
|
|
+ addconsume_token *int64
|
|
|
+ active_user *uint64
|
|
|
+ addactive_user *int64
|
|
|
+ new_user *int64
|
|
|
+ addnew_user *int64
|
|
|
+ label_dist *[]custom_types.LabelDist
|
|
|
+ appendlabel_dist []custom_types.LabelDist
|
|
|
+ clearedFields map[string]struct{}
|
|
|
+ done bool
|
|
|
+ oldValue func(context.Context) (*UsageStatisticHour, error)
|
|
|
+ predicates []predicate.UsageStatisticHour
|
|
|
+}
|
|
|
+
|
|
|
+var _ ent.Mutation = (*UsageStatisticHourMutation)(nil)
|
|
|
+
|
|
|
+// usagestatistichourOption allows management of the mutation configuration using functional options.
|
|
|
+type usagestatistichourOption func(*UsageStatisticHourMutation)
|
|
|
+
|
|
|
+// newUsageStatisticHourMutation creates new mutation for the UsageStatisticHour entity.
|
|
|
+func newUsageStatisticHourMutation(c config, op Op, opts ...usagestatistichourOption) *UsageStatisticHourMutation {
|
|
|
+ m := &UsageStatisticHourMutation{
|
|
|
+ config: c,
|
|
|
+ op: op,
|
|
|
+ typ: TypeUsageStatisticHour,
|
|
|
+ clearedFields: make(map[string]struct{}),
|
|
|
+ }
|
|
|
+ for _, opt := range opts {
|
|
|
+ opt(m)
|
|
|
+ }
|
|
|
+ return m
|
|
|
+}
|
|
|
+
|
|
|
+// withUsageStatisticHourID sets the ID field of the mutation.
|
|
|
+func withUsageStatisticHourID(id uint64) usagestatistichourOption {
|
|
|
+ return func(m *UsageStatisticHourMutation) {
|
|
|
+ var (
|
|
|
+ err error
|
|
|
+ once sync.Once
|
|
|
+ value *UsageStatisticHour
|
|
|
+ )
|
|
|
+ m.oldValue = func(ctx context.Context) (*UsageStatisticHour, error) {
|
|
|
+ once.Do(func() {
|
|
|
+ if m.done {
|
|
|
+ err = errors.New("querying old values post mutation is not allowed")
|
|
|
+ } else {
|
|
|
+ value, err = m.Client().UsageStatisticHour.Get(ctx, id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return value, err
|
|
|
+ }
|
|
|
+ m.id = &id
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// withUsageStatisticHour sets the old UsageStatisticHour of the mutation.
|
|
|
+func withUsageStatisticHour(node *UsageStatisticHour) usagestatistichourOption {
|
|
|
+ return func(m *UsageStatisticHourMutation) {
|
|
|
+ m.oldValue = func(context.Context) (*UsageStatisticHour, 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 UsageStatisticHourMutation) 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 UsageStatisticHourMutation) 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 UsageStatisticHour entities.
|
|
|
+func (m *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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().UsageStatisticHour.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 *UsageStatisticHourMutation) SetCreatedAt(t time.Time) {
|
|
|
+ m.created_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) ResetCreatedAt() {
|
|
|
+ m.created_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetUpdatedAt sets the "updated_at" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetUpdatedAt(t time.Time) {
|
|
|
+ m.updated_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) ResetUpdatedAt() {
|
|
|
+ m.updated_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetStatus sets the "status" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetStatus(u uint8) {
|
|
|
+ m.status = &u
|
|
|
+ m.addstatus = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns the value of the "status" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) ClearStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ m.clearedFields[usagestatistichour.FieldStatus] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCleared returns if the "status" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) StatusCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatistichour.FieldStatus]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetStatus resets all changes to the "status" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ delete(m.clearedFields, usagestatistichour.FieldStatus)
|
|
|
+}
|
|
|
+
|
|
|
+// SetDeletedAt sets the "deleted_at" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetDeletedAt(t time.Time) {
|
|
|
+ m.deleted_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) ClearDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ m.clearedFields[usagestatistichour.FieldDeletedAt] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) DeletedAtCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatistichour.FieldDeletedAt]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetDeletedAt resets all changes to the "deleted_at" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ delete(m.clearedFields, usagestatistichour.FieldDeletedAt)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAddtime sets the "addtime" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetAddtime(u uint64) {
|
|
|
+ m.addtime = &u
|
|
|
+ m.addaddtime = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Addtime returns the value of the "addtime" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) Addtime() (r uint64, exists bool) {
|
|
|
+ v := m.addtime
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAddtime returns the old "addtime" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldAddtime(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAddtime is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAddtime requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAddtime: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Addtime, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAddtime adds u to the "addtime" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddAddtime(u int64) {
|
|
|
+ if m.addaddtime != nil {
|
|
|
+ *m.addaddtime += u
|
|
|
+ } else {
|
|
|
+ m.addaddtime = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAddtime returns the value that was added to the "addtime" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedAddtime() (r int64, exists bool) {
|
|
|
+ v := m.addaddtime
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAddtime resets all changes to the "addtime" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetAddtime() {
|
|
|
+ m.addtime = nil
|
|
|
+ m.addaddtime = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetType sets the "type" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetType(i int) {
|
|
|
+ m._type = &i
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetType returns the value of the "type" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) GetType() (r int, exists bool) {
|
|
|
+ v := m._type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldType returns the old "type" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldType(ctx context.Context) (v int, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldType is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldType requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldType: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Type, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddType adds i to the "type" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddType(i int) {
|
|
|
+ if m.add_type != nil {
|
|
|
+ *m.add_type += i
|
|
|
+ } else {
|
|
|
+ m.add_type = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedType returns the value that was added to the "type" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedType() (r int, exists bool) {
|
|
|
+ v := m.add_type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetType resets all changes to the "type" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetType() {
|
|
|
+ m._type = nil
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetBotID sets the "bot_id" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetBotID(s string) {
|
|
|
+ m.bot_id = &s
|
|
|
+}
|
|
|
+
|
|
|
+// BotID returns the value of the "bot_id" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) BotID() (r string, exists bool) {
|
|
|
+ v := m.bot_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldBotID returns the old "bot_id" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldBotID(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldBotID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldBotID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldBotID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.BotID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearBotID clears the value of the "bot_id" field.
|
|
|
+func (m *UsageStatisticHourMutation) ClearBotID() {
|
|
|
+ m.bot_id = nil
|
|
|
+ m.clearedFields[usagestatistichour.FieldBotID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// BotIDCleared returns if the "bot_id" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) BotIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatistichour.FieldBotID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetBotID resets all changes to the "bot_id" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetBotID() {
|
|
|
+ m.bot_id = nil
|
|
|
+ delete(m.clearedFields, usagestatistichour.FieldBotID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetOrganizationID sets the "organization_id" field.
|
|
|
+func (m *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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 UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) ClearOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ m.clearedFields[usagestatistichour.FieldOrganizationID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) OrganizationIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatistichour.FieldOrganizationID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetOrganizationID resets all changes to the "organization_id" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ delete(m.clearedFields, usagestatistichour.FieldOrganizationID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAiResponse sets the "ai_response" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetAiResponse(u uint64) {
|
|
|
+ m.ai_response = &u
|
|
|
+ m.addai_response = nil
|
|
|
+}
|
|
|
+
|
|
|
+// AiResponse returns the value of the "ai_response" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AiResponse() (r uint64, exists bool) {
|
|
|
+ v := m.ai_response
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAiResponse returns the old "ai_response" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldAiResponse(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAiResponse is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAiResponse requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAiResponse: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AiResponse, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAiResponse adds u to the "ai_response" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddAiResponse(u int64) {
|
|
|
+ if m.addai_response != nil {
|
|
|
+ *m.addai_response += u
|
|
|
+ } else {
|
|
|
+ m.addai_response = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAiResponse returns the value that was added to the "ai_response" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedAiResponse() (r int64, exists bool) {
|
|
|
+ v := m.addai_response
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAiResponse resets all changes to the "ai_response" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetAiResponse() {
|
|
|
+ m.ai_response = nil
|
|
|
+ m.addai_response = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetSopRun sets the "sop_run" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetSopRun(u uint64) {
|
|
|
+ m.sop_run = &u
|
|
|
+ m.addsop_run = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SopRun returns the value of the "sop_run" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) SopRun() (r uint64, exists bool) {
|
|
|
+ v := m.sop_run
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldSopRun returns the old "sop_run" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldSopRun(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldSopRun is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldSopRun requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldSopRun: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.SopRun, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddSopRun adds u to the "sop_run" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddSopRun(u int64) {
|
|
|
+ if m.addsop_run != nil {
|
|
|
+ *m.addsop_run += u
|
|
|
+ } else {
|
|
|
+ m.addsop_run = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedSopRun returns the value that was added to the "sop_run" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedSopRun() (r int64, exists bool) {
|
|
|
+ v := m.addsop_run
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetSopRun resets all changes to the "sop_run" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetSopRun() {
|
|
|
+ m.sop_run = nil
|
|
|
+ m.addsop_run = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetTotalFriend sets the "total_friend" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetTotalFriend(u uint64) {
|
|
|
+ m.total_friend = &u
|
|
|
+ m.addtotal_friend = nil
|
|
|
+}
|
|
|
+
|
|
|
+// TotalFriend returns the value of the "total_friend" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) TotalFriend() (r uint64, exists bool) {
|
|
|
+ v := m.total_friend
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldTotalFriend returns the old "total_friend" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldTotalFriend(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldTotalFriend is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldTotalFriend requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldTotalFriend: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.TotalFriend, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddTotalFriend adds u to the "total_friend" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddTotalFriend(u int64) {
|
|
|
+ if m.addtotal_friend != nil {
|
|
|
+ *m.addtotal_friend += u
|
|
|
+ } else {
|
|
|
+ m.addtotal_friend = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedTotalFriend returns the value that was added to the "total_friend" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedTotalFriend() (r int64, exists bool) {
|
|
|
+ v := m.addtotal_friend
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetTotalFriend resets all changes to the "total_friend" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetTotalFriend() {
|
|
|
+ m.total_friend = nil
|
|
|
+ m.addtotal_friend = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetTotalGroup sets the "total_group" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetTotalGroup(u uint64) {
|
|
|
+ m.total_group = &u
|
|
|
+ m.addtotal_group = nil
|
|
|
+}
|
|
|
+
|
|
|
+// TotalGroup returns the value of the "total_group" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) TotalGroup() (r uint64, exists bool) {
|
|
|
+ v := m.total_group
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldTotalGroup returns the old "total_group" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldTotalGroup(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldTotalGroup is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldTotalGroup requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldTotalGroup: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.TotalGroup, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddTotalGroup adds u to the "total_group" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddTotalGroup(u int64) {
|
|
|
+ if m.addtotal_group != nil {
|
|
|
+ *m.addtotal_group += u
|
|
|
+ } else {
|
|
|
+ m.addtotal_group = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedTotalGroup returns the value that was added to the "total_group" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedTotalGroup() (r int64, exists bool) {
|
|
|
+ v := m.addtotal_group
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetTotalGroup resets all changes to the "total_group" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetTotalGroup() {
|
|
|
+ m.total_group = nil
|
|
|
+ m.addtotal_group = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetAccountBalance sets the "account_balance" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetAccountBalance(u uint64) {
|
|
|
+ m.account_balance = &u
|
|
|
+ m.addaccount_balance = nil
|
|
|
+}
|
|
|
+
|
|
|
+// AccountBalance returns the value of the "account_balance" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AccountBalance() (r uint64, exists bool) {
|
|
|
+ v := m.account_balance
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAccountBalance returns the old "account_balance" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldAccountBalance(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAccountBalance is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAccountBalance requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAccountBalance: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AccountBalance, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAccountBalance adds u to the "account_balance" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddAccountBalance(u int64) {
|
|
|
+ if m.addaccount_balance != nil {
|
|
|
+ *m.addaccount_balance += u
|
|
|
+ } else {
|
|
|
+ m.addaccount_balance = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAccountBalance returns the value that was added to the "account_balance" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedAccountBalance() (r int64, exists bool) {
|
|
|
+ v := m.addaccount_balance
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAccountBalance resets all changes to the "account_balance" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetAccountBalance() {
|
|
|
+ m.account_balance = nil
|
|
|
+ m.addaccount_balance = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetConsumeToken sets the "consume_token" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetConsumeToken(u uint64) {
|
|
|
+ m.consume_token = &u
|
|
|
+ m.addconsume_token = nil
|
|
|
+}
|
|
|
+
|
|
|
+// ConsumeToken returns the value of the "consume_token" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) ConsumeToken() (r uint64, exists bool) {
|
|
|
+ v := m.consume_token
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldConsumeToken returns the old "consume_token" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldConsumeToken(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldConsumeToken is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldConsumeToken requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldConsumeToken: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ConsumeToken, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddConsumeToken adds u to the "consume_token" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddConsumeToken(u int64) {
|
|
|
+ if m.addconsume_token != nil {
|
|
|
+ *m.addconsume_token += u
|
|
|
+ } else {
|
|
|
+ m.addconsume_token = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedConsumeToken returns the value that was added to the "consume_token" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedConsumeToken() (r int64, exists bool) {
|
|
|
+ v := m.addconsume_token
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetConsumeToken resets all changes to the "consume_token" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetConsumeToken() {
|
|
|
+ m.consume_token = nil
|
|
|
+ m.addconsume_token = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetActiveUser sets the "active_user" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetActiveUser(u uint64) {
|
|
|
+ m.active_user = &u
|
|
|
+ m.addactive_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// ActiveUser returns the value of the "active_user" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) ActiveUser() (r uint64, exists bool) {
|
|
|
+ v := m.active_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldActiveUser returns the old "active_user" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldActiveUser(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldActiveUser is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldActiveUser requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldActiveUser: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ActiveUser, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddActiveUser adds u to the "active_user" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddActiveUser(u int64) {
|
|
|
+ if m.addactive_user != nil {
|
|
|
+ *m.addactive_user += u
|
|
|
+ } else {
|
|
|
+ m.addactive_user = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedActiveUser returns the value that was added to the "active_user" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedActiveUser() (r int64, exists bool) {
|
|
|
+ v := m.addactive_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetActiveUser resets all changes to the "active_user" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetActiveUser() {
|
|
|
+ m.active_user = nil
|
|
|
+ m.addactive_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetNewUser sets the "new_user" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetNewUser(i int64) {
|
|
|
+ m.new_user = &i
|
|
|
+ m.addnew_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewUser returns the value of the "new_user" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) NewUser() (r int64, exists bool) {
|
|
|
+ v := m.new_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldNewUser returns the old "new_user" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldNewUser(ctx context.Context) (v int64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldNewUser is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldNewUser requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldNewUser: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.NewUser, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddNewUser adds i to the "new_user" field.
|
|
|
+func (m *UsageStatisticHourMutation) AddNewUser(i int64) {
|
|
|
+ if m.addnew_user != nil {
|
|
|
+ *m.addnew_user += i
|
|
|
+ } else {
|
|
|
+ m.addnew_user = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedNewUser returns the value that was added to the "new_user" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedNewUser() (r int64, exists bool) {
|
|
|
+ v := m.addnew_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetNewUser resets all changes to the "new_user" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetNewUser() {
|
|
|
+ m.new_user = nil
|
|
|
+ m.addnew_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetLabelDist sets the "label_dist" field.
|
|
|
+func (m *UsageStatisticHourMutation) SetLabelDist(ctd []custom_types.LabelDist) {
|
|
|
+ m.label_dist = &ctd
|
|
|
+ m.appendlabel_dist = nil
|
|
|
+}
|
|
|
+
|
|
|
+// LabelDist returns the value of the "label_dist" field in the mutation.
|
|
|
+func (m *UsageStatisticHourMutation) LabelDist() (r []custom_types.LabelDist, exists bool) {
|
|
|
+ v := m.label_dist
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldLabelDist returns the old "label_dist" field's value of the UsageStatisticHour entity.
|
|
|
+// If the UsageStatisticHour 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 *UsageStatisticHourMutation) OldLabelDist(ctx context.Context) (v []custom_types.LabelDist, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldLabelDist is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldLabelDist requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldLabelDist: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.LabelDist, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AppendLabelDist adds ctd to the "label_dist" field.
|
|
|
+func (m *UsageStatisticHourMutation) AppendLabelDist(ctd []custom_types.LabelDist) {
|
|
|
+ m.appendlabel_dist = append(m.appendlabel_dist, ctd...)
|
|
|
+}
|
|
|
+
|
|
|
+// AppendedLabelDist returns the list of values that were appended to the "label_dist" field in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AppendedLabelDist() ([]custom_types.LabelDist, bool) {
|
|
|
+ if len(m.appendlabel_dist) == 0 {
|
|
|
+ return nil, false
|
|
|
+ }
|
|
|
+ return m.appendlabel_dist, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetLabelDist resets all changes to the "label_dist" field.
|
|
|
+func (m *UsageStatisticHourMutation) ResetLabelDist() {
|
|
|
+ m.label_dist = nil
|
|
|
+ m.appendlabel_dist = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Where appends a list predicates to the UsageStatisticHourMutation builder.
|
|
|
+func (m *UsageStatisticHourMutation) Where(ps ...predicate.UsageStatisticHour) {
|
|
|
+ m.predicates = append(m.predicates, ps...)
|
|
|
+}
|
|
|
+
|
|
|
+// WhereP appends storage-level predicates to the UsageStatisticHourMutation builder. Using this method,
|
|
|
+// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
|
+func (m *UsageStatisticHourMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
|
+ p := make([]predicate.UsageStatisticHour, len(ps))
|
|
|
+ for i := range ps {
|
|
|
+ p[i] = ps[i]
|
|
|
+ }
|
|
|
+ m.Where(p...)
|
|
|
+}
|
|
|
+
|
|
|
+// Op returns the operation name.
|
|
|
+func (m *UsageStatisticHourMutation) Op() Op {
|
|
|
+ return m.op
|
|
|
+}
|
|
|
+
|
|
|
+// SetOp allows setting the mutation operation.
|
|
|
+func (m *UsageStatisticHourMutation) SetOp(op Op) {
|
|
|
+ m.op = op
|
|
|
+}
|
|
|
+
|
|
|
+// Type returns the node type of this mutation (UsageStatisticHour).
|
|
|
+func (m *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) Fields() []string {
|
|
|
+ fields := make([]string, 0, 17)
|
|
|
+ if m.created_at != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldCreatedAt)
|
|
|
+ }
|
|
|
+ if m.updated_at != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldUpdatedAt)
|
|
|
+ }
|
|
|
+ if m.status != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.deleted_at != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.addtime != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldAddtime)
|
|
|
+ }
|
|
|
+ if m._type != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldType)
|
|
|
+ }
|
|
|
+ if m.bot_id != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldBotID)
|
|
|
+ }
|
|
|
+ if m.organization_id != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.ai_response != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldAiResponse)
|
|
|
+ }
|
|
|
+ if m.sop_run != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldSopRun)
|
|
|
+ }
|
|
|
+ if m.total_friend != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldTotalFriend)
|
|
|
+ }
|
|
|
+ if m.total_group != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldTotalGroup)
|
|
|
+ }
|
|
|
+ if m.account_balance != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldAccountBalance)
|
|
|
+ }
|
|
|
+ if m.consume_token != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldConsumeToken)
|
|
|
+ }
|
|
|
+ if m.active_user != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldActiveUser)
|
|
|
+ }
|
|
|
+ if m.new_user != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldNewUser)
|
|
|
+ }
|
|
|
+ if m.label_dist != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldLabelDist)
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticHourMutation) Field(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case usagestatistichour.FieldCreatedAt:
|
|
|
+ return m.CreatedAt()
|
|
|
+ case usagestatistichour.FieldUpdatedAt:
|
|
|
+ return m.UpdatedAt()
|
|
|
+ case usagestatistichour.FieldStatus:
|
|
|
+ return m.Status()
|
|
|
+ case usagestatistichour.FieldDeletedAt:
|
|
|
+ return m.DeletedAt()
|
|
|
+ case usagestatistichour.FieldAddtime:
|
|
|
+ return m.Addtime()
|
|
|
+ case usagestatistichour.FieldType:
|
|
|
+ return m.GetType()
|
|
|
+ case usagestatistichour.FieldBotID:
|
|
|
+ return m.BotID()
|
|
|
+ case usagestatistichour.FieldOrganizationID:
|
|
|
+ return m.OrganizationID()
|
|
|
+ case usagestatistichour.FieldAiResponse:
|
|
|
+ return m.AiResponse()
|
|
|
+ case usagestatistichour.FieldSopRun:
|
|
|
+ return m.SopRun()
|
|
|
+ case usagestatistichour.FieldTotalFriend:
|
|
|
+ return m.TotalFriend()
|
|
|
+ case usagestatistichour.FieldTotalGroup:
|
|
|
+ return m.TotalGroup()
|
|
|
+ case usagestatistichour.FieldAccountBalance:
|
|
|
+ return m.AccountBalance()
|
|
|
+ case usagestatistichour.FieldConsumeToken:
|
|
|
+ return m.ConsumeToken()
|
|
|
+ case usagestatistichour.FieldActiveUser:
|
|
|
+ return m.ActiveUser()
|
|
|
+ case usagestatistichour.FieldNewUser:
|
|
|
+ return m.NewUser()
|
|
|
+ case usagestatistichour.FieldLabelDist:
|
|
|
+ return m.LabelDist()
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticHourMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
|
+ switch name {
|
|
|
+ case usagestatistichour.FieldCreatedAt:
|
|
|
+ return m.OldCreatedAt(ctx)
|
|
|
+ case usagestatistichour.FieldUpdatedAt:
|
|
|
+ return m.OldUpdatedAt(ctx)
|
|
|
+ case usagestatistichour.FieldStatus:
|
|
|
+ return m.OldStatus(ctx)
|
|
|
+ case usagestatistichour.FieldDeletedAt:
|
|
|
+ return m.OldDeletedAt(ctx)
|
|
|
+ case usagestatistichour.FieldAddtime:
|
|
|
+ return m.OldAddtime(ctx)
|
|
|
+ case usagestatistichour.FieldType:
|
|
|
+ return m.OldType(ctx)
|
|
|
+ case usagestatistichour.FieldBotID:
|
|
|
+ return m.OldBotID(ctx)
|
|
|
+ case usagestatistichour.FieldOrganizationID:
|
|
|
+ return m.OldOrganizationID(ctx)
|
|
|
+ case usagestatistichour.FieldAiResponse:
|
|
|
+ return m.OldAiResponse(ctx)
|
|
|
+ case usagestatistichour.FieldSopRun:
|
|
|
+ return m.OldSopRun(ctx)
|
|
|
+ case usagestatistichour.FieldTotalFriend:
|
|
|
+ return m.OldTotalFriend(ctx)
|
|
|
+ case usagestatistichour.FieldTotalGroup:
|
|
|
+ return m.OldTotalGroup(ctx)
|
|
|
+ case usagestatistichour.FieldAccountBalance:
|
|
|
+ return m.OldAccountBalance(ctx)
|
|
|
+ case usagestatistichour.FieldConsumeToken:
|
|
|
+ return m.OldConsumeToken(ctx)
|
|
|
+ case usagestatistichour.FieldActiveUser:
|
|
|
+ return m.OldActiveUser(ctx)
|
|
|
+ case usagestatistichour.FieldNewUser:
|
|
|
+ return m.OldNewUser(ctx)
|
|
|
+ case usagestatistichour.FieldLabelDist:
|
|
|
+ return m.OldLabelDist(ctx)
|
|
|
+ }
|
|
|
+ return nil, fmt.Errorf("unknown UsageStatisticHour 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 *UsageStatisticHourMutation) SetField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatistichour.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 usagestatistichour.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 usagestatistichour.FieldStatus:
|
|
|
+ v, ok := value.(uint8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetStatus(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.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 usagestatistichour.FieldAddtime:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAddtime(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetType(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldBotID:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetBotID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldOrganizationID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAiResponse:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAiResponse(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldSopRun:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetSopRun(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldTotalFriend:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetTotalFriend(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldTotalGroup:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetTotalGroup(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAccountBalance:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAccountBalance(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldConsumeToken:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetConsumeToken(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldActiveUser:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetActiveUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldNewUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetNewUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldLabelDist:
|
|
|
+ v, ok := value.([]custom_types.LabelDist)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetLabelDist(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticHour field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedFields returns all numeric fields that were incremented/decremented during
|
|
|
+// this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) AddedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.addstatus != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.addaddtime != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldAddtime)
|
|
|
+ }
|
|
|
+ if m.add_type != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldType)
|
|
|
+ }
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.addai_response != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldAiResponse)
|
|
|
+ }
|
|
|
+ if m.addsop_run != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldSopRun)
|
|
|
+ }
|
|
|
+ if m.addtotal_friend != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldTotalFriend)
|
|
|
+ }
|
|
|
+ if m.addtotal_group != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldTotalGroup)
|
|
|
+ }
|
|
|
+ if m.addaccount_balance != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldAccountBalance)
|
|
|
+ }
|
|
|
+ if m.addconsume_token != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldConsumeToken)
|
|
|
+ }
|
|
|
+ if m.addactive_user != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldActiveUser)
|
|
|
+ }
|
|
|
+ if m.addnew_user != nil {
|
|
|
+ fields = append(fields, usagestatistichour.FieldNewUser)
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticHourMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case usagestatistichour.FieldStatus:
|
|
|
+ return m.AddedStatus()
|
|
|
+ case usagestatistichour.FieldAddtime:
|
|
|
+ return m.AddedAddtime()
|
|
|
+ case usagestatistichour.FieldType:
|
|
|
+ return m.AddedType()
|
|
|
+ case usagestatistichour.FieldOrganizationID:
|
|
|
+ return m.AddedOrganizationID()
|
|
|
+ case usagestatistichour.FieldAiResponse:
|
|
|
+ return m.AddedAiResponse()
|
|
|
+ case usagestatistichour.FieldSopRun:
|
|
|
+ return m.AddedSopRun()
|
|
|
+ case usagestatistichour.FieldTotalFriend:
|
|
|
+ return m.AddedTotalFriend()
|
|
|
+ case usagestatistichour.FieldTotalGroup:
|
|
|
+ return m.AddedTotalGroup()
|
|
|
+ case usagestatistichour.FieldAccountBalance:
|
|
|
+ return m.AddedAccountBalance()
|
|
|
+ case usagestatistichour.FieldConsumeToken:
|
|
|
+ return m.AddedConsumeToken()
|
|
|
+ case usagestatistichour.FieldActiveUser:
|
|
|
+ return m.AddedActiveUser()
|
|
|
+ case usagestatistichour.FieldNewUser:
|
|
|
+ return m.AddedNewUser()
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticHourMutation) AddField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatistichour.FieldStatus:
|
|
|
+ v, ok := value.(int8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddStatus(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAddtime:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAddtime(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddType(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldOrganizationID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAiResponse:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAiResponse(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldSopRun:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddSopRun(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldTotalFriend:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddTotalFriend(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldTotalGroup:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddTotalGroup(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAccountBalance:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAccountBalance(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldConsumeToken:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddConsumeToken(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldActiveUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddActiveUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldNewUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddNewUser(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticHour numeric field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedFields returns all nullable fields that were cleared during this
|
|
|
+// mutation.
|
|
|
+func (m *UsageStatisticHourMutation) ClearedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.FieldCleared(usagestatistichour.FieldStatus) {
|
|
|
+ fields = append(fields, usagestatistichour.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatistichour.FieldDeletedAt) {
|
|
|
+ fields = append(fields, usagestatistichour.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatistichour.FieldBotID) {
|
|
|
+ fields = append(fields, usagestatistichour.FieldBotID)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatistichour.FieldOrganizationID) {
|
|
|
+ fields = append(fields, usagestatistichour.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+// FieldCleared returns a boolean indicating if a field with the given name was
|
|
|
+// cleared in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) ClearField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatistichour.FieldStatus:
|
|
|
+ m.ClearStatus()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldDeletedAt:
|
|
|
+ m.ClearDeletedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldBotID:
|
|
|
+ m.ClearBotID()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldOrganizationID:
|
|
|
+ m.ClearOrganizationID()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticHour 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 *UsageStatisticHourMutation) ResetField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatistichour.FieldCreatedAt:
|
|
|
+ m.ResetCreatedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldUpdatedAt:
|
|
|
+ m.ResetUpdatedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldStatus:
|
|
|
+ m.ResetStatus()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldDeletedAt:
|
|
|
+ m.ResetDeletedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAddtime:
|
|
|
+ m.ResetAddtime()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldType:
|
|
|
+ m.ResetType()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldBotID:
|
|
|
+ m.ResetBotID()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldOrganizationID:
|
|
|
+ m.ResetOrganizationID()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAiResponse:
|
|
|
+ m.ResetAiResponse()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldSopRun:
|
|
|
+ m.ResetSopRun()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldTotalFriend:
|
|
|
+ m.ResetTotalFriend()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldTotalGroup:
|
|
|
+ m.ResetTotalGroup()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldAccountBalance:
|
|
|
+ m.ResetAccountBalance()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldConsumeToken:
|
|
|
+ m.ResetConsumeToken()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldActiveUser:
|
|
|
+ m.ResetActiveUser()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldNewUser:
|
|
|
+ m.ResetNewUser()
|
|
|
+ return nil
|
|
|
+ case usagestatistichour.FieldLabelDist:
|
|
|
+ m.ResetLabelDist()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticHour field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) RemovedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
+func (m *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) 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 *UsageStatisticHourMutation) ClearEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown UsageStatisticHour 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 *UsageStatisticHourMutation) ResetEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown UsageStatisticHour edge %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// UsageStatisticMonthMutation represents an operation that mutates the UsageStatisticMonth nodes in the graph.
|
|
|
+type UsageStatisticMonthMutation struct {
|
|
|
+ config
|
|
|
+ op Op
|
|
|
+ typ string
|
|
|
+ id *uint64
|
|
|
+ created_at *time.Time
|
|
|
+ updated_at *time.Time
|
|
|
+ status *uint8
|
|
|
+ addstatus *int8
|
|
|
+ deleted_at *time.Time
|
|
|
+ addtime *uint64
|
|
|
+ addaddtime *int64
|
|
|
+ _type *int
|
|
|
+ add_type *int
|
|
|
+ bot_id *string
|
|
|
+ organization_id *uint64
|
|
|
+ addorganization_id *int64
|
|
|
+ ai_response *uint64
|
|
|
+ addai_response *int64
|
|
|
+ sop_run *uint64
|
|
|
+ addsop_run *int64
|
|
|
+ total_friend *uint64
|
|
|
+ addtotal_friend *int64
|
|
|
+ total_group *uint64
|
|
|
+ addtotal_group *int64
|
|
|
+ account_balance *uint64
|
|
|
+ addaccount_balance *int64
|
|
|
+ consume_token *uint64
|
|
|
+ addconsume_token *int64
|
|
|
+ active_user *uint64
|
|
|
+ addactive_user *int64
|
|
|
+ new_user *int64
|
|
|
+ addnew_user *int64
|
|
|
+ label_dist *[]custom_types.LabelDist
|
|
|
+ appendlabel_dist []custom_types.LabelDist
|
|
|
+ clearedFields map[string]struct{}
|
|
|
+ done bool
|
|
|
+ oldValue func(context.Context) (*UsageStatisticMonth, error)
|
|
|
+ predicates []predicate.UsageStatisticMonth
|
|
|
+}
|
|
|
+
|
|
|
+var _ ent.Mutation = (*UsageStatisticMonthMutation)(nil)
|
|
|
+
|
|
|
+// usagestatisticmonthOption allows management of the mutation configuration using functional options.
|
|
|
+type usagestatisticmonthOption func(*UsageStatisticMonthMutation)
|
|
|
+
|
|
|
+// newUsageStatisticMonthMutation creates new mutation for the UsageStatisticMonth entity.
|
|
|
+func newUsageStatisticMonthMutation(c config, op Op, opts ...usagestatisticmonthOption) *UsageStatisticMonthMutation {
|
|
|
+ m := &UsageStatisticMonthMutation{
|
|
|
+ config: c,
|
|
|
+ op: op,
|
|
|
+ typ: TypeUsageStatisticMonth,
|
|
|
+ clearedFields: make(map[string]struct{}),
|
|
|
+ }
|
|
|
+ for _, opt := range opts {
|
|
|
+ opt(m)
|
|
|
+ }
|
|
|
+ return m
|
|
|
+}
|
|
|
+
|
|
|
+// withUsageStatisticMonthID sets the ID field of the mutation.
|
|
|
+func withUsageStatisticMonthID(id uint64) usagestatisticmonthOption {
|
|
|
+ return func(m *UsageStatisticMonthMutation) {
|
|
|
+ var (
|
|
|
+ err error
|
|
|
+ once sync.Once
|
|
|
+ value *UsageStatisticMonth
|
|
|
+ )
|
|
|
+ m.oldValue = func(ctx context.Context) (*UsageStatisticMonth, error) {
|
|
|
+ once.Do(func() {
|
|
|
+ if m.done {
|
|
|
+ err = errors.New("querying old values post mutation is not allowed")
|
|
|
+ } else {
|
|
|
+ value, err = m.Client().UsageStatisticMonth.Get(ctx, id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return value, err
|
|
|
+ }
|
|
|
+ m.id = &id
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// withUsageStatisticMonth sets the old UsageStatisticMonth of the mutation.
|
|
|
+func withUsageStatisticMonth(node *UsageStatisticMonth) usagestatisticmonthOption {
|
|
|
+ return func(m *UsageStatisticMonthMutation) {
|
|
|
+ m.oldValue = func(context.Context) (*UsageStatisticMonth, 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 UsageStatisticMonthMutation) 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 UsageStatisticMonthMutation) 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 UsageStatisticMonth entities.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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().UsageStatisticMonth.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 *UsageStatisticMonthMutation) SetCreatedAt(t time.Time) {
|
|
|
+ m.created_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// CreatedAt returns the value of the "created_at" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) ResetCreatedAt() {
|
|
|
+ m.created_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetUpdatedAt sets the "updated_at" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetUpdatedAt(t time.Time) {
|
|
|
+ m.updated_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) ResetUpdatedAt() {
|
|
|
+ m.updated_at = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetStatus sets the "status" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetStatus(u uint8) {
|
|
|
+ m.status = &u
|
|
|
+ m.addstatus = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Status returns the value of the "status" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) ClearStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ m.clearedFields[usagestatisticmonth.FieldStatus] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// StatusCleared returns if the "status" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) StatusCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticmonth.FieldStatus]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetStatus resets all changes to the "status" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetStatus() {
|
|
|
+ m.status = nil
|
|
|
+ m.addstatus = nil
|
|
|
+ delete(m.clearedFields, usagestatisticmonth.FieldStatus)
|
|
|
+}
|
|
|
+
|
|
|
+// SetDeletedAt sets the "deleted_at" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetDeletedAt(t time.Time) {
|
|
|
+ m.deleted_at = &t
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) ClearDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ m.clearedFields[usagestatisticmonth.FieldDeletedAt] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) DeletedAtCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticmonth.FieldDeletedAt]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetDeletedAt resets all changes to the "deleted_at" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetDeletedAt() {
|
|
|
+ m.deleted_at = nil
|
|
|
+ delete(m.clearedFields, usagestatisticmonth.FieldDeletedAt)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAddtime sets the "addtime" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetAddtime(u uint64) {
|
|
|
+ m.addtime = &u
|
|
|
+ m.addaddtime = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Addtime returns the value of the "addtime" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) Addtime() (r uint64, exists bool) {
|
|
|
+ v := m.addtime
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAddtime returns the old "addtime" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldAddtime(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAddtime is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAddtime requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAddtime: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Addtime, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAddtime adds u to the "addtime" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddAddtime(u int64) {
|
|
|
+ if m.addaddtime != nil {
|
|
|
+ *m.addaddtime += u
|
|
|
+ } else {
|
|
|
+ m.addaddtime = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAddtime returns the value that was added to the "addtime" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedAddtime() (r int64, exists bool) {
|
|
|
+ v := m.addaddtime
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAddtime resets all changes to the "addtime" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetAddtime() {
|
|
|
+ m.addtime = nil
|
|
|
+ m.addaddtime = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetType sets the "type" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetType(i int) {
|
|
|
+ m._type = &i
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetType returns the value of the "type" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) GetType() (r int, exists bool) {
|
|
|
+ v := m._type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldType returns the old "type" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldType(ctx context.Context) (v int, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldType is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldType requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldType: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.Type, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddType adds i to the "type" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddType(i int) {
|
|
|
+ if m.add_type != nil {
|
|
|
+ *m.add_type += i
|
|
|
+ } else {
|
|
|
+ m.add_type = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedType returns the value that was added to the "type" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedType() (r int, exists bool) {
|
|
|
+ v := m.add_type
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetType resets all changes to the "type" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetType() {
|
|
|
+ m._type = nil
|
|
|
+ m.add_type = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetBotID sets the "bot_id" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetBotID(s string) {
|
|
|
+ m.bot_id = &s
|
|
|
+}
|
|
|
+
|
|
|
+// BotID returns the value of the "bot_id" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) BotID() (r string, exists bool) {
|
|
|
+ v := m.bot_id
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldBotID returns the old "bot_id" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldBotID(ctx context.Context) (v string, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldBotID is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldBotID requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldBotID: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.BotID, nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearBotID clears the value of the "bot_id" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ClearBotID() {
|
|
|
+ m.bot_id = nil
|
|
|
+ m.clearedFields[usagestatisticmonth.FieldBotID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// BotIDCleared returns if the "bot_id" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) BotIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticmonth.FieldBotID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetBotID resets all changes to the "bot_id" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetBotID() {
|
|
|
+ m.bot_id = nil
|
|
|
+ delete(m.clearedFields, usagestatisticmonth.FieldBotID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetOrganizationID sets the "organization_id" field.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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 UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) ClearOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ m.clearedFields[usagestatisticmonth.FieldOrganizationID] = struct{}{}
|
|
|
+}
|
|
|
+
|
|
|
+// OrganizationIDCleared returns if the "organization_id" field was cleared in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) OrganizationIDCleared() bool {
|
|
|
+ _, ok := m.clearedFields[usagestatisticmonth.FieldOrganizationID]
|
|
|
+ return ok
|
|
|
+}
|
|
|
+
|
|
|
+// ResetOrganizationID resets all changes to the "organization_id" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetOrganizationID() {
|
|
|
+ m.organization_id = nil
|
|
|
+ m.addorganization_id = nil
|
|
|
+ delete(m.clearedFields, usagestatisticmonth.FieldOrganizationID)
|
|
|
+}
|
|
|
+
|
|
|
+// SetAiResponse sets the "ai_response" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetAiResponse(u uint64) {
|
|
|
+ m.ai_response = &u
|
|
|
+ m.addai_response = nil
|
|
|
+}
|
|
|
+
|
|
|
+// AiResponse returns the value of the "ai_response" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AiResponse() (r uint64, exists bool) {
|
|
|
+ v := m.ai_response
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAiResponse returns the old "ai_response" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldAiResponse(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAiResponse is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAiResponse requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAiResponse: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AiResponse, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAiResponse adds u to the "ai_response" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddAiResponse(u int64) {
|
|
|
+ if m.addai_response != nil {
|
|
|
+ *m.addai_response += u
|
|
|
+ } else {
|
|
|
+ m.addai_response = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAiResponse returns the value that was added to the "ai_response" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedAiResponse() (r int64, exists bool) {
|
|
|
+ v := m.addai_response
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAiResponse resets all changes to the "ai_response" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetAiResponse() {
|
|
|
+ m.ai_response = nil
|
|
|
+ m.addai_response = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetSopRun sets the "sop_run" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetSopRun(u uint64) {
|
|
|
+ m.sop_run = &u
|
|
|
+ m.addsop_run = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SopRun returns the value of the "sop_run" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) SopRun() (r uint64, exists bool) {
|
|
|
+ v := m.sop_run
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldSopRun returns the old "sop_run" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldSopRun(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldSopRun is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldSopRun requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldSopRun: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.SopRun, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddSopRun adds u to the "sop_run" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddSopRun(u int64) {
|
|
|
+ if m.addsop_run != nil {
|
|
|
+ *m.addsop_run += u
|
|
|
+ } else {
|
|
|
+ m.addsop_run = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedSopRun returns the value that was added to the "sop_run" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedSopRun() (r int64, exists bool) {
|
|
|
+ v := m.addsop_run
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetSopRun resets all changes to the "sop_run" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetSopRun() {
|
|
|
+ m.sop_run = nil
|
|
|
+ m.addsop_run = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetTotalFriend sets the "total_friend" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetTotalFriend(u uint64) {
|
|
|
+ m.total_friend = &u
|
|
|
+ m.addtotal_friend = nil
|
|
|
+}
|
|
|
+
|
|
|
+// TotalFriend returns the value of the "total_friend" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) TotalFriend() (r uint64, exists bool) {
|
|
|
+ v := m.total_friend
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldTotalFriend returns the old "total_friend" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldTotalFriend(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldTotalFriend is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldTotalFriend requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldTotalFriend: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.TotalFriend, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddTotalFriend adds u to the "total_friend" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddTotalFriend(u int64) {
|
|
|
+ if m.addtotal_friend != nil {
|
|
|
+ *m.addtotal_friend += u
|
|
|
+ } else {
|
|
|
+ m.addtotal_friend = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedTotalFriend returns the value that was added to the "total_friend" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedTotalFriend() (r int64, exists bool) {
|
|
|
+ v := m.addtotal_friend
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetTotalFriend resets all changes to the "total_friend" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetTotalFriend() {
|
|
|
+ m.total_friend = nil
|
|
|
+ m.addtotal_friend = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetTotalGroup sets the "total_group" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetTotalGroup(u uint64) {
|
|
|
+ m.total_group = &u
|
|
|
+ m.addtotal_group = nil
|
|
|
+}
|
|
|
+
|
|
|
+// TotalGroup returns the value of the "total_group" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) TotalGroup() (r uint64, exists bool) {
|
|
|
+ v := m.total_group
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldTotalGroup returns the old "total_group" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldTotalGroup(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldTotalGroup is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldTotalGroup requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldTotalGroup: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.TotalGroup, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddTotalGroup adds u to the "total_group" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddTotalGroup(u int64) {
|
|
|
+ if m.addtotal_group != nil {
|
|
|
+ *m.addtotal_group += u
|
|
|
+ } else {
|
|
|
+ m.addtotal_group = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedTotalGroup returns the value that was added to the "total_group" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedTotalGroup() (r int64, exists bool) {
|
|
|
+ v := m.addtotal_group
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetTotalGroup resets all changes to the "total_group" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetTotalGroup() {
|
|
|
+ m.total_group = nil
|
|
|
+ m.addtotal_group = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetAccountBalance sets the "account_balance" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetAccountBalance(u uint64) {
|
|
|
+ m.account_balance = &u
|
|
|
+ m.addaccount_balance = nil
|
|
|
+}
|
|
|
+
|
|
|
+// AccountBalance returns the value of the "account_balance" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AccountBalance() (r uint64, exists bool) {
|
|
|
+ v := m.account_balance
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldAccountBalance returns the old "account_balance" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldAccountBalance(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldAccountBalance is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldAccountBalance requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldAccountBalance: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.AccountBalance, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddAccountBalance adds u to the "account_balance" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddAccountBalance(u int64) {
|
|
|
+ if m.addaccount_balance != nil {
|
|
|
+ *m.addaccount_balance += u
|
|
|
+ } else {
|
|
|
+ m.addaccount_balance = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedAccountBalance returns the value that was added to the "account_balance" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedAccountBalance() (r int64, exists bool) {
|
|
|
+ v := m.addaccount_balance
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetAccountBalance resets all changes to the "account_balance" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetAccountBalance() {
|
|
|
+ m.account_balance = nil
|
|
|
+ m.addaccount_balance = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetConsumeToken sets the "consume_token" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetConsumeToken(u uint64) {
|
|
|
+ m.consume_token = &u
|
|
|
+ m.addconsume_token = nil
|
|
|
+}
|
|
|
+
|
|
|
+// ConsumeToken returns the value of the "consume_token" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) ConsumeToken() (r uint64, exists bool) {
|
|
|
+ v := m.consume_token
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldConsumeToken returns the old "consume_token" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldConsumeToken(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldConsumeToken is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldConsumeToken requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldConsumeToken: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ConsumeToken, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddConsumeToken adds u to the "consume_token" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddConsumeToken(u int64) {
|
|
|
+ if m.addconsume_token != nil {
|
|
|
+ *m.addconsume_token += u
|
|
|
+ } else {
|
|
|
+ m.addconsume_token = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedConsumeToken returns the value that was added to the "consume_token" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedConsumeToken() (r int64, exists bool) {
|
|
|
+ v := m.addconsume_token
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetConsumeToken resets all changes to the "consume_token" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetConsumeToken() {
|
|
|
+ m.consume_token = nil
|
|
|
+ m.addconsume_token = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetActiveUser sets the "active_user" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetActiveUser(u uint64) {
|
|
|
+ m.active_user = &u
|
|
|
+ m.addactive_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// ActiveUser returns the value of the "active_user" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) ActiveUser() (r uint64, exists bool) {
|
|
|
+ v := m.active_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldActiveUser returns the old "active_user" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldActiveUser(ctx context.Context) (v uint64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldActiveUser is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldActiveUser requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldActiveUser: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.ActiveUser, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddActiveUser adds u to the "active_user" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddActiveUser(u int64) {
|
|
|
+ if m.addactive_user != nil {
|
|
|
+ *m.addactive_user += u
|
|
|
+ } else {
|
|
|
+ m.addactive_user = &u
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedActiveUser returns the value that was added to the "active_user" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedActiveUser() (r int64, exists bool) {
|
|
|
+ v := m.addactive_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetActiveUser resets all changes to the "active_user" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetActiveUser() {
|
|
|
+ m.active_user = nil
|
|
|
+ m.addactive_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetNewUser sets the "new_user" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetNewUser(i int64) {
|
|
|
+ m.new_user = &i
|
|
|
+ m.addnew_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// NewUser returns the value of the "new_user" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) NewUser() (r int64, exists bool) {
|
|
|
+ v := m.new_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldNewUser returns the old "new_user" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldNewUser(ctx context.Context) (v int64, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldNewUser is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldNewUser requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldNewUser: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.NewUser, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AddNewUser adds i to the "new_user" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AddNewUser(i int64) {
|
|
|
+ if m.addnew_user != nil {
|
|
|
+ *m.addnew_user += i
|
|
|
+ } else {
|
|
|
+ m.addnew_user = &i
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// AddedNewUser returns the value that was added to the "new_user" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedNewUser() (r int64, exists bool) {
|
|
|
+ v := m.addnew_user
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetNewUser resets all changes to the "new_user" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetNewUser() {
|
|
|
+ m.new_user = nil
|
|
|
+ m.addnew_user = nil
|
|
|
+}
|
|
|
+
|
|
|
+// SetLabelDist sets the "label_dist" field.
|
|
|
+func (m *UsageStatisticMonthMutation) SetLabelDist(ctd []custom_types.LabelDist) {
|
|
|
+ m.label_dist = &ctd
|
|
|
+ m.appendlabel_dist = nil
|
|
|
+}
|
|
|
+
|
|
|
+// LabelDist returns the value of the "label_dist" field in the mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) LabelDist() (r []custom_types.LabelDist, exists bool) {
|
|
|
+ v := m.label_dist
|
|
|
+ if v == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ return *v, true
|
|
|
+}
|
|
|
+
|
|
|
+// OldLabelDist returns the old "label_dist" field's value of the UsageStatisticMonth entity.
|
|
|
+// If the UsageStatisticMonth 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 *UsageStatisticMonthMutation) OldLabelDist(ctx context.Context) (v []custom_types.LabelDist, err error) {
|
|
|
+ if !m.op.Is(OpUpdateOne) {
|
|
|
+ return v, errors.New("OldLabelDist is only allowed on UpdateOne operations")
|
|
|
+ }
|
|
|
+ if m.id == nil || m.oldValue == nil {
|
|
|
+ return v, errors.New("OldLabelDist requires an ID field in the mutation")
|
|
|
+ }
|
|
|
+ oldValue, err := m.oldValue(ctx)
|
|
|
+ if err != nil {
|
|
|
+ return v, fmt.Errorf("querying old value for OldLabelDist: %w", err)
|
|
|
+ }
|
|
|
+ return oldValue.LabelDist, nil
|
|
|
+}
|
|
|
+
|
|
|
+// AppendLabelDist adds ctd to the "label_dist" field.
|
|
|
+func (m *UsageStatisticMonthMutation) AppendLabelDist(ctd []custom_types.LabelDist) {
|
|
|
+ m.appendlabel_dist = append(m.appendlabel_dist, ctd...)
|
|
|
+}
|
|
|
+
|
|
|
+// AppendedLabelDist returns the list of values that were appended to the "label_dist" field in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AppendedLabelDist() ([]custom_types.LabelDist, bool) {
|
|
|
+ if len(m.appendlabel_dist) == 0 {
|
|
|
+ return nil, false
|
|
|
+ }
|
|
|
+ return m.appendlabel_dist, true
|
|
|
+}
|
|
|
+
|
|
|
+// ResetLabelDist resets all changes to the "label_dist" field.
|
|
|
+func (m *UsageStatisticMonthMutation) ResetLabelDist() {
|
|
|
+ m.label_dist = nil
|
|
|
+ m.appendlabel_dist = nil
|
|
|
+}
|
|
|
+
|
|
|
+// Where appends a list predicates to the UsageStatisticMonthMutation builder.
|
|
|
+func (m *UsageStatisticMonthMutation) Where(ps ...predicate.UsageStatisticMonth) {
|
|
|
+ m.predicates = append(m.predicates, ps...)
|
|
|
+}
|
|
|
+
|
|
|
+// WhereP appends storage-level predicates to the UsageStatisticMonthMutation builder. Using this method,
|
|
|
+// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
|
+func (m *UsageStatisticMonthMutation) WhereP(ps ...func(*sql.Selector)) {
|
|
|
+ p := make([]predicate.UsageStatisticMonth, len(ps))
|
|
|
+ for i := range ps {
|
|
|
+ p[i] = ps[i]
|
|
|
+ }
|
|
|
+ m.Where(p...)
|
|
|
+}
|
|
|
+
|
|
|
+// Op returns the operation name.
|
|
|
+func (m *UsageStatisticMonthMutation) Op() Op {
|
|
|
+ return m.op
|
|
|
+}
|
|
|
+
|
|
|
+// SetOp allows setting the mutation operation.
|
|
|
+func (m *UsageStatisticMonthMutation) SetOp(op Op) {
|
|
|
+ m.op = op
|
|
|
+}
|
|
|
+
|
|
|
+// Type returns the node type of this mutation (UsageStatisticMonth).
|
|
|
+func (m *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) Fields() []string {
|
|
|
+ fields := make([]string, 0, 17)
|
|
|
+ if m.created_at != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldCreatedAt)
|
|
|
+ }
|
|
|
+ if m.updated_at != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldUpdatedAt)
|
|
|
+ }
|
|
|
+ if m.status != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.deleted_at != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.addtime != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldAddtime)
|
|
|
+ }
|
|
|
+ if m._type != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldType)
|
|
|
+ }
|
|
|
+ if m.bot_id != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldBotID)
|
|
|
+ }
|
|
|
+ if m.organization_id != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.ai_response != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldAiResponse)
|
|
|
+ }
|
|
|
+ if m.sop_run != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldSopRun)
|
|
|
+ }
|
|
|
+ if m.total_friend != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldTotalFriend)
|
|
|
+ }
|
|
|
+ if m.total_group != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldTotalGroup)
|
|
|
+ }
|
|
|
+ if m.account_balance != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldAccountBalance)
|
|
|
+ }
|
|
|
+ if m.consume_token != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldConsumeToken)
|
|
|
+ }
|
|
|
+ if m.active_user != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldActiveUser)
|
|
|
+ }
|
|
|
+ if m.new_user != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldNewUser)
|
|
|
+ }
|
|
|
+ if m.label_dist != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldLabelDist)
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticMonthMutation) Field(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticmonth.FieldCreatedAt:
|
|
|
+ return m.CreatedAt()
|
|
|
+ case usagestatisticmonth.FieldUpdatedAt:
|
|
|
+ return m.UpdatedAt()
|
|
|
+ case usagestatisticmonth.FieldStatus:
|
|
|
+ return m.Status()
|
|
|
+ case usagestatisticmonth.FieldDeletedAt:
|
|
|
+ return m.DeletedAt()
|
|
|
+ case usagestatisticmonth.FieldAddtime:
|
|
|
+ return m.Addtime()
|
|
|
+ case usagestatisticmonth.FieldType:
|
|
|
+ return m.GetType()
|
|
|
+ case usagestatisticmonth.FieldBotID:
|
|
|
+ return m.BotID()
|
|
|
+ case usagestatisticmonth.FieldOrganizationID:
|
|
|
+ return m.OrganizationID()
|
|
|
+ case usagestatisticmonth.FieldAiResponse:
|
|
|
+ return m.AiResponse()
|
|
|
+ case usagestatisticmonth.FieldSopRun:
|
|
|
+ return m.SopRun()
|
|
|
+ case usagestatisticmonth.FieldTotalFriend:
|
|
|
+ return m.TotalFriend()
|
|
|
+ case usagestatisticmonth.FieldTotalGroup:
|
|
|
+ return m.TotalGroup()
|
|
|
+ case usagestatisticmonth.FieldAccountBalance:
|
|
|
+ return m.AccountBalance()
|
|
|
+ case usagestatisticmonth.FieldConsumeToken:
|
|
|
+ return m.ConsumeToken()
|
|
|
+ case usagestatisticmonth.FieldActiveUser:
|
|
|
+ return m.ActiveUser()
|
|
|
+ case usagestatisticmonth.FieldNewUser:
|
|
|
+ return m.NewUser()
|
|
|
+ case usagestatisticmonth.FieldLabelDist:
|
|
|
+ return m.LabelDist()
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticMonthMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticmonth.FieldCreatedAt:
|
|
|
+ return m.OldCreatedAt(ctx)
|
|
|
+ case usagestatisticmonth.FieldUpdatedAt:
|
|
|
+ return m.OldUpdatedAt(ctx)
|
|
|
+ case usagestatisticmonth.FieldStatus:
|
|
|
+ return m.OldStatus(ctx)
|
|
|
+ case usagestatisticmonth.FieldDeletedAt:
|
|
|
+ return m.OldDeletedAt(ctx)
|
|
|
+ case usagestatisticmonth.FieldAddtime:
|
|
|
+ return m.OldAddtime(ctx)
|
|
|
+ case usagestatisticmonth.FieldType:
|
|
|
+ return m.OldType(ctx)
|
|
|
+ case usagestatisticmonth.FieldBotID:
|
|
|
+ return m.OldBotID(ctx)
|
|
|
+ case usagestatisticmonth.FieldOrganizationID:
|
|
|
+ return m.OldOrganizationID(ctx)
|
|
|
+ case usagestatisticmonth.FieldAiResponse:
|
|
|
+ return m.OldAiResponse(ctx)
|
|
|
+ case usagestatisticmonth.FieldSopRun:
|
|
|
+ return m.OldSopRun(ctx)
|
|
|
+ case usagestatisticmonth.FieldTotalFriend:
|
|
|
+ return m.OldTotalFriend(ctx)
|
|
|
+ case usagestatisticmonth.FieldTotalGroup:
|
|
|
+ return m.OldTotalGroup(ctx)
|
|
|
+ case usagestatisticmonth.FieldAccountBalance:
|
|
|
+ return m.OldAccountBalance(ctx)
|
|
|
+ case usagestatisticmonth.FieldConsumeToken:
|
|
|
+ return m.OldConsumeToken(ctx)
|
|
|
+ case usagestatisticmonth.FieldActiveUser:
|
|
|
+ return m.OldActiveUser(ctx)
|
|
|
+ case usagestatisticmonth.FieldNewUser:
|
|
|
+ return m.OldNewUser(ctx)
|
|
|
+ case usagestatisticmonth.FieldLabelDist:
|
|
|
+ return m.OldLabelDist(ctx)
|
|
|
+ }
|
|
|
+ return nil, fmt.Errorf("unknown UsageStatisticMonth 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 *UsageStatisticMonthMutation) SetField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticmonth.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 usagestatisticmonth.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 usagestatisticmonth.FieldStatus:
|
|
|
+ v, ok := value.(uint8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetStatus(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.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 usagestatisticmonth.FieldAddtime:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAddtime(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetType(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldBotID:
|
|
|
+ v, ok := value.(string)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetBotID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldOrganizationID:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAiResponse:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAiResponse(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldSopRun:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetSopRun(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldTotalFriend:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetTotalFriend(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldTotalGroup:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetTotalGroup(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAccountBalance:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetAccountBalance(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldConsumeToken:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetConsumeToken(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldActiveUser:
|
|
|
+ v, ok := value.(uint64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetActiveUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldNewUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetNewUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldLabelDist:
|
|
|
+ v, ok := value.([]custom_types.LabelDist)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.SetLabelDist(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticMonth field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedFields returns all numeric fields that were incremented/decremented during
|
|
|
+// this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) AddedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.addstatus != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.addaddtime != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldAddtime)
|
|
|
+ }
|
|
|
+ if m.add_type != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldType)
|
|
|
+ }
|
|
|
+ if m.addorganization_id != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ if m.addai_response != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldAiResponse)
|
|
|
+ }
|
|
|
+ if m.addsop_run != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldSopRun)
|
|
|
+ }
|
|
|
+ if m.addtotal_friend != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldTotalFriend)
|
|
|
+ }
|
|
|
+ if m.addtotal_group != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldTotalGroup)
|
|
|
+ }
|
|
|
+ if m.addaccount_balance != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldAccountBalance)
|
|
|
+ }
|
|
|
+ if m.addconsume_token != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldConsumeToken)
|
|
|
+ }
|
|
|
+ if m.addactive_user != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldActiveUser)
|
|
|
+ }
|
|
|
+ if m.addnew_user != nil {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldNewUser)
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticMonthMutation) AddedField(name string) (ent.Value, bool) {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticmonth.FieldStatus:
|
|
|
+ return m.AddedStatus()
|
|
|
+ case usagestatisticmonth.FieldAddtime:
|
|
|
+ return m.AddedAddtime()
|
|
|
+ case usagestatisticmonth.FieldType:
|
|
|
+ return m.AddedType()
|
|
|
+ case usagestatisticmonth.FieldOrganizationID:
|
|
|
+ return m.AddedOrganizationID()
|
|
|
+ case usagestatisticmonth.FieldAiResponse:
|
|
|
+ return m.AddedAiResponse()
|
|
|
+ case usagestatisticmonth.FieldSopRun:
|
|
|
+ return m.AddedSopRun()
|
|
|
+ case usagestatisticmonth.FieldTotalFriend:
|
|
|
+ return m.AddedTotalFriend()
|
|
|
+ case usagestatisticmonth.FieldTotalGroup:
|
|
|
+ return m.AddedTotalGroup()
|
|
|
+ case usagestatisticmonth.FieldAccountBalance:
|
|
|
+ return m.AddedAccountBalance()
|
|
|
+ case usagestatisticmonth.FieldConsumeToken:
|
|
|
+ return m.AddedConsumeToken()
|
|
|
+ case usagestatisticmonth.FieldActiveUser:
|
|
|
+ return m.AddedActiveUser()
|
|
|
+ case usagestatisticmonth.FieldNewUser:
|
|
|
+ return m.AddedNewUser()
|
|
|
+ }
|
|
|
+ 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 *UsageStatisticMonthMutation) AddField(name string, value ent.Value) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticmonth.FieldStatus:
|
|
|
+ v, ok := value.(int8)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddStatus(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAddtime:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAddtime(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldType:
|
|
|
+ v, ok := value.(int)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddType(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldOrganizationID:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddOrganizationID(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAiResponse:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAiResponse(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldSopRun:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddSopRun(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldTotalFriend:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddTotalFriend(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldTotalGroup:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddTotalGroup(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAccountBalance:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddAccountBalance(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldConsumeToken:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddConsumeToken(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldActiveUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddActiveUser(v)
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldNewUser:
|
|
|
+ v, ok := value.(int64)
|
|
|
+ if !ok {
|
|
|
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
|
+ }
|
|
|
+ m.AddNewUser(v)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticMonth numeric field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedFields returns all nullable fields that were cleared during this
|
|
|
+// mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) ClearedFields() []string {
|
|
|
+ var fields []string
|
|
|
+ if m.FieldCleared(usagestatisticmonth.FieldStatus) {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldStatus)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatisticmonth.FieldDeletedAt) {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldDeletedAt)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatisticmonth.FieldBotID) {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldBotID)
|
|
|
+ }
|
|
|
+ if m.FieldCleared(usagestatisticmonth.FieldOrganizationID) {
|
|
|
+ fields = append(fields, usagestatisticmonth.FieldOrganizationID)
|
|
|
+ }
|
|
|
+ return fields
|
|
|
+}
|
|
|
+
|
|
|
+// FieldCleared returns a boolean indicating if a field with the given name was
|
|
|
+// cleared in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) ClearField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticmonth.FieldStatus:
|
|
|
+ m.ClearStatus()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldDeletedAt:
|
|
|
+ m.ClearDeletedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldBotID:
|
|
|
+ m.ClearBotID()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldOrganizationID:
|
|
|
+ m.ClearOrganizationID()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticMonth 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 *UsageStatisticMonthMutation) ResetField(name string) error {
|
|
|
+ switch name {
|
|
|
+ case usagestatisticmonth.FieldCreatedAt:
|
|
|
+ m.ResetCreatedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldUpdatedAt:
|
|
|
+ m.ResetUpdatedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldStatus:
|
|
|
+ m.ResetStatus()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldDeletedAt:
|
|
|
+ m.ResetDeletedAt()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAddtime:
|
|
|
+ m.ResetAddtime()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldType:
|
|
|
+ m.ResetType()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldBotID:
|
|
|
+ m.ResetBotID()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldOrganizationID:
|
|
|
+ m.ResetOrganizationID()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAiResponse:
|
|
|
+ m.ResetAiResponse()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldSopRun:
|
|
|
+ m.ResetSopRun()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldTotalFriend:
|
|
|
+ m.ResetTotalFriend()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldTotalGroup:
|
|
|
+ m.ResetTotalGroup()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldAccountBalance:
|
|
|
+ m.ResetAccountBalance()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldConsumeToken:
|
|
|
+ m.ResetConsumeToken()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldActiveUser:
|
|
|
+ m.ResetActiveUser()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldNewUser:
|
|
|
+ m.ResetNewUser()
|
|
|
+ return nil
|
|
|
+ case usagestatisticmonth.FieldLabelDist:
|
|
|
+ m.ResetLabelDist()
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ return fmt.Errorf("unknown UsageStatisticMonth field %s", name)
|
|
|
+}
|
|
|
+
|
|
|
+// AddedEdges returns all edge names that were set/added in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) AddedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// RemovedEdges returns all edge names that were removed in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) RemovedIDs(name string) []ent.Value {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// ClearedEdges returns all edge names that were cleared in this mutation.
|
|
|
+func (m *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) 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 *UsageStatisticMonthMutation) ClearEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown UsageStatisticMonth 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 *UsageStatisticMonthMutation) ResetEdge(name string) error {
|
|
|
+ return fmt.Errorf("unknown UsageStatisticMonth edge %s", name)
|
|
|
+}
|
|
|
+
|
|
|
// UsageTotalMutation represents an operation that mutates the UsageTotal nodes in the graph.
|
|
|
type UsageTotalMutation struct {
|
|
|
config
|