2025-03-18 10:13:57 +08:00
|
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
|
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
|
|
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
|
|
|
|
|
|
|
|
|
package queries
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"database/sql"
|
|
|
|
|
|
|
|
|
|
"gorm.io/gorm"
|
|
|
|
|
|
|
|
|
|
"gorm.io/gen"
|
|
|
|
|
|
|
|
|
|
"gorm.io/plugin/dbresolver"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
|
Q = new(Query)
|
|
|
|
|
Admin *admin
|
|
|
|
|
AdminRole *adminRole
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement *announcement
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity *balanceActivity
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill *bill
|
|
|
|
|
Channel *channel
|
2025-03-18 17:57:07 +08:00
|
|
|
Client *client
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon *coupon
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser *couponUser
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge *edge
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry *inquiry
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole *linkAdminRole
|
|
|
|
|
LinkAdminRolePermission *linkAdminRolePermission
|
|
|
|
|
LinkClientPermission *linkClientPermission
|
|
|
|
|
LinkUserRole *linkUserRole
|
|
|
|
|
LinkUserRolePermission *linkUserRolePermission
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin *logsLogin
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest *logsRequest
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth *logsUserBandwidth
|
|
|
|
|
LogsUserUsage *logsUserUsage
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission *permission
|
|
|
|
|
Product *product
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount *productDiscount
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku *productSku
|
|
|
|
|
ProductSkuUser *productSkuUser
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy *proxy
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund *refund
|
|
|
|
|
Resource *resource
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong *resourceLong
|
|
|
|
|
ResourceShort *resourceShort
|
2025-05-12 10:07:12 +08:00
|
|
|
Session *session
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade *trade
|
|
|
|
|
User *user
|
|
|
|
|
UserRole *userRole
|
|
|
|
|
Whitelist *whitelist
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
|
|
|
|
*Q = *Use(db, opts...)
|
|
|
|
|
Admin = &Q.Admin
|
|
|
|
|
AdminRole = &Q.AdminRole
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement = &Q.Announcement
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity = &Q.BalanceActivity
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill = &Q.Bill
|
|
|
|
|
Channel = &Q.Channel
|
2025-03-18 17:57:07 +08:00
|
|
|
Client = &Q.Client
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon = &Q.Coupon
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser = &Q.CouponUser
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge = &Q.Edge
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry = &Q.Inquiry
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole = &Q.LinkAdminRole
|
|
|
|
|
LinkAdminRolePermission = &Q.LinkAdminRolePermission
|
|
|
|
|
LinkClientPermission = &Q.LinkClientPermission
|
|
|
|
|
LinkUserRole = &Q.LinkUserRole
|
|
|
|
|
LinkUserRolePermission = &Q.LinkUserRolePermission
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin = &Q.LogsLogin
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest = &Q.LogsRequest
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth = &Q.LogsUserBandwidth
|
|
|
|
|
LogsUserUsage = &Q.LogsUserUsage
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission = &Q.Permission
|
|
|
|
|
Product = &Q.Product
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount = &Q.ProductDiscount
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku = &Q.ProductSku
|
|
|
|
|
ProductSkuUser = &Q.ProductSkuUser
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy = &Q.Proxy
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund = &Q.Refund
|
|
|
|
|
Resource = &Q.Resource
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong = &Q.ResourceLong
|
|
|
|
|
ResourceShort = &Q.ResourceShort
|
2025-05-12 10:07:12 +08:00
|
|
|
Session = &Q.Session
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade = &Q.Trade
|
|
|
|
|
User = &Q.User
|
|
|
|
|
UserRole = &Q.UserRole
|
|
|
|
|
Whitelist = &Q.Whitelist
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
|
|
|
|
return &Query{
|
|
|
|
|
db: db,
|
|
|
|
|
Admin: newAdmin(db, opts...),
|
|
|
|
|
AdminRole: newAdminRole(db, opts...),
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement: newAnnouncement(db, opts...),
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity: newBalanceActivity(db, opts...),
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill: newBill(db, opts...),
|
|
|
|
|
Channel: newChannel(db, opts...),
|
2025-03-18 17:57:07 +08:00
|
|
|
Client: newClient(db, opts...),
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon: newCoupon(db, opts...),
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser: newCouponUser(db, opts...),
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge: newEdge(db, opts...),
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry: newInquiry(db, opts...),
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole: newLinkAdminRole(db, opts...),
|
|
|
|
|
LinkAdminRolePermission: newLinkAdminRolePermission(db, opts...),
|
|
|
|
|
LinkClientPermission: newLinkClientPermission(db, opts...),
|
|
|
|
|
LinkUserRole: newLinkUserRole(db, opts...),
|
|
|
|
|
LinkUserRolePermission: newLinkUserRolePermission(db, opts...),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin: newLogsLogin(db, opts...),
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest: newLogsRequest(db, opts...),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth: newLogsUserBandwidth(db, opts...),
|
|
|
|
|
LogsUserUsage: newLogsUserUsage(db, opts...),
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission: newPermission(db, opts...),
|
|
|
|
|
Product: newProduct(db, opts...),
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount: newProductDiscount(db, opts...),
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku: newProductSku(db, opts...),
|
|
|
|
|
ProductSkuUser: newProductSkuUser(db, opts...),
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy: newProxy(db, opts...),
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund: newRefund(db, opts...),
|
|
|
|
|
Resource: newResource(db, opts...),
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong: newResourceLong(db, opts...),
|
|
|
|
|
ResourceShort: newResourceShort(db, opts...),
|
2025-05-12 10:07:12 +08:00
|
|
|
Session: newSession(db, opts...),
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade: newTrade(db, opts...),
|
|
|
|
|
User: newUser(db, opts...),
|
|
|
|
|
UserRole: newUserRole(db, opts...),
|
|
|
|
|
Whitelist: newWhitelist(db, opts...),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Query struct {
|
|
|
|
|
db *gorm.DB
|
|
|
|
|
|
|
|
|
|
Admin admin
|
|
|
|
|
AdminRole adminRole
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement announcement
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity balanceActivity
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill bill
|
|
|
|
|
Channel channel
|
2025-03-18 17:57:07 +08:00
|
|
|
Client client
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon coupon
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser couponUser
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge edge
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry inquiry
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole linkAdminRole
|
|
|
|
|
LinkAdminRolePermission linkAdminRolePermission
|
|
|
|
|
LinkClientPermission linkClientPermission
|
|
|
|
|
LinkUserRole linkUserRole
|
|
|
|
|
LinkUserRolePermission linkUserRolePermission
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin logsLogin
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest logsRequest
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth logsUserBandwidth
|
|
|
|
|
LogsUserUsage logsUserUsage
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission permission
|
|
|
|
|
Product product
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount productDiscount
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku productSku
|
|
|
|
|
ProductSkuUser productSkuUser
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy proxy
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund refund
|
|
|
|
|
Resource resource
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong resourceLong
|
|
|
|
|
ResourceShort resourceShort
|
2025-05-12 10:07:12 +08:00
|
|
|
Session session
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade trade
|
|
|
|
|
User user
|
|
|
|
|
UserRole userRole
|
|
|
|
|
Whitelist whitelist
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Query) Available() bool { return q.db != nil }
|
|
|
|
|
|
|
|
|
|
func (q *Query) clone(db *gorm.DB) *Query {
|
|
|
|
|
return &Query{
|
|
|
|
|
db: db,
|
|
|
|
|
Admin: q.Admin.clone(db),
|
|
|
|
|
AdminRole: q.AdminRole.clone(db),
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement: q.Announcement.clone(db),
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity: q.BalanceActivity.clone(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill: q.Bill.clone(db),
|
|
|
|
|
Channel: q.Channel.clone(db),
|
2025-03-18 17:57:07 +08:00
|
|
|
Client: q.Client.clone(db),
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon: q.Coupon.clone(db),
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser: q.CouponUser.clone(db),
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge: q.Edge.clone(db),
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry: q.Inquiry.clone(db),
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole: q.LinkAdminRole.clone(db),
|
|
|
|
|
LinkAdminRolePermission: q.LinkAdminRolePermission.clone(db),
|
|
|
|
|
LinkClientPermission: q.LinkClientPermission.clone(db),
|
|
|
|
|
LinkUserRole: q.LinkUserRole.clone(db),
|
|
|
|
|
LinkUserRolePermission: q.LinkUserRolePermission.clone(db),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin: q.LogsLogin.clone(db),
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest: q.LogsRequest.clone(db),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth: q.LogsUserBandwidth.clone(db),
|
|
|
|
|
LogsUserUsage: q.LogsUserUsage.clone(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission: q.Permission.clone(db),
|
|
|
|
|
Product: q.Product.clone(db),
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount: q.ProductDiscount.clone(db),
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku: q.ProductSku.clone(db),
|
|
|
|
|
ProductSkuUser: q.ProductSkuUser.clone(db),
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy: q.Proxy.clone(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund: q.Refund.clone(db),
|
|
|
|
|
Resource: q.Resource.clone(db),
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong: q.ResourceLong.clone(db),
|
|
|
|
|
ResourceShort: q.ResourceShort.clone(db),
|
2025-05-12 10:07:12 +08:00
|
|
|
Session: q.Session.clone(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade: q.Trade.clone(db),
|
|
|
|
|
User: q.User.clone(db),
|
|
|
|
|
UserRole: q.UserRole.clone(db),
|
|
|
|
|
Whitelist: q.Whitelist.clone(db),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Query) ReadDB() *Query {
|
|
|
|
|
return q.ReplaceDB(q.db.Clauses(dbresolver.Read))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Query) WriteDB() *Query {
|
|
|
|
|
return q.ReplaceDB(q.db.Clauses(dbresolver.Write))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
|
|
|
|
return &Query{
|
|
|
|
|
db: db,
|
|
|
|
|
Admin: q.Admin.replaceDB(db),
|
|
|
|
|
AdminRole: q.AdminRole.replaceDB(db),
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement: q.Announcement.replaceDB(db),
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity: q.BalanceActivity.replaceDB(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill: q.Bill.replaceDB(db),
|
|
|
|
|
Channel: q.Channel.replaceDB(db),
|
2025-03-18 17:57:07 +08:00
|
|
|
Client: q.Client.replaceDB(db),
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon: q.Coupon.replaceDB(db),
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser: q.CouponUser.replaceDB(db),
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge: q.Edge.replaceDB(db),
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry: q.Inquiry.replaceDB(db),
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole: q.LinkAdminRole.replaceDB(db),
|
|
|
|
|
LinkAdminRolePermission: q.LinkAdminRolePermission.replaceDB(db),
|
|
|
|
|
LinkClientPermission: q.LinkClientPermission.replaceDB(db),
|
|
|
|
|
LinkUserRole: q.LinkUserRole.replaceDB(db),
|
|
|
|
|
LinkUserRolePermission: q.LinkUserRolePermission.replaceDB(db),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin: q.LogsLogin.replaceDB(db),
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest: q.LogsRequest.replaceDB(db),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth: q.LogsUserBandwidth.replaceDB(db),
|
|
|
|
|
LogsUserUsage: q.LogsUserUsage.replaceDB(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission: q.Permission.replaceDB(db),
|
|
|
|
|
Product: q.Product.replaceDB(db),
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount: q.ProductDiscount.replaceDB(db),
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku: q.ProductSku.replaceDB(db),
|
|
|
|
|
ProductSkuUser: q.ProductSkuUser.replaceDB(db),
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy: q.Proxy.replaceDB(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund: q.Refund.replaceDB(db),
|
|
|
|
|
Resource: q.Resource.replaceDB(db),
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong: q.ResourceLong.replaceDB(db),
|
|
|
|
|
ResourceShort: q.ResourceShort.replaceDB(db),
|
2025-05-12 10:07:12 +08:00
|
|
|
Session: q.Session.replaceDB(db),
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade: q.Trade.replaceDB(db),
|
|
|
|
|
User: q.User.replaceDB(db),
|
|
|
|
|
UserRole: q.UserRole.replaceDB(db),
|
|
|
|
|
Whitelist: q.Whitelist.replaceDB(db),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type queryCtx struct {
|
|
|
|
|
Admin *adminDo
|
|
|
|
|
AdminRole *adminRoleDo
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement *announcementDo
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity *balanceActivityDo
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill *billDo
|
|
|
|
|
Channel *channelDo
|
2025-03-18 17:57:07 +08:00
|
|
|
Client *clientDo
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon *couponDo
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser *couponUserDo
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge *edgeDo
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry *inquiryDo
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole *linkAdminRoleDo
|
|
|
|
|
LinkAdminRolePermission *linkAdminRolePermissionDo
|
|
|
|
|
LinkClientPermission *linkClientPermissionDo
|
|
|
|
|
LinkUserRole *linkUserRoleDo
|
|
|
|
|
LinkUserRolePermission *linkUserRolePermissionDo
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin *logsLoginDo
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest *logsRequestDo
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth *logsUserBandwidthDo
|
|
|
|
|
LogsUserUsage *logsUserUsageDo
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission *permissionDo
|
|
|
|
|
Product *productDo
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount *productDiscountDo
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku *productSkuDo
|
|
|
|
|
ProductSkuUser *productSkuUserDo
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy *proxyDo
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund *refundDo
|
|
|
|
|
Resource *resourceDo
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong *resourceLongDo
|
|
|
|
|
ResourceShort *resourceShortDo
|
2025-05-12 10:07:12 +08:00
|
|
|
Session *sessionDo
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade *tradeDo
|
|
|
|
|
User *userDo
|
|
|
|
|
UserRole *userRoleDo
|
|
|
|
|
Whitelist *whitelistDo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
|
|
|
|
return &queryCtx{
|
|
|
|
|
Admin: q.Admin.WithContext(ctx),
|
|
|
|
|
AdminRole: q.AdminRole.WithContext(ctx),
|
2025-05-07 16:48:02 +08:00
|
|
|
Announcement: q.Announcement.WithContext(ctx),
|
2026-03-30 14:59:35 +08:00
|
|
|
BalanceActivity: q.BalanceActivity.WithContext(ctx),
|
2025-03-18 10:13:57 +08:00
|
|
|
Bill: q.Bill.WithContext(ctx),
|
|
|
|
|
Channel: q.Channel.WithContext(ctx),
|
2025-03-18 17:57:07 +08:00
|
|
|
Client: q.Client.WithContext(ctx),
|
2025-04-19 14:59:19 +08:00
|
|
|
Coupon: q.Coupon.WithContext(ctx),
|
2026-04-09 14:58:20 +08:00
|
|
|
CouponUser: q.CouponUser.WithContext(ctx),
|
2025-05-13 09:29:13 +08:00
|
|
|
Edge: q.Edge.WithContext(ctx),
|
2025-12-18 14:22:56 +08:00
|
|
|
Inquiry: q.Inquiry.WithContext(ctx),
|
2025-11-24 18:44:06 +08:00
|
|
|
LinkAdminRole: q.LinkAdminRole.WithContext(ctx),
|
|
|
|
|
LinkAdminRolePermission: q.LinkAdminRolePermission.WithContext(ctx),
|
|
|
|
|
LinkClientPermission: q.LinkClientPermission.WithContext(ctx),
|
|
|
|
|
LinkUserRole: q.LinkUserRole.WithContext(ctx),
|
|
|
|
|
LinkUserRolePermission: q.LinkUserRolePermission.WithContext(ctx),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsLogin: q.LogsLogin.WithContext(ctx),
|
2025-05-08 10:46:21 +08:00
|
|
|
LogsRequest: q.LogsRequest.WithContext(ctx),
|
2025-06-20 15:17:15 +08:00
|
|
|
LogsUserBandwidth: q.LogsUserBandwidth.WithContext(ctx),
|
|
|
|
|
LogsUserUsage: q.LogsUserUsage.WithContext(ctx),
|
2025-03-18 10:13:57 +08:00
|
|
|
Permission: q.Permission.WithContext(ctx),
|
|
|
|
|
Product: q.Product.WithContext(ctx),
|
2026-03-24 16:25:21 +08:00
|
|
|
ProductDiscount: q.ProductDiscount.WithContext(ctx),
|
2026-03-18 13:07:06 +08:00
|
|
|
ProductSku: q.ProductSku.WithContext(ctx),
|
|
|
|
|
ProductSkuUser: q.ProductSkuUser.WithContext(ctx),
|
2025-03-28 10:03:29 +08:00
|
|
|
Proxy: q.Proxy.WithContext(ctx),
|
2025-03-18 10:13:57 +08:00
|
|
|
Refund: q.Refund.WithContext(ctx),
|
|
|
|
|
Resource: q.Resource.WithContext(ctx),
|
2025-05-17 15:54:42 +08:00
|
|
|
ResourceLong: q.ResourceLong.WithContext(ctx),
|
|
|
|
|
ResourceShort: q.ResourceShort.WithContext(ctx),
|
2025-05-12 10:07:12 +08:00
|
|
|
Session: q.Session.WithContext(ctx),
|
2025-03-18 10:13:57 +08:00
|
|
|
Trade: q.Trade.WithContext(ctx),
|
|
|
|
|
User: q.User.WithContext(ctx),
|
|
|
|
|
UserRole: q.UserRole.WithContext(ctx),
|
|
|
|
|
Whitelist: q.Whitelist.WithContext(ctx),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Query) Transaction(fc func(tx *Query) error, opts ...*sql.TxOptions) error {
|
|
|
|
|
return q.db.Transaction(func(tx *gorm.DB) error { return fc(q.clone(tx)) }, opts...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *Query) Begin(opts ...*sql.TxOptions) *QueryTx {
|
|
|
|
|
tx := q.db.Begin(opts...)
|
|
|
|
|
return &QueryTx{Query: q.clone(tx), Error: tx.Error}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type QueryTx struct {
|
|
|
|
|
*Query
|
|
|
|
|
Error error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *QueryTx) Commit() error {
|
|
|
|
|
return q.db.Commit().Error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *QueryTx) Rollback() error {
|
|
|
|
|
return q.db.Rollback().Error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *QueryTx) SavePoint(name string) error {
|
|
|
|
|
return q.db.SavePoint(name).Error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (q *QueryTx) RollbackTo(name string) error {
|
|
|
|
|
return q.db.RollbackTo(name).Error
|
|
|
|
|
}
|