🎨 remove xorm & add gorm gen
This commit is contained in:
2861
.idea/GOHCache.xml
generated
2861
.idea/GOHCache.xml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
COMMENT int = iota
|
||||
COMMENT int64 = iota
|
||||
REPLY
|
||||
)
|
||||
|
||||
const (
|
||||
CommentTopicType = iota
|
||||
CommentTopicType int64 = iota
|
||||
)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
NotDeleted int8 = iota
|
||||
Deleted int8 = 1
|
||||
NotDeleted int64 = iota
|
||||
Deleted int64 = 1
|
||||
)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
Female int8 = iota
|
||||
Female int64 = iota
|
||||
Male
|
||||
)
|
||||
|
5
app/core/api/common/constant/mongodb.go
Normal file
5
app/core/api/common/constant/mongodb.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package constant
|
||||
|
||||
const (
|
||||
COMMENT_IMAGES = "comment_images"
|
||||
)
|
@@ -38,7 +38,7 @@ type (
|
||||
Username string `json:"username,omitempty"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Status int8 `json:"status"`
|
||||
Status int64 `json:"status"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -103,16 +103,16 @@ type (
|
||||
// 评论列表请求参数
|
||||
CommentListRequest {
|
||||
TopicId string `json:"topic_id"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
IsHot bool `json:"is_hot,default=true,optional"`
|
||||
}
|
||||
// 回复列表请求参数
|
||||
ReplyListRequest {
|
||||
TopicId string `json:"topic_id"`
|
||||
CommentId int64 `json:"comment_id"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
}
|
||||
// 点赞评论的请求参数
|
||||
CommentLikeRequest {
|
||||
|
@@ -8,6 +8,8 @@ import (
|
||||
|
||||
"github.com/mssola/useragent"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/captcha/verify"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
@@ -15,8 +17,6 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SubmitCommentLogic struct {
|
||||
@@ -57,7 +57,7 @@ func (l *SubmitCommentLogic) SubmitComment(r *http.Request, req *types.CommentRe
|
||||
|
||||
browser, _ := ua.Browser()
|
||||
operatingSystem := ua.OS()
|
||||
isAuthor := 0
|
||||
var isAuthor int64 = 0
|
||||
session, err := l.svcCtx.Session.Get(r, constant.SESSION_KEY)
|
||||
if err == nil {
|
||||
return nil, err
|
||||
@@ -74,26 +74,25 @@ func (l *SubmitCommentLogic) SubmitComment(r *http.Request, req *types.CommentRe
|
||||
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||
}
|
||||
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
|
||||
comment := model.ScaCommentReply{
|
||||
topicType := constant.CommentTopicType
|
||||
commentType := constant.COMMENT
|
||||
comment := &model.ScaCommentReply{
|
||||
Content: commentContent,
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
TopicType: constant.CommentTopicType,
|
||||
CommentType: constant.COMMENT,
|
||||
UserID: uid,
|
||||
TopicID: req.TopicId,
|
||||
TopicType: topicType,
|
||||
CommentType: commentType,
|
||||
Author: isAuthor,
|
||||
CommentIp: ip,
|
||||
CommentIP: ip,
|
||||
Location: location,
|
||||
Browser: browser,
|
||||
OperatingSystem: operatingSystem,
|
||||
Agent: userAgent,
|
||||
}
|
||||
affected, err := l.svcCtx.DB.InsertOne(&comment)
|
||||
err = l.svcCtx.DB.ScaCommentReply.Create(comment)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if affected == 0 {
|
||||
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||
}
|
||||
|
||||
if len(req.Images) > 0 {
|
||||
imagesData, err := utils.ProcessImages(req.Images)
|
||||
@@ -103,16 +102,16 @@ func (l *SubmitCommentLogic) SubmitComment(r *http.Request, req *types.CommentRe
|
||||
commentImages := types.CommentImages{
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
CommentId: comment.Id,
|
||||
CommentId: comment.ID,
|
||||
Images: imagesData,
|
||||
CreatedAt: comment.CreatedAt.String(),
|
||||
}
|
||||
if _, err = l.svcCtx.MongoClient.Collection("comment_images").InsertOne(l.ctx, commentImages); err != nil {
|
||||
if _, err = l.svcCtx.MongoClient.Collection(constant.COMMENT_IMAGES).InsertOne(l.ctx, commentImages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
commentResponse := types.CommentResponse{
|
||||
Id: comment.Id,
|
||||
Id: comment.ID,
|
||||
Content: commentContent,
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
|
@@ -8,6 +8,8 @@ import (
|
||||
|
||||
"github.com/mssola/useragent"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/captcha/verify"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
@@ -15,8 +17,6 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SubmitReplyCommentLogic struct {
|
||||
@@ -65,7 +65,7 @@ func (l *SubmitReplyCommentLogic) SubmitReplyComment(r *http.Request, req *types
|
||||
if !ok {
|
||||
return nil, errors.New("uid not found in session")
|
||||
}
|
||||
isAuthor := 0
|
||||
var isAuthor int64 = 0
|
||||
if uid == req.Author {
|
||||
isAuthor = 1
|
||||
}
|
||||
@@ -76,39 +76,34 @@ func (l *SubmitReplyCommentLogic) SubmitReplyComment(r *http.Request, req *types
|
||||
}
|
||||
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
|
||||
|
||||
tx := l.svcCtx.DB.NewSession()
|
||||
defer tx.Close()
|
||||
if err = tx.Begin(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reply := model.ScaCommentReply{
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
topicType := constant.CommentTopicType
|
||||
commentType := constant.REPLY
|
||||
reply := &model.ScaCommentReply{
|
||||
Content: commentContent,
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
TopicType: constant.CommentTopicType,
|
||||
CommentType: constant.COMMENT,
|
||||
UserID: uid,
|
||||
TopicID: req.TopicId,
|
||||
TopicType: topicType,
|
||||
CommentType: commentType,
|
||||
Author: isAuthor,
|
||||
CommentIp: ip,
|
||||
CommentIP: ip,
|
||||
Location: location,
|
||||
Browser: browser,
|
||||
OperatingSystem: operatingSystem,
|
||||
Agent: userAgent,
|
||||
ReplyId: req.ReplyId,
|
||||
ReplyID: req.ReplyId,
|
||||
ReplyUser: req.ReplyUser,
|
||||
}
|
||||
affected, err := tx.Insert(&reply)
|
||||
err = tx.ScaCommentReply.Create(reply)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if affected == 0 {
|
||||
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||
}
|
||||
update, err := tx.Table(model.ScaCommentReply{}).Where("id = ? and deleted = 0", req.ReplyId).Incr("reply_count", 1).Update(nil)
|
||||
commentReply := l.svcCtx.DB.ScaCommentReply
|
||||
update, err := tx.ScaCommentReply.Updates(commentReply.ReplyCount.Add(1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if update == 0 {
|
||||
if update.RowsAffected == 0 {
|
||||
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||
}
|
||||
|
||||
@@ -121,26 +116,26 @@ func (l *SubmitReplyCommentLogic) SubmitReplyComment(r *http.Request, req *types
|
||||
commentImages := types.CommentImages{
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
CommentId: reply.Id,
|
||||
CommentId: reply.ID,
|
||||
Images: imagesData,
|
||||
CreatedAt: reply.CreatedAt.String(),
|
||||
}
|
||||
if _, err = l.svcCtx.MongoClient.Collection("comment_images").InsertOne(l.ctx, commentImages); err != nil {
|
||||
if _, err = l.svcCtx.MongoClient.Collection(constant.COMMENT_IMAGES).InsertOne(l.ctx, commentImages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
commentResponse := types.CommentResponse{
|
||||
Id: reply.Id,
|
||||
Id: reply.ID,
|
||||
Content: commentContent,
|
||||
UserId: uid,
|
||||
TopicId: reply.TopicId,
|
||||
TopicId: reply.TopicID,
|
||||
Author: isAuthor,
|
||||
Location: location,
|
||||
Browser: browser,
|
||||
OperatingSystem: operatingSystem,
|
||||
CreatedTime: time.Now(),
|
||||
ReplyId: reply.ReplyId,
|
||||
ReplyId: reply.ReplyID,
|
||||
ReplyUser: reply.ReplyUser,
|
||||
}
|
||||
err = tx.Commit()
|
||||
|
@@ -8,6 +8,8 @@ import (
|
||||
|
||||
"github.com/mssola/useragent"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/captcha/verify"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
@@ -15,8 +17,6 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type SubmitReplyReplyLogic struct {
|
||||
@@ -74,7 +74,7 @@ func (l *SubmitReplyReplyLogic) SubmitReplyReply(r *http.Request, req *types.Rep
|
||||
}
|
||||
|
||||
// 判断作者身份
|
||||
isAuthor := 0
|
||||
var isAuthor int64 = 0
|
||||
if uid == req.Author {
|
||||
isAuthor = 1
|
||||
}
|
||||
@@ -86,40 +86,35 @@ func (l *SubmitReplyReplyLogic) SubmitReplyReply(r *http.Request, req *types.Rep
|
||||
}
|
||||
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
|
||||
|
||||
tx := l.svcCtx.DB.NewSession()
|
||||
defer tx.Close()
|
||||
if err = tx.Begin(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
replyReply := model.ScaCommentReply{
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
topicType := constant.CommentTopicType
|
||||
commentType := constant.REPLY
|
||||
replyReply := &model.ScaCommentReply{
|
||||
Content: commentContent,
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
TopicType: constant.CommentTopicType,
|
||||
CommentType: constant.COMMENT,
|
||||
UserID: uid,
|
||||
TopicID: req.TopicId,
|
||||
TopicType: topicType,
|
||||
CommentType: commentType,
|
||||
Author: isAuthor,
|
||||
CommentIp: ip,
|
||||
CommentIP: ip,
|
||||
Location: location,
|
||||
Browser: browser,
|
||||
OperatingSystem: operatingSystem,
|
||||
Agent: userAgent,
|
||||
ReplyId: req.ReplyId,
|
||||
ReplyID: req.ReplyId,
|
||||
ReplyUser: req.ReplyUser,
|
||||
ReplyTo: req.ReplyTo,
|
||||
}
|
||||
affected, err := tx.Insert(&replyReply)
|
||||
err = tx.ScaCommentReply.Create(replyReply)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if affected == 0 {
|
||||
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||
}
|
||||
update, err := tx.Table(model.ScaCommentReply{}).Where("id = ? and version = ? and deleted = 0", req.ReplyId, replyReply.Version).Incr("reply_count", 1).Update(nil)
|
||||
commentReply := l.svcCtx.DB.ScaCommentReply
|
||||
update, err := tx.ScaCommentReply.Updates(commentReply.ReplyCount.Add(1))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if update == 0 {
|
||||
if update.RowsAffected == 0 {
|
||||
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||
}
|
||||
|
||||
@@ -132,27 +127,27 @@ func (l *SubmitReplyReplyLogic) SubmitReplyReply(r *http.Request, req *types.Rep
|
||||
commentImages := types.CommentImages{
|
||||
UserId: uid,
|
||||
TopicId: req.TopicId,
|
||||
CommentId: replyReply.Id,
|
||||
CommentId: replyReply.ID,
|
||||
Images: imagesData,
|
||||
CreatedAt: replyReply.CreatedAt.String(),
|
||||
}
|
||||
if _, err = l.svcCtx.MongoClient.Collection("comment_images").InsertOne(l.ctx, commentImages); err != nil {
|
||||
if _, err = l.svcCtx.MongoClient.Collection(constant.COMMENT_IMAGES).InsertOne(l.ctx, commentImages); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// 构建响应
|
||||
commentResponse := types.CommentResponse{
|
||||
Id: replyReply.Id,
|
||||
Id: replyReply.ID,
|
||||
Content: commentContent,
|
||||
UserId: uid,
|
||||
TopicId: replyReply.TopicId,
|
||||
TopicId: replyReply.TopicID,
|
||||
Author: isAuthor,
|
||||
Location: location,
|
||||
Browser: browser,
|
||||
OperatingSystem: operatingSystem,
|
||||
CreatedTime: time.Now(),
|
||||
ReplyId: replyReply.ReplyId,
|
||||
ReplyId: replyReply.ReplyID,
|
||||
ReplyUser: replyReply.ReplyUser,
|
||||
ReplyTo: replyReply.ReplyTo,
|
||||
}
|
||||
|
@@ -3,12 +3,16 @@ package oauth
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/yitter/idgenerator-go/idgen"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
@@ -16,8 +20,6 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GiteeCallbackLogic struct {
|
||||
@@ -102,26 +104,19 @@ func (l *GiteeCallbackLogic) GiteeCallback(w http.ResponseWriter, r *http.Reques
|
||||
}
|
||||
Id := strconv.Itoa(giteeUser.ID)
|
||||
|
||||
tx := l.svcCtx.DB.NewSession()
|
||||
defer tx.Close()
|
||||
if err = tx.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
userSocial := model.ScaAuthUserSocial{
|
||||
OpenId: Id,
|
||||
Source: constant.OAuthSourceGitee,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
has, err := tx.Get(&userSocial)
|
||||
if err != nil {
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(Id), userSocial.Source.Eq(constant.OAuthSourceGitee), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
|
||||
if !has {
|
||||
if socialUser == nil {
|
||||
// 创建用户
|
||||
uid := idgen.NextId()
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
addUser := model.ScaAuthUser{
|
||||
addUser := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Avatar: giteeUser.AvatarURL,
|
||||
Username: giteeUser.Login,
|
||||
@@ -131,21 +126,25 @@ func (l *GiteeCallbackLogic) GiteeCallback(w http.ResponseWriter, r *http.Reques
|
||||
Deleted: constant.NotDeleted,
|
||||
Gender: constant.Male,
|
||||
}
|
||||
affected, err := tx.Insert(&addUser)
|
||||
if err != nil || affected == 0 {
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
socialUser := model.ScaAuthUserSocial{
|
||||
UserId: uidStr,
|
||||
OpenId: Id,
|
||||
Source: constant.OAuthSourceGitee,
|
||||
gitee := constant.OAuthSourceGitee
|
||||
newSocialUser := &model.ScaAuthUserSocial{
|
||||
UserID: uidStr,
|
||||
OpenID: Id,
|
||||
Source: gitee,
|
||||
}
|
||||
insert, err := tx.Insert(&socialUser)
|
||||
if err != nil || insert == 0 {
|
||||
err = tx.ScaAuthUserSocial.Create(newSocialUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if res, err := l.svcCtx.CasbinEnforcer.AddRoleForUser(uidStr, constant.User); !res || err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -153,16 +152,16 @@ func (l *GiteeCallbackLogic) GiteeCallback(w http.ResponseWriter, r *http.Reques
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
user := model.ScaAuthUser{
|
||||
UID: userSocial.UserId,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
have, err := tx.Get(&user)
|
||||
if err != nil || !have {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if err = HandleOauthLoginResponse(user, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
if err = HandleOauthLoginResponse(authUserInfo, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -174,7 +173,7 @@ func (l *GiteeCallbackLogic) GiteeCallback(w http.ResponseWriter, r *http.Reques
|
||||
}
|
||||
|
||||
// HandleOauthLoginResponse 处理登录响应
|
||||
func HandleOauthLoginResponse(scaAuthUser model.ScaAuthUser, svcCtx *svc.ServiceContext, r *http.Request, w http.ResponseWriter, ctx context.Context) error {
|
||||
func HandleOauthLoginResponse(scaAuthUser *model.ScaAuthUser, svcCtx *svc.ServiceContext, r *http.Request, w http.ResponseWriter, ctx context.Context) error {
|
||||
data, err := user.HandleUserLogin(scaAuthUser, svcCtx, true, r, w, ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@@ -3,18 +3,20 @@ package oauth
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/yitter/idgenerator-go/idgen"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GithubCallbackLogic struct {
|
||||
@@ -101,74 +103,73 @@ func (l *GithubCallbackLogic) GithubCallback(w http.ResponseWriter, r *http.Requ
|
||||
return err
|
||||
}
|
||||
Id := strconv.Itoa(gitHubUser.ID)
|
||||
tx := l.svcCtx.DB.NewSession()
|
||||
defer tx.Close()
|
||||
if err = tx.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
userSocial := model.ScaAuthUserSocial{
|
||||
OpenId: Id,
|
||||
Source: constant.OAuthSourceGithub,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
has, err := tx.Get(&userSocial)
|
||||
if err != nil {
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(Id), userSocial.Source.Eq(constant.OAuthSourceGithub), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
|
||||
if !has {
|
||||
if socialUser == nil {
|
||||
// 创建用户
|
||||
uid := idgen.NextId()
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
|
||||
addUser := model.ScaAuthUser{
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
addUser := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Avatar: gitHubUser.AvatarURL,
|
||||
Username: gitHubUser.Login,
|
||||
Nickname: gitHubUser.Name,
|
||||
Blog: gitHubUser.Blog,
|
||||
Email: gitHubUser.Email,
|
||||
Deleted: constant.NotDeleted,
|
||||
Gender: constant.Male,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
}
|
||||
affected, err := tx.Insert(&addUser)
|
||||
if err != nil || affected == 0 {
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
socialUser := model.ScaAuthUserSocial{
|
||||
UserId: uidStr,
|
||||
OpenId: Id,
|
||||
Source: constant.OAuthSourceGithub,
|
||||
githubUser := constant.OAuthSourceGithub
|
||||
newSocialUser := &model.ScaAuthUserSocial{
|
||||
UserID: uidStr,
|
||||
OpenID: Id,
|
||||
Source: githubUser,
|
||||
}
|
||||
insert, err := tx.Insert(&socialUser)
|
||||
if err != nil || insert == 0 {
|
||||
err = tx.ScaAuthUserSocial.Create(newSocialUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if res, err := l.svcCtx.CasbinEnforcer.AddRoleForUser(uidStr, constant.User); !res || err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if err = HandleOauthLoginResponse(addUser, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
user := model.ScaAuthUser{
|
||||
UID: userSocial.UserId,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
have, err := tx.Get(&user)
|
||||
if err != nil || !have {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if err = HandleOauthLoginResponse(user, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
if err = HandleOauthLoginResponse(authUserInfo, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
if err = tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@@ -3,18 +3,20 @@ package oauth
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/yitter/idgenerator-go/idgen"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type QqCallbackLogic struct {
|
||||
@@ -98,72 +100,72 @@ func (l *QqCallbackLogic) QqCallback(w http.ResponseWriter, r *http.Request, req
|
||||
return err
|
||||
}
|
||||
|
||||
tx := l.svcCtx.DB.NewSession()
|
||||
defer tx.Close()
|
||||
if err = tx.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
userSocial := model.ScaAuthUserSocial{
|
||||
OpenId: authQQme.OpenID,
|
||||
Source: constant.OAuthSourceQQ,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
has, err := tx.Get(&userSocial)
|
||||
if err != nil {
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(authQQme.OpenID), userSocial.Source.Eq(constant.OAuthSourceQQ), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
|
||||
if !has {
|
||||
if socialUser == nil {
|
||||
// 创建用户
|
||||
uid := idgen.NextId()
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
|
||||
addUser := model.ScaAuthUser{
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
addUser := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Avatar: qqUserInfo.FigureurlQq1,
|
||||
Username: authQQme.OpenID,
|
||||
Nickname: qqUserInfo.Nickname,
|
||||
Deleted: constant.NotDeleted,
|
||||
Gender: constant.Male,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
}
|
||||
affected, err := tx.Insert(&addUser)
|
||||
if err != nil || affected == 0 {
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
socialUser := model.ScaAuthUserSocial{
|
||||
UserId: uidStr,
|
||||
OpenId: authQQme.OpenID,
|
||||
Source: constant.OAuthSourceGithub,
|
||||
githubUser := constant.OAuthSourceQQ
|
||||
newSocialUser := &model.ScaAuthUserSocial{
|
||||
UserID: uidStr,
|
||||
OpenID: authQQme.OpenID,
|
||||
Source: githubUser,
|
||||
}
|
||||
insert, err := tx.Insert(&socialUser)
|
||||
if err != nil || insert == 0 {
|
||||
err = tx.ScaAuthUserSocial.Create(newSocialUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if res, err := l.svcCtx.CasbinEnforcer.AddRoleForUser(uidStr, constant.User); !res || err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if err = HandleOauthLoginResponse(addUser, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
user := model.ScaAuthUser{
|
||||
UID: userSocial.UserId,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
have, err := tx.Get(&user)
|
||||
if err != nil || !have {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if err = HandleOauthLoginResponse(user, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
if err = HandleOauthLoginResponse(authUserInfo, l.svcCtx, r, w, l.ctx); err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := tx.Commit(); err != nil {
|
||||
if err = tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/ArtisanCloud/PowerWeChat/v3/src/officialAccount/server/handlers/models"
|
||||
"github.com/yitter/idgenerator-go/idgen"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/i18n"
|
||||
@@ -113,91 +114,96 @@ func (l *WechatCallbackLogic) HandlerWechatLogin(openId string, clientId string,
|
||||
if openId == "" {
|
||||
return errors.New("openId is empty")
|
||||
}
|
||||
tx := l.svcCtx.DB.NewSession()
|
||||
defer tx.Close()
|
||||
if err := tx.Begin(); err != nil {
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
|
||||
userSocial := l.svcCtx.DB.ScaAuthUserSocial
|
||||
socialUser, err := tx.ScaAuthUserSocial.Where(userSocial.OpenID.Eq(openId), userSocial.Source.Eq(constant.OAuthSourceWechat), userSocial.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
userSocial := model.ScaAuthUserSocial{
|
||||
OpenId: openId,
|
||||
Source: constant.OAuthSourceWechat,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
has, err := tx.Get(&userSocial)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !has {
|
||||
|
||||
if socialUser == nil {
|
||||
// 创建用户
|
||||
uid := idgen.NextId()
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
avatar := utils.GenerateAvatar(uidStr)
|
||||
name := randomname.GenerateName()
|
||||
|
||||
addUser := model.ScaAuthUser{
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
addUser := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Avatar: avatar,
|
||||
Username: openId,
|
||||
Nickname: name,
|
||||
Deleted: constant.NotDeleted,
|
||||
Gender: constant.Male,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
}
|
||||
affected, err := tx.Insert(&addUser)
|
||||
if err != nil || affected == 0 {
|
||||
err = tx.ScaAuthUser.Create(addUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
socialUser := model.ScaAuthUserSocial{
|
||||
UserId: uidStr,
|
||||
OpenId: openId,
|
||||
Source: constant.OAuthSourceGithub,
|
||||
wechatUser := constant.OAuthSourceWechat
|
||||
newSocialUser := &model.ScaAuthUserSocial{
|
||||
UserID: uidStr,
|
||||
OpenID: openId,
|
||||
Source: wechatUser,
|
||||
}
|
||||
insert, err := tx.Insert(&socialUser)
|
||||
if err != nil || insert == 0 {
|
||||
err = tx.ScaAuthUserSocial.Create(newSocialUser)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
if res, err := l.svcCtx.CasbinEnforcer.AddRoleForUser(uidStr, constant.User); !res || err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
data, err := user.HandleUserLogin(addUser, l.svcCtx, true, r, w, l.ctx)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
marshal, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
err = websocket.QrcodeWebSocketHandler.SendMessageToClient(clientId, marshal)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
} else {
|
||||
authUser := model.ScaAuthUser{
|
||||
UID: userSocial.UserId,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
have, err := tx.Get(&authUser)
|
||||
if err != nil || !have {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
authUserInfo, err := tx.ScaAuthUser.Where(authUser.UID.Eq(socialUser.UserID), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
data, err := user.HandleUserLogin(authUser, l.svcCtx, true, r, w, l.ctx)
|
||||
data, err := user.HandleUserLogin(authUserInfo, l.svcCtx, true, r, w, l.ctx)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
marshal, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
err = websocket.QrcodeWebSocketHandler.SendMessageToClient(clientId, marshal)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := tx.Commit(); err != nil {
|
||||
if err = tx.Commit(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@@ -2,11 +2,12 @@ package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"xorm.io/xorm"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/captcha/verify"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
@@ -16,6 +17,7 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/query"
|
||||
)
|
||||
|
||||
type AccountLoginLogic struct {
|
||||
@@ -37,43 +39,44 @@ func (l *AccountLoginLogic) AccountLogin(w http.ResponseWriter, r *http.Request,
|
||||
if !verifyResult {
|
||||
return response.ErrorWithI18n(l.ctx, "captcha.verificationFailure"), nil
|
||||
}
|
||||
var user model.ScaAuthUser
|
||||
var query *xorm.Session
|
||||
|
||||
user := l.svcCtx.DB.ScaAuthUser
|
||||
var selectedUser query.IScaAuthUserDo
|
||||
|
||||
switch {
|
||||
case utils.IsPhone(req.Account):
|
||||
query = l.svcCtx.DB.Where("phone = ? AND deleted = ?", req.Account, 0)
|
||||
selectedUser = user.Where(user.Phone.Eq(req.Account), user.Deleted.Eq(constant.NotDeleted))
|
||||
case utils.IsEmail(req.Account):
|
||||
query = l.svcCtx.DB.Where("email = ? AND deleted = ?", req.Account, 0)
|
||||
selectedUser = user.Where(user.Email.Eq(req.Account), user.Deleted.Eq(constant.NotDeleted))
|
||||
case utils.IsUsername(req.Account):
|
||||
query = l.svcCtx.DB.Where("username = ? AND deleted = ?", req.Account, 0)
|
||||
selectedUser = user.Where(user.Username.Eq(req.Account), user.Deleted.Eq(constant.NotDeleted))
|
||||
default:
|
||||
return response.ErrorWithI18n(l.ctx, "login.invalidAccount"), nil
|
||||
}
|
||||
has, err := query.Get(&user)
|
||||
userInfo, err := selectedUser.First()
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return response.ErrorWithI18n(l.ctx, "login.userNotRegistered"), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if !has {
|
||||
return response.ErrorWithI18n(l.ctx, "login.userNotRegistered"), nil
|
||||
}
|
||||
|
||||
if !utils.Verify(user.Password, req.Password) {
|
||||
if !utils.Verify(userInfo.Password, req.Password) {
|
||||
return response.ErrorWithI18n(l.ctx, "login.invalidPassword"), nil
|
||||
}
|
||||
data, err := HandleUserLogin(user, l.svcCtx, req.AutoLogin, r, w, l.ctx)
|
||||
data, err := HandleUserLogin(userInfo, l.svcCtx, req.AutoLogin, r, w, l.ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 记录用户登录设备
|
||||
if err = GetUserLoginDevice(user.UID, r, l.svcCtx.Ip2Region, l.svcCtx.DB, l.ctx); err != nil {
|
||||
if err = GetUserLoginDevice(userInfo.UID, r, l.svcCtx.Ip2Region, l.svcCtx.DB); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return response.SuccessWithData(data), nil
|
||||
}
|
||||
|
||||
// HandleUserLogin 处理用户登录
|
||||
func HandleUserLogin(user model.ScaAuthUser, svcCtx *svc.ServiceContext, autoLogin bool, r *http.Request, w http.ResponseWriter, ctx context.Context) (*types.LoginResponse, error) {
|
||||
func HandleUserLogin(user *model.ScaAuthUser, svcCtx *svc.ServiceContext, autoLogin bool, r *http.Request, w http.ResponseWriter, ctx context.Context) (*types.LoginResponse, error) {
|
||||
// 生成jwt token
|
||||
accessToken := jwt.GenerateAccessToken(svcCtx.Config.Auth.AccessSecret, jwt.AccessJWTPayload{
|
||||
UserID: user.UID,
|
||||
|
@@ -8,12 +8,13 @@ import (
|
||||
"github.com/lionsoul2014/ip2region/binding/golang/xdb"
|
||||
"github.com/mssola/useragent"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"xorm.io/xorm"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/query"
|
||||
)
|
||||
|
||||
type GetUserDeviceLogic struct {
|
||||
@@ -40,14 +41,14 @@ func (l *GetUserDeviceLogic) GetUserDevice(r *http.Request) error {
|
||||
return errors.New("user session not found")
|
||||
}
|
||||
|
||||
if err = GetUserLoginDevice(uid, r, l.svcCtx.Ip2Region, l.svcCtx.DB, l.ctx); err != nil {
|
||||
if err = GetUserLoginDevice(uid, r, l.svcCtx.Ip2Region, l.svcCtx.DB); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUserLoginDevice 获取用户登录设备
|
||||
func GetUserLoginDevice(userId string, r *http.Request, ip2location *xdb.Searcher, db *xorm.Engine, ctx context.Context) error {
|
||||
func GetUserLoginDevice(userId string, r *http.Request, ip2location *xdb.Searcher, DB *query.Query) error {
|
||||
userAgent := r.Header.Get("User-Agent")
|
||||
if userAgent == "" {
|
||||
return errors.New("user agent not found")
|
||||
@@ -67,54 +68,45 @@ func GetUserLoginDevice(userId string, r *http.Request, ip2location *xdb.Searche
|
||||
mozilla := ua.Mozilla()
|
||||
platform := ua.Platform()
|
||||
engine, engineVersion := ua.Engine()
|
||||
|
||||
var device model.ScaAuthUserDevice
|
||||
has, err := db.Where("user_id = ? AND ip = ? AND agent = ?", userId, ip, userAgent).Get(&device)
|
||||
if err != nil {
|
||||
var newIsBot int64 = 0
|
||||
var newIsMobile int64 = 0
|
||||
if isBot {
|
||||
newIsBot = 1
|
||||
}
|
||||
if mobile {
|
||||
newIsMobile = 1
|
||||
}
|
||||
userDevice := DB.ScaAuthUserDevice
|
||||
device, err := userDevice.Where(userDevice.UserID.Eq(userId), userDevice.IP.Eq(ip), userDevice.Agent.Eq(userAgent)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
}
|
||||
|
||||
if !has {
|
||||
newDevice := &model.ScaAuthUserDevice{
|
||||
UserID: userId,
|
||||
Bot: newIsBot,
|
||||
Agent: userAgent,
|
||||
Browser: browser,
|
||||
BrowserVersion: browserVersion,
|
||||
EngineName: engine,
|
||||
EngineVersion: engineVersion,
|
||||
IP: ip,
|
||||
Location: location,
|
||||
OperatingSystem: os,
|
||||
Mobile: newIsMobile,
|
||||
Mozilla: mozilla,
|
||||
Platform: platform,
|
||||
}
|
||||
if device == nil {
|
||||
// 创建新的设备记录
|
||||
newDevice := &model.ScaAuthUserDevice{
|
||||
UserId: userId,
|
||||
Bot: isBot,
|
||||
Agent: userAgent,
|
||||
Browser: browser,
|
||||
BrowserVersion: browserVersion,
|
||||
EngineName: engine,
|
||||
EngineVersion: engineVersion,
|
||||
Ip: ip,
|
||||
Location: location,
|
||||
OperatingSystem: os,
|
||||
Mobile: mobile,
|
||||
Mozilla: mozilla,
|
||||
Platform: platform,
|
||||
}
|
||||
|
||||
affected, err := db.Insert(newDevice)
|
||||
if err != nil || affected == 0 {
|
||||
return errors.New("create user device failed")
|
||||
err = DB.ScaAuthUserDevice.Create(newDevice)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
// 如果设备存在,执行更新
|
||||
device.Bot = isBot
|
||||
device.Agent = userAgent
|
||||
device.Browser = browser
|
||||
device.BrowserVersion = browserVersion
|
||||
device.EngineName = engine
|
||||
device.EngineVersion = engineVersion
|
||||
device.Ip = ip
|
||||
device.Location = location
|
||||
device.OperatingSystem = os
|
||||
device.Mobile = mobile
|
||||
device.Mozilla = mozilla
|
||||
device.Platform = platform
|
||||
|
||||
affected, err := db.ID(device.Id).Update(&device)
|
||||
if err != nil || affected == 0 {
|
||||
return errors.New("update user device failed")
|
||||
resultInfo, err := userDevice.Where(userDevice.ID.Eq(device.ID)).Updates(newDevice)
|
||||
if err != nil || resultInfo.RowsAffected == 0 {
|
||||
return errors.New("update device failed")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/yitter/idgenerator-go/idgen"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
randomname "schisandra-album-cloud-microservices/app/core/api/common/random_name"
|
||||
@@ -43,48 +44,51 @@ func (l *PhoneLoginLogic) PhoneLogin(r *http.Request, w http.ResponseWriter, req
|
||||
if req.Captcha != code {
|
||||
return response.ErrorWithI18n(l.ctx, "login.captchaError"), nil
|
||||
}
|
||||
authUser := model.ScaAuthUser{
|
||||
Phone: req.Phone,
|
||||
Deleted: constant.NotDeleted,
|
||||
}
|
||||
has, err := l.svcCtx.DB.Get(&authUser)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tx := l.svcCtx.DB.NewSession()
|
||||
defer tx.Close()
|
||||
if err = tx.Begin(); err != nil {
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
userInfo, err := authUser.Where(authUser.Phone.Eq(req.Phone), authUser.Deleted.Eq(constant.NotDeleted)).First()
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
tx := l.svcCtx.DB.Begin()
|
||||
defer func() {
|
||||
if recover() != nil || err != nil {
|
||||
_ = tx.Rollback()
|
||||
}
|
||||
}()
|
||||
|
||||
if !has {
|
||||
if userInfo == nil {
|
||||
uid := idgen.NextId()
|
||||
uidStr := strconv.FormatInt(uid, 10)
|
||||
avatar := utils.GenerateAvatar(uidStr)
|
||||
name := randomname.GenerateName()
|
||||
|
||||
user := model.ScaAuthUser{
|
||||
notDeleted := constant.NotDeleted
|
||||
male := constant.Male
|
||||
user := &model.ScaAuthUser{
|
||||
UID: uidStr,
|
||||
Phone: req.Phone,
|
||||
Avatar: avatar,
|
||||
Nickname: name,
|
||||
Deleted: constant.NotDeleted,
|
||||
Gender: constant.Male,
|
||||
Deleted: notDeleted,
|
||||
Gender: male,
|
||||
}
|
||||
insert, err := tx.Insert(&user)
|
||||
if err != nil || insert == 0 {
|
||||
return nil, errors.New("register failed")
|
||||
err := tx.ScaAuthUser.Create(user)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
_, err = l.svcCtx.CasbinEnforcer.AddRoleForUser(uidStr, constant.User)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
data, err := HandleUserLogin(user, l.svcCtx, req.AutoLogin, r, w, l.ctx)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
// 记录用户登录设备
|
||||
if err = GetUserLoginDevice(user.UID, r, l.svcCtx.Ip2Region, l.svcCtx.DB, l.ctx); err != nil {
|
||||
if err = GetUserLoginDevice(user.UID, r, l.svcCtx.Ip2Region, l.svcCtx.DB); err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
err = tx.Commit()
|
||||
@@ -93,12 +97,14 @@ func (l *PhoneLoginLogic) PhoneLogin(r *http.Request, w http.ResponseWriter, req
|
||||
}
|
||||
return response.SuccessWithData(data), nil
|
||||
} else {
|
||||
data, err := HandleUserLogin(authUser, l.svcCtx, req.AutoLogin, r, w, l.ctx)
|
||||
data, err := HandleUserLogin(userInfo, l.svcCtx, req.AutoLogin, r, w, l.ctx)
|
||||
if err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
// 记录用户登录设备
|
||||
if err = GetUserLoginDevice(authUser.UID, r, l.svcCtx.Ip2Region, l.svcCtx.DB, l.ctx); err != nil {
|
||||
if err = GetUserLoginDevice(userInfo.UID, r, l.svcCtx.Ip2Region, l.svcCtx.DB); err != nil {
|
||||
_ = tx.Rollback()
|
||||
return nil, err
|
||||
}
|
||||
err = tx.Commit()
|
||||
|
@@ -2,15 +2,16 @@ package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/response"
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/utils"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ResetPasswordLogic struct {
|
||||
@@ -48,27 +49,25 @@ func (l *ResetPasswordLogic) ResetPassword(req *types.ResetPasswordRequest) (res
|
||||
if err = l.svcCtx.RedisClient.Del(l.ctx, constant.UserSmsRedisPrefix+req.Phone).Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authUser := model.ScaAuthUser{
|
||||
Phone: req.Phone,
|
||||
Deleted: constant.NotDeleted,
|
||||
authUser := l.svcCtx.DB.ScaAuthUser
|
||||
|
||||
userInfo, err := authUser.Where(authUser.Phone.Eq(req.Phone)).First()
|
||||
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return response.ErrorWithI18n(l.ctx, "login.userNotRegistered"), nil
|
||||
}
|
||||
has, err := l.svcCtx.DB.Get(&authUser)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !has {
|
||||
return response.ErrorWithI18n(l.ctx, "login.userNotRegistered"), nil
|
||||
}
|
||||
encrypt, err := utils.Encrypt(req.Password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
affected, err := l.svcCtx.DB.ID(authUser.Id).Cols("password").Update(&model.ScaAuthUser{Password: encrypt})
|
||||
affected, err := authUser.Where(authUser.ID.Eq(userInfo.ID), authUser.Phone.Eq(req.Phone)).Update(authUser.Password, encrypt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if affected == 0 {
|
||||
if affected.RowsAffected == 0 {
|
||||
return response.ErrorWithI18n(l.ctx, "login.resetPasswordError"), nil
|
||||
}
|
||||
return response.Success(), nil
|
||||
|
@@ -8,10 +8,8 @@ import (
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/wenlng/go-captcha/v2/rotate"
|
||||
"github.com/wenlng/go-captcha/v2/slide"
|
||||
sensitive "github.com/zmexing/go-sensitive-word"
|
||||
"xorm.io/xorm"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
sensitive "github.com/zmexing/go-sensitive-word"
|
||||
"go.mongodb.org/mongo-driver/v2/mongo"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/config"
|
||||
@@ -21,17 +19,18 @@ import (
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/ip2region"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mongodb"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/query"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/redis_session"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/redisx"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/sensitivex"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/wechat_public"
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/wechat_official"
|
||||
)
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
SecurityHeadersMiddleware rest.Middleware
|
||||
CasbinVerifyMiddleware rest.Middleware
|
||||
DB *xorm.Engine
|
||||
DB *query.Query
|
||||
RedisClient *redis.Client
|
||||
MongoClient *mongo.Database
|
||||
Session *redisstore.RedisStore
|
||||
@@ -44,7 +43,7 @@ type ServiceContext struct {
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
db := mysql.NewMySQL(c.Mysql.DataSource, c.Mysql.MaxOpenConn, c.Mysql.MaxIdleConn)
|
||||
db, queryDB := mysql.NewMySQL(c.Mysql.DataSource, c.Mysql.MaxOpenConn, c.Mysql.MaxIdleConn)
|
||||
casbinEnforcer := casbinx.NewCasbin(db)
|
||||
redisClient := redisx.NewRedis(c.Redis.Host, c.Redis.Pass, c.Redis.DB)
|
||||
session := redis_session.NewRedisSession(redisClient)
|
||||
@@ -52,13 +51,13 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||
Config: c,
|
||||
SecurityHeadersMiddleware: middleware.NewSecurityHeadersMiddleware().Handle,
|
||||
CasbinVerifyMiddleware: middleware.NewCasbinVerifyMiddleware(casbinEnforcer, session).Handle,
|
||||
DB: db,
|
||||
DB: queryDB,
|
||||
RedisClient: redisClient,
|
||||
MongoClient: mongodb.NewMongoDB(c.Mongo.Uri, c.Mongo.Username, c.Mongo.Password, c.Mongo.AuthSource, c.Mongo.Database),
|
||||
Session: session,
|
||||
Ip2Region: ip2region.NewIP2Region(),
|
||||
CasbinEnforcer: casbinEnforcer,
|
||||
WechatPublic: wechat_public.NewWechatPublic(c.Wechat.AppID, c.Wechat.AppSecret, c.Wechat.Token, c.Wechat.AESKey, c.Redis.Host, c.Redis.Pass, c.Redis.DB),
|
||||
WechatPublic: wechat_official.NewWechatPublic(c.Wechat.AppID, c.Wechat.AppSecret, c.Wechat.Token, c.Wechat.AESKey, c.Redis.Host, c.Redis.Pass, c.Redis.DB),
|
||||
Sensitive: sensitivex.NewSensitive(),
|
||||
RotateCaptcha: captcha.NewRotateCaptcha(),
|
||||
SlideCaptcha: captcha.NewSlideCaptcha(),
|
||||
|
@@ -8,7 +8,7 @@ type CommentResponse struct {
|
||||
Content string `json:"content"`
|
||||
UserId string `json:"user_id"`
|
||||
TopicId string `json:"topic_id"`
|
||||
Author int `json:"author"`
|
||||
Author int64 `json:"author"`
|
||||
Location string `json:"location"`
|
||||
Browser string `json:"browser"`
|
||||
OperatingSystem string `json:"operating_system"`
|
||||
|
@@ -1,17 +0,0 @@
|
||||
package types
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// SessionData 返回数据
|
||||
type SessionData struct {
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
UID string `json:"uid"`
|
||||
}
|
||||
|
||||
func (res SessionData) MarshalBinary() ([]byte, error) {
|
||||
return json.Marshal(res)
|
||||
}
|
||||
|
||||
func (res SessionData) UnmarshalBinary(data []byte) error {
|
||||
return json.Unmarshal(data, &res)
|
||||
}
|
@@ -23,8 +23,8 @@ type CommentLikeRequest struct {
|
||||
|
||||
type CommentListRequest struct {
|
||||
TopicId string `json:"topic_id"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
IsHot bool `json:"is_hot,default=true,optional"`
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ type LoginResponse struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Status int8 `json:"status"`
|
||||
Status int64 `json:"status"`
|
||||
}
|
||||
|
||||
type OAuthCallbackRequest struct {
|
||||
@@ -78,8 +78,8 @@ type ReplyCommentRequest struct {
|
||||
type ReplyListRequest struct {
|
||||
TopicId string `json:"topic_id"`
|
||||
CommentId int64 `json:"comment_id"`
|
||||
Page int `json:"page,default=1,optional"`
|
||||
Size int `json:"size,default=5,optional"`
|
||||
Page int64 `json:"page,default=1,optional"`
|
||||
Size int64 `json:"size,default=5,optional"`
|
||||
}
|
||||
|
||||
type ReplyReplyRequest struct {
|
||||
|
@@ -6,14 +6,13 @@ import (
|
||||
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/casbin/casbin/v2/model"
|
||||
xormadapter "github.com/casbin/xorm-adapter/v3"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"xorm.io/xorm"
|
||||
gormadapter "github.com/casbin/gorm-adapter/v3"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// NewCasbin creates a new casbinx enforcer with a mysql adapter and loads the policy from the file system.
|
||||
func NewCasbin(engine *xorm.Engine) *casbin.CachedEnforcer {
|
||||
a, err := xormadapter.NewAdapterByEngineWithTableName(engine, "permission_rule", "sca_auth_")
|
||||
func NewCasbin(engine *gorm.DB) *casbin.CachedEnforcer {
|
||||
a, err := gormadapter.NewAdapterByDBUseTableName(engine, "sca_auth_", "permission_rule")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
103
app/core/api/repository/mysql/generate/generate.go
Normal file
103
app/core/api/repository/mysql/generate/generate.go
Normal file
@@ -0,0 +1,103 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const MySQLDSN = "root:1611@(localhost:3306)/schisandra-cloud-album?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
|
||||
func main() {
|
||||
|
||||
// 连接数据库
|
||||
db, err := gorm.Open(mysql.Open(MySQLDSN))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
dir, err := os.Getwd()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
path := filepath.Join(dir, "app/core/api/repository/mysql/", "query")
|
||||
// 生成实例
|
||||
g := gen.NewGenerator(gen.Config{
|
||||
// 相对执行`go run`时的路径, 会自动创建目录
|
||||
OutPath: path,
|
||||
// 生成的文件名,默认gen.go
|
||||
OutFile: "gen.go",
|
||||
// 生成DAO代码的包名,默认是:model
|
||||
ModelPkgPath: "model",
|
||||
// 是否为DAO包生成单元测试代码,默认:false
|
||||
WithUnitTest: false,
|
||||
|
||||
// WithDefaultQuery 生成默认查询结构体(作为全局变量使用), 即`Q`结构体和其字段(各表模型)
|
||||
// WithoutContext 生成没有context调用限制的代码供查询
|
||||
// WithQueryInterface 生成interface形式的查询代码(可导出), 如`Where()`方法返回的就是一个可导出的接口类型
|
||||
Mode: gen.WithDefaultQuery | gen.WithQueryInterface | gen.WithoutContext,
|
||||
|
||||
// 表字段可为 null 值时, 对应结体字段使用指针类型
|
||||
FieldNullable: false, // generate pointer when field is nullable
|
||||
|
||||
// 表字段默认值与模型结构体字段零值不一致的字段, 在插入数据时需要赋值该字段值为零值的, 结构体字段须是指针类型才能成功, 即`FieldCoverable:true`配置下生成的结构体字段.
|
||||
// 因为在插入时遇到字段为零值的会被GORM赋予默认值. 如字段`age`表默认值为10, 即使你显式设置为0最后也会被GORM设为10提交.
|
||||
// 如果该字段没有上面提到的插入时赋零值的特殊需要, 则字段为非指针类型使用起来会比较方便.
|
||||
FieldCoverable: true,
|
||||
|
||||
// 模型结构体字段的数字类型的符号表示是否与表字段的一致, `false`指示都用有符号类型
|
||||
FieldSignable: false,
|
||||
// 生成 gorm 标签的字段索引属性
|
||||
FieldWithIndexTag: true,
|
||||
// 生成 gorm 标签的字段类型属性
|
||||
FieldWithTypeTag: true,
|
||||
})
|
||||
// 设置目标 db
|
||||
g.UseDB(db)
|
||||
|
||||
// 自定义字段的数据类型
|
||||
// 统一数字类型为int64,兼容protobuf
|
||||
dataMap := map[string]func(columnType gorm.ColumnType) (dataType string){
|
||||
"tinyint": func(columnType gorm.ColumnType) (dataType string) { return "int64" },
|
||||
"smallint": func(columnType gorm.ColumnType) (dataType string) { return "int64" },
|
||||
"mediumint": func(columnType gorm.ColumnType) (dataType string) { return "int64" },
|
||||
"bigint": func(columnType gorm.ColumnType) (dataType string) { return "int64" },
|
||||
"int": func(columnType gorm.ColumnType) (dataType string) { return "int64" },
|
||||
}
|
||||
// 要先于`ApplyBasic`执行
|
||||
g.WithDataTypeMap(dataMap)
|
||||
|
||||
// 自定义模型结体字段的标签
|
||||
// 将特定字段名的 json 标签加上`string`属性,即 MarshalJSON 时该字段由数字类型转成字符串类型
|
||||
jsonField := gen.FieldJSONTagWithNS(func(columnName string) (tagContent string) {
|
||||
toStringField := `id, `
|
||||
if strings.Contains(toStringField, columnName) {
|
||||
return columnName + ",string"
|
||||
}
|
||||
return columnName
|
||||
})
|
||||
// 将非默认字段名的字段定义为自动时间戳和软删除字段;
|
||||
// 自动时间戳默认字段名为:`updated_at`、`created_at, 表字段数据类型为: INT 或 DATETIME
|
||||
// 软删除默认字段名为:`deleted_at`, 表字段数据类型为: DATETIME
|
||||
autoUpdateTimeField := gen.FieldGORMTag("updated_at", func(tag field.GormTag) field.GormTag {
|
||||
return tag.Append("autoUpdateTime")
|
||||
})
|
||||
autoCreateTimeField := gen.FieldGORMTag("created_at", func(tag field.GormTag) field.GormTag {
|
||||
return tag.Append("autoCreateTime")
|
||||
})
|
||||
softDeleteField := gen.FieldType("delete_at", "gorm.DeletedAt")
|
||||
// 模型自定义选项组
|
||||
fieldOpts := []gen.ModelOpt{jsonField, autoUpdateTimeField, autoCreateTimeField, softDeleteField}
|
||||
|
||||
// 创建全部模型文件, 并覆盖前面创建的同名模型
|
||||
allModel := g.GenerateAllTable(fieldOpts...)
|
||||
|
||||
g.ApplyBasic(allModel...)
|
||||
|
||||
g.Execute()
|
||||
}
|
@@ -1,32 +0,0 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"xorm.io/xorm"
|
||||
"xorm.io/xorm/caches"
|
||||
"xorm.io/xorm/log"
|
||||
)
|
||||
|
||||
func NewMySQL(url string, maxOpenConn int, maxIdleConn int) *xorm.Engine {
|
||||
engine, err := xorm.NewEngine("mysql", url)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = engine.Ping()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = SyncDatabase(engine)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
engine.SetMaxOpenConns(maxOpenConn)
|
||||
engine.SetMaxIdleConns(maxIdleConn)
|
||||
|
||||
cacher := caches.NewLRUCacher(caches.NewMemoryStore(), 1000)
|
||||
engine.SetDefaultCacher(cacher)
|
||||
|
||||
engine.ShowSQL(true)
|
||||
engine.Logger().SetLevel(log.LOG_DEBUG)
|
||||
return engine
|
||||
}
|
36
app/core/api/repository/mysql/model/sca_auth_menu.gen.go
Normal file
36
app/core/api/repository/mysql/model/sca_auth_menu.gen.go
Normal file
@@ -0,0 +1,36 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaAuthMenu = "sca_auth_menu"
|
||||
|
||||
// ScaAuthMenu mapped from table <sca_auth_menu>
|
||||
type ScaAuthMenu struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键ID" json:"id,string"` // 主键ID
|
||||
MenuName string `gorm:"column:menu_name;type:varchar(64);comment:名称" json:"menu_name"` // 名称
|
||||
ParentID int64 `gorm:"column:parent_id;type:bigint;comment:父ID" json:"parent_id"` // 父ID
|
||||
Type int64 `gorm:"column:type;type:tinyint;comment:类型" json:"type"` // 类型
|
||||
Path string `gorm:"column:path;type:varchar(30);comment:路径" json:"path"` // 路径
|
||||
Status int64 `gorm:"column:status;type:tinyint;comment:状态 0 启用 1 停用" json:"status"` // 状态 0 启用 1 停用
|
||||
Icon string `gorm:"column:icon;type:varchar(128);comment:图标" json:"icon"` // 图标
|
||||
MenuKey string `gorm:"column:menu_key;type:varchar(64);comment:关键字" json:"menu_key"` // 关键字
|
||||
Order_ int64 `gorm:"column:order;type:int;comment:排序" json:"order"` // 排序
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除" json:"deleted"` // 是否删除
|
||||
Remark string `gorm:"column:remark;type:varchar(255);comment:备注 描述" json:"remark"` // 备注 描述
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaAuthMenu's table name
|
||||
func (*ScaAuthMenu) TableName() string {
|
||||
return TableNameScaAuthMenu
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaAuthMenu struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键ID') pk autoincr notnull " json:"id"` // 主键ID
|
||||
MenuName string `xorm:"varchar(64) 'menu_name' comment('名称') default NULL " json:"menu_name"` // 名称
|
||||
ParentId int64 `xorm:"bigint(20) 'parent_id' comment('父ID') default NULL " json:"parent_id"` // 父ID
|
||||
Type int8 `xorm:"tinyint(4) 'type' comment('类型 ') default 0 " json:"type"` // 类型
|
||||
Path string `xorm:"varchar(30) 'path' comment('路径') default NULL " json:"path"` // 路径
|
||||
Status int8 `xorm:"tinyint(4) 'status' comment('状态 0 启用 1 停用') default 0 " json:"status"` // 状态 0 启用 1 停用
|
||||
Icon string `xorm:"varchar(128) 'icon' comment('图标') default NULL " json:"icon"` // 图标
|
||||
MenuKey string `xorm:"varchar(64) 'menu_key' comment('关键字') default NULL " json:"menu_key"` // 关键字
|
||||
Order int32 `xorm:"int(11) 'order' comment('排序') default NULL " json:"order"` // 排序
|
||||
CreatedAt time.Time `xorm:"datetime 'created_at' comment('创建时间') default NULL " json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"datetime 'updated_at' comment('更新时间') default NULL " json:"updated_at"` // 更新时间
|
||||
Deleted int32 `xorm:"int(11) 'deleted' comment('是否删除') default 0 " json:"deleted"` // 是否删除
|
||||
Remark string `xorm:"varchar(255) 'remark' comment('备注 描述') default NULL " json:"remark"` // 备注 描述
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
func (s *ScaAuthMenu) TableName() string {
|
||||
return "sca_auth_menu"
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
// 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 model
|
||||
|
||||
const TableNameScaAuthPermissionRule = "sca_auth_permission_rule"
|
||||
|
||||
// ScaAuthPermissionRule mapped from table <sca_auth_permission_rule>
|
||||
type ScaAuthPermissionRule struct {
|
||||
ID int64 `gorm:"column:id;type:int;primaryKey;autoIncrement:true" json:"id,string"`
|
||||
Ptype string `gorm:"column:ptype;type:varchar(100);uniqueIndex:idx_sca_auth_permission_rule,priority:1;index:IDX_sca_auth_permission_rule_ptype,priority:1" json:"ptype"`
|
||||
V0 string `gorm:"column:v0;type:varchar(100);uniqueIndex:idx_sca_auth_permission_rule,priority:2;index:IDX_sca_auth_permission_rule_v0,priority:1" json:"v0"`
|
||||
V1 string `gorm:"column:v1;type:varchar(100);uniqueIndex:idx_sca_auth_permission_rule,priority:3;index:IDX_sca_auth_permission_rule_v1,priority:1" json:"v1"`
|
||||
V2 string `gorm:"column:v2;type:varchar(100);uniqueIndex:idx_sca_auth_permission_rule,priority:4;index:IDX_sca_auth_permission_rule_v2,priority:1" json:"v2"`
|
||||
V3 string `gorm:"column:v3;type:varchar(100);uniqueIndex:idx_sca_auth_permission_rule,priority:5;index:IDX_sca_auth_permission_rule_v3,priority:1" json:"v3"`
|
||||
V4 string `gorm:"column:v4;type:varchar(100);uniqueIndex:idx_sca_auth_permission_rule,priority:6;index:IDX_sca_auth_permission_rule_v4,priority:1" json:"v4"`
|
||||
V5 string `gorm:"column:v5;type:varchar(100);uniqueIndex:idx_sca_auth_permission_rule,priority:7;index:IDX_sca_auth_permission_rule_v5,priority:1" json:"v5"`
|
||||
}
|
||||
|
||||
// TableName ScaAuthPermissionRule's table name
|
||||
func (*ScaAuthPermissionRule) TableName() string {
|
||||
return TableNameScaAuthPermissionRule
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
package model
|
||||
|
||||
type ScaAuthPermissionRule struct {
|
||||
Id int32 `xorm:"int(11) 'id' pk autoincr notnull " json:"id"`
|
||||
Ptype string `xorm:"varchar(100) 'ptype' default NULL " json:"ptype"`
|
||||
V0 string `xorm:"varchar(100) 'v0' default NULL " json:"v0"`
|
||||
V1 string `xorm:"varchar(100) 'v1' default NULL " json:"v1"`
|
||||
V2 string `xorm:"varchar(100) 'v2' default NULL " json:"v2"`
|
||||
V3 string `xorm:"varchar(100) 'v3' default NULL " json:"v3"`
|
||||
V4 string `xorm:"varchar(100) 'v4' default NULL " json:"v4"`
|
||||
V5 string `xorm:"varchar(100) 'v5' default NULL " json:"v5"`
|
||||
}
|
||||
|
||||
func (s *ScaAuthPermissionRule) TableName() string {
|
||||
return "sca_auth_permission_rule"
|
||||
}
|
29
app/core/api/repository/mysql/model/sca_auth_role.gen.go
Normal file
29
app/core/api/repository/mysql/model/sca_auth_role.gen.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaAuthRole = "sca_auth_role"
|
||||
|
||||
// ScaAuthRole mapped from table <sca_auth_role>
|
||||
type ScaAuthRole struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键ID" json:"id,string"` // 主键ID
|
||||
RoleName string `gorm:"column:role_name;type:varchar(32);not null;comment:角色名称" json:"role_name"` // 角色名称
|
||||
RoleKey string `gorm:"column:role_key;type:varchar(64);not null;comment:角色关键字" json:"role_key"` // 角色关键字
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaAuthRole's table name
|
||||
func (*ScaAuthRole) TableName() string {
|
||||
return TableNameScaAuthRole
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaAuthRole struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键ID') pk autoincr notnull " json:"id"` // 主键ID
|
||||
RoleName string `xorm:"varchar(32) 'role_name' comment('角色名称') notnull " json:"role_name"` // 角色名称
|
||||
RoleKey string `xorm:"varchar(64) 'role_key' comment('角色关键字') notnull " json:"role_key"` // 角色关键字
|
||||
CreatedAt time.Time `xorm:"timestamp 'created_at' created comment('创建时间') default NULL " json:"created_at"` // 创建时间
|
||||
Deleted int8 `xorm:"tinyint(4) 'deleted' comment('是否删除 0 未删除 1 已删除') notnull default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt time.Time `xorm:"timestamp 'updated_at' updated comment('更新时间') default NULL " json:"updated_at"` // 更新时间
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
func (s *ScaAuthRole) TableName() string {
|
||||
return "sca_auth_role"
|
||||
}
|
40
app/core/api/repository/mysql/model/sca_auth_user.gen.go
Normal file
40
app/core/api/repository/mysql/model/sca_auth_user.gen.go
Normal file
@@ -0,0 +1,40 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaAuthUser = "sca_auth_user"
|
||||
|
||||
// ScaAuthUser mapped from table <sca_auth_user>
|
||||
type ScaAuthUser struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;uniqueIndex:id,priority:1;comment:自增ID" json:"id,string"` // 自增ID
|
||||
UID string `gorm:"column:uid;type:varchar(50);not null;uniqueIndex:uid,priority:1;comment:唯一ID" json:"uid"` // 唯一ID
|
||||
Username string `gorm:"column:username;type:varchar(32);comment:用户名" json:"username"` // 用户名
|
||||
Nickname string `gorm:"column:nickname;type:varchar(32);comment:昵称" json:"nickname"` // 昵称
|
||||
Email string `gorm:"column:email;type:varchar(32);comment:邮箱" json:"email"` // 邮箱
|
||||
Phone string `gorm:"column:phone;type:varchar(32);uniqueIndex:phone,priority:1;comment:电话" json:"phone"` // 电话
|
||||
Password string `gorm:"column:password;type:varchar(64);comment:密码" json:"password"` // 密码
|
||||
Gender int64 `gorm:"column:gender;type:tinyint;comment:性别" json:"gender"` // 性别
|
||||
Avatar string `gorm:"column:avatar;type:longtext;comment:头像" json:"avatar"` // 头像
|
||||
Status int64 `gorm:"column:status;type:tinyint;comment:状态 0 正常 1 封禁" json:"status"` // 状态 0 正常 1 封禁
|
||||
Introduce string `gorm:"column:introduce;type:varchar(255);comment:介绍" json:"introduce"` // 介绍
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Blog string `gorm:"column:blog;type:varchar(30);comment:博客" json:"blog"` // 博客
|
||||
Location string `gorm:"column:location;type:varchar(50);comment:地址" json:"location"` // 地址
|
||||
Company string `gorm:"column:company;type:varchar(50);comment:公司" json:"company"` // 公司
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaAuthUser's table name
|
||||
func (*ScaAuthUser) TableName() string {
|
||||
return TableNameScaAuthUser
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaAuthUser struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' unique comment('自增ID') pk autoincr notnull " json:"id"` // 自增ID
|
||||
UID string `xorm:"varchar(20) 'uid' comment('唯一ID') notnull " json:"uid"` // 唯一ID
|
||||
Username string `xorm:"varchar(32) 'username' comment('用户名') default NULL " json:"username"` // 用户名
|
||||
Nickname string `xorm:"varchar(32) 'nickname' comment('昵称') default NULL " json:"nickname"` // 昵称
|
||||
Email string `xorm:"varchar(32) 'email' comment('邮箱') default NULL " json:"email"` // 邮箱
|
||||
Phone string `xorm:"varchar(32) 'phone' comment('电话') default NULL " json:"phone"` // 电话
|
||||
Password string `xorm:"varchar(64) 'password' comment('密码') default NULL " json:"password"` // 密码
|
||||
Gender int8 `xorm:"tinyint(4) 'gender' comment('性别') default NULL " json:"gender"` // 性别
|
||||
Avatar string `xorm:"longtext 'avatar' comment('头像') " json:"avatar"` // 头像
|
||||
Status int8 `xorm:"tinyint(4) 'status' comment('状态 0 正常 1 封禁') default 0 " json:"status"` // 状态 0 正常 1 封禁
|
||||
Introduce string `xorm:"varchar(255) 'introduce' comment('介绍') default NULL " json:"introduce"` // 介绍
|
||||
CreatedAt time.Time `xorm:"timestamp created 'created_at' comment('创建时间') default CURRENT_TIMESTAMP " json:"created_at"` // 创建时间
|
||||
Deleted int8 `xorm:"tinyint(4) 'deleted' comment('是否删除 0 未删除 1 已删除') notnull default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Blog string `xorm:"varchar(30) 'blog' comment('博客') default NULL " json:"blog"` // 博客
|
||||
Location string `xorm:"varchar(50) 'location' comment('地址') default NULL " json:"location"` // 地址
|
||||
Company string `xorm:"varchar(50) 'company' comment('公司') default NULL " json:"company"` // 公司
|
||||
UpdatedAt time.Time `xorm:"timestamp updated 'updated_at' comment('更新时间') default NULL " json:"updated_at"` // 更新时间
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaAuthUser) TableName() string {
|
||||
return "sca_auth_user"
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaAuthUserDevice = "sca_auth_user_device"
|
||||
|
||||
// ScaAuthUserDevice mapped from table <sca_auth_user_device>
|
||||
type ScaAuthUserDevice struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键ID" json:"id,string"` // 主键ID
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
IP string `gorm:"column:ip;type:varchar(20);comment:登录IP" json:"ip"` // 登录IP
|
||||
Location string `gorm:"column:location;type:varchar(20);comment:地址" json:"location"` // 地址
|
||||
Agent string `gorm:"column:agent;type:varchar(255);comment:设备信息" json:"agent"` // 设备信息
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Browser string `gorm:"column:browser;type:varchar(20);comment:浏览器" json:"browser"` // 浏览器
|
||||
OperatingSystem string `gorm:"column:operating_system;type:varchar(20);comment:操作系统" json:"operating_system"` // 操作系统
|
||||
BrowserVersion string `gorm:"column:browser_version;type:varchar(20);comment:浏览器版本" json:"browser_version"` // 浏览器版本
|
||||
Mobile int64 `gorm:"column:mobile;type:tinyint(1);comment:是否为手机 0否1是" json:"mobile"` // 是否为手机 0否1是
|
||||
Bot int64 `gorm:"column:bot;type:tinyint(1);comment:是否为bot 0否1是" json:"bot"` // 是否为bot 0否1是
|
||||
Mozilla string `gorm:"column:mozilla;type:varchar(10);comment:火狐版本" json:"mozilla"` // 火狐版本
|
||||
Platform string `gorm:"column:platform;type:varchar(20);comment:平台" json:"platform"` // 平台
|
||||
EngineName string `gorm:"column:engine_name;type:varchar(20);comment:引擎名称" json:"engine_name"` // 引擎名称
|
||||
EngineVersion string `gorm:"column:engine_version;type:varchar(20);comment:引擎版本" json:"engine_version"` // 引擎版本
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaAuthUserDevice's table name
|
||||
func (*ScaAuthUserDevice) TableName() string {
|
||||
return TableNameScaAuthUserDevice
|
||||
}
|
@@ -1,29 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaAuthUserDevice struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键ID') pk autoincr notnull " json:"id"` // 主键ID
|
||||
UserId string `xorm:"varchar(20) 'user_id' comment('用户ID') notnull " json:"user_id"` // 用户ID
|
||||
Ip string `xorm:"varchar(20) 'ip' comment('登录IP') notnull " json:"ip"` // 登录IP
|
||||
Location string `xorm:"varchar(20) 'location' comment('地址') notnull " json:"location"` // 地址
|
||||
Agent string `xorm:"varchar(255) 'agent' comment('设备信息') notnull " json:"agent"` // 设备信息
|
||||
CreatedAt time.Time `xorm:"timestamp 'created_at' created comment('创建时间') default NULL " json:"created_at"` // 创建时间
|
||||
Deleted int8 `xorm:"tinyint(4) 'deleted' comment('是否删除 0 未删除 1 已删除') notnull default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Browser string `xorm:"varchar(20) 'browser' comment('浏览器') notnull " json:"browser"` // 浏览器
|
||||
OperatingSystem string `xorm:"varchar(20) 'operating_system' comment('操作系统') notnull " json:"operating_system"` // 操作系统
|
||||
BrowserVersion string `xorm:"varchar(20) 'browser_version' comment('浏览器版本') notnull " json:"browser_version"` // 浏览器版本
|
||||
Mobile bool `xorm:"tinyint(1) 'mobile' comment('是否为手机 0否1是') notnull " json:"mobile"` // 是否为手机 0否1是
|
||||
Bot bool `xorm:"tinyint(1) 'bot' comment('是否为bot 0否1是') notnull " json:"bot"` // 是否为bot 0否1是
|
||||
Mozilla string `xorm:"varchar(10) 'mozilla' comment('火狐版本') notnull " json:"mozilla"` // 火狐版本
|
||||
Platform string `xorm:"varchar(20) 'platform' comment('平台') notnull " json:"platform"` // 平台
|
||||
EngineName string `xorm:"varchar(20) 'engine_name' comment('引擎名称') notnull " json:"engine_name"` // 引擎名称
|
||||
EngineVersion string `xorm:"varchar(20) 'engine_version' comment('引擎版本') notnull " json:"engine_version"` // 引擎版本
|
||||
UpdatedAt time.Time `xorm:"timestamp 'updated_at' updated comment('更新时间') default NULL " json:"updated_at"` // 更新时间
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaAuthUserDevice) TableName() string {
|
||||
return "sca_auth_user_device"
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaAuthUserSocial = "sca_auth_user_social"
|
||||
|
||||
// ScaAuthUserSocial mapped from table <sca_auth_user_social>
|
||||
type ScaAuthUserSocial struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键ID" json:"id,string"` // 主键ID
|
||||
UserID string `gorm:"column:user_id;type:varchar(50);not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
OpenID string `gorm:"column:open_id;type:varchar(50);not null;comment:第三方用户的 open id" json:"open_id"` // 第三方用户的 open id
|
||||
Source string `gorm:"column:source;type:varchar(10);comment:第三方用户来源" json:"source"` // 第三方用户来源
|
||||
Status int64 `gorm:"column:status;type:bigint;comment:状态 0正常 1 封禁" json:"status"` // 状态 0正常 1 封禁
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaAuthUserSocial's table name
|
||||
func (*ScaAuthUserSocial) TableName() string {
|
||||
return TableNameScaAuthUserSocial
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaAuthUserSocial struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键ID') pk autoincr notnull " json:"id"` // 主键ID
|
||||
UserId string `xorm:"varchar(20) 'user_id' comment('用户ID') notnull " json:"user_id"` // 用户ID
|
||||
OpenId string `xorm:"varchar(50) 'open_id' comment('第三方用户的 open id') notnull " json:"open_id"` // 第三方用户的 open id
|
||||
Source string `xorm:"varchar(10) 'source' comment('第三方用户来源') notnull " json:"source"` // 第三方用户来源
|
||||
Status int64 `xorm:"bigint(20) 'status' comment('状态 0正常 1 封禁') notnull default 0 " json:"status"` // 状态 0正常 1 封禁
|
||||
CreatedAt time.Time `xorm:"timestamp 'created_at' created comment('创建时间') default NULL " json:"created_at"` // 创建时间
|
||||
Deleted int8 `xorm:"tinyint(4) 'deleted' comment('是否删除 0 未删除 1 已删除') notnull default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt time.Time `xorm:"timestamp 'updated_at'updated comment('更新时间') default NULL " json:"updated_at"` // 更新时间
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaAuthUserSocial) TableName() string {
|
||||
return "sca_auth_user_social"
|
||||
}
|
25
app/core/api/repository/mysql/model/sca_comment_likes.gen.go
Normal file
25
app/core/api/repository/mysql/model/sca_comment_likes.gen.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const TableNameScaCommentLike = "sca_comment_likes"
|
||||
|
||||
// ScaCommentLike mapped from table <sca_comment_likes>
|
||||
type ScaCommentLike struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键id" json:"id,string"` // 主键id
|
||||
TopicID string `gorm:"column:topic_id;type:varchar(50);not null;comment:话题ID" json:"topic_id"` // 话题ID
|
||||
UserID string `gorm:"column:user_id;type:varchar(50);not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
CommentID int64 `gorm:"column:comment_id;type:bigint;not null;comment:评论ID" json:"comment_id"` // 评论ID
|
||||
LikeTime time.Time `gorm:"column:like_time;type:timestamp;comment:点赞时间" json:"like_time"` // 点赞时间
|
||||
}
|
||||
|
||||
// TableName ScaCommentLike's table name
|
||||
func (*ScaCommentLike) TableName() string {
|
||||
return TableNameScaCommentLike
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaCommentLikes struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键id') pk autoincr notnull " json:"id"` // 主键id
|
||||
TopicId string `xorm:"varchar(255) 'topic_id' comment('话题ID') notnull " json:"topic_id"` // 话题ID
|
||||
UserId string `xorm:"varchar(255) 'user_id' comment('用户ID') notnull " json:"user_id"` // 用户ID
|
||||
CommentId int64 `xorm:"bigint(20) 'comment_id' comment('评论ID') notnull " json:"comment_id"` // 评论ID
|
||||
LikeTime time.Time `xorm:"timestamp 'like_time' created comment('点赞时间') default NULL " json:"like_time"` // 点赞时间
|
||||
}
|
||||
|
||||
func (s *ScaCommentLikes) TableName() string {
|
||||
return "sca_comment_likes"
|
||||
}
|
44
app/core/api/repository/mysql/model/sca_comment_reply.gen.go
Normal file
44
app/core/api/repository/mysql/model/sca_comment_reply.gen.go
Normal file
@@ -0,0 +1,44 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaCommentReply = "sca_comment_reply"
|
||||
|
||||
// ScaCommentReply mapped from table <sca_comment_reply>
|
||||
type ScaCommentReply struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;uniqueIndex:id,priority:1;comment:主键id" json:"id,string"` // 主键id
|
||||
UserID string `gorm:"column:user_id;type:varchar(50);not null;comment:评论用户id" json:"user_id"` // 评论用户id
|
||||
TopicID string `gorm:"column:topic_id;type:varchar(50);comment:评论话题id" json:"topic_id"` // 评论话题id
|
||||
TopicType int64 `gorm:"column:topic_type;type:tinyint;comment:话题类型" json:"topic_type"` // 话题类型
|
||||
Content string `gorm:"column:content;type:text;comment:评论内容" json:"content"` // 评论内容
|
||||
CommentType int64 `gorm:"column:comment_type;type:bigint;comment:评论类型 0评论 1 回复" json:"comment_type"` // 评论类型 0评论 1 回复
|
||||
ReplyTo int64 `gorm:"column:reply_to;type:bigint;comment:回复子评论ID" json:"reply_to"` // 回复子评论ID
|
||||
ReplyID int64 `gorm:"column:reply_id;type:bigint;comment:回复父评论Id" json:"reply_id"` // 回复父评论Id
|
||||
ReplyUser string `gorm:"column:reply_user;type:varchar(50);comment:回复人id" json:"reply_user"` // 回复人id
|
||||
Author int64 `gorm:"column:author;type:tinyint;comment:评论回复是否作者 0否 1是" json:"author"` // 评论回复是否作者 0否 1是
|
||||
Likes int64 `gorm:"column:likes;type:bigint;comment:点赞数" json:"likes"` // 点赞数
|
||||
ReplyCount int64 `gorm:"column:reply_count;type:bigint;comment:回复数量" json:"reply_count"` // 回复数量
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Browser string `gorm:"column:browser;type:varchar(50);comment:浏览器" json:"browser"` // 浏览器
|
||||
OperatingSystem string `gorm:"column:operating_system;type:varchar(50);comment:操作系统" json:"operating_system"` // 操作系统
|
||||
CommentIP string `gorm:"column:comment_ip;type:varchar(50);comment:IP地址" json:"comment_ip"` // IP地址
|
||||
Location string `gorm:"column:location;type:varchar(50);comment:地址" json:"location"` // 地址
|
||||
Agent string `gorm:"column:agent;type:varchar(255);comment:设备信息" json:"agent"` // 设备信息
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Version int64 `gorm:"column:version;type:bigint;comment:版本" json:"version"` // 版本
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaCommentReply's table name
|
||||
func (*ScaCommentReply) TableName() string {
|
||||
return TableNameScaCommentReply
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaCommentReply struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键id') pk autoincr notnull " json:"id"` // 主键id
|
||||
UserId string `xorm:"varchar(255) 'user_id' comment('评论用户id') notnull " json:"user_id"` // 评论用户id
|
||||
TopicId string `xorm:"varchar(255) 'topic_id' comment('评论话题id') notnull " json:"topic_id"` // 评论话题id
|
||||
TopicType int `xorm:"bigint(20) 'topic_type' comment('话题类型') notnull " json:"topic_type"` // 话题类型
|
||||
Content string `xorm:"varchar(255) 'content' comment('评论内容') notnull " json:"content"` // 评论内容
|
||||
CommentType int `xorm:"bigint(20) 'comment_type' comment('评论类型 0评论 1 回复') notnull " json:"comment_type"` // 评论类型 0评论 1 回复
|
||||
ReplyTo int64 `xorm:"bigint(20) 'reply_to' comment('回复子评论ID') default NULL " json:"reply_to"` // 回复子评论ID
|
||||
ReplyId int64 `xorm:"bigint(20) 'reply_id' comment('回复父评论Id') default NULL " json:"reply_id"` // 回复父评论Id
|
||||
ReplyUser string `xorm:"varchar(255) 'reply_user' comment('回复人id') default NULL " json:"reply_user"` // 回复人id
|
||||
Author int `xorm:"bigint(20) 'author' comment('评论回复是否作者 0否 1是') notnull default 0 " json:"author"` // 评论回复是否作者 0否 1是
|
||||
Likes int64 `xorm:"bigint(20) 'likes' comment('点赞数') default 0 " json:"likes"` // 点赞数
|
||||
ReplyCount int64 `xorm:"bigint(20) 'reply_count' comment('回复数量') default 0 " json:"reply_count"` // 回复数量
|
||||
Deleted int8 `xorm:"tinyint(4) 'deleted' comment('是否删除 0 未删除 1 已删除') notnull default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
Browser string `xorm:"varchar(255) 'browser' comment('浏览器') notnull " json:"browser"` // 浏览器
|
||||
OperatingSystem string `xorm:"varchar(255) 'operating_system' comment('操作系统') notnull " json:"operating_system"` // 操作系统
|
||||
CommentIp string `xorm:"varchar(255) 'comment_ip' comment('IP地址') notnull " json:"comment_ip"` // IP地址
|
||||
Location string `xorm:"varchar(255) 'location' comment('地址') notnull " json:"location"` // 地址
|
||||
Agent string `xorm:"varchar(255) 'agent' comment('设备信息') notnull " json:"agent"` // 设备信息
|
||||
CreatedAt time.Time `xorm:"timestamp 'created_at' created comment('创建时间') default NULL " json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"timestamp 'updated_at' updated comment('更新时间') default NULL " json:"updated_at"` // 更新时间
|
||||
Version int64 `xorm:"bigint(20) 'version' version comment('版本') default 0 " json:"version"` // 版本
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaCommentReply) TableName() string {
|
||||
return "sca_comment_reply"
|
||||
}
|
32
app/core/api/repository/mysql/model/sca_file_folder.gen.go
Normal file
32
app/core/api/repository/mysql/model/sca_file_folder.gen.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaFileFolder = "sca_file_folder"
|
||||
|
||||
// ScaFileFolder mapped from table <sca_file_folder>
|
||||
type ScaFileFolder struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
FolderName string `gorm:"column:folder_name;type:varchar(512);comment:文件夹名称" json:"folder_name"` // 文件夹名称
|
||||
ParentFolderID int64 `gorm:"column:parent_folder_id;type:bigint;comment:父文件夹编号" json:"parent_folder_id"` // 父文件夹编号
|
||||
FolderAddr string `gorm:"column:folder_addr;type:varchar(1024);comment:文件夹名称" json:"folder_addr"` // 文件夹名称
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户编号" json:"user_id"` // 用户编号
|
||||
FolderSource int64 `gorm:"column:folder_source;type:int;comment:文件夹来源 0相册 1 评论" json:"folder_source"` // 文件夹来源 0相册 1 评论
|
||||
CreatedTime *time.Time `gorm:"column:created_time;type:datetime;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_time"` // 创建时间
|
||||
UpdateTime *time.Time `gorm:"column:update_time;type:datetime;default:CURRENT_TIMESTAMP;comment:更新时间" json:"update_time"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaFileFolder's table name
|
||||
func (*ScaFileFolder) TableName() string {
|
||||
return TableNameScaFileFolder
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaFileFolder struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键') pk autoincr notnull " json:"id"` // 主键
|
||||
FolderName string `xorm:"varchar(512) 'folder_name' comment('文件夹名称') default NULL " json:"folder_name"` // 文件夹名称
|
||||
ParentFolderId int64 `xorm:"bigint(20) 'parent_folder_id' comment('父文件夹编号') default NULL " json:"parent_folder_id"` // 父文件夹编号
|
||||
FolderAddr string `xorm:"varchar(1024) 'folder_addr' comment('文件夹名称') default NULL " json:"folder_addr"` // 文件夹名称
|
||||
UserId string `xorm:"varchar(20) 'user_id' comment('用户编号') default NULL " json:"user_id"` // 用户编号
|
||||
FolderSource int32 `xorm:"int(11) 'folder_source' comment('文件夹来源 0相册 1 评论') default NULL " json:"folder_source"` // 文件夹来源 0相册 1 评论
|
||||
CreatedAt time.Time `xorm:"datetime 'created_time' created comment('创建时间') default CURRENT_TIMESTAMP " json:"created_time"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"datetime 'update_time' updated comment('更新时间') default CURRENT_TIMESTAMP " json:"update_time"` // 更新时间
|
||||
Deleted int32 `xorm:"int(11) 'deleted' comment('是否删除 0 未删除 1 已删除') default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaFileFolder) TableName() string {
|
||||
return "sca_file_folder"
|
||||
}
|
35
app/core/api/repository/mysql/model/sca_file_info.gen.go
Normal file
35
app/core/api/repository/mysql/model/sca_file_info.gen.go
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaFileInfo = "sca_file_info"
|
||||
|
||||
// ScaFileInfo mapped from table <sca_file_info>
|
||||
type ScaFileInfo struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
FileName string `gorm:"column:file_name;type:varchar(50);comment:文件名" json:"file_name"` // 文件名
|
||||
FileSize float64 `gorm:"column:file_size;type:double;comment:文件大小" json:"file_size"` // 文件大小
|
||||
FileTypeID int64 `gorm:"column:file_type_id;type:bigint;comment:文件类型编号" json:"file_type_id"` // 文件类型编号
|
||||
UploadTime time.Time `gorm:"column:upload_time;type:datetime;comment:上传时间" json:"upload_time"` // 上传时间
|
||||
FolderID int64 `gorm:"column:folder_id;type:bigint;comment:文件夹编号" json:"folder_id"` // 文件夹编号
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户编号" json:"user_id"` // 用户编号
|
||||
FileSource int64 `gorm:"column:file_source;type:int;comment:文件来源 0 相册 1 评论" json:"file_source"` // 文件来源 0 相册 1 评论
|
||||
Status int64 `gorm:"column:status;type:int;comment:文件状态" json:"status"` // 文件状态
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:datetime;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:datetime;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaFileInfo's table name
|
||||
func (*ScaFileInfo) TableName() string {
|
||||
return TableNameScaFileInfo
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaFileInfo struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键') pk autoincr notnull " json:"id"` // 主键
|
||||
FileName string `xorm:"varchar(50) 'file_name' comment('文件名') default NULL " json:"file_name"` // 文件名
|
||||
FileSize float64 `xorm:"double 'file_size' comment('文件大小') default NULL " json:"file_size"` // 文件大小
|
||||
FileTypeId int64 `xorm:"bigint(20) 'file_type_id' comment('文件类型编号') default NULL " json:"file_type_id"` // 文件类型编号
|
||||
UploadTime time.Time `xorm:"datetime 'upload_time' comment('上传时间') default NULL " json:"upload_time"` // 上传时间
|
||||
FolderId int64 `xorm:"bigint(20) 'folder_id' comment('文件夹编号') default NULL " json:"folder_id"` // 文件夹编号
|
||||
UserId string `xorm:"varchar(20) 'user_id' comment('用户编号') default NULL " json:"user_id"` // 用户编号
|
||||
FileSource int32 `xorm:"int(11) 'file_source' comment('文件来源 0 相册 1 评论') default NULL " json:"file_source"` // 文件来源 0 相册 1 评论
|
||||
Status int32 `xorm:"int(11) 'status' comment('文件状态') default NULL " json:"status"` // 文件状态
|
||||
CreatedAt time.Time `xorm:"datetime 'created_at' created comment('创建时间') default CURRENT_TIMESTAMP " json:"created_time"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"datetime 'updated_at' updated comment('更新时间') default CURRENT_TIMESTAMP " json:"update_time"` // 更新时间
|
||||
Deleted int32 `xorm:"int(11) 'deleted' comment('是否删除 0 未删除 1 已删除') default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaFileInfo) TableName() string {
|
||||
return "sca_file_info"
|
||||
}
|
29
app/core/api/repository/mysql/model/sca_file_recycle.gen.go
Normal file
29
app/core/api/repository/mysql/model/sca_file_recycle.gen.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaFileRecycle = "sca_file_recycle"
|
||||
|
||||
// ScaFileRecycle mapped from table <sca_file_recycle>
|
||||
type ScaFileRecycle struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
FileID int64 `gorm:"column:file_id;type:bigint;comment:文件编号" json:"file_id"` // 文件编号
|
||||
FolderID int64 `gorm:"column:folder_id;type:bigint;comment:文件夹编号" json:"folder_id"` // 文件夹编号
|
||||
Type int64 `gorm:"column:type;type:int;comment:类型 0 文件 1 文件夹" json:"type"` // 类型 0 文件 1 文件夹
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户编号" json:"user_id"` // 用户编号
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
OriginalPath string `gorm:"column:original_path;type:varchar(1024);comment:原始路径" json:"original_path"` // 原始路径
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否被永久删除 0否 1是" json:"deleted"` // 是否被永久删除 0否 1是
|
||||
FileSource int64 `gorm:"column:file_source;type:int;comment:文件来源 0 相册 1 评论" json:"file_source"` // 文件来源 0 相册 1 评论
|
||||
}
|
||||
|
||||
// TableName ScaFileRecycle's table name
|
||||
func (*ScaFileRecycle) TableName() string {
|
||||
return TableNameScaFileRecycle
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaFileRecycle struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键') pk autoincr notnull " json:"id"` // 主键
|
||||
FileId int64 `xorm:"bigint(20) 'file_id' comment('文件编号') default NULL " json:"file_id"` // 文件编号
|
||||
FolderId int64 `xorm:"bigint(20) 'folder_id' comment('文件夹编号') default NULL " json:"folder_id"` // 文件夹编号
|
||||
Type int32 `xorm:"int(11) 'type' comment('类型 0 文件 1 文件夹') default NULL " json:"type"` // 类型 0 文件 1 文件夹
|
||||
UserId string `xorm:"varchar(20) 'user_id' comment('用户编号') default NULL " json:"user_id"` // 用户编号
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
OriginalPath string `xorm:"varchar(1024) 'original_path' comment('原始路径') default NULL " json:"original_path"` // 原始路径
|
||||
Deleted int32 `xorm:"int(11) 'deleted' comment('是否被永久删除 0否 1是') default NULL " json:"deleted"` // 是否被永久删除 0否 1是
|
||||
FileSource int32 `xorm:"int(11) 'file_source' comment('文件来源 0 相册 1 评论') default NULL " json:"file_source"` // 文件来源 0 相册 1 评论
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaFileRecycle) TableName() string {
|
||||
return "sca_file_recycle"
|
||||
}
|
30
app/core/api/repository/mysql/model/sca_file_type.gen.go
Normal file
30
app/core/api/repository/mysql/model/sca_file_type.gen.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaFileType = "sca_file_type"
|
||||
|
||||
// ScaFileType mapped from table <sca_file_type>
|
||||
type ScaFileType struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
TypeName string `gorm:"column:type_name;type:varchar(100);comment:类型名称" json:"type_name"` // 类型名称
|
||||
MimeType string `gorm:"column:mime_type;type:varchar(50);comment:MIME 类型" json:"mime_type"` // MIME 类型
|
||||
Status int64 `gorm:"column:status;type:int;comment:类型状态" json:"status"` // 类型状态
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:datetime;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:datetime;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:int;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaFileType's table name
|
||||
func (*ScaFileType) TableName() string {
|
||||
return TableNameScaFileType
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaFileType struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键') pk autoincr notnull " json:"id"` // 主键
|
||||
TypeName string `xorm:"varchar(100) 'type_name' comment('类型名称') default NULL " json:"type_name"` // 类型名称
|
||||
MimeType string `xorm:"varchar(50) 'mime_type' comment('MIME 类型') default NULL " json:"mime_type"` // MIME 类型
|
||||
Status int32 `xorm:"int(11) 'status' comment('类型状态') default NULL " json:"status"` // 类型状态
|
||||
CreatedAt time.Time `xorm:"datetime 'created_at' created comment('创建时间') default CURRENT_TIMESTAMP " json:"created_time"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"datetime 'updated_at' updated comment('更新时间') default CURRENT_TIMESTAMP " json:"update_time"` // 更新时间
|
||||
Deleted int32 `xorm:"int(11) 'deleted' comment('是否删除 0 未删除 1 已删除') default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaFileType) TableName() string {
|
||||
return "sca_file_type"
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaMessageReport = "sca_message_report"
|
||||
|
||||
// ScaMessageReport mapped from table <sca_message_report>
|
||||
type ScaMessageReport struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
UserID string `gorm:"column:user_id;type:varchar(20);comment:用户Id" json:"user_id"` // 用户Id
|
||||
Type int64 `gorm:"column:type;type:tinyint;comment:举报类型 0评论 1 相册" json:"type"` // 举报类型 0评论 1 相册
|
||||
CommentID int64 `gorm:"column:comment_id;type:bigint;comment:评论Id" json:"comment_id"` // 评论Id
|
||||
TopicID string `gorm:"column:topic_id;type:varchar(20);comment:话题Id" json:"topic_id"` // 话题Id
|
||||
ReportType int64 `gorm:"column:report_type;type:tinyint;comment:举报" json:"report_type"` // 举报
|
||||
ReportContent string `gorm:"column:report_content;type:text;comment:举报说明内容" json:"report_content"` // 举报说明内容
|
||||
ReportTag string `gorm:"column:report_tag;type:varchar(255);comment:举报标签" json:"report_tag"` // 举报标签
|
||||
Status int64 `gorm:"column:status;type:tinyint;comment:状态(0 未处理 1 已处理)" json:"status"` // 状态(0 未处理 1 已处理)
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdateBy string `gorm:"column:update_by;type:varchar(32);comment:更新人" json:"update_by"` // 更新人
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0否 1是" json:"deleted"` // 是否删除 0否 1是
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaMessageReport's table name
|
||||
func (*ScaMessageReport) TableName() string {
|
||||
return TableNameScaMessageReport
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaMessageReport struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键') pk autoincr notnull " json:"id"` // 主键
|
||||
UserId string `xorm:"varchar(20) 'user_id' comment('用户Id') default NULL " json:"user_id"` // 用户Id
|
||||
Type int32 `xorm:"int(11) 'type' comment('举报类型 0评论 1 相册') default NULL " json:"type"` // 举报类型 0评论 1 相册
|
||||
CommentId int64 `xorm:"bigint(20) 'comment_id' comment('评论Id') default NULL " json:"comment_id"` // 评论Id
|
||||
TopicId string `xorm:"varchar(20) 'topic_id' comment('话题Id') default NULL " json:"topic_id"` // 话题Id
|
||||
ReportType string `xorm:"varchar(255) 'report_type' comment('举报') default NULL " json:"report_type"` // 举报
|
||||
ReportContent string `xorm:"longtext 'report_content' comment('举报说明内容') " json:"report_content"` // 举报说明内容
|
||||
ReportTag string `xorm:"varchar(255) 'report_tag' comment('举报标签') default NULL " json:"report_tag"` // 举报标签
|
||||
Status int32 `xorm:"int(11) 'status' comment('状态(0 未处理 1 已处理)') default NULL " json:"status"` // 状态(0 未处理 1 已处理)
|
||||
CreatedAt time.Time `xorm:"datetime 'created_at' comment('创建时间') default CURRENT_TIMESTAMP " json:"created_time"` // 创建时间
|
||||
UpdateBy string `xorm:"varchar(32) 'update_by' created comment('更新人') default NULL " json:"update_by"` // 更新人
|
||||
UpdatedAt time.Time `xorm:"datetime 'updated_at' updated comment('更新时间') default CURRENT_TIMESTAMP " json:"update_time"` // 更新时间
|
||||
Deleted int32 `xorm:"int(11) 'deleted' comment('是否删除 0否 1是') default 0 " json:"deleted"` // 是否删除 0否 1是
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaMessageReport) TableName() string {
|
||||
return "sca_message_report"
|
||||
}
|
29
app/core/api/repository/mysql/model/sca_user_follows.gen.go
Normal file
29
app/core/api/repository/mysql/model/sca_user_follows.gen.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaUserFollow = "sca_user_follows"
|
||||
|
||||
// ScaUserFollow mapped from table <sca_user_follows>
|
||||
type ScaUserFollow struct {
|
||||
FollowerID string `gorm:"column:follower_id;type:varchar(50);not null;comment:关注者" json:"follower_id"` // 关注者
|
||||
FolloweeID string `gorm:"column:followee_id;type:varchar(50);not null;comment:被关注者" json:"followee_id"` // 被关注者
|
||||
Status int64 `gorm:"column:status;type:tinyint unsigned;not null;comment:关注状态(0 未互关 1 互关)" json:"status"` // 关注状态(0 未互关 1 互关)
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id,string"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaUserFollow's table name
|
||||
func (*ScaUserFollow) TableName() string {
|
||||
return TableNameScaUserFollow
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaUserFollows struct {
|
||||
FollowerId string `xorm:"varchar(255) 'follower_id' comment('关注者') notnull " json:"follower_id"` // 关注者
|
||||
FolloweeId string `xorm:"varchar(255) 'followee_id' comment('被关注者') notnull " json:"followee_id"` // 被关注者
|
||||
Status uint8 `xorm:"tinyint(3) UNSIGNED 'status' comment('关注状态(0 未互关 1 互关)') notnull default 0 " json:"status"` // 关注状态(0 未互关 1 互关)
|
||||
CreatedAt time.Time `xorm:"datetime 'created_at' created comment('创建时间') default CURRENT_TIMESTAMP " json:"created_time"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"datetime 'updated_at' updated comment('更新时间') default CURRENT_TIMESTAMP " json:"update_time"` // 更新时间
|
||||
Id int64 `xorm:"bigint(20) 'id' pk autoincr notnull " json:"id"`
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaUserFollows) TableName() string {
|
||||
return "sca_user_follows"
|
||||
}
|
33
app/core/api/repository/mysql/model/sca_user_level.gen.go
Normal file
33
app/core/api/repository/mysql/model/sca_user_level.gen.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaUserLevel = "sca_user_level"
|
||||
|
||||
// ScaUserLevel mapped from table <sca_user_level>
|
||||
type ScaUserLevel struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;comment:主键" json:"id,string"` // 主键
|
||||
UserID string `gorm:"column:user_id;type:varchar(50);comment:用户Id" json:"user_id"` // 用户Id
|
||||
LevelType int64 `gorm:"column:level_type;type:tinyint unsigned;comment:等级类型" json:"level_type"` // 等级类型
|
||||
Level int64 `gorm:"column:level;type:int;comment:等级" json:"level"` // 等级
|
||||
LevelName string `gorm:"column:level_name;type:varchar(50);comment:等级名称" json:"level_name"` // 等级名称
|
||||
ExpStart int64 `gorm:"column:exp_start;type:bigint;comment:开始经验值" json:"exp_start"` // 开始经验值
|
||||
ExpEnd int64 `gorm:"column:exp_end;type:bigint;comment:结束经验值" json:"exp_end"` // 结束经验值
|
||||
Description string `gorm:"column:description;type:text;comment:等级描述" json:"description"` // 等级描述
|
||||
CreatedAt *time.Time `gorm:"column:created_at;type:timestamp;default:CURRENT_TIMESTAMP;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt *time.Time `gorm:"column:updated_at;type:timestamp;default:CURRENT_TIMESTAMP;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaUserLevel's table name
|
||||
func (*ScaUserLevel) TableName() string {
|
||||
return TableNameScaUserLevel
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaUserLevel struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键') pk notnull " json:"id"` // 主键
|
||||
UserId string `xorm:"varchar(255) 'user_id' comment('用户Id') notnull " json:"user_id"` // 用户Id
|
||||
LevelType uint8 `xorm:"tinyint(3) UNSIGNED 'level_type' comment('等级类型') notnull " json:"level_type"` // 等级类型
|
||||
Level int64 `xorm:"bigint(20) 'level' comment('等级') notnull " json:"level"` // 等级
|
||||
LevelName string `xorm:"varchar(50) 'level_name' comment('等级名称') notnull " json:"level_name"` // 等级名称
|
||||
ExpStart int64 `xorm:"bigint(20) 'exp_start' comment('开始经验值') notnull " json:"exp_start"` // 开始经验值
|
||||
ExpEnd int64 `xorm:"bigint(20) 'exp_end' comment('结束经验值') notnull " json:"exp_end"` // 结束经验值
|
||||
Description string `xorm:"longtext 'description' comment('等级描述') " json:"description"` // 等级描述
|
||||
CreatedAt time.Time `xorm:"datetime 'created_at' created comment('创建时间') default CURRENT_TIMESTAMP " json:"created_time"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"datetime 'updated_at' updated comment('更新时间') default CURRENT_TIMESTAMP " json:"update_time"` // 更新时间
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
|
||||
}
|
||||
|
||||
func (s *ScaUserLevel) TableName() string {
|
||||
return "sca_user_level"
|
||||
}
|
32
app/core/api/repository/mysql/model/sca_user_message.gen.go
Normal file
32
app/core/api/repository/mysql/model/sca_user_message.gen.go
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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 model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameScaUserMessage = "sca_user_message"
|
||||
|
||||
// ScaUserMessage mapped from table <sca_user_message>
|
||||
type ScaUserMessage struct {
|
||||
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键" json:"id,string"` // 主键
|
||||
TopicID string `gorm:"column:topic_id;type:varchar(50);comment:话题Id" json:"topic_id"` // 话题Id
|
||||
FromID string `gorm:"column:from_id;type:varchar(50);comment:来自人" json:"from_id"` // 来自人
|
||||
ToID string `gorm:"column:to_id;type:varchar(50);comment:送达人" json:"to_id"` // 送达人
|
||||
Content string `gorm:"column:content;type:text;comment:消息内容" json:"content"` // 消息内容
|
||||
IsRead int64 `gorm:"column:is_read;type:tinyint;comment:是否已读" json:"is_read"` // 是否已读
|
||||
Deleted int64 `gorm:"column:deleted;type:tinyint;comment:是否删除 0 未删除 1 已删除" json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;autoCreateTime;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;autoUpdateTime;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:timestamp;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ScaUserMessage's table name
|
||||
func (*ScaUserMessage) TableName() string {
|
||||
return TableNameScaUserMessage
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type ScaUserMessage struct {
|
||||
Id int64 `xorm:"bigint(20) 'id' comment('主键') pk autoincr notnull " json:"id"` // 主键
|
||||
TopicId string `xorm:"varchar(255) 'topic_id' comment('话题Id') notnull " json:"topic_id"` // 话题Id
|
||||
FromId string `xorm:"varchar(255) 'from_id' comment('来自人') notnull " json:"from_id"` // 来自人
|
||||
ToId string `xorm:"varchar(255) 'to_id' comment('送达人') notnull " json:"to_id"` // 送达人
|
||||
Content string `xorm:"varchar(255) 'content' comment('消息内容') notnull " json:"content"` // 消息内容
|
||||
IsRead int64 `xorm:"bigint(20) 'is_read' comment('是否已读') default NULL " json:"is_read"` // 是否已读
|
||||
CreatedBy string `xorm:"varchar(32) 'created_by' comment('创建人') default NULL " json:"created_by"` // 创建人
|
||||
CreatedTime time.Time `xorm:"datetime 'created_time' comment('创建时间') default CURRENT_TIMESTAMP " json:"created_time"` // 创建时间
|
||||
UpdateBy string `xorm:"varchar(32) 'update_by' comment('更新人') default NULL " json:"update_by"` // 更新人
|
||||
UpdateTime time.Time `xorm:"datetime 'update_time' comment('更新时间') default CURRENT_TIMESTAMP " json:"update_time"` // 更新时间
|
||||
Deleted int8 `xorm:"tinyint(4) 'deleted' comment('是否删除 0 未删除 1 已删除') notnull default 0 " json:"deleted"` // 是否删除 0 未删除 1 已删除
|
||||
CreatedAt time.Time `xorm:"timestamp 'created_at' created comment('创建时间') default NULL " json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `xorm:"timestamp 'updated_at' updated comment('更新时间') default NULL " json:"updated_at"` // 更新时间
|
||||
DeletedAt time.Time `xorm:"datetime 'deleted_at' deleted comment('删除时间') default NULL " json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
func (s *ScaUserMessage) TableName() string {
|
||||
return "sca_user_message"
|
||||
}
|
40
app/core/api/repository/mysql/mysql.go
Normal file
40
app/core/api/repository/mysql/mysql.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/query"
|
||||
)
|
||||
|
||||
func NewMySQL(url string, maxOpenConn int, maxIdleConn int) (*gorm.DB, *query.Query) {
|
||||
db, err := gorm.Open(mysql.Open(url), &gorm.Config{
|
||||
SkipDefaultTransaction: true,
|
||||
PrepareStmt: true,
|
||||
Logger: logger.New(
|
||||
log.New(os.Stdout, "\r\n", log.LstdFlags),
|
||||
logger.Config{
|
||||
SlowThreshold: time.Second, // 慢sql日志
|
||||
LogLevel: logger.Info, // 级别
|
||||
Colorful: true, // 颜色
|
||||
IgnoreRecordNotFoundError: true, // 忽略RecordNotFoundError
|
||||
ParameterizedQueries: true, // 格式化SQL语句
|
||||
}),
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
sqlDB, err := db.DB()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
sqlDB.SetMaxOpenConns(maxOpenConn)
|
||||
sqlDB.SetMaxIdleConns(maxIdleConn)
|
||||
useDB := query.Use(db)
|
||||
return db, useDB
|
||||
}
|
223
app/core/api/repository/mysql/query/gen.go
Normal file
223
app/core/api/repository/mysql/query/gen.go
Normal file
@@ -0,0 +1,223 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"gorm.io/gen"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
)
|
||||
|
||||
var (
|
||||
Q = new(Query)
|
||||
ScaAuthMenu *scaAuthMenu
|
||||
ScaAuthPermissionRule *scaAuthPermissionRule
|
||||
ScaAuthRole *scaAuthRole
|
||||
ScaAuthUser *scaAuthUser
|
||||
ScaAuthUserDevice *scaAuthUserDevice
|
||||
ScaAuthUserSocial *scaAuthUserSocial
|
||||
ScaCommentLike *scaCommentLike
|
||||
ScaCommentReply *scaCommentReply
|
||||
ScaFileFolder *scaFileFolder
|
||||
ScaFileInfo *scaFileInfo
|
||||
ScaFileRecycle *scaFileRecycle
|
||||
ScaFileType *scaFileType
|
||||
ScaMessageReport *scaMessageReport
|
||||
ScaUserFollow *scaUserFollow
|
||||
ScaUserLevel *scaUserLevel
|
||||
ScaUserMessage *scaUserMessage
|
||||
)
|
||||
|
||||
func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
||||
*Q = *Use(db, opts...)
|
||||
ScaAuthMenu = &Q.ScaAuthMenu
|
||||
ScaAuthPermissionRule = &Q.ScaAuthPermissionRule
|
||||
ScaAuthRole = &Q.ScaAuthRole
|
||||
ScaAuthUser = &Q.ScaAuthUser
|
||||
ScaAuthUserDevice = &Q.ScaAuthUserDevice
|
||||
ScaAuthUserSocial = &Q.ScaAuthUserSocial
|
||||
ScaCommentLike = &Q.ScaCommentLike
|
||||
ScaCommentReply = &Q.ScaCommentReply
|
||||
ScaFileFolder = &Q.ScaFileFolder
|
||||
ScaFileInfo = &Q.ScaFileInfo
|
||||
ScaFileRecycle = &Q.ScaFileRecycle
|
||||
ScaFileType = &Q.ScaFileType
|
||||
ScaMessageReport = &Q.ScaMessageReport
|
||||
ScaUserFollow = &Q.ScaUserFollow
|
||||
ScaUserLevel = &Q.ScaUserLevel
|
||||
ScaUserMessage = &Q.ScaUserMessage
|
||||
}
|
||||
|
||||
func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
ScaAuthMenu: newScaAuthMenu(db, opts...),
|
||||
ScaAuthPermissionRule: newScaAuthPermissionRule(db, opts...),
|
||||
ScaAuthRole: newScaAuthRole(db, opts...),
|
||||
ScaAuthUser: newScaAuthUser(db, opts...),
|
||||
ScaAuthUserDevice: newScaAuthUserDevice(db, opts...),
|
||||
ScaAuthUserSocial: newScaAuthUserSocial(db, opts...),
|
||||
ScaCommentLike: newScaCommentLike(db, opts...),
|
||||
ScaCommentReply: newScaCommentReply(db, opts...),
|
||||
ScaFileFolder: newScaFileFolder(db, opts...),
|
||||
ScaFileInfo: newScaFileInfo(db, opts...),
|
||||
ScaFileRecycle: newScaFileRecycle(db, opts...),
|
||||
ScaFileType: newScaFileType(db, opts...),
|
||||
ScaMessageReport: newScaMessageReport(db, opts...),
|
||||
ScaUserFollow: newScaUserFollow(db, opts...),
|
||||
ScaUserLevel: newScaUserLevel(db, opts...),
|
||||
ScaUserMessage: newScaUserMessage(db, opts...),
|
||||
}
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
db *gorm.DB
|
||||
|
||||
ScaAuthMenu scaAuthMenu
|
||||
ScaAuthPermissionRule scaAuthPermissionRule
|
||||
ScaAuthRole scaAuthRole
|
||||
ScaAuthUser scaAuthUser
|
||||
ScaAuthUserDevice scaAuthUserDevice
|
||||
ScaAuthUserSocial scaAuthUserSocial
|
||||
ScaCommentLike scaCommentLike
|
||||
ScaCommentReply scaCommentReply
|
||||
ScaFileFolder scaFileFolder
|
||||
ScaFileInfo scaFileInfo
|
||||
ScaFileRecycle scaFileRecycle
|
||||
ScaFileType scaFileType
|
||||
ScaMessageReport scaMessageReport
|
||||
ScaUserFollow scaUserFollow
|
||||
ScaUserLevel scaUserLevel
|
||||
ScaUserMessage scaUserMessage
|
||||
}
|
||||
|
||||
func (q *Query) Available() bool { return q.db != nil }
|
||||
|
||||
func (q *Query) clone(db *gorm.DB) *Query {
|
||||
return &Query{
|
||||
db: db,
|
||||
ScaAuthMenu: q.ScaAuthMenu.clone(db),
|
||||
ScaAuthPermissionRule: q.ScaAuthPermissionRule.clone(db),
|
||||
ScaAuthRole: q.ScaAuthRole.clone(db),
|
||||
ScaAuthUser: q.ScaAuthUser.clone(db),
|
||||
ScaAuthUserDevice: q.ScaAuthUserDevice.clone(db),
|
||||
ScaAuthUserSocial: q.ScaAuthUserSocial.clone(db),
|
||||
ScaCommentLike: q.ScaCommentLike.clone(db),
|
||||
ScaCommentReply: q.ScaCommentReply.clone(db),
|
||||
ScaFileFolder: q.ScaFileFolder.clone(db),
|
||||
ScaFileInfo: q.ScaFileInfo.clone(db),
|
||||
ScaFileRecycle: q.ScaFileRecycle.clone(db),
|
||||
ScaFileType: q.ScaFileType.clone(db),
|
||||
ScaMessageReport: q.ScaMessageReport.clone(db),
|
||||
ScaUserFollow: q.ScaUserFollow.clone(db),
|
||||
ScaUserLevel: q.ScaUserLevel.clone(db),
|
||||
ScaUserMessage: q.ScaUserMessage.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,
|
||||
ScaAuthMenu: q.ScaAuthMenu.replaceDB(db),
|
||||
ScaAuthPermissionRule: q.ScaAuthPermissionRule.replaceDB(db),
|
||||
ScaAuthRole: q.ScaAuthRole.replaceDB(db),
|
||||
ScaAuthUser: q.ScaAuthUser.replaceDB(db),
|
||||
ScaAuthUserDevice: q.ScaAuthUserDevice.replaceDB(db),
|
||||
ScaAuthUserSocial: q.ScaAuthUserSocial.replaceDB(db),
|
||||
ScaCommentLike: q.ScaCommentLike.replaceDB(db),
|
||||
ScaCommentReply: q.ScaCommentReply.replaceDB(db),
|
||||
ScaFileFolder: q.ScaFileFolder.replaceDB(db),
|
||||
ScaFileInfo: q.ScaFileInfo.replaceDB(db),
|
||||
ScaFileRecycle: q.ScaFileRecycle.replaceDB(db),
|
||||
ScaFileType: q.ScaFileType.replaceDB(db),
|
||||
ScaMessageReport: q.ScaMessageReport.replaceDB(db),
|
||||
ScaUserFollow: q.ScaUserFollow.replaceDB(db),
|
||||
ScaUserLevel: q.ScaUserLevel.replaceDB(db),
|
||||
ScaUserMessage: q.ScaUserMessage.replaceDB(db),
|
||||
}
|
||||
}
|
||||
|
||||
type queryCtx struct {
|
||||
ScaAuthMenu IScaAuthMenuDo
|
||||
ScaAuthPermissionRule IScaAuthPermissionRuleDo
|
||||
ScaAuthRole IScaAuthRoleDo
|
||||
ScaAuthUser IScaAuthUserDo
|
||||
ScaAuthUserDevice IScaAuthUserDeviceDo
|
||||
ScaAuthUserSocial IScaAuthUserSocialDo
|
||||
ScaCommentLike IScaCommentLikeDo
|
||||
ScaCommentReply IScaCommentReplyDo
|
||||
ScaFileFolder IScaFileFolderDo
|
||||
ScaFileInfo IScaFileInfoDo
|
||||
ScaFileRecycle IScaFileRecycleDo
|
||||
ScaFileType IScaFileTypeDo
|
||||
ScaMessageReport IScaMessageReportDo
|
||||
ScaUserFollow IScaUserFollowDo
|
||||
ScaUserLevel IScaUserLevelDo
|
||||
ScaUserMessage IScaUserMessageDo
|
||||
}
|
||||
|
||||
func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
||||
return &queryCtx{
|
||||
ScaAuthMenu: q.ScaAuthMenu.WithContext(ctx),
|
||||
ScaAuthPermissionRule: q.ScaAuthPermissionRule.WithContext(ctx),
|
||||
ScaAuthRole: q.ScaAuthRole.WithContext(ctx),
|
||||
ScaAuthUser: q.ScaAuthUser.WithContext(ctx),
|
||||
ScaAuthUserDevice: q.ScaAuthUserDevice.WithContext(ctx),
|
||||
ScaAuthUserSocial: q.ScaAuthUserSocial.WithContext(ctx),
|
||||
ScaCommentLike: q.ScaCommentLike.WithContext(ctx),
|
||||
ScaCommentReply: q.ScaCommentReply.WithContext(ctx),
|
||||
ScaFileFolder: q.ScaFileFolder.WithContext(ctx),
|
||||
ScaFileInfo: q.ScaFileInfo.WithContext(ctx),
|
||||
ScaFileRecycle: q.ScaFileRecycle.WithContext(ctx),
|
||||
ScaFileType: q.ScaFileType.WithContext(ctx),
|
||||
ScaMessageReport: q.ScaMessageReport.WithContext(ctx),
|
||||
ScaUserFollow: q.ScaUserFollow.WithContext(ctx),
|
||||
ScaUserLevel: q.ScaUserLevel.WithContext(ctx),
|
||||
ScaUserMessage: q.ScaUserMessage.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
|
||||
}
|
432
app/core/api/repository/mysql/query/sca_auth_menu.gen.go
Normal file
432
app/core/api/repository/mysql/query/sca_auth_menu.gen.go
Normal file
@@ -0,0 +1,432 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaAuthMenu(db *gorm.DB, opts ...gen.DOOption) scaAuthMenu {
|
||||
_scaAuthMenu := scaAuthMenu{}
|
||||
|
||||
_scaAuthMenu.scaAuthMenuDo.UseDB(db, opts...)
|
||||
_scaAuthMenu.scaAuthMenuDo.UseModel(&model.ScaAuthMenu{})
|
||||
|
||||
tableName := _scaAuthMenu.scaAuthMenuDo.TableName()
|
||||
_scaAuthMenu.ALL = field.NewAsterisk(tableName)
|
||||
_scaAuthMenu.ID = field.NewInt64(tableName, "id")
|
||||
_scaAuthMenu.MenuName = field.NewString(tableName, "menu_name")
|
||||
_scaAuthMenu.ParentID = field.NewInt64(tableName, "parent_id")
|
||||
_scaAuthMenu.Type = field.NewInt64(tableName, "type")
|
||||
_scaAuthMenu.Path = field.NewString(tableName, "path")
|
||||
_scaAuthMenu.Status = field.NewInt64(tableName, "status")
|
||||
_scaAuthMenu.Icon = field.NewString(tableName, "icon")
|
||||
_scaAuthMenu.MenuKey = field.NewString(tableName, "menu_key")
|
||||
_scaAuthMenu.Order_ = field.NewInt64(tableName, "order")
|
||||
_scaAuthMenu.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthMenu.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthMenu.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthMenu.Remark = field.NewString(tableName, "remark")
|
||||
_scaAuthMenu.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaAuthMenu.fillFieldMap()
|
||||
|
||||
return _scaAuthMenu
|
||||
}
|
||||
|
||||
type scaAuthMenu struct {
|
||||
scaAuthMenuDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键ID
|
||||
MenuName field.String // 名称
|
||||
ParentID field.Int64 // 父ID
|
||||
Type field.Int64 // 类型
|
||||
Path field.String // 路径
|
||||
Status field.Int64 // 状态 0 启用 1 停用
|
||||
Icon field.String // 图标
|
||||
MenuKey field.String // 关键字
|
||||
Order_ field.Int64 // 排序
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除
|
||||
Remark field.String // 备注 描述
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaAuthMenu) Table(newTableName string) *scaAuthMenu {
|
||||
s.scaAuthMenuDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaAuthMenu) As(alias string) *scaAuthMenu {
|
||||
s.scaAuthMenuDo.DO = *(s.scaAuthMenuDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaAuthMenu) updateTableName(table string) *scaAuthMenu {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.MenuName = field.NewString(table, "menu_name")
|
||||
s.ParentID = field.NewInt64(table, "parent_id")
|
||||
s.Type = field.NewInt64(table, "type")
|
||||
s.Path = field.NewString(table, "path")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.Icon = field.NewString(table, "icon")
|
||||
s.MenuKey = field.NewString(table, "menu_key")
|
||||
s.Order_ = field.NewInt64(table, "order")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Remark = field.NewString(table, "remark")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaAuthMenu) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaAuthMenu) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 14)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["menu_name"] = s.MenuName
|
||||
s.fieldMap["parent_id"] = s.ParentID
|
||||
s.fieldMap["type"] = s.Type
|
||||
s.fieldMap["path"] = s.Path
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["icon"] = s.Icon
|
||||
s.fieldMap["menu_key"] = s.MenuKey
|
||||
s.fieldMap["order"] = s.Order_
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["remark"] = s.Remark
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaAuthMenu) clone(db *gorm.DB) scaAuthMenu {
|
||||
s.scaAuthMenuDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaAuthMenu) replaceDB(db *gorm.DB) scaAuthMenu {
|
||||
s.scaAuthMenuDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaAuthMenuDo struct{ gen.DO }
|
||||
|
||||
type IScaAuthMenuDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaAuthMenuDo
|
||||
WithContext(ctx context.Context) IScaAuthMenuDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaAuthMenuDo
|
||||
WriteDB() IScaAuthMenuDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaAuthMenuDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaAuthMenuDo
|
||||
Not(conds ...gen.Condition) IScaAuthMenuDo
|
||||
Or(conds ...gen.Condition) IScaAuthMenuDo
|
||||
Select(conds ...field.Expr) IScaAuthMenuDo
|
||||
Where(conds ...gen.Condition) IScaAuthMenuDo
|
||||
Order(conds ...field.Expr) IScaAuthMenuDo
|
||||
Distinct(cols ...field.Expr) IScaAuthMenuDo
|
||||
Omit(cols ...field.Expr) IScaAuthMenuDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaAuthMenuDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthMenuDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthMenuDo
|
||||
Group(cols ...field.Expr) IScaAuthMenuDo
|
||||
Having(conds ...gen.Condition) IScaAuthMenuDo
|
||||
Limit(limit int) IScaAuthMenuDo
|
||||
Offset(offset int) IScaAuthMenuDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthMenuDo
|
||||
Unscoped() IScaAuthMenuDo
|
||||
Create(values ...*model.ScaAuthMenu) error
|
||||
CreateInBatches(values []*model.ScaAuthMenu, batchSize int) error
|
||||
Save(values ...*model.ScaAuthMenu) error
|
||||
First() (*model.ScaAuthMenu, error)
|
||||
Take() (*model.ScaAuthMenu, error)
|
||||
Last() (*model.ScaAuthMenu, error)
|
||||
Find() ([]*model.ScaAuthMenu, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthMenu, err error)
|
||||
FindInBatches(result *[]*model.ScaAuthMenu, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaAuthMenu) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaAuthMenuDo
|
||||
Assign(attrs ...field.AssignExpr) IScaAuthMenuDo
|
||||
Joins(fields ...field.RelationField) IScaAuthMenuDo
|
||||
Preload(fields ...field.RelationField) IScaAuthMenuDo
|
||||
FirstOrInit() (*model.ScaAuthMenu, error)
|
||||
FirstOrCreate() (*model.ScaAuthMenu, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaAuthMenu, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaAuthMenuDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Debug() IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) WithContext(ctx context.Context) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) ReadDB() IScaAuthMenuDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) WriteDB() IScaAuthMenuDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Session(config *gorm.Session) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Clauses(conds ...clause.Expression) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Returning(value interface{}, columns ...string) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Not(conds ...gen.Condition) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Or(conds ...gen.Condition) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Select(conds ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Where(conds ...gen.Condition) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Order(conds ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Distinct(cols ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Omit(cols ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Join(table schema.Tabler, on ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Group(cols ...field.Expr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Having(conds ...gen.Condition) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Limit(limit int) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Offset(offset int) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Unscoped() IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Create(values ...*model.ScaAuthMenu) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) CreateInBatches(values []*model.ScaAuthMenu, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaAuthMenuDo) Save(values ...*model.ScaAuthMenu) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) First() (*model.ScaAuthMenu, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthMenu), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Take() (*model.ScaAuthMenu, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthMenu), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Last() (*model.ScaAuthMenu, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthMenu), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Find() ([]*model.ScaAuthMenu, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaAuthMenu), err
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthMenu, err error) {
|
||||
buf := make([]*model.ScaAuthMenu, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) FindInBatches(result *[]*model.ScaAuthMenu, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Attrs(attrs ...field.AssignExpr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Assign(attrs ...field.AssignExpr) IScaAuthMenuDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Joins(fields ...field.RelationField) IScaAuthMenuDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Preload(fields ...field.RelationField) IScaAuthMenuDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) FirstOrInit() (*model.ScaAuthMenu, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthMenu), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) FirstOrCreate() (*model.ScaAuthMenu, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthMenu), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) FindByPage(offset int, limit int) (result []*model.ScaAuthMenu, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaAuthMenuDo) Delete(models ...*model.ScaAuthMenu) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaAuthMenuDo) withDO(do gen.Dao) *scaAuthMenuDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
@@ -0,0 +1,408 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaAuthPermissionRule(db *gorm.DB, opts ...gen.DOOption) scaAuthPermissionRule {
|
||||
_scaAuthPermissionRule := scaAuthPermissionRule{}
|
||||
|
||||
_scaAuthPermissionRule.scaAuthPermissionRuleDo.UseDB(db, opts...)
|
||||
_scaAuthPermissionRule.scaAuthPermissionRuleDo.UseModel(&model.ScaAuthPermissionRule{})
|
||||
|
||||
tableName := _scaAuthPermissionRule.scaAuthPermissionRuleDo.TableName()
|
||||
_scaAuthPermissionRule.ALL = field.NewAsterisk(tableName)
|
||||
_scaAuthPermissionRule.ID = field.NewInt64(tableName, "id")
|
||||
_scaAuthPermissionRule.Ptype = field.NewString(tableName, "ptype")
|
||||
_scaAuthPermissionRule.V0 = field.NewString(tableName, "v0")
|
||||
_scaAuthPermissionRule.V1 = field.NewString(tableName, "v1")
|
||||
_scaAuthPermissionRule.V2 = field.NewString(tableName, "v2")
|
||||
_scaAuthPermissionRule.V3 = field.NewString(tableName, "v3")
|
||||
_scaAuthPermissionRule.V4 = field.NewString(tableName, "v4")
|
||||
_scaAuthPermissionRule.V5 = field.NewString(tableName, "v5")
|
||||
|
||||
_scaAuthPermissionRule.fillFieldMap()
|
||||
|
||||
return _scaAuthPermissionRule
|
||||
}
|
||||
|
||||
type scaAuthPermissionRule struct {
|
||||
scaAuthPermissionRuleDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64
|
||||
Ptype field.String
|
||||
V0 field.String
|
||||
V1 field.String
|
||||
V2 field.String
|
||||
V3 field.String
|
||||
V4 field.String
|
||||
V5 field.String
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRule) Table(newTableName string) *scaAuthPermissionRule {
|
||||
s.scaAuthPermissionRuleDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRule) As(alias string) *scaAuthPermissionRule {
|
||||
s.scaAuthPermissionRuleDo.DO = *(s.scaAuthPermissionRuleDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaAuthPermissionRule) updateTableName(table string) *scaAuthPermissionRule {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.Ptype = field.NewString(table, "ptype")
|
||||
s.V0 = field.NewString(table, "v0")
|
||||
s.V1 = field.NewString(table, "v1")
|
||||
s.V2 = field.NewString(table, "v2")
|
||||
s.V3 = field.NewString(table, "v3")
|
||||
s.V4 = field.NewString(table, "v4")
|
||||
s.V5 = field.NewString(table, "v5")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaAuthPermissionRule) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaAuthPermissionRule) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 8)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["ptype"] = s.Ptype
|
||||
s.fieldMap["v0"] = s.V0
|
||||
s.fieldMap["v1"] = s.V1
|
||||
s.fieldMap["v2"] = s.V2
|
||||
s.fieldMap["v3"] = s.V3
|
||||
s.fieldMap["v4"] = s.V4
|
||||
s.fieldMap["v5"] = s.V5
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRule) clone(db *gorm.DB) scaAuthPermissionRule {
|
||||
s.scaAuthPermissionRuleDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRule) replaceDB(db *gorm.DB) scaAuthPermissionRule {
|
||||
s.scaAuthPermissionRuleDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaAuthPermissionRuleDo struct{ gen.DO }
|
||||
|
||||
type IScaAuthPermissionRuleDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaAuthPermissionRuleDo
|
||||
WithContext(ctx context.Context) IScaAuthPermissionRuleDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaAuthPermissionRuleDo
|
||||
WriteDB() IScaAuthPermissionRuleDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaAuthPermissionRuleDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaAuthPermissionRuleDo
|
||||
Not(conds ...gen.Condition) IScaAuthPermissionRuleDo
|
||||
Or(conds ...gen.Condition) IScaAuthPermissionRuleDo
|
||||
Select(conds ...field.Expr) IScaAuthPermissionRuleDo
|
||||
Where(conds ...gen.Condition) IScaAuthPermissionRuleDo
|
||||
Order(conds ...field.Expr) IScaAuthPermissionRuleDo
|
||||
Distinct(cols ...field.Expr) IScaAuthPermissionRuleDo
|
||||
Omit(cols ...field.Expr) IScaAuthPermissionRuleDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaAuthPermissionRuleDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthPermissionRuleDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthPermissionRuleDo
|
||||
Group(cols ...field.Expr) IScaAuthPermissionRuleDo
|
||||
Having(conds ...gen.Condition) IScaAuthPermissionRuleDo
|
||||
Limit(limit int) IScaAuthPermissionRuleDo
|
||||
Offset(offset int) IScaAuthPermissionRuleDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthPermissionRuleDo
|
||||
Unscoped() IScaAuthPermissionRuleDo
|
||||
Create(values ...*model.ScaAuthPermissionRule) error
|
||||
CreateInBatches(values []*model.ScaAuthPermissionRule, batchSize int) error
|
||||
Save(values ...*model.ScaAuthPermissionRule) error
|
||||
First() (*model.ScaAuthPermissionRule, error)
|
||||
Take() (*model.ScaAuthPermissionRule, error)
|
||||
Last() (*model.ScaAuthPermissionRule, error)
|
||||
Find() ([]*model.ScaAuthPermissionRule, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthPermissionRule, err error)
|
||||
FindInBatches(result *[]*model.ScaAuthPermissionRule, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaAuthPermissionRule) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaAuthPermissionRuleDo
|
||||
Assign(attrs ...field.AssignExpr) IScaAuthPermissionRuleDo
|
||||
Joins(fields ...field.RelationField) IScaAuthPermissionRuleDo
|
||||
Preload(fields ...field.RelationField) IScaAuthPermissionRuleDo
|
||||
FirstOrInit() (*model.ScaAuthPermissionRule, error)
|
||||
FirstOrCreate() (*model.ScaAuthPermissionRule, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaAuthPermissionRule, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaAuthPermissionRuleDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Debug() IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) WithContext(ctx context.Context) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) ReadDB() IScaAuthPermissionRuleDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) WriteDB() IScaAuthPermissionRuleDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Session(config *gorm.Session) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Clauses(conds ...clause.Expression) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Returning(value interface{}, columns ...string) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Not(conds ...gen.Condition) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Or(conds ...gen.Condition) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Select(conds ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Where(conds ...gen.Condition) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Order(conds ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Distinct(cols ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Omit(cols ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Join(table schema.Tabler, on ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Group(cols ...field.Expr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Having(conds ...gen.Condition) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Limit(limit int) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Offset(offset int) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Unscoped() IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Create(values ...*model.ScaAuthPermissionRule) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) CreateInBatches(values []*model.ScaAuthPermissionRule, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaAuthPermissionRuleDo) Save(values ...*model.ScaAuthPermissionRule) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) First() (*model.ScaAuthPermissionRule, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthPermissionRule), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Take() (*model.ScaAuthPermissionRule, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthPermissionRule), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Last() (*model.ScaAuthPermissionRule, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthPermissionRule), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Find() ([]*model.ScaAuthPermissionRule, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaAuthPermissionRule), err
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthPermissionRule, err error) {
|
||||
buf := make([]*model.ScaAuthPermissionRule, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) FindInBatches(result *[]*model.ScaAuthPermissionRule, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Attrs(attrs ...field.AssignExpr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Assign(attrs ...field.AssignExpr) IScaAuthPermissionRuleDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Joins(fields ...field.RelationField) IScaAuthPermissionRuleDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Preload(fields ...field.RelationField) IScaAuthPermissionRuleDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) FirstOrInit() (*model.ScaAuthPermissionRule, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthPermissionRule), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) FirstOrCreate() (*model.ScaAuthPermissionRule, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthPermissionRule), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) FindByPage(offset int, limit int) (result []*model.ScaAuthPermissionRule, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaAuthPermissionRuleDo) Delete(models ...*model.ScaAuthPermissionRule) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaAuthPermissionRuleDo) withDO(do gen.Dao) *scaAuthPermissionRuleDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
404
app/core/api/repository/mysql/query/sca_auth_role.gen.go
Normal file
404
app/core/api/repository/mysql/query/sca_auth_role.gen.go
Normal file
@@ -0,0 +1,404 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaAuthRole(db *gorm.DB, opts ...gen.DOOption) scaAuthRole {
|
||||
_scaAuthRole := scaAuthRole{}
|
||||
|
||||
_scaAuthRole.scaAuthRoleDo.UseDB(db, opts...)
|
||||
_scaAuthRole.scaAuthRoleDo.UseModel(&model.ScaAuthRole{})
|
||||
|
||||
tableName := _scaAuthRole.scaAuthRoleDo.TableName()
|
||||
_scaAuthRole.ALL = field.NewAsterisk(tableName)
|
||||
_scaAuthRole.ID = field.NewInt64(tableName, "id")
|
||||
_scaAuthRole.RoleName = field.NewString(tableName, "role_name")
|
||||
_scaAuthRole.RoleKey = field.NewString(tableName, "role_key")
|
||||
_scaAuthRole.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthRole.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthRole.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthRole.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaAuthRole.fillFieldMap()
|
||||
|
||||
return _scaAuthRole
|
||||
}
|
||||
|
||||
type scaAuthRole struct {
|
||||
scaAuthRoleDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键ID
|
||||
RoleName field.String // 角色名称
|
||||
RoleKey field.String // 角色关键字
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaAuthRole) Table(newTableName string) *scaAuthRole {
|
||||
s.scaAuthRoleDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaAuthRole) As(alias string) *scaAuthRole {
|
||||
s.scaAuthRoleDo.DO = *(s.scaAuthRoleDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaAuthRole) updateTableName(table string) *scaAuthRole {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.RoleName = field.NewString(table, "role_name")
|
||||
s.RoleKey = field.NewString(table, "role_key")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaAuthRole) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaAuthRole) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 7)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["role_name"] = s.RoleName
|
||||
s.fieldMap["role_key"] = s.RoleKey
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaAuthRole) clone(db *gorm.DB) scaAuthRole {
|
||||
s.scaAuthRoleDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaAuthRole) replaceDB(db *gorm.DB) scaAuthRole {
|
||||
s.scaAuthRoleDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaAuthRoleDo struct{ gen.DO }
|
||||
|
||||
type IScaAuthRoleDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaAuthRoleDo
|
||||
WithContext(ctx context.Context) IScaAuthRoleDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaAuthRoleDo
|
||||
WriteDB() IScaAuthRoleDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaAuthRoleDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaAuthRoleDo
|
||||
Not(conds ...gen.Condition) IScaAuthRoleDo
|
||||
Or(conds ...gen.Condition) IScaAuthRoleDo
|
||||
Select(conds ...field.Expr) IScaAuthRoleDo
|
||||
Where(conds ...gen.Condition) IScaAuthRoleDo
|
||||
Order(conds ...field.Expr) IScaAuthRoleDo
|
||||
Distinct(cols ...field.Expr) IScaAuthRoleDo
|
||||
Omit(cols ...field.Expr) IScaAuthRoleDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaAuthRoleDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthRoleDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthRoleDo
|
||||
Group(cols ...field.Expr) IScaAuthRoleDo
|
||||
Having(conds ...gen.Condition) IScaAuthRoleDo
|
||||
Limit(limit int) IScaAuthRoleDo
|
||||
Offset(offset int) IScaAuthRoleDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthRoleDo
|
||||
Unscoped() IScaAuthRoleDo
|
||||
Create(values ...*model.ScaAuthRole) error
|
||||
CreateInBatches(values []*model.ScaAuthRole, batchSize int) error
|
||||
Save(values ...*model.ScaAuthRole) error
|
||||
First() (*model.ScaAuthRole, error)
|
||||
Take() (*model.ScaAuthRole, error)
|
||||
Last() (*model.ScaAuthRole, error)
|
||||
Find() ([]*model.ScaAuthRole, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthRole, err error)
|
||||
FindInBatches(result *[]*model.ScaAuthRole, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaAuthRole) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaAuthRoleDo
|
||||
Assign(attrs ...field.AssignExpr) IScaAuthRoleDo
|
||||
Joins(fields ...field.RelationField) IScaAuthRoleDo
|
||||
Preload(fields ...field.RelationField) IScaAuthRoleDo
|
||||
FirstOrInit() (*model.ScaAuthRole, error)
|
||||
FirstOrCreate() (*model.ScaAuthRole, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaAuthRole, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaAuthRoleDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Debug() IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) WithContext(ctx context.Context) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) ReadDB() IScaAuthRoleDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) WriteDB() IScaAuthRoleDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Session(config *gorm.Session) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Clauses(conds ...clause.Expression) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Returning(value interface{}, columns ...string) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Not(conds ...gen.Condition) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Or(conds ...gen.Condition) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Select(conds ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Where(conds ...gen.Condition) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Order(conds ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Distinct(cols ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Omit(cols ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Join(table schema.Tabler, on ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Group(cols ...field.Expr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Having(conds ...gen.Condition) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Limit(limit int) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Offset(offset int) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Unscoped() IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Create(values ...*model.ScaAuthRole) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) CreateInBatches(values []*model.ScaAuthRole, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaAuthRoleDo) Save(values ...*model.ScaAuthRole) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) First() (*model.ScaAuthRole, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthRole), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Take() (*model.ScaAuthRole, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthRole), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Last() (*model.ScaAuthRole, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthRole), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Find() ([]*model.ScaAuthRole, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaAuthRole), err
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthRole, err error) {
|
||||
buf := make([]*model.ScaAuthRole, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) FindInBatches(result *[]*model.ScaAuthRole, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Attrs(attrs ...field.AssignExpr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Assign(attrs ...field.AssignExpr) IScaAuthRoleDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Joins(fields ...field.RelationField) IScaAuthRoleDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Preload(fields ...field.RelationField) IScaAuthRoleDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) FirstOrInit() (*model.ScaAuthRole, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthRole), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) FirstOrCreate() (*model.ScaAuthRole, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthRole), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) FindByPage(offset int, limit int) (result []*model.ScaAuthRole, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaAuthRoleDo) Delete(models ...*model.ScaAuthRole) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaAuthRoleDo) withDO(do gen.Dao) *scaAuthRoleDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
448
app/core/api/repository/mysql/query/sca_auth_user.gen.go
Normal file
448
app/core/api/repository/mysql/query/sca_auth_user.gen.go
Normal file
@@ -0,0 +1,448 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaAuthUser(db *gorm.DB, opts ...gen.DOOption) scaAuthUser {
|
||||
_scaAuthUser := scaAuthUser{}
|
||||
|
||||
_scaAuthUser.scaAuthUserDo.UseDB(db, opts...)
|
||||
_scaAuthUser.scaAuthUserDo.UseModel(&model.ScaAuthUser{})
|
||||
|
||||
tableName := _scaAuthUser.scaAuthUserDo.TableName()
|
||||
_scaAuthUser.ALL = field.NewAsterisk(tableName)
|
||||
_scaAuthUser.ID = field.NewInt64(tableName, "id")
|
||||
_scaAuthUser.UID = field.NewString(tableName, "uid")
|
||||
_scaAuthUser.Username = field.NewString(tableName, "username")
|
||||
_scaAuthUser.Nickname = field.NewString(tableName, "nickname")
|
||||
_scaAuthUser.Email = field.NewString(tableName, "email")
|
||||
_scaAuthUser.Phone = field.NewString(tableName, "phone")
|
||||
_scaAuthUser.Password = field.NewString(tableName, "password")
|
||||
_scaAuthUser.Gender = field.NewInt64(tableName, "gender")
|
||||
_scaAuthUser.Avatar = field.NewString(tableName, "avatar")
|
||||
_scaAuthUser.Status = field.NewInt64(tableName, "status")
|
||||
_scaAuthUser.Introduce = field.NewString(tableName, "introduce")
|
||||
_scaAuthUser.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthUser.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthUser.Blog = field.NewString(tableName, "blog")
|
||||
_scaAuthUser.Location = field.NewString(tableName, "location")
|
||||
_scaAuthUser.Company = field.NewString(tableName, "company")
|
||||
_scaAuthUser.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthUser.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaAuthUser.fillFieldMap()
|
||||
|
||||
return _scaAuthUser
|
||||
}
|
||||
|
||||
type scaAuthUser struct {
|
||||
scaAuthUserDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 自增ID
|
||||
UID field.String // 唯一ID
|
||||
Username field.String // 用户名
|
||||
Nickname field.String // 昵称
|
||||
Email field.String // 邮箱
|
||||
Phone field.String // 电话
|
||||
Password field.String // 密码
|
||||
Gender field.Int64 // 性别
|
||||
Avatar field.String // 头像
|
||||
Status field.Int64 // 状态 0 正常 1 封禁
|
||||
Introduce field.String // 介绍
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
Blog field.String // 博客
|
||||
Location field.String // 地址
|
||||
Company field.String // 公司
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaAuthUser) Table(newTableName string) *scaAuthUser {
|
||||
s.scaAuthUserDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaAuthUser) As(alias string) *scaAuthUser {
|
||||
s.scaAuthUserDo.DO = *(s.scaAuthUserDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaAuthUser) updateTableName(table string) *scaAuthUser {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UID = field.NewString(table, "uid")
|
||||
s.Username = field.NewString(table, "username")
|
||||
s.Nickname = field.NewString(table, "nickname")
|
||||
s.Email = field.NewString(table, "email")
|
||||
s.Phone = field.NewString(table, "phone")
|
||||
s.Password = field.NewString(table, "password")
|
||||
s.Gender = field.NewInt64(table, "gender")
|
||||
s.Avatar = field.NewString(table, "avatar")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.Introduce = field.NewString(table, "introduce")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Blog = field.NewString(table, "blog")
|
||||
s.Location = field.NewString(table, "location")
|
||||
s.Company = field.NewString(table, "company")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaAuthUser) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaAuthUser) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 18)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["uid"] = s.UID
|
||||
s.fieldMap["username"] = s.Username
|
||||
s.fieldMap["nickname"] = s.Nickname
|
||||
s.fieldMap["email"] = s.Email
|
||||
s.fieldMap["phone"] = s.Phone
|
||||
s.fieldMap["password"] = s.Password
|
||||
s.fieldMap["gender"] = s.Gender
|
||||
s.fieldMap["avatar"] = s.Avatar
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["introduce"] = s.Introduce
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["blog"] = s.Blog
|
||||
s.fieldMap["location"] = s.Location
|
||||
s.fieldMap["company"] = s.Company
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaAuthUser) clone(db *gorm.DB) scaAuthUser {
|
||||
s.scaAuthUserDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaAuthUser) replaceDB(db *gorm.DB) scaAuthUser {
|
||||
s.scaAuthUserDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaAuthUserDo struct{ gen.DO }
|
||||
|
||||
type IScaAuthUserDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaAuthUserDo
|
||||
WithContext(ctx context.Context) IScaAuthUserDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaAuthUserDo
|
||||
WriteDB() IScaAuthUserDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaAuthUserDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaAuthUserDo
|
||||
Not(conds ...gen.Condition) IScaAuthUserDo
|
||||
Or(conds ...gen.Condition) IScaAuthUserDo
|
||||
Select(conds ...field.Expr) IScaAuthUserDo
|
||||
Where(conds ...gen.Condition) IScaAuthUserDo
|
||||
Order(conds ...field.Expr) IScaAuthUserDo
|
||||
Distinct(cols ...field.Expr) IScaAuthUserDo
|
||||
Omit(cols ...field.Expr) IScaAuthUserDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaAuthUserDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDo
|
||||
Group(cols ...field.Expr) IScaAuthUserDo
|
||||
Having(conds ...gen.Condition) IScaAuthUserDo
|
||||
Limit(limit int) IScaAuthUserDo
|
||||
Offset(offset int) IScaAuthUserDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthUserDo
|
||||
Unscoped() IScaAuthUserDo
|
||||
Create(values ...*model.ScaAuthUser) error
|
||||
CreateInBatches(values []*model.ScaAuthUser, batchSize int) error
|
||||
Save(values ...*model.ScaAuthUser) error
|
||||
First() (*model.ScaAuthUser, error)
|
||||
Take() (*model.ScaAuthUser, error)
|
||||
Last() (*model.ScaAuthUser, error)
|
||||
Find() ([]*model.ScaAuthUser, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthUser, err error)
|
||||
FindInBatches(result *[]*model.ScaAuthUser, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaAuthUser) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaAuthUserDo
|
||||
Assign(attrs ...field.AssignExpr) IScaAuthUserDo
|
||||
Joins(fields ...field.RelationField) IScaAuthUserDo
|
||||
Preload(fields ...field.RelationField) IScaAuthUserDo
|
||||
FirstOrInit() (*model.ScaAuthUser, error)
|
||||
FirstOrCreate() (*model.ScaAuthUser, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaAuthUser, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaAuthUserDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Debug() IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) WithContext(ctx context.Context) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) ReadDB() IScaAuthUserDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) WriteDB() IScaAuthUserDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Session(config *gorm.Session) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Clauses(conds ...clause.Expression) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Returning(value interface{}, columns ...string) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Not(conds ...gen.Condition) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Or(conds ...gen.Condition) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Select(conds ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Where(conds ...gen.Condition) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Order(conds ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Distinct(cols ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Omit(cols ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Join(table schema.Tabler, on ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Group(cols ...field.Expr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Having(conds ...gen.Condition) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Limit(limit int) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Offset(offset int) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Unscoped() IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Create(values ...*model.ScaAuthUser) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) CreateInBatches(values []*model.ScaAuthUser, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaAuthUserDo) Save(values ...*model.ScaAuthUser) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) First() (*model.ScaAuthUser, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUser), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Take() (*model.ScaAuthUser, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUser), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Last() (*model.ScaAuthUser, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUser), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Find() ([]*model.ScaAuthUser, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaAuthUser), err
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthUser, err error) {
|
||||
buf := make([]*model.ScaAuthUser, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) FindInBatches(result *[]*model.ScaAuthUser, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Attrs(attrs ...field.AssignExpr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Assign(attrs ...field.AssignExpr) IScaAuthUserDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Joins(fields ...field.RelationField) IScaAuthUserDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Preload(fields ...field.RelationField) IScaAuthUserDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) FirstOrInit() (*model.ScaAuthUser, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUser), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) FirstOrCreate() (*model.ScaAuthUser, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUser), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) FindByPage(offset int, limit int) (result []*model.ScaAuthUser, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDo) Delete(models ...*model.ScaAuthUser) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaAuthUserDo) withDO(do gen.Dao) *scaAuthUserDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
448
app/core/api/repository/mysql/query/sca_auth_user_device.gen.go
Normal file
448
app/core/api/repository/mysql/query/sca_auth_user_device.gen.go
Normal file
@@ -0,0 +1,448 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaAuthUserDevice(db *gorm.DB, opts ...gen.DOOption) scaAuthUserDevice {
|
||||
_scaAuthUserDevice := scaAuthUserDevice{}
|
||||
|
||||
_scaAuthUserDevice.scaAuthUserDeviceDo.UseDB(db, opts...)
|
||||
_scaAuthUserDevice.scaAuthUserDeviceDo.UseModel(&model.ScaAuthUserDevice{})
|
||||
|
||||
tableName := _scaAuthUserDevice.scaAuthUserDeviceDo.TableName()
|
||||
_scaAuthUserDevice.ALL = field.NewAsterisk(tableName)
|
||||
_scaAuthUserDevice.ID = field.NewInt64(tableName, "id")
|
||||
_scaAuthUserDevice.UserID = field.NewString(tableName, "user_id")
|
||||
_scaAuthUserDevice.IP = field.NewString(tableName, "ip")
|
||||
_scaAuthUserDevice.Location = field.NewString(tableName, "location")
|
||||
_scaAuthUserDevice.Agent = field.NewString(tableName, "agent")
|
||||
_scaAuthUserDevice.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthUserDevice.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthUserDevice.Browser = field.NewString(tableName, "browser")
|
||||
_scaAuthUserDevice.OperatingSystem = field.NewString(tableName, "operating_system")
|
||||
_scaAuthUserDevice.BrowserVersion = field.NewString(tableName, "browser_version")
|
||||
_scaAuthUserDevice.Mobile = field.NewInt64(tableName, "mobile")
|
||||
_scaAuthUserDevice.Bot = field.NewInt64(tableName, "bot")
|
||||
_scaAuthUserDevice.Mozilla = field.NewString(tableName, "mozilla")
|
||||
_scaAuthUserDevice.Platform = field.NewString(tableName, "platform")
|
||||
_scaAuthUserDevice.EngineName = field.NewString(tableName, "engine_name")
|
||||
_scaAuthUserDevice.EngineVersion = field.NewString(tableName, "engine_version")
|
||||
_scaAuthUserDevice.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthUserDevice.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaAuthUserDevice.fillFieldMap()
|
||||
|
||||
return _scaAuthUserDevice
|
||||
}
|
||||
|
||||
type scaAuthUserDevice struct {
|
||||
scaAuthUserDeviceDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键ID
|
||||
UserID field.String // 用户ID
|
||||
IP field.String // 登录IP
|
||||
Location field.String // 地址
|
||||
Agent field.String // 设备信息
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
Browser field.String // 浏览器
|
||||
OperatingSystem field.String // 操作系统
|
||||
BrowserVersion field.String // 浏览器版本
|
||||
Mobile field.Int64 // 是否为手机 0否1是
|
||||
Bot field.Int64 // 是否为bot 0否1是
|
||||
Mozilla field.String // 火狐版本
|
||||
Platform field.String // 平台
|
||||
EngineName field.String // 引擎名称
|
||||
EngineVersion field.String // 引擎版本
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaAuthUserDevice) Table(newTableName string) *scaAuthUserDevice {
|
||||
s.scaAuthUserDeviceDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDevice) As(alias string) *scaAuthUserDevice {
|
||||
s.scaAuthUserDeviceDo.DO = *(s.scaAuthUserDeviceDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaAuthUserDevice) updateTableName(table string) *scaAuthUserDevice {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.IP = field.NewString(table, "ip")
|
||||
s.Location = field.NewString(table, "location")
|
||||
s.Agent = field.NewString(table, "agent")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Browser = field.NewString(table, "browser")
|
||||
s.OperatingSystem = field.NewString(table, "operating_system")
|
||||
s.BrowserVersion = field.NewString(table, "browser_version")
|
||||
s.Mobile = field.NewInt64(table, "mobile")
|
||||
s.Bot = field.NewInt64(table, "bot")
|
||||
s.Mozilla = field.NewString(table, "mozilla")
|
||||
s.Platform = field.NewString(table, "platform")
|
||||
s.EngineName = field.NewString(table, "engine_name")
|
||||
s.EngineVersion = field.NewString(table, "engine_version")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaAuthUserDevice) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaAuthUserDevice) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 18)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["ip"] = s.IP
|
||||
s.fieldMap["location"] = s.Location
|
||||
s.fieldMap["agent"] = s.Agent
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["browser"] = s.Browser
|
||||
s.fieldMap["operating_system"] = s.OperatingSystem
|
||||
s.fieldMap["browser_version"] = s.BrowserVersion
|
||||
s.fieldMap["mobile"] = s.Mobile
|
||||
s.fieldMap["bot"] = s.Bot
|
||||
s.fieldMap["mozilla"] = s.Mozilla
|
||||
s.fieldMap["platform"] = s.Platform
|
||||
s.fieldMap["engine_name"] = s.EngineName
|
||||
s.fieldMap["engine_version"] = s.EngineVersion
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaAuthUserDevice) clone(db *gorm.DB) scaAuthUserDevice {
|
||||
s.scaAuthUserDeviceDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaAuthUserDevice) replaceDB(db *gorm.DB) scaAuthUserDevice {
|
||||
s.scaAuthUserDeviceDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaAuthUserDeviceDo struct{ gen.DO }
|
||||
|
||||
type IScaAuthUserDeviceDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaAuthUserDeviceDo
|
||||
WithContext(ctx context.Context) IScaAuthUserDeviceDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaAuthUserDeviceDo
|
||||
WriteDB() IScaAuthUserDeviceDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaAuthUserDeviceDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaAuthUserDeviceDo
|
||||
Not(conds ...gen.Condition) IScaAuthUserDeviceDo
|
||||
Or(conds ...gen.Condition) IScaAuthUserDeviceDo
|
||||
Select(conds ...field.Expr) IScaAuthUserDeviceDo
|
||||
Where(conds ...gen.Condition) IScaAuthUserDeviceDo
|
||||
Order(conds ...field.Expr) IScaAuthUserDeviceDo
|
||||
Distinct(cols ...field.Expr) IScaAuthUserDeviceDo
|
||||
Omit(cols ...field.Expr) IScaAuthUserDeviceDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaAuthUserDeviceDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDeviceDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDeviceDo
|
||||
Group(cols ...field.Expr) IScaAuthUserDeviceDo
|
||||
Having(conds ...gen.Condition) IScaAuthUserDeviceDo
|
||||
Limit(limit int) IScaAuthUserDeviceDo
|
||||
Offset(offset int) IScaAuthUserDeviceDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthUserDeviceDo
|
||||
Unscoped() IScaAuthUserDeviceDo
|
||||
Create(values ...*model.ScaAuthUserDevice) error
|
||||
CreateInBatches(values []*model.ScaAuthUserDevice, batchSize int) error
|
||||
Save(values ...*model.ScaAuthUserDevice) error
|
||||
First() (*model.ScaAuthUserDevice, error)
|
||||
Take() (*model.ScaAuthUserDevice, error)
|
||||
Last() (*model.ScaAuthUserDevice, error)
|
||||
Find() ([]*model.ScaAuthUserDevice, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthUserDevice, err error)
|
||||
FindInBatches(result *[]*model.ScaAuthUserDevice, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaAuthUserDevice) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaAuthUserDeviceDo
|
||||
Assign(attrs ...field.AssignExpr) IScaAuthUserDeviceDo
|
||||
Joins(fields ...field.RelationField) IScaAuthUserDeviceDo
|
||||
Preload(fields ...field.RelationField) IScaAuthUserDeviceDo
|
||||
FirstOrInit() (*model.ScaAuthUserDevice, error)
|
||||
FirstOrCreate() (*model.ScaAuthUserDevice, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaAuthUserDevice, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaAuthUserDeviceDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Debug() IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) WithContext(ctx context.Context) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) ReadDB() IScaAuthUserDeviceDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) WriteDB() IScaAuthUserDeviceDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Session(config *gorm.Session) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Clauses(conds ...clause.Expression) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Returning(value interface{}, columns ...string) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Not(conds ...gen.Condition) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Or(conds ...gen.Condition) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Select(conds ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Where(conds ...gen.Condition) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Order(conds ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Distinct(cols ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Omit(cols ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Join(table schema.Tabler, on ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Group(cols ...field.Expr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Having(conds ...gen.Condition) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Limit(limit int) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Offset(offset int) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Unscoped() IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Create(values ...*model.ScaAuthUserDevice) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) CreateInBatches(values []*model.ScaAuthUserDevice, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaAuthUserDeviceDo) Save(values ...*model.ScaAuthUserDevice) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) First() (*model.ScaAuthUserDevice, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserDevice), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Take() (*model.ScaAuthUserDevice, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserDevice), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Last() (*model.ScaAuthUserDevice, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserDevice), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Find() ([]*model.ScaAuthUserDevice, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaAuthUserDevice), err
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthUserDevice, err error) {
|
||||
buf := make([]*model.ScaAuthUserDevice, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) FindInBatches(result *[]*model.ScaAuthUserDevice, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Attrs(attrs ...field.AssignExpr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Assign(attrs ...field.AssignExpr) IScaAuthUserDeviceDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Joins(fields ...field.RelationField) IScaAuthUserDeviceDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Preload(fields ...field.RelationField) IScaAuthUserDeviceDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) FirstOrInit() (*model.ScaAuthUserDevice, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserDevice), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) FirstOrCreate() (*model.ScaAuthUserDevice, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserDevice), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) FindByPage(offset int, limit int) (result []*model.ScaAuthUserDevice, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaAuthUserDeviceDo) Delete(models ...*model.ScaAuthUserDevice) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaAuthUserDeviceDo) withDO(do gen.Dao) *scaAuthUserDeviceDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
412
app/core/api/repository/mysql/query/sca_auth_user_social.gen.go
Normal file
412
app/core/api/repository/mysql/query/sca_auth_user_social.gen.go
Normal file
@@ -0,0 +1,412 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaAuthUserSocial(db *gorm.DB, opts ...gen.DOOption) scaAuthUserSocial {
|
||||
_scaAuthUserSocial := scaAuthUserSocial{}
|
||||
|
||||
_scaAuthUserSocial.scaAuthUserSocialDo.UseDB(db, opts...)
|
||||
_scaAuthUserSocial.scaAuthUserSocialDo.UseModel(&model.ScaAuthUserSocial{})
|
||||
|
||||
tableName := _scaAuthUserSocial.scaAuthUserSocialDo.TableName()
|
||||
_scaAuthUserSocial.ALL = field.NewAsterisk(tableName)
|
||||
_scaAuthUserSocial.ID = field.NewInt64(tableName, "id")
|
||||
_scaAuthUserSocial.UserID = field.NewString(tableName, "user_id")
|
||||
_scaAuthUserSocial.OpenID = field.NewString(tableName, "open_id")
|
||||
_scaAuthUserSocial.Source = field.NewString(tableName, "source")
|
||||
_scaAuthUserSocial.Status = field.NewInt64(tableName, "status")
|
||||
_scaAuthUserSocial.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaAuthUserSocial.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaAuthUserSocial.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaAuthUserSocial.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaAuthUserSocial.fillFieldMap()
|
||||
|
||||
return _scaAuthUserSocial
|
||||
}
|
||||
|
||||
type scaAuthUserSocial struct {
|
||||
scaAuthUserSocialDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键ID
|
||||
UserID field.String // 用户ID
|
||||
OpenID field.String // 第三方用户的 open id
|
||||
Source field.String // 第三方用户来源
|
||||
Status field.Int64 // 状态 0正常 1 封禁
|
||||
CreatedAt field.Time // 创建时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocial) Table(newTableName string) *scaAuthUserSocial {
|
||||
s.scaAuthUserSocialDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocial) As(alias string) *scaAuthUserSocial {
|
||||
s.scaAuthUserSocialDo.DO = *(s.scaAuthUserSocialDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaAuthUserSocial) updateTableName(table string) *scaAuthUserSocial {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.OpenID = field.NewString(table, "open_id")
|
||||
s.Source = field.NewString(table, "source")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaAuthUserSocial) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaAuthUserSocial) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 9)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["open_id"] = s.OpenID
|
||||
s.fieldMap["source"] = s.Source
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocial) clone(db *gorm.DB) scaAuthUserSocial {
|
||||
s.scaAuthUserSocialDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocial) replaceDB(db *gorm.DB) scaAuthUserSocial {
|
||||
s.scaAuthUserSocialDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaAuthUserSocialDo struct{ gen.DO }
|
||||
|
||||
type IScaAuthUserSocialDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaAuthUserSocialDo
|
||||
WithContext(ctx context.Context) IScaAuthUserSocialDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaAuthUserSocialDo
|
||||
WriteDB() IScaAuthUserSocialDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaAuthUserSocialDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaAuthUserSocialDo
|
||||
Not(conds ...gen.Condition) IScaAuthUserSocialDo
|
||||
Or(conds ...gen.Condition) IScaAuthUserSocialDo
|
||||
Select(conds ...field.Expr) IScaAuthUserSocialDo
|
||||
Where(conds ...gen.Condition) IScaAuthUserSocialDo
|
||||
Order(conds ...field.Expr) IScaAuthUserSocialDo
|
||||
Distinct(cols ...field.Expr) IScaAuthUserSocialDo
|
||||
Omit(cols ...field.Expr) IScaAuthUserSocialDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaAuthUserSocialDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserSocialDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserSocialDo
|
||||
Group(cols ...field.Expr) IScaAuthUserSocialDo
|
||||
Having(conds ...gen.Condition) IScaAuthUserSocialDo
|
||||
Limit(limit int) IScaAuthUserSocialDo
|
||||
Offset(offset int) IScaAuthUserSocialDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthUserSocialDo
|
||||
Unscoped() IScaAuthUserSocialDo
|
||||
Create(values ...*model.ScaAuthUserSocial) error
|
||||
CreateInBatches(values []*model.ScaAuthUserSocial, batchSize int) error
|
||||
Save(values ...*model.ScaAuthUserSocial) error
|
||||
First() (*model.ScaAuthUserSocial, error)
|
||||
Take() (*model.ScaAuthUserSocial, error)
|
||||
Last() (*model.ScaAuthUserSocial, error)
|
||||
Find() ([]*model.ScaAuthUserSocial, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthUserSocial, err error)
|
||||
FindInBatches(result *[]*model.ScaAuthUserSocial, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaAuthUserSocial) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaAuthUserSocialDo
|
||||
Assign(attrs ...field.AssignExpr) IScaAuthUserSocialDo
|
||||
Joins(fields ...field.RelationField) IScaAuthUserSocialDo
|
||||
Preload(fields ...field.RelationField) IScaAuthUserSocialDo
|
||||
FirstOrInit() (*model.ScaAuthUserSocial, error)
|
||||
FirstOrCreate() (*model.ScaAuthUserSocial, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaAuthUserSocial, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaAuthUserSocialDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Debug() IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) WithContext(ctx context.Context) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) ReadDB() IScaAuthUserSocialDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) WriteDB() IScaAuthUserSocialDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Session(config *gorm.Session) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Clauses(conds ...clause.Expression) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Returning(value interface{}, columns ...string) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Not(conds ...gen.Condition) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Or(conds ...gen.Condition) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Select(conds ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Where(conds ...gen.Condition) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Order(conds ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Distinct(cols ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Omit(cols ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Join(table schema.Tabler, on ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Group(cols ...field.Expr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Having(conds ...gen.Condition) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Limit(limit int) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Offset(offset int) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Unscoped() IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Create(values ...*model.ScaAuthUserSocial) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) CreateInBatches(values []*model.ScaAuthUserSocial, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaAuthUserSocialDo) Save(values ...*model.ScaAuthUserSocial) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) First() (*model.ScaAuthUserSocial, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserSocial), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Take() (*model.ScaAuthUserSocial, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserSocial), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Last() (*model.ScaAuthUserSocial, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserSocial), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Find() ([]*model.ScaAuthUserSocial, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaAuthUserSocial), err
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaAuthUserSocial, err error) {
|
||||
buf := make([]*model.ScaAuthUserSocial, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) FindInBatches(result *[]*model.ScaAuthUserSocial, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Attrs(attrs ...field.AssignExpr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Assign(attrs ...field.AssignExpr) IScaAuthUserSocialDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Joins(fields ...field.RelationField) IScaAuthUserSocialDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Preload(fields ...field.RelationField) IScaAuthUserSocialDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) FirstOrInit() (*model.ScaAuthUserSocial, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserSocial), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) FirstOrCreate() (*model.ScaAuthUserSocial, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaAuthUserSocial), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) FindByPage(offset int, limit int) (result []*model.ScaAuthUserSocial, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaAuthUserSocialDo) Delete(models ...*model.ScaAuthUserSocial) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaAuthUserSocialDo) withDO(do gen.Dao) *scaAuthUserSocialDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
396
app/core/api/repository/mysql/query/sca_comment_likes.gen.go
Normal file
396
app/core/api/repository/mysql/query/sca_comment_likes.gen.go
Normal file
@@ -0,0 +1,396 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaCommentLike(db *gorm.DB, opts ...gen.DOOption) scaCommentLike {
|
||||
_scaCommentLike := scaCommentLike{}
|
||||
|
||||
_scaCommentLike.scaCommentLikeDo.UseDB(db, opts...)
|
||||
_scaCommentLike.scaCommentLikeDo.UseModel(&model.ScaCommentLike{})
|
||||
|
||||
tableName := _scaCommentLike.scaCommentLikeDo.TableName()
|
||||
_scaCommentLike.ALL = field.NewAsterisk(tableName)
|
||||
_scaCommentLike.ID = field.NewInt64(tableName, "id")
|
||||
_scaCommentLike.TopicID = field.NewString(tableName, "topic_id")
|
||||
_scaCommentLike.UserID = field.NewString(tableName, "user_id")
|
||||
_scaCommentLike.CommentID = field.NewInt64(tableName, "comment_id")
|
||||
_scaCommentLike.LikeTime = field.NewTime(tableName, "like_time")
|
||||
|
||||
_scaCommentLike.fillFieldMap()
|
||||
|
||||
return _scaCommentLike
|
||||
}
|
||||
|
||||
type scaCommentLike struct {
|
||||
scaCommentLikeDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键id
|
||||
TopicID field.String // 话题ID
|
||||
UserID field.String // 用户ID
|
||||
CommentID field.Int64 // 评论ID
|
||||
LikeTime field.Time // 点赞时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaCommentLike) Table(newTableName string) *scaCommentLike {
|
||||
s.scaCommentLikeDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaCommentLike) As(alias string) *scaCommentLike {
|
||||
s.scaCommentLikeDo.DO = *(s.scaCommentLikeDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaCommentLike) updateTableName(table string) *scaCommentLike {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.TopicID = field.NewString(table, "topic_id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.CommentID = field.NewInt64(table, "comment_id")
|
||||
s.LikeTime = field.NewTime(table, "like_time")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaCommentLike) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaCommentLike) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 5)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["topic_id"] = s.TopicID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["comment_id"] = s.CommentID
|
||||
s.fieldMap["like_time"] = s.LikeTime
|
||||
}
|
||||
|
||||
func (s scaCommentLike) clone(db *gorm.DB) scaCommentLike {
|
||||
s.scaCommentLikeDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaCommentLike) replaceDB(db *gorm.DB) scaCommentLike {
|
||||
s.scaCommentLikeDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaCommentLikeDo struct{ gen.DO }
|
||||
|
||||
type IScaCommentLikeDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaCommentLikeDo
|
||||
WithContext(ctx context.Context) IScaCommentLikeDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaCommentLikeDo
|
||||
WriteDB() IScaCommentLikeDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaCommentLikeDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaCommentLikeDo
|
||||
Not(conds ...gen.Condition) IScaCommentLikeDo
|
||||
Or(conds ...gen.Condition) IScaCommentLikeDo
|
||||
Select(conds ...field.Expr) IScaCommentLikeDo
|
||||
Where(conds ...gen.Condition) IScaCommentLikeDo
|
||||
Order(conds ...field.Expr) IScaCommentLikeDo
|
||||
Distinct(cols ...field.Expr) IScaCommentLikeDo
|
||||
Omit(cols ...field.Expr) IScaCommentLikeDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo
|
||||
Group(cols ...field.Expr) IScaCommentLikeDo
|
||||
Having(conds ...gen.Condition) IScaCommentLikeDo
|
||||
Limit(limit int) IScaCommentLikeDo
|
||||
Offset(offset int) IScaCommentLikeDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentLikeDo
|
||||
Unscoped() IScaCommentLikeDo
|
||||
Create(values ...*model.ScaCommentLike) error
|
||||
CreateInBatches(values []*model.ScaCommentLike, batchSize int) error
|
||||
Save(values ...*model.ScaCommentLike) error
|
||||
First() (*model.ScaCommentLike, error)
|
||||
Take() (*model.ScaCommentLike, error)
|
||||
Last() (*model.ScaCommentLike, error)
|
||||
Find() ([]*model.ScaCommentLike, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentLike, err error)
|
||||
FindInBatches(result *[]*model.ScaCommentLike, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaCommentLike) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaCommentLikeDo
|
||||
Assign(attrs ...field.AssignExpr) IScaCommentLikeDo
|
||||
Joins(fields ...field.RelationField) IScaCommentLikeDo
|
||||
Preload(fields ...field.RelationField) IScaCommentLikeDo
|
||||
FirstOrInit() (*model.ScaCommentLike, error)
|
||||
FirstOrCreate() (*model.ScaCommentLike, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaCommentLike, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaCommentLikeDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Debug() IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) WithContext(ctx context.Context) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) ReadDB() IScaCommentLikeDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) WriteDB() IScaCommentLikeDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Session(config *gorm.Session) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Clauses(conds ...clause.Expression) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Returning(value interface{}, columns ...string) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Not(conds ...gen.Condition) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Or(conds ...gen.Condition) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Select(conds ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Where(conds ...gen.Condition) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Order(conds ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Distinct(cols ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Omit(cols ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Join(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Group(cols ...field.Expr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Having(conds ...gen.Condition) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Limit(limit int) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Offset(offset int) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Unscoped() IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Create(values ...*model.ScaCommentLike) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) CreateInBatches(values []*model.ScaCommentLike, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaCommentLikeDo) Save(values ...*model.ScaCommentLike) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) First() (*model.ScaCommentLike, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentLike), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Take() (*model.ScaCommentLike, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentLike), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Last() (*model.ScaCommentLike, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentLike), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Find() ([]*model.ScaCommentLike, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaCommentLike), err
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentLike, err error) {
|
||||
buf := make([]*model.ScaCommentLike, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) FindInBatches(result *[]*model.ScaCommentLike, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Attrs(attrs ...field.AssignExpr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Assign(attrs ...field.AssignExpr) IScaCommentLikeDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Joins(fields ...field.RelationField) IScaCommentLikeDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Preload(fields ...field.RelationField) IScaCommentLikeDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) FirstOrInit() (*model.ScaCommentLike, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentLike), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) FirstOrCreate() (*model.ScaCommentLike, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentLike), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) FindByPage(offset int, limit int) (result []*model.ScaCommentLike, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaCommentLikeDo) Delete(models ...*model.ScaCommentLike) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaCommentLikeDo) withDO(do gen.Dao) *scaCommentLikeDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
464
app/core/api/repository/mysql/query/sca_comment_reply.gen.go
Normal file
464
app/core/api/repository/mysql/query/sca_comment_reply.gen.go
Normal file
@@ -0,0 +1,464 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaCommentReply(db *gorm.DB, opts ...gen.DOOption) scaCommentReply {
|
||||
_scaCommentReply := scaCommentReply{}
|
||||
|
||||
_scaCommentReply.scaCommentReplyDo.UseDB(db, opts...)
|
||||
_scaCommentReply.scaCommentReplyDo.UseModel(&model.ScaCommentReply{})
|
||||
|
||||
tableName := _scaCommentReply.scaCommentReplyDo.TableName()
|
||||
_scaCommentReply.ALL = field.NewAsterisk(tableName)
|
||||
_scaCommentReply.ID = field.NewInt64(tableName, "id")
|
||||
_scaCommentReply.UserID = field.NewString(tableName, "user_id")
|
||||
_scaCommentReply.TopicID = field.NewString(tableName, "topic_id")
|
||||
_scaCommentReply.TopicType = field.NewInt64(tableName, "topic_type")
|
||||
_scaCommentReply.Content = field.NewString(tableName, "content")
|
||||
_scaCommentReply.CommentType = field.NewInt64(tableName, "comment_type")
|
||||
_scaCommentReply.ReplyTo = field.NewInt64(tableName, "reply_to")
|
||||
_scaCommentReply.ReplyID = field.NewInt64(tableName, "reply_id")
|
||||
_scaCommentReply.ReplyUser = field.NewString(tableName, "reply_user")
|
||||
_scaCommentReply.Author = field.NewInt64(tableName, "author")
|
||||
_scaCommentReply.Likes = field.NewInt64(tableName, "likes")
|
||||
_scaCommentReply.ReplyCount = field.NewInt64(tableName, "reply_count")
|
||||
_scaCommentReply.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaCommentReply.Browser = field.NewString(tableName, "browser")
|
||||
_scaCommentReply.OperatingSystem = field.NewString(tableName, "operating_system")
|
||||
_scaCommentReply.CommentIP = field.NewString(tableName, "comment_ip")
|
||||
_scaCommentReply.Location = field.NewString(tableName, "location")
|
||||
_scaCommentReply.Agent = field.NewString(tableName, "agent")
|
||||
_scaCommentReply.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaCommentReply.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaCommentReply.Version = field.NewInt64(tableName, "version")
|
||||
_scaCommentReply.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaCommentReply.fillFieldMap()
|
||||
|
||||
return _scaCommentReply
|
||||
}
|
||||
|
||||
type scaCommentReply struct {
|
||||
scaCommentReplyDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键id
|
||||
UserID field.String // 评论用户id
|
||||
TopicID field.String // 评论话题id
|
||||
TopicType field.Int64 // 话题类型
|
||||
Content field.String // 评论内容
|
||||
CommentType field.Int64 // 评论类型 0评论 1 回复
|
||||
ReplyTo field.Int64 // 回复子评论ID
|
||||
ReplyID field.Int64 // 回复父评论Id
|
||||
ReplyUser field.String // 回复人id
|
||||
Author field.Int64 // 评论回复是否作者 0否 1是
|
||||
Likes field.Int64 // 点赞数
|
||||
ReplyCount field.Int64 // 回复数量
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
Browser field.String // 浏览器
|
||||
OperatingSystem field.String // 操作系统
|
||||
CommentIP field.String // IP地址
|
||||
Location field.String // 地址
|
||||
Agent field.String // 设备信息
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Version field.Int64 // 版本
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaCommentReply) Table(newTableName string) *scaCommentReply {
|
||||
s.scaCommentReplyDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaCommentReply) As(alias string) *scaCommentReply {
|
||||
s.scaCommentReplyDo.DO = *(s.scaCommentReplyDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaCommentReply) updateTableName(table string) *scaCommentReply {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.TopicID = field.NewString(table, "topic_id")
|
||||
s.TopicType = field.NewInt64(table, "topic_type")
|
||||
s.Content = field.NewString(table, "content")
|
||||
s.CommentType = field.NewInt64(table, "comment_type")
|
||||
s.ReplyTo = field.NewInt64(table, "reply_to")
|
||||
s.ReplyID = field.NewInt64(table, "reply_id")
|
||||
s.ReplyUser = field.NewString(table, "reply_user")
|
||||
s.Author = field.NewInt64(table, "author")
|
||||
s.Likes = field.NewInt64(table, "likes")
|
||||
s.ReplyCount = field.NewInt64(table, "reply_count")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.Browser = field.NewString(table, "browser")
|
||||
s.OperatingSystem = field.NewString(table, "operating_system")
|
||||
s.CommentIP = field.NewString(table, "comment_ip")
|
||||
s.Location = field.NewString(table, "location")
|
||||
s.Agent = field.NewString(table, "agent")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Version = field.NewInt64(table, "version")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaCommentReply) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaCommentReply) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 22)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["topic_id"] = s.TopicID
|
||||
s.fieldMap["topic_type"] = s.TopicType
|
||||
s.fieldMap["content"] = s.Content
|
||||
s.fieldMap["comment_type"] = s.CommentType
|
||||
s.fieldMap["reply_to"] = s.ReplyTo
|
||||
s.fieldMap["reply_id"] = s.ReplyID
|
||||
s.fieldMap["reply_user"] = s.ReplyUser
|
||||
s.fieldMap["author"] = s.Author
|
||||
s.fieldMap["likes"] = s.Likes
|
||||
s.fieldMap["reply_count"] = s.ReplyCount
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["browser"] = s.Browser
|
||||
s.fieldMap["operating_system"] = s.OperatingSystem
|
||||
s.fieldMap["comment_ip"] = s.CommentIP
|
||||
s.fieldMap["location"] = s.Location
|
||||
s.fieldMap["agent"] = s.Agent
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["version"] = s.Version
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaCommentReply) clone(db *gorm.DB) scaCommentReply {
|
||||
s.scaCommentReplyDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaCommentReply) replaceDB(db *gorm.DB) scaCommentReply {
|
||||
s.scaCommentReplyDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaCommentReplyDo struct{ gen.DO }
|
||||
|
||||
type IScaCommentReplyDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaCommentReplyDo
|
||||
WithContext(ctx context.Context) IScaCommentReplyDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaCommentReplyDo
|
||||
WriteDB() IScaCommentReplyDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaCommentReplyDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaCommentReplyDo
|
||||
Not(conds ...gen.Condition) IScaCommentReplyDo
|
||||
Or(conds ...gen.Condition) IScaCommentReplyDo
|
||||
Select(conds ...field.Expr) IScaCommentReplyDo
|
||||
Where(conds ...gen.Condition) IScaCommentReplyDo
|
||||
Order(conds ...field.Expr) IScaCommentReplyDo
|
||||
Distinct(cols ...field.Expr) IScaCommentReplyDo
|
||||
Omit(cols ...field.Expr) IScaCommentReplyDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo
|
||||
Group(cols ...field.Expr) IScaCommentReplyDo
|
||||
Having(conds ...gen.Condition) IScaCommentReplyDo
|
||||
Limit(limit int) IScaCommentReplyDo
|
||||
Offset(offset int) IScaCommentReplyDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentReplyDo
|
||||
Unscoped() IScaCommentReplyDo
|
||||
Create(values ...*model.ScaCommentReply) error
|
||||
CreateInBatches(values []*model.ScaCommentReply, batchSize int) error
|
||||
Save(values ...*model.ScaCommentReply) error
|
||||
First() (*model.ScaCommentReply, error)
|
||||
Take() (*model.ScaCommentReply, error)
|
||||
Last() (*model.ScaCommentReply, error)
|
||||
Find() ([]*model.ScaCommentReply, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentReply, err error)
|
||||
FindInBatches(result *[]*model.ScaCommentReply, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaCommentReply) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaCommentReplyDo
|
||||
Assign(attrs ...field.AssignExpr) IScaCommentReplyDo
|
||||
Joins(fields ...field.RelationField) IScaCommentReplyDo
|
||||
Preload(fields ...field.RelationField) IScaCommentReplyDo
|
||||
FirstOrInit() (*model.ScaCommentReply, error)
|
||||
FirstOrCreate() (*model.ScaCommentReply, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaCommentReply, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaCommentReplyDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Debug() IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) WithContext(ctx context.Context) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) ReadDB() IScaCommentReplyDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) WriteDB() IScaCommentReplyDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Session(config *gorm.Session) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Clauses(conds ...clause.Expression) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Returning(value interface{}, columns ...string) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Not(conds ...gen.Condition) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Or(conds ...gen.Condition) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Select(conds ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Where(conds ...gen.Condition) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Order(conds ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Distinct(cols ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Omit(cols ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Join(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Group(cols ...field.Expr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Having(conds ...gen.Condition) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Limit(limit int) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Offset(offset int) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Unscoped() IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Create(values ...*model.ScaCommentReply) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) CreateInBatches(values []*model.ScaCommentReply, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaCommentReplyDo) Save(values ...*model.ScaCommentReply) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) First() (*model.ScaCommentReply, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentReply), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Take() (*model.ScaCommentReply, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentReply), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Last() (*model.ScaCommentReply, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentReply), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Find() ([]*model.ScaCommentReply, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaCommentReply), err
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaCommentReply, err error) {
|
||||
buf := make([]*model.ScaCommentReply, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) FindInBatches(result *[]*model.ScaCommentReply, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Attrs(attrs ...field.AssignExpr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Assign(attrs ...field.AssignExpr) IScaCommentReplyDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Joins(fields ...field.RelationField) IScaCommentReplyDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Preload(fields ...field.RelationField) IScaCommentReplyDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) FirstOrInit() (*model.ScaCommentReply, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentReply), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) FirstOrCreate() (*model.ScaCommentReply, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaCommentReply), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) FindByPage(offset int, limit int) (result []*model.ScaCommentReply, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaCommentReplyDo) Delete(models ...*model.ScaCommentReply) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaCommentReplyDo) withDO(do gen.Dao) *scaCommentReplyDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
416
app/core/api/repository/mysql/query/sca_file_folder.gen.go
Normal file
416
app/core/api/repository/mysql/query/sca_file_folder.gen.go
Normal file
@@ -0,0 +1,416 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaFileFolder(db *gorm.DB, opts ...gen.DOOption) scaFileFolder {
|
||||
_scaFileFolder := scaFileFolder{}
|
||||
|
||||
_scaFileFolder.scaFileFolderDo.UseDB(db, opts...)
|
||||
_scaFileFolder.scaFileFolderDo.UseModel(&model.ScaFileFolder{})
|
||||
|
||||
tableName := _scaFileFolder.scaFileFolderDo.TableName()
|
||||
_scaFileFolder.ALL = field.NewAsterisk(tableName)
|
||||
_scaFileFolder.ID = field.NewInt64(tableName, "id")
|
||||
_scaFileFolder.FolderName = field.NewString(tableName, "folder_name")
|
||||
_scaFileFolder.ParentFolderID = field.NewInt64(tableName, "parent_folder_id")
|
||||
_scaFileFolder.FolderAddr = field.NewString(tableName, "folder_addr")
|
||||
_scaFileFolder.UserID = field.NewString(tableName, "user_id")
|
||||
_scaFileFolder.FolderSource = field.NewInt64(tableName, "folder_source")
|
||||
_scaFileFolder.CreatedTime = field.NewTime(tableName, "created_time")
|
||||
_scaFileFolder.UpdateTime = field.NewTime(tableName, "update_time")
|
||||
_scaFileFolder.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileFolder.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaFileFolder.fillFieldMap()
|
||||
|
||||
return _scaFileFolder
|
||||
}
|
||||
|
||||
type scaFileFolder struct {
|
||||
scaFileFolderDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
FolderName field.String // 文件夹名称
|
||||
ParentFolderID field.Int64 // 父文件夹编号
|
||||
FolderAddr field.String // 文件夹名称
|
||||
UserID field.String // 用户编号
|
||||
FolderSource field.Int64 // 文件夹来源 0相册 1 评论
|
||||
CreatedTime field.Time // 创建时间
|
||||
UpdateTime field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaFileFolder) Table(newTableName string) *scaFileFolder {
|
||||
s.scaFileFolderDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaFileFolder) As(alias string) *scaFileFolder {
|
||||
s.scaFileFolderDo.DO = *(s.scaFileFolderDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaFileFolder) updateTableName(table string) *scaFileFolder {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.FolderName = field.NewString(table, "folder_name")
|
||||
s.ParentFolderID = field.NewInt64(table, "parent_folder_id")
|
||||
s.FolderAddr = field.NewString(table, "folder_addr")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.FolderSource = field.NewInt64(table, "folder_source")
|
||||
s.CreatedTime = field.NewTime(table, "created_time")
|
||||
s.UpdateTime = field.NewTime(table, "update_time")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaFileFolder) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaFileFolder) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 10)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["folder_name"] = s.FolderName
|
||||
s.fieldMap["parent_folder_id"] = s.ParentFolderID
|
||||
s.fieldMap["folder_addr"] = s.FolderAddr
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["folder_source"] = s.FolderSource
|
||||
s.fieldMap["created_time"] = s.CreatedTime
|
||||
s.fieldMap["update_time"] = s.UpdateTime
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaFileFolder) clone(db *gorm.DB) scaFileFolder {
|
||||
s.scaFileFolderDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaFileFolder) replaceDB(db *gorm.DB) scaFileFolder {
|
||||
s.scaFileFolderDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaFileFolderDo struct{ gen.DO }
|
||||
|
||||
type IScaFileFolderDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaFileFolderDo
|
||||
WithContext(ctx context.Context) IScaFileFolderDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaFileFolderDo
|
||||
WriteDB() IScaFileFolderDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaFileFolderDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaFileFolderDo
|
||||
Not(conds ...gen.Condition) IScaFileFolderDo
|
||||
Or(conds ...gen.Condition) IScaFileFolderDo
|
||||
Select(conds ...field.Expr) IScaFileFolderDo
|
||||
Where(conds ...gen.Condition) IScaFileFolderDo
|
||||
Order(conds ...field.Expr) IScaFileFolderDo
|
||||
Distinct(cols ...field.Expr) IScaFileFolderDo
|
||||
Omit(cols ...field.Expr) IScaFileFolderDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaFileFolderDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo
|
||||
Group(cols ...field.Expr) IScaFileFolderDo
|
||||
Having(conds ...gen.Condition) IScaFileFolderDo
|
||||
Limit(limit int) IScaFileFolderDo
|
||||
Offset(offset int) IScaFileFolderDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileFolderDo
|
||||
Unscoped() IScaFileFolderDo
|
||||
Create(values ...*model.ScaFileFolder) error
|
||||
CreateInBatches(values []*model.ScaFileFolder, batchSize int) error
|
||||
Save(values ...*model.ScaFileFolder) error
|
||||
First() (*model.ScaFileFolder, error)
|
||||
Take() (*model.ScaFileFolder, error)
|
||||
Last() (*model.ScaFileFolder, error)
|
||||
Find() ([]*model.ScaFileFolder, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileFolder, err error)
|
||||
FindInBatches(result *[]*model.ScaFileFolder, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaFileFolder) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaFileFolderDo
|
||||
Assign(attrs ...field.AssignExpr) IScaFileFolderDo
|
||||
Joins(fields ...field.RelationField) IScaFileFolderDo
|
||||
Preload(fields ...field.RelationField) IScaFileFolderDo
|
||||
FirstOrInit() (*model.ScaFileFolder, error)
|
||||
FirstOrCreate() (*model.ScaFileFolder, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaFileFolder, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaFileFolderDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Debug() IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) WithContext(ctx context.Context) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) ReadDB() IScaFileFolderDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) WriteDB() IScaFileFolderDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Session(config *gorm.Session) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Clauses(conds ...clause.Expression) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Returning(value interface{}, columns ...string) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Not(conds ...gen.Condition) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Or(conds ...gen.Condition) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Select(conds ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Where(conds ...gen.Condition) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Order(conds ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Distinct(cols ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Omit(cols ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Join(table schema.Tabler, on ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Group(cols ...field.Expr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Having(conds ...gen.Condition) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Limit(limit int) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Offset(offset int) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Unscoped() IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Create(values ...*model.ScaFileFolder) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) CreateInBatches(values []*model.ScaFileFolder, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaFileFolderDo) Save(values ...*model.ScaFileFolder) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) First() (*model.ScaFileFolder, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileFolder), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Take() (*model.ScaFileFolder, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileFolder), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Last() (*model.ScaFileFolder, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileFolder), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Find() ([]*model.ScaFileFolder, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaFileFolder), err
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileFolder, err error) {
|
||||
buf := make([]*model.ScaFileFolder, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) FindInBatches(result *[]*model.ScaFileFolder, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Attrs(attrs ...field.AssignExpr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Assign(attrs ...field.AssignExpr) IScaFileFolderDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Joins(fields ...field.RelationField) IScaFileFolderDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Preload(fields ...field.RelationField) IScaFileFolderDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) FirstOrInit() (*model.ScaFileFolder, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileFolder), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) FirstOrCreate() (*model.ScaFileFolder, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileFolder), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) FindByPage(offset int, limit int) (result []*model.ScaFileFolder, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaFileFolderDo) Delete(models ...*model.ScaFileFolder) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaFileFolderDo) withDO(do gen.Dao) *scaFileFolderDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
428
app/core/api/repository/mysql/query/sca_file_info.gen.go
Normal file
428
app/core/api/repository/mysql/query/sca_file_info.gen.go
Normal file
@@ -0,0 +1,428 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaFileInfo(db *gorm.DB, opts ...gen.DOOption) scaFileInfo {
|
||||
_scaFileInfo := scaFileInfo{}
|
||||
|
||||
_scaFileInfo.scaFileInfoDo.UseDB(db, opts...)
|
||||
_scaFileInfo.scaFileInfoDo.UseModel(&model.ScaFileInfo{})
|
||||
|
||||
tableName := _scaFileInfo.scaFileInfoDo.TableName()
|
||||
_scaFileInfo.ALL = field.NewAsterisk(tableName)
|
||||
_scaFileInfo.ID = field.NewInt64(tableName, "id")
|
||||
_scaFileInfo.FileName = field.NewString(tableName, "file_name")
|
||||
_scaFileInfo.FileSize = field.NewFloat64(tableName, "file_size")
|
||||
_scaFileInfo.FileTypeID = field.NewInt64(tableName, "file_type_id")
|
||||
_scaFileInfo.UploadTime = field.NewTime(tableName, "upload_time")
|
||||
_scaFileInfo.FolderID = field.NewInt64(tableName, "folder_id")
|
||||
_scaFileInfo.UserID = field.NewString(tableName, "user_id")
|
||||
_scaFileInfo.FileSource = field.NewInt64(tableName, "file_source")
|
||||
_scaFileInfo.Status = field.NewInt64(tableName, "status")
|
||||
_scaFileInfo.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaFileInfo.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaFileInfo.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileInfo.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaFileInfo.fillFieldMap()
|
||||
|
||||
return _scaFileInfo
|
||||
}
|
||||
|
||||
type scaFileInfo struct {
|
||||
scaFileInfoDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
FileName field.String // 文件名
|
||||
FileSize field.Float64 // 文件大小
|
||||
FileTypeID field.Int64 // 文件类型编号
|
||||
UploadTime field.Time // 上传时间
|
||||
FolderID field.Int64 // 文件夹编号
|
||||
UserID field.String // 用户编号
|
||||
FileSource field.Int64 // 文件来源 0 相册 1 评论
|
||||
Status field.Int64 // 文件状态
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaFileInfo) Table(newTableName string) *scaFileInfo {
|
||||
s.scaFileInfoDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaFileInfo) As(alias string) *scaFileInfo {
|
||||
s.scaFileInfoDo.DO = *(s.scaFileInfoDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaFileInfo) updateTableName(table string) *scaFileInfo {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.FileName = field.NewString(table, "file_name")
|
||||
s.FileSize = field.NewFloat64(table, "file_size")
|
||||
s.FileTypeID = field.NewInt64(table, "file_type_id")
|
||||
s.UploadTime = field.NewTime(table, "upload_time")
|
||||
s.FolderID = field.NewInt64(table, "folder_id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.FileSource = field.NewInt64(table, "file_source")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaFileInfo) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaFileInfo) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 13)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["file_name"] = s.FileName
|
||||
s.fieldMap["file_size"] = s.FileSize
|
||||
s.fieldMap["file_type_id"] = s.FileTypeID
|
||||
s.fieldMap["upload_time"] = s.UploadTime
|
||||
s.fieldMap["folder_id"] = s.FolderID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["file_source"] = s.FileSource
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaFileInfo) clone(db *gorm.DB) scaFileInfo {
|
||||
s.scaFileInfoDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaFileInfo) replaceDB(db *gorm.DB) scaFileInfo {
|
||||
s.scaFileInfoDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaFileInfoDo struct{ gen.DO }
|
||||
|
||||
type IScaFileInfoDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaFileInfoDo
|
||||
WithContext(ctx context.Context) IScaFileInfoDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaFileInfoDo
|
||||
WriteDB() IScaFileInfoDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaFileInfoDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaFileInfoDo
|
||||
Not(conds ...gen.Condition) IScaFileInfoDo
|
||||
Or(conds ...gen.Condition) IScaFileInfoDo
|
||||
Select(conds ...field.Expr) IScaFileInfoDo
|
||||
Where(conds ...gen.Condition) IScaFileInfoDo
|
||||
Order(conds ...field.Expr) IScaFileInfoDo
|
||||
Distinct(cols ...field.Expr) IScaFileInfoDo
|
||||
Omit(cols ...field.Expr) IScaFileInfoDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaFileInfoDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo
|
||||
Group(cols ...field.Expr) IScaFileInfoDo
|
||||
Having(conds ...gen.Condition) IScaFileInfoDo
|
||||
Limit(limit int) IScaFileInfoDo
|
||||
Offset(offset int) IScaFileInfoDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileInfoDo
|
||||
Unscoped() IScaFileInfoDo
|
||||
Create(values ...*model.ScaFileInfo) error
|
||||
CreateInBatches(values []*model.ScaFileInfo, batchSize int) error
|
||||
Save(values ...*model.ScaFileInfo) error
|
||||
First() (*model.ScaFileInfo, error)
|
||||
Take() (*model.ScaFileInfo, error)
|
||||
Last() (*model.ScaFileInfo, error)
|
||||
Find() ([]*model.ScaFileInfo, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileInfo, err error)
|
||||
FindInBatches(result *[]*model.ScaFileInfo, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaFileInfo) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaFileInfoDo
|
||||
Assign(attrs ...field.AssignExpr) IScaFileInfoDo
|
||||
Joins(fields ...field.RelationField) IScaFileInfoDo
|
||||
Preload(fields ...field.RelationField) IScaFileInfoDo
|
||||
FirstOrInit() (*model.ScaFileInfo, error)
|
||||
FirstOrCreate() (*model.ScaFileInfo, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaFileInfo, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaFileInfoDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Debug() IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) WithContext(ctx context.Context) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) ReadDB() IScaFileInfoDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) WriteDB() IScaFileInfoDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Session(config *gorm.Session) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Clauses(conds ...clause.Expression) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Returning(value interface{}, columns ...string) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Not(conds ...gen.Condition) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Or(conds ...gen.Condition) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Select(conds ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Where(conds ...gen.Condition) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Order(conds ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Distinct(cols ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Omit(cols ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Join(table schema.Tabler, on ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Group(cols ...field.Expr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Having(conds ...gen.Condition) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Limit(limit int) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Offset(offset int) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Unscoped() IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Create(values ...*model.ScaFileInfo) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) CreateInBatches(values []*model.ScaFileInfo, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaFileInfoDo) Save(values ...*model.ScaFileInfo) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) First() (*model.ScaFileInfo, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileInfo), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Take() (*model.ScaFileInfo, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileInfo), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Last() (*model.ScaFileInfo, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileInfo), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Find() ([]*model.ScaFileInfo, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaFileInfo), err
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileInfo, err error) {
|
||||
buf := make([]*model.ScaFileInfo, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) FindInBatches(result *[]*model.ScaFileInfo, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Attrs(attrs ...field.AssignExpr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Assign(attrs ...field.AssignExpr) IScaFileInfoDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Joins(fields ...field.RelationField) IScaFileInfoDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Preload(fields ...field.RelationField) IScaFileInfoDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) FirstOrInit() (*model.ScaFileInfo, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileInfo), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) FirstOrCreate() (*model.ScaFileInfo, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileInfo), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) FindByPage(offset int, limit int) (result []*model.ScaFileInfo, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaFileInfoDo) Delete(models ...*model.ScaFileInfo) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaFileInfoDo) withDO(do gen.Dao) *scaFileInfoDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
412
app/core/api/repository/mysql/query/sca_file_recycle.gen.go
Normal file
412
app/core/api/repository/mysql/query/sca_file_recycle.gen.go
Normal file
@@ -0,0 +1,412 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaFileRecycle(db *gorm.DB, opts ...gen.DOOption) scaFileRecycle {
|
||||
_scaFileRecycle := scaFileRecycle{}
|
||||
|
||||
_scaFileRecycle.scaFileRecycleDo.UseDB(db, opts...)
|
||||
_scaFileRecycle.scaFileRecycleDo.UseModel(&model.ScaFileRecycle{})
|
||||
|
||||
tableName := _scaFileRecycle.scaFileRecycleDo.TableName()
|
||||
_scaFileRecycle.ALL = field.NewAsterisk(tableName)
|
||||
_scaFileRecycle.ID = field.NewInt64(tableName, "id")
|
||||
_scaFileRecycle.FileID = field.NewInt64(tableName, "file_id")
|
||||
_scaFileRecycle.FolderID = field.NewInt64(tableName, "folder_id")
|
||||
_scaFileRecycle.Type = field.NewInt64(tableName, "type")
|
||||
_scaFileRecycle.UserID = field.NewString(tableName, "user_id")
|
||||
_scaFileRecycle.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
_scaFileRecycle.OriginalPath = field.NewString(tableName, "original_path")
|
||||
_scaFileRecycle.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileRecycle.FileSource = field.NewInt64(tableName, "file_source")
|
||||
|
||||
_scaFileRecycle.fillFieldMap()
|
||||
|
||||
return _scaFileRecycle
|
||||
}
|
||||
|
||||
type scaFileRecycle struct {
|
||||
scaFileRecycleDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
FileID field.Int64 // 文件编号
|
||||
FolderID field.Int64 // 文件夹编号
|
||||
Type field.Int64 // 类型 0 文件 1 文件夹
|
||||
UserID field.String // 用户编号
|
||||
DeletedAt field.Field // 删除时间
|
||||
OriginalPath field.String // 原始路径
|
||||
Deleted field.Int64 // 是否被永久删除 0否 1是
|
||||
FileSource field.Int64 // 文件来源 0 相册 1 评论
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaFileRecycle) Table(newTableName string) *scaFileRecycle {
|
||||
s.scaFileRecycleDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaFileRecycle) As(alias string) *scaFileRecycle {
|
||||
s.scaFileRecycleDo.DO = *(s.scaFileRecycleDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaFileRecycle) updateTableName(table string) *scaFileRecycle {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.FileID = field.NewInt64(table, "file_id")
|
||||
s.FolderID = field.NewInt64(table, "folder_id")
|
||||
s.Type = field.NewInt64(table, "type")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
s.OriginalPath = field.NewString(table, "original_path")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.FileSource = field.NewInt64(table, "file_source")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaFileRecycle) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaFileRecycle) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 9)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["file_id"] = s.FileID
|
||||
s.fieldMap["folder_id"] = s.FolderID
|
||||
s.fieldMap["type"] = s.Type
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
s.fieldMap["original_path"] = s.OriginalPath
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["file_source"] = s.FileSource
|
||||
}
|
||||
|
||||
func (s scaFileRecycle) clone(db *gorm.DB) scaFileRecycle {
|
||||
s.scaFileRecycleDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaFileRecycle) replaceDB(db *gorm.DB) scaFileRecycle {
|
||||
s.scaFileRecycleDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaFileRecycleDo struct{ gen.DO }
|
||||
|
||||
type IScaFileRecycleDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaFileRecycleDo
|
||||
WithContext(ctx context.Context) IScaFileRecycleDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaFileRecycleDo
|
||||
WriteDB() IScaFileRecycleDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaFileRecycleDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaFileRecycleDo
|
||||
Not(conds ...gen.Condition) IScaFileRecycleDo
|
||||
Or(conds ...gen.Condition) IScaFileRecycleDo
|
||||
Select(conds ...field.Expr) IScaFileRecycleDo
|
||||
Where(conds ...gen.Condition) IScaFileRecycleDo
|
||||
Order(conds ...field.Expr) IScaFileRecycleDo
|
||||
Distinct(cols ...field.Expr) IScaFileRecycleDo
|
||||
Omit(cols ...field.Expr) IScaFileRecycleDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo
|
||||
Group(cols ...field.Expr) IScaFileRecycleDo
|
||||
Having(conds ...gen.Condition) IScaFileRecycleDo
|
||||
Limit(limit int) IScaFileRecycleDo
|
||||
Offset(offset int) IScaFileRecycleDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileRecycleDo
|
||||
Unscoped() IScaFileRecycleDo
|
||||
Create(values ...*model.ScaFileRecycle) error
|
||||
CreateInBatches(values []*model.ScaFileRecycle, batchSize int) error
|
||||
Save(values ...*model.ScaFileRecycle) error
|
||||
First() (*model.ScaFileRecycle, error)
|
||||
Take() (*model.ScaFileRecycle, error)
|
||||
Last() (*model.ScaFileRecycle, error)
|
||||
Find() ([]*model.ScaFileRecycle, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileRecycle, err error)
|
||||
FindInBatches(result *[]*model.ScaFileRecycle, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaFileRecycle) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaFileRecycleDo
|
||||
Assign(attrs ...field.AssignExpr) IScaFileRecycleDo
|
||||
Joins(fields ...field.RelationField) IScaFileRecycleDo
|
||||
Preload(fields ...field.RelationField) IScaFileRecycleDo
|
||||
FirstOrInit() (*model.ScaFileRecycle, error)
|
||||
FirstOrCreate() (*model.ScaFileRecycle, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaFileRecycle, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaFileRecycleDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Debug() IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) WithContext(ctx context.Context) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) ReadDB() IScaFileRecycleDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) WriteDB() IScaFileRecycleDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Session(config *gorm.Session) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Clauses(conds ...clause.Expression) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Returning(value interface{}, columns ...string) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Not(conds ...gen.Condition) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Or(conds ...gen.Condition) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Select(conds ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Where(conds ...gen.Condition) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Order(conds ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Distinct(cols ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Omit(cols ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Join(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Group(cols ...field.Expr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Having(conds ...gen.Condition) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Limit(limit int) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Offset(offset int) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Unscoped() IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Create(values ...*model.ScaFileRecycle) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) CreateInBatches(values []*model.ScaFileRecycle, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaFileRecycleDo) Save(values ...*model.ScaFileRecycle) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) First() (*model.ScaFileRecycle, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileRecycle), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Take() (*model.ScaFileRecycle, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileRecycle), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Last() (*model.ScaFileRecycle, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileRecycle), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Find() ([]*model.ScaFileRecycle, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaFileRecycle), err
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileRecycle, err error) {
|
||||
buf := make([]*model.ScaFileRecycle, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) FindInBatches(result *[]*model.ScaFileRecycle, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Attrs(attrs ...field.AssignExpr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Assign(attrs ...field.AssignExpr) IScaFileRecycleDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Joins(fields ...field.RelationField) IScaFileRecycleDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Preload(fields ...field.RelationField) IScaFileRecycleDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) FirstOrInit() (*model.ScaFileRecycle, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileRecycle), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) FirstOrCreate() (*model.ScaFileRecycle, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileRecycle), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) FindByPage(offset int, limit int) (result []*model.ScaFileRecycle, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaFileRecycleDo) Delete(models ...*model.ScaFileRecycle) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaFileRecycleDo) withDO(do gen.Dao) *scaFileRecycleDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
408
app/core/api/repository/mysql/query/sca_file_type.gen.go
Normal file
408
app/core/api/repository/mysql/query/sca_file_type.gen.go
Normal file
@@ -0,0 +1,408 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaFileType(db *gorm.DB, opts ...gen.DOOption) scaFileType {
|
||||
_scaFileType := scaFileType{}
|
||||
|
||||
_scaFileType.scaFileTypeDo.UseDB(db, opts...)
|
||||
_scaFileType.scaFileTypeDo.UseModel(&model.ScaFileType{})
|
||||
|
||||
tableName := _scaFileType.scaFileTypeDo.TableName()
|
||||
_scaFileType.ALL = field.NewAsterisk(tableName)
|
||||
_scaFileType.ID = field.NewInt64(tableName, "id")
|
||||
_scaFileType.TypeName = field.NewString(tableName, "type_name")
|
||||
_scaFileType.MimeType = field.NewString(tableName, "mime_type")
|
||||
_scaFileType.Status = field.NewInt64(tableName, "status")
|
||||
_scaFileType.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaFileType.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaFileType.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaFileType.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaFileType.fillFieldMap()
|
||||
|
||||
return _scaFileType
|
||||
}
|
||||
|
||||
type scaFileType struct {
|
||||
scaFileTypeDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
TypeName field.String // 类型名称
|
||||
MimeType field.String // MIME 类型
|
||||
Status field.Int64 // 类型状态
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaFileType) Table(newTableName string) *scaFileType {
|
||||
s.scaFileTypeDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaFileType) As(alias string) *scaFileType {
|
||||
s.scaFileTypeDo.DO = *(s.scaFileTypeDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaFileType) updateTableName(table string) *scaFileType {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.TypeName = field.NewString(table, "type_name")
|
||||
s.MimeType = field.NewString(table, "mime_type")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaFileType) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaFileType) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 8)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["type_name"] = s.TypeName
|
||||
s.fieldMap["mime_type"] = s.MimeType
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaFileType) clone(db *gorm.DB) scaFileType {
|
||||
s.scaFileTypeDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaFileType) replaceDB(db *gorm.DB) scaFileType {
|
||||
s.scaFileTypeDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaFileTypeDo struct{ gen.DO }
|
||||
|
||||
type IScaFileTypeDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaFileTypeDo
|
||||
WithContext(ctx context.Context) IScaFileTypeDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaFileTypeDo
|
||||
WriteDB() IScaFileTypeDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaFileTypeDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaFileTypeDo
|
||||
Not(conds ...gen.Condition) IScaFileTypeDo
|
||||
Or(conds ...gen.Condition) IScaFileTypeDo
|
||||
Select(conds ...field.Expr) IScaFileTypeDo
|
||||
Where(conds ...gen.Condition) IScaFileTypeDo
|
||||
Order(conds ...field.Expr) IScaFileTypeDo
|
||||
Distinct(cols ...field.Expr) IScaFileTypeDo
|
||||
Omit(cols ...field.Expr) IScaFileTypeDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaFileTypeDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo
|
||||
Group(cols ...field.Expr) IScaFileTypeDo
|
||||
Having(conds ...gen.Condition) IScaFileTypeDo
|
||||
Limit(limit int) IScaFileTypeDo
|
||||
Offset(offset int) IScaFileTypeDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileTypeDo
|
||||
Unscoped() IScaFileTypeDo
|
||||
Create(values ...*model.ScaFileType) error
|
||||
CreateInBatches(values []*model.ScaFileType, batchSize int) error
|
||||
Save(values ...*model.ScaFileType) error
|
||||
First() (*model.ScaFileType, error)
|
||||
Take() (*model.ScaFileType, error)
|
||||
Last() (*model.ScaFileType, error)
|
||||
Find() ([]*model.ScaFileType, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileType, err error)
|
||||
FindInBatches(result *[]*model.ScaFileType, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaFileType) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaFileTypeDo
|
||||
Assign(attrs ...field.AssignExpr) IScaFileTypeDo
|
||||
Joins(fields ...field.RelationField) IScaFileTypeDo
|
||||
Preload(fields ...field.RelationField) IScaFileTypeDo
|
||||
FirstOrInit() (*model.ScaFileType, error)
|
||||
FirstOrCreate() (*model.ScaFileType, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaFileType, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaFileTypeDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Debug() IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) WithContext(ctx context.Context) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) ReadDB() IScaFileTypeDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) WriteDB() IScaFileTypeDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Session(config *gorm.Session) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Clauses(conds ...clause.Expression) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Returning(value interface{}, columns ...string) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Not(conds ...gen.Condition) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Or(conds ...gen.Condition) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Select(conds ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Where(conds ...gen.Condition) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Order(conds ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Distinct(cols ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Omit(cols ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Join(table schema.Tabler, on ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Group(cols ...field.Expr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Having(conds ...gen.Condition) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Limit(limit int) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Offset(offset int) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Unscoped() IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Create(values ...*model.ScaFileType) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) CreateInBatches(values []*model.ScaFileType, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaFileTypeDo) Save(values ...*model.ScaFileType) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) First() (*model.ScaFileType, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileType), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Take() (*model.ScaFileType, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileType), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Last() (*model.ScaFileType, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileType), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Find() ([]*model.ScaFileType, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaFileType), err
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaFileType, err error) {
|
||||
buf := make([]*model.ScaFileType, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) FindInBatches(result *[]*model.ScaFileType, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Attrs(attrs ...field.AssignExpr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Assign(attrs ...field.AssignExpr) IScaFileTypeDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Joins(fields ...field.RelationField) IScaFileTypeDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Preload(fields ...field.RelationField) IScaFileTypeDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) FirstOrInit() (*model.ScaFileType, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileType), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) FirstOrCreate() (*model.ScaFileType, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaFileType), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) FindByPage(offset int, limit int) (result []*model.ScaFileType, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaFileTypeDo) Delete(models ...*model.ScaFileType) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaFileTypeDo) withDO(do gen.Dao) *scaFileTypeDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
432
app/core/api/repository/mysql/query/sca_message_report.gen.go
Normal file
432
app/core/api/repository/mysql/query/sca_message_report.gen.go
Normal file
@@ -0,0 +1,432 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaMessageReport(db *gorm.DB, opts ...gen.DOOption) scaMessageReport {
|
||||
_scaMessageReport := scaMessageReport{}
|
||||
|
||||
_scaMessageReport.scaMessageReportDo.UseDB(db, opts...)
|
||||
_scaMessageReport.scaMessageReportDo.UseModel(&model.ScaMessageReport{})
|
||||
|
||||
tableName := _scaMessageReport.scaMessageReportDo.TableName()
|
||||
_scaMessageReport.ALL = field.NewAsterisk(tableName)
|
||||
_scaMessageReport.ID = field.NewInt64(tableName, "id")
|
||||
_scaMessageReport.UserID = field.NewString(tableName, "user_id")
|
||||
_scaMessageReport.Type = field.NewInt64(tableName, "type")
|
||||
_scaMessageReport.CommentID = field.NewInt64(tableName, "comment_id")
|
||||
_scaMessageReport.TopicID = field.NewString(tableName, "topic_id")
|
||||
_scaMessageReport.ReportType = field.NewInt64(tableName, "report_type")
|
||||
_scaMessageReport.ReportContent = field.NewString(tableName, "report_content")
|
||||
_scaMessageReport.ReportTag = field.NewString(tableName, "report_tag")
|
||||
_scaMessageReport.Status = field.NewInt64(tableName, "status")
|
||||
_scaMessageReport.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaMessageReport.UpdateBy = field.NewString(tableName, "update_by")
|
||||
_scaMessageReport.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaMessageReport.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaMessageReport.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaMessageReport.fillFieldMap()
|
||||
|
||||
return _scaMessageReport
|
||||
}
|
||||
|
||||
type scaMessageReport struct {
|
||||
scaMessageReportDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
UserID field.String // 用户Id
|
||||
Type field.Int64 // 举报类型 0评论 1 相册
|
||||
CommentID field.Int64 // 评论Id
|
||||
TopicID field.String // 话题Id
|
||||
ReportType field.Int64 // 举报
|
||||
ReportContent field.String // 举报说明内容
|
||||
ReportTag field.String // 举报标签
|
||||
Status field.Int64 // 状态(0 未处理 1 已处理)
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdateBy field.String // 更新人
|
||||
UpdatedAt field.Time // 更新时间
|
||||
Deleted field.Int64 // 是否删除 0否 1是
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaMessageReport) Table(newTableName string) *scaMessageReport {
|
||||
s.scaMessageReportDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaMessageReport) As(alias string) *scaMessageReport {
|
||||
s.scaMessageReportDo.DO = *(s.scaMessageReportDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaMessageReport) updateTableName(table string) *scaMessageReport {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.Type = field.NewInt64(table, "type")
|
||||
s.CommentID = field.NewInt64(table, "comment_id")
|
||||
s.TopicID = field.NewString(table, "topic_id")
|
||||
s.ReportType = field.NewInt64(table, "report_type")
|
||||
s.ReportContent = field.NewString(table, "report_content")
|
||||
s.ReportTag = field.NewString(table, "report_tag")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdateBy = field.NewString(table, "update_by")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaMessageReport) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaMessageReport) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 14)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["type"] = s.Type
|
||||
s.fieldMap["comment_id"] = s.CommentID
|
||||
s.fieldMap["topic_id"] = s.TopicID
|
||||
s.fieldMap["report_type"] = s.ReportType
|
||||
s.fieldMap["report_content"] = s.ReportContent
|
||||
s.fieldMap["report_tag"] = s.ReportTag
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["update_by"] = s.UpdateBy
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaMessageReport) clone(db *gorm.DB) scaMessageReport {
|
||||
s.scaMessageReportDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaMessageReport) replaceDB(db *gorm.DB) scaMessageReport {
|
||||
s.scaMessageReportDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaMessageReportDo struct{ gen.DO }
|
||||
|
||||
type IScaMessageReportDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaMessageReportDo
|
||||
WithContext(ctx context.Context) IScaMessageReportDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaMessageReportDo
|
||||
WriteDB() IScaMessageReportDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaMessageReportDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaMessageReportDo
|
||||
Not(conds ...gen.Condition) IScaMessageReportDo
|
||||
Or(conds ...gen.Condition) IScaMessageReportDo
|
||||
Select(conds ...field.Expr) IScaMessageReportDo
|
||||
Where(conds ...gen.Condition) IScaMessageReportDo
|
||||
Order(conds ...field.Expr) IScaMessageReportDo
|
||||
Distinct(cols ...field.Expr) IScaMessageReportDo
|
||||
Omit(cols ...field.Expr) IScaMessageReportDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaMessageReportDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo
|
||||
Group(cols ...field.Expr) IScaMessageReportDo
|
||||
Having(conds ...gen.Condition) IScaMessageReportDo
|
||||
Limit(limit int) IScaMessageReportDo
|
||||
Offset(offset int) IScaMessageReportDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaMessageReportDo
|
||||
Unscoped() IScaMessageReportDo
|
||||
Create(values ...*model.ScaMessageReport) error
|
||||
CreateInBatches(values []*model.ScaMessageReport, batchSize int) error
|
||||
Save(values ...*model.ScaMessageReport) error
|
||||
First() (*model.ScaMessageReport, error)
|
||||
Take() (*model.ScaMessageReport, error)
|
||||
Last() (*model.ScaMessageReport, error)
|
||||
Find() ([]*model.ScaMessageReport, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaMessageReport, err error)
|
||||
FindInBatches(result *[]*model.ScaMessageReport, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaMessageReport) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaMessageReportDo
|
||||
Assign(attrs ...field.AssignExpr) IScaMessageReportDo
|
||||
Joins(fields ...field.RelationField) IScaMessageReportDo
|
||||
Preload(fields ...field.RelationField) IScaMessageReportDo
|
||||
FirstOrInit() (*model.ScaMessageReport, error)
|
||||
FirstOrCreate() (*model.ScaMessageReport, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaMessageReport, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaMessageReportDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Debug() IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) WithContext(ctx context.Context) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) ReadDB() IScaMessageReportDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) WriteDB() IScaMessageReportDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Session(config *gorm.Session) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Clauses(conds ...clause.Expression) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Returning(value interface{}, columns ...string) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Not(conds ...gen.Condition) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Or(conds ...gen.Condition) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Select(conds ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Where(conds ...gen.Condition) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Order(conds ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Distinct(cols ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Omit(cols ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Join(table schema.Tabler, on ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Group(cols ...field.Expr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Having(conds ...gen.Condition) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Limit(limit int) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Offset(offset int) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Unscoped() IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Create(values ...*model.ScaMessageReport) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) CreateInBatches(values []*model.ScaMessageReport, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaMessageReportDo) Save(values ...*model.ScaMessageReport) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) First() (*model.ScaMessageReport, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaMessageReport), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Take() (*model.ScaMessageReport, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaMessageReport), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Last() (*model.ScaMessageReport, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaMessageReport), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Find() ([]*model.ScaMessageReport, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaMessageReport), err
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaMessageReport, err error) {
|
||||
buf := make([]*model.ScaMessageReport, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) FindInBatches(result *[]*model.ScaMessageReport, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Attrs(attrs ...field.AssignExpr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Assign(attrs ...field.AssignExpr) IScaMessageReportDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Joins(fields ...field.RelationField) IScaMessageReportDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Preload(fields ...field.RelationField) IScaMessageReportDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) FirstOrInit() (*model.ScaMessageReport, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaMessageReport), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) FirstOrCreate() (*model.ScaMessageReport, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaMessageReport), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) FindByPage(offset int, limit int) (result []*model.ScaMessageReport, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaMessageReportDo) Delete(models ...*model.ScaMessageReport) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaMessageReportDo) withDO(do gen.Dao) *scaMessageReportDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
404
app/core/api/repository/mysql/query/sca_user_follows.gen.go
Normal file
404
app/core/api/repository/mysql/query/sca_user_follows.gen.go
Normal file
@@ -0,0 +1,404 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaUserFollow(db *gorm.DB, opts ...gen.DOOption) scaUserFollow {
|
||||
_scaUserFollow := scaUserFollow{}
|
||||
|
||||
_scaUserFollow.scaUserFollowDo.UseDB(db, opts...)
|
||||
_scaUserFollow.scaUserFollowDo.UseModel(&model.ScaUserFollow{})
|
||||
|
||||
tableName := _scaUserFollow.scaUserFollowDo.TableName()
|
||||
_scaUserFollow.ALL = field.NewAsterisk(tableName)
|
||||
_scaUserFollow.FollowerID = field.NewString(tableName, "follower_id")
|
||||
_scaUserFollow.FolloweeID = field.NewString(tableName, "followee_id")
|
||||
_scaUserFollow.Status = field.NewInt64(tableName, "status")
|
||||
_scaUserFollow.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaUserFollow.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaUserFollow.ID = field.NewInt64(tableName, "id")
|
||||
_scaUserFollow.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaUserFollow.fillFieldMap()
|
||||
|
||||
return _scaUserFollow
|
||||
}
|
||||
|
||||
type scaUserFollow struct {
|
||||
scaUserFollowDo
|
||||
|
||||
ALL field.Asterisk
|
||||
FollowerID field.String // 关注者
|
||||
FolloweeID field.String // 被关注者
|
||||
Status field.Int64 // 关注状态(0 未互关 1 互关)
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
ID field.Int64
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaUserFollow) Table(newTableName string) *scaUserFollow {
|
||||
s.scaUserFollowDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaUserFollow) As(alias string) *scaUserFollow {
|
||||
s.scaUserFollowDo.DO = *(s.scaUserFollowDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaUserFollow) updateTableName(table string) *scaUserFollow {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.FollowerID = field.NewString(table, "follower_id")
|
||||
s.FolloweeID = field.NewString(table, "followee_id")
|
||||
s.Status = field.NewInt64(table, "status")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaUserFollow) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaUserFollow) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 7)
|
||||
s.fieldMap["follower_id"] = s.FollowerID
|
||||
s.fieldMap["followee_id"] = s.FolloweeID
|
||||
s.fieldMap["status"] = s.Status
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaUserFollow) clone(db *gorm.DB) scaUserFollow {
|
||||
s.scaUserFollowDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaUserFollow) replaceDB(db *gorm.DB) scaUserFollow {
|
||||
s.scaUserFollowDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaUserFollowDo struct{ gen.DO }
|
||||
|
||||
type IScaUserFollowDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaUserFollowDo
|
||||
WithContext(ctx context.Context) IScaUserFollowDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaUserFollowDo
|
||||
WriteDB() IScaUserFollowDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaUserFollowDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaUserFollowDo
|
||||
Not(conds ...gen.Condition) IScaUserFollowDo
|
||||
Or(conds ...gen.Condition) IScaUserFollowDo
|
||||
Select(conds ...field.Expr) IScaUserFollowDo
|
||||
Where(conds ...gen.Condition) IScaUserFollowDo
|
||||
Order(conds ...field.Expr) IScaUserFollowDo
|
||||
Distinct(cols ...field.Expr) IScaUserFollowDo
|
||||
Omit(cols ...field.Expr) IScaUserFollowDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaUserFollowDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo
|
||||
Group(cols ...field.Expr) IScaUserFollowDo
|
||||
Having(conds ...gen.Condition) IScaUserFollowDo
|
||||
Limit(limit int) IScaUserFollowDo
|
||||
Offset(offset int) IScaUserFollowDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserFollowDo
|
||||
Unscoped() IScaUserFollowDo
|
||||
Create(values ...*model.ScaUserFollow) error
|
||||
CreateInBatches(values []*model.ScaUserFollow, batchSize int) error
|
||||
Save(values ...*model.ScaUserFollow) error
|
||||
First() (*model.ScaUserFollow, error)
|
||||
Take() (*model.ScaUserFollow, error)
|
||||
Last() (*model.ScaUserFollow, error)
|
||||
Find() ([]*model.ScaUserFollow, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserFollow, err error)
|
||||
FindInBatches(result *[]*model.ScaUserFollow, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaUserFollow) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaUserFollowDo
|
||||
Assign(attrs ...field.AssignExpr) IScaUserFollowDo
|
||||
Joins(fields ...field.RelationField) IScaUserFollowDo
|
||||
Preload(fields ...field.RelationField) IScaUserFollowDo
|
||||
FirstOrInit() (*model.ScaUserFollow, error)
|
||||
FirstOrCreate() (*model.ScaUserFollow, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaUserFollow, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaUserFollowDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Debug() IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) WithContext(ctx context.Context) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) ReadDB() IScaUserFollowDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) WriteDB() IScaUserFollowDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Session(config *gorm.Session) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Clauses(conds ...clause.Expression) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Returning(value interface{}, columns ...string) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Not(conds ...gen.Condition) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Or(conds ...gen.Condition) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Select(conds ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Where(conds ...gen.Condition) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Order(conds ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Distinct(cols ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Omit(cols ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Join(table schema.Tabler, on ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Group(cols ...field.Expr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Having(conds ...gen.Condition) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Limit(limit int) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Offset(offset int) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Unscoped() IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Create(values ...*model.ScaUserFollow) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) CreateInBatches(values []*model.ScaUserFollow, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaUserFollowDo) Save(values ...*model.ScaUserFollow) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) First() (*model.ScaUserFollow, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserFollow), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Take() (*model.ScaUserFollow, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserFollow), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Last() (*model.ScaUserFollow, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserFollow), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Find() ([]*model.ScaUserFollow, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaUserFollow), err
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserFollow, err error) {
|
||||
buf := make([]*model.ScaUserFollow, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) FindInBatches(result *[]*model.ScaUserFollow, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Attrs(attrs ...field.AssignExpr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Assign(attrs ...field.AssignExpr) IScaUserFollowDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Joins(fields ...field.RelationField) IScaUserFollowDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Preload(fields ...field.RelationField) IScaUserFollowDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) FirstOrInit() (*model.ScaUserFollow, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserFollow), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) FirstOrCreate() (*model.ScaUserFollow, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserFollow), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) FindByPage(offset int, limit int) (result []*model.ScaUserFollow, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaUserFollowDo) Delete(models ...*model.ScaUserFollow) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaUserFollowDo) withDO(do gen.Dao) *scaUserFollowDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
420
app/core/api/repository/mysql/query/sca_user_level.gen.go
Normal file
420
app/core/api/repository/mysql/query/sca_user_level.gen.go
Normal file
@@ -0,0 +1,420 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaUserLevel(db *gorm.DB, opts ...gen.DOOption) scaUserLevel {
|
||||
_scaUserLevel := scaUserLevel{}
|
||||
|
||||
_scaUserLevel.scaUserLevelDo.UseDB(db, opts...)
|
||||
_scaUserLevel.scaUserLevelDo.UseModel(&model.ScaUserLevel{})
|
||||
|
||||
tableName := _scaUserLevel.scaUserLevelDo.TableName()
|
||||
_scaUserLevel.ALL = field.NewAsterisk(tableName)
|
||||
_scaUserLevel.ID = field.NewInt64(tableName, "id")
|
||||
_scaUserLevel.UserID = field.NewString(tableName, "user_id")
|
||||
_scaUserLevel.LevelType = field.NewInt64(tableName, "level_type")
|
||||
_scaUserLevel.Level = field.NewInt64(tableName, "level")
|
||||
_scaUserLevel.LevelName = field.NewString(tableName, "level_name")
|
||||
_scaUserLevel.ExpStart = field.NewInt64(tableName, "exp_start")
|
||||
_scaUserLevel.ExpEnd = field.NewInt64(tableName, "exp_end")
|
||||
_scaUserLevel.Description = field.NewString(tableName, "description")
|
||||
_scaUserLevel.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaUserLevel.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaUserLevel.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaUserLevel.fillFieldMap()
|
||||
|
||||
return _scaUserLevel
|
||||
}
|
||||
|
||||
type scaUserLevel struct {
|
||||
scaUserLevelDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
UserID field.String // 用户Id
|
||||
LevelType field.Int64 // 等级类型
|
||||
Level field.Int64 // 等级
|
||||
LevelName field.String // 等级名称
|
||||
ExpStart field.Int64 // 开始经验值
|
||||
ExpEnd field.Int64 // 结束经验值
|
||||
Description field.String // 等级描述
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaUserLevel) Table(newTableName string) *scaUserLevel {
|
||||
s.scaUserLevelDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaUserLevel) As(alias string) *scaUserLevel {
|
||||
s.scaUserLevelDo.DO = *(s.scaUserLevelDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaUserLevel) updateTableName(table string) *scaUserLevel {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.UserID = field.NewString(table, "user_id")
|
||||
s.LevelType = field.NewInt64(table, "level_type")
|
||||
s.Level = field.NewInt64(table, "level")
|
||||
s.LevelName = field.NewString(table, "level_name")
|
||||
s.ExpStart = field.NewInt64(table, "exp_start")
|
||||
s.ExpEnd = field.NewInt64(table, "exp_end")
|
||||
s.Description = field.NewString(table, "description")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaUserLevel) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaUserLevel) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 11)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["user_id"] = s.UserID
|
||||
s.fieldMap["level_type"] = s.LevelType
|
||||
s.fieldMap["level"] = s.Level
|
||||
s.fieldMap["level_name"] = s.LevelName
|
||||
s.fieldMap["exp_start"] = s.ExpStart
|
||||
s.fieldMap["exp_end"] = s.ExpEnd
|
||||
s.fieldMap["description"] = s.Description
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaUserLevel) clone(db *gorm.DB) scaUserLevel {
|
||||
s.scaUserLevelDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaUserLevel) replaceDB(db *gorm.DB) scaUserLevel {
|
||||
s.scaUserLevelDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaUserLevelDo struct{ gen.DO }
|
||||
|
||||
type IScaUserLevelDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaUserLevelDo
|
||||
WithContext(ctx context.Context) IScaUserLevelDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaUserLevelDo
|
||||
WriteDB() IScaUserLevelDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaUserLevelDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaUserLevelDo
|
||||
Not(conds ...gen.Condition) IScaUserLevelDo
|
||||
Or(conds ...gen.Condition) IScaUserLevelDo
|
||||
Select(conds ...field.Expr) IScaUserLevelDo
|
||||
Where(conds ...gen.Condition) IScaUserLevelDo
|
||||
Order(conds ...field.Expr) IScaUserLevelDo
|
||||
Distinct(cols ...field.Expr) IScaUserLevelDo
|
||||
Omit(cols ...field.Expr) IScaUserLevelDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaUserLevelDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserLevelDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaUserLevelDo
|
||||
Group(cols ...field.Expr) IScaUserLevelDo
|
||||
Having(conds ...gen.Condition) IScaUserLevelDo
|
||||
Limit(limit int) IScaUserLevelDo
|
||||
Offset(offset int) IScaUserLevelDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserLevelDo
|
||||
Unscoped() IScaUserLevelDo
|
||||
Create(values ...*model.ScaUserLevel) error
|
||||
CreateInBatches(values []*model.ScaUserLevel, batchSize int) error
|
||||
Save(values ...*model.ScaUserLevel) error
|
||||
First() (*model.ScaUserLevel, error)
|
||||
Take() (*model.ScaUserLevel, error)
|
||||
Last() (*model.ScaUserLevel, error)
|
||||
Find() ([]*model.ScaUserLevel, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserLevel, err error)
|
||||
FindInBatches(result *[]*model.ScaUserLevel, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaUserLevel) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaUserLevelDo
|
||||
Assign(attrs ...field.AssignExpr) IScaUserLevelDo
|
||||
Joins(fields ...field.RelationField) IScaUserLevelDo
|
||||
Preload(fields ...field.RelationField) IScaUserLevelDo
|
||||
FirstOrInit() (*model.ScaUserLevel, error)
|
||||
FirstOrCreate() (*model.ScaUserLevel, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaUserLevel, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaUserLevelDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Debug() IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) WithContext(ctx context.Context) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) ReadDB() IScaUserLevelDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) WriteDB() IScaUserLevelDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Session(config *gorm.Session) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Clauses(conds ...clause.Expression) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Returning(value interface{}, columns ...string) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Not(conds ...gen.Condition) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Or(conds ...gen.Condition) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Select(conds ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Where(conds ...gen.Condition) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Order(conds ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Distinct(cols ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Omit(cols ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Join(table schema.Tabler, on ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Group(cols ...field.Expr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Having(conds ...gen.Condition) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Limit(limit int) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Offset(offset int) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Unscoped() IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Create(values ...*model.ScaUserLevel) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) CreateInBatches(values []*model.ScaUserLevel, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaUserLevelDo) Save(values ...*model.ScaUserLevel) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) First() (*model.ScaUserLevel, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserLevel), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Take() (*model.ScaUserLevel, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserLevel), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Last() (*model.ScaUserLevel, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserLevel), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Find() ([]*model.ScaUserLevel, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaUserLevel), err
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserLevel, err error) {
|
||||
buf := make([]*model.ScaUserLevel, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) FindInBatches(result *[]*model.ScaUserLevel, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Attrs(attrs ...field.AssignExpr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Assign(attrs ...field.AssignExpr) IScaUserLevelDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Joins(fields ...field.RelationField) IScaUserLevelDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Preload(fields ...field.RelationField) IScaUserLevelDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) FirstOrInit() (*model.ScaUserLevel, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserLevel), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) FirstOrCreate() (*model.ScaUserLevel, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserLevel), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) FindByPage(offset int, limit int) (result []*model.ScaUserLevel, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaUserLevelDo) Delete(models ...*model.ScaUserLevel) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaUserLevelDo) withDO(do gen.Dao) *scaUserLevelDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
416
app/core/api/repository/mysql/query/sca_user_message.gen.go
Normal file
416
app/core/api/repository/mysql/query/sca_user_message.gen.go
Normal file
@@ -0,0 +1,416 @@
|
||||
// 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 query
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"gorm.io/gen"
|
||||
"gorm.io/gen/field"
|
||||
|
||||
"gorm.io/plugin/dbresolver"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
func newScaUserMessage(db *gorm.DB, opts ...gen.DOOption) scaUserMessage {
|
||||
_scaUserMessage := scaUserMessage{}
|
||||
|
||||
_scaUserMessage.scaUserMessageDo.UseDB(db, opts...)
|
||||
_scaUserMessage.scaUserMessageDo.UseModel(&model.ScaUserMessage{})
|
||||
|
||||
tableName := _scaUserMessage.scaUserMessageDo.TableName()
|
||||
_scaUserMessage.ALL = field.NewAsterisk(tableName)
|
||||
_scaUserMessage.ID = field.NewInt64(tableName, "id")
|
||||
_scaUserMessage.TopicID = field.NewString(tableName, "topic_id")
|
||||
_scaUserMessage.FromID = field.NewString(tableName, "from_id")
|
||||
_scaUserMessage.ToID = field.NewString(tableName, "to_id")
|
||||
_scaUserMessage.Content = field.NewString(tableName, "content")
|
||||
_scaUserMessage.IsRead = field.NewInt64(tableName, "is_read")
|
||||
_scaUserMessage.Deleted = field.NewInt64(tableName, "deleted")
|
||||
_scaUserMessage.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_scaUserMessage.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_scaUserMessage.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
|
||||
_scaUserMessage.fillFieldMap()
|
||||
|
||||
return _scaUserMessage
|
||||
}
|
||||
|
||||
type scaUserMessage struct {
|
||||
scaUserMessageDo
|
||||
|
||||
ALL field.Asterisk
|
||||
ID field.Int64 // 主键
|
||||
TopicID field.String // 话题Id
|
||||
FromID field.String // 来自人
|
||||
ToID field.String // 送达人
|
||||
Content field.String // 消息内容
|
||||
IsRead field.Int64 // 是否已读
|
||||
Deleted field.Int64 // 是否删除 0 未删除 1 已删除
|
||||
CreatedAt field.Time // 创建时间
|
||||
UpdatedAt field.Time // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
|
||||
func (s scaUserMessage) Table(newTableName string) *scaUserMessage {
|
||||
s.scaUserMessageDo.UseTable(newTableName)
|
||||
return s.updateTableName(newTableName)
|
||||
}
|
||||
|
||||
func (s scaUserMessage) As(alias string) *scaUserMessage {
|
||||
s.scaUserMessageDo.DO = *(s.scaUserMessageDo.As(alias).(*gen.DO))
|
||||
return s.updateTableName(alias)
|
||||
}
|
||||
|
||||
func (s *scaUserMessage) updateTableName(table string) *scaUserMessage {
|
||||
s.ALL = field.NewAsterisk(table)
|
||||
s.ID = field.NewInt64(table, "id")
|
||||
s.TopicID = field.NewString(table, "topic_id")
|
||||
s.FromID = field.NewString(table, "from_id")
|
||||
s.ToID = field.NewString(table, "to_id")
|
||||
s.Content = field.NewString(table, "content")
|
||||
s.IsRead = field.NewInt64(table, "is_read")
|
||||
s.Deleted = field.NewInt64(table, "deleted")
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
|
||||
s.fillFieldMap()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *scaUserMessage) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||
_f, ok := s.fieldMap[fieldName]
|
||||
if !ok || _f == nil {
|
||||
return nil, false
|
||||
}
|
||||
_oe, ok := _f.(field.OrderExpr)
|
||||
return _oe, ok
|
||||
}
|
||||
|
||||
func (s *scaUserMessage) fillFieldMap() {
|
||||
s.fieldMap = make(map[string]field.Expr, 10)
|
||||
s.fieldMap["id"] = s.ID
|
||||
s.fieldMap["topic_id"] = s.TopicID
|
||||
s.fieldMap["from_id"] = s.FromID
|
||||
s.fieldMap["to_id"] = s.ToID
|
||||
s.fieldMap["content"] = s.Content
|
||||
s.fieldMap["is_read"] = s.IsRead
|
||||
s.fieldMap["deleted"] = s.Deleted
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
}
|
||||
|
||||
func (s scaUserMessage) clone(db *gorm.DB) scaUserMessage {
|
||||
s.scaUserMessageDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||
return s
|
||||
}
|
||||
|
||||
func (s scaUserMessage) replaceDB(db *gorm.DB) scaUserMessage {
|
||||
s.scaUserMessageDo.ReplaceDB(db)
|
||||
return s
|
||||
}
|
||||
|
||||
type scaUserMessageDo struct{ gen.DO }
|
||||
|
||||
type IScaUserMessageDo interface {
|
||||
gen.SubQuery
|
||||
Debug() IScaUserMessageDo
|
||||
WithContext(ctx context.Context) IScaUserMessageDo
|
||||
WithResult(fc func(tx gen.Dao)) gen.ResultInfo
|
||||
ReplaceDB(db *gorm.DB)
|
||||
ReadDB() IScaUserMessageDo
|
||||
WriteDB() IScaUserMessageDo
|
||||
As(alias string) gen.Dao
|
||||
Session(config *gorm.Session) IScaUserMessageDo
|
||||
Columns(cols ...field.Expr) gen.Columns
|
||||
Clauses(conds ...clause.Expression) IScaUserMessageDo
|
||||
Not(conds ...gen.Condition) IScaUserMessageDo
|
||||
Or(conds ...gen.Condition) IScaUserMessageDo
|
||||
Select(conds ...field.Expr) IScaUserMessageDo
|
||||
Where(conds ...gen.Condition) IScaUserMessageDo
|
||||
Order(conds ...field.Expr) IScaUserMessageDo
|
||||
Distinct(cols ...field.Expr) IScaUserMessageDo
|
||||
Omit(cols ...field.Expr) IScaUserMessageDo
|
||||
Join(table schema.Tabler, on ...field.Expr) IScaUserMessageDo
|
||||
LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserMessageDo
|
||||
RightJoin(table schema.Tabler, on ...field.Expr) IScaUserMessageDo
|
||||
Group(cols ...field.Expr) IScaUserMessageDo
|
||||
Having(conds ...gen.Condition) IScaUserMessageDo
|
||||
Limit(limit int) IScaUserMessageDo
|
||||
Offset(offset int) IScaUserMessageDo
|
||||
Count() (count int64, err error)
|
||||
Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserMessageDo
|
||||
Unscoped() IScaUserMessageDo
|
||||
Create(values ...*model.ScaUserMessage) error
|
||||
CreateInBatches(values []*model.ScaUserMessage, batchSize int) error
|
||||
Save(values ...*model.ScaUserMessage) error
|
||||
First() (*model.ScaUserMessage, error)
|
||||
Take() (*model.ScaUserMessage, error)
|
||||
Last() (*model.ScaUserMessage, error)
|
||||
Find() ([]*model.ScaUserMessage, error)
|
||||
FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserMessage, err error)
|
||||
FindInBatches(result *[]*model.ScaUserMessage, batchSize int, fc func(tx gen.Dao, batch int) error) error
|
||||
Pluck(column field.Expr, dest interface{}) error
|
||||
Delete(...*model.ScaUserMessage) (info gen.ResultInfo, err error)
|
||||
Update(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
Updates(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumn(column field.Expr, value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateColumnSimple(columns ...field.AssignExpr) (info gen.ResultInfo, err error)
|
||||
UpdateColumns(value interface{}) (info gen.ResultInfo, err error)
|
||||
UpdateFrom(q gen.SubQuery) gen.Dao
|
||||
Attrs(attrs ...field.AssignExpr) IScaUserMessageDo
|
||||
Assign(attrs ...field.AssignExpr) IScaUserMessageDo
|
||||
Joins(fields ...field.RelationField) IScaUserMessageDo
|
||||
Preload(fields ...field.RelationField) IScaUserMessageDo
|
||||
FirstOrInit() (*model.ScaUserMessage, error)
|
||||
FirstOrCreate() (*model.ScaUserMessage, error)
|
||||
FindByPage(offset int, limit int) (result []*model.ScaUserMessage, count int64, err error)
|
||||
ScanByPage(result interface{}, offset int, limit int) (count int64, err error)
|
||||
Scan(result interface{}) (err error)
|
||||
Returning(value interface{}, columns ...string) IScaUserMessageDo
|
||||
UnderlyingDB() *gorm.DB
|
||||
schema.Tabler
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Debug() IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Debug())
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) WithContext(ctx context.Context) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.WithContext(ctx))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) ReadDB() IScaUserMessageDo {
|
||||
return s.Clauses(dbresolver.Read)
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) WriteDB() IScaUserMessageDo {
|
||||
return s.Clauses(dbresolver.Write)
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Session(config *gorm.Session) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Session(config))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Clauses(conds ...clause.Expression) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Clauses(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Returning(value interface{}, columns ...string) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Returning(value, columns...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Not(conds ...gen.Condition) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Not(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Or(conds ...gen.Condition) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Or(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Select(conds ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Select(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Where(conds ...gen.Condition) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Where(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Order(conds ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Order(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Distinct(cols ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Distinct(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Omit(cols ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Omit(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Join(table schema.Tabler, on ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Join(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) LeftJoin(table schema.Tabler, on ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.LeftJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) RightJoin(table schema.Tabler, on ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.RightJoin(table, on...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Group(cols ...field.Expr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Group(cols...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Having(conds ...gen.Condition) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Having(conds...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Limit(limit int) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Limit(limit))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Offset(offset int) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Offset(offset))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Scopes(funcs ...func(gen.Dao) gen.Dao) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Scopes(funcs...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Unscoped() IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Unscoped())
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Create(values ...*model.ScaUserMessage) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Create(values)
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) CreateInBatches(values []*model.ScaUserMessage, batchSize int) error {
|
||||
return s.DO.CreateInBatches(values, batchSize)
|
||||
}
|
||||
|
||||
// Save : !!! underlying implementation is different with GORM
|
||||
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||
func (s scaUserMessageDo) Save(values ...*model.ScaUserMessage) error {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.DO.Save(values)
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) First() (*model.ScaUserMessage, error) {
|
||||
if result, err := s.DO.First(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserMessage), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Take() (*model.ScaUserMessage, error) {
|
||||
if result, err := s.DO.Take(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserMessage), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Last() (*model.ScaUserMessage, error) {
|
||||
if result, err := s.DO.Last(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserMessage), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Find() ([]*model.ScaUserMessage, error) {
|
||||
result, err := s.DO.Find()
|
||||
return result.([]*model.ScaUserMessage), err
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*model.ScaUserMessage, err error) {
|
||||
buf := make([]*model.ScaUserMessage, 0, batchSize)
|
||||
err = s.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||
defer func() { results = append(results, buf...) }()
|
||||
return fc(tx, batch)
|
||||
})
|
||||
return results, err
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) FindInBatches(result *[]*model.ScaUserMessage, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||
return s.DO.FindInBatches(result, batchSize, fc)
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Attrs(attrs ...field.AssignExpr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Attrs(attrs...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Assign(attrs ...field.AssignExpr) IScaUserMessageDo {
|
||||
return s.withDO(s.DO.Assign(attrs...))
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Joins(fields ...field.RelationField) IScaUserMessageDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Joins(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Preload(fields ...field.RelationField) IScaUserMessageDo {
|
||||
for _, _f := range fields {
|
||||
s = *s.withDO(s.DO.Preload(_f))
|
||||
}
|
||||
return &s
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) FirstOrInit() (*model.ScaUserMessage, error) {
|
||||
if result, err := s.DO.FirstOrInit(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserMessage), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) FirstOrCreate() (*model.ScaUserMessage, error) {
|
||||
if result, err := s.DO.FirstOrCreate(); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return result.(*model.ScaUserMessage), nil
|
||||
}
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) FindByPage(offset int, limit int) (result []*model.ScaUserMessage, count int64, err error) {
|
||||
result, err = s.Offset(offset).Limit(limit).Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||
count = int64(size + offset)
|
||||
return
|
||||
}
|
||||
|
||||
count, err = s.Offset(-1).Limit(-1).Count()
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||
count, err = s.Count()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.Offset(offset).Limit(limit).Scan(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Scan(result interface{}) (err error) {
|
||||
return s.DO.Scan(result)
|
||||
}
|
||||
|
||||
func (s scaUserMessageDo) Delete(models ...*model.ScaUserMessage) (result gen.ResultInfo, err error) {
|
||||
return s.DO.Delete(models)
|
||||
}
|
||||
|
||||
func (s *scaUserMessageDo) withDO(do gen.Dao) *scaUserMessageDo {
|
||||
s.DO = *do.(*gen.DO)
|
||||
return s
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||
)
|
||||
|
||||
// SyncDatabase function is used to create all tables in the database if they don't exist.
|
||||
func SyncDatabase(engine *xorm.Engine) error {
|
||||
err := engine.Sync2(
|
||||
new(model.ScaAuthUser),
|
||||
new(model.ScaCommentReply),
|
||||
new(model.ScaAuthUserSocial),
|
||||
new(model.ScaAuthUserDevice),
|
||||
new(model.ScaCommentLikes),
|
||||
new(model.ScaAuthRole),
|
||||
new(model.ScaFileRecycle),
|
||||
new(model.ScaFileType),
|
||||
new(model.ScaMessageReport),
|
||||
new(model.ScaUserFollows),
|
||||
new(model.ScaUserLevel),
|
||||
new(model.ScaUserMessage),
|
||||
new(model.ScaAuthMenu),
|
||||
new(model.ScaAuthPermissionRule),
|
||||
new(model.ScaFileFolder),
|
||||
new(model.ScaFileInfo),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
@@ -2,7 +2,6 @@ package redis_session
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/gob"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/sessions"
|
||||
@@ -10,7 +9,6 @@ import (
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/common/constant"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||
)
|
||||
|
||||
func NewRedisSession(client *redis.Client) *redisstore.RedisStore {
|
||||
@@ -26,6 +24,5 @@ func NewRedisSession(client *redis.Client) *redisstore.RedisStore {
|
||||
Secure: true,
|
||||
SameSite: http.SameSiteLaxMode,
|
||||
})
|
||||
gob.Register(types.SessionData{})
|
||||
return store
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package wechat_public
|
||||
package wechat_official
|
||||
|
||||
import (
|
||||
"os"
|
38
go.mod
38
go.mod
@@ -6,13 +6,12 @@ require (
|
||||
github.com/ArtisanCloud/PowerLibs/v3 v3.2.6
|
||||
github.com/ArtisanCloud/PowerWeChat/v3 v3.2.55
|
||||
github.com/casbin/casbin/v2 v2.100.0
|
||||
github.com/casbin/xorm-adapter/v3 v3.4.0
|
||||
github.com/casbin/gorm-adapter/v3 v3.32.0
|
||||
github.com/ccpwcn/kgo v1.2.3
|
||||
github.com/chenmingyong0423/go-mongox/v2 v2.0.0-beta1
|
||||
github.com/go-sql-driver/mysql v1.8.1
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||
github.com/gorilla/sessions v1.2.0
|
||||
github.com/gorilla/sessions v1.2.1
|
||||
github.com/lionsoul2014/ip2region/binding/golang v0.0.0-20240510055607-89e20ab7b6c6
|
||||
github.com/lxzan/gws v1.8.8
|
||||
github.com/microcosm-cc/bluemonday v1.0.27
|
||||
@@ -31,7 +30,10 @@ require (
|
||||
golang.org/x/crypto v0.29.0
|
||||
golang.org/x/text v0.20.0
|
||||
google.golang.org/grpc v1.65.0
|
||||
xorm.io/xorm v1.3.9
|
||||
gorm.io/driver/mysql v1.5.7
|
||||
gorm.io/gen v0.3.26
|
||||
gorm.io/gorm v1.25.12
|
||||
gorm.io/plugin/dbresolver v1.5.3
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -48,16 +50,21 @@ require (
|
||||
github.com/cloudflare/circl v1.5.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dolthub/maphash v0.1.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/fatih/color v1.17.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/glebarez/go-sqlite v1.20.3 // indirect
|
||||
github.com/glebarez/sqlite v1.7.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/goccy/go-json v0.8.1 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
|
||||
github.com/golang-sql/sqlexp v0.1.0 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/pprof v0.0.0-20241101162523-b92577c0c142 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
@@ -67,14 +74,18 @@ require (
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/imroc/req/v3 v3.48.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/pgx/v5 v5.6.0 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.1 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/lib/pq v1.10.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/microsoft/go-mssqldb v1.6.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.21.0 // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.3 // indirect
|
||||
@@ -89,8 +100,8 @@ require (
|
||||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.48.1 // indirect
|
||||
github.com/refraction-networking/utls v1.6.7 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230126093431-47fa9a501578 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.1.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
@@ -122,5 +133,12 @@ require (
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect
|
||||
gorm.io/datatypes v1.2.4 // indirect
|
||||
gorm.io/driver/postgres v1.5.9 // indirect
|
||||
gorm.io/driver/sqlserver v1.5.3 // indirect
|
||||
gorm.io/hints v1.1.2 // indirect
|
||||
modernc.org/libc v1.22.2 // indirect
|
||||
modernc.org/mathutil v1.5.0 // indirect
|
||||
modernc.org/memory v1.5.0 // indirect
|
||||
modernc.org/sqlite v1.20.4 // indirect
|
||||
)
|
||||
|
Reference in New Issue
Block a user