mingyang-admin-pay/rpc/ent/paynotifylog.go

224 lines
7.8 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"mingyang-admin-pay/rpc/ent/paynotifylog"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// PayNotifyLog Table | 异步通知日志表
type PayNotifyLog struct {
config `json:"-"`
// ID of the ent.
ID uint64 `json:"id,omitempty"`
// Create Time | 创建日期
CreatedAt time.Time `json:"created_at,omitempty"`
// Update Time | 修改日期
UpdatedAt time.Time `json:"updated_at,omitempty"`
// Status 1: normal 2: ban | 状态 1 正常 2 禁用
Status uint8 `json:"status,omitempty"`
// Tenant ID | 租户 ID
TenantID uint64 `json:"tenant_id,omitempty"`
// Delete Time | 删除日期
DeletedAt time.Time `json:"deleted_at,omitempty"`
// 任务ID | 任务ID
TaskID uint64 `json:"task_id,omitempty"`
// 通知次数 | 通知次数
NotifyCount uint32 `json:"notify_count,omitempty"`
// 响应内容 | 响应内容
Response string `json:"response,omitempty"`
// 通知状态 | 通知状态
NotifyStatus string `json:"notify_status,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PayNotifyLogQuery when eager-loading is set.
Edges PayNotifyLogEdges `json:"edges"`
selectValues sql.SelectValues
}
// PayNotifyLogEdges holds the relations/edges for other nodes in the graph.
type PayNotifyLogEdges struct {
// Task holds the value of the task edge.
Task *PayNotifyTask `json:"task,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [1]bool
}
// TaskOrErr returns the Task value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e PayNotifyLogEdges) TaskOrErr() (*PayNotifyTask, error) {
if e.Task != nil {
return e.Task, nil
} else if e.loadedTypes[0] {
return nil, &NotFoundError{label: paynotifytask.Label}
}
return nil, &NotLoadedError{edge: "task"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*PayNotifyLog) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case paynotifylog.FieldID, paynotifylog.FieldStatus, paynotifylog.FieldTenantID, paynotifylog.FieldTaskID, paynotifylog.FieldNotifyCount:
values[i] = new(sql.NullInt64)
case paynotifylog.FieldResponse, paynotifylog.FieldNotifyStatus:
values[i] = new(sql.NullString)
case paynotifylog.FieldCreatedAt, paynotifylog.FieldUpdatedAt, paynotifylog.FieldDeletedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the PayNotifyLog fields.
func (_m *PayNotifyLog) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case paynotifylog.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = uint64(value.Int64)
case paynotifylog.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
case paynotifylog.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
_m.UpdatedAt = value.Time
}
case paynotifylog.FieldStatus:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
_m.Status = uint8(value.Int64)
}
case paynotifylog.FieldTenantID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field tenant_id", values[i])
} else if value.Valid {
_m.TenantID = uint64(value.Int64)
}
case paynotifylog.FieldDeletedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
} else if value.Valid {
_m.DeletedAt = value.Time
}
case paynotifylog.FieldTaskID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field task_id", values[i])
} else if value.Valid {
_m.TaskID = uint64(value.Int64)
}
case paynotifylog.FieldNotifyCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field notify_count", values[i])
} else if value.Valid {
_m.NotifyCount = uint32(value.Int64)
}
case paynotifylog.FieldResponse:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field response", values[i])
} else if value.Valid {
_m.Response = value.String
}
case paynotifylog.FieldNotifyStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field notify_status", values[i])
} else if value.Valid {
_m.NotifyStatus = value.String
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the PayNotifyLog.
// This includes values selected through modifiers, order, etc.
func (_m *PayNotifyLog) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryTask queries the "task" edge of the PayNotifyLog entity.
func (_m *PayNotifyLog) QueryTask() *PayNotifyTaskQuery {
return NewPayNotifyLogClient(_m.config).QueryTask(_m)
}
// Update returns a builder for updating this PayNotifyLog.
// Note that you need to call PayNotifyLog.Unwrap() before calling this method if this PayNotifyLog
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *PayNotifyLog) Update() *PayNotifyLogUpdateOne {
return NewPayNotifyLogClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the PayNotifyLog entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *PayNotifyLog) Unwrap() *PayNotifyLog {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: PayNotifyLog is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *PayNotifyLog) String() string {
var builder strings.Builder
builder.WriteString("PayNotifyLog(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(fmt.Sprintf("%v", _m.Status))
builder.WriteString(", ")
builder.WriteString("tenant_id=")
builder.WriteString(fmt.Sprintf("%v", _m.TenantID))
builder.WriteString(", ")
builder.WriteString("deleted_at=")
builder.WriteString(_m.DeletedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("task_id=")
builder.WriteString(fmt.Sprintf("%v", _m.TaskID))
builder.WriteString(", ")
builder.WriteString("notify_count=")
builder.WriteString(fmt.Sprintf("%v", _m.NotifyCount))
builder.WriteString(", ")
builder.WriteString("response=")
builder.WriteString(_m.Response)
builder.WriteString(", ")
builder.WriteString("notify_status=")
builder.WriteString(_m.NotifyStatus)
builder.WriteByte(')')
return builder.String()
}
// PayNotifyLogs is a parsable slice of PayNotifyLog.
type PayNotifyLogs []*PayNotifyLog