feat(ent): 生成支付应用实体及相关操作代码

- 新增 App 实体定义,包含字段如 ID、创建时间、更新时间、状态、租户 ID、删除时间、应用密钥、应用名称、订单通知 URL 和退款通知 URL
- 实现 App 实体的 CRUD 操作,包括创建、查询、删除等功能
- 支持与支付渠道(PayChannel)和支付通知任务(PayNotifyTask)关联关系的操作
- 自动生成数据库表结构映射及 SQL 查询逻辑
- 提供批量创建和单个/多个对象查询接口
- 包含默认值设置、数据校验以及错误处理机制
This commit is contained in:
huanglei19951029 2025-12-17 14:14:46 +08:00
parent 76a0f62a51
commit 974b68fffe
51 changed files with 34583 additions and 152 deletions

236
rpc/ent/app.go Normal file
View File

@ -0,0 +1,236 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"mingyang-admin-pay/rpc/ent/app"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// PayApp Table | 支付应用表
type App 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"`
// appKey 应用标识
AppKey string `json:"app_key,omitempty"`
// 应用名称
AppName string `json:"app_name,omitempty"`
// 支付成功回调地址
OrderNotifyURL string `json:"order_notify_url,omitempty"`
// 退款成功回调地址
RefundNotifyURL string `json:"refund_notify_url,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the AppQuery when eager-loading is set.
Edges AppEdges `json:"edges"`
selectValues sql.SelectValues
}
// AppEdges holds the relations/edges for other nodes in the graph.
type AppEdges struct {
// Channel holds the value of the channel edge.
Channel []*PayChannel `json:"channel,omitempty"`
// NotifyTask holds the value of the notify_task edge.
NotifyTask []*PayNotifyTask `json:"notify_task,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [2]bool
}
// ChannelOrErr returns the Channel value or an error if the edge
// was not loaded in eager-loading.
func (e AppEdges) ChannelOrErr() ([]*PayChannel, error) {
if e.loadedTypes[0] {
return e.Channel, nil
}
return nil, &NotLoadedError{edge: "channel"}
}
// NotifyTaskOrErr returns the NotifyTask value or an error if the edge
// was not loaded in eager-loading.
func (e AppEdges) NotifyTaskOrErr() ([]*PayNotifyTask, error) {
if e.loadedTypes[1] {
return e.NotifyTask, nil
}
return nil, &NotLoadedError{edge: "notify_task"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*App) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case app.FieldID, app.FieldStatus, app.FieldTenantID:
values[i] = new(sql.NullInt64)
case app.FieldAppKey, app.FieldAppName, app.FieldOrderNotifyURL, app.FieldRefundNotifyURL:
values[i] = new(sql.NullString)
case app.FieldCreatedAt, app.FieldUpdatedAt, app.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 App fields.
func (_m *App) 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 app.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 app.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 app.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 app.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 app.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 app.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 app.FieldAppKey:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field app_key", values[i])
} else if value.Valid {
_m.AppKey = value.String
}
case app.FieldAppName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field app_name", values[i])
} else if value.Valid {
_m.AppName = value.String
}
case app.FieldOrderNotifyURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field order_notify_url", values[i])
} else if value.Valid {
_m.OrderNotifyURL = value.String
}
case app.FieldRefundNotifyURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field refund_notify_url", values[i])
} else if value.Valid {
_m.RefundNotifyURL = 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 App.
// This includes values selected through modifiers, order, etc.
func (_m *App) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryChannel queries the "channel" edge of the App entity.
func (_m *App) QueryChannel() *PayChannelQuery {
return NewAppClient(_m.config).QueryChannel(_m)
}
// QueryNotifyTask queries the "notify_task" edge of the App entity.
func (_m *App) QueryNotifyTask() *PayNotifyTaskQuery {
return NewAppClient(_m.config).QueryNotifyTask(_m)
}
// Update returns a builder for updating this App.
// Note that you need to call App.Unwrap() before calling this method if this App
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *App) Update() *AppUpdateOne {
return NewAppClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the App 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 *App) Unwrap() *App {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: App is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *App) String() string {
var builder strings.Builder
builder.WriteString("App(")
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("app_key=")
builder.WriteString(_m.AppKey)
builder.WriteString(", ")
builder.WriteString("app_name=")
builder.WriteString(_m.AppName)
builder.WriteString(", ")
builder.WriteString("order_notify_url=")
builder.WriteString(_m.OrderNotifyURL)
builder.WriteString(", ")
builder.WriteString("refund_notify_url=")
builder.WriteString(_m.RefundNotifyURL)
builder.WriteByte(')')
return builder.String()
}
// Apps is a parsable slice of App.
type Apps []*App

187
rpc/ent/app/app.go Normal file
View File

@ -0,0 +1,187 @@
// Code generated by ent, DO NOT EDIT.
package app
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the app type in the database.
Label = "app"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldTenantID holds the string denoting the tenant_id field in the database.
FieldTenantID = "tenant_id"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldAppKey holds the string denoting the app_key field in the database.
FieldAppKey = "app_key"
// FieldAppName holds the string denoting the app_name field in the database.
FieldAppName = "app_name"
// FieldOrderNotifyURL holds the string denoting the order_notify_url field in the database.
FieldOrderNotifyURL = "order_notify_url"
// FieldRefundNotifyURL holds the string denoting the refund_notify_url field in the database.
FieldRefundNotifyURL = "refund_notify_url"
// EdgeChannel holds the string denoting the channel edge name in mutations.
EdgeChannel = "channel"
// EdgeNotifyTask holds the string denoting the notify_task edge name in mutations.
EdgeNotifyTask = "notify_task"
// Table holds the table name of the app in the database.
Table = "pay_app"
// ChannelTable is the table that holds the channel relation/edge.
ChannelTable = "pay_channel"
// ChannelInverseTable is the table name for the PayChannel entity.
// It exists in this package in order to avoid circular dependency with the "paychannel" package.
ChannelInverseTable = "pay_channel"
// ChannelColumn is the table column denoting the channel relation/edge.
ChannelColumn = "app_id"
// NotifyTaskTable is the table that holds the notify_task relation/edge.
NotifyTaskTable = "pay_notify_task"
// NotifyTaskInverseTable is the table name for the PayNotifyTask entity.
// It exists in this package in order to avoid circular dependency with the "paynotifytask" package.
NotifyTaskInverseTable = "pay_notify_task"
// NotifyTaskColumn is the table column denoting the notify_task relation/edge.
NotifyTaskColumn = "app_id"
)
// Columns holds all SQL columns for app fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldStatus,
FieldTenantID,
FieldDeletedAt,
FieldAppKey,
FieldAppName,
FieldOrderNotifyURL,
FieldRefundNotifyURL,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus uint8
// DefaultTenantID holds the default value on creation for the "tenant_id" field.
DefaultTenantID uint64
)
// OrderOption defines the ordering options for the App queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByTenantID orders the results by the tenant_id field.
func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTenantID, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByAppKey orders the results by the app_key field.
func ByAppKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAppKey, opts...).ToFunc()
}
// ByAppName orders the results by the app_name field.
func ByAppName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAppName, opts...).ToFunc()
}
// ByOrderNotifyURL orders the results by the order_notify_url field.
func ByOrderNotifyURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrderNotifyURL, opts...).ToFunc()
}
// ByRefundNotifyURL orders the results by the refund_notify_url field.
func ByRefundNotifyURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRefundNotifyURL, opts...).ToFunc()
}
// ByChannelCount orders the results by channel count.
func ByChannelCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newChannelStep(), opts...)
}
}
// ByChannel orders the results by channel terms.
func ByChannel(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newChannelStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByNotifyTaskCount orders the results by notify_task count.
func ByNotifyTaskCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newNotifyTaskStep(), opts...)
}
}
// ByNotifyTask orders the results by notify_task terms.
func ByNotifyTask(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newNotifyTaskStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newChannelStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ChannelInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, ChannelTable, ChannelColumn),
)
}
func newNotifyTaskStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(NotifyTaskInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, NotifyTaskTable, NotifyTaskColumn),
)
}

662
rpc/ent/app/where.go Normal file
View File

@ -0,0 +1,662 @@
// Code generated by ent, DO NOT EDIT.
package app
import (
"mingyang-admin-pay/rpc/ent/predicate"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
// ID filters vertices based on their ID field.
func ID(id uint64) predicate.App {
return predicate.App(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id uint64) predicate.App {
return predicate.App(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id uint64) predicate.App {
return predicate.App(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...uint64) predicate.App {
return predicate.App(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uint64) predicate.App {
return predicate.App(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id uint64) predicate.App {
return predicate.App(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id uint64) predicate.App {
return predicate.App(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id uint64) predicate.App {
return predicate.App(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id uint64) predicate.App {
return predicate.App(sql.FieldLTE(FieldID, id))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.App {
return predicate.App(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.App {
return predicate.App(sql.FieldEQ(FieldUpdatedAt, v))
}
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
func Status(v uint8) predicate.App {
return predicate.App(sql.FieldEQ(FieldStatus, v))
}
// TenantID applies equality check predicate on the "tenant_id" field. It's identical to TenantIDEQ.
func TenantID(v uint64) predicate.App {
return predicate.App(sql.FieldEQ(FieldTenantID, v))
}
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
func DeletedAt(v time.Time) predicate.App {
return predicate.App(sql.FieldEQ(FieldDeletedAt, v))
}
// AppKey applies equality check predicate on the "app_key" field. It's identical to AppKeyEQ.
func AppKey(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldAppKey, v))
}
// AppName applies equality check predicate on the "app_name" field. It's identical to AppNameEQ.
func AppName(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldAppName, v))
}
// OrderNotifyURL applies equality check predicate on the "order_notify_url" field. It's identical to OrderNotifyURLEQ.
func OrderNotifyURL(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldOrderNotifyURL, v))
}
// RefundNotifyURL applies equality check predicate on the "refund_notify_url" field. It's identical to RefundNotifyURLEQ.
func RefundNotifyURL(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldRefundNotifyURL, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.App {
return predicate.App(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.App {
return predicate.App(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.App {
return predicate.App(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.App {
return predicate.App(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.App {
return predicate.App(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.App {
return predicate.App(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.App {
return predicate.App(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.App {
return predicate.App(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.App {
return predicate.App(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.App {
return predicate.App(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.App {
return predicate.App(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.App {
return predicate.App(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.App {
return predicate.App(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.App {
return predicate.App(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.App {
return predicate.App(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.App {
return predicate.App(sql.FieldLTE(FieldUpdatedAt, v))
}
// StatusEQ applies the EQ predicate on the "status" field.
func StatusEQ(v uint8) predicate.App {
return predicate.App(sql.FieldEQ(FieldStatus, v))
}
// StatusNEQ applies the NEQ predicate on the "status" field.
func StatusNEQ(v uint8) predicate.App {
return predicate.App(sql.FieldNEQ(FieldStatus, v))
}
// StatusIn applies the In predicate on the "status" field.
func StatusIn(vs ...uint8) predicate.App {
return predicate.App(sql.FieldIn(FieldStatus, vs...))
}
// StatusNotIn applies the NotIn predicate on the "status" field.
func StatusNotIn(vs ...uint8) predicate.App {
return predicate.App(sql.FieldNotIn(FieldStatus, vs...))
}
// StatusGT applies the GT predicate on the "status" field.
func StatusGT(v uint8) predicate.App {
return predicate.App(sql.FieldGT(FieldStatus, v))
}
// StatusGTE applies the GTE predicate on the "status" field.
func StatusGTE(v uint8) predicate.App {
return predicate.App(sql.FieldGTE(FieldStatus, v))
}
// StatusLT applies the LT predicate on the "status" field.
func StatusLT(v uint8) predicate.App {
return predicate.App(sql.FieldLT(FieldStatus, v))
}
// StatusLTE applies the LTE predicate on the "status" field.
func StatusLTE(v uint8) predicate.App {
return predicate.App(sql.FieldLTE(FieldStatus, v))
}
// StatusIsNil applies the IsNil predicate on the "status" field.
func StatusIsNil() predicate.App {
return predicate.App(sql.FieldIsNull(FieldStatus))
}
// StatusNotNil applies the NotNil predicate on the "status" field.
func StatusNotNil() predicate.App {
return predicate.App(sql.FieldNotNull(FieldStatus))
}
// TenantIDEQ applies the EQ predicate on the "tenant_id" field.
func TenantIDEQ(v uint64) predicate.App {
return predicate.App(sql.FieldEQ(FieldTenantID, v))
}
// TenantIDNEQ applies the NEQ predicate on the "tenant_id" field.
func TenantIDNEQ(v uint64) predicate.App {
return predicate.App(sql.FieldNEQ(FieldTenantID, v))
}
// TenantIDIn applies the In predicate on the "tenant_id" field.
func TenantIDIn(vs ...uint64) predicate.App {
return predicate.App(sql.FieldIn(FieldTenantID, vs...))
}
// TenantIDNotIn applies the NotIn predicate on the "tenant_id" field.
func TenantIDNotIn(vs ...uint64) predicate.App {
return predicate.App(sql.FieldNotIn(FieldTenantID, vs...))
}
// TenantIDGT applies the GT predicate on the "tenant_id" field.
func TenantIDGT(v uint64) predicate.App {
return predicate.App(sql.FieldGT(FieldTenantID, v))
}
// TenantIDGTE applies the GTE predicate on the "tenant_id" field.
func TenantIDGTE(v uint64) predicate.App {
return predicate.App(sql.FieldGTE(FieldTenantID, v))
}
// TenantIDLT applies the LT predicate on the "tenant_id" field.
func TenantIDLT(v uint64) predicate.App {
return predicate.App(sql.FieldLT(FieldTenantID, v))
}
// TenantIDLTE applies the LTE predicate on the "tenant_id" field.
func TenantIDLTE(v uint64) predicate.App {
return predicate.App(sql.FieldLTE(FieldTenantID, v))
}
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
func DeletedAtEQ(v time.Time) predicate.App {
return predicate.App(sql.FieldEQ(FieldDeletedAt, v))
}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
func DeletedAtNEQ(v time.Time) predicate.App {
return predicate.App(sql.FieldNEQ(FieldDeletedAt, v))
}
// DeletedAtIn applies the In predicate on the "deleted_at" field.
func DeletedAtIn(vs ...time.Time) predicate.App {
return predicate.App(sql.FieldIn(FieldDeletedAt, vs...))
}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
func DeletedAtNotIn(vs ...time.Time) predicate.App {
return predicate.App(sql.FieldNotIn(FieldDeletedAt, vs...))
}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.
func DeletedAtGT(v time.Time) predicate.App {
return predicate.App(sql.FieldGT(FieldDeletedAt, v))
}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
func DeletedAtGTE(v time.Time) predicate.App {
return predicate.App(sql.FieldGTE(FieldDeletedAt, v))
}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.
func DeletedAtLT(v time.Time) predicate.App {
return predicate.App(sql.FieldLT(FieldDeletedAt, v))
}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
func DeletedAtLTE(v time.Time) predicate.App {
return predicate.App(sql.FieldLTE(FieldDeletedAt, v))
}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
func DeletedAtIsNil() predicate.App {
return predicate.App(sql.FieldIsNull(FieldDeletedAt))
}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
func DeletedAtNotNil() predicate.App {
return predicate.App(sql.FieldNotNull(FieldDeletedAt))
}
// AppKeyEQ applies the EQ predicate on the "app_key" field.
func AppKeyEQ(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldAppKey, v))
}
// AppKeyNEQ applies the NEQ predicate on the "app_key" field.
func AppKeyNEQ(v string) predicate.App {
return predicate.App(sql.FieldNEQ(FieldAppKey, v))
}
// AppKeyIn applies the In predicate on the "app_key" field.
func AppKeyIn(vs ...string) predicate.App {
return predicate.App(sql.FieldIn(FieldAppKey, vs...))
}
// AppKeyNotIn applies the NotIn predicate on the "app_key" field.
func AppKeyNotIn(vs ...string) predicate.App {
return predicate.App(sql.FieldNotIn(FieldAppKey, vs...))
}
// AppKeyGT applies the GT predicate on the "app_key" field.
func AppKeyGT(v string) predicate.App {
return predicate.App(sql.FieldGT(FieldAppKey, v))
}
// AppKeyGTE applies the GTE predicate on the "app_key" field.
func AppKeyGTE(v string) predicate.App {
return predicate.App(sql.FieldGTE(FieldAppKey, v))
}
// AppKeyLT applies the LT predicate on the "app_key" field.
func AppKeyLT(v string) predicate.App {
return predicate.App(sql.FieldLT(FieldAppKey, v))
}
// AppKeyLTE applies the LTE predicate on the "app_key" field.
func AppKeyLTE(v string) predicate.App {
return predicate.App(sql.FieldLTE(FieldAppKey, v))
}
// AppKeyContains applies the Contains predicate on the "app_key" field.
func AppKeyContains(v string) predicate.App {
return predicate.App(sql.FieldContains(FieldAppKey, v))
}
// AppKeyHasPrefix applies the HasPrefix predicate on the "app_key" field.
func AppKeyHasPrefix(v string) predicate.App {
return predicate.App(sql.FieldHasPrefix(FieldAppKey, v))
}
// AppKeyHasSuffix applies the HasSuffix predicate on the "app_key" field.
func AppKeyHasSuffix(v string) predicate.App {
return predicate.App(sql.FieldHasSuffix(FieldAppKey, v))
}
// AppKeyEqualFold applies the EqualFold predicate on the "app_key" field.
func AppKeyEqualFold(v string) predicate.App {
return predicate.App(sql.FieldEqualFold(FieldAppKey, v))
}
// AppKeyContainsFold applies the ContainsFold predicate on the "app_key" field.
func AppKeyContainsFold(v string) predicate.App {
return predicate.App(sql.FieldContainsFold(FieldAppKey, v))
}
// AppNameEQ applies the EQ predicate on the "app_name" field.
func AppNameEQ(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldAppName, v))
}
// AppNameNEQ applies the NEQ predicate on the "app_name" field.
func AppNameNEQ(v string) predicate.App {
return predicate.App(sql.FieldNEQ(FieldAppName, v))
}
// AppNameIn applies the In predicate on the "app_name" field.
func AppNameIn(vs ...string) predicate.App {
return predicate.App(sql.FieldIn(FieldAppName, vs...))
}
// AppNameNotIn applies the NotIn predicate on the "app_name" field.
func AppNameNotIn(vs ...string) predicate.App {
return predicate.App(sql.FieldNotIn(FieldAppName, vs...))
}
// AppNameGT applies the GT predicate on the "app_name" field.
func AppNameGT(v string) predicate.App {
return predicate.App(sql.FieldGT(FieldAppName, v))
}
// AppNameGTE applies the GTE predicate on the "app_name" field.
func AppNameGTE(v string) predicate.App {
return predicate.App(sql.FieldGTE(FieldAppName, v))
}
// AppNameLT applies the LT predicate on the "app_name" field.
func AppNameLT(v string) predicate.App {
return predicate.App(sql.FieldLT(FieldAppName, v))
}
// AppNameLTE applies the LTE predicate on the "app_name" field.
func AppNameLTE(v string) predicate.App {
return predicate.App(sql.FieldLTE(FieldAppName, v))
}
// AppNameContains applies the Contains predicate on the "app_name" field.
func AppNameContains(v string) predicate.App {
return predicate.App(sql.FieldContains(FieldAppName, v))
}
// AppNameHasPrefix applies the HasPrefix predicate on the "app_name" field.
func AppNameHasPrefix(v string) predicate.App {
return predicate.App(sql.FieldHasPrefix(FieldAppName, v))
}
// AppNameHasSuffix applies the HasSuffix predicate on the "app_name" field.
func AppNameHasSuffix(v string) predicate.App {
return predicate.App(sql.FieldHasSuffix(FieldAppName, v))
}
// AppNameEqualFold applies the EqualFold predicate on the "app_name" field.
func AppNameEqualFold(v string) predicate.App {
return predicate.App(sql.FieldEqualFold(FieldAppName, v))
}
// AppNameContainsFold applies the ContainsFold predicate on the "app_name" field.
func AppNameContainsFold(v string) predicate.App {
return predicate.App(sql.FieldContainsFold(FieldAppName, v))
}
// OrderNotifyURLEQ applies the EQ predicate on the "order_notify_url" field.
func OrderNotifyURLEQ(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldOrderNotifyURL, v))
}
// OrderNotifyURLNEQ applies the NEQ predicate on the "order_notify_url" field.
func OrderNotifyURLNEQ(v string) predicate.App {
return predicate.App(sql.FieldNEQ(FieldOrderNotifyURL, v))
}
// OrderNotifyURLIn applies the In predicate on the "order_notify_url" field.
func OrderNotifyURLIn(vs ...string) predicate.App {
return predicate.App(sql.FieldIn(FieldOrderNotifyURL, vs...))
}
// OrderNotifyURLNotIn applies the NotIn predicate on the "order_notify_url" field.
func OrderNotifyURLNotIn(vs ...string) predicate.App {
return predicate.App(sql.FieldNotIn(FieldOrderNotifyURL, vs...))
}
// OrderNotifyURLGT applies the GT predicate on the "order_notify_url" field.
func OrderNotifyURLGT(v string) predicate.App {
return predicate.App(sql.FieldGT(FieldOrderNotifyURL, v))
}
// OrderNotifyURLGTE applies the GTE predicate on the "order_notify_url" field.
func OrderNotifyURLGTE(v string) predicate.App {
return predicate.App(sql.FieldGTE(FieldOrderNotifyURL, v))
}
// OrderNotifyURLLT applies the LT predicate on the "order_notify_url" field.
func OrderNotifyURLLT(v string) predicate.App {
return predicate.App(sql.FieldLT(FieldOrderNotifyURL, v))
}
// OrderNotifyURLLTE applies the LTE predicate on the "order_notify_url" field.
func OrderNotifyURLLTE(v string) predicate.App {
return predicate.App(sql.FieldLTE(FieldOrderNotifyURL, v))
}
// OrderNotifyURLContains applies the Contains predicate on the "order_notify_url" field.
func OrderNotifyURLContains(v string) predicate.App {
return predicate.App(sql.FieldContains(FieldOrderNotifyURL, v))
}
// OrderNotifyURLHasPrefix applies the HasPrefix predicate on the "order_notify_url" field.
func OrderNotifyURLHasPrefix(v string) predicate.App {
return predicate.App(sql.FieldHasPrefix(FieldOrderNotifyURL, v))
}
// OrderNotifyURLHasSuffix applies the HasSuffix predicate on the "order_notify_url" field.
func OrderNotifyURLHasSuffix(v string) predicate.App {
return predicate.App(sql.FieldHasSuffix(FieldOrderNotifyURL, v))
}
// OrderNotifyURLIsNil applies the IsNil predicate on the "order_notify_url" field.
func OrderNotifyURLIsNil() predicate.App {
return predicate.App(sql.FieldIsNull(FieldOrderNotifyURL))
}
// OrderNotifyURLNotNil applies the NotNil predicate on the "order_notify_url" field.
func OrderNotifyURLNotNil() predicate.App {
return predicate.App(sql.FieldNotNull(FieldOrderNotifyURL))
}
// OrderNotifyURLEqualFold applies the EqualFold predicate on the "order_notify_url" field.
func OrderNotifyURLEqualFold(v string) predicate.App {
return predicate.App(sql.FieldEqualFold(FieldOrderNotifyURL, v))
}
// OrderNotifyURLContainsFold applies the ContainsFold predicate on the "order_notify_url" field.
func OrderNotifyURLContainsFold(v string) predicate.App {
return predicate.App(sql.FieldContainsFold(FieldOrderNotifyURL, v))
}
// RefundNotifyURLEQ applies the EQ predicate on the "refund_notify_url" field.
func RefundNotifyURLEQ(v string) predicate.App {
return predicate.App(sql.FieldEQ(FieldRefundNotifyURL, v))
}
// RefundNotifyURLNEQ applies the NEQ predicate on the "refund_notify_url" field.
func RefundNotifyURLNEQ(v string) predicate.App {
return predicate.App(sql.FieldNEQ(FieldRefundNotifyURL, v))
}
// RefundNotifyURLIn applies the In predicate on the "refund_notify_url" field.
func RefundNotifyURLIn(vs ...string) predicate.App {
return predicate.App(sql.FieldIn(FieldRefundNotifyURL, vs...))
}
// RefundNotifyURLNotIn applies the NotIn predicate on the "refund_notify_url" field.
func RefundNotifyURLNotIn(vs ...string) predicate.App {
return predicate.App(sql.FieldNotIn(FieldRefundNotifyURL, vs...))
}
// RefundNotifyURLGT applies the GT predicate on the "refund_notify_url" field.
func RefundNotifyURLGT(v string) predicate.App {
return predicate.App(sql.FieldGT(FieldRefundNotifyURL, v))
}
// RefundNotifyURLGTE applies the GTE predicate on the "refund_notify_url" field.
func RefundNotifyURLGTE(v string) predicate.App {
return predicate.App(sql.FieldGTE(FieldRefundNotifyURL, v))
}
// RefundNotifyURLLT applies the LT predicate on the "refund_notify_url" field.
func RefundNotifyURLLT(v string) predicate.App {
return predicate.App(sql.FieldLT(FieldRefundNotifyURL, v))
}
// RefundNotifyURLLTE applies the LTE predicate on the "refund_notify_url" field.
func RefundNotifyURLLTE(v string) predicate.App {
return predicate.App(sql.FieldLTE(FieldRefundNotifyURL, v))
}
// RefundNotifyURLContains applies the Contains predicate on the "refund_notify_url" field.
func RefundNotifyURLContains(v string) predicate.App {
return predicate.App(sql.FieldContains(FieldRefundNotifyURL, v))
}
// RefundNotifyURLHasPrefix applies the HasPrefix predicate on the "refund_notify_url" field.
func RefundNotifyURLHasPrefix(v string) predicate.App {
return predicate.App(sql.FieldHasPrefix(FieldRefundNotifyURL, v))
}
// RefundNotifyURLHasSuffix applies the HasSuffix predicate on the "refund_notify_url" field.
func RefundNotifyURLHasSuffix(v string) predicate.App {
return predicate.App(sql.FieldHasSuffix(FieldRefundNotifyURL, v))
}
// RefundNotifyURLIsNil applies the IsNil predicate on the "refund_notify_url" field.
func RefundNotifyURLIsNil() predicate.App {
return predicate.App(sql.FieldIsNull(FieldRefundNotifyURL))
}
// RefundNotifyURLNotNil applies the NotNil predicate on the "refund_notify_url" field.
func RefundNotifyURLNotNil() predicate.App {
return predicate.App(sql.FieldNotNull(FieldRefundNotifyURL))
}
// RefundNotifyURLEqualFold applies the EqualFold predicate on the "refund_notify_url" field.
func RefundNotifyURLEqualFold(v string) predicate.App {
return predicate.App(sql.FieldEqualFold(FieldRefundNotifyURL, v))
}
// RefundNotifyURLContainsFold applies the ContainsFold predicate on the "refund_notify_url" field.
func RefundNotifyURLContainsFold(v string) predicate.App {
return predicate.App(sql.FieldContainsFold(FieldRefundNotifyURL, v))
}
// HasChannel applies the HasEdge predicate on the "channel" edge.
func HasChannel() predicate.App {
return predicate.App(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, ChannelTable, ChannelColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasChannelWith applies the HasEdge predicate on the "channel" edge with a given conditions (other predicates).
func HasChannelWith(preds ...predicate.PayChannel) predicate.App {
return predicate.App(func(s *sql.Selector) {
step := newChannelStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasNotifyTask applies the HasEdge predicate on the "notify_task" edge.
func HasNotifyTask() predicate.App {
return predicate.App(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, NotifyTaskTable, NotifyTaskColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasNotifyTaskWith applies the HasEdge predicate on the "notify_task" edge with a given conditions (other predicates).
func HasNotifyTaskWith(preds ...predicate.PayNotifyTask) predicate.App {
return predicate.App(func(s *sql.Selector) {
step := newNotifyTaskStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.App) predicate.App {
return predicate.App(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.App) predicate.App {
return predicate.App(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.App) predicate.App {
return predicate.App(sql.NotPredicates(p))
}

430
rpc/ent/app_create.go Normal file
View File

@ -0,0 +1,430 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"time"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// AppCreate is the builder for creating a App entity.
type AppCreate struct {
config
mutation *AppMutation
hooks []Hook
}
// SetCreatedAt sets the "created_at" field.
func (_c *AppCreate) SetCreatedAt(v time.Time) *AppCreate {
_c.mutation.SetCreatedAt(v)
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *AppCreate) SetNillableCreatedAt(v *time.Time) *AppCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// SetUpdatedAt sets the "updated_at" field.
func (_c *AppCreate) SetUpdatedAt(v time.Time) *AppCreate {
_c.mutation.SetUpdatedAt(v)
return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (_c *AppCreate) SetNillableUpdatedAt(v *time.Time) *AppCreate {
if v != nil {
_c.SetUpdatedAt(*v)
}
return _c
}
// SetStatus sets the "status" field.
func (_c *AppCreate) SetStatus(v uint8) *AppCreate {
_c.mutation.SetStatus(v)
return _c
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_c *AppCreate) SetNillableStatus(v *uint8) *AppCreate {
if v != nil {
_c.SetStatus(*v)
}
return _c
}
// SetTenantID sets the "tenant_id" field.
func (_c *AppCreate) SetTenantID(v uint64) *AppCreate {
_c.mutation.SetTenantID(v)
return _c
}
// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (_c *AppCreate) SetNillableTenantID(v *uint64) *AppCreate {
if v != nil {
_c.SetTenantID(*v)
}
return _c
}
// SetDeletedAt sets the "deleted_at" field.
func (_c *AppCreate) SetDeletedAt(v time.Time) *AppCreate {
_c.mutation.SetDeletedAt(v)
return _c
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_c *AppCreate) SetNillableDeletedAt(v *time.Time) *AppCreate {
if v != nil {
_c.SetDeletedAt(*v)
}
return _c
}
// SetAppKey sets the "app_key" field.
func (_c *AppCreate) SetAppKey(v string) *AppCreate {
_c.mutation.SetAppKey(v)
return _c
}
// SetAppName sets the "app_name" field.
func (_c *AppCreate) SetAppName(v string) *AppCreate {
_c.mutation.SetAppName(v)
return _c
}
// SetOrderNotifyURL sets the "order_notify_url" field.
func (_c *AppCreate) SetOrderNotifyURL(v string) *AppCreate {
_c.mutation.SetOrderNotifyURL(v)
return _c
}
// SetNillableOrderNotifyURL sets the "order_notify_url" field if the given value is not nil.
func (_c *AppCreate) SetNillableOrderNotifyURL(v *string) *AppCreate {
if v != nil {
_c.SetOrderNotifyURL(*v)
}
return _c
}
// SetRefundNotifyURL sets the "refund_notify_url" field.
func (_c *AppCreate) SetRefundNotifyURL(v string) *AppCreate {
_c.mutation.SetRefundNotifyURL(v)
return _c
}
// SetNillableRefundNotifyURL sets the "refund_notify_url" field if the given value is not nil.
func (_c *AppCreate) SetNillableRefundNotifyURL(v *string) *AppCreate {
if v != nil {
_c.SetRefundNotifyURL(*v)
}
return _c
}
// SetID sets the "id" field.
func (_c *AppCreate) SetID(v uint64) *AppCreate {
_c.mutation.SetID(v)
return _c
}
// AddChannelIDs adds the "channel" edge to the PayChannel entity by IDs.
func (_c *AppCreate) AddChannelIDs(ids ...uint64) *AppCreate {
_c.mutation.AddChannelIDs(ids...)
return _c
}
// AddChannel adds the "channel" edges to the PayChannel entity.
func (_c *AppCreate) AddChannel(v ...*PayChannel) *AppCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddChannelIDs(ids...)
}
// AddNotifyTaskIDs adds the "notify_task" edge to the PayNotifyTask entity by IDs.
func (_c *AppCreate) AddNotifyTaskIDs(ids ...uint64) *AppCreate {
_c.mutation.AddNotifyTaskIDs(ids...)
return _c
}
// AddNotifyTask adds the "notify_task" edges to the PayNotifyTask entity.
func (_c *AppCreate) AddNotifyTask(v ...*PayNotifyTask) *AppCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddNotifyTaskIDs(ids...)
}
// Mutation returns the AppMutation object of the builder.
func (_c *AppCreate) Mutation() *AppMutation {
return _c.mutation
}
// Save creates the App in the database.
func (_c *AppCreate) Save(ctx context.Context) (*App, error) {
_c.defaults()
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (_c *AppCreate) SaveX(ctx context.Context) *App {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *AppCreate) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *AppCreate) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_c *AppCreate) defaults() {
if _, ok := _c.mutation.CreatedAt(); !ok {
v := app.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
v := app.DefaultUpdatedAt()
_c.mutation.SetUpdatedAt(v)
}
if _, ok := _c.mutation.Status(); !ok {
v := app.DefaultStatus
_c.mutation.SetStatus(v)
}
if _, ok := _c.mutation.TenantID(); !ok {
v := app.DefaultTenantID
_c.mutation.SetTenantID(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_c *AppCreate) check() error {
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "App.created_at"`)}
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "App.updated_at"`)}
}
if _, ok := _c.mutation.TenantID(); !ok {
return &ValidationError{Name: "tenant_id", err: errors.New(`ent: missing required field "App.tenant_id"`)}
}
if _, ok := _c.mutation.AppKey(); !ok {
return &ValidationError{Name: "app_key", err: errors.New(`ent: missing required field "App.app_key"`)}
}
if _, ok := _c.mutation.AppName(); !ok {
return &ValidationError{Name: "app_name", err: errors.New(`ent: missing required field "App.app_name"`)}
}
return nil
}
func (_c *AppCreate) sqlSave(ctx context.Context) (*App, error) {
if err := _c.check(); err != nil {
return nil, err
}
_node, _spec := _c.createSpec()
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
if _spec.ID.Value != _node.ID {
id := _spec.ID.Value.(int64)
_node.ID = uint64(id)
}
_c.mutation.id = &_node.ID
_c.mutation.done = true
return _node, nil
}
func (_c *AppCreate) createSpec() (*App, *sqlgraph.CreateSpec) {
var (
_node = &App{config: _c.config}
_spec = sqlgraph.NewCreateSpec(app.Table, sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64))
)
if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = id
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(app.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(app.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := _c.mutation.Status(); ok {
_spec.SetField(app.FieldStatus, field.TypeUint8, value)
_node.Status = value
}
if value, ok := _c.mutation.TenantID(); ok {
_spec.SetField(app.FieldTenantID, field.TypeUint64, value)
_node.TenantID = value
}
if value, ok := _c.mutation.DeletedAt(); ok {
_spec.SetField(app.FieldDeletedAt, field.TypeTime, value)
_node.DeletedAt = value
}
if value, ok := _c.mutation.AppKey(); ok {
_spec.SetField(app.FieldAppKey, field.TypeString, value)
_node.AppKey = value
}
if value, ok := _c.mutation.AppName(); ok {
_spec.SetField(app.FieldAppName, field.TypeString, value)
_node.AppName = value
}
if value, ok := _c.mutation.OrderNotifyURL(); ok {
_spec.SetField(app.FieldOrderNotifyURL, field.TypeString, value)
_node.OrderNotifyURL = value
}
if value, ok := _c.mutation.RefundNotifyURL(); ok {
_spec.SetField(app.FieldRefundNotifyURL, field.TypeString, value)
_node.RefundNotifyURL = value
}
if nodes := _c.mutation.ChannelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.ChannelTable,
Columns: []string{app.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.NotifyTaskIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.NotifyTaskTable,
Columns: []string{app.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
return _node, _spec
}
// AppCreateBulk is the builder for creating many App entities in bulk.
type AppCreateBulk struct {
config
err error
builders []*AppCreate
}
// Save creates the App entities in the database.
func (_c *AppCreateBulk) Save(ctx context.Context) ([]*App, error) {
if _c.err != nil {
return nil, _c.err
}
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
nodes := make([]*App, len(_c.builders))
mutators := make([]Mutator, len(_c.builders))
for i := range _c.builders {
func(i int, root context.Context) {
builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*AppMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
if err := builder.check(); err != nil {
return nil, err
}
builder.mutation = mutation
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
} else {
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
}
}
if err != nil {
return nil, err
}
mutation.id = &nodes[i].ID
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
id := specs[i].ID.Value.(int64)
nodes[i].ID = uint64(id)
}
mutation.done = true
return nodes[i], nil
})
for i := len(builder.hooks) - 1; i >= 0; i-- {
mut = builder.hooks[i](mut)
}
mutators[i] = mut
}(i, ctx)
}
if len(mutators) > 0 {
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
return nodes, nil
}
// SaveX is like Save, but panics if an error occurs.
func (_c *AppCreateBulk) SaveX(ctx context.Context) []*App {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *AppCreateBulk) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *AppCreateBulk) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}

88
rpc/ent/app_delete.go Normal file
View File

@ -0,0 +1,88 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// AppDelete is the builder for deleting a App entity.
type AppDelete struct {
config
hooks []Hook
mutation *AppMutation
}
// Where appends a list predicates to the AppDelete builder.
func (_d *AppDelete) Where(ps ...predicate.App) *AppDelete {
_d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (_d *AppDelete) Exec(ctx context.Context) (int, error) {
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *AppDelete) ExecX(ctx context.Context) int {
n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (_d *AppDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(app.Table, sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64))
if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
_d.mutation.done = true
return affected, err
}
// AppDeleteOne is the builder for deleting a single App entity.
type AppDeleteOne struct {
_d *AppDelete
}
// Where appends a list predicates to the AppDelete builder.
func (_d *AppDeleteOne) Where(ps ...predicate.App) *AppDeleteOne {
_d._d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query.
func (_d *AppDeleteOne) Exec(ctx context.Context) error {
n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{app.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *AppDeleteOne) ExecX(ctx context.Context) {
if err := _d.Exec(ctx); err != nil {
panic(err)
}
}

680
rpc/ent/app_query.go Normal file
View File

@ -0,0 +1,680 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"database/sql/driver"
"fmt"
"math"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// AppQuery is the builder for querying App entities.
type AppQuery struct {
config
ctx *QueryContext
order []app.OrderOption
inters []Interceptor
predicates []predicate.App
withChannel *PayChannelQuery
withNotifyTask *PayNotifyTaskQuery
// intermediate query (i.e. traversal path).
sql *sql.Selector
path func(context.Context) (*sql.Selector, error)
}
// Where adds a new predicate for the AppQuery builder.
func (_q *AppQuery) Where(ps ...predicate.App) *AppQuery {
_q.predicates = append(_q.predicates, ps...)
return _q
}
// Limit the number of records to be returned by this query.
func (_q *AppQuery) Limit(limit int) *AppQuery {
_q.ctx.Limit = &limit
return _q
}
// Offset to start from.
func (_q *AppQuery) Offset(offset int) *AppQuery {
_q.ctx.Offset = &offset
return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
func (_q *AppQuery) Unique(unique bool) *AppQuery {
_q.ctx.Unique = &unique
return _q
}
// Order specifies how the records should be ordered.
func (_q *AppQuery) Order(o ...app.OrderOption) *AppQuery {
_q.order = append(_q.order, o...)
return _q
}
// QueryChannel chains the current query on the "channel" edge.
func (_q *AppQuery) QueryChannel() *PayChannelQuery {
query := (&PayChannelClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(app.Table, app.FieldID, selector),
sqlgraph.To(paychannel.Table, paychannel.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, app.ChannelTable, app.ChannelColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryNotifyTask chains the current query on the "notify_task" edge.
func (_q *AppQuery) QueryNotifyTask() *PayNotifyTaskQuery {
query := (&PayNotifyTaskClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(app.Table, app.FieldID, selector),
sqlgraph.To(paynotifytask.Table, paynotifytask.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, app.NotifyTaskTable, app.NotifyTaskColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// First returns the first App entity from the query.
// Returns a *NotFoundError when no App was found.
func (_q *AppQuery) First(ctx context.Context) (*App, error) {
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
if len(nodes) == 0 {
return nil, &NotFoundError{app.Label}
}
return nodes[0], nil
}
// FirstX is like First, but panics if an error occurs.
func (_q *AppQuery) FirstX(ctx context.Context) *App {
node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return node
}
// FirstID returns the first App ID from the query.
// Returns a *NotFoundError when no App ID was found.
func (_q *AppQuery) FirstID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
err = &NotFoundError{app.Label}
return
}
return ids[0], nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func (_q *AppQuery) FirstIDX(ctx context.Context) uint64 {
id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return id
}
// Only returns a single App entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one App entity is found.
// Returns a *NotFoundError when no App entities are found.
func (_q *AppQuery) Only(ctx context.Context) (*App, error) {
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
switch len(nodes) {
case 1:
return nodes[0], nil
case 0:
return nil, &NotFoundError{app.Label}
default:
return nil, &NotSingularError{app.Label}
}
}
// OnlyX is like Only, but panics if an error occurs.
func (_q *AppQuery) OnlyX(ctx context.Context) *App {
node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
return node
}
// OnlyID is like Only, but returns the only App ID in the query.
// Returns a *NotSingularError when more than one App ID is found.
// Returns a *NotFoundError when no entities are found.
func (_q *AppQuery) OnlyID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
case 1:
id = ids[0]
case 0:
err = &NotFoundError{app.Label}
default:
err = &NotSingularError{app.Label}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func (_q *AppQuery) OnlyIDX(ctx context.Context) uint64 {
id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
return id
}
// All executes the query and returns a list of Apps.
func (_q *AppQuery) All(ctx context.Context) ([]*App, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*App, *AppQuery]()
return withInterceptors[[]*App](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
func (_q *AppQuery) AllX(ctx context.Context) []*App {
nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
return nodes
}
// IDs executes the query and returns a list of App IDs.
func (_q *AppQuery) IDs(ctx context.Context) (ids []uint64, err error) {
if _q.ctx.Unique == nil && _q.path != nil {
_q.Unique(true)
}
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
if err = _q.Select(app.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
func (_q *AppQuery) IDsX(ctx context.Context) []uint64 {
ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
return ids
}
// Count returns the count of the given query.
func (_q *AppQuery) Count(ctx context.Context) (int, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
return withInterceptors[int](ctx, _q, querierCount[*AppQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
func (_q *AppQuery) CountX(ctx context.Context) int {
count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
return count
}
// Exist returns true if the query has elements in the graph.
func (_q *AppQuery) Exist(ctx context.Context) (bool, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
}
}
// ExistX is like Exist, but panics if an error occurs.
func (_q *AppQuery) ExistX(ctx context.Context) bool {
exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
return exist
}
// Clone returns a duplicate of the AppQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func (_q *AppQuery) Clone() *AppQuery {
if _q == nil {
return nil
}
return &AppQuery{
config: _q.config,
ctx: _q.ctx.Clone(),
order: append([]app.OrderOption{}, _q.order...),
inters: append([]Interceptor{}, _q.inters...),
predicates: append([]predicate.App{}, _q.predicates...),
withChannel: _q.withChannel.Clone(),
withNotifyTask: _q.withNotifyTask.Clone(),
// clone intermediate query.
sql: _q.sql.Clone(),
path: _q.path,
}
}
// WithChannel tells the query-builder to eager-load the nodes that are connected to
// the "channel" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *AppQuery) WithChannel(opts ...func(*PayChannelQuery)) *AppQuery {
query := (&PayChannelClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withChannel = query
return _q
}
// WithNotifyTask tells the query-builder to eager-load the nodes that are connected to
// the "notify_task" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *AppQuery) WithNotifyTask(opts ...func(*PayNotifyTaskQuery)) *AppQuery {
query := (&PayNotifyTaskClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withNotifyTask = query
return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.App.Query().
// GroupBy(app.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func (_q *AppQuery) GroupBy(field string, fields ...string) *AppGroupBy {
_q.ctx.Fields = append([]string{field}, fields...)
grbuild := &AppGroupBy{build: _q}
grbuild.flds = &_q.ctx.Fields
grbuild.label = app.Label
grbuild.scan = grbuild.Scan
return grbuild
}
// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// }
//
// client.App.Query().
// Select(app.FieldCreatedAt).
// Scan(ctx, &v)
func (_q *AppQuery) Select(fields ...string) *AppSelect {
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
sbuild := &AppSelect{AppQuery: _q}
sbuild.label = app.Label
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a AppSelect configured with the given aggregations.
func (_q *AppQuery) Aggregate(fns ...AggregateFunc) *AppSelect {
return _q.Select().Aggregate(fns...)
}
func (_q *AppQuery) prepareQuery(ctx context.Context) error {
for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
for _, f := range _q.ctx.Fields {
if !app.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
if _q.path != nil {
prev, err := _q.path(ctx)
if err != nil {
return err
}
_q.sql = prev
}
return nil
}
func (_q *AppQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*App, error) {
var (
nodes = []*App{}
_spec = _q.querySpec()
loadedTypes = [2]bool{
_q.withChannel != nil,
_q.withNotifyTask != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*App).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
node := &App{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
}
for i := range hooks {
hooks[i](ctx, _spec)
}
if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
if query := _q.withChannel; query != nil {
if err := _q.loadChannel(ctx, query, nodes,
func(n *App) { n.Edges.Channel = []*PayChannel{} },
func(n *App, e *PayChannel) { n.Edges.Channel = append(n.Edges.Channel, e) }); err != nil {
return nil, err
}
}
if query := _q.withNotifyTask; query != nil {
if err := _q.loadNotifyTask(ctx, query, nodes,
func(n *App) { n.Edges.NotifyTask = []*PayNotifyTask{} },
func(n *App, e *PayNotifyTask) { n.Edges.NotifyTask = append(n.Edges.NotifyTask, e) }); err != nil {
return nil, err
}
}
return nodes, nil
}
func (_q *AppQuery) loadChannel(ctx context.Context, query *PayChannelQuery, nodes []*App, init func(*App), assign func(*App, *PayChannel)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*App)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(paychannel.FieldAppID)
}
query.Where(predicate.PayChannel(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(app.ChannelColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.AppID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "app_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *AppQuery) loadNotifyTask(ctx context.Context, query *PayNotifyTaskQuery, nodes []*App, init func(*App), assign func(*App, *PayNotifyTask)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*App)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(paynotifytask.FieldAppID)
}
query.Where(predicate.PayNotifyTask(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(app.NotifyTaskColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.AppID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "app_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *AppQuery) sqlCount(ctx context.Context) (int, error) {
_spec := _q.querySpec()
_spec.Node.Columns = _q.ctx.Fields
if len(_q.ctx.Fields) > 0 {
_spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
func (_q *AppQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(app.Table, app.Columns, sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64))
_spec.From = _q.sql
if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
} else if _q.path != nil {
_spec.Unique = true
}
if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, app.FieldID)
for i := range fields {
if fields[i] != app.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
}
if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
return _spec
}
func (_q *AppQuery) sqlQuery(ctx context.Context) *sql.Selector {
builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(app.Table)
columns := _q.ctx.Fields
if len(columns) == 0 {
columns = app.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
if _q.sql != nil {
selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
for _, p := range _q.predicates {
p(selector)
}
for _, p := range _q.order {
p(selector)
}
if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
}
// AppGroupBy is the group-by builder for App entities.
type AppGroupBy struct {
selector
build *AppQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func (_g *AppGroupBy) Aggregate(fns ...AggregateFunc) *AppGroupBy {
_g.fns = append(_g.fns, fns...)
return _g
}
// Scan applies the selector query and scans the result into the given value.
func (_g *AppGroupBy) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*AppQuery, *AppGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
func (_g *AppGroupBy) sqlScan(ctx context.Context, root *AppQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
aggregation := make([]string, 0, len(_g.fns))
for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}
// AppSelect is the builder for selecting fields of App entities.
type AppSelect struct {
*AppQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func (_s *AppSelect) Aggregate(fns ...AggregateFunc) *AppSelect {
_s.fns = append(_s.fns, fns...)
return _s
}
// Scan applies the selector query and scans the result into the given value.
func (_s *AppSelect) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
if err := _s.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*AppQuery, *AppSelect](ctx, _s.AppQuery, _s, _s.inters, v)
}
func (_s *AppSelect) sqlScan(ctx context.Context, root *AppQuery, v any) error {
selector := root.sqlQuery(ctx)
aggregation := make([]string, 0, len(_s.fns))
for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
selector.AppendSelect(aggregation...)
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}

834
rpc/ent/app_update.go Normal file
View File

@ -0,0 +1,834 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/predicate"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// AppUpdate is the builder for updating App entities.
type AppUpdate struct {
config
hooks []Hook
mutation *AppMutation
}
// Where appends a list predicates to the AppUpdate builder.
func (_u *AppUpdate) Where(ps ...predicate.App) *AppUpdate {
_u.mutation.Where(ps...)
return _u
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *AppUpdate) SetUpdatedAt(v time.Time) *AppUpdate {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetStatus sets the "status" field.
func (_u *AppUpdate) SetStatus(v uint8) *AppUpdate {
_u.mutation.ResetStatus()
_u.mutation.SetStatus(v)
return _u
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_u *AppUpdate) SetNillableStatus(v *uint8) *AppUpdate {
if v != nil {
_u.SetStatus(*v)
}
return _u
}
// AddStatus adds value to the "status" field.
func (_u *AppUpdate) AddStatus(v int8) *AppUpdate {
_u.mutation.AddStatus(v)
return _u
}
// ClearStatus clears the value of the "status" field.
func (_u *AppUpdate) ClearStatus() *AppUpdate {
_u.mutation.ClearStatus()
return _u
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *AppUpdate) SetDeletedAt(v time.Time) *AppUpdate {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *AppUpdate) SetNillableDeletedAt(v *time.Time) *AppUpdate {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *AppUpdate) ClearDeletedAt() *AppUpdate {
_u.mutation.ClearDeletedAt()
return _u
}
// SetAppKey sets the "app_key" field.
func (_u *AppUpdate) SetAppKey(v string) *AppUpdate {
_u.mutation.SetAppKey(v)
return _u
}
// SetNillableAppKey sets the "app_key" field if the given value is not nil.
func (_u *AppUpdate) SetNillableAppKey(v *string) *AppUpdate {
if v != nil {
_u.SetAppKey(*v)
}
return _u
}
// SetAppName sets the "app_name" field.
func (_u *AppUpdate) SetAppName(v string) *AppUpdate {
_u.mutation.SetAppName(v)
return _u
}
// SetNillableAppName sets the "app_name" field if the given value is not nil.
func (_u *AppUpdate) SetNillableAppName(v *string) *AppUpdate {
if v != nil {
_u.SetAppName(*v)
}
return _u
}
// SetOrderNotifyURL sets the "order_notify_url" field.
func (_u *AppUpdate) SetOrderNotifyURL(v string) *AppUpdate {
_u.mutation.SetOrderNotifyURL(v)
return _u
}
// SetNillableOrderNotifyURL sets the "order_notify_url" field if the given value is not nil.
func (_u *AppUpdate) SetNillableOrderNotifyURL(v *string) *AppUpdate {
if v != nil {
_u.SetOrderNotifyURL(*v)
}
return _u
}
// ClearOrderNotifyURL clears the value of the "order_notify_url" field.
func (_u *AppUpdate) ClearOrderNotifyURL() *AppUpdate {
_u.mutation.ClearOrderNotifyURL()
return _u
}
// SetRefundNotifyURL sets the "refund_notify_url" field.
func (_u *AppUpdate) SetRefundNotifyURL(v string) *AppUpdate {
_u.mutation.SetRefundNotifyURL(v)
return _u
}
// SetNillableRefundNotifyURL sets the "refund_notify_url" field if the given value is not nil.
func (_u *AppUpdate) SetNillableRefundNotifyURL(v *string) *AppUpdate {
if v != nil {
_u.SetRefundNotifyURL(*v)
}
return _u
}
// ClearRefundNotifyURL clears the value of the "refund_notify_url" field.
func (_u *AppUpdate) ClearRefundNotifyURL() *AppUpdate {
_u.mutation.ClearRefundNotifyURL()
return _u
}
// AddChannelIDs adds the "channel" edge to the PayChannel entity by IDs.
func (_u *AppUpdate) AddChannelIDs(ids ...uint64) *AppUpdate {
_u.mutation.AddChannelIDs(ids...)
return _u
}
// AddChannel adds the "channel" edges to the PayChannel entity.
func (_u *AppUpdate) AddChannel(v ...*PayChannel) *AppUpdate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddChannelIDs(ids...)
}
// AddNotifyTaskIDs adds the "notify_task" edge to the PayNotifyTask entity by IDs.
func (_u *AppUpdate) AddNotifyTaskIDs(ids ...uint64) *AppUpdate {
_u.mutation.AddNotifyTaskIDs(ids...)
return _u
}
// AddNotifyTask adds the "notify_task" edges to the PayNotifyTask entity.
func (_u *AppUpdate) AddNotifyTask(v ...*PayNotifyTask) *AppUpdate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddNotifyTaskIDs(ids...)
}
// Mutation returns the AppMutation object of the builder.
func (_u *AppUpdate) Mutation() *AppMutation {
return _u.mutation
}
// ClearChannel clears all "channel" edges to the PayChannel entity.
func (_u *AppUpdate) ClearChannel() *AppUpdate {
_u.mutation.ClearChannel()
return _u
}
// RemoveChannelIDs removes the "channel" edge to PayChannel entities by IDs.
func (_u *AppUpdate) RemoveChannelIDs(ids ...uint64) *AppUpdate {
_u.mutation.RemoveChannelIDs(ids...)
return _u
}
// RemoveChannel removes "channel" edges to PayChannel entities.
func (_u *AppUpdate) RemoveChannel(v ...*PayChannel) *AppUpdate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveChannelIDs(ids...)
}
// ClearNotifyTask clears all "notify_task" edges to the PayNotifyTask entity.
func (_u *AppUpdate) ClearNotifyTask() *AppUpdate {
_u.mutation.ClearNotifyTask()
return _u
}
// RemoveNotifyTaskIDs removes the "notify_task" edge to PayNotifyTask entities by IDs.
func (_u *AppUpdate) RemoveNotifyTaskIDs(ids ...uint64) *AppUpdate {
_u.mutation.RemoveNotifyTaskIDs(ids...)
return _u
}
// RemoveNotifyTask removes "notify_task" edges to PayNotifyTask entities.
func (_u *AppUpdate) RemoveNotifyTask(v ...*PayNotifyTask) *AppUpdate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveNotifyTaskIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *AppUpdate) Save(ctx context.Context) (int, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *AppUpdate) SaveX(ctx context.Context) int {
affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (_u *AppUpdate) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *AppUpdate) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *AppUpdate) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := app.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
func (_u *AppUpdate) sqlSave(ctx context.Context) (_node int, err error) {
_spec := sqlgraph.NewUpdateSpec(app.Table, app.Columns, sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(app.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(app.FieldStatus, field.TypeUint8, value)
}
if value, ok := _u.mutation.AddedStatus(); ok {
_spec.AddField(app.FieldStatus, field.TypeUint8, value)
}
if _u.mutation.StatusCleared() {
_spec.ClearField(app.FieldStatus, field.TypeUint8)
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(app.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(app.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.AppKey(); ok {
_spec.SetField(app.FieldAppKey, field.TypeString, value)
}
if value, ok := _u.mutation.AppName(); ok {
_spec.SetField(app.FieldAppName, field.TypeString, value)
}
if value, ok := _u.mutation.OrderNotifyURL(); ok {
_spec.SetField(app.FieldOrderNotifyURL, field.TypeString, value)
}
if _u.mutation.OrderNotifyURLCleared() {
_spec.ClearField(app.FieldOrderNotifyURL, field.TypeString)
}
if value, ok := _u.mutation.RefundNotifyURL(); ok {
_spec.SetField(app.FieldRefundNotifyURL, field.TypeString, value)
}
if _u.mutation.RefundNotifyURLCleared() {
_spec.ClearField(app.FieldRefundNotifyURL, field.TypeString)
}
if _u.mutation.ChannelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.ChannelTable,
Columns: []string{app.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedChannelIDs(); len(nodes) > 0 && !_u.mutation.ChannelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.ChannelTable,
Columns: []string{app.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ChannelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.ChannelTable,
Columns: []string{app.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.NotifyTaskCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.NotifyTaskTable,
Columns: []string{app.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedNotifyTaskIDs(); len(nodes) > 0 && !_u.mutation.NotifyTaskCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.NotifyTaskTable,
Columns: []string{app.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.NotifyTaskIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.NotifyTaskTable,
Columns: []string{app.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{app.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
_u.mutation.done = true
return _node, nil
}
// AppUpdateOne is the builder for updating a single App entity.
type AppUpdateOne struct {
config
fields []string
hooks []Hook
mutation *AppMutation
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *AppUpdateOne) SetUpdatedAt(v time.Time) *AppUpdateOne {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetStatus sets the "status" field.
func (_u *AppUpdateOne) SetStatus(v uint8) *AppUpdateOne {
_u.mutation.ResetStatus()
_u.mutation.SetStatus(v)
return _u
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_u *AppUpdateOne) SetNillableStatus(v *uint8) *AppUpdateOne {
if v != nil {
_u.SetStatus(*v)
}
return _u
}
// AddStatus adds value to the "status" field.
func (_u *AppUpdateOne) AddStatus(v int8) *AppUpdateOne {
_u.mutation.AddStatus(v)
return _u
}
// ClearStatus clears the value of the "status" field.
func (_u *AppUpdateOne) ClearStatus() *AppUpdateOne {
_u.mutation.ClearStatus()
return _u
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *AppUpdateOne) SetDeletedAt(v time.Time) *AppUpdateOne {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *AppUpdateOne) SetNillableDeletedAt(v *time.Time) *AppUpdateOne {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *AppUpdateOne) ClearDeletedAt() *AppUpdateOne {
_u.mutation.ClearDeletedAt()
return _u
}
// SetAppKey sets the "app_key" field.
func (_u *AppUpdateOne) SetAppKey(v string) *AppUpdateOne {
_u.mutation.SetAppKey(v)
return _u
}
// SetNillableAppKey sets the "app_key" field if the given value is not nil.
func (_u *AppUpdateOne) SetNillableAppKey(v *string) *AppUpdateOne {
if v != nil {
_u.SetAppKey(*v)
}
return _u
}
// SetAppName sets the "app_name" field.
func (_u *AppUpdateOne) SetAppName(v string) *AppUpdateOne {
_u.mutation.SetAppName(v)
return _u
}
// SetNillableAppName sets the "app_name" field if the given value is not nil.
func (_u *AppUpdateOne) SetNillableAppName(v *string) *AppUpdateOne {
if v != nil {
_u.SetAppName(*v)
}
return _u
}
// SetOrderNotifyURL sets the "order_notify_url" field.
func (_u *AppUpdateOne) SetOrderNotifyURL(v string) *AppUpdateOne {
_u.mutation.SetOrderNotifyURL(v)
return _u
}
// SetNillableOrderNotifyURL sets the "order_notify_url" field if the given value is not nil.
func (_u *AppUpdateOne) SetNillableOrderNotifyURL(v *string) *AppUpdateOne {
if v != nil {
_u.SetOrderNotifyURL(*v)
}
return _u
}
// ClearOrderNotifyURL clears the value of the "order_notify_url" field.
func (_u *AppUpdateOne) ClearOrderNotifyURL() *AppUpdateOne {
_u.mutation.ClearOrderNotifyURL()
return _u
}
// SetRefundNotifyURL sets the "refund_notify_url" field.
func (_u *AppUpdateOne) SetRefundNotifyURL(v string) *AppUpdateOne {
_u.mutation.SetRefundNotifyURL(v)
return _u
}
// SetNillableRefundNotifyURL sets the "refund_notify_url" field if the given value is not nil.
func (_u *AppUpdateOne) SetNillableRefundNotifyURL(v *string) *AppUpdateOne {
if v != nil {
_u.SetRefundNotifyURL(*v)
}
return _u
}
// ClearRefundNotifyURL clears the value of the "refund_notify_url" field.
func (_u *AppUpdateOne) ClearRefundNotifyURL() *AppUpdateOne {
_u.mutation.ClearRefundNotifyURL()
return _u
}
// AddChannelIDs adds the "channel" edge to the PayChannel entity by IDs.
func (_u *AppUpdateOne) AddChannelIDs(ids ...uint64) *AppUpdateOne {
_u.mutation.AddChannelIDs(ids...)
return _u
}
// AddChannel adds the "channel" edges to the PayChannel entity.
func (_u *AppUpdateOne) AddChannel(v ...*PayChannel) *AppUpdateOne {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddChannelIDs(ids...)
}
// AddNotifyTaskIDs adds the "notify_task" edge to the PayNotifyTask entity by IDs.
func (_u *AppUpdateOne) AddNotifyTaskIDs(ids ...uint64) *AppUpdateOne {
_u.mutation.AddNotifyTaskIDs(ids...)
return _u
}
// AddNotifyTask adds the "notify_task" edges to the PayNotifyTask entity.
func (_u *AppUpdateOne) AddNotifyTask(v ...*PayNotifyTask) *AppUpdateOne {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddNotifyTaskIDs(ids...)
}
// Mutation returns the AppMutation object of the builder.
func (_u *AppUpdateOne) Mutation() *AppMutation {
return _u.mutation
}
// ClearChannel clears all "channel" edges to the PayChannel entity.
func (_u *AppUpdateOne) ClearChannel() *AppUpdateOne {
_u.mutation.ClearChannel()
return _u
}
// RemoveChannelIDs removes the "channel" edge to PayChannel entities by IDs.
func (_u *AppUpdateOne) RemoveChannelIDs(ids ...uint64) *AppUpdateOne {
_u.mutation.RemoveChannelIDs(ids...)
return _u
}
// RemoveChannel removes "channel" edges to PayChannel entities.
func (_u *AppUpdateOne) RemoveChannel(v ...*PayChannel) *AppUpdateOne {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveChannelIDs(ids...)
}
// ClearNotifyTask clears all "notify_task" edges to the PayNotifyTask entity.
func (_u *AppUpdateOne) ClearNotifyTask() *AppUpdateOne {
_u.mutation.ClearNotifyTask()
return _u
}
// RemoveNotifyTaskIDs removes the "notify_task" edge to PayNotifyTask entities by IDs.
func (_u *AppUpdateOne) RemoveNotifyTaskIDs(ids ...uint64) *AppUpdateOne {
_u.mutation.RemoveNotifyTaskIDs(ids...)
return _u
}
// RemoveNotifyTask removes "notify_task" edges to PayNotifyTask entities.
func (_u *AppUpdateOne) RemoveNotifyTask(v ...*PayNotifyTask) *AppUpdateOne {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveNotifyTaskIDs(ids...)
}
// Where appends a list predicates to the AppUpdate builder.
func (_u *AppUpdateOne) Where(ps ...predicate.App) *AppUpdateOne {
_u.mutation.Where(ps...)
return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (_u *AppUpdateOne) Select(field string, fields ...string) *AppUpdateOne {
_u.fields = append([]string{field}, fields...)
return _u
}
// Save executes the query and returns the updated App entity.
func (_u *AppUpdateOne) Save(ctx context.Context) (*App, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *AppUpdateOne) SaveX(ctx context.Context) *App {
node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (_u *AppUpdateOne) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *AppUpdateOne) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *AppUpdateOne) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := app.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
func (_u *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) {
_spec := sqlgraph.NewUpdateSpec(app.Table, app.Columns, sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64))
id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "App.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, app.FieldID)
for _, f := range fields {
if !app.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != app.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(app.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(app.FieldStatus, field.TypeUint8, value)
}
if value, ok := _u.mutation.AddedStatus(); ok {
_spec.AddField(app.FieldStatus, field.TypeUint8, value)
}
if _u.mutation.StatusCleared() {
_spec.ClearField(app.FieldStatus, field.TypeUint8)
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(app.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(app.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.AppKey(); ok {
_spec.SetField(app.FieldAppKey, field.TypeString, value)
}
if value, ok := _u.mutation.AppName(); ok {
_spec.SetField(app.FieldAppName, field.TypeString, value)
}
if value, ok := _u.mutation.OrderNotifyURL(); ok {
_spec.SetField(app.FieldOrderNotifyURL, field.TypeString, value)
}
if _u.mutation.OrderNotifyURLCleared() {
_spec.ClearField(app.FieldOrderNotifyURL, field.TypeString)
}
if value, ok := _u.mutation.RefundNotifyURL(); ok {
_spec.SetField(app.FieldRefundNotifyURL, field.TypeString, value)
}
if _u.mutation.RefundNotifyURLCleared() {
_spec.ClearField(app.FieldRefundNotifyURL, field.TypeString)
}
if _u.mutation.ChannelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.ChannelTable,
Columns: []string{app.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedChannelIDs(); len(nodes) > 0 && !_u.mutation.ChannelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.ChannelTable,
Columns: []string{app.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ChannelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.ChannelTable,
Columns: []string{app.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.NotifyTaskCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.NotifyTaskTable,
Columns: []string{app.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedNotifyTaskIDs(); len(nodes) > 0 && !_u.mutation.NotifyTaskCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.NotifyTaskTable,
Columns: []string{app.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.NotifyTaskIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: app.NotifyTaskTable,
Columns: []string{app.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_node = &App{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{app.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
_u.mutation.done = true
return _node, nil
}

1514
rpc/ent/client.go Normal file

File diff suppressed because it is too large Load Diff

620
rpc/ent/ent.go Normal file
View File

@ -0,0 +1,620 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifylog"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
"reflect"
"sync"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
// ent aliases to avoid import conflicts in user's code.
type (
Op = ent.Op
Hook = ent.Hook
Value = ent.Value
Query = ent.Query
QueryContext = ent.QueryContext
Querier = ent.Querier
QuerierFunc = ent.QuerierFunc
Interceptor = ent.Interceptor
InterceptFunc = ent.InterceptFunc
Traverser = ent.Traverser
TraverseFunc = ent.TraverseFunc
Policy = ent.Policy
Mutator = ent.Mutator
Mutation = ent.Mutation
MutateFunc = ent.MutateFunc
)
type clientCtxKey struct{}
// FromContext returns a Client stored inside a context, or nil if there isn't one.
func FromContext(ctx context.Context) *Client {
c, _ := ctx.Value(clientCtxKey{}).(*Client)
return c
}
// NewContext returns a new context with the given Client attached.
func NewContext(parent context.Context, c *Client) context.Context {
return context.WithValue(parent, clientCtxKey{}, c)
}
type txCtxKey struct{}
// TxFromContext returns a Tx stored inside a context, or nil if there isn't one.
func TxFromContext(ctx context.Context) *Tx {
tx, _ := ctx.Value(txCtxKey{}).(*Tx)
return tx
}
// NewTxContext returns a new context with the given Tx attached.
func NewTxContext(parent context.Context, tx *Tx) context.Context {
return context.WithValue(parent, txCtxKey{}, tx)
}
// OrderFunc applies an ordering on the sql selector.
// Deprecated: Use Asc/Desc functions or the package builders instead.
type OrderFunc func(*sql.Selector)
var (
initCheck sync.Once
columnCheck sql.ColumnCheck
)
// checkColumn checks if the column exists in the given table.
func checkColumn(t, c string) error {
initCheck.Do(func() {
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
app.Table: app.ValidColumn,
paychannel.Table: paychannel.ValidColumn,
paynotifylog.Table: paynotifylog.ValidColumn,
paynotifytask.Table: paynotifytask.ValidColumn,
payorder.Table: payorder.ValidColumn,
payorderextension.Table: payorderextension.ValidColumn,
payrefund.Table: payrefund.ValidColumn,
})
})
return columnCheck(t, c)
}
// Asc applies the given fields in ASC order.
func Asc(fields ...string) func(*sql.Selector) {
return func(s *sql.Selector) {
for _, f := range fields {
if err := checkColumn(s.TableName(), f); err != nil {
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
}
s.OrderBy(sql.Asc(s.C(f)))
}
}
}
// Desc applies the given fields in DESC order.
func Desc(fields ...string) func(*sql.Selector) {
return func(s *sql.Selector) {
for _, f := range fields {
if err := checkColumn(s.TableName(), f); err != nil {
s.AddError(&ValidationError{Name: f, err: fmt.Errorf("ent: %w", err)})
}
s.OrderBy(sql.Desc(s.C(f)))
}
}
}
// AggregateFunc applies an aggregation step on the group-by traversal/selector.
type AggregateFunc func(*sql.Selector) string
// As is a pseudo aggregation function for renaming another other functions with custom names. For example:
//
// GroupBy(field1, field2).
// Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
// Scan(ctx, &v)
func As(fn AggregateFunc, end string) AggregateFunc {
return func(s *sql.Selector) string {
return sql.As(fn(s), end)
}
}
// Count applies the "count" aggregation function on each group.
func Count() AggregateFunc {
return func(s *sql.Selector) string {
return sql.Count("*")
}
}
// Max applies the "max" aggregation function on the given field of each group.
func Max(field string) AggregateFunc {
return func(s *sql.Selector) string {
if err := checkColumn(s.TableName(), field); err != nil {
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
return ""
}
return sql.Max(s.C(field))
}
}
// Mean applies the "mean" aggregation function on the given field of each group.
func Mean(field string) AggregateFunc {
return func(s *sql.Selector) string {
if err := checkColumn(s.TableName(), field); err != nil {
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
return ""
}
return sql.Avg(s.C(field))
}
}
// Min applies the "min" aggregation function on the given field of each group.
func Min(field string) AggregateFunc {
return func(s *sql.Selector) string {
if err := checkColumn(s.TableName(), field); err != nil {
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
return ""
}
return sql.Min(s.C(field))
}
}
// Sum applies the "sum" aggregation function on the given field of each group.
func Sum(field string) AggregateFunc {
return func(s *sql.Selector) string {
if err := checkColumn(s.TableName(), field); err != nil {
s.AddError(&ValidationError{Name: field, err: fmt.Errorf("ent: %w", err)})
return ""
}
return sql.Sum(s.C(field))
}
}
// ValidationError returns when validating a field or edge fails.
type ValidationError struct {
Name string // Field or edge name.
err error
}
// Error implements the error interface.
func (e *ValidationError) Error() string {
return e.err.Error()
}
// Unwrap implements the errors.Wrapper interface.
func (e *ValidationError) Unwrap() error {
return e.err
}
// IsValidationError returns a boolean indicating whether the error is a validation error.
func IsValidationError(err error) bool {
if err == nil {
return false
}
var e *ValidationError
return errors.As(err, &e)
}
// NotFoundError returns when trying to fetch a specific entity and it was not found in the database.
type NotFoundError struct {
label string
}
// Error implements the error interface.
func (e *NotFoundError) Error() string {
return "ent: " + e.label + " not found"
}
// IsNotFound returns a boolean indicating whether the error is a not found error.
func IsNotFound(err error) bool {
if err == nil {
return false
}
var e *NotFoundError
return errors.As(err, &e)
}
// MaskNotFound masks not found error.
func MaskNotFound(err error) error {
if IsNotFound(err) {
return nil
}
return err
}
// NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.
type NotSingularError struct {
label string
}
// Error implements the error interface.
func (e *NotSingularError) Error() string {
return "ent: " + e.label + " not singular"
}
// IsNotSingular returns a boolean indicating whether the error is a not singular error.
func IsNotSingular(err error) bool {
if err == nil {
return false
}
var e *NotSingularError
return errors.As(err, &e)
}
// NotLoadedError returns when trying to get a node that was not loaded by the query.
type NotLoadedError struct {
edge string
}
// Error implements the error interface.
func (e *NotLoadedError) Error() string {
return "ent: " + e.edge + " edge was not loaded"
}
// IsNotLoaded returns a boolean indicating whether the error is a not loaded error.
func IsNotLoaded(err error) bool {
if err == nil {
return false
}
var e *NotLoadedError
return errors.As(err, &e)
}
// ConstraintError returns when trying to create/update one or more entities and
// one or more of their constraints failed. For example, violation of edge or
// field uniqueness.
type ConstraintError struct {
msg string
wrap error
}
// Error implements the error interface.
func (e ConstraintError) Error() string {
return "ent: constraint failed: " + e.msg
}
// Unwrap implements the errors.Wrapper interface.
func (e *ConstraintError) Unwrap() error {
return e.wrap
}
// IsConstraintError returns a boolean indicating whether the error is a constraint failure.
func IsConstraintError(err error) bool {
if err == nil {
return false
}
var e *ConstraintError
return errors.As(err, &e)
}
// selector embedded by the different Select/GroupBy builders.
type selector struct {
label string
flds *[]string
fns []AggregateFunc
scan func(context.Context, any) error
}
// ScanX is like Scan, but panics if an error occurs.
func (s *selector) ScanX(ctx context.Context, v any) {
if err := s.scan(ctx, v); err != nil {
panic(err)
}
}
// Strings returns list of strings from a selector. It is only allowed when selecting one field.
func (s *selector) Strings(ctx context.Context) ([]string, error) {
if len(*s.flds) > 1 {
return nil, errors.New("ent: Strings is not achievable when selecting more than 1 field")
}
var v []string
if err := s.scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// StringsX is like Strings, but panics if an error occurs.
func (s *selector) StringsX(ctx context.Context) []string {
v, err := s.Strings(ctx)
if err != nil {
panic(err)
}
return v
}
// String returns a single string from a selector. It is only allowed when selecting one field.
func (s *selector) String(ctx context.Context) (_ string, err error) {
var v []string
if v, err = s.Strings(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{s.label}
default:
err = fmt.Errorf("ent: Strings returned %d results when one was expected", len(v))
}
return
}
// StringX is like String, but panics if an error occurs.
func (s *selector) StringX(ctx context.Context) string {
v, err := s.String(ctx)
if err != nil {
panic(err)
}
return v
}
// Ints returns list of ints from a selector. It is only allowed when selecting one field.
func (s *selector) Ints(ctx context.Context) ([]int, error) {
if len(*s.flds) > 1 {
return nil, errors.New("ent: Ints is not achievable when selecting more than 1 field")
}
var v []int
if err := s.scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// IntsX is like Ints, but panics if an error occurs.
func (s *selector) IntsX(ctx context.Context) []int {
v, err := s.Ints(ctx)
if err != nil {
panic(err)
}
return v
}
// Int returns a single int from a selector. It is only allowed when selecting one field.
func (s *selector) Int(ctx context.Context) (_ int, err error) {
var v []int
if v, err = s.Ints(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{s.label}
default:
err = fmt.Errorf("ent: Ints returned %d results when one was expected", len(v))
}
return
}
// IntX is like Int, but panics if an error occurs.
func (s *selector) IntX(ctx context.Context) int {
v, err := s.Int(ctx)
if err != nil {
panic(err)
}
return v
}
// Float64s returns list of float64s from a selector. It is only allowed when selecting one field.
func (s *selector) Float64s(ctx context.Context) ([]float64, error) {
if len(*s.flds) > 1 {
return nil, errors.New("ent: Float64s is not achievable when selecting more than 1 field")
}
var v []float64
if err := s.scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// Float64sX is like Float64s, but panics if an error occurs.
func (s *selector) Float64sX(ctx context.Context) []float64 {
v, err := s.Float64s(ctx)
if err != nil {
panic(err)
}
return v
}
// Float64 returns a single float64 from a selector. It is only allowed when selecting one field.
func (s *selector) Float64(ctx context.Context) (_ float64, err error) {
var v []float64
if v, err = s.Float64s(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{s.label}
default:
err = fmt.Errorf("ent: Float64s returned %d results when one was expected", len(v))
}
return
}
// Float64X is like Float64, but panics if an error occurs.
func (s *selector) Float64X(ctx context.Context) float64 {
v, err := s.Float64(ctx)
if err != nil {
panic(err)
}
return v
}
// Bools returns list of bools from a selector. It is only allowed when selecting one field.
func (s *selector) Bools(ctx context.Context) ([]bool, error) {
if len(*s.flds) > 1 {
return nil, errors.New("ent: Bools is not achievable when selecting more than 1 field")
}
var v []bool
if err := s.scan(ctx, &v); err != nil {
return nil, err
}
return v, nil
}
// BoolsX is like Bools, but panics if an error occurs.
func (s *selector) BoolsX(ctx context.Context) []bool {
v, err := s.Bools(ctx)
if err != nil {
panic(err)
}
return v
}
// Bool returns a single bool from a selector. It is only allowed when selecting one field.
func (s *selector) Bool(ctx context.Context) (_ bool, err error) {
var v []bool
if v, err = s.Bools(ctx); err != nil {
return
}
switch len(v) {
case 1:
return v[0], nil
case 0:
err = &NotFoundError{s.label}
default:
err = fmt.Errorf("ent: Bools returned %d results when one was expected", len(v))
}
return
}
// BoolX is like Bool, but panics if an error occurs.
func (s *selector) BoolX(ctx context.Context) bool {
v, err := s.Bool(ctx)
if err != nil {
panic(err)
}
return v
}
// withHooks invokes the builder operation with the given hooks, if any.
func withHooks[V Value, M any, PM interface {
*M
Mutation
}](ctx context.Context, exec func(context.Context) (V, error), mutation PM, hooks []Hook) (value V, err error) {
if len(hooks) == 0 {
return exec(ctx)
}
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutationT, ok := any(m).(PM)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
// Set the mutation to the builder.
*mutation = *mutationT
return exec(ctx)
})
for i := len(hooks) - 1; i >= 0; i-- {
if hooks[i] == nil {
return value, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
}
mut = hooks[i](mut)
}
v, err := mut.Mutate(ctx, mutation)
if err != nil {
return value, err
}
nv, ok := v.(V)
if !ok {
return value, fmt.Errorf("unexpected node type %T returned from %T", v, mutation)
}
return nv, nil
}
// setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist.
func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context {
if ent.QueryFromContext(ctx) == nil {
qc.Op = op
ctx = ent.NewQueryContext(ctx, qc)
}
return ctx
}
func querierAll[V Value, Q interface {
sqlAll(context.Context, ...queryHook) (V, error)
}]() Querier {
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
query, ok := q.(Q)
if !ok {
return nil, fmt.Errorf("unexpected query type %T", q)
}
return query.sqlAll(ctx)
})
}
func querierCount[Q interface {
sqlCount(context.Context) (int, error)
}]() Querier {
return QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
query, ok := q.(Q)
if !ok {
return nil, fmt.Errorf("unexpected query type %T", q)
}
return query.sqlCount(ctx)
})
}
func withInterceptors[V Value](ctx context.Context, q Query, qr Querier, inters []Interceptor) (v V, err error) {
for i := len(inters) - 1; i >= 0; i-- {
qr = inters[i].Intercept(qr)
}
rv, err := qr.Query(ctx, q)
if err != nil {
return v, err
}
vt, ok := rv.(V)
if !ok {
return v, fmt.Errorf("unexpected type %T returned from %T. expected type: %T", vt, q, v)
}
return vt, nil
}
func scanWithInterceptors[Q1 ent.Query, Q2 interface {
sqlScan(context.Context, Q1, any) error
}](ctx context.Context, rootQuery Q1, selectOrGroup Q2, inters []Interceptor, v any) error {
rv := reflect.ValueOf(v)
var qr Querier = QuerierFunc(func(ctx context.Context, q Query) (Value, error) {
query, ok := q.(Q1)
if !ok {
return nil, fmt.Errorf("unexpected query type %T", q)
}
if err := selectOrGroup.sqlScan(ctx, query, v); err != nil {
return nil, err
}
if k := rv.Kind(); k == reflect.Pointer && rv.Elem().CanInterface() {
return rv.Elem().Interface(), nil
}
return v, nil
})
for i := len(inters) - 1; i >= 0; i-- {
qr = inters[i].Intercept(qr)
}
vv, err := qr.Query(ctx, rootQuery)
if err != nil {
return err
}
switch rv2 := reflect.ValueOf(vv); {
case rv.IsNil(), rv2.IsNil(), rv.Kind() != reflect.Pointer:
case rv.Type() == rv2.Type():
rv.Elem().Set(rv2.Elem())
case rv.Elem().Type() == rv2.Type():
rv.Elem().Set(rv2)
}
return nil
}
// queryHook describes an internal hook for the different sqlAll methods.
type queryHook func(context.Context, *sqlgraph.QuerySpec)

View File

@ -0,0 +1,85 @@
// Code generated by ent, DO NOT EDIT.
package enttest
import (
"context"
"mingyang-admin-pay/rpc/ent"
// required by schema hooks.
_ "mingyang-admin-pay/rpc/ent/runtime"
"mingyang-admin-pay/rpc/ent/migrate"
"entgo.io/ent/dialect/sql/schema"
)
type (
// TestingT is the interface that is shared between
// testing.T and testing.B and used by enttest.
TestingT interface {
FailNow()
Error(...any)
}
// Option configures client creation.
Option func(*options)
options struct {
opts []ent.Option
migrateOpts []schema.MigrateOption
}
)
// WithOptions forwards options to client creation.
func WithOptions(opts ...ent.Option) Option {
return func(o *options) {
o.opts = append(o.opts, opts...)
}
}
// WithMigrateOptions forwards options to auto migration.
func WithMigrateOptions(opts ...schema.MigrateOption) Option {
return func(o *options) {
o.migrateOpts = append(o.migrateOpts, opts...)
}
}
func newOptions(opts []Option) *options {
o := &options{}
for _, opt := range opts {
opt(o)
}
return o
}
// Open calls ent.Open and auto-run migration.
func Open(t TestingT, driverName, dataSourceName string, opts ...Option) *ent.Client {
o := newOptions(opts)
c, err := ent.Open(driverName, dataSourceName, o.opts...)
if err != nil {
t.Error(err)
t.FailNow()
}
migrateSchema(t, c, o)
return c
}
// NewClient calls ent.NewClient and auto-run migration.
func NewClient(t TestingT, opts ...Option) *ent.Client {
o := newOptions(opts)
c := ent.NewClient(o.opts...)
migrateSchema(t, c, o)
return c
}
func migrateSchema(t TestingT, c *ent.Client, o *options) {
tables, err := schema.CopyTables(migrate.Tables)
if err != nil {
t.Error(err)
t.FailNow()
}
if err := migrate.Create(context.Background(), c.Schema, tables, o.migrateOpts...); err != nil {
t.Error(err)
t.FailNow()
}
}

270
rpc/ent/hook/hook.go Normal file
View File

@ -0,0 +1,270 @@
// Code generated by ent, DO NOT EDIT.
package hook
import (
"context"
"fmt"
"mingyang-admin-pay/rpc/ent"
)
// The AppFunc type is an adapter to allow the use of ordinary
// function as App mutator.
type AppFunc func(context.Context, *ent.AppMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f AppFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.AppMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AppMutation", m)
}
// The PayChannelFunc type is an adapter to allow the use of ordinary
// function as PayChannel mutator.
type PayChannelFunc func(context.Context, *ent.PayChannelMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f PayChannelFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.PayChannelMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PayChannelMutation", m)
}
// The PayNotifyLogFunc type is an adapter to allow the use of ordinary
// function as PayNotifyLog mutator.
type PayNotifyLogFunc func(context.Context, *ent.PayNotifyLogMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f PayNotifyLogFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.PayNotifyLogMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PayNotifyLogMutation", m)
}
// The PayNotifyTaskFunc type is an adapter to allow the use of ordinary
// function as PayNotifyTask mutator.
type PayNotifyTaskFunc func(context.Context, *ent.PayNotifyTaskMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f PayNotifyTaskFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.PayNotifyTaskMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PayNotifyTaskMutation", m)
}
// The PayOrderFunc type is an adapter to allow the use of ordinary
// function as PayOrder mutator.
type PayOrderFunc func(context.Context, *ent.PayOrderMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f PayOrderFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.PayOrderMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PayOrderMutation", m)
}
// The PayOrderExtensionFunc type is an adapter to allow the use of ordinary
// function as PayOrderExtension mutator.
type PayOrderExtensionFunc func(context.Context, *ent.PayOrderExtensionMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f PayOrderExtensionFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.PayOrderExtensionMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PayOrderExtensionMutation", m)
}
// The PayRefundFunc type is an adapter to allow the use of ordinary
// function as PayRefund mutator.
type PayRefundFunc func(context.Context, *ent.PayRefundMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f PayRefundFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.PayRefundMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.PayRefundMutation", m)
}
// Condition is a hook condition function.
type Condition func(context.Context, ent.Mutation) bool
// And groups conditions with the AND operator.
func And(first, second Condition, rest ...Condition) Condition {
return func(ctx context.Context, m ent.Mutation) bool {
if !first(ctx, m) || !second(ctx, m) {
return false
}
for _, cond := range rest {
if !cond(ctx, m) {
return false
}
}
return true
}
}
// Or groups conditions with the OR operator.
func Or(first, second Condition, rest ...Condition) Condition {
return func(ctx context.Context, m ent.Mutation) bool {
if first(ctx, m) || second(ctx, m) {
return true
}
for _, cond := range rest {
if cond(ctx, m) {
return true
}
}
return false
}
}
// Not negates a given condition.
func Not(cond Condition) Condition {
return func(ctx context.Context, m ent.Mutation) bool {
return !cond(ctx, m)
}
}
// HasOp is a condition testing mutation operation.
func HasOp(op ent.Op) Condition {
return func(_ context.Context, m ent.Mutation) bool {
return m.Op().Is(op)
}
}
// HasAddedFields is a condition validating `.AddedField` on fields.
func HasAddedFields(field string, fields ...string) Condition {
return func(_ context.Context, m ent.Mutation) bool {
if _, exists := m.AddedField(field); !exists {
return false
}
for _, field := range fields {
if _, exists := m.AddedField(field); !exists {
return false
}
}
return true
}
}
// HasClearedFields is a condition validating `.FieldCleared` on fields.
func HasClearedFields(field string, fields ...string) Condition {
return func(_ context.Context, m ent.Mutation) bool {
if exists := m.FieldCleared(field); !exists {
return false
}
for _, field := range fields {
if exists := m.FieldCleared(field); !exists {
return false
}
}
return true
}
}
// HasFields is a condition validating `.Field` on fields.
func HasFields(field string, fields ...string) Condition {
return func(_ context.Context, m ent.Mutation) bool {
if _, exists := m.Field(field); !exists {
return false
}
for _, field := range fields {
if _, exists := m.Field(field); !exists {
return false
}
}
return true
}
}
// If executes the given hook under condition.
//
// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))
func If(hk ent.Hook, cond Condition) ent.Hook {
return func(next ent.Mutator) ent.Mutator {
return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if cond(ctx, m) {
return hk(next).Mutate(ctx, m)
}
return next.Mutate(ctx, m)
})
}
}
// On executes the given hook only for the given operation.
//
// hook.On(Log, ent.Delete|ent.Create)
func On(hk ent.Hook, op ent.Op) ent.Hook {
return If(hk, HasOp(op))
}
// Unless skips the given hook only for the given operation.
//
// hook.Unless(Log, ent.Update|ent.UpdateOne)
func Unless(hk ent.Hook, op ent.Op) ent.Hook {
return If(hk, Not(HasOp(op)))
}
// FixedError is a hook returning a fixed error.
func FixedError(err error) ent.Hook {
return func(ent.Mutator) ent.Mutator {
return ent.MutateFunc(func(context.Context, ent.Mutation) (ent.Value, error) {
return nil, err
})
}
}
// Reject returns a hook that rejects all operations that match op.
//
// func (T) Hooks() []ent.Hook {
// return []ent.Hook{
// Reject(ent.Delete|ent.Update),
// }
// }
func Reject(op ent.Op) ent.Hook {
hk := FixedError(fmt.Errorf("%s operation is not allowed", op))
return On(hk, op)
}
// Chain acts as a list of hooks and is effectively immutable.
// Once created, it will always hold the same set of hooks in the same order.
type Chain struct {
hooks []ent.Hook
}
// NewChain creates a new chain of hooks.
func NewChain(hooks ...ent.Hook) Chain {
return Chain{append([]ent.Hook(nil), hooks...)}
}
// Hook chains the list of hooks and returns the final hook.
func (c Chain) Hook() ent.Hook {
return func(mutator ent.Mutator) ent.Mutator {
for i := len(c.hooks) - 1; i >= 0; i-- {
mutator = c.hooks[i](mutator)
}
return mutator
}
}
// Append extends a chain, adding the specified hook
// as the last ones in the mutation flow.
func (c Chain) Append(hooks ...ent.Hook) Chain {
newHooks := make([]ent.Hook, 0, len(c.hooks)+len(hooks))
newHooks = append(newHooks, c.hooks...)
newHooks = append(newHooks, hooks...)
return Chain{newHooks}
}
// Extend extends a chain, adding the specified chain
// as the last ones in the mutation flow.
func (c Chain) Extend(chain Chain) Chain {
return c.Append(chain.hooks...)
}

View File

@ -0,0 +1,330 @@
// Code generated by ent, DO NOT EDIT.
package intercept
import (
"context"
"fmt"
"mingyang-admin-pay/rpc/ent"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifylog"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent/dialect/sql"
)
// The Query interface represents an operation that queries a graph.
// By using this interface, users can write generic code that manipulates
// query builders of different types.
type Query interface {
// Type returns the string representation of the query type.
Type() string
// Limit the number of records to be returned by this query.
Limit(int)
// Offset to start from.
Offset(int)
// Unique configures the query builder to filter duplicate records.
Unique(bool)
// Order specifies how the records should be ordered.
Order(...func(*sql.Selector))
// WhereP appends storage-level predicates to the query builder. Using this method, users
// can use type-assertion to append predicates that do not depend on any generated package.
WhereP(...func(*sql.Selector))
}
// The Func type is an adapter that allows ordinary functions to be used as interceptors.
// Unlike traversal functions, interceptors are skipped during graph traversals. Note that the
// implementation of Func is different from the one defined in entgo.io/ent.InterceptFunc.
type Func func(context.Context, Query) error
// Intercept calls f(ctx, q) and then applied the next Querier.
func (f Func) Intercept(next ent.Querier) ent.Querier {
return ent.QuerierFunc(func(ctx context.Context, q ent.Query) (ent.Value, error) {
query, err := NewQuery(q)
if err != nil {
return nil, err
}
if err := f(ctx, query); err != nil {
return nil, err
}
return next.Query(ctx, q)
})
}
// The TraverseFunc type is an adapter to allow the use of ordinary function as Traverser.
// If f is a function with the appropriate signature, TraverseFunc(f) is a Traverser that calls f.
type TraverseFunc func(context.Context, Query) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraverseFunc) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraverseFunc) Traverse(ctx context.Context, q ent.Query) error {
query, err := NewQuery(q)
if err != nil {
return err
}
return f(ctx, query)
}
// The AppFunc type is an adapter to allow the use of ordinary function as a Querier.
type AppFunc func(context.Context, *ent.AppQuery) (ent.Value, error)
// Query calls f(ctx, q).
func (f AppFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
if q, ok := q.(*ent.AppQuery); ok {
return f(ctx, q)
}
return nil, fmt.Errorf("unexpected query type %T. expect *ent.AppQuery", q)
}
// The TraverseApp type is an adapter to allow the use of ordinary function as Traverser.
type TraverseApp func(context.Context, *ent.AppQuery) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraverseApp) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraverseApp) Traverse(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.AppQuery); ok {
return f(ctx, q)
}
return fmt.Errorf("unexpected query type %T. expect *ent.AppQuery", q)
}
// The PayChannelFunc type is an adapter to allow the use of ordinary function as a Querier.
type PayChannelFunc func(context.Context, *ent.PayChannelQuery) (ent.Value, error)
// Query calls f(ctx, q).
func (f PayChannelFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
if q, ok := q.(*ent.PayChannelQuery); ok {
return f(ctx, q)
}
return nil, fmt.Errorf("unexpected query type %T. expect *ent.PayChannelQuery", q)
}
// The TraversePayChannel type is an adapter to allow the use of ordinary function as Traverser.
type TraversePayChannel func(context.Context, *ent.PayChannelQuery) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraversePayChannel) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraversePayChannel) Traverse(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.PayChannelQuery); ok {
return f(ctx, q)
}
return fmt.Errorf("unexpected query type %T. expect *ent.PayChannelQuery", q)
}
// The PayNotifyLogFunc type is an adapter to allow the use of ordinary function as a Querier.
type PayNotifyLogFunc func(context.Context, *ent.PayNotifyLogQuery) (ent.Value, error)
// Query calls f(ctx, q).
func (f PayNotifyLogFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
if q, ok := q.(*ent.PayNotifyLogQuery); ok {
return f(ctx, q)
}
return nil, fmt.Errorf("unexpected query type %T. expect *ent.PayNotifyLogQuery", q)
}
// The TraversePayNotifyLog type is an adapter to allow the use of ordinary function as Traverser.
type TraversePayNotifyLog func(context.Context, *ent.PayNotifyLogQuery) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraversePayNotifyLog) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraversePayNotifyLog) Traverse(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.PayNotifyLogQuery); ok {
return f(ctx, q)
}
return fmt.Errorf("unexpected query type %T. expect *ent.PayNotifyLogQuery", q)
}
// The PayNotifyTaskFunc type is an adapter to allow the use of ordinary function as a Querier.
type PayNotifyTaskFunc func(context.Context, *ent.PayNotifyTaskQuery) (ent.Value, error)
// Query calls f(ctx, q).
func (f PayNotifyTaskFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
if q, ok := q.(*ent.PayNotifyTaskQuery); ok {
return f(ctx, q)
}
return nil, fmt.Errorf("unexpected query type %T. expect *ent.PayNotifyTaskQuery", q)
}
// The TraversePayNotifyTask type is an adapter to allow the use of ordinary function as Traverser.
type TraversePayNotifyTask func(context.Context, *ent.PayNotifyTaskQuery) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraversePayNotifyTask) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraversePayNotifyTask) Traverse(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.PayNotifyTaskQuery); ok {
return f(ctx, q)
}
return fmt.Errorf("unexpected query type %T. expect *ent.PayNotifyTaskQuery", q)
}
// The PayOrderFunc type is an adapter to allow the use of ordinary function as a Querier.
type PayOrderFunc func(context.Context, *ent.PayOrderQuery) (ent.Value, error)
// Query calls f(ctx, q).
func (f PayOrderFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
if q, ok := q.(*ent.PayOrderQuery); ok {
return f(ctx, q)
}
return nil, fmt.Errorf("unexpected query type %T. expect *ent.PayOrderQuery", q)
}
// The TraversePayOrder type is an adapter to allow the use of ordinary function as Traverser.
type TraversePayOrder func(context.Context, *ent.PayOrderQuery) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraversePayOrder) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraversePayOrder) Traverse(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.PayOrderQuery); ok {
return f(ctx, q)
}
return fmt.Errorf("unexpected query type %T. expect *ent.PayOrderQuery", q)
}
// The PayOrderExtensionFunc type is an adapter to allow the use of ordinary function as a Querier.
type PayOrderExtensionFunc func(context.Context, *ent.PayOrderExtensionQuery) (ent.Value, error)
// Query calls f(ctx, q).
func (f PayOrderExtensionFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
if q, ok := q.(*ent.PayOrderExtensionQuery); ok {
return f(ctx, q)
}
return nil, fmt.Errorf("unexpected query type %T. expect *ent.PayOrderExtensionQuery", q)
}
// The TraversePayOrderExtension type is an adapter to allow the use of ordinary function as Traverser.
type TraversePayOrderExtension func(context.Context, *ent.PayOrderExtensionQuery) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraversePayOrderExtension) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraversePayOrderExtension) Traverse(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.PayOrderExtensionQuery); ok {
return f(ctx, q)
}
return fmt.Errorf("unexpected query type %T. expect *ent.PayOrderExtensionQuery", q)
}
// The PayRefundFunc type is an adapter to allow the use of ordinary function as a Querier.
type PayRefundFunc func(context.Context, *ent.PayRefundQuery) (ent.Value, error)
// Query calls f(ctx, q).
func (f PayRefundFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
if q, ok := q.(*ent.PayRefundQuery); ok {
return f(ctx, q)
}
return nil, fmt.Errorf("unexpected query type %T. expect *ent.PayRefundQuery", q)
}
// The TraversePayRefund type is an adapter to allow the use of ordinary function as Traverser.
type TraversePayRefund func(context.Context, *ent.PayRefundQuery) error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func (f TraversePayRefund) Intercept(next ent.Querier) ent.Querier {
return next
}
// Traverse calls f(ctx, q).
func (f TraversePayRefund) Traverse(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.PayRefundQuery); ok {
return f(ctx, q)
}
return fmt.Errorf("unexpected query type %T. expect *ent.PayRefundQuery", q)
}
// NewQuery returns the generic Query interface for the given typed query.
func NewQuery(q ent.Query) (Query, error) {
switch q := q.(type) {
case *ent.AppQuery:
return &query[*ent.AppQuery, predicate.App, app.OrderOption]{typ: ent.TypeApp, tq: q}, nil
case *ent.PayChannelQuery:
return &query[*ent.PayChannelQuery, predicate.PayChannel, paychannel.OrderOption]{typ: ent.TypePayChannel, tq: q}, nil
case *ent.PayNotifyLogQuery:
return &query[*ent.PayNotifyLogQuery, predicate.PayNotifyLog, paynotifylog.OrderOption]{typ: ent.TypePayNotifyLog, tq: q}, nil
case *ent.PayNotifyTaskQuery:
return &query[*ent.PayNotifyTaskQuery, predicate.PayNotifyTask, paynotifytask.OrderOption]{typ: ent.TypePayNotifyTask, tq: q}, nil
case *ent.PayOrderQuery:
return &query[*ent.PayOrderQuery, predicate.PayOrder, payorder.OrderOption]{typ: ent.TypePayOrder, tq: q}, nil
case *ent.PayOrderExtensionQuery:
return &query[*ent.PayOrderExtensionQuery, predicate.PayOrderExtension, payorderextension.OrderOption]{typ: ent.TypePayOrderExtension, tq: q}, nil
case *ent.PayRefundQuery:
return &query[*ent.PayRefundQuery, predicate.PayRefund, payrefund.OrderOption]{typ: ent.TypePayRefund, tq: q}, nil
default:
return nil, fmt.Errorf("unknown query type %T", q)
}
}
type query[T any, P ~func(*sql.Selector), R ~func(*sql.Selector)] struct {
typ string
tq interface {
Limit(int) T
Offset(int) T
Unique(bool) T
Order(...R) T
Where(...P) T
}
}
func (q query[T, P, R]) Type() string {
return q.typ
}
func (q query[T, P, R]) Limit(limit int) {
q.tq.Limit(limit)
}
func (q query[T, P, R]) Offset(offset int) {
q.tq.Offset(offset)
}
func (q query[T, P, R]) Unique(unique bool) {
q.tq.Unique(unique)
}
func (q query[T, P, R]) Order(orders ...func(*sql.Selector)) {
rs := make([]R, len(orders))
for i := range orders {
rs[i] = orders[i]
}
q.tq.Order(rs...)
}
func (q query[T, P, R]) WhereP(ps ...func(*sql.Selector)) {
p := make([]P, len(ps))
for i := range ps {
p[i] = ps[i]
}
q.tq.Where(p...)
}

View File

@ -0,0 +1,64 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"context"
"fmt"
"io"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql/schema"
)
var (
// WithGlobalUniqueID sets the universal ids options to the migration.
// If this option is enabled, ent migration will allocate a 1<<32 range
// for the ids of each entity (table).
// Note that this option cannot be applied on tables that already exist.
WithGlobalUniqueID = schema.WithGlobalUniqueID
// WithDropColumn sets the drop column option to the migration.
// If this option is enabled, ent migration will drop old columns
// that were used for both fields and edges. This defaults to false.
WithDropColumn = schema.WithDropColumn
// WithDropIndex sets the drop index option to the migration.
// If this option is enabled, ent migration will drop old indexes
// that were defined in the schema. This defaults to false.
// Note that unique constraints are defined using `UNIQUE INDEX`,
// and therefore, it's recommended to enable this option to get more
// flexibility in the schema changes.
WithDropIndex = schema.WithDropIndex
// WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true.
WithForeignKeys = schema.WithForeignKeys
)
// Schema is the API for creating, migrating and dropping a schema.
type Schema struct {
drv dialect.Driver
}
// NewSchema creates a new schema client.
func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
// Create creates all schema resources.
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
return Create(ctx, s, Tables, opts...)
}
// Create creates all table resources using the given schema driver.
func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...schema.MigrateOption) error {
migrate, err := schema.NewMigrate(s.drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, tables...)
}
// WriteTo writes the schema changes to w instead of running them against the database.
//
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
// log.Fatal(err)
// }
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
}

409
rpc/ent/migrate/schema.go Normal file
View File

@ -0,0 +1,409 @@
// Code generated by ent, DO NOT EDIT.
package migrate
import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field"
)
var (
// PayAppColumns holds the columns for the "pay_app" table.
PayAppColumns = []*schema.Column{
{Name: "id", Type: field.TypeUint64, Increment: true},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
{Name: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
{Name: "app_key", Type: field.TypeString, Comment: "appKey 应用标识"},
{Name: "app_name", Type: field.TypeString, Comment: "应用名称"},
{Name: "order_notify_url", Type: field.TypeString, Nullable: true, Comment: "支付成功回调地址"},
{Name: "refund_notify_url", Type: field.TypeString, Nullable: true, Comment: "退款成功回调地址"},
}
// PayAppTable holds the schema information for the "pay_app" table.
PayAppTable = &schema.Table{
Name: "pay_app",
Comment: "PayApp Table | 支付应用表",
Columns: PayAppColumns,
PrimaryKey: []*schema.Column{PayAppColumns[0]},
}
// PayChannelColumns holds the columns for the "pay_channel" table.
PayChannelColumns = []*schema.Column{
{Name: "id", Type: field.TypeUint64, Increment: true},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
{Name: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
{Name: "code", Type: field.TypeString, Comment: "Pay channel code | 支付渠道编码"},
{Name: "name_en", Type: field.TypeString, Comment: "Pay channel name | 支付渠道英文名称"},
{Name: "name_zh", Type: field.TypeString, Comment: "Pay channel name | 支付渠道中文名称"},
{Name: "free_rate", Type: field.TypeString, Comment: "Free rate | 手续费比例", Default: "0"},
{Name: "config", Type: field.TypeJSON, Comment: "Config | 配置信息"},
{Name: "remake", Type: field.TypeString, Nullable: true, Comment: "Remark | 备注"},
{Name: "icon", Type: field.TypeUint64, Nullable: true, Comment: "Icon | 图标"},
{Name: "order_time_out", Type: field.TypeString, Comment: "Order time out | 订单超时时间", Default: "10m"},
{Name: "support_currency", Type: field.TypeString, Comment: "Support currency | 支持币种", Default: "CNY,USD"},
{Name: "app_id", Type: field.TypeUint64, Comment: "App ID | 应用ID"},
}
// PayChannelTable holds the schema information for the "pay_channel" table.
PayChannelTable = &schema.Table{
Name: "pay_channel",
Comment: "PayChannel Table | 支付渠道表",
Columns: PayChannelColumns,
PrimaryKey: []*schema.Column{PayChannelColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "pay_channel_pay_app_app",
Columns: []*schema.Column{PayChannelColumns[15]},
RefColumns: []*schema.Column{PayAppColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "paychannel_app_id_code",
Unique: true,
Columns: []*schema.Column{PayChannelColumns[15], PayChannelColumns[6]},
},
},
}
// PayNotifyLogColumns holds the columns for the "pay_notify_log" table.
PayNotifyLogColumns = []*schema.Column{
{Name: "id", Type: field.TypeUint64, Increment: true},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
{Name: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
{Name: "notify_count", Type: field.TypeUint32, Comment: "通知次数 | 通知次数", Default: 0},
{Name: "response", Type: field.TypeString, Nullable: true, Comment: "响应内容 | 响应内容"},
{Name: "notify_status", Type: field.TypeString, Nullable: true, Comment: "通知状态 | 通知状态"},
{Name: "task_id", Type: field.TypeUint64, Comment: "任务ID | 任务ID"},
}
// PayNotifyLogTable holds the schema information for the "pay_notify_log" table.
PayNotifyLogTable = &schema.Table{
Name: "pay_notify_log",
Comment: "PayNotifyLog Table | 异步通知日志表",
Columns: PayNotifyLogColumns,
PrimaryKey: []*schema.Column{PayNotifyLogColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "pay_notify_log_pay_notify_task_task",
Columns: []*schema.Column{PayNotifyLogColumns[9]},
RefColumns: []*schema.Column{PayNotifyTaskColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "paynotifylog_task_id",
Unique: false,
Columns: []*schema.Column{PayNotifyLogColumns[9]},
},
},
}
// PayNotifyTaskColumns holds the columns for the "pay_notify_task" table.
PayNotifyTaskColumns = []*schema.Column{
{Name: "id", Type: field.TypeUint64, Increment: true},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
{Name: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
{Name: "type", Type: field.TypeUint8, Comment: "通知类型", Default: 1},
{Name: "data_id", Type: field.TypeUint64, Comment: "数据 ID"},
{Name: "notify_status", Type: field.TypeUint8, Comment: "通知状态"},
{Name: "next_notify_time", Type: field.TypeTime, Nullable: true, Comment: "下次通知时间"},
{Name: "last_execute_time", Type: field.TypeTime, Nullable: true, Comment: "最后一次执行时间"},
{Name: "retry_count", Type: field.TypeUint32, Nullable: true, Comment: "重试次数"},
{Name: "max_retry_count", Type: field.TypeUint32, Nullable: true, Comment: "最大重试次数"},
{Name: "notify_url", Type: field.TypeString, Nullable: true, Comment: "通知地址"},
{Name: "app_id", Type: field.TypeUint64, Comment: "应用 ID"},
{Name: "order_id", Type: field.TypeUint64, Comment: "订单 ID"},
}
// PayNotifyTaskTable holds the schema information for the "pay_notify_task" table.
PayNotifyTaskTable = &schema.Table{
Name: "pay_notify_task",
Comment: "PayNotifyTask Table | 异步通知任务表",
Columns: PayNotifyTaskColumns,
PrimaryKey: []*schema.Column{PayNotifyTaskColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "pay_notify_task_pay_app_app",
Columns: []*schema.Column{PayNotifyTaskColumns[14]},
RefColumns: []*schema.Column{PayAppColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "pay_notify_task_pay_order_order",
Columns: []*schema.Column{PayNotifyTaskColumns[15]},
RefColumns: []*schema.Column{PayOrderColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "paynotifytask_order_id",
Unique: false,
Columns: []*schema.Column{PayNotifyTaskColumns[15]},
},
{
Name: "paynotifytask_data_id",
Unique: false,
Columns: []*schema.Column{PayNotifyTaskColumns[7]},
},
},
}
// PayOrderColumns holds the columns for the "pay_order" table.
PayOrderColumns = []*schema.Column{
{Name: "id", Type: field.TypeUint64, Increment: true},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
{Name: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
{Name: "user_id", Type: field.TypeUint64, Comment: "用户 ID"},
{Name: "subject", Type: field.TypeString, Comment: "商品标题"},
{Name: "body", Type: field.TypeString, Comment: "商品描述"},
{Name: "notify_url", Type: field.TypeString, Comment: "异步通知地址"},
{Name: "amount", Type: field.TypeUint64, Comment: "金额,单位为分", Default: 0},
{Name: "pay_source", Type: field.TypeString, Nullable: true, Comment: "支付来源"},
{Name: "channel_fee_rate", Type: field.TypeString, Comment: "本次渠道费率,百分比", Default: "0.00"},
{Name: "channel_fee", Type: field.TypeUint64, Comment: "本次渠道实际收取费y", Default: 0},
{Name: "order_status", Type: field.TypeString, Comment: "订单状态", Default: "WAIT"},
{Name: "user_ip", Type: field.TypeString, Nullable: true, Comment: "用户 IP"},
{Name: "expire_time", Type: field.TypeTime, Comment: "订单过期时间"},
{Name: "pay_no", Type: field.TypeString, Comment: "支付单号"},
{Name: "success_time", Type: field.TypeTime, Comment: "订单支付成功时间"},
{Name: "extension_id", Type: field.TypeUint64, Nullable: true, Comment: "支付成功的订单拓展单ID"},
{Name: "transaction_id", Type: field.TypeString, Nullable: true, Comment: "交易流水号,有一些平台可能会有"},
{Name: "currency", Type: field.TypeString, Comment: "货币代码", Default: "USD"},
{Name: "refund_price", Type: field.TypeUint64, Comment: "退款金额,单位为分", Default: 0},
{Name: "channel_order_no", Type: field.TypeString, Nullable: true, Comment: "渠道订单号"},
{Name: "channel_user_id", Type: field.TypeString, Nullable: true, Comment: "渠道用户 ID"},
{Name: "channel_id", Type: field.TypeUint64, Comment: "支付渠道 ID"},
}
// PayOrderTable holds the schema information for the "pay_order" table.
PayOrderTable = &schema.Table{
Name: "pay_order",
Comment: "PayOrder Table | 支付订单表",
Columns: PayOrderColumns,
PrimaryKey: []*schema.Column{PayOrderColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "pay_order_pay_channel_channel",
Columns: []*schema.Column{PayOrderColumns[25]},
RefColumns: []*schema.Column{PayChannelColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "payorder_extension_id",
Unique: false,
Columns: []*schema.Column{PayOrderColumns[19]},
},
{
Name: "payorder_channel_order_no",
Unique: true,
Columns: []*schema.Column{PayOrderColumns[23]},
},
{
Name: "payorder_pay_no",
Unique: true,
Columns: []*schema.Column{PayOrderColumns[17]},
},
{
Name: "payorder_transaction_id",
Unique: false,
Columns: []*schema.Column{PayOrderColumns[20]},
},
{
Name: "payorder_user_id",
Unique: false,
Columns: []*schema.Column{PayOrderColumns[6]},
},
{
Name: "payorder_channel_id",
Unique: false,
Columns: []*schema.Column{PayOrderColumns[25]},
},
{
Name: "payorder_order_status",
Unique: false,
Columns: []*schema.Column{PayOrderColumns[14]},
},
},
}
// PayOrderExtensionColumns holds the columns for the "pay_order_extension" table.
PayOrderExtensionColumns = []*schema.Column{
{Name: "id", Type: field.TypeUint64, Increment: true},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
{Name: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
{Name: "channel_extras", Type: field.TypeJSON, Nullable: true, Comment: "Channel Extras | 渠道参数"},
{Name: "channel_error_code", Type: field.TypeString, Nullable: true, Comment: "Channel Error Code | 渠道错误码"},
{Name: "channel_error_msg", Type: field.TypeString, Nullable: true, Comment: "Channel Error Msg | 渠道错误信息"},
{Name: "channel_notify_data", Type: field.TypeString, Nullable: true, Comment: "Channel Notify Data | 渠道回调数据"},
{Name: "channel_id", Type: field.TypeUint64, Comment: "Channel ID | 渠道ID"},
{Name: "order_id", Type: field.TypeUint64, Comment: "Order ID | 订单ID"},
}
// PayOrderExtensionTable holds the schema information for the "pay_order_extension" table.
PayOrderExtensionTable = &schema.Table{
Name: "pay_order_extension",
Comment: "PayOrderExtension Table | 支付订单拓展表",
Columns: PayOrderExtensionColumns,
PrimaryKey: []*schema.Column{PayOrderExtensionColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "pay_order_extension_pay_channel_channel",
Columns: []*schema.Column{PayOrderExtensionColumns[10]},
RefColumns: []*schema.Column{PayChannelColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "pay_order_extension_pay_order_order",
Columns: []*schema.Column{PayOrderExtensionColumns[11]},
RefColumns: []*schema.Column{PayOrderColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "payorderextension_order_id",
Unique: false,
Columns: []*schema.Column{PayOrderExtensionColumns[11]},
},
{
Name: "payorderextension_channel_id",
Unique: false,
Columns: []*schema.Column{PayOrderExtensionColumns[10]},
},
},
}
// PayRefundColumns holds the columns for the "pay_refund" table.
PayRefundColumns = []*schema.Column{
{Name: "id", Type: field.TypeUint64, Increment: true},
{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
{Name: "tenant_id", Type: field.TypeUint64, Comment: "Tenant ID | 租户 ID", Default: 1},
{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
{Name: "user_id", Type: field.TypeUint64, Comment: "用户 ID"},
{Name: "notify_url", Type: field.TypeString, Nullable: true, Comment: "回调地址"},
{Name: "refund_status", Type: field.TypeUint8, Comment: "退款状态", Default: 0},
{Name: "refund_amount", Type: field.TypeUint64, Comment: "退款金额", Default: 0},
{Name: "pay_amount", Type: field.TypeUint64, Comment: "支付金额", Default: 0},
{Name: "refund_no", Type: field.TypeString, Comment: "退款单号"},
{Name: "refund_reason", Type: field.TypeString, Comment: "退款原因"},
{Name: "user_ip", Type: field.TypeString, Nullable: true, Comment: "用户 IP"},
{Name: "channel_refund_no", Type: field.TypeString, Comment: "渠道退款单号"},
{Name: "refund_time", Type: field.TypeTime, Comment: "退款成功时间"},
{Name: "channel_error_code", Type: field.TypeString, Nullable: true, Comment: "渠道错误码"},
{Name: "channel_error_msg", Type: field.TypeString, Nullable: true, Comment: "渠道错误信息"},
{Name: "channel_notify_data", Type: field.TypeString, Nullable: true, Comment: "渠道回调数据"},
{Name: "order_id", Type: field.TypeUint64, Comment: "订单 ID"},
{Name: "channel_id", Type: field.TypeUint64, Comment: "支付渠道 ID"},
}
// PayRefundTable holds the schema information for the "pay_refund" table.
PayRefundTable = &schema.Table{
Name: "pay_refund",
Comment: "PayRefund Table | 退款订单表",
Columns: PayRefundColumns,
PrimaryKey: []*schema.Column{PayRefundColumns[0]},
ForeignKeys: []*schema.ForeignKey{
{
Symbol: "pay_refund_pay_order_order",
Columns: []*schema.Column{PayRefundColumns[19]},
RefColumns: []*schema.Column{PayOrderColumns[0]},
OnDelete: schema.NoAction,
},
{
Symbol: "pay_refund_pay_channel_channel",
Columns: []*schema.Column{PayRefundColumns[20]},
RefColumns: []*schema.Column{PayChannelColumns[0]},
OnDelete: schema.NoAction,
},
},
Indexes: []*schema.Index{
{
Name: "payrefund_user_id",
Unique: false,
Columns: []*schema.Column{PayRefundColumns[6]},
},
{
Name: "payrefund_order_id",
Unique: false,
Columns: []*schema.Column{PayRefundColumns[19]},
},
{
Name: "payrefund_channel_id",
Unique: false,
Columns: []*schema.Column{PayRefundColumns[20]},
},
{
Name: "payrefund_refund_status",
Unique: false,
Columns: []*schema.Column{PayRefundColumns[8]},
},
{
Name: "payrefund_refund_no",
Unique: false,
Columns: []*schema.Column{PayRefundColumns[11]},
},
{
Name: "payrefund_channel_refund_no",
Unique: false,
Columns: []*schema.Column{PayRefundColumns[14]},
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
PayAppTable,
PayChannelTable,
PayNotifyLogTable,
PayNotifyTaskTable,
PayOrderTable,
PayOrderExtensionTable,
PayRefundTable,
}
)
func init() {
PayAppTable.Annotation = &entsql.Annotation{
Table: "pay_app",
}
PayChannelTable.ForeignKeys[0].RefTable = PayAppTable
PayChannelTable.Annotation = &entsql.Annotation{
Table: "pay_channel",
}
PayNotifyLogTable.ForeignKeys[0].RefTable = PayNotifyTaskTable
PayNotifyLogTable.Annotation = &entsql.Annotation{
Table: "pay_notify_log",
}
PayNotifyTaskTable.ForeignKeys[0].RefTable = PayAppTable
PayNotifyTaskTable.ForeignKeys[1].RefTable = PayOrderTable
PayNotifyTaskTable.Annotation = &entsql.Annotation{
Table: "pay_notify_task",
}
PayOrderTable.ForeignKeys[0].RefTable = PayChannelTable
PayOrderTable.Annotation = &entsql.Annotation{
Table: "pay_order",
}
PayOrderExtensionTable.ForeignKeys[0].RefTable = PayChannelTable
PayOrderExtensionTable.ForeignKeys[1].RefTable = PayOrderTable
PayOrderExtensionTable.Annotation = &entsql.Annotation{
Table: "pay_order_extension",
}
PayRefundTable.ForeignKeys[0].RefTable = PayOrderTable
PayRefundTable.ForeignKeys[1].RefTable = PayChannelTable
PayRefundTable.Annotation = &entsql.Annotation{
Table: "pay_refund",
}
}

10630
rpc/ent/mutation.go Normal file

File diff suppressed because it is too large Load Diff

628
rpc/ent/pagination.go Normal file
View File

@ -0,0 +1,628 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"fmt"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifylog"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
)
const errInvalidPage = "INVALID_PAGE"
const (
listField = "list"
pageNumField = "pageNum"
pageSizeField = "pageSize"
)
type PageDetails struct {
Page uint64 `json:"page"`
Size uint64 `json:"size"`
Total uint64 `json:"total"`
}
// OrderDirection defines the directions in which to order a list of items.
type OrderDirection string
const (
// OrderDirectionAsc specifies an ascending order.
OrderDirectionAsc OrderDirection = "ASC"
// OrderDirectionDesc specifies a descending order.
OrderDirectionDesc OrderDirection = "DESC"
)
// Validate the order direction value.
func (o OrderDirection) Validate() error {
if o != OrderDirectionAsc && o != OrderDirectionDesc {
return fmt.Errorf("%s is not a valid OrderDirection", o)
}
return nil
}
// String implements fmt.Stringer interface.
func (o OrderDirection) String() string {
return string(o)
}
func (o OrderDirection) reverse() OrderDirection {
if o == OrderDirectionDesc {
return OrderDirectionAsc
}
return OrderDirectionDesc
}
const errInvalidPagination = "INVALID_PAGINATION"
type AppPager struct {
Order app.OrderOption
Filter func(*AppQuery) (*AppQuery, error)
}
// AppPaginateOption enables pagination customization.
type AppPaginateOption func(*AppPager)
// DefaultAppOrder is the default ordering of App.
var DefaultAppOrder = Desc(app.FieldID)
func newAppPager(opts []AppPaginateOption) (*AppPager, error) {
pager := &AppPager{}
for _, opt := range opts {
opt(pager)
}
if pager.Order == nil {
pager.Order = DefaultAppOrder
}
return pager, nil
}
func (p *AppPager) ApplyFilter(query *AppQuery) (*AppQuery, error) {
if p.Filter != nil {
return p.Filter(query)
}
return query, nil
}
// AppPageList is App PageList result.
type AppPageList struct {
List []*App `json:"list"`
PageDetails *PageDetails `json:"pageDetails"`
}
func (_m *AppQuery) Page(
ctx context.Context, pageNum uint64, pageSize uint64, opts ...AppPaginateOption,
) (*AppPageList, error) {
pager, err := newAppPager(opts)
if err != nil {
return nil, err
}
if _m, err = pager.ApplyFilter(_m); err != nil {
return nil, err
}
ret := &AppPageList{}
ret.PageDetails = &PageDetails{
Page: pageNum,
Size: pageSize,
}
query := _m.Clone()
query.ctx.Fields = nil
count, err := query.Count(ctx)
if err != nil {
return nil, err
}
ret.PageDetails.Total = uint64(count)
if pager.Order != nil {
_m = _m.Order(pager.Order)
} else {
_m = _m.Order(DefaultAppOrder)
}
_m = _m.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
list, err := _m.All(ctx)
if err != nil {
return nil, err
}
ret.List = list
return ret, nil
}
type PayChannelPager struct {
Order paychannel.OrderOption
Filter func(*PayChannelQuery) (*PayChannelQuery, error)
}
// PayChannelPaginateOption enables pagination customization.
type PayChannelPaginateOption func(*PayChannelPager)
// DefaultPayChannelOrder is the default ordering of PayChannel.
var DefaultPayChannelOrder = Desc(paychannel.FieldID)
func newPayChannelPager(opts []PayChannelPaginateOption) (*PayChannelPager, error) {
pager := &PayChannelPager{}
for _, opt := range opts {
opt(pager)
}
if pager.Order == nil {
pager.Order = DefaultPayChannelOrder
}
return pager, nil
}
func (p *PayChannelPager) ApplyFilter(query *PayChannelQuery) (*PayChannelQuery, error) {
if p.Filter != nil {
return p.Filter(query)
}
return query, nil
}
// PayChannelPageList is PayChannel PageList result.
type PayChannelPageList struct {
List []*PayChannel `json:"list"`
PageDetails *PageDetails `json:"pageDetails"`
}
func (_m *PayChannelQuery) Page(
ctx context.Context, pageNum uint64, pageSize uint64, opts ...PayChannelPaginateOption,
) (*PayChannelPageList, error) {
pager, err := newPayChannelPager(opts)
if err != nil {
return nil, err
}
if _m, err = pager.ApplyFilter(_m); err != nil {
return nil, err
}
ret := &PayChannelPageList{}
ret.PageDetails = &PageDetails{
Page: pageNum,
Size: pageSize,
}
query := _m.Clone()
query.ctx.Fields = nil
count, err := query.Count(ctx)
if err != nil {
return nil, err
}
ret.PageDetails.Total = uint64(count)
if pager.Order != nil {
_m = _m.Order(pager.Order)
} else {
_m = _m.Order(DefaultPayChannelOrder)
}
_m = _m.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
list, err := _m.All(ctx)
if err != nil {
return nil, err
}
ret.List = list
return ret, nil
}
type PayNotifyLogPager struct {
Order paynotifylog.OrderOption
Filter func(*PayNotifyLogQuery) (*PayNotifyLogQuery, error)
}
// PayNotifyLogPaginateOption enables pagination customization.
type PayNotifyLogPaginateOption func(*PayNotifyLogPager)
// DefaultPayNotifyLogOrder is the default ordering of PayNotifyLog.
var DefaultPayNotifyLogOrder = Desc(paynotifylog.FieldID)
func newPayNotifyLogPager(opts []PayNotifyLogPaginateOption) (*PayNotifyLogPager, error) {
pager := &PayNotifyLogPager{}
for _, opt := range opts {
opt(pager)
}
if pager.Order == nil {
pager.Order = DefaultPayNotifyLogOrder
}
return pager, nil
}
func (p *PayNotifyLogPager) ApplyFilter(query *PayNotifyLogQuery) (*PayNotifyLogQuery, error) {
if p.Filter != nil {
return p.Filter(query)
}
return query, nil
}
// PayNotifyLogPageList is PayNotifyLog PageList result.
type PayNotifyLogPageList struct {
List []*PayNotifyLog `json:"list"`
PageDetails *PageDetails `json:"pageDetails"`
}
func (_m *PayNotifyLogQuery) Page(
ctx context.Context, pageNum uint64, pageSize uint64, opts ...PayNotifyLogPaginateOption,
) (*PayNotifyLogPageList, error) {
pager, err := newPayNotifyLogPager(opts)
if err != nil {
return nil, err
}
if _m, err = pager.ApplyFilter(_m); err != nil {
return nil, err
}
ret := &PayNotifyLogPageList{}
ret.PageDetails = &PageDetails{
Page: pageNum,
Size: pageSize,
}
query := _m.Clone()
query.ctx.Fields = nil
count, err := query.Count(ctx)
if err != nil {
return nil, err
}
ret.PageDetails.Total = uint64(count)
if pager.Order != nil {
_m = _m.Order(pager.Order)
} else {
_m = _m.Order(DefaultPayNotifyLogOrder)
}
_m = _m.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
list, err := _m.All(ctx)
if err != nil {
return nil, err
}
ret.List = list
return ret, nil
}
type PayNotifyTaskPager struct {
Order paynotifytask.OrderOption
Filter func(*PayNotifyTaskQuery) (*PayNotifyTaskQuery, error)
}
// PayNotifyTaskPaginateOption enables pagination customization.
type PayNotifyTaskPaginateOption func(*PayNotifyTaskPager)
// DefaultPayNotifyTaskOrder is the default ordering of PayNotifyTask.
var DefaultPayNotifyTaskOrder = Desc(paynotifytask.FieldID)
func newPayNotifyTaskPager(opts []PayNotifyTaskPaginateOption) (*PayNotifyTaskPager, error) {
pager := &PayNotifyTaskPager{}
for _, opt := range opts {
opt(pager)
}
if pager.Order == nil {
pager.Order = DefaultPayNotifyTaskOrder
}
return pager, nil
}
func (p *PayNotifyTaskPager) ApplyFilter(query *PayNotifyTaskQuery) (*PayNotifyTaskQuery, error) {
if p.Filter != nil {
return p.Filter(query)
}
return query, nil
}
// PayNotifyTaskPageList is PayNotifyTask PageList result.
type PayNotifyTaskPageList struct {
List []*PayNotifyTask `json:"list"`
PageDetails *PageDetails `json:"pageDetails"`
}
func (_m *PayNotifyTaskQuery) Page(
ctx context.Context, pageNum uint64, pageSize uint64, opts ...PayNotifyTaskPaginateOption,
) (*PayNotifyTaskPageList, error) {
pager, err := newPayNotifyTaskPager(opts)
if err != nil {
return nil, err
}
if _m, err = pager.ApplyFilter(_m); err != nil {
return nil, err
}
ret := &PayNotifyTaskPageList{}
ret.PageDetails = &PageDetails{
Page: pageNum,
Size: pageSize,
}
query := _m.Clone()
query.ctx.Fields = nil
count, err := query.Count(ctx)
if err != nil {
return nil, err
}
ret.PageDetails.Total = uint64(count)
if pager.Order != nil {
_m = _m.Order(pager.Order)
} else {
_m = _m.Order(DefaultPayNotifyTaskOrder)
}
_m = _m.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
list, err := _m.All(ctx)
if err != nil {
return nil, err
}
ret.List = list
return ret, nil
}
type PayOrderPager struct {
Order payorder.OrderOption
Filter func(*PayOrderQuery) (*PayOrderQuery, error)
}
// PayOrderPaginateOption enables pagination customization.
type PayOrderPaginateOption func(*PayOrderPager)
// DefaultPayOrderOrder is the default ordering of PayOrder.
var DefaultPayOrderOrder = Desc(payorder.FieldID)
func newPayOrderPager(opts []PayOrderPaginateOption) (*PayOrderPager, error) {
pager := &PayOrderPager{}
for _, opt := range opts {
opt(pager)
}
if pager.Order == nil {
pager.Order = DefaultPayOrderOrder
}
return pager, nil
}
func (p *PayOrderPager) ApplyFilter(query *PayOrderQuery) (*PayOrderQuery, error) {
if p.Filter != nil {
return p.Filter(query)
}
return query, nil
}
// PayOrderPageList is PayOrder PageList result.
type PayOrderPageList struct {
List []*PayOrder `json:"list"`
PageDetails *PageDetails `json:"pageDetails"`
}
func (_m *PayOrderQuery) Page(
ctx context.Context, pageNum uint64, pageSize uint64, opts ...PayOrderPaginateOption,
) (*PayOrderPageList, error) {
pager, err := newPayOrderPager(opts)
if err != nil {
return nil, err
}
if _m, err = pager.ApplyFilter(_m); err != nil {
return nil, err
}
ret := &PayOrderPageList{}
ret.PageDetails = &PageDetails{
Page: pageNum,
Size: pageSize,
}
query := _m.Clone()
query.ctx.Fields = nil
count, err := query.Count(ctx)
if err != nil {
return nil, err
}
ret.PageDetails.Total = uint64(count)
if pager.Order != nil {
_m = _m.Order(pager.Order)
} else {
_m = _m.Order(DefaultPayOrderOrder)
}
_m = _m.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
list, err := _m.All(ctx)
if err != nil {
return nil, err
}
ret.List = list
return ret, nil
}
type PayOrderExtensionPager struct {
Order payorderextension.OrderOption
Filter func(*PayOrderExtensionQuery) (*PayOrderExtensionQuery, error)
}
// PayOrderExtensionPaginateOption enables pagination customization.
type PayOrderExtensionPaginateOption func(*PayOrderExtensionPager)
// DefaultPayOrderExtensionOrder is the default ordering of PayOrderExtension.
var DefaultPayOrderExtensionOrder = Desc(payorderextension.FieldID)
func newPayOrderExtensionPager(opts []PayOrderExtensionPaginateOption) (*PayOrderExtensionPager, error) {
pager := &PayOrderExtensionPager{}
for _, opt := range opts {
opt(pager)
}
if pager.Order == nil {
pager.Order = DefaultPayOrderExtensionOrder
}
return pager, nil
}
func (p *PayOrderExtensionPager) ApplyFilter(query *PayOrderExtensionQuery) (*PayOrderExtensionQuery, error) {
if p.Filter != nil {
return p.Filter(query)
}
return query, nil
}
// PayOrderExtensionPageList is PayOrderExtension PageList result.
type PayOrderExtensionPageList struct {
List []*PayOrderExtension `json:"list"`
PageDetails *PageDetails `json:"pageDetails"`
}
func (_m *PayOrderExtensionQuery) Page(
ctx context.Context, pageNum uint64, pageSize uint64, opts ...PayOrderExtensionPaginateOption,
) (*PayOrderExtensionPageList, error) {
pager, err := newPayOrderExtensionPager(opts)
if err != nil {
return nil, err
}
if _m, err = pager.ApplyFilter(_m); err != nil {
return nil, err
}
ret := &PayOrderExtensionPageList{}
ret.PageDetails = &PageDetails{
Page: pageNum,
Size: pageSize,
}
query := _m.Clone()
query.ctx.Fields = nil
count, err := query.Count(ctx)
if err != nil {
return nil, err
}
ret.PageDetails.Total = uint64(count)
if pager.Order != nil {
_m = _m.Order(pager.Order)
} else {
_m = _m.Order(DefaultPayOrderExtensionOrder)
}
_m = _m.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
list, err := _m.All(ctx)
if err != nil {
return nil, err
}
ret.List = list
return ret, nil
}
type PayRefundPager struct {
Order payrefund.OrderOption
Filter func(*PayRefundQuery) (*PayRefundQuery, error)
}
// PayRefundPaginateOption enables pagination customization.
type PayRefundPaginateOption func(*PayRefundPager)
// DefaultPayRefundOrder is the default ordering of PayRefund.
var DefaultPayRefundOrder = Desc(payrefund.FieldID)
func newPayRefundPager(opts []PayRefundPaginateOption) (*PayRefundPager, error) {
pager := &PayRefundPager{}
for _, opt := range opts {
opt(pager)
}
if pager.Order == nil {
pager.Order = DefaultPayRefundOrder
}
return pager, nil
}
func (p *PayRefundPager) ApplyFilter(query *PayRefundQuery) (*PayRefundQuery, error) {
if p.Filter != nil {
return p.Filter(query)
}
return query, nil
}
// PayRefundPageList is PayRefund PageList result.
type PayRefundPageList struct {
List []*PayRefund `json:"list"`
PageDetails *PageDetails `json:"pageDetails"`
}
func (_m *PayRefundQuery) Page(
ctx context.Context, pageNum uint64, pageSize uint64, opts ...PayRefundPaginateOption,
) (*PayRefundPageList, error) {
pager, err := newPayRefundPager(opts)
if err != nil {
return nil, err
}
if _m, err = pager.ApplyFilter(_m); err != nil {
return nil, err
}
ret := &PayRefundPageList{}
ret.PageDetails = &PageDetails{
Page: pageNum,
Size: pageSize,
}
query := _m.Clone()
query.ctx.Fields = nil
count, err := query.Count(ctx)
if err != nil {
return nil, err
}
ret.PageDetails.Total = uint64(count)
if pager.Order != nil {
_m = _m.Order(pager.Order)
} else {
_m = _m.Order(DefaultPayRefundOrder)
}
_m = _m.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
list, err := _m.All(ctx)
if err != nil {
return nil, err
}
ret.List = list
return ret, nil
}

342
rpc/ent/paychannel.go Normal file
View File

@ -0,0 +1,342 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"encoding/json"
"fmt"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// PayChannel Table | 支付渠道表
type PayChannel 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"`
// Pay channel code | 支付渠道编码
Code string `json:"code,omitempty"`
// Pay channel name | 支付渠道英文名称
NameEn string `json:"name_en,omitempty"`
// Pay channel name | 支付渠道中文名称
NameZh string `json:"name_zh,omitempty"`
// Free rate | 手续费比例
FreeRate string `json:"free_rate,omitempty"`
// App ID | 应用ID
AppID uint64 `json:"app_id,omitempty"`
// Config | 配置信息
Config map[string]interface{} `json:"config,omitempty"`
// Remark | 备注
Remake string `json:"remake,omitempty"`
// Icon | 图标
Icon uint64 `json:"icon,omitempty"`
// Order time out | 订单超时时间
OrderTimeOut string `json:"order_time_out,omitempty"`
// Support currency | 支持币种
SupportCurrency string `json:"support_currency,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PayChannelQuery when eager-loading is set.
Edges PayChannelEdges `json:"edges"`
selectValues sql.SelectValues
}
// PayChannelEdges holds the relations/edges for other nodes in the graph.
type PayChannelEdges struct {
// Orders holds the value of the orders edge.
Orders []*PayOrder `json:"orders,omitempty"`
// OrdersExtension holds the value of the orders_extension edge.
OrdersExtension []*PayOrderExtension `json:"orders_extension,omitempty"`
// Refund holds the value of the refund edge.
Refund []*PayRefund `json:"refund,omitempty"`
// App holds the value of the app edge.
App *App `json:"app,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [4]bool
}
// OrdersOrErr returns the Orders value or an error if the edge
// was not loaded in eager-loading.
func (e PayChannelEdges) OrdersOrErr() ([]*PayOrder, error) {
if e.loadedTypes[0] {
return e.Orders, nil
}
return nil, &NotLoadedError{edge: "orders"}
}
// OrdersExtensionOrErr returns the OrdersExtension value or an error if the edge
// was not loaded in eager-loading.
func (e PayChannelEdges) OrdersExtensionOrErr() ([]*PayOrderExtension, error) {
if e.loadedTypes[1] {
return e.OrdersExtension, nil
}
return nil, &NotLoadedError{edge: "orders_extension"}
}
// RefundOrErr returns the Refund value or an error if the edge
// was not loaded in eager-loading.
func (e PayChannelEdges) RefundOrErr() ([]*PayRefund, error) {
if e.loadedTypes[2] {
return e.Refund, nil
}
return nil, &NotLoadedError{edge: "refund"}
}
// AppOrErr returns the App value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e PayChannelEdges) AppOrErr() (*App, error) {
if e.App != nil {
return e.App, nil
} else if e.loadedTypes[3] {
return nil, &NotFoundError{label: app.Label}
}
return nil, &NotLoadedError{edge: "app"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*PayChannel) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case paychannel.FieldConfig:
values[i] = new([]byte)
case paychannel.FieldID, paychannel.FieldStatus, paychannel.FieldTenantID, paychannel.FieldAppID, paychannel.FieldIcon:
values[i] = new(sql.NullInt64)
case paychannel.FieldCode, paychannel.FieldNameEn, paychannel.FieldNameZh, paychannel.FieldFreeRate, paychannel.FieldRemake, paychannel.FieldOrderTimeOut, paychannel.FieldSupportCurrency:
values[i] = new(sql.NullString)
case paychannel.FieldCreatedAt, paychannel.FieldUpdatedAt, paychannel.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 PayChannel fields.
func (_m *PayChannel) 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 paychannel.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 paychannel.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 paychannel.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 paychannel.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 paychannel.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 paychannel.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 paychannel.FieldCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field code", values[i])
} else if value.Valid {
_m.Code = value.String
}
case paychannel.FieldNameEn:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name_en", values[i])
} else if value.Valid {
_m.NameEn = value.String
}
case paychannel.FieldNameZh:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name_zh", values[i])
} else if value.Valid {
_m.NameZh = value.String
}
case paychannel.FieldFreeRate:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field free_rate", values[i])
} else if value.Valid {
_m.FreeRate = value.String
}
case paychannel.FieldAppID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field app_id", values[i])
} else if value.Valid {
_m.AppID = uint64(value.Int64)
}
case paychannel.FieldConfig:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field config", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &_m.Config); err != nil {
return fmt.Errorf("unmarshal field config: %w", err)
}
}
case paychannel.FieldRemake:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remake", values[i])
} else if value.Valid {
_m.Remake = value.String
}
case paychannel.FieldIcon:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field icon", values[i])
} else if value.Valid {
_m.Icon = uint64(value.Int64)
}
case paychannel.FieldOrderTimeOut:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field order_time_out", values[i])
} else if value.Valid {
_m.OrderTimeOut = value.String
}
case paychannel.FieldSupportCurrency:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field support_currency", values[i])
} else if value.Valid {
_m.SupportCurrency = 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 PayChannel.
// This includes values selected through modifiers, order, etc.
func (_m *PayChannel) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryOrders queries the "orders" edge of the PayChannel entity.
func (_m *PayChannel) QueryOrders() *PayOrderQuery {
return NewPayChannelClient(_m.config).QueryOrders(_m)
}
// QueryOrdersExtension queries the "orders_extension" edge of the PayChannel entity.
func (_m *PayChannel) QueryOrdersExtension() *PayOrderExtensionQuery {
return NewPayChannelClient(_m.config).QueryOrdersExtension(_m)
}
// QueryRefund queries the "refund" edge of the PayChannel entity.
func (_m *PayChannel) QueryRefund() *PayRefundQuery {
return NewPayChannelClient(_m.config).QueryRefund(_m)
}
// QueryApp queries the "app" edge of the PayChannel entity.
func (_m *PayChannel) QueryApp() *AppQuery {
return NewPayChannelClient(_m.config).QueryApp(_m)
}
// Update returns a builder for updating this PayChannel.
// Note that you need to call PayChannel.Unwrap() before calling this method if this PayChannel
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *PayChannel) Update() *PayChannelUpdateOne {
return NewPayChannelClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the PayChannel 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 *PayChannel) Unwrap() *PayChannel {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: PayChannel is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *PayChannel) String() string {
var builder strings.Builder
builder.WriteString("PayChannel(")
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("code=")
builder.WriteString(_m.Code)
builder.WriteString(", ")
builder.WriteString("name_en=")
builder.WriteString(_m.NameEn)
builder.WriteString(", ")
builder.WriteString("name_zh=")
builder.WriteString(_m.NameZh)
builder.WriteString(", ")
builder.WriteString("free_rate=")
builder.WriteString(_m.FreeRate)
builder.WriteString(", ")
builder.WriteString("app_id=")
builder.WriteString(fmt.Sprintf("%v", _m.AppID))
builder.WriteString(", ")
builder.WriteString("config=")
builder.WriteString(fmt.Sprintf("%v", _m.Config))
builder.WriteString(", ")
builder.WriteString("remake=")
builder.WriteString(_m.Remake)
builder.WriteString(", ")
builder.WriteString("icon=")
builder.WriteString(fmt.Sprintf("%v", _m.Icon))
builder.WriteString(", ")
builder.WriteString("order_time_out=")
builder.WriteString(_m.OrderTimeOut)
builder.WriteString(", ")
builder.WriteString("support_currency=")
builder.WriteString(_m.SupportCurrency)
builder.WriteByte(')')
return builder.String()
}
// PayChannels is a parsable slice of PayChannel.
type PayChannels []*PayChannel

View File

@ -0,0 +1,289 @@
// Code generated by ent, DO NOT EDIT.
package paychannel
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the paychannel type in the database.
Label = "pay_channel"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldTenantID holds the string denoting the tenant_id field in the database.
FieldTenantID = "tenant_id"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldCode holds the string denoting the code field in the database.
FieldCode = "code"
// FieldNameEn holds the string denoting the name_en field in the database.
FieldNameEn = "name_en"
// FieldNameZh holds the string denoting the name_zh field in the database.
FieldNameZh = "name_zh"
// FieldFreeRate holds the string denoting the free_rate field in the database.
FieldFreeRate = "free_rate"
// FieldAppID holds the string denoting the app_id field in the database.
FieldAppID = "app_id"
// FieldConfig holds the string denoting the config field in the database.
FieldConfig = "config"
// FieldRemake holds the string denoting the remake field in the database.
FieldRemake = "remake"
// FieldIcon holds the string denoting the icon field in the database.
FieldIcon = "icon"
// FieldOrderTimeOut holds the string denoting the order_time_out field in the database.
FieldOrderTimeOut = "order_time_out"
// FieldSupportCurrency holds the string denoting the support_currency field in the database.
FieldSupportCurrency = "support_currency"
// EdgeOrders holds the string denoting the orders edge name in mutations.
EdgeOrders = "orders"
// EdgeOrdersExtension holds the string denoting the orders_extension edge name in mutations.
EdgeOrdersExtension = "orders_extension"
// EdgeRefund holds the string denoting the refund edge name in mutations.
EdgeRefund = "refund"
// EdgeApp holds the string denoting the app edge name in mutations.
EdgeApp = "app"
// Table holds the table name of the paychannel in the database.
Table = "pay_channel"
// OrdersTable is the table that holds the orders relation/edge.
OrdersTable = "pay_order"
// OrdersInverseTable is the table name for the PayOrder entity.
// It exists in this package in order to avoid circular dependency with the "payorder" package.
OrdersInverseTable = "pay_order"
// OrdersColumn is the table column denoting the orders relation/edge.
OrdersColumn = "channel_id"
// OrdersExtensionTable is the table that holds the orders_extension relation/edge.
OrdersExtensionTable = "pay_order_extension"
// OrdersExtensionInverseTable is the table name for the PayOrderExtension entity.
// It exists in this package in order to avoid circular dependency with the "payorderextension" package.
OrdersExtensionInverseTable = "pay_order_extension"
// OrdersExtensionColumn is the table column denoting the orders_extension relation/edge.
OrdersExtensionColumn = "channel_id"
// RefundTable is the table that holds the refund relation/edge.
RefundTable = "pay_refund"
// RefundInverseTable is the table name for the PayRefund entity.
// It exists in this package in order to avoid circular dependency with the "payrefund" package.
RefundInverseTable = "pay_refund"
// RefundColumn is the table column denoting the refund relation/edge.
RefundColumn = "channel_id"
// AppTable is the table that holds the app relation/edge.
AppTable = "pay_channel"
// AppInverseTable is the table name for the App entity.
// It exists in this package in order to avoid circular dependency with the "app" package.
AppInverseTable = "pay_app"
// AppColumn is the table column denoting the app relation/edge.
AppColumn = "app_id"
)
// Columns holds all SQL columns for paychannel fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldStatus,
FieldTenantID,
FieldDeletedAt,
FieldCode,
FieldNameEn,
FieldNameZh,
FieldFreeRate,
FieldAppID,
FieldConfig,
FieldRemake,
FieldIcon,
FieldOrderTimeOut,
FieldSupportCurrency,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus uint8
// DefaultTenantID holds the default value on creation for the "tenant_id" field.
DefaultTenantID uint64
// DefaultFreeRate holds the default value on creation for the "free_rate" field.
DefaultFreeRate string
// DefaultOrderTimeOut holds the default value on creation for the "order_time_out" field.
DefaultOrderTimeOut string
// DefaultSupportCurrency holds the default value on creation for the "support_currency" field.
DefaultSupportCurrency string
)
// OrderOption defines the ordering options for the PayChannel queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByTenantID orders the results by the tenant_id field.
func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTenantID, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByCode orders the results by the code field.
func ByCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCode, opts...).ToFunc()
}
// ByNameEn orders the results by the name_en field.
func ByNameEn(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNameEn, opts...).ToFunc()
}
// ByNameZh orders the results by the name_zh field.
func ByNameZh(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNameZh, opts...).ToFunc()
}
// ByFreeRate orders the results by the free_rate field.
func ByFreeRate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFreeRate, opts...).ToFunc()
}
// ByAppID orders the results by the app_id field.
func ByAppID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAppID, opts...).ToFunc()
}
// ByRemake orders the results by the remake field.
func ByRemake(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRemake, opts...).ToFunc()
}
// ByIcon orders the results by the icon field.
func ByIcon(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIcon, opts...).ToFunc()
}
// ByOrderTimeOut orders the results by the order_time_out field.
func ByOrderTimeOut(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrderTimeOut, opts...).ToFunc()
}
// BySupportCurrency orders the results by the support_currency field.
func BySupportCurrency(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSupportCurrency, opts...).ToFunc()
}
// ByOrdersCount orders the results by orders count.
func ByOrdersCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newOrdersStep(), opts...)
}
}
// ByOrders orders the results by orders terms.
func ByOrders(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newOrdersStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByOrdersExtensionCount orders the results by orders_extension count.
func ByOrdersExtensionCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newOrdersExtensionStep(), opts...)
}
}
// ByOrdersExtension orders the results by orders_extension terms.
func ByOrdersExtension(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newOrdersExtensionStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByRefundCount orders the results by refund count.
func ByRefundCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newRefundStep(), opts...)
}
}
// ByRefund orders the results by refund terms.
func ByRefund(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newRefundStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByAppField orders the results by app field.
func ByAppField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newAppStep(), sql.OrderByField(field, opts...))
}
}
func newOrdersStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(OrdersInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, OrdersTable, OrdersColumn),
)
}
func newOrdersExtensionStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(OrdersExtensionInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, OrdersExtensionTable, OrdersExtensionColumn),
)
}
func newRefundStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(RefundInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, RefundTable, RefundColumn),
)
}
func newAppStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(AppInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, AppTable, AppColumn),
)
}

988
rpc/ent/paychannel/where.go Normal file
View File

@ -0,0 +1,988 @@
// Code generated by ent, DO NOT EDIT.
package paychannel
import (
"mingyang-admin-pay/rpc/ent/predicate"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
// ID filters vertices based on their ID field.
func ID(id uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldID, id))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldUpdatedAt, v))
}
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
func Status(v uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldStatus, v))
}
// TenantID applies equality check predicate on the "tenant_id" field. It's identical to TenantIDEQ.
func TenantID(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldTenantID, v))
}
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
func DeletedAt(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldDeletedAt, v))
}
// Code applies equality check predicate on the "code" field. It's identical to CodeEQ.
func Code(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldCode, v))
}
// NameEn applies equality check predicate on the "name_en" field. It's identical to NameEnEQ.
func NameEn(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldNameEn, v))
}
// NameZh applies equality check predicate on the "name_zh" field. It's identical to NameZhEQ.
func NameZh(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldNameZh, v))
}
// FreeRate applies equality check predicate on the "free_rate" field. It's identical to FreeRateEQ.
func FreeRate(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldFreeRate, v))
}
// AppID applies equality check predicate on the "app_id" field. It's identical to AppIDEQ.
func AppID(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldAppID, v))
}
// Remake applies equality check predicate on the "remake" field. It's identical to RemakeEQ.
func Remake(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldRemake, v))
}
// Icon applies equality check predicate on the "icon" field. It's identical to IconEQ.
func Icon(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldIcon, v))
}
// OrderTimeOut applies equality check predicate on the "order_time_out" field. It's identical to OrderTimeOutEQ.
func OrderTimeOut(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldOrderTimeOut, v))
}
// SupportCurrency applies equality check predicate on the "support_currency" field. It's identical to SupportCurrencyEQ.
func SupportCurrency(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldSupportCurrency, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldUpdatedAt, v))
}
// StatusEQ applies the EQ predicate on the "status" field.
func StatusEQ(v uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldStatus, v))
}
// StatusNEQ applies the NEQ predicate on the "status" field.
func StatusNEQ(v uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldStatus, v))
}
// StatusIn applies the In predicate on the "status" field.
func StatusIn(vs ...uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldStatus, vs...))
}
// StatusNotIn applies the NotIn predicate on the "status" field.
func StatusNotIn(vs ...uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldStatus, vs...))
}
// StatusGT applies the GT predicate on the "status" field.
func StatusGT(v uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldStatus, v))
}
// StatusGTE applies the GTE predicate on the "status" field.
func StatusGTE(v uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldStatus, v))
}
// StatusLT applies the LT predicate on the "status" field.
func StatusLT(v uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldStatus, v))
}
// StatusLTE applies the LTE predicate on the "status" field.
func StatusLTE(v uint8) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldStatus, v))
}
// StatusIsNil applies the IsNil predicate on the "status" field.
func StatusIsNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldIsNull(FieldStatus))
}
// StatusNotNil applies the NotNil predicate on the "status" field.
func StatusNotNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotNull(FieldStatus))
}
// TenantIDEQ applies the EQ predicate on the "tenant_id" field.
func TenantIDEQ(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldTenantID, v))
}
// TenantIDNEQ applies the NEQ predicate on the "tenant_id" field.
func TenantIDNEQ(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldTenantID, v))
}
// TenantIDIn applies the In predicate on the "tenant_id" field.
func TenantIDIn(vs ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldTenantID, vs...))
}
// TenantIDNotIn applies the NotIn predicate on the "tenant_id" field.
func TenantIDNotIn(vs ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldTenantID, vs...))
}
// TenantIDGT applies the GT predicate on the "tenant_id" field.
func TenantIDGT(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldTenantID, v))
}
// TenantIDGTE applies the GTE predicate on the "tenant_id" field.
func TenantIDGTE(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldTenantID, v))
}
// TenantIDLT applies the LT predicate on the "tenant_id" field.
func TenantIDLT(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldTenantID, v))
}
// TenantIDLTE applies the LTE predicate on the "tenant_id" field.
func TenantIDLTE(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldTenantID, v))
}
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
func DeletedAtEQ(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldDeletedAt, v))
}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
func DeletedAtNEQ(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldDeletedAt, v))
}
// DeletedAtIn applies the In predicate on the "deleted_at" field.
func DeletedAtIn(vs ...time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldDeletedAt, vs...))
}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
func DeletedAtNotIn(vs ...time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldDeletedAt, vs...))
}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.
func DeletedAtGT(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldDeletedAt, v))
}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
func DeletedAtGTE(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldDeletedAt, v))
}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.
func DeletedAtLT(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldDeletedAt, v))
}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
func DeletedAtLTE(v time.Time) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldDeletedAt, v))
}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
func DeletedAtIsNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldIsNull(FieldDeletedAt))
}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
func DeletedAtNotNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotNull(FieldDeletedAt))
}
// CodeEQ applies the EQ predicate on the "code" field.
func CodeEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldCode, v))
}
// CodeNEQ applies the NEQ predicate on the "code" field.
func CodeNEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldCode, v))
}
// CodeIn applies the In predicate on the "code" field.
func CodeIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldCode, vs...))
}
// CodeNotIn applies the NotIn predicate on the "code" field.
func CodeNotIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldCode, vs...))
}
// CodeGT applies the GT predicate on the "code" field.
func CodeGT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldCode, v))
}
// CodeGTE applies the GTE predicate on the "code" field.
func CodeGTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldCode, v))
}
// CodeLT applies the LT predicate on the "code" field.
func CodeLT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldCode, v))
}
// CodeLTE applies the LTE predicate on the "code" field.
func CodeLTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldCode, v))
}
// CodeContains applies the Contains predicate on the "code" field.
func CodeContains(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContains(FieldCode, v))
}
// CodeHasPrefix applies the HasPrefix predicate on the "code" field.
func CodeHasPrefix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasPrefix(FieldCode, v))
}
// CodeHasSuffix applies the HasSuffix predicate on the "code" field.
func CodeHasSuffix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasSuffix(FieldCode, v))
}
// CodeEqualFold applies the EqualFold predicate on the "code" field.
func CodeEqualFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEqualFold(FieldCode, v))
}
// CodeContainsFold applies the ContainsFold predicate on the "code" field.
func CodeContainsFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContainsFold(FieldCode, v))
}
// NameEnEQ applies the EQ predicate on the "name_en" field.
func NameEnEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldNameEn, v))
}
// NameEnNEQ applies the NEQ predicate on the "name_en" field.
func NameEnNEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldNameEn, v))
}
// NameEnIn applies the In predicate on the "name_en" field.
func NameEnIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldNameEn, vs...))
}
// NameEnNotIn applies the NotIn predicate on the "name_en" field.
func NameEnNotIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldNameEn, vs...))
}
// NameEnGT applies the GT predicate on the "name_en" field.
func NameEnGT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldNameEn, v))
}
// NameEnGTE applies the GTE predicate on the "name_en" field.
func NameEnGTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldNameEn, v))
}
// NameEnLT applies the LT predicate on the "name_en" field.
func NameEnLT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldNameEn, v))
}
// NameEnLTE applies the LTE predicate on the "name_en" field.
func NameEnLTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldNameEn, v))
}
// NameEnContains applies the Contains predicate on the "name_en" field.
func NameEnContains(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContains(FieldNameEn, v))
}
// NameEnHasPrefix applies the HasPrefix predicate on the "name_en" field.
func NameEnHasPrefix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasPrefix(FieldNameEn, v))
}
// NameEnHasSuffix applies the HasSuffix predicate on the "name_en" field.
func NameEnHasSuffix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasSuffix(FieldNameEn, v))
}
// NameEnEqualFold applies the EqualFold predicate on the "name_en" field.
func NameEnEqualFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEqualFold(FieldNameEn, v))
}
// NameEnContainsFold applies the ContainsFold predicate on the "name_en" field.
func NameEnContainsFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContainsFold(FieldNameEn, v))
}
// NameZhEQ applies the EQ predicate on the "name_zh" field.
func NameZhEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldNameZh, v))
}
// NameZhNEQ applies the NEQ predicate on the "name_zh" field.
func NameZhNEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldNameZh, v))
}
// NameZhIn applies the In predicate on the "name_zh" field.
func NameZhIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldNameZh, vs...))
}
// NameZhNotIn applies the NotIn predicate on the "name_zh" field.
func NameZhNotIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldNameZh, vs...))
}
// NameZhGT applies the GT predicate on the "name_zh" field.
func NameZhGT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldNameZh, v))
}
// NameZhGTE applies the GTE predicate on the "name_zh" field.
func NameZhGTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldNameZh, v))
}
// NameZhLT applies the LT predicate on the "name_zh" field.
func NameZhLT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldNameZh, v))
}
// NameZhLTE applies the LTE predicate on the "name_zh" field.
func NameZhLTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldNameZh, v))
}
// NameZhContains applies the Contains predicate on the "name_zh" field.
func NameZhContains(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContains(FieldNameZh, v))
}
// NameZhHasPrefix applies the HasPrefix predicate on the "name_zh" field.
func NameZhHasPrefix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasPrefix(FieldNameZh, v))
}
// NameZhHasSuffix applies the HasSuffix predicate on the "name_zh" field.
func NameZhHasSuffix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasSuffix(FieldNameZh, v))
}
// NameZhEqualFold applies the EqualFold predicate on the "name_zh" field.
func NameZhEqualFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEqualFold(FieldNameZh, v))
}
// NameZhContainsFold applies the ContainsFold predicate on the "name_zh" field.
func NameZhContainsFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContainsFold(FieldNameZh, v))
}
// FreeRateEQ applies the EQ predicate on the "free_rate" field.
func FreeRateEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldFreeRate, v))
}
// FreeRateNEQ applies the NEQ predicate on the "free_rate" field.
func FreeRateNEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldFreeRate, v))
}
// FreeRateIn applies the In predicate on the "free_rate" field.
func FreeRateIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldFreeRate, vs...))
}
// FreeRateNotIn applies the NotIn predicate on the "free_rate" field.
func FreeRateNotIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldFreeRate, vs...))
}
// FreeRateGT applies the GT predicate on the "free_rate" field.
func FreeRateGT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldFreeRate, v))
}
// FreeRateGTE applies the GTE predicate on the "free_rate" field.
func FreeRateGTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldFreeRate, v))
}
// FreeRateLT applies the LT predicate on the "free_rate" field.
func FreeRateLT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldFreeRate, v))
}
// FreeRateLTE applies the LTE predicate on the "free_rate" field.
func FreeRateLTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldFreeRate, v))
}
// FreeRateContains applies the Contains predicate on the "free_rate" field.
func FreeRateContains(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContains(FieldFreeRate, v))
}
// FreeRateHasPrefix applies the HasPrefix predicate on the "free_rate" field.
func FreeRateHasPrefix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasPrefix(FieldFreeRate, v))
}
// FreeRateHasSuffix applies the HasSuffix predicate on the "free_rate" field.
func FreeRateHasSuffix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasSuffix(FieldFreeRate, v))
}
// FreeRateEqualFold applies the EqualFold predicate on the "free_rate" field.
func FreeRateEqualFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEqualFold(FieldFreeRate, v))
}
// FreeRateContainsFold applies the ContainsFold predicate on the "free_rate" field.
func FreeRateContainsFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContainsFold(FieldFreeRate, v))
}
// AppIDEQ applies the EQ predicate on the "app_id" field.
func AppIDEQ(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldAppID, v))
}
// AppIDNEQ applies the NEQ predicate on the "app_id" field.
func AppIDNEQ(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldAppID, v))
}
// AppIDIn applies the In predicate on the "app_id" field.
func AppIDIn(vs ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldAppID, vs...))
}
// AppIDNotIn applies the NotIn predicate on the "app_id" field.
func AppIDNotIn(vs ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldAppID, vs...))
}
// RemakeEQ applies the EQ predicate on the "remake" field.
func RemakeEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldRemake, v))
}
// RemakeNEQ applies the NEQ predicate on the "remake" field.
func RemakeNEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldRemake, v))
}
// RemakeIn applies the In predicate on the "remake" field.
func RemakeIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldRemake, vs...))
}
// RemakeNotIn applies the NotIn predicate on the "remake" field.
func RemakeNotIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldRemake, vs...))
}
// RemakeGT applies the GT predicate on the "remake" field.
func RemakeGT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldRemake, v))
}
// RemakeGTE applies the GTE predicate on the "remake" field.
func RemakeGTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldRemake, v))
}
// RemakeLT applies the LT predicate on the "remake" field.
func RemakeLT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldRemake, v))
}
// RemakeLTE applies the LTE predicate on the "remake" field.
func RemakeLTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldRemake, v))
}
// RemakeContains applies the Contains predicate on the "remake" field.
func RemakeContains(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContains(FieldRemake, v))
}
// RemakeHasPrefix applies the HasPrefix predicate on the "remake" field.
func RemakeHasPrefix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasPrefix(FieldRemake, v))
}
// RemakeHasSuffix applies the HasSuffix predicate on the "remake" field.
func RemakeHasSuffix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasSuffix(FieldRemake, v))
}
// RemakeIsNil applies the IsNil predicate on the "remake" field.
func RemakeIsNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldIsNull(FieldRemake))
}
// RemakeNotNil applies the NotNil predicate on the "remake" field.
func RemakeNotNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotNull(FieldRemake))
}
// RemakeEqualFold applies the EqualFold predicate on the "remake" field.
func RemakeEqualFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEqualFold(FieldRemake, v))
}
// RemakeContainsFold applies the ContainsFold predicate on the "remake" field.
func RemakeContainsFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContainsFold(FieldRemake, v))
}
// IconEQ applies the EQ predicate on the "icon" field.
func IconEQ(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldIcon, v))
}
// IconNEQ applies the NEQ predicate on the "icon" field.
func IconNEQ(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldIcon, v))
}
// IconIn applies the In predicate on the "icon" field.
func IconIn(vs ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldIcon, vs...))
}
// IconNotIn applies the NotIn predicate on the "icon" field.
func IconNotIn(vs ...uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldIcon, vs...))
}
// IconGT applies the GT predicate on the "icon" field.
func IconGT(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldIcon, v))
}
// IconGTE applies the GTE predicate on the "icon" field.
func IconGTE(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldIcon, v))
}
// IconLT applies the LT predicate on the "icon" field.
func IconLT(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldIcon, v))
}
// IconLTE applies the LTE predicate on the "icon" field.
func IconLTE(v uint64) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldIcon, v))
}
// IconIsNil applies the IsNil predicate on the "icon" field.
func IconIsNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldIsNull(FieldIcon))
}
// IconNotNil applies the NotNil predicate on the "icon" field.
func IconNotNil() predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotNull(FieldIcon))
}
// OrderTimeOutEQ applies the EQ predicate on the "order_time_out" field.
func OrderTimeOutEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldOrderTimeOut, v))
}
// OrderTimeOutNEQ applies the NEQ predicate on the "order_time_out" field.
func OrderTimeOutNEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldOrderTimeOut, v))
}
// OrderTimeOutIn applies the In predicate on the "order_time_out" field.
func OrderTimeOutIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldOrderTimeOut, vs...))
}
// OrderTimeOutNotIn applies the NotIn predicate on the "order_time_out" field.
func OrderTimeOutNotIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldOrderTimeOut, vs...))
}
// OrderTimeOutGT applies the GT predicate on the "order_time_out" field.
func OrderTimeOutGT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldOrderTimeOut, v))
}
// OrderTimeOutGTE applies the GTE predicate on the "order_time_out" field.
func OrderTimeOutGTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldOrderTimeOut, v))
}
// OrderTimeOutLT applies the LT predicate on the "order_time_out" field.
func OrderTimeOutLT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldOrderTimeOut, v))
}
// OrderTimeOutLTE applies the LTE predicate on the "order_time_out" field.
func OrderTimeOutLTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldOrderTimeOut, v))
}
// OrderTimeOutContains applies the Contains predicate on the "order_time_out" field.
func OrderTimeOutContains(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContains(FieldOrderTimeOut, v))
}
// OrderTimeOutHasPrefix applies the HasPrefix predicate on the "order_time_out" field.
func OrderTimeOutHasPrefix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasPrefix(FieldOrderTimeOut, v))
}
// OrderTimeOutHasSuffix applies the HasSuffix predicate on the "order_time_out" field.
func OrderTimeOutHasSuffix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasSuffix(FieldOrderTimeOut, v))
}
// OrderTimeOutEqualFold applies the EqualFold predicate on the "order_time_out" field.
func OrderTimeOutEqualFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEqualFold(FieldOrderTimeOut, v))
}
// OrderTimeOutContainsFold applies the ContainsFold predicate on the "order_time_out" field.
func OrderTimeOutContainsFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContainsFold(FieldOrderTimeOut, v))
}
// SupportCurrencyEQ applies the EQ predicate on the "support_currency" field.
func SupportCurrencyEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEQ(FieldSupportCurrency, v))
}
// SupportCurrencyNEQ applies the NEQ predicate on the "support_currency" field.
func SupportCurrencyNEQ(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNEQ(FieldSupportCurrency, v))
}
// SupportCurrencyIn applies the In predicate on the "support_currency" field.
func SupportCurrencyIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldIn(FieldSupportCurrency, vs...))
}
// SupportCurrencyNotIn applies the NotIn predicate on the "support_currency" field.
func SupportCurrencyNotIn(vs ...string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldNotIn(FieldSupportCurrency, vs...))
}
// SupportCurrencyGT applies the GT predicate on the "support_currency" field.
func SupportCurrencyGT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGT(FieldSupportCurrency, v))
}
// SupportCurrencyGTE applies the GTE predicate on the "support_currency" field.
func SupportCurrencyGTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldGTE(FieldSupportCurrency, v))
}
// SupportCurrencyLT applies the LT predicate on the "support_currency" field.
func SupportCurrencyLT(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLT(FieldSupportCurrency, v))
}
// SupportCurrencyLTE applies the LTE predicate on the "support_currency" field.
func SupportCurrencyLTE(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldLTE(FieldSupportCurrency, v))
}
// SupportCurrencyContains applies the Contains predicate on the "support_currency" field.
func SupportCurrencyContains(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContains(FieldSupportCurrency, v))
}
// SupportCurrencyHasPrefix applies the HasPrefix predicate on the "support_currency" field.
func SupportCurrencyHasPrefix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasPrefix(FieldSupportCurrency, v))
}
// SupportCurrencyHasSuffix applies the HasSuffix predicate on the "support_currency" field.
func SupportCurrencyHasSuffix(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldHasSuffix(FieldSupportCurrency, v))
}
// SupportCurrencyEqualFold applies the EqualFold predicate on the "support_currency" field.
func SupportCurrencyEqualFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldEqualFold(FieldSupportCurrency, v))
}
// SupportCurrencyContainsFold applies the ContainsFold predicate on the "support_currency" field.
func SupportCurrencyContainsFold(v string) predicate.PayChannel {
return predicate.PayChannel(sql.FieldContainsFold(FieldSupportCurrency, v))
}
// HasOrders applies the HasEdge predicate on the "orders" edge.
func HasOrders() predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, OrdersTable, OrdersColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasOrdersWith applies the HasEdge predicate on the "orders" edge with a given conditions (other predicates).
func HasOrdersWith(preds ...predicate.PayOrder) predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := newOrdersStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasOrdersExtension applies the HasEdge predicate on the "orders_extension" edge.
func HasOrdersExtension() predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, OrdersExtensionTable, OrdersExtensionColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasOrdersExtensionWith applies the HasEdge predicate on the "orders_extension" edge with a given conditions (other predicates).
func HasOrdersExtensionWith(preds ...predicate.PayOrderExtension) predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := newOrdersExtensionStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasRefund applies the HasEdge predicate on the "refund" edge.
func HasRefund() predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, RefundTable, RefundColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasRefundWith applies the HasEdge predicate on the "refund" edge with a given conditions (other predicates).
func HasRefundWith(preds ...predicate.PayRefund) predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := newRefundStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasApp applies the HasEdge predicate on the "app" edge.
func HasApp() predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, AppTable, AppColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasAppWith applies the HasEdge predicate on the "app" edge with a given conditions (other predicates).
func HasAppWith(preds ...predicate.App) predicate.PayChannel {
return predicate.PayChannel(func(s *sql.Selector) {
step := newAppStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.PayChannel) predicate.PayChannel {
return predicate.PayChannel(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.PayChannel) predicate.PayChannel {
return predicate.PayChannel(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.PayChannel) predicate.PayChannel {
return predicate.PayChannel(sql.NotPredicates(p))
}

View File

@ -0,0 +1,598 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
"time"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayChannelCreate is the builder for creating a PayChannel entity.
type PayChannelCreate struct {
config
mutation *PayChannelMutation
hooks []Hook
}
// SetCreatedAt sets the "created_at" field.
func (_c *PayChannelCreate) SetCreatedAt(v time.Time) *PayChannelCreate {
_c.mutation.SetCreatedAt(v)
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableCreatedAt(v *time.Time) *PayChannelCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// SetUpdatedAt sets the "updated_at" field.
func (_c *PayChannelCreate) SetUpdatedAt(v time.Time) *PayChannelCreate {
_c.mutation.SetUpdatedAt(v)
return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableUpdatedAt(v *time.Time) *PayChannelCreate {
if v != nil {
_c.SetUpdatedAt(*v)
}
return _c
}
// SetStatus sets the "status" field.
func (_c *PayChannelCreate) SetStatus(v uint8) *PayChannelCreate {
_c.mutation.SetStatus(v)
return _c
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableStatus(v *uint8) *PayChannelCreate {
if v != nil {
_c.SetStatus(*v)
}
return _c
}
// SetTenantID sets the "tenant_id" field.
func (_c *PayChannelCreate) SetTenantID(v uint64) *PayChannelCreate {
_c.mutation.SetTenantID(v)
return _c
}
// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableTenantID(v *uint64) *PayChannelCreate {
if v != nil {
_c.SetTenantID(*v)
}
return _c
}
// SetDeletedAt sets the "deleted_at" field.
func (_c *PayChannelCreate) SetDeletedAt(v time.Time) *PayChannelCreate {
_c.mutation.SetDeletedAt(v)
return _c
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableDeletedAt(v *time.Time) *PayChannelCreate {
if v != nil {
_c.SetDeletedAt(*v)
}
return _c
}
// SetCode sets the "code" field.
func (_c *PayChannelCreate) SetCode(v string) *PayChannelCreate {
_c.mutation.SetCode(v)
return _c
}
// SetNameEn sets the "name_en" field.
func (_c *PayChannelCreate) SetNameEn(v string) *PayChannelCreate {
_c.mutation.SetNameEn(v)
return _c
}
// SetNameZh sets the "name_zh" field.
func (_c *PayChannelCreate) SetNameZh(v string) *PayChannelCreate {
_c.mutation.SetNameZh(v)
return _c
}
// SetFreeRate sets the "free_rate" field.
func (_c *PayChannelCreate) SetFreeRate(v string) *PayChannelCreate {
_c.mutation.SetFreeRate(v)
return _c
}
// SetNillableFreeRate sets the "free_rate" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableFreeRate(v *string) *PayChannelCreate {
if v != nil {
_c.SetFreeRate(*v)
}
return _c
}
// SetAppID sets the "app_id" field.
func (_c *PayChannelCreate) SetAppID(v uint64) *PayChannelCreate {
_c.mutation.SetAppID(v)
return _c
}
// SetConfig sets the "config" field.
func (_c *PayChannelCreate) SetConfig(v map[string]interface{}) *PayChannelCreate {
_c.mutation.SetConfig(v)
return _c
}
// SetRemake sets the "remake" field.
func (_c *PayChannelCreate) SetRemake(v string) *PayChannelCreate {
_c.mutation.SetRemake(v)
return _c
}
// SetNillableRemake sets the "remake" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableRemake(v *string) *PayChannelCreate {
if v != nil {
_c.SetRemake(*v)
}
return _c
}
// SetIcon sets the "icon" field.
func (_c *PayChannelCreate) SetIcon(v uint64) *PayChannelCreate {
_c.mutation.SetIcon(v)
return _c
}
// SetNillableIcon sets the "icon" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableIcon(v *uint64) *PayChannelCreate {
if v != nil {
_c.SetIcon(*v)
}
return _c
}
// SetOrderTimeOut sets the "order_time_out" field.
func (_c *PayChannelCreate) SetOrderTimeOut(v string) *PayChannelCreate {
_c.mutation.SetOrderTimeOut(v)
return _c
}
// SetNillableOrderTimeOut sets the "order_time_out" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableOrderTimeOut(v *string) *PayChannelCreate {
if v != nil {
_c.SetOrderTimeOut(*v)
}
return _c
}
// SetSupportCurrency sets the "support_currency" field.
func (_c *PayChannelCreate) SetSupportCurrency(v string) *PayChannelCreate {
_c.mutation.SetSupportCurrency(v)
return _c
}
// SetNillableSupportCurrency sets the "support_currency" field if the given value is not nil.
func (_c *PayChannelCreate) SetNillableSupportCurrency(v *string) *PayChannelCreate {
if v != nil {
_c.SetSupportCurrency(*v)
}
return _c
}
// SetID sets the "id" field.
func (_c *PayChannelCreate) SetID(v uint64) *PayChannelCreate {
_c.mutation.SetID(v)
return _c
}
// AddOrderIDs adds the "orders" edge to the PayOrder entity by IDs.
func (_c *PayChannelCreate) AddOrderIDs(ids ...uint64) *PayChannelCreate {
_c.mutation.AddOrderIDs(ids...)
return _c
}
// AddOrders adds the "orders" edges to the PayOrder entity.
func (_c *PayChannelCreate) AddOrders(v ...*PayOrder) *PayChannelCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddOrderIDs(ids...)
}
// AddOrdersExtensionIDs adds the "orders_extension" edge to the PayOrderExtension entity by IDs.
func (_c *PayChannelCreate) AddOrdersExtensionIDs(ids ...uint64) *PayChannelCreate {
_c.mutation.AddOrdersExtensionIDs(ids...)
return _c
}
// AddOrdersExtension adds the "orders_extension" edges to the PayOrderExtension entity.
func (_c *PayChannelCreate) AddOrdersExtension(v ...*PayOrderExtension) *PayChannelCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddOrdersExtensionIDs(ids...)
}
// AddRefundIDs adds the "refund" edge to the PayRefund entity by IDs.
func (_c *PayChannelCreate) AddRefundIDs(ids ...uint64) *PayChannelCreate {
_c.mutation.AddRefundIDs(ids...)
return _c
}
// AddRefund adds the "refund" edges to the PayRefund entity.
func (_c *PayChannelCreate) AddRefund(v ...*PayRefund) *PayChannelCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddRefundIDs(ids...)
}
// SetApp sets the "app" edge to the App entity.
func (_c *PayChannelCreate) SetApp(v *App) *PayChannelCreate {
return _c.SetAppID(v.ID)
}
// Mutation returns the PayChannelMutation object of the builder.
func (_c *PayChannelCreate) Mutation() *PayChannelMutation {
return _c.mutation
}
// Save creates the PayChannel in the database.
func (_c *PayChannelCreate) Save(ctx context.Context) (*PayChannel, error) {
_c.defaults()
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (_c *PayChannelCreate) SaveX(ctx context.Context) *PayChannel {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PayChannelCreate) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PayChannelCreate) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_c *PayChannelCreate) defaults() {
if _, ok := _c.mutation.CreatedAt(); !ok {
v := paychannel.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
v := paychannel.DefaultUpdatedAt()
_c.mutation.SetUpdatedAt(v)
}
if _, ok := _c.mutation.Status(); !ok {
v := paychannel.DefaultStatus
_c.mutation.SetStatus(v)
}
if _, ok := _c.mutation.TenantID(); !ok {
v := paychannel.DefaultTenantID
_c.mutation.SetTenantID(v)
}
if _, ok := _c.mutation.FreeRate(); !ok {
v := paychannel.DefaultFreeRate
_c.mutation.SetFreeRate(v)
}
if _, ok := _c.mutation.OrderTimeOut(); !ok {
v := paychannel.DefaultOrderTimeOut
_c.mutation.SetOrderTimeOut(v)
}
if _, ok := _c.mutation.SupportCurrency(); !ok {
v := paychannel.DefaultSupportCurrency
_c.mutation.SetSupportCurrency(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_c *PayChannelCreate) check() error {
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "PayChannel.created_at"`)}
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "PayChannel.updated_at"`)}
}
if _, ok := _c.mutation.TenantID(); !ok {
return &ValidationError{Name: "tenant_id", err: errors.New(`ent: missing required field "PayChannel.tenant_id"`)}
}
if _, ok := _c.mutation.Code(); !ok {
return &ValidationError{Name: "code", err: errors.New(`ent: missing required field "PayChannel.code"`)}
}
if _, ok := _c.mutation.NameEn(); !ok {
return &ValidationError{Name: "name_en", err: errors.New(`ent: missing required field "PayChannel.name_en"`)}
}
if _, ok := _c.mutation.NameZh(); !ok {
return &ValidationError{Name: "name_zh", err: errors.New(`ent: missing required field "PayChannel.name_zh"`)}
}
if _, ok := _c.mutation.FreeRate(); !ok {
return &ValidationError{Name: "free_rate", err: errors.New(`ent: missing required field "PayChannel.free_rate"`)}
}
if _, ok := _c.mutation.AppID(); !ok {
return &ValidationError{Name: "app_id", err: errors.New(`ent: missing required field "PayChannel.app_id"`)}
}
if _, ok := _c.mutation.Config(); !ok {
return &ValidationError{Name: "config", err: errors.New(`ent: missing required field "PayChannel.config"`)}
}
if _, ok := _c.mutation.OrderTimeOut(); !ok {
return &ValidationError{Name: "order_time_out", err: errors.New(`ent: missing required field "PayChannel.order_time_out"`)}
}
if _, ok := _c.mutation.SupportCurrency(); !ok {
return &ValidationError{Name: "support_currency", err: errors.New(`ent: missing required field "PayChannel.support_currency"`)}
}
if len(_c.mutation.AppIDs()) == 0 {
return &ValidationError{Name: "app", err: errors.New(`ent: missing required edge "PayChannel.app"`)}
}
return nil
}
func (_c *PayChannelCreate) sqlSave(ctx context.Context) (*PayChannel, error) {
if err := _c.check(); err != nil {
return nil, err
}
_node, _spec := _c.createSpec()
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
if _spec.ID.Value != _node.ID {
id := _spec.ID.Value.(int64)
_node.ID = uint64(id)
}
_c.mutation.id = &_node.ID
_c.mutation.done = true
return _node, nil
}
func (_c *PayChannelCreate) createSpec() (*PayChannel, *sqlgraph.CreateSpec) {
var (
_node = &PayChannel{config: _c.config}
_spec = sqlgraph.NewCreateSpec(paychannel.Table, sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64))
)
if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = id
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(paychannel.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(paychannel.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := _c.mutation.Status(); ok {
_spec.SetField(paychannel.FieldStatus, field.TypeUint8, value)
_node.Status = value
}
if value, ok := _c.mutation.TenantID(); ok {
_spec.SetField(paychannel.FieldTenantID, field.TypeUint64, value)
_node.TenantID = value
}
if value, ok := _c.mutation.DeletedAt(); ok {
_spec.SetField(paychannel.FieldDeletedAt, field.TypeTime, value)
_node.DeletedAt = value
}
if value, ok := _c.mutation.Code(); ok {
_spec.SetField(paychannel.FieldCode, field.TypeString, value)
_node.Code = value
}
if value, ok := _c.mutation.NameEn(); ok {
_spec.SetField(paychannel.FieldNameEn, field.TypeString, value)
_node.NameEn = value
}
if value, ok := _c.mutation.NameZh(); ok {
_spec.SetField(paychannel.FieldNameZh, field.TypeString, value)
_node.NameZh = value
}
if value, ok := _c.mutation.FreeRate(); ok {
_spec.SetField(paychannel.FieldFreeRate, field.TypeString, value)
_node.FreeRate = value
}
if value, ok := _c.mutation.Config(); ok {
_spec.SetField(paychannel.FieldConfig, field.TypeJSON, value)
_node.Config = value
}
if value, ok := _c.mutation.Remake(); ok {
_spec.SetField(paychannel.FieldRemake, field.TypeString, value)
_node.Remake = value
}
if value, ok := _c.mutation.Icon(); ok {
_spec.SetField(paychannel.FieldIcon, field.TypeUint64, value)
_node.Icon = value
}
if value, ok := _c.mutation.OrderTimeOut(); ok {
_spec.SetField(paychannel.FieldOrderTimeOut, field.TypeString, value)
_node.OrderTimeOut = value
}
if value, ok := _c.mutation.SupportCurrency(); ok {
_spec.SetField(paychannel.FieldSupportCurrency, field.TypeString, value)
_node.SupportCurrency = value
}
if nodes := _c.mutation.OrdersIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: paychannel.OrdersTable,
Columns: []string{paychannel.OrdersColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.OrdersExtensionIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: paychannel.OrdersExtensionTable,
Columns: []string{paychannel.OrdersExtensionColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorderextension.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.RefundIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: paychannel.RefundTable,
Columns: []string{paychannel.RefundColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payrefund.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.AppIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: paychannel.AppTable,
Columns: []string{paychannel.AppColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(app.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_node.AppID = nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
return _node, _spec
}
// PayChannelCreateBulk is the builder for creating many PayChannel entities in bulk.
type PayChannelCreateBulk struct {
config
err error
builders []*PayChannelCreate
}
// Save creates the PayChannel entities in the database.
func (_c *PayChannelCreateBulk) Save(ctx context.Context) ([]*PayChannel, error) {
if _c.err != nil {
return nil, _c.err
}
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
nodes := make([]*PayChannel, len(_c.builders))
mutators := make([]Mutator, len(_c.builders))
for i := range _c.builders {
func(i int, root context.Context) {
builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*PayChannelMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
if err := builder.check(); err != nil {
return nil, err
}
builder.mutation = mutation
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
} else {
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
}
}
if err != nil {
return nil, err
}
mutation.id = &nodes[i].ID
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
id := specs[i].ID.Value.(int64)
nodes[i].ID = uint64(id)
}
mutation.done = true
return nodes[i], nil
})
for i := len(builder.hooks) - 1; i >= 0; i-- {
mut = builder.hooks[i](mut)
}
mutators[i] = mut
}(i, ctx)
}
if len(mutators) > 0 {
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
return nodes, nil
}
// SaveX is like Save, but panics if an error occurs.
func (_c *PayChannelCreateBulk) SaveX(ctx context.Context) []*PayChannel {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PayChannelCreateBulk) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PayChannelCreateBulk) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}

View File

@ -0,0 +1,88 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayChannelDelete is the builder for deleting a PayChannel entity.
type PayChannelDelete struct {
config
hooks []Hook
mutation *PayChannelMutation
}
// Where appends a list predicates to the PayChannelDelete builder.
func (_d *PayChannelDelete) Where(ps ...predicate.PayChannel) *PayChannelDelete {
_d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (_d *PayChannelDelete) Exec(ctx context.Context) (int, error) {
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *PayChannelDelete) ExecX(ctx context.Context) int {
n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (_d *PayChannelDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(paychannel.Table, sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64))
if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
_d.mutation.done = true
return affected, err
}
// PayChannelDeleteOne is the builder for deleting a single PayChannel entity.
type PayChannelDeleteOne struct {
_d *PayChannelDelete
}
// Where appends a list predicates to the PayChannelDelete builder.
func (_d *PayChannelDeleteOne) Where(ps ...predicate.PayChannel) *PayChannelDeleteOne {
_d._d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query.
func (_d *PayChannelDeleteOne) Exec(ctx context.Context) error {
n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{paychannel.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *PayChannelDeleteOne) ExecX(ctx context.Context) {
if err := _d.Exec(ctx); err != nil {
panic(err)
}
}

831
rpc/ent/paychannel_query.go Normal file
View File

@ -0,0 +1,831 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"database/sql/driver"
"fmt"
"math"
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayChannelQuery is the builder for querying PayChannel entities.
type PayChannelQuery struct {
config
ctx *QueryContext
order []paychannel.OrderOption
inters []Interceptor
predicates []predicate.PayChannel
withOrders *PayOrderQuery
withOrdersExtension *PayOrderExtensionQuery
withRefund *PayRefundQuery
withApp *AppQuery
// intermediate query (i.e. traversal path).
sql *sql.Selector
path func(context.Context) (*sql.Selector, error)
}
// Where adds a new predicate for the PayChannelQuery builder.
func (_q *PayChannelQuery) Where(ps ...predicate.PayChannel) *PayChannelQuery {
_q.predicates = append(_q.predicates, ps...)
return _q
}
// Limit the number of records to be returned by this query.
func (_q *PayChannelQuery) Limit(limit int) *PayChannelQuery {
_q.ctx.Limit = &limit
return _q
}
// Offset to start from.
func (_q *PayChannelQuery) Offset(offset int) *PayChannelQuery {
_q.ctx.Offset = &offset
return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
func (_q *PayChannelQuery) Unique(unique bool) *PayChannelQuery {
_q.ctx.Unique = &unique
return _q
}
// Order specifies how the records should be ordered.
func (_q *PayChannelQuery) Order(o ...paychannel.OrderOption) *PayChannelQuery {
_q.order = append(_q.order, o...)
return _q
}
// QueryOrders chains the current query on the "orders" edge.
func (_q *PayChannelQuery) QueryOrders() *PayOrderQuery {
query := (&PayOrderClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(paychannel.Table, paychannel.FieldID, selector),
sqlgraph.To(payorder.Table, payorder.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, paychannel.OrdersTable, paychannel.OrdersColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryOrdersExtension chains the current query on the "orders_extension" edge.
func (_q *PayChannelQuery) QueryOrdersExtension() *PayOrderExtensionQuery {
query := (&PayOrderExtensionClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(paychannel.Table, paychannel.FieldID, selector),
sqlgraph.To(payorderextension.Table, payorderextension.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, paychannel.OrdersExtensionTable, paychannel.OrdersExtensionColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryRefund chains the current query on the "refund" edge.
func (_q *PayChannelQuery) QueryRefund() *PayRefundQuery {
query := (&PayRefundClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(paychannel.Table, paychannel.FieldID, selector),
sqlgraph.To(payrefund.Table, payrefund.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, paychannel.RefundTable, paychannel.RefundColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryApp chains the current query on the "app" edge.
func (_q *PayChannelQuery) QueryApp() *AppQuery {
query := (&AppClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(paychannel.Table, paychannel.FieldID, selector),
sqlgraph.To(app.Table, app.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, paychannel.AppTable, paychannel.AppColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// First returns the first PayChannel entity from the query.
// Returns a *NotFoundError when no PayChannel was found.
func (_q *PayChannelQuery) First(ctx context.Context) (*PayChannel, error) {
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
if len(nodes) == 0 {
return nil, &NotFoundError{paychannel.Label}
}
return nodes[0], nil
}
// FirstX is like First, but panics if an error occurs.
func (_q *PayChannelQuery) FirstX(ctx context.Context) *PayChannel {
node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return node
}
// FirstID returns the first PayChannel ID from the query.
// Returns a *NotFoundError when no PayChannel ID was found.
func (_q *PayChannelQuery) FirstID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
err = &NotFoundError{paychannel.Label}
return
}
return ids[0], nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func (_q *PayChannelQuery) FirstIDX(ctx context.Context) uint64 {
id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return id
}
// Only returns a single PayChannel entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one PayChannel entity is found.
// Returns a *NotFoundError when no PayChannel entities are found.
func (_q *PayChannelQuery) Only(ctx context.Context) (*PayChannel, error) {
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
switch len(nodes) {
case 1:
return nodes[0], nil
case 0:
return nil, &NotFoundError{paychannel.Label}
default:
return nil, &NotSingularError{paychannel.Label}
}
}
// OnlyX is like Only, but panics if an error occurs.
func (_q *PayChannelQuery) OnlyX(ctx context.Context) *PayChannel {
node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
return node
}
// OnlyID is like Only, but returns the only PayChannel ID in the query.
// Returns a *NotSingularError when more than one PayChannel ID is found.
// Returns a *NotFoundError when no entities are found.
func (_q *PayChannelQuery) OnlyID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
case 1:
id = ids[0]
case 0:
err = &NotFoundError{paychannel.Label}
default:
err = &NotSingularError{paychannel.Label}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func (_q *PayChannelQuery) OnlyIDX(ctx context.Context) uint64 {
id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
return id
}
// All executes the query and returns a list of PayChannels.
func (_q *PayChannelQuery) All(ctx context.Context) ([]*PayChannel, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*PayChannel, *PayChannelQuery]()
return withInterceptors[[]*PayChannel](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
func (_q *PayChannelQuery) AllX(ctx context.Context) []*PayChannel {
nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
return nodes
}
// IDs executes the query and returns a list of PayChannel IDs.
func (_q *PayChannelQuery) IDs(ctx context.Context) (ids []uint64, err error) {
if _q.ctx.Unique == nil && _q.path != nil {
_q.Unique(true)
}
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
if err = _q.Select(paychannel.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
func (_q *PayChannelQuery) IDsX(ctx context.Context) []uint64 {
ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
return ids
}
// Count returns the count of the given query.
func (_q *PayChannelQuery) Count(ctx context.Context) (int, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
return withInterceptors[int](ctx, _q, querierCount[*PayChannelQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
func (_q *PayChannelQuery) CountX(ctx context.Context) int {
count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
return count
}
// Exist returns true if the query has elements in the graph.
func (_q *PayChannelQuery) Exist(ctx context.Context) (bool, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
}
}
// ExistX is like Exist, but panics if an error occurs.
func (_q *PayChannelQuery) ExistX(ctx context.Context) bool {
exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
return exist
}
// Clone returns a duplicate of the PayChannelQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func (_q *PayChannelQuery) Clone() *PayChannelQuery {
if _q == nil {
return nil
}
return &PayChannelQuery{
config: _q.config,
ctx: _q.ctx.Clone(),
order: append([]paychannel.OrderOption{}, _q.order...),
inters: append([]Interceptor{}, _q.inters...),
predicates: append([]predicate.PayChannel{}, _q.predicates...),
withOrders: _q.withOrders.Clone(),
withOrdersExtension: _q.withOrdersExtension.Clone(),
withRefund: _q.withRefund.Clone(),
withApp: _q.withApp.Clone(),
// clone intermediate query.
sql: _q.sql.Clone(),
path: _q.path,
}
}
// WithOrders tells the query-builder to eager-load the nodes that are connected to
// the "orders" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayChannelQuery) WithOrders(opts ...func(*PayOrderQuery)) *PayChannelQuery {
query := (&PayOrderClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withOrders = query
return _q
}
// WithOrdersExtension tells the query-builder to eager-load the nodes that are connected to
// the "orders_extension" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayChannelQuery) WithOrdersExtension(opts ...func(*PayOrderExtensionQuery)) *PayChannelQuery {
query := (&PayOrderExtensionClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withOrdersExtension = query
return _q
}
// WithRefund tells the query-builder to eager-load the nodes that are connected to
// the "refund" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayChannelQuery) WithRefund(opts ...func(*PayRefundQuery)) *PayChannelQuery {
query := (&PayRefundClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withRefund = query
return _q
}
// WithApp tells the query-builder to eager-load the nodes that are connected to
// the "app" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayChannelQuery) WithApp(opts ...func(*AppQuery)) *PayChannelQuery {
query := (&AppClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withApp = query
return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.PayChannel.Query().
// GroupBy(paychannel.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func (_q *PayChannelQuery) GroupBy(field string, fields ...string) *PayChannelGroupBy {
_q.ctx.Fields = append([]string{field}, fields...)
grbuild := &PayChannelGroupBy{build: _q}
grbuild.flds = &_q.ctx.Fields
grbuild.label = paychannel.Label
grbuild.scan = grbuild.Scan
return grbuild
}
// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// }
//
// client.PayChannel.Query().
// Select(paychannel.FieldCreatedAt).
// Scan(ctx, &v)
func (_q *PayChannelQuery) Select(fields ...string) *PayChannelSelect {
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
sbuild := &PayChannelSelect{PayChannelQuery: _q}
sbuild.label = paychannel.Label
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a PayChannelSelect configured with the given aggregations.
func (_q *PayChannelQuery) Aggregate(fns ...AggregateFunc) *PayChannelSelect {
return _q.Select().Aggregate(fns...)
}
func (_q *PayChannelQuery) prepareQuery(ctx context.Context) error {
for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
for _, f := range _q.ctx.Fields {
if !paychannel.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
if _q.path != nil {
prev, err := _q.path(ctx)
if err != nil {
return err
}
_q.sql = prev
}
return nil
}
func (_q *PayChannelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*PayChannel, error) {
var (
nodes = []*PayChannel{}
_spec = _q.querySpec()
loadedTypes = [4]bool{
_q.withOrders != nil,
_q.withOrdersExtension != nil,
_q.withRefund != nil,
_q.withApp != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*PayChannel).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
node := &PayChannel{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
}
for i := range hooks {
hooks[i](ctx, _spec)
}
if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
if query := _q.withOrders; query != nil {
if err := _q.loadOrders(ctx, query, nodes,
func(n *PayChannel) { n.Edges.Orders = []*PayOrder{} },
func(n *PayChannel, e *PayOrder) { n.Edges.Orders = append(n.Edges.Orders, e) }); err != nil {
return nil, err
}
}
if query := _q.withOrdersExtension; query != nil {
if err := _q.loadOrdersExtension(ctx, query, nodes,
func(n *PayChannel) { n.Edges.OrdersExtension = []*PayOrderExtension{} },
func(n *PayChannel, e *PayOrderExtension) {
n.Edges.OrdersExtension = append(n.Edges.OrdersExtension, e)
}); err != nil {
return nil, err
}
}
if query := _q.withRefund; query != nil {
if err := _q.loadRefund(ctx, query, nodes,
func(n *PayChannel) { n.Edges.Refund = []*PayRefund{} },
func(n *PayChannel, e *PayRefund) { n.Edges.Refund = append(n.Edges.Refund, e) }); err != nil {
return nil, err
}
}
if query := _q.withApp; query != nil {
if err := _q.loadApp(ctx, query, nodes, nil,
func(n *PayChannel, e *App) { n.Edges.App = e }); err != nil {
return nil, err
}
}
return nodes, nil
}
func (_q *PayChannelQuery) loadOrders(ctx context.Context, query *PayOrderQuery, nodes []*PayChannel, init func(*PayChannel), assign func(*PayChannel, *PayOrder)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*PayChannel)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(payorder.FieldChannelID)
}
query.Where(predicate.PayOrder(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(paychannel.OrdersColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.ChannelID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "channel_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *PayChannelQuery) loadOrdersExtension(ctx context.Context, query *PayOrderExtensionQuery, nodes []*PayChannel, init func(*PayChannel), assign func(*PayChannel, *PayOrderExtension)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*PayChannel)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(payorderextension.FieldChannelID)
}
query.Where(predicate.PayOrderExtension(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(paychannel.OrdersExtensionColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.ChannelID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "channel_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *PayChannelQuery) loadRefund(ctx context.Context, query *PayRefundQuery, nodes []*PayChannel, init func(*PayChannel), assign func(*PayChannel, *PayRefund)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*PayChannel)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(payrefund.FieldChannelID)
}
query.Where(predicate.PayRefund(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(paychannel.RefundColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.ChannelID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "channel_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *PayChannelQuery) loadApp(ctx context.Context, query *AppQuery, nodes []*PayChannel, init func(*PayChannel), assign func(*PayChannel, *App)) error {
ids := make([]uint64, 0, len(nodes))
nodeids := make(map[uint64][]*PayChannel)
for i := range nodes {
fk := nodes[i].AppID
if _, ok := nodeids[fk]; !ok {
ids = append(ids, fk)
}
nodeids[fk] = append(nodeids[fk], nodes[i])
}
if len(ids) == 0 {
return nil
}
query.Where(app.IDIn(ids...))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
nodes, ok := nodeids[n.ID]
if !ok {
return fmt.Errorf(`unexpected foreign-key "app_id" returned %v`, n.ID)
}
for i := range nodes {
assign(nodes[i], n)
}
}
return nil
}
func (_q *PayChannelQuery) sqlCount(ctx context.Context) (int, error) {
_spec := _q.querySpec()
_spec.Node.Columns = _q.ctx.Fields
if len(_q.ctx.Fields) > 0 {
_spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
func (_q *PayChannelQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(paychannel.Table, paychannel.Columns, sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64))
_spec.From = _q.sql
if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
} else if _q.path != nil {
_spec.Unique = true
}
if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, paychannel.FieldID)
for i := range fields {
if fields[i] != paychannel.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
if _q.withApp != nil {
_spec.Node.AddColumnOnce(paychannel.FieldAppID)
}
}
if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
return _spec
}
func (_q *PayChannelQuery) sqlQuery(ctx context.Context) *sql.Selector {
builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(paychannel.Table)
columns := _q.ctx.Fields
if len(columns) == 0 {
columns = paychannel.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
if _q.sql != nil {
selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
for _, p := range _q.predicates {
p(selector)
}
for _, p := range _q.order {
p(selector)
}
if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
}
// PayChannelGroupBy is the group-by builder for PayChannel entities.
type PayChannelGroupBy struct {
selector
build *PayChannelQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func (_g *PayChannelGroupBy) Aggregate(fns ...AggregateFunc) *PayChannelGroupBy {
_g.fns = append(_g.fns, fns...)
return _g
}
// Scan applies the selector query and scans the result into the given value.
func (_g *PayChannelGroupBy) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*PayChannelQuery, *PayChannelGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
func (_g *PayChannelGroupBy) sqlScan(ctx context.Context, root *PayChannelQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
aggregation := make([]string, 0, len(_g.fns))
for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}
// PayChannelSelect is the builder for selecting fields of PayChannel entities.
type PayChannelSelect struct {
*PayChannelQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func (_s *PayChannelSelect) Aggregate(fns ...AggregateFunc) *PayChannelSelect {
_s.fns = append(_s.fns, fns...)
return _s
}
// Scan applies the selector query and scans the result into the given value.
func (_s *PayChannelSelect) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
if err := _s.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*PayChannelQuery, *PayChannelSelect](ctx, _s.PayChannelQuery, _s, _s.inters, v)
}
func (_s *PayChannelSelect) sqlScan(ctx context.Context, root *PayChannelQuery, v any) error {
selector := root.sqlQuery(ctx)
aggregation := make([]string, 0, len(_s.fns))
for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
selector.AppendSelect(aggregation...)
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}

1302
rpc/ent/paychannel_update.go Normal file

File diff suppressed because it is too large Load Diff

447
rpc/ent/payorder.go Normal file
View File

@ -0,0 +1,447 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"fmt"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/payorder"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// PayOrder Table | 支付订单表
type PayOrder 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
ChannelID uint64 `json:"channel_id,omitempty"`
// 用户 ID
UserID uint64 `json:"user_id,omitempty"`
// 商品标题
Subject string `json:"subject,omitempty"`
// 商品描述
Body string `json:"body,omitempty"`
// 异步通知地址
NotifyURL string `json:"notify_url,omitempty"`
// 金额,单位为分
Amount uint64 `json:"amount,omitempty"`
// 支付来源
PaySource string `json:"pay_source,omitempty"`
// 本次渠道费率,百分比
ChannelFeeRate string `json:"channel_fee_rate,omitempty"`
// 本次渠道实际收取费y
ChannelFee uint64 `json:"channel_fee,omitempty"`
// 订单状态
OrderStatus string `json:"order_status,omitempty"`
// 用户 IP
UserIP string `json:"user_ip,omitempty"`
// 订单过期时间
ExpireTime time.Time `json:"expire_time,omitempty"`
// 支付单号
PayNo string `json:"pay_no,omitempty"`
// 订单支付成功时间
SuccessTime time.Time `json:"success_time,omitempty"`
// 支付成功的订单拓展单ID
ExtensionID uint64 `json:"extension_id,omitempty"`
// 交易流水号,有一些平台可能会有
TransactionID string `json:"transaction_id,omitempty"`
// 货币代码
Currency string `json:"currency,omitempty"`
// 退款金额,单位为分
RefundPrice uint64 `json:"refund_price,omitempty"`
// 渠道订单号
ChannelOrderNo string `json:"channel_order_no,omitempty"`
// 渠道用户 ID
ChannelUserID string `json:"channel_user_id,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PayOrderQuery when eager-loading is set.
Edges PayOrderEdges `json:"edges"`
selectValues sql.SelectValues
}
// PayOrderEdges holds the relations/edges for other nodes in the graph.
type PayOrderEdges struct {
// Channel holds the value of the channel edge.
Channel *PayChannel `json:"channel,omitempty"`
// OrdersExtension holds the value of the orders_extension edge.
OrdersExtension []*PayOrderExtension `json:"orders_extension,omitempty"`
// NotifyTask holds the value of the notify_task edge.
NotifyTask []*PayNotifyTask `json:"notify_task,omitempty"`
// Refund holds the value of the refund edge.
Refund []*PayRefund `json:"refund,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [4]bool
}
// ChannelOrErr returns the Channel value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e PayOrderEdges) ChannelOrErr() (*PayChannel, error) {
if e.Channel != nil {
return e.Channel, nil
} else if e.loadedTypes[0] {
return nil, &NotFoundError{label: paychannel.Label}
}
return nil, &NotLoadedError{edge: "channel"}
}
// OrdersExtensionOrErr returns the OrdersExtension value or an error if the edge
// was not loaded in eager-loading.
func (e PayOrderEdges) OrdersExtensionOrErr() ([]*PayOrderExtension, error) {
if e.loadedTypes[1] {
return e.OrdersExtension, nil
}
return nil, &NotLoadedError{edge: "orders_extension"}
}
// NotifyTaskOrErr returns the NotifyTask value or an error if the edge
// was not loaded in eager-loading.
func (e PayOrderEdges) NotifyTaskOrErr() ([]*PayNotifyTask, error) {
if e.loadedTypes[2] {
return e.NotifyTask, nil
}
return nil, &NotLoadedError{edge: "notify_task"}
}
// RefundOrErr returns the Refund value or an error if the edge
// was not loaded in eager-loading.
func (e PayOrderEdges) RefundOrErr() ([]*PayRefund, error) {
if e.loadedTypes[3] {
return e.Refund, nil
}
return nil, &NotLoadedError{edge: "refund"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*PayOrder) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case payorder.FieldID, payorder.FieldStatus, payorder.FieldTenantID, payorder.FieldChannelID, payorder.FieldUserID, payorder.FieldAmount, payorder.FieldChannelFee, payorder.FieldExtensionID, payorder.FieldRefundPrice:
values[i] = new(sql.NullInt64)
case payorder.FieldSubject, payorder.FieldBody, payorder.FieldNotifyURL, payorder.FieldPaySource, payorder.FieldChannelFeeRate, payorder.FieldOrderStatus, payorder.FieldUserIP, payorder.FieldPayNo, payorder.FieldTransactionID, payorder.FieldCurrency, payorder.FieldChannelOrderNo, payorder.FieldChannelUserID:
values[i] = new(sql.NullString)
case payorder.FieldCreatedAt, payorder.FieldUpdatedAt, payorder.FieldDeletedAt, payorder.FieldExpireTime, payorder.FieldSuccessTime:
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 PayOrder fields.
func (_m *PayOrder) 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 payorder.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 payorder.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 payorder.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 payorder.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 payorder.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 payorder.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 payorder.FieldChannelID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field channel_id", values[i])
} else if value.Valid {
_m.ChannelID = uint64(value.Int64)
}
case payorder.FieldUserID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field user_id", values[i])
} else if value.Valid {
_m.UserID = uint64(value.Int64)
}
case payorder.FieldSubject:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field subject", values[i])
} else if value.Valid {
_m.Subject = value.String
}
case payorder.FieldBody:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field body", values[i])
} else if value.Valid {
_m.Body = value.String
}
case payorder.FieldNotifyURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field notify_url", values[i])
} else if value.Valid {
_m.NotifyURL = value.String
}
case payorder.FieldAmount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field amount", values[i])
} else if value.Valid {
_m.Amount = uint64(value.Int64)
}
case payorder.FieldPaySource:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field pay_source", values[i])
} else if value.Valid {
_m.PaySource = value.String
}
case payorder.FieldChannelFeeRate:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field channel_fee_rate", values[i])
} else if value.Valid {
_m.ChannelFeeRate = value.String
}
case payorder.FieldChannelFee:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field channel_fee", values[i])
} else if value.Valid {
_m.ChannelFee = uint64(value.Int64)
}
case payorder.FieldOrderStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field order_status", values[i])
} else if value.Valid {
_m.OrderStatus = value.String
}
case payorder.FieldUserIP:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field user_ip", values[i])
} else if value.Valid {
_m.UserIP = value.String
}
case payorder.FieldExpireTime:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field expire_time", values[i])
} else if value.Valid {
_m.ExpireTime = value.Time
}
case payorder.FieldPayNo:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field pay_no", values[i])
} else if value.Valid {
_m.PayNo = value.String
}
case payorder.FieldSuccessTime:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field success_time", values[i])
} else if value.Valid {
_m.SuccessTime = value.Time
}
case payorder.FieldExtensionID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field extension_id", values[i])
} else if value.Valid {
_m.ExtensionID = uint64(value.Int64)
}
case payorder.FieldTransactionID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field transaction_id", values[i])
} else if value.Valid {
_m.TransactionID = value.String
}
case payorder.FieldCurrency:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field currency", values[i])
} else if value.Valid {
_m.Currency = value.String
}
case payorder.FieldRefundPrice:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field refund_price", values[i])
} else if value.Valid {
_m.RefundPrice = uint64(value.Int64)
}
case payorder.FieldChannelOrderNo:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field channel_order_no", values[i])
} else if value.Valid {
_m.ChannelOrderNo = value.String
}
case payorder.FieldChannelUserID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field channel_user_id", values[i])
} else if value.Valid {
_m.ChannelUserID = 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 PayOrder.
// This includes values selected through modifiers, order, etc.
func (_m *PayOrder) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryChannel queries the "channel" edge of the PayOrder entity.
func (_m *PayOrder) QueryChannel() *PayChannelQuery {
return NewPayOrderClient(_m.config).QueryChannel(_m)
}
// QueryOrdersExtension queries the "orders_extension" edge of the PayOrder entity.
func (_m *PayOrder) QueryOrdersExtension() *PayOrderExtensionQuery {
return NewPayOrderClient(_m.config).QueryOrdersExtension(_m)
}
// QueryNotifyTask queries the "notify_task" edge of the PayOrder entity.
func (_m *PayOrder) QueryNotifyTask() *PayNotifyTaskQuery {
return NewPayOrderClient(_m.config).QueryNotifyTask(_m)
}
// QueryRefund queries the "refund" edge of the PayOrder entity.
func (_m *PayOrder) QueryRefund() *PayRefundQuery {
return NewPayOrderClient(_m.config).QueryRefund(_m)
}
// Update returns a builder for updating this PayOrder.
// Note that you need to call PayOrder.Unwrap() before calling this method if this PayOrder
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *PayOrder) Update() *PayOrderUpdateOne {
return NewPayOrderClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the PayOrder 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 *PayOrder) Unwrap() *PayOrder {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: PayOrder is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *PayOrder) String() string {
var builder strings.Builder
builder.WriteString("PayOrder(")
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("channel_id=")
builder.WriteString(fmt.Sprintf("%v", _m.ChannelID))
builder.WriteString(", ")
builder.WriteString("user_id=")
builder.WriteString(fmt.Sprintf("%v", _m.UserID))
builder.WriteString(", ")
builder.WriteString("subject=")
builder.WriteString(_m.Subject)
builder.WriteString(", ")
builder.WriteString("body=")
builder.WriteString(_m.Body)
builder.WriteString(", ")
builder.WriteString("notify_url=")
builder.WriteString(_m.NotifyURL)
builder.WriteString(", ")
builder.WriteString("amount=")
builder.WriteString(fmt.Sprintf("%v", _m.Amount))
builder.WriteString(", ")
builder.WriteString("pay_source=")
builder.WriteString(_m.PaySource)
builder.WriteString(", ")
builder.WriteString("channel_fee_rate=")
builder.WriteString(_m.ChannelFeeRate)
builder.WriteString(", ")
builder.WriteString("channel_fee=")
builder.WriteString(fmt.Sprintf("%v", _m.ChannelFee))
builder.WriteString(", ")
builder.WriteString("order_status=")
builder.WriteString(_m.OrderStatus)
builder.WriteString(", ")
builder.WriteString("user_ip=")
builder.WriteString(_m.UserIP)
builder.WriteString(", ")
builder.WriteString("expire_time=")
builder.WriteString(_m.ExpireTime.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("pay_no=")
builder.WriteString(_m.PayNo)
builder.WriteString(", ")
builder.WriteString("success_time=")
builder.WriteString(_m.SuccessTime.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("extension_id=")
builder.WriteString(fmt.Sprintf("%v", _m.ExtensionID))
builder.WriteString(", ")
builder.WriteString("transaction_id=")
builder.WriteString(_m.TransactionID)
builder.WriteString(", ")
builder.WriteString("currency=")
builder.WriteString(_m.Currency)
builder.WriteString(", ")
builder.WriteString("refund_price=")
builder.WriteString(fmt.Sprintf("%v", _m.RefundPrice))
builder.WriteString(", ")
builder.WriteString("channel_order_no=")
builder.WriteString(_m.ChannelOrderNo)
builder.WriteString(", ")
builder.WriteString("channel_user_id=")
builder.WriteString(_m.ChannelUserID)
builder.WriteByte(')')
return builder.String()
}
// PayOrders is a parsable slice of PayOrder.
type PayOrders []*PayOrder

View File

@ -0,0 +1,380 @@
// Code generated by ent, DO NOT EDIT.
package payorder
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the payorder type in the database.
Label = "pay_order"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldTenantID holds the string denoting the tenant_id field in the database.
FieldTenantID = "tenant_id"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldChannelID holds the string denoting the channel_id field in the database.
FieldChannelID = "channel_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID = "user_id"
// FieldSubject holds the string denoting the subject field in the database.
FieldSubject = "subject"
// FieldBody holds the string denoting the body field in the database.
FieldBody = "body"
// FieldNotifyURL holds the string denoting the notify_url field in the database.
FieldNotifyURL = "notify_url"
// FieldAmount holds the string denoting the amount field in the database.
FieldAmount = "amount"
// FieldPaySource holds the string denoting the pay_source field in the database.
FieldPaySource = "pay_source"
// FieldChannelFeeRate holds the string denoting the channel_fee_rate field in the database.
FieldChannelFeeRate = "channel_fee_rate"
// FieldChannelFee holds the string denoting the channel_fee field in the database.
FieldChannelFee = "channel_fee"
// FieldOrderStatus holds the string denoting the order_status field in the database.
FieldOrderStatus = "order_status"
// FieldUserIP holds the string denoting the user_ip field in the database.
FieldUserIP = "user_ip"
// FieldExpireTime holds the string denoting the expire_time field in the database.
FieldExpireTime = "expire_time"
// FieldPayNo holds the string denoting the pay_no field in the database.
FieldPayNo = "pay_no"
// FieldSuccessTime holds the string denoting the success_time field in the database.
FieldSuccessTime = "success_time"
// FieldExtensionID holds the string denoting the extension_id field in the database.
FieldExtensionID = "extension_id"
// FieldTransactionID holds the string denoting the transaction_id field in the database.
FieldTransactionID = "transaction_id"
// FieldCurrency holds the string denoting the currency field in the database.
FieldCurrency = "currency"
// FieldRefundPrice holds the string denoting the refund_price field in the database.
FieldRefundPrice = "refund_price"
// FieldChannelOrderNo holds the string denoting the channel_order_no field in the database.
FieldChannelOrderNo = "channel_order_no"
// FieldChannelUserID holds the string denoting the channel_user_id field in the database.
FieldChannelUserID = "channel_user_id"
// EdgeChannel holds the string denoting the channel edge name in mutations.
EdgeChannel = "channel"
// EdgeOrdersExtension holds the string denoting the orders_extension edge name in mutations.
EdgeOrdersExtension = "orders_extension"
// EdgeNotifyTask holds the string denoting the notify_task edge name in mutations.
EdgeNotifyTask = "notify_task"
// EdgeRefund holds the string denoting the refund edge name in mutations.
EdgeRefund = "refund"
// Table holds the table name of the payorder in the database.
Table = "pay_order"
// ChannelTable is the table that holds the channel relation/edge.
ChannelTable = "pay_order"
// ChannelInverseTable is the table name for the PayChannel entity.
// It exists in this package in order to avoid circular dependency with the "paychannel" package.
ChannelInverseTable = "pay_channel"
// ChannelColumn is the table column denoting the channel relation/edge.
ChannelColumn = "channel_id"
// OrdersExtensionTable is the table that holds the orders_extension relation/edge.
OrdersExtensionTable = "pay_order_extension"
// OrdersExtensionInverseTable is the table name for the PayOrderExtension entity.
// It exists in this package in order to avoid circular dependency with the "payorderextension" package.
OrdersExtensionInverseTable = "pay_order_extension"
// OrdersExtensionColumn is the table column denoting the orders_extension relation/edge.
OrdersExtensionColumn = "order_id"
// NotifyTaskTable is the table that holds the notify_task relation/edge.
NotifyTaskTable = "pay_notify_task"
// NotifyTaskInverseTable is the table name for the PayNotifyTask entity.
// It exists in this package in order to avoid circular dependency with the "paynotifytask" package.
NotifyTaskInverseTable = "pay_notify_task"
// NotifyTaskColumn is the table column denoting the notify_task relation/edge.
NotifyTaskColumn = "order_id"
// RefundTable is the table that holds the refund relation/edge.
RefundTable = "pay_refund"
// RefundInverseTable is the table name for the PayRefund entity.
// It exists in this package in order to avoid circular dependency with the "payrefund" package.
RefundInverseTable = "pay_refund"
// RefundColumn is the table column denoting the refund relation/edge.
RefundColumn = "order_id"
)
// Columns holds all SQL columns for payorder fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldStatus,
FieldTenantID,
FieldDeletedAt,
FieldChannelID,
FieldUserID,
FieldSubject,
FieldBody,
FieldNotifyURL,
FieldAmount,
FieldPaySource,
FieldChannelFeeRate,
FieldChannelFee,
FieldOrderStatus,
FieldUserIP,
FieldExpireTime,
FieldPayNo,
FieldSuccessTime,
FieldExtensionID,
FieldTransactionID,
FieldCurrency,
FieldRefundPrice,
FieldChannelOrderNo,
FieldChannelUserID,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus uint8
// DefaultTenantID holds the default value on creation for the "tenant_id" field.
DefaultTenantID uint64
// DefaultAmount holds the default value on creation for the "amount" field.
DefaultAmount uint64
// DefaultChannelFeeRate holds the default value on creation for the "channel_fee_rate" field.
DefaultChannelFeeRate string
// DefaultChannelFee holds the default value on creation for the "channel_fee" field.
DefaultChannelFee uint64
// DefaultOrderStatus holds the default value on creation for the "order_status" field.
DefaultOrderStatus string
// DefaultCurrency holds the default value on creation for the "currency" field.
DefaultCurrency string
// DefaultRefundPrice holds the default value on creation for the "refund_price" field.
DefaultRefundPrice uint64
)
// OrderOption defines the ordering options for the PayOrder queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByTenantID orders the results by the tenant_id field.
func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTenantID, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByChannelID orders the results by the channel_id field.
func ByChannelID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelID, opts...).ToFunc()
}
// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc()
}
// BySubject orders the results by the subject field.
func BySubject(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSubject, opts...).ToFunc()
}
// ByBody orders the results by the body field.
func ByBody(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBody, opts...).ToFunc()
}
// ByNotifyURL orders the results by the notify_url field.
func ByNotifyURL(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldNotifyURL, opts...).ToFunc()
}
// ByAmount orders the results by the amount field.
func ByAmount(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAmount, opts...).ToFunc()
}
// ByPaySource orders the results by the pay_source field.
func ByPaySource(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPaySource, opts...).ToFunc()
}
// ByChannelFeeRate orders the results by the channel_fee_rate field.
func ByChannelFeeRate(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelFeeRate, opts...).ToFunc()
}
// ByChannelFee orders the results by the channel_fee field.
func ByChannelFee(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelFee, opts...).ToFunc()
}
// ByOrderStatus orders the results by the order_status field.
func ByOrderStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrderStatus, opts...).ToFunc()
}
// ByUserIP orders the results by the user_ip field.
func ByUserIP(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserIP, opts...).ToFunc()
}
// ByExpireTime orders the results by the expire_time field.
func ByExpireTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpireTime, opts...).ToFunc()
}
// ByPayNo orders the results by the pay_no field.
func ByPayNo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPayNo, opts...).ToFunc()
}
// BySuccessTime orders the results by the success_time field.
func BySuccessTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSuccessTime, opts...).ToFunc()
}
// ByExtensionID orders the results by the extension_id field.
func ByExtensionID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExtensionID, opts...).ToFunc()
}
// ByTransactionID orders the results by the transaction_id field.
func ByTransactionID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTransactionID, opts...).ToFunc()
}
// ByCurrency orders the results by the currency field.
func ByCurrency(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCurrency, opts...).ToFunc()
}
// ByRefundPrice orders the results by the refund_price field.
func ByRefundPrice(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRefundPrice, opts...).ToFunc()
}
// ByChannelOrderNo orders the results by the channel_order_no field.
func ByChannelOrderNo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelOrderNo, opts...).ToFunc()
}
// ByChannelUserID orders the results by the channel_user_id field.
func ByChannelUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelUserID, opts...).ToFunc()
}
// ByChannelField orders the results by channel field.
func ByChannelField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newChannelStep(), sql.OrderByField(field, opts...))
}
}
// ByOrdersExtensionCount orders the results by orders_extension count.
func ByOrdersExtensionCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newOrdersExtensionStep(), opts...)
}
}
// ByOrdersExtension orders the results by orders_extension terms.
func ByOrdersExtension(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newOrdersExtensionStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByNotifyTaskCount orders the results by notify_task count.
func ByNotifyTaskCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newNotifyTaskStep(), opts...)
}
}
// ByNotifyTask orders the results by notify_task terms.
func ByNotifyTask(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newNotifyTaskStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
// ByRefundCount orders the results by refund count.
func ByRefundCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newRefundStep(), opts...)
}
}
// ByRefund orders the results by refund terms.
func ByRefund(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newRefundStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newChannelStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ChannelInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, ChannelTable, ChannelColumn),
)
}
func newOrdersExtensionStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(OrdersExtensionInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, OrdersExtensionTable, OrdersExtensionColumn),
)
}
func newNotifyTaskStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(NotifyTaskInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, NotifyTaskTable, NotifyTaskColumn),
)
}
func newRefundStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(RefundInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, RefundTable, RefundColumn),
)
}

1648
rpc/ent/payorder/where.go Normal file

File diff suppressed because it is too large Load Diff

784
rpc/ent/payorder_create.go Normal file
View File

@ -0,0 +1,784 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
"time"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayOrderCreate is the builder for creating a PayOrder entity.
type PayOrderCreate struct {
config
mutation *PayOrderMutation
hooks []Hook
}
// SetCreatedAt sets the "created_at" field.
func (_c *PayOrderCreate) SetCreatedAt(v time.Time) *PayOrderCreate {
_c.mutation.SetCreatedAt(v)
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableCreatedAt(v *time.Time) *PayOrderCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// SetUpdatedAt sets the "updated_at" field.
func (_c *PayOrderCreate) SetUpdatedAt(v time.Time) *PayOrderCreate {
_c.mutation.SetUpdatedAt(v)
return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableUpdatedAt(v *time.Time) *PayOrderCreate {
if v != nil {
_c.SetUpdatedAt(*v)
}
return _c
}
// SetStatus sets the "status" field.
func (_c *PayOrderCreate) SetStatus(v uint8) *PayOrderCreate {
_c.mutation.SetStatus(v)
return _c
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableStatus(v *uint8) *PayOrderCreate {
if v != nil {
_c.SetStatus(*v)
}
return _c
}
// SetTenantID sets the "tenant_id" field.
func (_c *PayOrderCreate) SetTenantID(v uint64) *PayOrderCreate {
_c.mutation.SetTenantID(v)
return _c
}
// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableTenantID(v *uint64) *PayOrderCreate {
if v != nil {
_c.SetTenantID(*v)
}
return _c
}
// SetDeletedAt sets the "deleted_at" field.
func (_c *PayOrderCreate) SetDeletedAt(v time.Time) *PayOrderCreate {
_c.mutation.SetDeletedAt(v)
return _c
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableDeletedAt(v *time.Time) *PayOrderCreate {
if v != nil {
_c.SetDeletedAt(*v)
}
return _c
}
// SetChannelID sets the "channel_id" field.
func (_c *PayOrderCreate) SetChannelID(v uint64) *PayOrderCreate {
_c.mutation.SetChannelID(v)
return _c
}
// SetUserID sets the "user_id" field.
func (_c *PayOrderCreate) SetUserID(v uint64) *PayOrderCreate {
_c.mutation.SetUserID(v)
return _c
}
// SetSubject sets the "subject" field.
func (_c *PayOrderCreate) SetSubject(v string) *PayOrderCreate {
_c.mutation.SetSubject(v)
return _c
}
// SetBody sets the "body" field.
func (_c *PayOrderCreate) SetBody(v string) *PayOrderCreate {
_c.mutation.SetBody(v)
return _c
}
// SetNotifyURL sets the "notify_url" field.
func (_c *PayOrderCreate) SetNotifyURL(v string) *PayOrderCreate {
_c.mutation.SetNotifyURL(v)
return _c
}
// SetAmount sets the "amount" field.
func (_c *PayOrderCreate) SetAmount(v uint64) *PayOrderCreate {
_c.mutation.SetAmount(v)
return _c
}
// SetNillableAmount sets the "amount" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableAmount(v *uint64) *PayOrderCreate {
if v != nil {
_c.SetAmount(*v)
}
return _c
}
// SetPaySource sets the "pay_source" field.
func (_c *PayOrderCreate) SetPaySource(v string) *PayOrderCreate {
_c.mutation.SetPaySource(v)
return _c
}
// SetNillablePaySource sets the "pay_source" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillablePaySource(v *string) *PayOrderCreate {
if v != nil {
_c.SetPaySource(*v)
}
return _c
}
// SetChannelFeeRate sets the "channel_fee_rate" field.
func (_c *PayOrderCreate) SetChannelFeeRate(v string) *PayOrderCreate {
_c.mutation.SetChannelFeeRate(v)
return _c
}
// SetNillableChannelFeeRate sets the "channel_fee_rate" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableChannelFeeRate(v *string) *PayOrderCreate {
if v != nil {
_c.SetChannelFeeRate(*v)
}
return _c
}
// SetChannelFee sets the "channel_fee" field.
func (_c *PayOrderCreate) SetChannelFee(v uint64) *PayOrderCreate {
_c.mutation.SetChannelFee(v)
return _c
}
// SetNillableChannelFee sets the "channel_fee" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableChannelFee(v *uint64) *PayOrderCreate {
if v != nil {
_c.SetChannelFee(*v)
}
return _c
}
// SetOrderStatus sets the "order_status" field.
func (_c *PayOrderCreate) SetOrderStatus(v string) *PayOrderCreate {
_c.mutation.SetOrderStatus(v)
return _c
}
// SetNillableOrderStatus sets the "order_status" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableOrderStatus(v *string) *PayOrderCreate {
if v != nil {
_c.SetOrderStatus(*v)
}
return _c
}
// SetUserIP sets the "user_ip" field.
func (_c *PayOrderCreate) SetUserIP(v string) *PayOrderCreate {
_c.mutation.SetUserIP(v)
return _c
}
// SetNillableUserIP sets the "user_ip" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableUserIP(v *string) *PayOrderCreate {
if v != nil {
_c.SetUserIP(*v)
}
return _c
}
// SetExpireTime sets the "expire_time" field.
func (_c *PayOrderCreate) SetExpireTime(v time.Time) *PayOrderCreate {
_c.mutation.SetExpireTime(v)
return _c
}
// SetPayNo sets the "pay_no" field.
func (_c *PayOrderCreate) SetPayNo(v string) *PayOrderCreate {
_c.mutation.SetPayNo(v)
return _c
}
// SetSuccessTime sets the "success_time" field.
func (_c *PayOrderCreate) SetSuccessTime(v time.Time) *PayOrderCreate {
_c.mutation.SetSuccessTime(v)
return _c
}
// SetExtensionID sets the "extension_id" field.
func (_c *PayOrderCreate) SetExtensionID(v uint64) *PayOrderCreate {
_c.mutation.SetExtensionID(v)
return _c
}
// SetNillableExtensionID sets the "extension_id" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableExtensionID(v *uint64) *PayOrderCreate {
if v != nil {
_c.SetExtensionID(*v)
}
return _c
}
// SetTransactionID sets the "transaction_id" field.
func (_c *PayOrderCreate) SetTransactionID(v string) *PayOrderCreate {
_c.mutation.SetTransactionID(v)
return _c
}
// SetNillableTransactionID sets the "transaction_id" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableTransactionID(v *string) *PayOrderCreate {
if v != nil {
_c.SetTransactionID(*v)
}
return _c
}
// SetCurrency sets the "currency" field.
func (_c *PayOrderCreate) SetCurrency(v string) *PayOrderCreate {
_c.mutation.SetCurrency(v)
return _c
}
// SetNillableCurrency sets the "currency" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableCurrency(v *string) *PayOrderCreate {
if v != nil {
_c.SetCurrency(*v)
}
return _c
}
// SetRefundPrice sets the "refund_price" field.
func (_c *PayOrderCreate) SetRefundPrice(v uint64) *PayOrderCreate {
_c.mutation.SetRefundPrice(v)
return _c
}
// SetNillableRefundPrice sets the "refund_price" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableRefundPrice(v *uint64) *PayOrderCreate {
if v != nil {
_c.SetRefundPrice(*v)
}
return _c
}
// SetChannelOrderNo sets the "channel_order_no" field.
func (_c *PayOrderCreate) SetChannelOrderNo(v string) *PayOrderCreate {
_c.mutation.SetChannelOrderNo(v)
return _c
}
// SetNillableChannelOrderNo sets the "channel_order_no" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableChannelOrderNo(v *string) *PayOrderCreate {
if v != nil {
_c.SetChannelOrderNo(*v)
}
return _c
}
// SetChannelUserID sets the "channel_user_id" field.
func (_c *PayOrderCreate) SetChannelUserID(v string) *PayOrderCreate {
_c.mutation.SetChannelUserID(v)
return _c
}
// SetNillableChannelUserID sets the "channel_user_id" field if the given value is not nil.
func (_c *PayOrderCreate) SetNillableChannelUserID(v *string) *PayOrderCreate {
if v != nil {
_c.SetChannelUserID(*v)
}
return _c
}
// SetID sets the "id" field.
func (_c *PayOrderCreate) SetID(v uint64) *PayOrderCreate {
_c.mutation.SetID(v)
return _c
}
// SetChannel sets the "channel" edge to the PayChannel entity.
func (_c *PayOrderCreate) SetChannel(v *PayChannel) *PayOrderCreate {
return _c.SetChannelID(v.ID)
}
// AddOrdersExtensionIDs adds the "orders_extension" edge to the PayOrderExtension entity by IDs.
func (_c *PayOrderCreate) AddOrdersExtensionIDs(ids ...uint64) *PayOrderCreate {
_c.mutation.AddOrdersExtensionIDs(ids...)
return _c
}
// AddOrdersExtension adds the "orders_extension" edges to the PayOrderExtension entity.
func (_c *PayOrderCreate) AddOrdersExtension(v ...*PayOrderExtension) *PayOrderCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddOrdersExtensionIDs(ids...)
}
// AddNotifyTaskIDs adds the "notify_task" edge to the PayNotifyTask entity by IDs.
func (_c *PayOrderCreate) AddNotifyTaskIDs(ids ...uint64) *PayOrderCreate {
_c.mutation.AddNotifyTaskIDs(ids...)
return _c
}
// AddNotifyTask adds the "notify_task" edges to the PayNotifyTask entity.
func (_c *PayOrderCreate) AddNotifyTask(v ...*PayNotifyTask) *PayOrderCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddNotifyTaskIDs(ids...)
}
// AddRefundIDs adds the "refund" edge to the PayRefund entity by IDs.
func (_c *PayOrderCreate) AddRefundIDs(ids ...uint64) *PayOrderCreate {
_c.mutation.AddRefundIDs(ids...)
return _c
}
// AddRefund adds the "refund" edges to the PayRefund entity.
func (_c *PayOrderCreate) AddRefund(v ...*PayRefund) *PayOrderCreate {
ids := make([]uint64, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _c.AddRefundIDs(ids...)
}
// Mutation returns the PayOrderMutation object of the builder.
func (_c *PayOrderCreate) Mutation() *PayOrderMutation {
return _c.mutation
}
// Save creates the PayOrder in the database.
func (_c *PayOrderCreate) Save(ctx context.Context) (*PayOrder, error) {
_c.defaults()
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (_c *PayOrderCreate) SaveX(ctx context.Context) *PayOrder {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PayOrderCreate) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PayOrderCreate) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_c *PayOrderCreate) defaults() {
if _, ok := _c.mutation.CreatedAt(); !ok {
v := payorder.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
v := payorder.DefaultUpdatedAt()
_c.mutation.SetUpdatedAt(v)
}
if _, ok := _c.mutation.Status(); !ok {
v := payorder.DefaultStatus
_c.mutation.SetStatus(v)
}
if _, ok := _c.mutation.TenantID(); !ok {
v := payorder.DefaultTenantID
_c.mutation.SetTenantID(v)
}
if _, ok := _c.mutation.Amount(); !ok {
v := payorder.DefaultAmount
_c.mutation.SetAmount(v)
}
if _, ok := _c.mutation.ChannelFeeRate(); !ok {
v := payorder.DefaultChannelFeeRate
_c.mutation.SetChannelFeeRate(v)
}
if _, ok := _c.mutation.ChannelFee(); !ok {
v := payorder.DefaultChannelFee
_c.mutation.SetChannelFee(v)
}
if _, ok := _c.mutation.OrderStatus(); !ok {
v := payorder.DefaultOrderStatus
_c.mutation.SetOrderStatus(v)
}
if _, ok := _c.mutation.Currency(); !ok {
v := payorder.DefaultCurrency
_c.mutation.SetCurrency(v)
}
if _, ok := _c.mutation.RefundPrice(); !ok {
v := payorder.DefaultRefundPrice
_c.mutation.SetRefundPrice(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_c *PayOrderCreate) check() error {
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "PayOrder.created_at"`)}
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "PayOrder.updated_at"`)}
}
if _, ok := _c.mutation.TenantID(); !ok {
return &ValidationError{Name: "tenant_id", err: errors.New(`ent: missing required field "PayOrder.tenant_id"`)}
}
if _, ok := _c.mutation.ChannelID(); !ok {
return &ValidationError{Name: "channel_id", err: errors.New(`ent: missing required field "PayOrder.channel_id"`)}
}
if _, ok := _c.mutation.UserID(); !ok {
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "PayOrder.user_id"`)}
}
if _, ok := _c.mutation.Subject(); !ok {
return &ValidationError{Name: "subject", err: errors.New(`ent: missing required field "PayOrder.subject"`)}
}
if _, ok := _c.mutation.Body(); !ok {
return &ValidationError{Name: "body", err: errors.New(`ent: missing required field "PayOrder.body"`)}
}
if _, ok := _c.mutation.NotifyURL(); !ok {
return &ValidationError{Name: "notify_url", err: errors.New(`ent: missing required field "PayOrder.notify_url"`)}
}
if _, ok := _c.mutation.Amount(); !ok {
return &ValidationError{Name: "amount", err: errors.New(`ent: missing required field "PayOrder.amount"`)}
}
if _, ok := _c.mutation.ChannelFeeRate(); !ok {
return &ValidationError{Name: "channel_fee_rate", err: errors.New(`ent: missing required field "PayOrder.channel_fee_rate"`)}
}
if _, ok := _c.mutation.ChannelFee(); !ok {
return &ValidationError{Name: "channel_fee", err: errors.New(`ent: missing required field "PayOrder.channel_fee"`)}
}
if _, ok := _c.mutation.OrderStatus(); !ok {
return &ValidationError{Name: "order_status", err: errors.New(`ent: missing required field "PayOrder.order_status"`)}
}
if _, ok := _c.mutation.ExpireTime(); !ok {
return &ValidationError{Name: "expire_time", err: errors.New(`ent: missing required field "PayOrder.expire_time"`)}
}
if _, ok := _c.mutation.PayNo(); !ok {
return &ValidationError{Name: "pay_no", err: errors.New(`ent: missing required field "PayOrder.pay_no"`)}
}
if _, ok := _c.mutation.SuccessTime(); !ok {
return &ValidationError{Name: "success_time", err: errors.New(`ent: missing required field "PayOrder.success_time"`)}
}
if _, ok := _c.mutation.Currency(); !ok {
return &ValidationError{Name: "currency", err: errors.New(`ent: missing required field "PayOrder.currency"`)}
}
if _, ok := _c.mutation.RefundPrice(); !ok {
return &ValidationError{Name: "refund_price", err: errors.New(`ent: missing required field "PayOrder.refund_price"`)}
}
if len(_c.mutation.ChannelIDs()) == 0 {
return &ValidationError{Name: "channel", err: errors.New(`ent: missing required edge "PayOrder.channel"`)}
}
return nil
}
func (_c *PayOrderCreate) sqlSave(ctx context.Context) (*PayOrder, error) {
if err := _c.check(); err != nil {
return nil, err
}
_node, _spec := _c.createSpec()
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
if _spec.ID.Value != _node.ID {
id := _spec.ID.Value.(int64)
_node.ID = uint64(id)
}
_c.mutation.id = &_node.ID
_c.mutation.done = true
return _node, nil
}
func (_c *PayOrderCreate) createSpec() (*PayOrder, *sqlgraph.CreateSpec) {
var (
_node = &PayOrder{config: _c.config}
_spec = sqlgraph.NewCreateSpec(payorder.Table, sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64))
)
if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = id
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(payorder.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(payorder.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := _c.mutation.Status(); ok {
_spec.SetField(payorder.FieldStatus, field.TypeUint8, value)
_node.Status = value
}
if value, ok := _c.mutation.TenantID(); ok {
_spec.SetField(payorder.FieldTenantID, field.TypeUint64, value)
_node.TenantID = value
}
if value, ok := _c.mutation.DeletedAt(); ok {
_spec.SetField(payorder.FieldDeletedAt, field.TypeTime, value)
_node.DeletedAt = value
}
if value, ok := _c.mutation.UserID(); ok {
_spec.SetField(payorder.FieldUserID, field.TypeUint64, value)
_node.UserID = value
}
if value, ok := _c.mutation.Subject(); ok {
_spec.SetField(payorder.FieldSubject, field.TypeString, value)
_node.Subject = value
}
if value, ok := _c.mutation.Body(); ok {
_spec.SetField(payorder.FieldBody, field.TypeString, value)
_node.Body = value
}
if value, ok := _c.mutation.NotifyURL(); ok {
_spec.SetField(payorder.FieldNotifyURL, field.TypeString, value)
_node.NotifyURL = value
}
if value, ok := _c.mutation.Amount(); ok {
_spec.SetField(payorder.FieldAmount, field.TypeUint64, value)
_node.Amount = value
}
if value, ok := _c.mutation.PaySource(); ok {
_spec.SetField(payorder.FieldPaySource, field.TypeString, value)
_node.PaySource = value
}
if value, ok := _c.mutation.ChannelFeeRate(); ok {
_spec.SetField(payorder.FieldChannelFeeRate, field.TypeString, value)
_node.ChannelFeeRate = value
}
if value, ok := _c.mutation.ChannelFee(); ok {
_spec.SetField(payorder.FieldChannelFee, field.TypeUint64, value)
_node.ChannelFee = value
}
if value, ok := _c.mutation.OrderStatus(); ok {
_spec.SetField(payorder.FieldOrderStatus, field.TypeString, value)
_node.OrderStatus = value
}
if value, ok := _c.mutation.UserIP(); ok {
_spec.SetField(payorder.FieldUserIP, field.TypeString, value)
_node.UserIP = value
}
if value, ok := _c.mutation.ExpireTime(); ok {
_spec.SetField(payorder.FieldExpireTime, field.TypeTime, value)
_node.ExpireTime = value
}
if value, ok := _c.mutation.PayNo(); ok {
_spec.SetField(payorder.FieldPayNo, field.TypeString, value)
_node.PayNo = value
}
if value, ok := _c.mutation.SuccessTime(); ok {
_spec.SetField(payorder.FieldSuccessTime, field.TypeTime, value)
_node.SuccessTime = value
}
if value, ok := _c.mutation.ExtensionID(); ok {
_spec.SetField(payorder.FieldExtensionID, field.TypeUint64, value)
_node.ExtensionID = value
}
if value, ok := _c.mutation.TransactionID(); ok {
_spec.SetField(payorder.FieldTransactionID, field.TypeString, value)
_node.TransactionID = value
}
if value, ok := _c.mutation.Currency(); ok {
_spec.SetField(payorder.FieldCurrency, field.TypeString, value)
_node.Currency = value
}
if value, ok := _c.mutation.RefundPrice(); ok {
_spec.SetField(payorder.FieldRefundPrice, field.TypeUint64, value)
_node.RefundPrice = value
}
if value, ok := _c.mutation.ChannelOrderNo(); ok {
_spec.SetField(payorder.FieldChannelOrderNo, field.TypeString, value)
_node.ChannelOrderNo = value
}
if value, ok := _c.mutation.ChannelUserID(); ok {
_spec.SetField(payorder.FieldChannelUserID, field.TypeString, value)
_node.ChannelUserID = value
}
if nodes := _c.mutation.ChannelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorder.ChannelTable,
Columns: []string{payorder.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_node.ChannelID = nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.OrdersExtensionIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: payorder.OrdersExtensionTable,
Columns: []string{payorder.OrdersExtensionColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorderextension.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.NotifyTaskIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: payorder.NotifyTaskTable,
Columns: []string{payorder.NotifyTaskColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paynotifytask.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.RefundIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: payorder.RefundTable,
Columns: []string{payorder.RefundColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payrefund.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
return _node, _spec
}
// PayOrderCreateBulk is the builder for creating many PayOrder entities in bulk.
type PayOrderCreateBulk struct {
config
err error
builders []*PayOrderCreate
}
// Save creates the PayOrder entities in the database.
func (_c *PayOrderCreateBulk) Save(ctx context.Context) ([]*PayOrder, error) {
if _c.err != nil {
return nil, _c.err
}
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
nodes := make([]*PayOrder, len(_c.builders))
mutators := make([]Mutator, len(_c.builders))
for i := range _c.builders {
func(i int, root context.Context) {
builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*PayOrderMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
if err := builder.check(); err != nil {
return nil, err
}
builder.mutation = mutation
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
} else {
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
}
}
if err != nil {
return nil, err
}
mutation.id = &nodes[i].ID
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
id := specs[i].ID.Value.(int64)
nodes[i].ID = uint64(id)
}
mutation.done = true
return nodes[i], nil
})
for i := len(builder.hooks) - 1; i >= 0; i-- {
mut = builder.hooks[i](mut)
}
mutators[i] = mut
}(i, ctx)
}
if len(mutators) > 0 {
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
return nodes, nil
}
// SaveX is like Save, but panics if an error occurs.
func (_c *PayOrderCreateBulk) SaveX(ctx context.Context) []*PayOrder {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PayOrderCreateBulk) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PayOrderCreateBulk) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}

View File

@ -0,0 +1,88 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayOrderDelete is the builder for deleting a PayOrder entity.
type PayOrderDelete struct {
config
hooks []Hook
mutation *PayOrderMutation
}
// Where appends a list predicates to the PayOrderDelete builder.
func (_d *PayOrderDelete) Where(ps ...predicate.PayOrder) *PayOrderDelete {
_d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (_d *PayOrderDelete) Exec(ctx context.Context) (int, error) {
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *PayOrderDelete) ExecX(ctx context.Context) int {
n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (_d *PayOrderDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(payorder.Table, sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64))
if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
_d.mutation.done = true
return affected, err
}
// PayOrderDeleteOne is the builder for deleting a single PayOrder entity.
type PayOrderDeleteOne struct {
_d *PayOrderDelete
}
// Where appends a list predicates to the PayOrderDelete builder.
func (_d *PayOrderDeleteOne) Where(ps ...predicate.PayOrder) *PayOrderDeleteOne {
_d._d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query.
func (_d *PayOrderDeleteOne) Exec(ctx context.Context) error {
n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{payorder.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *PayOrderDeleteOne) ExecX(ctx context.Context) {
if err := _d.Exec(ctx); err != nil {
panic(err)
}
}

829
rpc/ent/payorder_query.go Normal file
View File

@ -0,0 +1,829 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"database/sql/driver"
"fmt"
"math"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayOrderQuery is the builder for querying PayOrder entities.
type PayOrderQuery struct {
config
ctx *QueryContext
order []payorder.OrderOption
inters []Interceptor
predicates []predicate.PayOrder
withChannel *PayChannelQuery
withOrdersExtension *PayOrderExtensionQuery
withNotifyTask *PayNotifyTaskQuery
withRefund *PayRefundQuery
// intermediate query (i.e. traversal path).
sql *sql.Selector
path func(context.Context) (*sql.Selector, error)
}
// Where adds a new predicate for the PayOrderQuery builder.
func (_q *PayOrderQuery) Where(ps ...predicate.PayOrder) *PayOrderQuery {
_q.predicates = append(_q.predicates, ps...)
return _q
}
// Limit the number of records to be returned by this query.
func (_q *PayOrderQuery) Limit(limit int) *PayOrderQuery {
_q.ctx.Limit = &limit
return _q
}
// Offset to start from.
func (_q *PayOrderQuery) Offset(offset int) *PayOrderQuery {
_q.ctx.Offset = &offset
return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
func (_q *PayOrderQuery) Unique(unique bool) *PayOrderQuery {
_q.ctx.Unique = &unique
return _q
}
// Order specifies how the records should be ordered.
func (_q *PayOrderQuery) Order(o ...payorder.OrderOption) *PayOrderQuery {
_q.order = append(_q.order, o...)
return _q
}
// QueryChannel chains the current query on the "channel" edge.
func (_q *PayOrderQuery) QueryChannel() *PayChannelQuery {
query := (&PayChannelClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(payorder.Table, payorder.FieldID, selector),
sqlgraph.To(paychannel.Table, paychannel.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, payorder.ChannelTable, payorder.ChannelColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryOrdersExtension chains the current query on the "orders_extension" edge.
func (_q *PayOrderQuery) QueryOrdersExtension() *PayOrderExtensionQuery {
query := (&PayOrderExtensionClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(payorder.Table, payorder.FieldID, selector),
sqlgraph.To(payorderextension.Table, payorderextension.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, payorder.OrdersExtensionTable, payorder.OrdersExtensionColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryNotifyTask chains the current query on the "notify_task" edge.
func (_q *PayOrderQuery) QueryNotifyTask() *PayNotifyTaskQuery {
query := (&PayNotifyTaskClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(payorder.Table, payorder.FieldID, selector),
sqlgraph.To(paynotifytask.Table, paynotifytask.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, payorder.NotifyTaskTable, payorder.NotifyTaskColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryRefund chains the current query on the "refund" edge.
func (_q *PayOrderQuery) QueryRefund() *PayRefundQuery {
query := (&PayRefundClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(payorder.Table, payorder.FieldID, selector),
sqlgraph.To(payrefund.Table, payrefund.FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, payorder.RefundTable, payorder.RefundColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// First returns the first PayOrder entity from the query.
// Returns a *NotFoundError when no PayOrder was found.
func (_q *PayOrderQuery) First(ctx context.Context) (*PayOrder, error) {
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
if len(nodes) == 0 {
return nil, &NotFoundError{payorder.Label}
}
return nodes[0], nil
}
// FirstX is like First, but panics if an error occurs.
func (_q *PayOrderQuery) FirstX(ctx context.Context) *PayOrder {
node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return node
}
// FirstID returns the first PayOrder ID from the query.
// Returns a *NotFoundError when no PayOrder ID was found.
func (_q *PayOrderQuery) FirstID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
err = &NotFoundError{payorder.Label}
return
}
return ids[0], nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func (_q *PayOrderQuery) FirstIDX(ctx context.Context) uint64 {
id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return id
}
// Only returns a single PayOrder entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one PayOrder entity is found.
// Returns a *NotFoundError when no PayOrder entities are found.
func (_q *PayOrderQuery) Only(ctx context.Context) (*PayOrder, error) {
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
switch len(nodes) {
case 1:
return nodes[0], nil
case 0:
return nil, &NotFoundError{payorder.Label}
default:
return nil, &NotSingularError{payorder.Label}
}
}
// OnlyX is like Only, but panics if an error occurs.
func (_q *PayOrderQuery) OnlyX(ctx context.Context) *PayOrder {
node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
return node
}
// OnlyID is like Only, but returns the only PayOrder ID in the query.
// Returns a *NotSingularError when more than one PayOrder ID is found.
// Returns a *NotFoundError when no entities are found.
func (_q *PayOrderQuery) OnlyID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
case 1:
id = ids[0]
case 0:
err = &NotFoundError{payorder.Label}
default:
err = &NotSingularError{payorder.Label}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func (_q *PayOrderQuery) OnlyIDX(ctx context.Context) uint64 {
id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
return id
}
// All executes the query and returns a list of PayOrders.
func (_q *PayOrderQuery) All(ctx context.Context) ([]*PayOrder, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*PayOrder, *PayOrderQuery]()
return withInterceptors[[]*PayOrder](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
func (_q *PayOrderQuery) AllX(ctx context.Context) []*PayOrder {
nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
return nodes
}
// IDs executes the query and returns a list of PayOrder IDs.
func (_q *PayOrderQuery) IDs(ctx context.Context) (ids []uint64, err error) {
if _q.ctx.Unique == nil && _q.path != nil {
_q.Unique(true)
}
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
if err = _q.Select(payorder.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
func (_q *PayOrderQuery) IDsX(ctx context.Context) []uint64 {
ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
return ids
}
// Count returns the count of the given query.
func (_q *PayOrderQuery) Count(ctx context.Context) (int, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
return withInterceptors[int](ctx, _q, querierCount[*PayOrderQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
func (_q *PayOrderQuery) CountX(ctx context.Context) int {
count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
return count
}
// Exist returns true if the query has elements in the graph.
func (_q *PayOrderQuery) Exist(ctx context.Context) (bool, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
}
}
// ExistX is like Exist, but panics if an error occurs.
func (_q *PayOrderQuery) ExistX(ctx context.Context) bool {
exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
return exist
}
// Clone returns a duplicate of the PayOrderQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func (_q *PayOrderQuery) Clone() *PayOrderQuery {
if _q == nil {
return nil
}
return &PayOrderQuery{
config: _q.config,
ctx: _q.ctx.Clone(),
order: append([]payorder.OrderOption{}, _q.order...),
inters: append([]Interceptor{}, _q.inters...),
predicates: append([]predicate.PayOrder{}, _q.predicates...),
withChannel: _q.withChannel.Clone(),
withOrdersExtension: _q.withOrdersExtension.Clone(),
withNotifyTask: _q.withNotifyTask.Clone(),
withRefund: _q.withRefund.Clone(),
// clone intermediate query.
sql: _q.sql.Clone(),
path: _q.path,
}
}
// WithChannel tells the query-builder to eager-load the nodes that are connected to
// the "channel" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayOrderQuery) WithChannel(opts ...func(*PayChannelQuery)) *PayOrderQuery {
query := (&PayChannelClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withChannel = query
return _q
}
// WithOrdersExtension tells the query-builder to eager-load the nodes that are connected to
// the "orders_extension" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayOrderQuery) WithOrdersExtension(opts ...func(*PayOrderExtensionQuery)) *PayOrderQuery {
query := (&PayOrderExtensionClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withOrdersExtension = query
return _q
}
// WithNotifyTask tells the query-builder to eager-load the nodes that are connected to
// the "notify_task" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayOrderQuery) WithNotifyTask(opts ...func(*PayNotifyTaskQuery)) *PayOrderQuery {
query := (&PayNotifyTaskClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withNotifyTask = query
return _q
}
// WithRefund tells the query-builder to eager-load the nodes that are connected to
// the "refund" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayOrderQuery) WithRefund(opts ...func(*PayRefundQuery)) *PayOrderQuery {
query := (&PayRefundClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withRefund = query
return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.PayOrder.Query().
// GroupBy(payorder.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func (_q *PayOrderQuery) GroupBy(field string, fields ...string) *PayOrderGroupBy {
_q.ctx.Fields = append([]string{field}, fields...)
grbuild := &PayOrderGroupBy{build: _q}
grbuild.flds = &_q.ctx.Fields
grbuild.label = payorder.Label
grbuild.scan = grbuild.Scan
return grbuild
}
// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// }
//
// client.PayOrder.Query().
// Select(payorder.FieldCreatedAt).
// Scan(ctx, &v)
func (_q *PayOrderQuery) Select(fields ...string) *PayOrderSelect {
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
sbuild := &PayOrderSelect{PayOrderQuery: _q}
sbuild.label = payorder.Label
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a PayOrderSelect configured with the given aggregations.
func (_q *PayOrderQuery) Aggregate(fns ...AggregateFunc) *PayOrderSelect {
return _q.Select().Aggregate(fns...)
}
func (_q *PayOrderQuery) prepareQuery(ctx context.Context) error {
for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
for _, f := range _q.ctx.Fields {
if !payorder.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
if _q.path != nil {
prev, err := _q.path(ctx)
if err != nil {
return err
}
_q.sql = prev
}
return nil
}
func (_q *PayOrderQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*PayOrder, error) {
var (
nodes = []*PayOrder{}
_spec = _q.querySpec()
loadedTypes = [4]bool{
_q.withChannel != nil,
_q.withOrdersExtension != nil,
_q.withNotifyTask != nil,
_q.withRefund != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*PayOrder).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
node := &PayOrder{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
}
for i := range hooks {
hooks[i](ctx, _spec)
}
if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
if query := _q.withChannel; query != nil {
if err := _q.loadChannel(ctx, query, nodes, nil,
func(n *PayOrder, e *PayChannel) { n.Edges.Channel = e }); err != nil {
return nil, err
}
}
if query := _q.withOrdersExtension; query != nil {
if err := _q.loadOrdersExtension(ctx, query, nodes,
func(n *PayOrder) { n.Edges.OrdersExtension = []*PayOrderExtension{} },
func(n *PayOrder, e *PayOrderExtension) { n.Edges.OrdersExtension = append(n.Edges.OrdersExtension, e) }); err != nil {
return nil, err
}
}
if query := _q.withNotifyTask; query != nil {
if err := _q.loadNotifyTask(ctx, query, nodes,
func(n *PayOrder) { n.Edges.NotifyTask = []*PayNotifyTask{} },
func(n *PayOrder, e *PayNotifyTask) { n.Edges.NotifyTask = append(n.Edges.NotifyTask, e) }); err != nil {
return nil, err
}
}
if query := _q.withRefund; query != nil {
if err := _q.loadRefund(ctx, query, nodes,
func(n *PayOrder) { n.Edges.Refund = []*PayRefund{} },
func(n *PayOrder, e *PayRefund) { n.Edges.Refund = append(n.Edges.Refund, e) }); err != nil {
return nil, err
}
}
return nodes, nil
}
func (_q *PayOrderQuery) loadChannel(ctx context.Context, query *PayChannelQuery, nodes []*PayOrder, init func(*PayOrder), assign func(*PayOrder, *PayChannel)) error {
ids := make([]uint64, 0, len(nodes))
nodeids := make(map[uint64][]*PayOrder)
for i := range nodes {
fk := nodes[i].ChannelID
if _, ok := nodeids[fk]; !ok {
ids = append(ids, fk)
}
nodeids[fk] = append(nodeids[fk], nodes[i])
}
if len(ids) == 0 {
return nil
}
query.Where(paychannel.IDIn(ids...))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
nodes, ok := nodeids[n.ID]
if !ok {
return fmt.Errorf(`unexpected foreign-key "channel_id" returned %v`, n.ID)
}
for i := range nodes {
assign(nodes[i], n)
}
}
return nil
}
func (_q *PayOrderQuery) loadOrdersExtension(ctx context.Context, query *PayOrderExtensionQuery, nodes []*PayOrder, init func(*PayOrder), assign func(*PayOrder, *PayOrderExtension)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*PayOrder)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(payorderextension.FieldOrderID)
}
query.Where(predicate.PayOrderExtension(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(payorder.OrdersExtensionColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.OrderID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "order_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *PayOrderQuery) loadNotifyTask(ctx context.Context, query *PayNotifyTaskQuery, nodes []*PayOrder, init func(*PayOrder), assign func(*PayOrder, *PayNotifyTask)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*PayOrder)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(paynotifytask.FieldOrderID)
}
query.Where(predicate.PayNotifyTask(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(payorder.NotifyTaskColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.OrderID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "order_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *PayOrderQuery) loadRefund(ctx context.Context, query *PayRefundQuery, nodes []*PayOrder, init func(*PayOrder), assign func(*PayOrder, *PayRefund)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uint64]*PayOrder)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
if init != nil {
init(nodes[i])
}
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(payrefund.FieldOrderID)
}
query.Where(predicate.PayRefund(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(payorder.RefundColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.OrderID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "order_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *PayOrderQuery) sqlCount(ctx context.Context) (int, error) {
_spec := _q.querySpec()
_spec.Node.Columns = _q.ctx.Fields
if len(_q.ctx.Fields) > 0 {
_spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
func (_q *PayOrderQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(payorder.Table, payorder.Columns, sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64))
_spec.From = _q.sql
if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
} else if _q.path != nil {
_spec.Unique = true
}
if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, payorder.FieldID)
for i := range fields {
if fields[i] != payorder.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
if _q.withChannel != nil {
_spec.Node.AddColumnOnce(payorder.FieldChannelID)
}
}
if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
return _spec
}
func (_q *PayOrderQuery) sqlQuery(ctx context.Context) *sql.Selector {
builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(payorder.Table)
columns := _q.ctx.Fields
if len(columns) == 0 {
columns = payorder.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
if _q.sql != nil {
selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
for _, p := range _q.predicates {
p(selector)
}
for _, p := range _q.order {
p(selector)
}
if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
}
// PayOrderGroupBy is the group-by builder for PayOrder entities.
type PayOrderGroupBy struct {
selector
build *PayOrderQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func (_g *PayOrderGroupBy) Aggregate(fns ...AggregateFunc) *PayOrderGroupBy {
_g.fns = append(_g.fns, fns...)
return _g
}
// Scan applies the selector query and scans the result into the given value.
func (_g *PayOrderGroupBy) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*PayOrderQuery, *PayOrderGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
func (_g *PayOrderGroupBy) sqlScan(ctx context.Context, root *PayOrderQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
aggregation := make([]string, 0, len(_g.fns))
for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}
// PayOrderSelect is the builder for selecting fields of PayOrder entities.
type PayOrderSelect struct {
*PayOrderQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func (_s *PayOrderSelect) Aggregate(fns ...AggregateFunc) *PayOrderSelect {
_s.fns = append(_s.fns, fns...)
return _s
}
// Scan applies the selector query and scans the result into the given value.
func (_s *PayOrderSelect) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
if err := _s.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*PayOrderQuery, *PayOrderSelect](ctx, _s.PayOrderQuery, _s, _s.inters, v)
}
func (_s *PayOrderSelect) sqlScan(ctx context.Context, root *PayOrderQuery, v any) error {
selector := root.sqlQuery(ctx)
aggregation := make([]string, 0, len(_s.fns))
for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
selector.AppendSelect(aggregation...)
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}

1810
rpc/ent/payorder_update.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,269 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"encoding/json"
"fmt"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// PayOrderExtension Table | 支付订单拓展表
type PayOrderExtension 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"`
// Order ID | 订单ID
OrderID uint64 `json:"order_id,omitempty"`
// Channel ID | 渠道ID
ChannelID uint64 `json:"channel_id,omitempty"`
// Channel Extras | 渠道参数
ChannelExtras map[string]interface{} `json:"channel_extras,omitempty"`
// Channel Error Code | 渠道错误码
ChannelErrorCode string `json:"channel_error_code,omitempty"`
// Channel Error Msg | 渠道错误信息
ChannelErrorMsg string `json:"channel_error_msg,omitempty"`
// Channel Notify Data | 渠道回调数据
ChannelNotifyData string `json:"channel_notify_data,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PayOrderExtensionQuery when eager-loading is set.
Edges PayOrderExtensionEdges `json:"edges"`
selectValues sql.SelectValues
}
// PayOrderExtensionEdges holds the relations/edges for other nodes in the graph.
type PayOrderExtensionEdges struct {
// Channel holds the value of the channel edge.
Channel *PayChannel `json:"channel,omitempty"`
// Order holds the value of the order edge.
Order *PayOrder `json:"order,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [2]bool
}
// ChannelOrErr returns the Channel value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e PayOrderExtensionEdges) ChannelOrErr() (*PayChannel, error) {
if e.Channel != nil {
return e.Channel, nil
} else if e.loadedTypes[0] {
return nil, &NotFoundError{label: paychannel.Label}
}
return nil, &NotLoadedError{edge: "channel"}
}
// OrderOrErr returns the Order value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e PayOrderExtensionEdges) OrderOrErr() (*PayOrder, error) {
if e.Order != nil {
return e.Order, nil
} else if e.loadedTypes[1] {
return nil, &NotFoundError{label: payorder.Label}
}
return nil, &NotLoadedError{edge: "order"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*PayOrderExtension) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case payorderextension.FieldChannelExtras:
values[i] = new([]byte)
case payorderextension.FieldID, payorderextension.FieldStatus, payorderextension.FieldTenantID, payorderextension.FieldOrderID, payorderextension.FieldChannelID:
values[i] = new(sql.NullInt64)
case payorderextension.FieldChannelErrorCode, payorderextension.FieldChannelErrorMsg, payorderextension.FieldChannelNotifyData:
values[i] = new(sql.NullString)
case payorderextension.FieldCreatedAt, payorderextension.FieldUpdatedAt, payorderextension.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 PayOrderExtension fields.
func (_m *PayOrderExtension) 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 payorderextension.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 payorderextension.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 payorderextension.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 payorderextension.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 payorderextension.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 payorderextension.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 payorderextension.FieldOrderID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field order_id", values[i])
} else if value.Valid {
_m.OrderID = uint64(value.Int64)
}
case payorderextension.FieldChannelID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field channel_id", values[i])
} else if value.Valid {
_m.ChannelID = uint64(value.Int64)
}
case payorderextension.FieldChannelExtras:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field channel_extras", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &_m.ChannelExtras); err != nil {
return fmt.Errorf("unmarshal field channel_extras: %w", err)
}
}
case payorderextension.FieldChannelErrorCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field channel_error_code", values[i])
} else if value.Valid {
_m.ChannelErrorCode = value.String
}
case payorderextension.FieldChannelErrorMsg:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field channel_error_msg", values[i])
} else if value.Valid {
_m.ChannelErrorMsg = value.String
}
case payorderextension.FieldChannelNotifyData:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field channel_notify_data", values[i])
} else if value.Valid {
_m.ChannelNotifyData = 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 PayOrderExtension.
// This includes values selected through modifiers, order, etc.
func (_m *PayOrderExtension) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryChannel queries the "channel" edge of the PayOrderExtension entity.
func (_m *PayOrderExtension) QueryChannel() *PayChannelQuery {
return NewPayOrderExtensionClient(_m.config).QueryChannel(_m)
}
// QueryOrder queries the "order" edge of the PayOrderExtension entity.
func (_m *PayOrderExtension) QueryOrder() *PayOrderQuery {
return NewPayOrderExtensionClient(_m.config).QueryOrder(_m)
}
// Update returns a builder for updating this PayOrderExtension.
// Note that you need to call PayOrderExtension.Unwrap() before calling this method if this PayOrderExtension
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *PayOrderExtension) Update() *PayOrderExtensionUpdateOne {
return NewPayOrderExtensionClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the PayOrderExtension 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 *PayOrderExtension) Unwrap() *PayOrderExtension {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: PayOrderExtension is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *PayOrderExtension) String() string {
var builder strings.Builder
builder.WriteString("PayOrderExtension(")
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("order_id=")
builder.WriteString(fmt.Sprintf("%v", _m.OrderID))
builder.WriteString(", ")
builder.WriteString("channel_id=")
builder.WriteString(fmt.Sprintf("%v", _m.ChannelID))
builder.WriteString(", ")
builder.WriteString("channel_extras=")
builder.WriteString(fmt.Sprintf("%v", _m.ChannelExtras))
builder.WriteString(", ")
builder.WriteString("channel_error_code=")
builder.WriteString(_m.ChannelErrorCode)
builder.WriteString(", ")
builder.WriteString("channel_error_msg=")
builder.WriteString(_m.ChannelErrorMsg)
builder.WriteString(", ")
builder.WriteString("channel_notify_data=")
builder.WriteString(_m.ChannelNotifyData)
builder.WriteByte(')')
return builder.String()
}
// PayOrderExtensions is a parsable slice of PayOrderExtension.
type PayOrderExtensions []*PayOrderExtension

View File

@ -0,0 +1,184 @@
// Code generated by ent, DO NOT EDIT.
package payorderextension
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the payorderextension type in the database.
Label = "pay_order_extension"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
// FieldTenantID holds the string denoting the tenant_id field in the database.
FieldTenantID = "tenant_id"
// FieldDeletedAt holds the string denoting the deleted_at field in the database.
FieldDeletedAt = "deleted_at"
// FieldOrderID holds the string denoting the order_id field in the database.
FieldOrderID = "order_id"
// FieldChannelID holds the string denoting the channel_id field in the database.
FieldChannelID = "channel_id"
// FieldChannelExtras holds the string denoting the channel_extras field in the database.
FieldChannelExtras = "channel_extras"
// FieldChannelErrorCode holds the string denoting the channel_error_code field in the database.
FieldChannelErrorCode = "channel_error_code"
// FieldChannelErrorMsg holds the string denoting the channel_error_msg field in the database.
FieldChannelErrorMsg = "channel_error_msg"
// FieldChannelNotifyData holds the string denoting the channel_notify_data field in the database.
FieldChannelNotifyData = "channel_notify_data"
// EdgeChannel holds the string denoting the channel edge name in mutations.
EdgeChannel = "channel"
// EdgeOrder holds the string denoting the order edge name in mutations.
EdgeOrder = "order"
// Table holds the table name of the payorderextension in the database.
Table = "pay_order_extension"
// ChannelTable is the table that holds the channel relation/edge.
ChannelTable = "pay_order_extension"
// ChannelInverseTable is the table name for the PayChannel entity.
// It exists in this package in order to avoid circular dependency with the "paychannel" package.
ChannelInverseTable = "pay_channel"
// ChannelColumn is the table column denoting the channel relation/edge.
ChannelColumn = "channel_id"
// OrderTable is the table that holds the order relation/edge.
OrderTable = "pay_order_extension"
// OrderInverseTable is the table name for the PayOrder entity.
// It exists in this package in order to avoid circular dependency with the "payorder" package.
OrderInverseTable = "pay_order"
// OrderColumn is the table column denoting the order relation/edge.
OrderColumn = "order_id"
)
// Columns holds all SQL columns for payorderextension fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldStatus,
FieldTenantID,
FieldDeletedAt,
FieldOrderID,
FieldChannelID,
FieldChannelExtras,
FieldChannelErrorCode,
FieldChannelErrorMsg,
FieldChannelNotifyData,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus uint8
// DefaultTenantID holds the default value on creation for the "tenant_id" field.
DefaultTenantID uint64
)
// OrderOption defines the ordering options for the PayOrderExtension queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
// ByTenantID orders the results by the tenant_id field.
func ByTenantID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTenantID, opts...).ToFunc()
}
// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}
// ByOrderID orders the results by the order_id field.
func ByOrderID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOrderID, opts...).ToFunc()
}
// ByChannelID orders the results by the channel_id field.
func ByChannelID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelID, opts...).ToFunc()
}
// ByChannelErrorCode orders the results by the channel_error_code field.
func ByChannelErrorCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelErrorCode, opts...).ToFunc()
}
// ByChannelErrorMsg orders the results by the channel_error_msg field.
func ByChannelErrorMsg(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelErrorMsg, opts...).ToFunc()
}
// ByChannelNotifyData orders the results by the channel_notify_data field.
func ByChannelNotifyData(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldChannelNotifyData, opts...).ToFunc()
}
// ByChannelField orders the results by channel field.
func ByChannelField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newChannelStep(), sql.OrderByField(field, opts...))
}
}
// ByOrderField orders the results by order field.
func ByOrderField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newOrderStep(), sql.OrderByField(field, opts...))
}
}
func newChannelStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(ChannelInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, ChannelTable, ChannelColumn),
)
}
func newOrderStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(OrderInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, OrderTable, OrderColumn),
)
}

View File

@ -0,0 +1,662 @@
// Code generated by ent, DO NOT EDIT.
package payorderextension
import (
"mingyang-admin-pay/rpc/ent/predicate"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
// ID filters vertices based on their ID field.
func ID(id uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldID, id))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldUpdatedAt, v))
}
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
func Status(v uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldStatus, v))
}
// TenantID applies equality check predicate on the "tenant_id" field. It's identical to TenantIDEQ.
func TenantID(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldTenantID, v))
}
// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
func DeletedAt(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldDeletedAt, v))
}
// OrderID applies equality check predicate on the "order_id" field. It's identical to OrderIDEQ.
func OrderID(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldOrderID, v))
}
// ChannelID applies equality check predicate on the "channel_id" field. It's identical to ChannelIDEQ.
func ChannelID(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelID, v))
}
// ChannelErrorCode applies equality check predicate on the "channel_error_code" field. It's identical to ChannelErrorCodeEQ.
func ChannelErrorCode(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelErrorCode, v))
}
// ChannelErrorMsg applies equality check predicate on the "channel_error_msg" field. It's identical to ChannelErrorMsgEQ.
func ChannelErrorMsg(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelErrorMsg, v))
}
// ChannelNotifyData applies equality check predicate on the "channel_notify_data" field. It's identical to ChannelNotifyDataEQ.
func ChannelNotifyData(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelNotifyData, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldUpdatedAt, v))
}
// StatusEQ applies the EQ predicate on the "status" field.
func StatusEQ(v uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldStatus, v))
}
// StatusNEQ applies the NEQ predicate on the "status" field.
func StatusNEQ(v uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldStatus, v))
}
// StatusIn applies the In predicate on the "status" field.
func StatusIn(vs ...uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldStatus, vs...))
}
// StatusNotIn applies the NotIn predicate on the "status" field.
func StatusNotIn(vs ...uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldStatus, vs...))
}
// StatusGT applies the GT predicate on the "status" field.
func StatusGT(v uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldStatus, v))
}
// StatusGTE applies the GTE predicate on the "status" field.
func StatusGTE(v uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldStatus, v))
}
// StatusLT applies the LT predicate on the "status" field.
func StatusLT(v uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldStatus, v))
}
// StatusLTE applies the LTE predicate on the "status" field.
func StatusLTE(v uint8) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldStatus, v))
}
// StatusIsNil applies the IsNil predicate on the "status" field.
func StatusIsNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIsNull(FieldStatus))
}
// StatusNotNil applies the NotNil predicate on the "status" field.
func StatusNotNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotNull(FieldStatus))
}
// TenantIDEQ applies the EQ predicate on the "tenant_id" field.
func TenantIDEQ(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldTenantID, v))
}
// TenantIDNEQ applies the NEQ predicate on the "tenant_id" field.
func TenantIDNEQ(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldTenantID, v))
}
// TenantIDIn applies the In predicate on the "tenant_id" field.
func TenantIDIn(vs ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldTenantID, vs...))
}
// TenantIDNotIn applies the NotIn predicate on the "tenant_id" field.
func TenantIDNotIn(vs ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldTenantID, vs...))
}
// TenantIDGT applies the GT predicate on the "tenant_id" field.
func TenantIDGT(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldTenantID, v))
}
// TenantIDGTE applies the GTE predicate on the "tenant_id" field.
func TenantIDGTE(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldTenantID, v))
}
// TenantIDLT applies the LT predicate on the "tenant_id" field.
func TenantIDLT(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldTenantID, v))
}
// TenantIDLTE applies the LTE predicate on the "tenant_id" field.
func TenantIDLTE(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldTenantID, v))
}
// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
func DeletedAtEQ(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldDeletedAt, v))
}
// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
func DeletedAtNEQ(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldDeletedAt, v))
}
// DeletedAtIn applies the In predicate on the "deleted_at" field.
func DeletedAtIn(vs ...time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldDeletedAt, vs...))
}
// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
func DeletedAtNotIn(vs ...time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldDeletedAt, vs...))
}
// DeletedAtGT applies the GT predicate on the "deleted_at" field.
func DeletedAtGT(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldDeletedAt, v))
}
// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
func DeletedAtGTE(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldDeletedAt, v))
}
// DeletedAtLT applies the LT predicate on the "deleted_at" field.
func DeletedAtLT(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldDeletedAt, v))
}
// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
func DeletedAtLTE(v time.Time) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldDeletedAt, v))
}
// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
func DeletedAtIsNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIsNull(FieldDeletedAt))
}
// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
func DeletedAtNotNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotNull(FieldDeletedAt))
}
// OrderIDEQ applies the EQ predicate on the "order_id" field.
func OrderIDEQ(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldOrderID, v))
}
// OrderIDNEQ applies the NEQ predicate on the "order_id" field.
func OrderIDNEQ(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldOrderID, v))
}
// OrderIDIn applies the In predicate on the "order_id" field.
func OrderIDIn(vs ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldOrderID, vs...))
}
// OrderIDNotIn applies the NotIn predicate on the "order_id" field.
func OrderIDNotIn(vs ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldOrderID, vs...))
}
// ChannelIDEQ applies the EQ predicate on the "channel_id" field.
func ChannelIDEQ(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelID, v))
}
// ChannelIDNEQ applies the NEQ predicate on the "channel_id" field.
func ChannelIDNEQ(v uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldChannelID, v))
}
// ChannelIDIn applies the In predicate on the "channel_id" field.
func ChannelIDIn(vs ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldChannelID, vs...))
}
// ChannelIDNotIn applies the NotIn predicate on the "channel_id" field.
func ChannelIDNotIn(vs ...uint64) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldChannelID, vs...))
}
// ChannelExtrasIsNil applies the IsNil predicate on the "channel_extras" field.
func ChannelExtrasIsNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIsNull(FieldChannelExtras))
}
// ChannelExtrasNotNil applies the NotNil predicate on the "channel_extras" field.
func ChannelExtrasNotNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotNull(FieldChannelExtras))
}
// ChannelErrorCodeEQ applies the EQ predicate on the "channel_error_code" field.
func ChannelErrorCodeEQ(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelErrorCode, v))
}
// ChannelErrorCodeNEQ applies the NEQ predicate on the "channel_error_code" field.
func ChannelErrorCodeNEQ(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldChannelErrorCode, v))
}
// ChannelErrorCodeIn applies the In predicate on the "channel_error_code" field.
func ChannelErrorCodeIn(vs ...string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldChannelErrorCode, vs...))
}
// ChannelErrorCodeNotIn applies the NotIn predicate on the "channel_error_code" field.
func ChannelErrorCodeNotIn(vs ...string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldChannelErrorCode, vs...))
}
// ChannelErrorCodeGT applies the GT predicate on the "channel_error_code" field.
func ChannelErrorCodeGT(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldChannelErrorCode, v))
}
// ChannelErrorCodeGTE applies the GTE predicate on the "channel_error_code" field.
func ChannelErrorCodeGTE(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldChannelErrorCode, v))
}
// ChannelErrorCodeLT applies the LT predicate on the "channel_error_code" field.
func ChannelErrorCodeLT(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldChannelErrorCode, v))
}
// ChannelErrorCodeLTE applies the LTE predicate on the "channel_error_code" field.
func ChannelErrorCodeLTE(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldChannelErrorCode, v))
}
// ChannelErrorCodeContains applies the Contains predicate on the "channel_error_code" field.
func ChannelErrorCodeContains(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldContains(FieldChannelErrorCode, v))
}
// ChannelErrorCodeHasPrefix applies the HasPrefix predicate on the "channel_error_code" field.
func ChannelErrorCodeHasPrefix(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldHasPrefix(FieldChannelErrorCode, v))
}
// ChannelErrorCodeHasSuffix applies the HasSuffix predicate on the "channel_error_code" field.
func ChannelErrorCodeHasSuffix(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldHasSuffix(FieldChannelErrorCode, v))
}
// ChannelErrorCodeIsNil applies the IsNil predicate on the "channel_error_code" field.
func ChannelErrorCodeIsNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIsNull(FieldChannelErrorCode))
}
// ChannelErrorCodeNotNil applies the NotNil predicate on the "channel_error_code" field.
func ChannelErrorCodeNotNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotNull(FieldChannelErrorCode))
}
// ChannelErrorCodeEqualFold applies the EqualFold predicate on the "channel_error_code" field.
func ChannelErrorCodeEqualFold(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEqualFold(FieldChannelErrorCode, v))
}
// ChannelErrorCodeContainsFold applies the ContainsFold predicate on the "channel_error_code" field.
func ChannelErrorCodeContainsFold(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldContainsFold(FieldChannelErrorCode, v))
}
// ChannelErrorMsgEQ applies the EQ predicate on the "channel_error_msg" field.
func ChannelErrorMsgEQ(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgNEQ applies the NEQ predicate on the "channel_error_msg" field.
func ChannelErrorMsgNEQ(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgIn applies the In predicate on the "channel_error_msg" field.
func ChannelErrorMsgIn(vs ...string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldChannelErrorMsg, vs...))
}
// ChannelErrorMsgNotIn applies the NotIn predicate on the "channel_error_msg" field.
func ChannelErrorMsgNotIn(vs ...string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldChannelErrorMsg, vs...))
}
// ChannelErrorMsgGT applies the GT predicate on the "channel_error_msg" field.
func ChannelErrorMsgGT(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgGTE applies the GTE predicate on the "channel_error_msg" field.
func ChannelErrorMsgGTE(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgLT applies the LT predicate on the "channel_error_msg" field.
func ChannelErrorMsgLT(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgLTE applies the LTE predicate on the "channel_error_msg" field.
func ChannelErrorMsgLTE(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgContains applies the Contains predicate on the "channel_error_msg" field.
func ChannelErrorMsgContains(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldContains(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgHasPrefix applies the HasPrefix predicate on the "channel_error_msg" field.
func ChannelErrorMsgHasPrefix(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldHasPrefix(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgHasSuffix applies the HasSuffix predicate on the "channel_error_msg" field.
func ChannelErrorMsgHasSuffix(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldHasSuffix(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgIsNil applies the IsNil predicate on the "channel_error_msg" field.
func ChannelErrorMsgIsNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIsNull(FieldChannelErrorMsg))
}
// ChannelErrorMsgNotNil applies the NotNil predicate on the "channel_error_msg" field.
func ChannelErrorMsgNotNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotNull(FieldChannelErrorMsg))
}
// ChannelErrorMsgEqualFold applies the EqualFold predicate on the "channel_error_msg" field.
func ChannelErrorMsgEqualFold(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEqualFold(FieldChannelErrorMsg, v))
}
// ChannelErrorMsgContainsFold applies the ContainsFold predicate on the "channel_error_msg" field.
func ChannelErrorMsgContainsFold(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldContainsFold(FieldChannelErrorMsg, v))
}
// ChannelNotifyDataEQ applies the EQ predicate on the "channel_notify_data" field.
func ChannelNotifyDataEQ(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEQ(FieldChannelNotifyData, v))
}
// ChannelNotifyDataNEQ applies the NEQ predicate on the "channel_notify_data" field.
func ChannelNotifyDataNEQ(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNEQ(FieldChannelNotifyData, v))
}
// ChannelNotifyDataIn applies the In predicate on the "channel_notify_data" field.
func ChannelNotifyDataIn(vs ...string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIn(FieldChannelNotifyData, vs...))
}
// ChannelNotifyDataNotIn applies the NotIn predicate on the "channel_notify_data" field.
func ChannelNotifyDataNotIn(vs ...string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotIn(FieldChannelNotifyData, vs...))
}
// ChannelNotifyDataGT applies the GT predicate on the "channel_notify_data" field.
func ChannelNotifyDataGT(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGT(FieldChannelNotifyData, v))
}
// ChannelNotifyDataGTE applies the GTE predicate on the "channel_notify_data" field.
func ChannelNotifyDataGTE(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldGTE(FieldChannelNotifyData, v))
}
// ChannelNotifyDataLT applies the LT predicate on the "channel_notify_data" field.
func ChannelNotifyDataLT(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLT(FieldChannelNotifyData, v))
}
// ChannelNotifyDataLTE applies the LTE predicate on the "channel_notify_data" field.
func ChannelNotifyDataLTE(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldLTE(FieldChannelNotifyData, v))
}
// ChannelNotifyDataContains applies the Contains predicate on the "channel_notify_data" field.
func ChannelNotifyDataContains(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldContains(FieldChannelNotifyData, v))
}
// ChannelNotifyDataHasPrefix applies the HasPrefix predicate on the "channel_notify_data" field.
func ChannelNotifyDataHasPrefix(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldHasPrefix(FieldChannelNotifyData, v))
}
// ChannelNotifyDataHasSuffix applies the HasSuffix predicate on the "channel_notify_data" field.
func ChannelNotifyDataHasSuffix(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldHasSuffix(FieldChannelNotifyData, v))
}
// ChannelNotifyDataIsNil applies the IsNil predicate on the "channel_notify_data" field.
func ChannelNotifyDataIsNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldIsNull(FieldChannelNotifyData))
}
// ChannelNotifyDataNotNil applies the NotNil predicate on the "channel_notify_data" field.
func ChannelNotifyDataNotNil() predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldNotNull(FieldChannelNotifyData))
}
// ChannelNotifyDataEqualFold applies the EqualFold predicate on the "channel_notify_data" field.
func ChannelNotifyDataEqualFold(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldEqualFold(FieldChannelNotifyData, v))
}
// ChannelNotifyDataContainsFold applies the ContainsFold predicate on the "channel_notify_data" field.
func ChannelNotifyDataContainsFold(v string) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.FieldContainsFold(FieldChannelNotifyData, v))
}
// HasChannel applies the HasEdge predicate on the "channel" edge.
func HasChannel() predicate.PayOrderExtension {
return predicate.PayOrderExtension(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, ChannelTable, ChannelColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasChannelWith applies the HasEdge predicate on the "channel" edge with a given conditions (other predicates).
func HasChannelWith(preds ...predicate.PayChannel) predicate.PayOrderExtension {
return predicate.PayOrderExtension(func(s *sql.Selector) {
step := newChannelStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasOrder applies the HasEdge predicate on the "order" edge.
func HasOrder() predicate.PayOrderExtension {
return predicate.PayOrderExtension(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, OrderTable, OrderColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasOrderWith applies the HasEdge predicate on the "order" edge with a given conditions (other predicates).
func HasOrderWith(preds ...predicate.PayOrder) predicate.PayOrderExtension {
return predicate.PayOrderExtension(func(s *sql.Selector) {
step := newOrderStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.PayOrderExtension) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.PayOrderExtension) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.PayOrderExtension) predicate.PayOrderExtension {
return predicate.PayOrderExtension(sql.NotPredicates(p))
}

View File

@ -0,0 +1,438 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"time"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayOrderExtensionCreate is the builder for creating a PayOrderExtension entity.
type PayOrderExtensionCreate struct {
config
mutation *PayOrderExtensionMutation
hooks []Hook
}
// SetCreatedAt sets the "created_at" field.
func (_c *PayOrderExtensionCreate) SetCreatedAt(v time.Time) *PayOrderExtensionCreate {
_c.mutation.SetCreatedAt(v)
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableCreatedAt(v *time.Time) *PayOrderExtensionCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// SetUpdatedAt sets the "updated_at" field.
func (_c *PayOrderExtensionCreate) SetUpdatedAt(v time.Time) *PayOrderExtensionCreate {
_c.mutation.SetUpdatedAt(v)
return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableUpdatedAt(v *time.Time) *PayOrderExtensionCreate {
if v != nil {
_c.SetUpdatedAt(*v)
}
return _c
}
// SetStatus sets the "status" field.
func (_c *PayOrderExtensionCreate) SetStatus(v uint8) *PayOrderExtensionCreate {
_c.mutation.SetStatus(v)
return _c
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableStatus(v *uint8) *PayOrderExtensionCreate {
if v != nil {
_c.SetStatus(*v)
}
return _c
}
// SetTenantID sets the "tenant_id" field.
func (_c *PayOrderExtensionCreate) SetTenantID(v uint64) *PayOrderExtensionCreate {
_c.mutation.SetTenantID(v)
return _c
}
// SetNillableTenantID sets the "tenant_id" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableTenantID(v *uint64) *PayOrderExtensionCreate {
if v != nil {
_c.SetTenantID(*v)
}
return _c
}
// SetDeletedAt sets the "deleted_at" field.
func (_c *PayOrderExtensionCreate) SetDeletedAt(v time.Time) *PayOrderExtensionCreate {
_c.mutation.SetDeletedAt(v)
return _c
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableDeletedAt(v *time.Time) *PayOrderExtensionCreate {
if v != nil {
_c.SetDeletedAt(*v)
}
return _c
}
// SetOrderID sets the "order_id" field.
func (_c *PayOrderExtensionCreate) SetOrderID(v uint64) *PayOrderExtensionCreate {
_c.mutation.SetOrderID(v)
return _c
}
// SetChannelID sets the "channel_id" field.
func (_c *PayOrderExtensionCreate) SetChannelID(v uint64) *PayOrderExtensionCreate {
_c.mutation.SetChannelID(v)
return _c
}
// SetChannelExtras sets the "channel_extras" field.
func (_c *PayOrderExtensionCreate) SetChannelExtras(v map[string]interface{}) *PayOrderExtensionCreate {
_c.mutation.SetChannelExtras(v)
return _c
}
// SetChannelErrorCode sets the "channel_error_code" field.
func (_c *PayOrderExtensionCreate) SetChannelErrorCode(v string) *PayOrderExtensionCreate {
_c.mutation.SetChannelErrorCode(v)
return _c
}
// SetNillableChannelErrorCode sets the "channel_error_code" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableChannelErrorCode(v *string) *PayOrderExtensionCreate {
if v != nil {
_c.SetChannelErrorCode(*v)
}
return _c
}
// SetChannelErrorMsg sets the "channel_error_msg" field.
func (_c *PayOrderExtensionCreate) SetChannelErrorMsg(v string) *PayOrderExtensionCreate {
_c.mutation.SetChannelErrorMsg(v)
return _c
}
// SetNillableChannelErrorMsg sets the "channel_error_msg" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableChannelErrorMsg(v *string) *PayOrderExtensionCreate {
if v != nil {
_c.SetChannelErrorMsg(*v)
}
return _c
}
// SetChannelNotifyData sets the "channel_notify_data" field.
func (_c *PayOrderExtensionCreate) SetChannelNotifyData(v string) *PayOrderExtensionCreate {
_c.mutation.SetChannelNotifyData(v)
return _c
}
// SetNillableChannelNotifyData sets the "channel_notify_data" field if the given value is not nil.
func (_c *PayOrderExtensionCreate) SetNillableChannelNotifyData(v *string) *PayOrderExtensionCreate {
if v != nil {
_c.SetChannelNotifyData(*v)
}
return _c
}
// SetID sets the "id" field.
func (_c *PayOrderExtensionCreate) SetID(v uint64) *PayOrderExtensionCreate {
_c.mutation.SetID(v)
return _c
}
// SetChannel sets the "channel" edge to the PayChannel entity.
func (_c *PayOrderExtensionCreate) SetChannel(v *PayChannel) *PayOrderExtensionCreate {
return _c.SetChannelID(v.ID)
}
// SetOrder sets the "order" edge to the PayOrder entity.
func (_c *PayOrderExtensionCreate) SetOrder(v *PayOrder) *PayOrderExtensionCreate {
return _c.SetOrderID(v.ID)
}
// Mutation returns the PayOrderExtensionMutation object of the builder.
func (_c *PayOrderExtensionCreate) Mutation() *PayOrderExtensionMutation {
return _c.mutation
}
// Save creates the PayOrderExtension in the database.
func (_c *PayOrderExtensionCreate) Save(ctx context.Context) (*PayOrderExtension, error) {
_c.defaults()
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (_c *PayOrderExtensionCreate) SaveX(ctx context.Context) *PayOrderExtension {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PayOrderExtensionCreate) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PayOrderExtensionCreate) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_c *PayOrderExtensionCreate) defaults() {
if _, ok := _c.mutation.CreatedAt(); !ok {
v := payorderextension.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
v := payorderextension.DefaultUpdatedAt()
_c.mutation.SetUpdatedAt(v)
}
if _, ok := _c.mutation.Status(); !ok {
v := payorderextension.DefaultStatus
_c.mutation.SetStatus(v)
}
if _, ok := _c.mutation.TenantID(); !ok {
v := payorderextension.DefaultTenantID
_c.mutation.SetTenantID(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_c *PayOrderExtensionCreate) check() error {
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "PayOrderExtension.created_at"`)}
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "PayOrderExtension.updated_at"`)}
}
if _, ok := _c.mutation.TenantID(); !ok {
return &ValidationError{Name: "tenant_id", err: errors.New(`ent: missing required field "PayOrderExtension.tenant_id"`)}
}
if _, ok := _c.mutation.OrderID(); !ok {
return &ValidationError{Name: "order_id", err: errors.New(`ent: missing required field "PayOrderExtension.order_id"`)}
}
if _, ok := _c.mutation.ChannelID(); !ok {
return &ValidationError{Name: "channel_id", err: errors.New(`ent: missing required field "PayOrderExtension.channel_id"`)}
}
if len(_c.mutation.ChannelIDs()) == 0 {
return &ValidationError{Name: "channel", err: errors.New(`ent: missing required edge "PayOrderExtension.channel"`)}
}
if len(_c.mutation.OrderIDs()) == 0 {
return &ValidationError{Name: "order", err: errors.New(`ent: missing required edge "PayOrderExtension.order"`)}
}
return nil
}
func (_c *PayOrderExtensionCreate) sqlSave(ctx context.Context) (*PayOrderExtension, error) {
if err := _c.check(); err != nil {
return nil, err
}
_node, _spec := _c.createSpec()
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
if _spec.ID.Value != _node.ID {
id := _spec.ID.Value.(int64)
_node.ID = uint64(id)
}
_c.mutation.id = &_node.ID
_c.mutation.done = true
return _node, nil
}
func (_c *PayOrderExtensionCreate) createSpec() (*PayOrderExtension, *sqlgraph.CreateSpec) {
var (
_node = &PayOrderExtension{config: _c.config}
_spec = sqlgraph.NewCreateSpec(payorderextension.Table, sqlgraph.NewFieldSpec(payorderextension.FieldID, field.TypeUint64))
)
if id, ok := _c.mutation.ID(); ok {
_node.ID = id
_spec.ID.Value = id
}
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(payorderextension.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(payorderextension.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := _c.mutation.Status(); ok {
_spec.SetField(payorderextension.FieldStatus, field.TypeUint8, value)
_node.Status = value
}
if value, ok := _c.mutation.TenantID(); ok {
_spec.SetField(payorderextension.FieldTenantID, field.TypeUint64, value)
_node.TenantID = value
}
if value, ok := _c.mutation.DeletedAt(); ok {
_spec.SetField(payorderextension.FieldDeletedAt, field.TypeTime, value)
_node.DeletedAt = value
}
if value, ok := _c.mutation.ChannelExtras(); ok {
_spec.SetField(payorderextension.FieldChannelExtras, field.TypeJSON, value)
_node.ChannelExtras = value
}
if value, ok := _c.mutation.ChannelErrorCode(); ok {
_spec.SetField(payorderextension.FieldChannelErrorCode, field.TypeString, value)
_node.ChannelErrorCode = value
}
if value, ok := _c.mutation.ChannelErrorMsg(); ok {
_spec.SetField(payorderextension.FieldChannelErrorMsg, field.TypeString, value)
_node.ChannelErrorMsg = value
}
if value, ok := _c.mutation.ChannelNotifyData(); ok {
_spec.SetField(payorderextension.FieldChannelNotifyData, field.TypeString, value)
_node.ChannelNotifyData = value
}
if nodes := _c.mutation.ChannelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.ChannelTable,
Columns: []string{payorderextension.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_node.ChannelID = nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.OrderIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.OrderTable,
Columns: []string{payorderextension.OrderColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_node.OrderID = nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
return _node, _spec
}
// PayOrderExtensionCreateBulk is the builder for creating many PayOrderExtension entities in bulk.
type PayOrderExtensionCreateBulk struct {
config
err error
builders []*PayOrderExtensionCreate
}
// Save creates the PayOrderExtension entities in the database.
func (_c *PayOrderExtensionCreateBulk) Save(ctx context.Context) ([]*PayOrderExtension, error) {
if _c.err != nil {
return nil, _c.err
}
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
nodes := make([]*PayOrderExtension, len(_c.builders))
mutators := make([]Mutator, len(_c.builders))
for i := range _c.builders {
func(i int, root context.Context) {
builder := _c.builders[i]
builder.defaults()
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*PayOrderExtensionMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
if err := builder.check(); err != nil {
return nil, err
}
builder.mutation = mutation
var err error
nodes[i], specs[i] = builder.createSpec()
if i < len(mutators)-1 {
_, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
} else {
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
// Invoke the actual operation on the latest mutation in the chain.
if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
}
}
if err != nil {
return nil, err
}
mutation.id = &nodes[i].ID
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
id := specs[i].ID.Value.(int64)
nodes[i].ID = uint64(id)
}
mutation.done = true
return nodes[i], nil
})
for i := len(builder.hooks) - 1; i >= 0; i-- {
mut = builder.hooks[i](mut)
}
mutators[i] = mut
}(i, ctx)
}
if len(mutators) > 0 {
if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
return nil, err
}
}
return nodes, nil
}
// SaveX is like Save, but panics if an error occurs.
func (_c *PayOrderExtensionCreateBulk) SaveX(ctx context.Context) []*PayOrderExtension {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PayOrderExtensionCreateBulk) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PayOrderExtensionCreateBulk) ExecX(ctx context.Context) {
if err := _c.Exec(ctx); err != nil {
panic(err)
}
}

View File

@ -0,0 +1,88 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayOrderExtensionDelete is the builder for deleting a PayOrderExtension entity.
type PayOrderExtensionDelete struct {
config
hooks []Hook
mutation *PayOrderExtensionMutation
}
// Where appends a list predicates to the PayOrderExtensionDelete builder.
func (_d *PayOrderExtensionDelete) Where(ps ...predicate.PayOrderExtension) *PayOrderExtensionDelete {
_d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (_d *PayOrderExtensionDelete) Exec(ctx context.Context) (int, error) {
return withHooks(ctx, _d.sqlExec, _d.mutation, _d.hooks)
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *PayOrderExtensionDelete) ExecX(ctx context.Context) int {
n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (_d *PayOrderExtensionDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(payorderextension.Table, sqlgraph.NewFieldSpec(payorderextension.FieldID, field.TypeUint64))
if ps := _d.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
affected, err := sqlgraph.DeleteNodes(ctx, _d.driver, _spec)
if err != nil && sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
_d.mutation.done = true
return affected, err
}
// PayOrderExtensionDeleteOne is the builder for deleting a single PayOrderExtension entity.
type PayOrderExtensionDeleteOne struct {
_d *PayOrderExtensionDelete
}
// Where appends a list predicates to the PayOrderExtensionDelete builder.
func (_d *PayOrderExtensionDeleteOne) Where(ps ...predicate.PayOrderExtension) *PayOrderExtensionDeleteOne {
_d._d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query.
func (_d *PayOrderExtensionDeleteOne) Exec(ctx context.Context) error {
n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{payorderextension.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *PayOrderExtensionDeleteOne) ExecX(ctx context.Context) {
if err := _d.Exec(ctx); err != nil {
panic(err)
}
}

View File

@ -0,0 +1,681 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"fmt"
"math"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/predicate"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayOrderExtensionQuery is the builder for querying PayOrderExtension entities.
type PayOrderExtensionQuery struct {
config
ctx *QueryContext
order []payorderextension.OrderOption
inters []Interceptor
predicates []predicate.PayOrderExtension
withChannel *PayChannelQuery
withOrder *PayOrderQuery
// intermediate query (i.e. traversal path).
sql *sql.Selector
path func(context.Context) (*sql.Selector, error)
}
// Where adds a new predicate for the PayOrderExtensionQuery builder.
func (_q *PayOrderExtensionQuery) Where(ps ...predicate.PayOrderExtension) *PayOrderExtensionQuery {
_q.predicates = append(_q.predicates, ps...)
return _q
}
// Limit the number of records to be returned by this query.
func (_q *PayOrderExtensionQuery) Limit(limit int) *PayOrderExtensionQuery {
_q.ctx.Limit = &limit
return _q
}
// Offset to start from.
func (_q *PayOrderExtensionQuery) Offset(offset int) *PayOrderExtensionQuery {
_q.ctx.Offset = &offset
return _q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
func (_q *PayOrderExtensionQuery) Unique(unique bool) *PayOrderExtensionQuery {
_q.ctx.Unique = &unique
return _q
}
// Order specifies how the records should be ordered.
func (_q *PayOrderExtensionQuery) Order(o ...payorderextension.OrderOption) *PayOrderExtensionQuery {
_q.order = append(_q.order, o...)
return _q
}
// QueryChannel chains the current query on the "channel" edge.
func (_q *PayOrderExtensionQuery) QueryChannel() *PayChannelQuery {
query := (&PayChannelClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(payorderextension.Table, payorderextension.FieldID, selector),
sqlgraph.To(paychannel.Table, paychannel.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, payorderextension.ChannelTable, payorderextension.ChannelColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryOrder chains the current query on the "order" edge.
func (_q *PayOrderExtensionQuery) QueryOrder() *PayOrderQuery {
query := (&PayOrderClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(payorderextension.Table, payorderextension.FieldID, selector),
sqlgraph.To(payorder.Table, payorder.FieldID),
sqlgraph.Edge(sqlgraph.M2O, false, payorderextension.OrderTable, payorderextension.OrderColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// First returns the first PayOrderExtension entity from the query.
// Returns a *NotFoundError when no PayOrderExtension was found.
func (_q *PayOrderExtensionQuery) First(ctx context.Context) (*PayOrderExtension, error) {
nodes, err := _q.Limit(1).All(setContextOp(ctx, _q.ctx, ent.OpQueryFirst))
if err != nil {
return nil, err
}
if len(nodes) == 0 {
return nil, &NotFoundError{payorderextension.Label}
}
return nodes[0], nil
}
// FirstX is like First, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) FirstX(ctx context.Context) *PayOrderExtension {
node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return node
}
// FirstID returns the first PayOrderExtension ID from the query.
// Returns a *NotFoundError when no PayOrderExtension ID was found.
func (_q *PayOrderExtensionQuery) FirstID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(1).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryFirstID)); err != nil {
return
}
if len(ids) == 0 {
err = &NotFoundError{payorderextension.Label}
return
}
return ids[0], nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) FirstIDX(ctx context.Context) uint64 {
id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return id
}
// Only returns a single PayOrderExtension entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one PayOrderExtension entity is found.
// Returns a *NotFoundError when no PayOrderExtension entities are found.
func (_q *PayOrderExtensionQuery) Only(ctx context.Context) (*PayOrderExtension, error) {
nodes, err := _q.Limit(2).All(setContextOp(ctx, _q.ctx, ent.OpQueryOnly))
if err != nil {
return nil, err
}
switch len(nodes) {
case 1:
return nodes[0], nil
case 0:
return nil, &NotFoundError{payorderextension.Label}
default:
return nil, &NotSingularError{payorderextension.Label}
}
}
// OnlyX is like Only, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) OnlyX(ctx context.Context) *PayOrderExtension {
node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
return node
}
// OnlyID is like Only, but returns the only PayOrderExtension ID in the query.
// Returns a *NotSingularError when more than one PayOrderExtension ID is found.
// Returns a *NotFoundError when no entities are found.
func (_q *PayOrderExtensionQuery) OnlyID(ctx context.Context) (id uint64, err error) {
var ids []uint64
if ids, err = _q.Limit(2).IDs(setContextOp(ctx, _q.ctx, ent.OpQueryOnlyID)); err != nil {
return
}
switch len(ids) {
case 1:
id = ids[0]
case 0:
err = &NotFoundError{payorderextension.Label}
default:
err = &NotSingularError{payorderextension.Label}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) OnlyIDX(ctx context.Context) uint64 {
id, err := _q.OnlyID(ctx)
if err != nil {
panic(err)
}
return id
}
// All executes the query and returns a list of PayOrderExtensions.
func (_q *PayOrderExtensionQuery) All(ctx context.Context) ([]*PayOrderExtension, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*PayOrderExtension, *PayOrderExtensionQuery]()
return withInterceptors[[]*PayOrderExtension](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) AllX(ctx context.Context) []*PayOrderExtension {
nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
return nodes
}
// IDs executes the query and returns a list of PayOrderExtension IDs.
func (_q *PayOrderExtensionQuery) IDs(ctx context.Context) (ids []uint64, err error) {
if _q.ctx.Unique == nil && _q.path != nil {
_q.Unique(true)
}
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryIDs)
if err = _q.Select(payorderextension.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) IDsX(ctx context.Context) []uint64 {
ids, err := _q.IDs(ctx)
if err != nil {
panic(err)
}
return ids
}
// Count returns the count of the given query.
func (_q *PayOrderExtensionQuery) Count(ctx context.Context) (int, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryCount)
if err := _q.prepareQuery(ctx); err != nil {
return 0, err
}
return withInterceptors[int](ctx, _q, querierCount[*PayOrderExtensionQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) CountX(ctx context.Context) int {
count, err := _q.Count(ctx)
if err != nil {
panic(err)
}
return count
}
// Exist returns true if the query has elements in the graph.
func (_q *PayOrderExtensionQuery) Exist(ctx context.Context) (bool, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryExist)
switch _, err := _q.FirstID(ctx); {
case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
}
}
// ExistX is like Exist, but panics if an error occurs.
func (_q *PayOrderExtensionQuery) ExistX(ctx context.Context) bool {
exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
return exist
}
// Clone returns a duplicate of the PayOrderExtensionQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func (_q *PayOrderExtensionQuery) Clone() *PayOrderExtensionQuery {
if _q == nil {
return nil
}
return &PayOrderExtensionQuery{
config: _q.config,
ctx: _q.ctx.Clone(),
order: append([]payorderextension.OrderOption{}, _q.order...),
inters: append([]Interceptor{}, _q.inters...),
predicates: append([]predicate.PayOrderExtension{}, _q.predicates...),
withChannel: _q.withChannel.Clone(),
withOrder: _q.withOrder.Clone(),
// clone intermediate query.
sql: _q.sql.Clone(),
path: _q.path,
}
}
// WithChannel tells the query-builder to eager-load the nodes that are connected to
// the "channel" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayOrderExtensionQuery) WithChannel(opts ...func(*PayChannelQuery)) *PayOrderExtensionQuery {
query := (&PayChannelClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withChannel = query
return _q
}
// WithOrder tells the query-builder to eager-load the nodes that are connected to
// the "order" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PayOrderExtensionQuery) WithOrder(opts ...func(*PayOrderQuery)) *PayOrderExtensionQuery {
query := (&PayOrderClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withOrder = query
return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.PayOrderExtension.Query().
// GroupBy(payorderextension.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func (_q *PayOrderExtensionQuery) GroupBy(field string, fields ...string) *PayOrderExtensionGroupBy {
_q.ctx.Fields = append([]string{field}, fields...)
grbuild := &PayOrderExtensionGroupBy{build: _q}
grbuild.flds = &_q.ctx.Fields
grbuild.label = payorderextension.Label
grbuild.scan = grbuild.Scan
return grbuild
}
// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// }
//
// client.PayOrderExtension.Query().
// Select(payorderextension.FieldCreatedAt).
// Scan(ctx, &v)
func (_q *PayOrderExtensionQuery) Select(fields ...string) *PayOrderExtensionSelect {
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
sbuild := &PayOrderExtensionSelect{PayOrderExtensionQuery: _q}
sbuild.label = payorderextension.Label
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a PayOrderExtensionSelect configured with the given aggregations.
func (_q *PayOrderExtensionQuery) Aggregate(fns ...AggregateFunc) *PayOrderExtensionSelect {
return _q.Select().Aggregate(fns...)
}
func (_q *PayOrderExtensionQuery) prepareQuery(ctx context.Context) error {
for _, inter := range _q.inters {
if inter == nil {
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
}
if trv, ok := inter.(Traverser); ok {
if err := trv.Traverse(ctx, _q); err != nil {
return err
}
}
}
for _, f := range _q.ctx.Fields {
if !payorderextension.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
}
if _q.path != nil {
prev, err := _q.path(ctx)
if err != nil {
return err
}
_q.sql = prev
}
return nil
}
func (_q *PayOrderExtensionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*PayOrderExtension, error) {
var (
nodes = []*PayOrderExtension{}
_spec = _q.querySpec()
loadedTypes = [2]bool{
_q.withChannel != nil,
_q.withOrder != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*PayOrderExtension).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
node := &PayOrderExtension{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
}
for i := range hooks {
hooks[i](ctx, _spec)
}
if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
if query := _q.withChannel; query != nil {
if err := _q.loadChannel(ctx, query, nodes, nil,
func(n *PayOrderExtension, e *PayChannel) { n.Edges.Channel = e }); err != nil {
return nil, err
}
}
if query := _q.withOrder; query != nil {
if err := _q.loadOrder(ctx, query, nodes, nil,
func(n *PayOrderExtension, e *PayOrder) { n.Edges.Order = e }); err != nil {
return nil, err
}
}
return nodes, nil
}
func (_q *PayOrderExtensionQuery) loadChannel(ctx context.Context, query *PayChannelQuery, nodes []*PayOrderExtension, init func(*PayOrderExtension), assign func(*PayOrderExtension, *PayChannel)) error {
ids := make([]uint64, 0, len(nodes))
nodeids := make(map[uint64][]*PayOrderExtension)
for i := range nodes {
fk := nodes[i].ChannelID
if _, ok := nodeids[fk]; !ok {
ids = append(ids, fk)
}
nodeids[fk] = append(nodeids[fk], nodes[i])
}
if len(ids) == 0 {
return nil
}
query.Where(paychannel.IDIn(ids...))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
nodes, ok := nodeids[n.ID]
if !ok {
return fmt.Errorf(`unexpected foreign-key "channel_id" returned %v`, n.ID)
}
for i := range nodes {
assign(nodes[i], n)
}
}
return nil
}
func (_q *PayOrderExtensionQuery) loadOrder(ctx context.Context, query *PayOrderQuery, nodes []*PayOrderExtension, init func(*PayOrderExtension), assign func(*PayOrderExtension, *PayOrder)) error {
ids := make([]uint64, 0, len(nodes))
nodeids := make(map[uint64][]*PayOrderExtension)
for i := range nodes {
fk := nodes[i].OrderID
if _, ok := nodeids[fk]; !ok {
ids = append(ids, fk)
}
nodeids[fk] = append(nodeids[fk], nodes[i])
}
if len(ids) == 0 {
return nil
}
query.Where(payorder.IDIn(ids...))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
nodes, ok := nodeids[n.ID]
if !ok {
return fmt.Errorf(`unexpected foreign-key "order_id" returned %v`, n.ID)
}
for i := range nodes {
assign(nodes[i], n)
}
}
return nil
}
func (_q *PayOrderExtensionQuery) sqlCount(ctx context.Context) (int, error) {
_spec := _q.querySpec()
_spec.Node.Columns = _q.ctx.Fields
if len(_q.ctx.Fields) > 0 {
_spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
}
return sqlgraph.CountNodes(ctx, _q.driver, _spec)
}
func (_q *PayOrderExtensionQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(payorderextension.Table, payorderextension.Columns, sqlgraph.NewFieldSpec(payorderextension.FieldID, field.TypeUint64))
_spec.From = _q.sql
if unique := _q.ctx.Unique; unique != nil {
_spec.Unique = *unique
} else if _q.path != nil {
_spec.Unique = true
}
if fields := _q.ctx.Fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, payorderextension.FieldID)
for i := range fields {
if fields[i] != payorderextension.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
if _q.withChannel != nil {
_spec.Node.AddColumnOnce(payorderextension.FieldChannelID)
}
if _q.withOrder != nil {
_spec.Node.AddColumnOnce(payorderextension.FieldOrderID)
}
}
if ps := _q.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if limit := _q.ctx.Limit; limit != nil {
_spec.Limit = *limit
}
if offset := _q.ctx.Offset; offset != nil {
_spec.Offset = *offset
}
if ps := _q.order; len(ps) > 0 {
_spec.Order = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
return _spec
}
func (_q *PayOrderExtensionQuery) sqlQuery(ctx context.Context) *sql.Selector {
builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(payorderextension.Table)
columns := _q.ctx.Fields
if len(columns) == 0 {
columns = payorderextension.Columns
}
selector := builder.Select(t1.Columns(columns...)...).From(t1)
if _q.sql != nil {
selector = _q.sql
selector.Select(selector.Columns(columns...)...)
}
if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
for _, p := range _q.predicates {
p(selector)
}
for _, p := range _q.order {
p(selector)
}
if offset := _q.ctx.Offset; offset != nil {
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector.Offset(*offset).Limit(math.MaxInt32)
}
if limit := _q.ctx.Limit; limit != nil {
selector.Limit(*limit)
}
return selector
}
// PayOrderExtensionGroupBy is the group-by builder for PayOrderExtension entities.
type PayOrderExtensionGroupBy struct {
selector
build *PayOrderExtensionQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func (_g *PayOrderExtensionGroupBy) Aggregate(fns ...AggregateFunc) *PayOrderExtensionGroupBy {
_g.fns = append(_g.fns, fns...)
return _g
}
// Scan applies the selector query and scans the result into the given value.
func (_g *PayOrderExtensionGroupBy) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy)
if err := _g.build.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*PayOrderExtensionQuery, *PayOrderExtensionGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
func (_g *PayOrderExtensionGroupBy) sqlScan(ctx context.Context, root *PayOrderExtensionQuery, v any) error {
selector := root.sqlQuery(ctx).Select()
aggregation := make([]string, 0, len(_g.fns))
for _, fn := range _g.fns {
aggregation = append(aggregation, fn(selector))
}
if len(selector.SelectedColumns()) == 0 {
columns := make([]string, 0, len(*_g.flds)+len(_g.fns))
for _, f := range *_g.flds {
columns = append(columns, selector.C(f))
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
selector.GroupBy(selector.Columns(*_g.flds...)...)
if err := selector.Err(); err != nil {
return err
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _g.build.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}
// PayOrderExtensionSelect is the builder for selecting fields of PayOrderExtension entities.
type PayOrderExtensionSelect struct {
*PayOrderExtensionQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func (_s *PayOrderExtensionSelect) Aggregate(fns ...AggregateFunc) *PayOrderExtensionSelect {
_s.fns = append(_s.fns, fns...)
return _s
}
// Scan applies the selector query and scans the result into the given value.
func (_s *PayOrderExtensionSelect) Scan(ctx context.Context, v any) error {
ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect)
if err := _s.prepareQuery(ctx); err != nil {
return err
}
return scanWithInterceptors[*PayOrderExtensionQuery, *PayOrderExtensionSelect](ctx, _s.PayOrderExtensionQuery, _s, _s.inters, v)
}
func (_s *PayOrderExtensionSelect) sqlScan(ctx context.Context, root *PayOrderExtensionQuery, v any) error {
selector := root.sqlQuery(ctx)
aggregation := make([]string, 0, len(_s.fns))
for _, fn := range _s.fns {
aggregation = append(aggregation, fn(selector))
}
switch n := len(*_s.selector.flds); {
case n == 0 && len(aggregation) > 0:
selector.Select(aggregation...)
case n != 0 && len(aggregation) > 0:
selector.AppendSelect(aggregation...)
}
rows := &sql.Rows{}
query, args := selector.Query()
if err := _s.driver.Query(ctx, query, args, rows); err != nil {
return err
}
defer rows.Close()
return sql.ScanSlice(rows, v)
}

View File

@ -0,0 +1,774 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/predicate"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
)
// PayOrderExtensionUpdate is the builder for updating PayOrderExtension entities.
type PayOrderExtensionUpdate struct {
config
hooks []Hook
mutation *PayOrderExtensionMutation
}
// Where appends a list predicates to the PayOrderExtensionUpdate builder.
func (_u *PayOrderExtensionUpdate) Where(ps ...predicate.PayOrderExtension) *PayOrderExtensionUpdate {
_u.mutation.Where(ps...)
return _u
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *PayOrderExtensionUpdate) SetUpdatedAt(v time.Time) *PayOrderExtensionUpdate {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetStatus sets the "status" field.
func (_u *PayOrderExtensionUpdate) SetStatus(v uint8) *PayOrderExtensionUpdate {
_u.mutation.ResetStatus()
_u.mutation.SetStatus(v)
return _u
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_u *PayOrderExtensionUpdate) SetNillableStatus(v *uint8) *PayOrderExtensionUpdate {
if v != nil {
_u.SetStatus(*v)
}
return _u
}
// AddStatus adds value to the "status" field.
func (_u *PayOrderExtensionUpdate) AddStatus(v int8) *PayOrderExtensionUpdate {
_u.mutation.AddStatus(v)
return _u
}
// ClearStatus clears the value of the "status" field.
func (_u *PayOrderExtensionUpdate) ClearStatus() *PayOrderExtensionUpdate {
_u.mutation.ClearStatus()
return _u
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *PayOrderExtensionUpdate) SetDeletedAt(v time.Time) *PayOrderExtensionUpdate {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *PayOrderExtensionUpdate) SetNillableDeletedAt(v *time.Time) *PayOrderExtensionUpdate {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *PayOrderExtensionUpdate) ClearDeletedAt() *PayOrderExtensionUpdate {
_u.mutation.ClearDeletedAt()
return _u
}
// SetOrderID sets the "order_id" field.
func (_u *PayOrderExtensionUpdate) SetOrderID(v uint64) *PayOrderExtensionUpdate {
_u.mutation.SetOrderID(v)
return _u
}
// SetNillableOrderID sets the "order_id" field if the given value is not nil.
func (_u *PayOrderExtensionUpdate) SetNillableOrderID(v *uint64) *PayOrderExtensionUpdate {
if v != nil {
_u.SetOrderID(*v)
}
return _u
}
// SetChannelID sets the "channel_id" field.
func (_u *PayOrderExtensionUpdate) SetChannelID(v uint64) *PayOrderExtensionUpdate {
_u.mutation.SetChannelID(v)
return _u
}
// SetNillableChannelID sets the "channel_id" field if the given value is not nil.
func (_u *PayOrderExtensionUpdate) SetNillableChannelID(v *uint64) *PayOrderExtensionUpdate {
if v != nil {
_u.SetChannelID(*v)
}
return _u
}
// SetChannelExtras sets the "channel_extras" field.
func (_u *PayOrderExtensionUpdate) SetChannelExtras(v map[string]interface{}) *PayOrderExtensionUpdate {
_u.mutation.SetChannelExtras(v)
return _u
}
// ClearChannelExtras clears the value of the "channel_extras" field.
func (_u *PayOrderExtensionUpdate) ClearChannelExtras() *PayOrderExtensionUpdate {
_u.mutation.ClearChannelExtras()
return _u
}
// SetChannelErrorCode sets the "channel_error_code" field.
func (_u *PayOrderExtensionUpdate) SetChannelErrorCode(v string) *PayOrderExtensionUpdate {
_u.mutation.SetChannelErrorCode(v)
return _u
}
// SetNillableChannelErrorCode sets the "channel_error_code" field if the given value is not nil.
func (_u *PayOrderExtensionUpdate) SetNillableChannelErrorCode(v *string) *PayOrderExtensionUpdate {
if v != nil {
_u.SetChannelErrorCode(*v)
}
return _u
}
// ClearChannelErrorCode clears the value of the "channel_error_code" field.
func (_u *PayOrderExtensionUpdate) ClearChannelErrorCode() *PayOrderExtensionUpdate {
_u.mutation.ClearChannelErrorCode()
return _u
}
// SetChannelErrorMsg sets the "channel_error_msg" field.
func (_u *PayOrderExtensionUpdate) SetChannelErrorMsg(v string) *PayOrderExtensionUpdate {
_u.mutation.SetChannelErrorMsg(v)
return _u
}
// SetNillableChannelErrorMsg sets the "channel_error_msg" field if the given value is not nil.
func (_u *PayOrderExtensionUpdate) SetNillableChannelErrorMsg(v *string) *PayOrderExtensionUpdate {
if v != nil {
_u.SetChannelErrorMsg(*v)
}
return _u
}
// ClearChannelErrorMsg clears the value of the "channel_error_msg" field.
func (_u *PayOrderExtensionUpdate) ClearChannelErrorMsg() *PayOrderExtensionUpdate {
_u.mutation.ClearChannelErrorMsg()
return _u
}
// SetChannelNotifyData sets the "channel_notify_data" field.
func (_u *PayOrderExtensionUpdate) SetChannelNotifyData(v string) *PayOrderExtensionUpdate {
_u.mutation.SetChannelNotifyData(v)
return _u
}
// SetNillableChannelNotifyData sets the "channel_notify_data" field if the given value is not nil.
func (_u *PayOrderExtensionUpdate) SetNillableChannelNotifyData(v *string) *PayOrderExtensionUpdate {
if v != nil {
_u.SetChannelNotifyData(*v)
}
return _u
}
// ClearChannelNotifyData clears the value of the "channel_notify_data" field.
func (_u *PayOrderExtensionUpdate) ClearChannelNotifyData() *PayOrderExtensionUpdate {
_u.mutation.ClearChannelNotifyData()
return _u
}
// SetChannel sets the "channel" edge to the PayChannel entity.
func (_u *PayOrderExtensionUpdate) SetChannel(v *PayChannel) *PayOrderExtensionUpdate {
return _u.SetChannelID(v.ID)
}
// SetOrder sets the "order" edge to the PayOrder entity.
func (_u *PayOrderExtensionUpdate) SetOrder(v *PayOrder) *PayOrderExtensionUpdate {
return _u.SetOrderID(v.ID)
}
// Mutation returns the PayOrderExtensionMutation object of the builder.
func (_u *PayOrderExtensionUpdate) Mutation() *PayOrderExtensionMutation {
return _u.mutation
}
// ClearChannel clears the "channel" edge to the PayChannel entity.
func (_u *PayOrderExtensionUpdate) ClearChannel() *PayOrderExtensionUpdate {
_u.mutation.ClearChannel()
return _u
}
// ClearOrder clears the "order" edge to the PayOrder entity.
func (_u *PayOrderExtensionUpdate) ClearOrder() *PayOrderExtensionUpdate {
_u.mutation.ClearOrder()
return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *PayOrderExtensionUpdate) Save(ctx context.Context) (int, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *PayOrderExtensionUpdate) SaveX(ctx context.Context) int {
affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (_u *PayOrderExtensionUpdate) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *PayOrderExtensionUpdate) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *PayOrderExtensionUpdate) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := payorderextension.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *PayOrderExtensionUpdate) check() error {
if _u.mutation.ChannelCleared() && len(_u.mutation.ChannelIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "PayOrderExtension.channel"`)
}
if _u.mutation.OrderCleared() && len(_u.mutation.OrderIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "PayOrderExtension.order"`)
}
return nil
}
func (_u *PayOrderExtensionUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(payorderextension.Table, payorderextension.Columns, sqlgraph.NewFieldSpec(payorderextension.FieldID, field.TypeUint64))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(payorderextension.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(payorderextension.FieldStatus, field.TypeUint8, value)
}
if value, ok := _u.mutation.AddedStatus(); ok {
_spec.AddField(payorderextension.FieldStatus, field.TypeUint8, value)
}
if _u.mutation.StatusCleared() {
_spec.ClearField(payorderextension.FieldStatus, field.TypeUint8)
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(payorderextension.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(payorderextension.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.ChannelExtras(); ok {
_spec.SetField(payorderextension.FieldChannelExtras, field.TypeJSON, value)
}
if _u.mutation.ChannelExtrasCleared() {
_spec.ClearField(payorderextension.FieldChannelExtras, field.TypeJSON)
}
if value, ok := _u.mutation.ChannelErrorCode(); ok {
_spec.SetField(payorderextension.FieldChannelErrorCode, field.TypeString, value)
}
if _u.mutation.ChannelErrorCodeCleared() {
_spec.ClearField(payorderextension.FieldChannelErrorCode, field.TypeString)
}
if value, ok := _u.mutation.ChannelErrorMsg(); ok {
_spec.SetField(payorderextension.FieldChannelErrorMsg, field.TypeString, value)
}
if _u.mutation.ChannelErrorMsgCleared() {
_spec.ClearField(payorderextension.FieldChannelErrorMsg, field.TypeString)
}
if value, ok := _u.mutation.ChannelNotifyData(); ok {
_spec.SetField(payorderextension.FieldChannelNotifyData, field.TypeString, value)
}
if _u.mutation.ChannelNotifyDataCleared() {
_spec.ClearField(payorderextension.FieldChannelNotifyData, field.TypeString)
}
if _u.mutation.ChannelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.ChannelTable,
Columns: []string{payorderextension.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ChannelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.ChannelTable,
Columns: []string{payorderextension.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.OrderCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.OrderTable,
Columns: []string{payorderextension.OrderColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.OrderIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.OrderTable,
Columns: []string{payorderextension.OrderColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{payorderextension.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
_u.mutation.done = true
return _node, nil
}
// PayOrderExtensionUpdateOne is the builder for updating a single PayOrderExtension entity.
type PayOrderExtensionUpdateOne struct {
config
fields []string
hooks []Hook
mutation *PayOrderExtensionMutation
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *PayOrderExtensionUpdateOne) SetUpdatedAt(v time.Time) *PayOrderExtensionUpdateOne {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetStatus sets the "status" field.
func (_u *PayOrderExtensionUpdateOne) SetStatus(v uint8) *PayOrderExtensionUpdateOne {
_u.mutation.ResetStatus()
_u.mutation.SetStatus(v)
return _u
}
// SetNillableStatus sets the "status" field if the given value is not nil.
func (_u *PayOrderExtensionUpdateOne) SetNillableStatus(v *uint8) *PayOrderExtensionUpdateOne {
if v != nil {
_u.SetStatus(*v)
}
return _u
}
// AddStatus adds value to the "status" field.
func (_u *PayOrderExtensionUpdateOne) AddStatus(v int8) *PayOrderExtensionUpdateOne {
_u.mutation.AddStatus(v)
return _u
}
// ClearStatus clears the value of the "status" field.
func (_u *PayOrderExtensionUpdateOne) ClearStatus() *PayOrderExtensionUpdateOne {
_u.mutation.ClearStatus()
return _u
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *PayOrderExtensionUpdateOne) SetDeletedAt(v time.Time) *PayOrderExtensionUpdateOne {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *PayOrderExtensionUpdateOne) SetNillableDeletedAt(v *time.Time) *PayOrderExtensionUpdateOne {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *PayOrderExtensionUpdateOne) ClearDeletedAt() *PayOrderExtensionUpdateOne {
_u.mutation.ClearDeletedAt()
return _u
}
// SetOrderID sets the "order_id" field.
func (_u *PayOrderExtensionUpdateOne) SetOrderID(v uint64) *PayOrderExtensionUpdateOne {
_u.mutation.SetOrderID(v)
return _u
}
// SetNillableOrderID sets the "order_id" field if the given value is not nil.
func (_u *PayOrderExtensionUpdateOne) SetNillableOrderID(v *uint64) *PayOrderExtensionUpdateOne {
if v != nil {
_u.SetOrderID(*v)
}
return _u
}
// SetChannelID sets the "channel_id" field.
func (_u *PayOrderExtensionUpdateOne) SetChannelID(v uint64) *PayOrderExtensionUpdateOne {
_u.mutation.SetChannelID(v)
return _u
}
// SetNillableChannelID sets the "channel_id" field if the given value is not nil.
func (_u *PayOrderExtensionUpdateOne) SetNillableChannelID(v *uint64) *PayOrderExtensionUpdateOne {
if v != nil {
_u.SetChannelID(*v)
}
return _u
}
// SetChannelExtras sets the "channel_extras" field.
func (_u *PayOrderExtensionUpdateOne) SetChannelExtras(v map[string]interface{}) *PayOrderExtensionUpdateOne {
_u.mutation.SetChannelExtras(v)
return _u
}
// ClearChannelExtras clears the value of the "channel_extras" field.
func (_u *PayOrderExtensionUpdateOne) ClearChannelExtras() *PayOrderExtensionUpdateOne {
_u.mutation.ClearChannelExtras()
return _u
}
// SetChannelErrorCode sets the "channel_error_code" field.
func (_u *PayOrderExtensionUpdateOne) SetChannelErrorCode(v string) *PayOrderExtensionUpdateOne {
_u.mutation.SetChannelErrorCode(v)
return _u
}
// SetNillableChannelErrorCode sets the "channel_error_code" field if the given value is not nil.
func (_u *PayOrderExtensionUpdateOne) SetNillableChannelErrorCode(v *string) *PayOrderExtensionUpdateOne {
if v != nil {
_u.SetChannelErrorCode(*v)
}
return _u
}
// ClearChannelErrorCode clears the value of the "channel_error_code" field.
func (_u *PayOrderExtensionUpdateOne) ClearChannelErrorCode() *PayOrderExtensionUpdateOne {
_u.mutation.ClearChannelErrorCode()
return _u
}
// SetChannelErrorMsg sets the "channel_error_msg" field.
func (_u *PayOrderExtensionUpdateOne) SetChannelErrorMsg(v string) *PayOrderExtensionUpdateOne {
_u.mutation.SetChannelErrorMsg(v)
return _u
}
// SetNillableChannelErrorMsg sets the "channel_error_msg" field if the given value is not nil.
func (_u *PayOrderExtensionUpdateOne) SetNillableChannelErrorMsg(v *string) *PayOrderExtensionUpdateOne {
if v != nil {
_u.SetChannelErrorMsg(*v)
}
return _u
}
// ClearChannelErrorMsg clears the value of the "channel_error_msg" field.
func (_u *PayOrderExtensionUpdateOne) ClearChannelErrorMsg() *PayOrderExtensionUpdateOne {
_u.mutation.ClearChannelErrorMsg()
return _u
}
// SetChannelNotifyData sets the "channel_notify_data" field.
func (_u *PayOrderExtensionUpdateOne) SetChannelNotifyData(v string) *PayOrderExtensionUpdateOne {
_u.mutation.SetChannelNotifyData(v)
return _u
}
// SetNillableChannelNotifyData sets the "channel_notify_data" field if the given value is not nil.
func (_u *PayOrderExtensionUpdateOne) SetNillableChannelNotifyData(v *string) *PayOrderExtensionUpdateOne {
if v != nil {
_u.SetChannelNotifyData(*v)
}
return _u
}
// ClearChannelNotifyData clears the value of the "channel_notify_data" field.
func (_u *PayOrderExtensionUpdateOne) ClearChannelNotifyData() *PayOrderExtensionUpdateOne {
_u.mutation.ClearChannelNotifyData()
return _u
}
// SetChannel sets the "channel" edge to the PayChannel entity.
func (_u *PayOrderExtensionUpdateOne) SetChannel(v *PayChannel) *PayOrderExtensionUpdateOne {
return _u.SetChannelID(v.ID)
}
// SetOrder sets the "order" edge to the PayOrder entity.
func (_u *PayOrderExtensionUpdateOne) SetOrder(v *PayOrder) *PayOrderExtensionUpdateOne {
return _u.SetOrderID(v.ID)
}
// Mutation returns the PayOrderExtensionMutation object of the builder.
func (_u *PayOrderExtensionUpdateOne) Mutation() *PayOrderExtensionMutation {
return _u.mutation
}
// ClearChannel clears the "channel" edge to the PayChannel entity.
func (_u *PayOrderExtensionUpdateOne) ClearChannel() *PayOrderExtensionUpdateOne {
_u.mutation.ClearChannel()
return _u
}
// ClearOrder clears the "order" edge to the PayOrder entity.
func (_u *PayOrderExtensionUpdateOne) ClearOrder() *PayOrderExtensionUpdateOne {
_u.mutation.ClearOrder()
return _u
}
// Where appends a list predicates to the PayOrderExtensionUpdate builder.
func (_u *PayOrderExtensionUpdateOne) Where(ps ...predicate.PayOrderExtension) *PayOrderExtensionUpdateOne {
_u.mutation.Where(ps...)
return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (_u *PayOrderExtensionUpdateOne) Select(field string, fields ...string) *PayOrderExtensionUpdateOne {
_u.fields = append([]string{field}, fields...)
return _u
}
// Save executes the query and returns the updated PayOrderExtension entity.
func (_u *PayOrderExtensionUpdateOne) Save(ctx context.Context) (*PayOrderExtension, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *PayOrderExtensionUpdateOne) SaveX(ctx context.Context) *PayOrderExtension {
node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (_u *PayOrderExtensionUpdateOne) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *PayOrderExtensionUpdateOne) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *PayOrderExtensionUpdateOne) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := payorderextension.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *PayOrderExtensionUpdateOne) check() error {
if _u.mutation.ChannelCleared() && len(_u.mutation.ChannelIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "PayOrderExtension.channel"`)
}
if _u.mutation.OrderCleared() && len(_u.mutation.OrderIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "PayOrderExtension.order"`)
}
return nil
}
func (_u *PayOrderExtensionUpdateOne) sqlSave(ctx context.Context) (_node *PayOrderExtension, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(payorderextension.Table, payorderextension.Columns, sqlgraph.NewFieldSpec(payorderextension.FieldID, field.TypeUint64))
id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "PayOrderExtension.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, payorderextension.FieldID)
for _, f := range fields {
if !payorderextension.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != payorderextension.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(payorderextension.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(payorderextension.FieldStatus, field.TypeUint8, value)
}
if value, ok := _u.mutation.AddedStatus(); ok {
_spec.AddField(payorderextension.FieldStatus, field.TypeUint8, value)
}
if _u.mutation.StatusCleared() {
_spec.ClearField(payorderextension.FieldStatus, field.TypeUint8)
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(payorderextension.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(payorderextension.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.ChannelExtras(); ok {
_spec.SetField(payorderextension.FieldChannelExtras, field.TypeJSON, value)
}
if _u.mutation.ChannelExtrasCleared() {
_spec.ClearField(payorderextension.FieldChannelExtras, field.TypeJSON)
}
if value, ok := _u.mutation.ChannelErrorCode(); ok {
_spec.SetField(payorderextension.FieldChannelErrorCode, field.TypeString, value)
}
if _u.mutation.ChannelErrorCodeCleared() {
_spec.ClearField(payorderextension.FieldChannelErrorCode, field.TypeString)
}
if value, ok := _u.mutation.ChannelErrorMsg(); ok {
_spec.SetField(payorderextension.FieldChannelErrorMsg, field.TypeString, value)
}
if _u.mutation.ChannelErrorMsgCleared() {
_spec.ClearField(payorderextension.FieldChannelErrorMsg, field.TypeString)
}
if value, ok := _u.mutation.ChannelNotifyData(); ok {
_spec.SetField(payorderextension.FieldChannelNotifyData, field.TypeString, value)
}
if _u.mutation.ChannelNotifyDataCleared() {
_spec.ClearField(payorderextension.FieldChannelNotifyData, field.TypeString)
}
if _u.mutation.ChannelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.ChannelTable,
Columns: []string{payorderextension.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ChannelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.ChannelTable,
Columns: []string{payorderextension.ChannelColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(paychannel.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.OrderCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.OrderTable,
Columns: []string{payorderextension.OrderColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.OrderIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: false,
Table: payorderextension.OrderTable,
Columns: []string{payorderextension.OrderColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(payorder.FieldID, field.TypeUint64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_node = &PayOrderExtension{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{payorderextension.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
_u.mutation.done = true
return _node, nil
}

View File

@ -0,0 +1,28 @@
// Code generated by ent, DO NOT EDIT.
package predicate
import (
"entgo.io/ent/dialect/sql"
)
// App is the predicate function for app builders.
type App func(*sql.Selector)
// PayChannel is the predicate function for paychannel builders.
type PayChannel func(*sql.Selector)
// PayNotifyLog is the predicate function for paynotifylog builders.
type PayNotifyLog func(*sql.Selector)
// PayNotifyTask is the predicate function for paynotifytask builders.
type PayNotifyTask func(*sql.Selector)
// PayOrder is the predicate function for payorder builders.
type PayOrder func(*sql.Selector)
// PayOrderExtension is the predicate function for payorderextension builders.
type PayOrderExtension func(*sql.Selector)
// PayRefund is the predicate function for payrefund builders.
type PayRefund func(*sql.Selector)

266
rpc/ent/runtime.go Normal file
View File

@ -0,0 +1,266 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"mingyang-admin-pay/rpc/ent/app"
"mingyang-admin-pay/rpc/ent/paychannel"
"mingyang-admin-pay/rpc/ent/paynotifylog"
"mingyang-admin-pay/rpc/ent/paynotifytask"
"mingyang-admin-pay/rpc/ent/payorder"
"mingyang-admin-pay/rpc/ent/payorderextension"
"mingyang-admin-pay/rpc/ent/payrefund"
"mingyang-admin-pay/rpc/ent/schema"
"time"
)
// The init function reads all schema descriptors with runtime code
// (default values, validators, hooks and policies) and stitches it
// to their package variables.
func init() {
appMixin := schema.App{}.Mixin()
appMixinFields0 := appMixin[0].Fields()
_ = appMixinFields0
appMixinFields1 := appMixin[1].Fields()
_ = appMixinFields1
appMixinFields2 := appMixin[2].Fields()
_ = appMixinFields2
appFields := schema.App{}.Fields()
_ = appFields
// appDescCreatedAt is the schema descriptor for created_at field.
appDescCreatedAt := appMixinFields0[1].Descriptor()
// app.DefaultCreatedAt holds the default value on creation for the created_at field.
app.DefaultCreatedAt = appDescCreatedAt.Default.(func() time.Time)
// appDescUpdatedAt is the schema descriptor for updated_at field.
appDescUpdatedAt := appMixinFields0[2].Descriptor()
// app.DefaultUpdatedAt holds the default value on creation for the updated_at field.
app.DefaultUpdatedAt = appDescUpdatedAt.Default.(func() time.Time)
// app.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
app.UpdateDefaultUpdatedAt = appDescUpdatedAt.UpdateDefault.(func() time.Time)
// appDescStatus is the schema descriptor for status field.
appDescStatus := appMixinFields1[0].Descriptor()
// app.DefaultStatus holds the default value on creation for the status field.
app.DefaultStatus = appDescStatus.Default.(uint8)
// appDescTenantID is the schema descriptor for tenant_id field.
appDescTenantID := appMixinFields2[0].Descriptor()
// app.DefaultTenantID holds the default value on creation for the tenant_id field.
app.DefaultTenantID = appDescTenantID.Default.(uint64)
paychannelMixin := schema.PayChannel{}.Mixin()
paychannelMixinFields0 := paychannelMixin[0].Fields()
_ = paychannelMixinFields0
paychannelMixinFields1 := paychannelMixin[1].Fields()
_ = paychannelMixinFields1
paychannelMixinFields2 := paychannelMixin[2].Fields()
_ = paychannelMixinFields2
paychannelFields := schema.PayChannel{}.Fields()
_ = paychannelFields
// paychannelDescCreatedAt is the schema descriptor for created_at field.
paychannelDescCreatedAt := paychannelMixinFields0[1].Descriptor()
// paychannel.DefaultCreatedAt holds the default value on creation for the created_at field.
paychannel.DefaultCreatedAt = paychannelDescCreatedAt.Default.(func() time.Time)
// paychannelDescUpdatedAt is the schema descriptor for updated_at field.
paychannelDescUpdatedAt := paychannelMixinFields0[2].Descriptor()
// paychannel.DefaultUpdatedAt holds the default value on creation for the updated_at field.
paychannel.DefaultUpdatedAt = paychannelDescUpdatedAt.Default.(func() time.Time)
// paychannel.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
paychannel.UpdateDefaultUpdatedAt = paychannelDescUpdatedAt.UpdateDefault.(func() time.Time)
// paychannelDescStatus is the schema descriptor for status field.
paychannelDescStatus := paychannelMixinFields1[0].Descriptor()
// paychannel.DefaultStatus holds the default value on creation for the status field.
paychannel.DefaultStatus = paychannelDescStatus.Default.(uint8)
// paychannelDescTenantID is the schema descriptor for tenant_id field.
paychannelDescTenantID := paychannelMixinFields2[0].Descriptor()
// paychannel.DefaultTenantID holds the default value on creation for the tenant_id field.
paychannel.DefaultTenantID = paychannelDescTenantID.Default.(uint64)
// paychannelDescFreeRate is the schema descriptor for free_rate field.
paychannelDescFreeRate := paychannelFields[3].Descriptor()
// paychannel.DefaultFreeRate holds the default value on creation for the free_rate field.
paychannel.DefaultFreeRate = paychannelDescFreeRate.Default.(string)
// paychannelDescOrderTimeOut is the schema descriptor for order_time_out field.
paychannelDescOrderTimeOut := paychannelFields[8].Descriptor()
// paychannel.DefaultOrderTimeOut holds the default value on creation for the order_time_out field.
paychannel.DefaultOrderTimeOut = paychannelDescOrderTimeOut.Default.(string)
// paychannelDescSupportCurrency is the schema descriptor for support_currency field.
paychannelDescSupportCurrency := paychannelFields[9].Descriptor()
// paychannel.DefaultSupportCurrency holds the default value on creation for the support_currency field.
paychannel.DefaultSupportCurrency = paychannelDescSupportCurrency.Default.(string)
paynotifylogMixin := schema.PayNotifyLog{}.Mixin()
paynotifylogMixinFields0 := paynotifylogMixin[0].Fields()
_ = paynotifylogMixinFields0
paynotifylogMixinFields1 := paynotifylogMixin[1].Fields()
_ = paynotifylogMixinFields1
paynotifylogMixinFields2 := paynotifylogMixin[2].Fields()
_ = paynotifylogMixinFields2
paynotifylogFields := schema.PayNotifyLog{}.Fields()
_ = paynotifylogFields
// paynotifylogDescCreatedAt is the schema descriptor for created_at field.
paynotifylogDescCreatedAt := paynotifylogMixinFields0[1].Descriptor()
// paynotifylog.DefaultCreatedAt holds the default value on creation for the created_at field.
paynotifylog.DefaultCreatedAt = paynotifylogDescCreatedAt.Default.(func() time.Time)
// paynotifylogDescUpdatedAt is the schema descriptor for updated_at field.
paynotifylogDescUpdatedAt := paynotifylogMixinFields0[2].Descriptor()
// paynotifylog.DefaultUpdatedAt holds the default value on creation for the updated_at field.
paynotifylog.DefaultUpdatedAt = paynotifylogDescUpdatedAt.Default.(func() time.Time)
// paynotifylog.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
paynotifylog.UpdateDefaultUpdatedAt = paynotifylogDescUpdatedAt.UpdateDefault.(func() time.Time)
// paynotifylogDescStatus is the schema descriptor for status field.
paynotifylogDescStatus := paynotifylogMixinFields1[0].Descriptor()
// paynotifylog.DefaultStatus holds the default value on creation for the status field.
paynotifylog.DefaultStatus = paynotifylogDescStatus.Default.(uint8)
// paynotifylogDescTenantID is the schema descriptor for tenant_id field.
paynotifylogDescTenantID := paynotifylogMixinFields2[0].Descriptor()
// paynotifylog.DefaultTenantID holds the default value on creation for the tenant_id field.
paynotifylog.DefaultTenantID = paynotifylogDescTenantID.Default.(uint64)
// paynotifylogDescNotifyCount is the schema descriptor for notify_count field.
paynotifylogDescNotifyCount := paynotifylogFields[1].Descriptor()
// paynotifylog.DefaultNotifyCount holds the default value on creation for the notify_count field.
paynotifylog.DefaultNotifyCount = paynotifylogDescNotifyCount.Default.(uint32)
paynotifytaskMixin := schema.PayNotifyTask{}.Mixin()
paynotifytaskMixinFields0 := paynotifytaskMixin[0].Fields()
_ = paynotifytaskMixinFields0
paynotifytaskMixinFields1 := paynotifytaskMixin[1].Fields()
_ = paynotifytaskMixinFields1
paynotifytaskMixinFields2 := paynotifytaskMixin[2].Fields()
_ = paynotifytaskMixinFields2
paynotifytaskFields := schema.PayNotifyTask{}.Fields()
_ = paynotifytaskFields
// paynotifytaskDescCreatedAt is the schema descriptor for created_at field.
paynotifytaskDescCreatedAt := paynotifytaskMixinFields0[1].Descriptor()
// paynotifytask.DefaultCreatedAt holds the default value on creation for the created_at field.
paynotifytask.DefaultCreatedAt = paynotifytaskDescCreatedAt.Default.(func() time.Time)
// paynotifytaskDescUpdatedAt is the schema descriptor for updated_at field.
paynotifytaskDescUpdatedAt := paynotifytaskMixinFields0[2].Descriptor()
// paynotifytask.DefaultUpdatedAt holds the default value on creation for the updated_at field.
paynotifytask.DefaultUpdatedAt = paynotifytaskDescUpdatedAt.Default.(func() time.Time)
// paynotifytask.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
paynotifytask.UpdateDefaultUpdatedAt = paynotifytaskDescUpdatedAt.UpdateDefault.(func() time.Time)
// paynotifytaskDescStatus is the schema descriptor for status field.
paynotifytaskDescStatus := paynotifytaskMixinFields1[0].Descriptor()
// paynotifytask.DefaultStatus holds the default value on creation for the status field.
paynotifytask.DefaultStatus = paynotifytaskDescStatus.Default.(uint8)
// paynotifytaskDescTenantID is the schema descriptor for tenant_id field.
paynotifytaskDescTenantID := paynotifytaskMixinFields2[0].Descriptor()
// paynotifytask.DefaultTenantID holds the default value on creation for the tenant_id field.
paynotifytask.DefaultTenantID = paynotifytaskDescTenantID.Default.(uint64)
// paynotifytaskDescType is the schema descriptor for type field.
paynotifytaskDescType := paynotifytaskFields[0].Descriptor()
// paynotifytask.DefaultType holds the default value on creation for the type field.
paynotifytask.DefaultType = paynotifytaskDescType.Default.(uint8)
payorderMixin := schema.PayOrder{}.Mixin()
payorderMixinFields0 := payorderMixin[0].Fields()
_ = payorderMixinFields0
payorderMixinFields1 := payorderMixin[1].Fields()
_ = payorderMixinFields1
payorderMixinFields2 := payorderMixin[2].Fields()
_ = payorderMixinFields2
payorderFields := schema.PayOrder{}.Fields()
_ = payorderFields
// payorderDescCreatedAt is the schema descriptor for created_at field.
payorderDescCreatedAt := payorderMixinFields0[1].Descriptor()
// payorder.DefaultCreatedAt holds the default value on creation for the created_at field.
payorder.DefaultCreatedAt = payorderDescCreatedAt.Default.(func() time.Time)
// payorderDescUpdatedAt is the schema descriptor for updated_at field.
payorderDescUpdatedAt := payorderMixinFields0[2].Descriptor()
// payorder.DefaultUpdatedAt holds the default value on creation for the updated_at field.
payorder.DefaultUpdatedAt = payorderDescUpdatedAt.Default.(func() time.Time)
// payorder.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
payorder.UpdateDefaultUpdatedAt = payorderDescUpdatedAt.UpdateDefault.(func() time.Time)
// payorderDescStatus is the schema descriptor for status field.
payorderDescStatus := payorderMixinFields1[0].Descriptor()
// payorder.DefaultStatus holds the default value on creation for the status field.
payorder.DefaultStatus = payorderDescStatus.Default.(uint8)
// payorderDescTenantID is the schema descriptor for tenant_id field.
payorderDescTenantID := payorderMixinFields2[0].Descriptor()
// payorder.DefaultTenantID holds the default value on creation for the tenant_id field.
payorder.DefaultTenantID = payorderDescTenantID.Default.(uint64)
// payorderDescAmount is the schema descriptor for amount field.
payorderDescAmount := payorderFields[5].Descriptor()
// payorder.DefaultAmount holds the default value on creation for the amount field.
payorder.DefaultAmount = payorderDescAmount.Default.(uint64)
// payorderDescChannelFeeRate is the schema descriptor for channel_fee_rate field.
payorderDescChannelFeeRate := payorderFields[7].Descriptor()
// payorder.DefaultChannelFeeRate holds the default value on creation for the channel_fee_rate field.
payorder.DefaultChannelFeeRate = payorderDescChannelFeeRate.Default.(string)
// payorderDescChannelFee is the schema descriptor for channel_fee field.
payorderDescChannelFee := payorderFields[8].Descriptor()
// payorder.DefaultChannelFee holds the default value on creation for the channel_fee field.
payorder.DefaultChannelFee = payorderDescChannelFee.Default.(uint64)
// payorderDescOrderStatus is the schema descriptor for order_status field.
payorderDescOrderStatus := payorderFields[9].Descriptor()
// payorder.DefaultOrderStatus holds the default value on creation for the order_status field.
payorder.DefaultOrderStatus = payorderDescOrderStatus.Default.(string)
// payorderDescCurrency is the schema descriptor for currency field.
payorderDescCurrency := payorderFields[16].Descriptor()
// payorder.DefaultCurrency holds the default value on creation for the currency field.
payorder.DefaultCurrency = payorderDescCurrency.Default.(string)
// payorderDescRefundPrice is the schema descriptor for refund_price field.
payorderDescRefundPrice := payorderFields[17].Descriptor()
// payorder.DefaultRefundPrice holds the default value on creation for the refund_price field.
payorder.DefaultRefundPrice = payorderDescRefundPrice.Default.(uint64)
payorderextensionMixin := schema.PayOrderExtension{}.Mixin()
payorderextensionMixinFields0 := payorderextensionMixin[0].Fields()
_ = payorderextensionMixinFields0
payorderextensionMixinFields1 := payorderextensionMixin[1].Fields()
_ = payorderextensionMixinFields1
payorderextensionMixinFields2 := payorderextensionMixin[2].Fields()
_ = payorderextensionMixinFields2
payorderextensionFields := schema.PayOrderExtension{}.Fields()
_ = payorderextensionFields
// payorderextensionDescCreatedAt is the schema descriptor for created_at field.
payorderextensionDescCreatedAt := payorderextensionMixinFields0[1].Descriptor()
// payorderextension.DefaultCreatedAt holds the default value on creation for the created_at field.
payorderextension.DefaultCreatedAt = payorderextensionDescCreatedAt.Default.(func() time.Time)
// payorderextensionDescUpdatedAt is the schema descriptor for updated_at field.
payorderextensionDescUpdatedAt := payorderextensionMixinFields0[2].Descriptor()
// payorderextension.DefaultUpdatedAt holds the default value on creation for the updated_at field.
payorderextension.DefaultUpdatedAt = payorderextensionDescUpdatedAt.Default.(func() time.Time)
// payorderextension.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
payorderextension.UpdateDefaultUpdatedAt = payorderextensionDescUpdatedAt.UpdateDefault.(func() time.Time)
// payorderextensionDescStatus is the schema descriptor for status field.
payorderextensionDescStatus := payorderextensionMixinFields1[0].Descriptor()
// payorderextension.DefaultStatus holds the default value on creation for the status field.
payorderextension.DefaultStatus = payorderextensionDescStatus.Default.(uint8)
// payorderextensionDescTenantID is the schema descriptor for tenant_id field.
payorderextensionDescTenantID := payorderextensionMixinFields2[0].Descriptor()
// payorderextension.DefaultTenantID holds the default value on creation for the tenant_id field.
payorderextension.DefaultTenantID = payorderextensionDescTenantID.Default.(uint64)
payrefundMixin := schema.PayRefund{}.Mixin()
payrefundMixinFields0 := payrefundMixin[0].Fields()
_ = payrefundMixinFields0
payrefundMixinFields1 := payrefundMixin[1].Fields()
_ = payrefundMixinFields1
payrefundMixinFields2 := payrefundMixin[2].Fields()
_ = payrefundMixinFields2
payrefundFields := schema.PayRefund{}.Fields()
_ = payrefundFields
// payrefundDescCreatedAt is the schema descriptor for created_at field.
payrefundDescCreatedAt := payrefundMixinFields0[1].Descriptor()
// payrefund.DefaultCreatedAt holds the default value on creation for the created_at field.
payrefund.DefaultCreatedAt = payrefundDescCreatedAt.Default.(func() time.Time)
// payrefundDescUpdatedAt is the schema descriptor for updated_at field.
payrefundDescUpdatedAt := payrefundMixinFields0[2].Descriptor()
// payrefund.DefaultUpdatedAt holds the default value on creation for the updated_at field.
payrefund.DefaultUpdatedAt = payrefundDescUpdatedAt.Default.(func() time.Time)
// payrefund.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
payrefund.UpdateDefaultUpdatedAt = payrefundDescUpdatedAt.UpdateDefault.(func() time.Time)
// payrefundDescStatus is the schema descriptor for status field.
payrefundDescStatus := payrefundMixinFields1[0].Descriptor()
// payrefund.DefaultStatus holds the default value on creation for the status field.
payrefund.DefaultStatus = payrefundDescStatus.Default.(uint8)
// payrefundDescTenantID is the schema descriptor for tenant_id field.
payrefundDescTenantID := payrefundMixinFields2[0].Descriptor()
// payrefund.DefaultTenantID holds the default value on creation for the tenant_id field.
payrefund.DefaultTenantID = payrefundDescTenantID.Default.(uint64)
// payrefundDescRefundStatus is the schema descriptor for refund_status field.
payrefundDescRefundStatus := payrefundFields[4].Descriptor()
// payrefund.DefaultRefundStatus holds the default value on creation for the refund_status field.
payrefund.DefaultRefundStatus = payrefundDescRefundStatus.Default.(uint8)
// payrefundDescRefundAmount is the schema descriptor for refund_amount field.
payrefundDescRefundAmount := payrefundFields[5].Descriptor()
// payrefund.DefaultRefundAmount holds the default value on creation for the refund_amount field.
payrefund.DefaultRefundAmount = payrefundDescRefundAmount.Default.(uint64)
// payrefundDescPayAmount is the schema descriptor for pay_amount field.
payrefundDescPayAmount := payrefundFields[6].Descriptor()
// payrefund.DefaultPayAmount holds the default value on creation for the pay_amount field.
payrefund.DefaultPayAmount = payrefundDescPayAmount.Default.(uint64)
}

View File

@ -0,0 +1,10 @@
// Code generated by ent, DO NOT EDIT.
package runtime
// The schema-stitching logic is generated in mingyang-admin-pay/rpc/ent/runtime.go
const (
Version = "v0.14.5" // Version of ent codegen.
Sum = "h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=" // Sum of ent codegen.
)

View File

@ -1,11 +1,51 @@
package schema
import "entgo.io/ent"
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/saas-mingyang/mingyang-admin-common/orm/ent/mixins"
mixins2 "mingyang-admin-pay/rpc/ent/schema/mixins"
)
type App struct {
ent.Schema
}
// Fields of the App.
func (App) Fields() []ent.Field {
return []ent.Field{}
return []ent.Field{
field.String("app_key").Comment("appKey 应用标识"),
field.String("app_name").Comment("应用名称"),
field.String("order_notify_url").Optional().Comment("支付成功回调地址"),
field.String("refund_notify_url").Optional().Comment("退款成功回调地址"),
}
}
func (App) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.TenantMixin{},
mixins2.SoftDeleteMixin{},
}
}
func (App) Edges() []ent.Edge {
return []ent.Edge{
edge.From("channel", PayChannel.Type).
Ref("app"),
edge.From("notify_task", PayNotifyTask.Type).
Ref("app"),
}
}
func (App) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("PayApp Table | 支付应用表"),
entsql.Annotation{Table: "pay_app"},
}
}

View File

@ -0,0 +1,71 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
"github.com/saas-mingyang/mingyang-admin-common/orm/ent/mixins"
mixins2 "mingyang-admin-pay/rpc/ent/schema/mixins"
)
type PayChannel struct {
ent.Schema
}
// Fields of the PayChannel.
func (PayChannel) Fields() []ent.Field {
return []ent.Field{
field.String("code").Comment("Pay channel code | 支付渠道编码"),
field.String("name_en").Comment("Pay channel name | 支付渠道英文名称"),
field.String("name_zh").Comment("Pay channel name | 支付渠道中文名称"),
field.String("free_rate").Comment("Free rate | 手续费比例").Default("0"),
field.Uint64("app_id").Comment("App ID | 应用ID"),
field.JSON("config", map[string]interface{}{}).Comment("Config | 配置信息"),
field.String("remake").Optional().Comment("Remark | 备注"),
field.Uint64("icon").Optional().Comment("Icon | 图标"),
field.String("order_time_out").Comment("Order time out | 订单超时时间").Default("10m"),
field.String("support_currency").Comment("Support currency | 支持币种").Default("CNY,USD"),
}
}
func (PayChannel) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.TenantMixin{},
mixins2.SoftDeleteMixin{},
}
}
func (PayChannel) Indexes() []ent.Index {
return []ent.Index{
index.Fields("app_id", "code").Unique(),
}
}
func (PayChannel) Edges() []ent.Edge {
return []ent.Edge{
// 使用 edge.From 而不是 edge.To
edge.From("orders", PayOrder.Type).
Ref("channel"),
edge.From("orders_extension", PayOrderExtension.Type).
Ref("channel"),
edge.From("refund", PayRefund.Type).
Ref("channel"),
edge.To("app", App.Type).
Field("app_id").
Unique().
Required(),
}
}
func (PayChannel) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("PayChannel Table | 支付渠道表"),
entsql.Annotation{Table: "pay_channel"},
}
}

View File

@ -0,0 +1,58 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
"github.com/saas-mingyang/mingyang-admin-common/orm/ent/mixins"
mixins2 "mingyang-admin-pay/rpc/ent/schema/mixins"
)
type PayNotifyLog struct {
ent.Schema
}
// Fields of the PayNotifyLog.
func (PayNotifyLog) Fields() []ent.Field {
return []ent.Field{
field.Uint64("task_id").Comment("任务ID | 任务ID"),
field.Uint32("notify_count").Comment("通知次数 | 通知次数").Default(0),
field.String("response").Optional().Comment("响应内容 | 响应内容"),
field.String("notify_status").Optional().Comment("通知状态 | 通知状态"),
}
}
func (PayNotifyLog) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.TenantMixin{},
mixins2.SoftDeleteMixin{},
}
}
func (PayNotifyLog) Edges() []ent.Edge {
return []ent.Edge{
edge.To("task", PayNotifyTask.Type).
Field("task_id").
Unique().
Required(),
}
}
func (PayNotifyLog) Indexes() []ent.Index {
return []ent.Index{
index.Fields("task_id"),
}
}
func (PayNotifyLog) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("PayNotifyLog Table | 异步通知日志表"),
entsql.Annotation{Table: "pay_notify_log"},
}
}

View File

@ -0,0 +1,71 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
"github.com/saas-mingyang/mingyang-admin-common/orm/ent/mixins"
mixins2 "mingyang-admin-pay/rpc/ent/schema/mixins"
)
type PayNotifyTask struct {
ent.Schema
}
// Fields of the PayNotifyTask.
func (PayNotifyTask) Fields() []ent.Field {
return []ent.Field{
field.Uint8("type").Comment("通知类型").Default(1),
field.Uint64("data_id").Comment("数据 ID"),
field.Uint64("order_id").Comment("订单 ID"),
field.Uint64("app_id").Comment("应用 ID"),
field.Uint8("notify_status").Comment("通知状态"),
field.Time("next_notify_time").Optional().Comment("下次通知时间"),
field.Time("last_execute_time").Optional().Comment("最后一次执行时间"),
field.Uint32("retry_count").Optional().Comment("重试次数"),
field.Uint32("max_retry_count").Optional().Comment("最大重试次数"),
field.String("notify_url").Optional().Comment("通知地址"),
}
}
func (PayNotifyTask) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.TenantMixin{},
mixins2.SoftDeleteMixin{},
}
}
func (PayNotifyTask) Edges() []ent.Edge {
return []ent.Edge{
edge.To("app", App.Type).
Field("app_id").
Unique().
Required(),
edge.To("order", PayOrder.Type).
Field("order_id").
Unique().
Required(),
edge.From("notify_log", PayNotifyLog.Type).
Ref("task"),
}
}
func (PayNotifyTask) Indexes() []ent.Index {
return []ent.Index{
index.Fields("order_id"),
index.Fields("data_id"),
}
}
func (PayNotifyTask) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("PayNotifyTask Table | 异步通知任务表"),
entsql.Annotation{Table: "pay_notify_task"},
}
}

View File

@ -0,0 +1,86 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
"github.com/saas-mingyang/mingyang-admin-common/orm/ent/mixins"
mixins2 "mingyang-admin-pay/rpc/ent/schema/mixins"
)
type PayOrder struct {
ent.Schema
}
// Fields of the PayOrder.
func (PayOrder) Fields() []ent.Field {
return []ent.Field{
field.Uint64("channel_id").Comment("支付渠道 ID"),
field.Uint64("user_id").Comment("用户 ID"),
field.String("subject").Comment("商品标题"),
field.String("body").Comment("商品描述"),
field.String("notify_url").Comment("异步通知地址"),
field.Uint64("amount").Comment("金额,单位为分").Default(0),
field.String("pay_source").Comment("支付来源").Optional(),
field.String("channel_fee_rate").Comment("本次渠道费率,百分比").Default("0.00"),
field.Uint64("channel_fee").Comment("本次渠道实际收取费y").Default(0),
field.String("order_status").Comment("订单状态").Default("WAIT"),
field.String("user_ip").Comment("用户 IP").Optional(),
field.Time("expire_time").Comment("订单过期时间"),
field.String("pay_no").Comment("支付单号"),
field.Time("success_time").Comment("订单支付成功时间"),
field.Uint64("extension_id").Comment("支付成功的订单拓展单ID").Optional(),
field.String("transaction_id").Comment("交易流水号,有一些平台可能会有").Optional(),
field.String("currency").Comment("货币代码").Default("USD"),
field.Uint64("refund_price").Comment("退款金额,单位为分").Default(0),
field.String("channel_order_no").Comment("渠道订单号").Optional(),
field.String("channel_user_id").Comment("渠道用户 ID").Optional(),
}
}
func (PayOrder) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.TenantMixin{},
mixins2.SoftDeleteMixin{},
}
}
func (PayOrder) Edges() []ent.Edge {
return []ent.Edge{
edge.To("channel", PayChannel.Type).
Field("channel_id").
Unique().
Required(),
edge.From("orders_extension", PayOrderExtension.Type).
Ref("order"),
edge.From("notify_task", PayNotifyTask.Type).
Ref("order"),
edge.From("refund", PayRefund.Type).
Ref("order"),
}
}
func (PayOrder) Indexes() []ent.Index {
return []ent.Index{
index.Fields("extension_id"),
index.Fields("channel_order_no").Unique(),
index.Fields("pay_no").Unique(),
index.Fields("transaction_id"),
index.Fields("user_id"),
index.Fields("channel_id"),
index.Fields("order_status"),
}
}
func (PayOrder) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("PayOrder Table | 支付订单表"),
entsql.Annotation{Table: "pay_order"},
}
}

View File

@ -0,0 +1,67 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
"github.com/saas-mingyang/mingyang-admin-common/orm/ent/mixins"
mixins2 "mingyang-admin-pay/rpc/ent/schema/mixins"
)
type PayOrderExtension struct {
ent.Schema
}
// Fields of the PayOrder.
func (PayOrderExtension) Fields() []ent.Field {
return []ent.Field{
field.Uint64("order_id").
Comment("Order ID | 订单ID"),
field.Uint64("channel_id").Comment("Channel ID | 渠道ID"),
field.JSON("channel_extras", map[string]interface{}{}).
Optional().Comment("Channel Extras | 渠道参数"),
field.String("channel_error_code").Optional().Comment("Channel Error Code | 渠道错误码"),
field.String("channel_error_msg").Optional().Comment("Channel Error Msg | 渠道错误信息"),
field.String("channel_notify_data").Optional().Comment("Channel Notify Data | 渠道回调数据"),
}
}
func (PayOrderExtension) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.TenantMixin{},
mixins2.SoftDeleteMixin{},
}
}
func (PayOrderExtension) Edges() []ent.Edge {
return []ent.Edge{
edge.To("channel", PayChannel.Type).
Field("channel_id").
Unique().
Required(),
edge.To("order", PayOrder.Type).
Field("order_id").
Unique().
Required(),
}
}
func (PayOrderExtension) Indexes() []ent.Index {
return []ent.Index{
index.Fields("order_id"),
index.Fields("channel_id"),
}
}
func (PayOrderExtension) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("PayOrderExtension Table | 支付订单拓展表"),
entsql.Annotation{Table: "pay_order_extension"},
}
}

View File

@ -0,0 +1,78 @@
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
"github.com/saas-mingyang/mingyang-admin-common/orm/ent/mixins"
mixins2 "mingyang-admin-pay/rpc/ent/schema/mixins"
)
type PayRefund struct {
ent.Schema
}
// Fields of the PayOrder.
func (PayRefund) Fields() []ent.Field {
return []ent.Field{
field.Uint64("channel_id").Comment("支付渠道 ID"),
field.Uint64("user_id").Comment("用户 ID"),
field.Uint64("order_id").Comment("订单 ID"),
field.String("notify_url").Comment("回调地址").Optional(),
field.Uint8("refund_status").Comment("退款状态").Default(0),
field.Uint64("refund_amount").Comment("退款金额").Default(0),
field.Uint64("pay_amount").Comment("支付金额").Default(0),
field.String("refund_no").Comment("退款单号"),
field.String("refund_reason").Comment("退款原因"),
field.String("user_ip").Optional().Comment("用户 IP"),
field.String("channel_refund_no").Comment("渠道退款单号"),
field.Time("refund_time").Comment("退款成功时间"),
field.String("channel_error_code").Comment("渠道错误码").Optional(),
field.String("channel_error_msg").Comment("渠道错误信息").Optional(),
field.String("channel_notify_data").Comment("渠道回调数据").Optional(),
}
}
func (PayRefund) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.TenantMixin{},
mixins2.SoftDeleteMixin{},
}
}
func (PayRefund) Edges() []ent.Edge {
return []ent.Edge{
edge.To("order", PayOrder.Type).
Field("order_id").
Unique().
Required(),
edge.To("channel", PayChannel.Type).
Field("channel_id").
Unique().
Required(),
}
}
func (PayRefund) Indexes() []ent.Index {
return []ent.Index{
index.Fields("user_id"),
index.Fields("order_id"),
index.Fields("channel_id"),
index.Fields("refund_status"),
index.Fields("refund_no"),
index.Fields("channel_refund_no"),
}
}
func (PayRefund) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("PayRefund Table | 退款订单表"),
entsql.Annotation{Table: "pay_refund"},
}
}

2165
rpc/ent/set_not_nil.go Normal file

File diff suppressed because it is too large Load Diff

254
rpc/ent/tx.go Normal file
View File

@ -0,0 +1,254 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
stdsql "database/sql"
"fmt"
"sync"
"entgo.io/ent/dialect"
)
// Tx is a transactional client that is created by calling Client.Tx().
type Tx struct {
config
// App is the client for interacting with the App builders.
App *AppClient
// PayChannel is the client for interacting with the PayChannel builders.
PayChannel *PayChannelClient
// PayNotifyLog is the client for interacting with the PayNotifyLog builders.
PayNotifyLog *PayNotifyLogClient
// PayNotifyTask is the client for interacting with the PayNotifyTask builders.
PayNotifyTask *PayNotifyTaskClient
// PayOrder is the client for interacting with the PayOrder builders.
PayOrder *PayOrderClient
// PayOrderExtension is the client for interacting with the PayOrderExtension builders.
PayOrderExtension *PayOrderExtensionClient
// PayRefund is the client for interacting with the PayRefund builders.
PayRefund *PayRefundClient
// lazily loaded.
client *Client
clientOnce sync.Once
// ctx lives for the life of the transaction. It is
// the same context used by the underlying connection.
ctx context.Context
}
type (
// Committer is the interface that wraps the Commit method.
Committer interface {
Commit(context.Context, *Tx) error
}
// The CommitFunc type is an adapter to allow the use of ordinary
// function as a Committer. If f is a function with the appropriate
// signature, CommitFunc(f) is a Committer that calls f.
CommitFunc func(context.Context, *Tx) error
// CommitHook defines the "commit middleware". A function that gets a Committer
// and returns a Committer. For example:
//
// hook := func(next ent.Committer) ent.Committer {
// return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
// // Do some stuff before.
// if err := next.Commit(ctx, tx); err != nil {
// return err
// }
// // Do some stuff after.
// return nil
// })
// }
//
CommitHook func(Committer) Committer
)
// Commit calls f(ctx, m).
func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error {
return f(ctx, tx)
}
// Commit commits the transaction.
func (tx *Tx) Commit() error {
txDriver := tx.config.driver.(*txDriver)
var fn Committer = CommitFunc(func(context.Context, *Tx) error {
return txDriver.tx.Commit()
})
txDriver.mu.Lock()
hooks := append([]CommitHook(nil), txDriver.onCommit...)
txDriver.mu.Unlock()
for i := len(hooks) - 1; i >= 0; i-- {
fn = hooks[i](fn)
}
return fn.Commit(tx.ctx, tx)
}
// OnCommit adds a hook to call on commit.
func (tx *Tx) OnCommit(f CommitHook) {
txDriver := tx.config.driver.(*txDriver)
txDriver.mu.Lock()
txDriver.onCommit = append(txDriver.onCommit, f)
txDriver.mu.Unlock()
}
type (
// Rollbacker is the interface that wraps the Rollback method.
Rollbacker interface {
Rollback(context.Context, *Tx) error
}
// The RollbackFunc type is an adapter to allow the use of ordinary
// function as a Rollbacker. If f is a function with the appropriate
// signature, RollbackFunc(f) is a Rollbacker that calls f.
RollbackFunc func(context.Context, *Tx) error
// RollbackHook defines the "rollback middleware". A function that gets a Rollbacker
// and returns a Rollbacker. For example:
//
// hook := func(next ent.Rollbacker) ent.Rollbacker {
// return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
// // Do some stuff before.
// if err := next.Rollback(ctx, tx); err != nil {
// return err
// }
// // Do some stuff after.
// return nil
// })
// }
//
RollbackHook func(Rollbacker) Rollbacker
)
// Rollback calls f(ctx, m).
func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error {
return f(ctx, tx)
}
// Rollback rollbacks the transaction.
func (tx *Tx) Rollback() error {
txDriver := tx.config.driver.(*txDriver)
var fn Rollbacker = RollbackFunc(func(context.Context, *Tx) error {
return txDriver.tx.Rollback()
})
txDriver.mu.Lock()
hooks := append([]RollbackHook(nil), txDriver.onRollback...)
txDriver.mu.Unlock()
for i := len(hooks) - 1; i >= 0; i-- {
fn = hooks[i](fn)
}
return fn.Rollback(tx.ctx, tx)
}
// OnRollback adds a hook to call on rollback.
func (tx *Tx) OnRollback(f RollbackHook) {
txDriver := tx.config.driver.(*txDriver)
txDriver.mu.Lock()
txDriver.onRollback = append(txDriver.onRollback, f)
txDriver.mu.Unlock()
}
// Client returns a Client that binds to current transaction.
func (tx *Tx) Client() *Client {
tx.clientOnce.Do(func() {
tx.client = &Client{config: tx.config}
tx.client.init()
})
return tx.client
}
func (tx *Tx) init() {
tx.App = NewAppClient(tx.config)
tx.PayChannel = NewPayChannelClient(tx.config)
tx.PayNotifyLog = NewPayNotifyLogClient(tx.config)
tx.PayNotifyTask = NewPayNotifyTaskClient(tx.config)
tx.PayOrder = NewPayOrderClient(tx.config)
tx.PayOrderExtension = NewPayOrderExtensionClient(tx.config)
tx.PayRefund = NewPayRefundClient(tx.config)
}
// txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation.
// The idea is to support transactions without adding any extra code to the builders.
// When a builder calls to driver.Tx(), it gets the same dialect.Tx instance.
// Commit and Rollback are nop for the internal builders and the user must call one
// of them in order to commit or rollback the transaction.
//
// If a closed transaction is embedded in one of the generated entities, and the entity
// applies a query, for example: App.QueryXXX(), the query will be executed
// through the driver which created this transaction.
//
// Note that txDriver is not goroutine safe.
type txDriver struct {
// the driver we started the transaction from.
drv dialect.Driver
// tx is the underlying transaction.
tx dialect.Tx
// completion hooks.
mu sync.Mutex
onCommit []CommitHook
onRollback []RollbackHook
}
// newTx creates a new transactional driver.
func newTx(ctx context.Context, drv dialect.Driver) (*txDriver, error) {
tx, err := drv.Tx(ctx)
if err != nil {
return nil, err
}
return &txDriver{tx: tx, drv: drv}, nil
}
// Tx returns the transaction wrapper (txDriver) to avoid Commit or Rollback calls
// from the internal builders. Should be called only by the internal builders.
func (tx *txDriver) Tx(context.Context) (dialect.Tx, error) { return tx, nil }
// Dialect returns the dialect of the driver we started the transaction from.
func (tx *txDriver) Dialect() string { return tx.drv.Dialect() }
// Close is a nop close.
func (*txDriver) Close() error { return nil }
// Commit is a nop commit for the internal builders.
// User must call `Tx.Commit` in order to commit the transaction.
func (*txDriver) Commit() error { return nil }
// Rollback is a nop rollback for the internal builders.
// User must call `Tx.Rollback` in order to rollback the transaction.
func (*txDriver) Rollback() error { return nil }
// Exec calls tx.Exec.
func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error {
return tx.tx.Exec(ctx, query, args, v)
}
// Query calls tx.Query.
func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error {
return tx.tx.Query(ctx, query, args, v)
}
var _ dialect.Driver = (*txDriver)(nil)
// ExecContext allows calling the underlying ExecContext method of the transaction if it is supported by it.
// See, database/sql#Tx.ExecContext for more information.
func (tx *txDriver) ExecContext(ctx context.Context, query string, args ...any) (stdsql.Result, error) {
ex, ok := tx.tx.(interface {
ExecContext(context.Context, string, ...any) (stdsql.Result, error)
})
if !ok {
return nil, fmt.Errorf("Tx.ExecContext is not supported")
}
return ex.ExecContext(ctx, query, args...)
}
// QueryContext allows calling the underlying QueryContext method of the transaction if it is supported by it.
// See, database/sql#Tx.QueryContext for more information.
func (tx *txDriver) QueryContext(ctx context.Context, query string, args ...any) (*stdsql.Rows, error) {
q, ok := tx.tx.(interface {
QueryContext(context.Context, string, ...any) (*stdsql.Rows, error)
})
if !ok {
return nil, fmt.Errorf("Tx.QueryContext is not supported")
}
return q.QueryContext(ctx, query, args...)
}

View File

@ -3,42 +3,62 @@ module mingyang-admin-pay/rpc
go 1.25.3
require (
entgo.io/ent v0.14.5
github.com/saas-mingyang/mingyang-admin-common v0.3.3
github.com/zeromicro/go-zero v1.9.1
google.golang.org/grpc v1.76.0
google.golang.org/protobuf v1.36.10
)
require github.com/redis/go-redis/v9 v9.16.0 // indirect
require (
entgo.io/ent v0.14.5 // indirect
ariga.io/atlas v0.38.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bmatcuk/doublestar v1.3.4 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-openapi/inflect v0.21.3 // indirect; indirectf
github.com/go-openapi/jsonpointer v0.22.1 // indirect
github.com/go-openapi/jsonreference v0.21.2 // indirect
github.com/go-openapi/swag v0.25.1 // indirect
github.com/go-openapi/swag/cmdutils v0.25.1 // indirect
github.com/go-openapi/swag/conv v0.25.1 // indirect
github.com/go-openapi/swag/fileutils v0.25.1 // indirect
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
github.com/go-openapi/swag/jsonutils v0.25.1 // indirect
github.com/go-openapi/swag/loading v0.25.1 // indirect
github.com/go-openapi/swag/mangling v0.25.1 // indirect
github.com/go-openapi/swag/netutils v0.25.1 // indirect
github.com/go-openapi/swag/stringutils v0.25.1 // indirect
github.com/go-openapi/swag/typeutils v0.25.1 // indirect
github.com/go-openapi/swag/yamlutils v0.25.1 // indirect
github.com/gofrs/uuid/v5 v5.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/pyroscope-go v1.2.7 // indirect
github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/hashicorp/hcl/v2 v2.24.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
@ -49,14 +69,16 @@ require (
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.2 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/redis/go-redis/v9 v9.16.0 // indirect
github.com/saas-mingyang/mingyang-admin-core v0.0.0-20251107040124-c97a0a448793 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.15 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect
go.etcd.io/etcd/client/v3 v3.5.15 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zclconf/go-cty v1.17.0 // indirect
github.com/zclconf/go-cty-yaml v1.1.0 // indirect
go.etcd.io/etcd/api/v3 v3.6.5 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.6.5 // indirect
go.etcd.io/etcd/client/v3 v3.6.5 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 // indirect
@ -65,32 +87,40 @@ require (
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.opentelemetry.io/proto/otlp v1.8.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
go.uber.org/mock v0.4.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go.uber.org/mock v0.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/oauth2 v0.32.0 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/term v0.36.0 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/sync v0.18.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/tools v0.38.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251103181224-f26f9409b101 // indirect
golang.org/x/tools v0.39.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.29.3 // indirect
k8s.io/apimachinery v0.29.4 // indirect
k8s.io/client-go v0.29.3 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
k8s.io/api v0.34.1 // indirect
k8s.io/apimachinery v0.34.1 // indirect
k8s.io/client-go v0.34.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)
replace github.com/zeromicro/go-zero v1.9.1 => github.com/suyuan32/simple-admin-tools v1.9.1
replace mingyang-admin-simple-admin-message v0.0.1 => ../../simple-admin-message-center-tenant

View File

@ -1,15 +1,15 @@
ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9 h1:E0wvcUXTkgyN4wy4LGtNzMNGMytJN8afmIWXJVMi4cc=
ariga.io/atlas v0.32.1-0.20250325101103-175b25e1c1b9/go.mod h1:Oe1xWPuu5q9LzyrWfbZmEZxFYeu4BHTyzfjeW2aZp/w=
ariga.io/atlas v0.38.0 h1:MwbtwVtDWJFq+ECyeTAz2ArvewDnpeiw/t/sgNdDsdo=
ariga.io/atlas v0.38.0/go.mod h1:D7XMK6ei3GvfDqvzk+2VId78j77LdqHrqPOWamn51/s=
entgo.io/ent v0.14.5 h1:Rj2WOYJtCkWyFo6a+5wB3EfBRP0rnx1fMk6gGA0UUe4=
entgo.io/ent v0.14.5/go.mod h1:zTzLmWtPvGpmSwtkaayM2cm5m819NdM7z7tYPq3vN0U=
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI=
github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=
@ -22,53 +22,79 @@ github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1x
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY=
github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/coreos/go-systemd/v22 v22.6.0 h1:aGVa/v8B7hpb0TKl0MWoAavPDmHvobFe5R5zn0bCJWo=
github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes=
github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM=
github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/inflect v0.21.3 h1:TmQvw+9eLrsNp4X0BBQacEZZtAnzk2z1FaLdQQJsDiU=
github.com/go-openapi/inflect v0.21.3/go.mod h1:INezMuUu7SJQc2AyR3WO0DqqYUJSj8Kb4hBd7WtjlAw=
github.com/go-openapi/jsonpointer v0.22.1 h1:sHYI1He3b9NqJ4wXLoJDKmUmHkWy/L7rtEo92JUxBNk=
github.com/go-openapi/jsonpointer v0.22.1/go.mod h1:pQT9OsLkfz1yWoMgYFy4x3U5GY5nUlsOn1qSBH5MkCM=
github.com/go-openapi/jsonreference v0.21.2 h1:Wxjda4M/BBQllegefXrY/9aq1fxBA8sI5M/lFU6tSWU=
github.com/go-openapi/jsonreference v0.21.2/go.mod h1:pp3PEjIsJ9CZDGCNOyXIQxsNuroxm8FAJ/+quA0yKzQ=
github.com/go-openapi/swag v0.25.1 h1:6uwVsx+/OuvFVPqfQmOOPsqTcm5/GkBhNwLqIR916n8=
github.com/go-openapi/swag v0.25.1/go.mod h1:bzONdGlT0fkStgGPd3bhZf1MnuPkf2YAys6h+jZipOo=
github.com/go-openapi/swag/cmdutils v0.25.1 h1:nDke3nAFDArAa631aitksFGj2omusks88GF1VwdYqPY=
github.com/go-openapi/swag/cmdutils v0.25.1/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0=
github.com/go-openapi/swag/conv v0.25.1 h1:+9o8YUg6QuqqBM5X6rYL/p1dpWeZRhoIt9x7CCP+he0=
github.com/go-openapi/swag/conv v0.25.1/go.mod h1:Z1mFEGPfyIKPu0806khI3zF+/EUXde+fdeksUl2NiDs=
github.com/go-openapi/swag/fileutils v0.25.1 h1:rSRXapjQequt7kqalKXdcpIegIShhTPXx7yw0kek2uU=
github.com/go-openapi/swag/fileutils v0.25.1/go.mod h1:+NXtt5xNZZqmpIpjqcujqojGFek9/w55b3ecmOdtg8M=
github.com/go-openapi/swag/jsonname v0.25.1 h1:Sgx+qbwa4ej6AomWC6pEfXrA6uP2RkaNjA9BR8a1RJU=
github.com/go-openapi/swag/jsonname v0.25.1/go.mod h1:71Tekow6UOLBD3wS7XhdT98g5J5GR13NOTQ9/6Q11Zo=
github.com/go-openapi/swag/jsonutils v0.25.1 h1:AihLHaD0brrkJoMqEZOBNzTLnk81Kg9cWr+SPtxtgl8=
github.com/go-openapi/swag/jsonutils v0.25.1/go.mod h1:JpEkAjxQXpiaHmRO04N1zE4qbUEg3b7Udll7AMGTNOo=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.1 h1:DSQGcdB6G0N9c/KhtpYc71PzzGEIc/fZ1no35x4/XBY=
github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.1/go.mod h1:kjmweouyPwRUEYMSrbAidoLMGeJ5p6zdHi9BgZiqmsg=
github.com/go-openapi/swag/loading v0.25.1 h1:6OruqzjWoJyanZOim58iG2vj934TysYVptyaoXS24kw=
github.com/go-openapi/swag/loading v0.25.1/go.mod h1:xoIe2EG32NOYYbqxvXgPzne989bWvSNoWoyQVWEZicc=
github.com/go-openapi/swag/mangling v0.25.1 h1:XzILnLzhZPZNtmxKaz/2xIGPQsBsvmCjrJOWGNz/ync=
github.com/go-openapi/swag/mangling v0.25.1/go.mod h1:CdiMQ6pnfAgyQGSOIYnZkXvqhnnwOn997uXZMAd/7mQ=
github.com/go-openapi/swag/netutils v0.25.1 h1:2wFLYahe40tDUHfKT1GRC4rfa5T1B4GWZ+msEFA4Fl4=
github.com/go-openapi/swag/netutils v0.25.1/go.mod h1:CAkkvqnUJX8NV96tNhEQvKz8SQo2KF0f7LleiJwIeRE=
github.com/go-openapi/swag/stringutils v0.25.1 h1:Xasqgjvk30eUe8VKdmyzKtjkVjeiXx1Iz0zDfMNpPbw=
github.com/go-openapi/swag/stringutils v0.25.1/go.mod h1:JLdSAq5169HaiDUbTvArA2yQxmgn4D6h4A+4HqVvAYg=
github.com/go-openapi/swag/typeutils v0.25.1 h1:rD/9HsEQieewNt6/k+JBwkxuAHktFtH3I3ysiFZqukA=
github.com/go-openapi/swag/typeutils v0.25.1/go.mod h1:9McMC/oCdS4BKwk2shEB7x17P6HmMmA6dQRtAkSnNb8=
github.com/go-openapi/swag/yamlutils v0.25.1 h1:mry5ez8joJwzvMbaTGLhw8pXUnhDK91oSJLDPF1bmGk=
github.com/go-openapi/swag/yamlutils v0.25.1/go.mod h1:cm9ywbzncy3y6uPm/97ysW8+wZ09qsks+9RS8fLWKqg=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/gofrs/uuid/v5 v5.4.0 h1:EfbpCTjqMuGyq5ZJwxqzn3Cbr2d0rUZU7v5ycAk/e/0=
github.com/gofrs/uuid/v5 v5.4.0/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo=
github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec=
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grafana/pyroscope-go v1.2.7 h1:VWBBlqxjyR0Cwk2W6UrE8CdcdD80GOFNutj0Kb1T8ac=
@ -79,35 +105,30 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 h1:NmZ1PKzSTQbuGHw9DGPFomqkkLW
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3/go.mod h1:zQrxl1YP88HQlA6i9c63DSVPFklWpGX4OWAc9bFuaH4=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/hcl/v2 v2.18.1 h1:6nxnOJFku1EuSawSD81fuviYUV8DxFr3fp2dUi3ZYSo=
github.com/hashicorp/hcl/v2 v2.18.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
github.com/hashicorp/hcl/v2 v2.24.0 h1:2QJdZ454DSsYGoaE6QheQZjtKZSUs9Nh2izTWiwQxvE=
github.com/hashicorp/hcl/v2 v2.24.0/go.mod h1:oGoO1FIQYfn/AgyOhlg9qLC6/nOJPX3qGbkZpYAcqfM=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@ -120,16 +141,14 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4=
github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o=
github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg=
github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@ -145,49 +164,48 @@ github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4
github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
github.com/redis/go-redis/v9 v9.16.0 h1:OotgqgLSRCmzfqChbQyG1PHC3tLNR89DG4jdOERSEP4=
github.com/redis/go-redis/v9 v9.16.0/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/saas-mingyang/mingyang-admin-common v0.3.3 h1:Pe1IYBaE7v541WKnEFPwiOC9yMzhmvVQ4+rSfRdEC1M=
github.com/saas-mingyang/mingyang-admin-common v0.3.3/go.mod h1:mAweT+3C08LGdr14AQNz9Sx5COPEpTtL6dr5fQAKqWc=
github.com/saas-mingyang/mingyang-admin-core v0.0.0-20251107040124-c97a0a448793 h1:wSJjRdeAIX++S1lDSInYlIPg6OyPKCakHBJTNG683RI=
github.com/saas-mingyang/mingyang-admin-core v0.0.0-20251107040124-c97a0a448793/go.mod h1:wMcbdgNDZ+ZNB4inJb68MD2vAJ2iintwm3EYQn4F7Sc=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/suyuan32/simple-admin-tools v1.9.1 h1:RRFT2Dn22H/b0A4aB+ixul/6xzmTFXG10ER64DuCS0A=
github.com/suyuan32/simple-admin-tools v1.9.1/go.mod h1:v3y8WAJTCt+g/+Ve0BZuSga38gwdDh/2WNuvve9Tz2Y=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
github.com/zclconf/go-cty v1.17.0 h1:seZvECve6XX4tmnvRzWtJNHdscMtYEx5R7bnnVyd/d0=
github.com/zclconf/go-cty v1.17.0/go.mod h1:wqFzcImaLTI6A5HfsRwB0nj5n0MRZFwmey8YoFPPs3U=
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM=
github.com/zclconf/go-cty-yaml v1.1.0 h1:nP+jp0qPHv2IhUVqmQSzjvqAWcObN0KBkUl2rWBdig0=
github.com/zclconf/go-cty-yaml v1.1.0/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JAprQNgxSZ1Gyxs=
github.com/zeromicro/go-zero v1.9.1 h1:GZCl4jun/ZgZHnSvX3SSNDHf+tEGmEQ8x2Z23xjHa9g=
github.com/zeromicro/go-zero v1.9.1/go.mod h1:bHOl7Xr7EV/iHZWEqsUNJwFc/9WgAMrPpPagYvOaMtY=
go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk=
go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM=
go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA=
go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU=
go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4=
go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU=
go.etcd.io/etcd/api/v3 v3.6.5 h1:pMMc42276sgR1j1raO/Qv3QI9Af/AuyQUW6CBAWuntA=
go.etcd.io/etcd/api/v3 v3.6.5/go.mod h1:ob0/oWA/UQQlT1BmaEkWQzI0sJ1M0Et0mMpaABxguOQ=
go.etcd.io/etcd/client/pkg/v3 v3.6.5 h1:Duz9fAzIZFhYWgRjp/FgNq2gO1jId9Yae/rLn3RrBP8=
go.etcd.io/etcd/client/pkg/v3 v3.6.5/go.mod h1:8Wx3eGRPiy0qOFMZT/hfvdos+DjEaPxdIDiCDUv/FQk=
go.etcd.io/etcd/client/v3 v3.6.5 h1:yRwZNFBx/35VKHTcLDeO7XVLbCBFbPi+XV4OC3QJf2U=
go.etcd.io/etcd/client/v3 v3.6.5/go.mod h1:ZqwG/7TAFZ0BJ0jXRPoJjKQJtbFo/9NIY8uoFFKcCyo=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=
go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54=
@ -206,72 +224,72 @@ go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE=
go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A=
go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4=
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0=
go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82 h1:6/3JGEh1C88g7m+qzzTbl3A0FtsLguXieqofVLU/JAo=
golang.org/x/net v0.46.1-0.20251013234738-63d1a5100f82/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q=
golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda h1:+2XxjfsAu6vqFxwGBRcHiMaDCuZiqXGDUDVWVtrFAnE=
google.golang.org/genproto/googleapis/api v0.0.0-20251029180050-ab9386a59fda/go.mod h1:fDMmzKV90WSg1NbozdqrE64fkuTv6mlq2zxo9ad+3yo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20251103181224-f26f9409b101 h1:tRPGkdGHuewF4UisLzzHHr1spKw92qLM98nIzxbC0wY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20251103181224-f26f9409b101/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba h1:B14OtaXuMaCQsl2deSvNkyPKIzq3BjfxQp8d00QyWx4=
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:G5IanEx8/PgI9w6CFcYQf7jMtHQhZruvfM1i3qOqk5U=
google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba h1:UKgtfRM7Yh93Sya0Fo8ZzhDP4qBckrrxEr2oF5UIVb8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A=
google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c=
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
@ -279,31 +297,33 @@ google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnfEbYzo=
gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.29.3 h1:2ORfZ7+bGC3YJqGpV0KSDDEVf8hdGQ6A03/50vj8pmw=
k8s.io/api v0.29.3/go.mod h1:y2yg2NTyHUUkIoTC+phinTnEa3KFM6RZ3szxt014a80=
k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q=
k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y=
k8s.io/client-go v0.29.3 h1:R/zaZbEAxqComZ9FHeQwOh3Y1ZUs7FaHKZdQtIc2WZg=
k8s.io/client-go v0.29.3/go.mod h1:tkDisCvgPfiRpxGnOORfkljmS+UrW+WtXAy2fTvXJB0=
k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0=
k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo=
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM=
k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk=
k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4=
k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw=
k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY=
k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE=
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ=
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck=
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg=
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco=
sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE=
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=