✨ add comment ent code
This commit is contained in:
1166
.idea/GOHCache.xml
generated
1166
.idea/GOHCache.xml
generated
File diff suppressed because it is too large
Load Diff
10
app/core/api/common/constant/comment_type.go
Normal file
10
app/core/api/common/constant/comment_type.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package constant
|
||||||
|
|
||||||
|
const (
|
||||||
|
COMMENT int = iota
|
||||||
|
REPLY
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
CommentTopicType = iota
|
||||||
|
)
|
||||||
@@ -52,27 +52,27 @@ func GetMimeType(data []byte) string {
|
|||||||
// ProcessImages 处理图片,将 base64 字符串转换为字节数组
|
// ProcessImages 处理图片,将 base64 字符串转换为字节数组
|
||||||
func ProcessImages(images []string) ([][]byte, error) {
|
func ProcessImages(images []string) ([][]byte, error) {
|
||||||
var imagesData [][]byte
|
var imagesData [][]byte
|
||||||
dataChan := make(chan []byte, len(images)) // 创建一个带缓冲的 channel
|
dataChan := make(chan []byte, len(images))
|
||||||
re := regexp.MustCompile(`^data:image/\w+;base64,`)
|
re := regexp.MustCompile(`^data:image/\w+;base64,`)
|
||||||
|
|
||||||
for _, img := range images {
|
for _, img := range images {
|
||||||
wg.Add(1) // 增加 WaitGroup 的计数
|
wg.Add(1)
|
||||||
go func(img string) {
|
go func(img string) {
|
||||||
defer wg.Done() // 函数结束时减少计数
|
defer wg.Done()
|
||||||
|
|
||||||
imgWithoutPrefix := re.ReplaceAllString(img, "")
|
imgWithoutPrefix := re.ReplaceAllString(img, "")
|
||||||
data, err := Base64ToBytes(imgWithoutPrefix)
|
data, err := Base64ToBytes(imgWithoutPrefix)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return // 出错时直接返回
|
return // 出错时直接返回
|
||||||
}
|
}
|
||||||
dataChan <- data // 将结果发送到 channel
|
dataChan <- data
|
||||||
}(img)
|
}(img)
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait() // 等待所有 goroutine 完成
|
wg.Wait()
|
||||||
close(dataChan) // 关闭 channel
|
close(dataChan)
|
||||||
|
|
||||||
for data := range dataChan { // 收集所有结果
|
for data := range dataChan {
|
||||||
imagesData = append(imagesData, data)
|
imagesData = append(imagesData, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func SubmitCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
l := comment.NewSubmitCommentLogic(r.Context(), svcCtx)
|
l := comment.NewSubmitCommentLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.SubmitComment(&req)
|
resp, err := l.SubmitComment(r, &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
httpx.WriteJsonCtx(
|
httpx.WriteJsonCtx(
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ func SubmitReplyCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
l := comment.NewSubmitReplyCommentLogic(r.Context(), svcCtx)
|
l := comment.NewSubmitReplyCommentLogic(r.Context(), svcCtx)
|
||||||
resp, err := l.SubmitReplyComment(&req)
|
resp, err := l.SubmitReplyComment(r, &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
httpx.WriteJsonCtx(
|
httpx.WriteJsonCtx(
|
||||||
|
|||||||
@@ -2,9 +2,16 @@ package comment
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/mssola/useragent"
|
||||||
|
|
||||||
"schisandra-album-cloud-microservices/app/core/api/common/captcha/verify"
|
"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"
|
"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/svc"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||||
|
|
||||||
@@ -25,12 +32,94 @@ func NewSubmitCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *SubmitCommentLogic) SubmitComment(req *types.CommentRequest) (resp *types.Response, err error) {
|
func (l *SubmitCommentLogic) SubmitComment(r *http.Request, req *types.CommentRequest) (resp *types.Response, err error) {
|
||||||
|
|
||||||
res := verify.VerifySlideCaptcha(l.ctx, l.svcCtx.RedisClient, req.Point, req.Key)
|
res := verify.VerifySlideCaptcha(l.ctx, l.svcCtx.RedisClient, req.Point, req.Key)
|
||||||
if !res {
|
if !res {
|
||||||
return response.ErrorWithI18n(l.ctx, "captcha.verificationFailure"), nil
|
return response.ErrorWithI18n(l.ctx, "captcha.verificationFailure"), nil
|
||||||
}
|
}
|
||||||
|
if len(req.Images) > 3 {
|
||||||
|
return response.ErrorWithI18n(l.ctx, "comment.tooManyImages"), nil
|
||||||
|
}
|
||||||
|
userAgent := r.Header.Get("User-Agent")
|
||||||
|
if userAgent == "" {
|
||||||
|
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||||
|
}
|
||||||
|
ua := useragent.New(userAgent)
|
||||||
|
|
||||||
return
|
ip := utils.GetClientIP(r)
|
||||||
|
location, err := l.svcCtx.Ip2Region.SearchByStr(ip)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
location = utils.RemoveZeroAndAdjust(location)
|
||||||
|
|
||||||
|
browser, _ := ua.Browser()
|
||||||
|
operatingSystem := ua.OS()
|
||||||
|
isAuthor := 0
|
||||||
|
session, wrong := l.svcCtx.Session.Get(r, constant.SESSION_KEY)
|
||||||
|
if wrong == nil {
|
||||||
|
return nil, wrong
|
||||||
|
}
|
||||||
|
uid := session.Values["uid"].(string)
|
||||||
|
if uid == req.Author {
|
||||||
|
isAuthor = 1
|
||||||
|
}
|
||||||
|
xssFilterContent := utils.XssFilter(req.Content)
|
||||||
|
if xssFilterContent == "" {
|
||||||
|
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||||
|
}
|
||||||
|
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
|
||||||
|
comment, err := l.svcCtx.MySQLClient.ScaCommentReply.Create().
|
||||||
|
SetContent(commentContent).
|
||||||
|
SetUserID(uid).
|
||||||
|
SetTopicID(req.TopicId).
|
||||||
|
SetCommentType(constant.CommentTopicType).
|
||||||
|
SetCommentType(constant.COMMENT).
|
||||||
|
SetAuthor(isAuthor).
|
||||||
|
SetCommentIP(ip).
|
||||||
|
SetLocation(location).
|
||||||
|
SetBrowser(browser).
|
||||||
|
SetOperatingSystem(operatingSystem).
|
||||||
|
SetAgent(userAgent).Save(l.ctx)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(req.Images) > 0 {
|
||||||
|
imagesDataCh := make(chan [][]byte)
|
||||||
|
go func() {
|
||||||
|
imagesData, err := utils.ProcessImages(req.Images)
|
||||||
|
if err != nil {
|
||||||
|
imagesDataCh <- nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
imagesDataCh <- imagesData
|
||||||
|
}()
|
||||||
|
imagesData := <-imagesDataCh
|
||||||
|
if imagesData == nil {
|
||||||
|
return nil, errors.New("process images failed")
|
||||||
|
}
|
||||||
|
commentImages := types.CommentImages{
|
||||||
|
UserId: uid,
|
||||||
|
TopicId: req.TopicId,
|
||||||
|
CommentId: comment.ID,
|
||||||
|
Images: imagesData,
|
||||||
|
CreatedAt: comment.CreatedAt.String(),
|
||||||
|
}
|
||||||
|
if _, err = l.svcCtx.MongoClient.Collection("comment_images").InsertOne(l.ctx, commentImages); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commentResponse := types.CommentResponse{
|
||||||
|
Id: comment.ID,
|
||||||
|
Content: commentContent,
|
||||||
|
UserId: uid,
|
||||||
|
TopicId: req.TopicId,
|
||||||
|
Author: isAuthor,
|
||||||
|
Location: location,
|
||||||
|
Browser: browser,
|
||||||
|
OperatingSystem: operatingSystem,
|
||||||
|
CreatedTime: time.Now(),
|
||||||
|
}
|
||||||
|
return response.SuccessWithData(commentResponse), nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,14 @@ package comment
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/mssola/useragent"
|
||||||
|
|
||||||
|
"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"
|
||||||
|
"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/svc"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
"schisandra-album-cloud-microservices/app/core/api/internal/types"
|
||||||
|
|
||||||
@@ -23,8 +30,43 @@ func NewSubmitReplyCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *SubmitReplyCommentLogic) SubmitReplyComment(req *types.ReplyCommentRequest) (resp *types.Response, err error) {
|
func (l *SubmitReplyCommentLogic) SubmitReplyComment(r *http.Request, req *types.ReplyCommentRequest) (resp *types.Response, err error) {
|
||||||
// todo: add your logic here and delete this line
|
res := verify.VerifySlideCaptcha(l.ctx, l.svcCtx.RedisClient, req.Point, req.Key)
|
||||||
|
if !res {
|
||||||
|
return response.ErrorWithI18n(l.ctx, "captcha.verificationFailure"), nil
|
||||||
|
}
|
||||||
|
if len(req.Images) > 3 {
|
||||||
|
return response.ErrorWithI18n(l.ctx, "comment.tooManyImages"), nil
|
||||||
|
}
|
||||||
|
userAgent := r.Header.Get("User-Agent")
|
||||||
|
if userAgent == "" {
|
||||||
|
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||||
|
}
|
||||||
|
ua := useragent.New(userAgent)
|
||||||
|
|
||||||
|
ip := utils.GetClientIP(r)
|
||||||
|
location, err := l.svcCtx.Ip2Region.SearchByStr(ip)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
location = utils.RemoveZeroAndAdjust(location)
|
||||||
|
|
||||||
|
browser, _ := ua.Browser()
|
||||||
|
operatingSystem := ua.OS()
|
||||||
|
isAuthor := 0
|
||||||
|
session, wrong := l.svcCtx.Session.Get(r, constant.SESSION_KEY)
|
||||||
|
if wrong == nil {
|
||||||
|
return nil, wrong
|
||||||
|
}
|
||||||
|
uid := session.Values["uid"].(string)
|
||||||
|
if uid == req.Author {
|
||||||
|
isAuthor = 1
|
||||||
|
}
|
||||||
|
xssFilterContent := utils.XssFilter(req.Content)
|
||||||
|
if xssFilterContent == "" {
|
||||||
|
return response.ErrorWithI18n(l.ctx, "comment.commentError"), nil
|
||||||
|
}
|
||||||
|
commentContent := l.svcCtx.Sensitive.Replace(xssFilterContent, '*')
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ func (c *MessageWebSocket) OnMessage(socket *gws.Conn, message *gws.Message) {
|
|||||||
if conn, ok := c.sessions.Load(clientId); ok {
|
if conn, ok := c.sessions.Load(clientId); ok {
|
||||||
_ = conn.WriteMessage(gws.OpcodeText, message.Bytes())
|
_ = conn.WriteMessage(gws.OpcodeText, message.Bytes())
|
||||||
}
|
}
|
||||||
|
// fmt.Printf("received message from client %s\n", message.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendMessageToClient 向指定客户端发送消息
|
// SendMessageToClient 向指定客户端发送消息
|
||||||
|
|||||||
24
app/core/api/internal/types/comment_types.go
Normal file
24
app/core/api/internal/types/comment_types.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type CommentResponse struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Content string `json:"content"`
|
||||||
|
UserId string `json:"user_id"`
|
||||||
|
TopicId string `json:"topic_id"`
|
||||||
|
Author int `json:"author"`
|
||||||
|
Location string `json:"location"`
|
||||||
|
Browser string `json:"browser"`
|
||||||
|
OperatingSystem string `json:"operating_system"`
|
||||||
|
CreatedTime time.Time `json:"created_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentImages 评论图片
|
||||||
|
type CommentImages struct {
|
||||||
|
TopicId string `json:"topic_id" bson:"topic_id"`
|
||||||
|
CommentId int64 `json:"comment_id" bson:"comment_id"`
|
||||||
|
UserId string `json:"user_id" bson:"user_id"`
|
||||||
|
Images [][]byte `json:"images" bson:"images"`
|
||||||
|
CreatedAt string `json:"created_at" bson:"created_at"`
|
||||||
|
}
|
||||||
@@ -16,6 +16,11 @@ import (
|
|||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect"
|
"entgo.io/ent/dialect"
|
||||||
@@ -37,6 +42,16 @@ type Client struct {
|
|||||||
ScaAuthUserDevice *ScaAuthUserDeviceClient
|
ScaAuthUserDevice *ScaAuthUserDeviceClient
|
||||||
// ScaAuthUserSocial is the client for interacting with the ScaAuthUserSocial builders.
|
// ScaAuthUserSocial is the client for interacting with the ScaAuthUserSocial builders.
|
||||||
ScaAuthUserSocial *ScaAuthUserSocialClient
|
ScaAuthUserSocial *ScaAuthUserSocialClient
|
||||||
|
// ScaCommentLikes is the client for interacting with the ScaCommentLikes builders.
|
||||||
|
ScaCommentLikes *ScaCommentLikesClient
|
||||||
|
// ScaCommentMessage is the client for interacting with the ScaCommentMessage builders.
|
||||||
|
ScaCommentMessage *ScaCommentMessageClient
|
||||||
|
// ScaCommentReply is the client for interacting with the ScaCommentReply builders.
|
||||||
|
ScaCommentReply *ScaCommentReplyClient
|
||||||
|
// ScaUserFollows is the client for interacting with the ScaUserFollows builders.
|
||||||
|
ScaUserFollows *ScaUserFollowsClient
|
||||||
|
// ScaUserLevel is the client for interacting with the ScaUserLevel builders.
|
||||||
|
ScaUserLevel *ScaUserLevelClient
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient creates a new client configured with the given options.
|
// NewClient creates a new client configured with the given options.
|
||||||
@@ -53,6 +68,11 @@ func (c *Client) init() {
|
|||||||
c.ScaAuthUser = NewScaAuthUserClient(c.config)
|
c.ScaAuthUser = NewScaAuthUserClient(c.config)
|
||||||
c.ScaAuthUserDevice = NewScaAuthUserDeviceClient(c.config)
|
c.ScaAuthUserDevice = NewScaAuthUserDeviceClient(c.config)
|
||||||
c.ScaAuthUserSocial = NewScaAuthUserSocialClient(c.config)
|
c.ScaAuthUserSocial = NewScaAuthUserSocialClient(c.config)
|
||||||
|
c.ScaCommentLikes = NewScaCommentLikesClient(c.config)
|
||||||
|
c.ScaCommentMessage = NewScaCommentMessageClient(c.config)
|
||||||
|
c.ScaCommentReply = NewScaCommentReplyClient(c.config)
|
||||||
|
c.ScaUserFollows = NewScaUserFollowsClient(c.config)
|
||||||
|
c.ScaUserLevel = NewScaUserLevelClient(c.config)
|
||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -150,6 +170,11 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
|
|||||||
ScaAuthUser: NewScaAuthUserClient(cfg),
|
ScaAuthUser: NewScaAuthUserClient(cfg),
|
||||||
ScaAuthUserDevice: NewScaAuthUserDeviceClient(cfg),
|
ScaAuthUserDevice: NewScaAuthUserDeviceClient(cfg),
|
||||||
ScaAuthUserSocial: NewScaAuthUserSocialClient(cfg),
|
ScaAuthUserSocial: NewScaAuthUserSocialClient(cfg),
|
||||||
|
ScaCommentLikes: NewScaCommentLikesClient(cfg),
|
||||||
|
ScaCommentMessage: NewScaCommentMessageClient(cfg),
|
||||||
|
ScaCommentReply: NewScaCommentReplyClient(cfg),
|
||||||
|
ScaUserFollows: NewScaUserFollowsClient(cfg),
|
||||||
|
ScaUserLevel: NewScaUserLevelClient(cfg),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +199,11 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
|||||||
ScaAuthUser: NewScaAuthUserClient(cfg),
|
ScaAuthUser: NewScaAuthUserClient(cfg),
|
||||||
ScaAuthUserDevice: NewScaAuthUserDeviceClient(cfg),
|
ScaAuthUserDevice: NewScaAuthUserDeviceClient(cfg),
|
||||||
ScaAuthUserSocial: NewScaAuthUserSocialClient(cfg),
|
ScaAuthUserSocial: NewScaAuthUserSocialClient(cfg),
|
||||||
|
ScaCommentLikes: NewScaCommentLikesClient(cfg),
|
||||||
|
ScaCommentMessage: NewScaCommentMessageClient(cfg),
|
||||||
|
ScaCommentReply: NewScaCommentReplyClient(cfg),
|
||||||
|
ScaUserFollows: NewScaUserFollowsClient(cfg),
|
||||||
|
ScaUserLevel: NewScaUserLevelClient(cfg),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,21 +232,25 @@ func (c *Client) Close() error {
|
|||||||
// Use adds the mutation hooks to all the entity clients.
|
// Use adds the mutation hooks to all the entity clients.
|
||||||
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
|
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
|
||||||
func (c *Client) Use(hooks ...Hook) {
|
func (c *Client) Use(hooks ...Hook) {
|
||||||
c.ScaAuthPermissionRule.Use(hooks...)
|
for _, n := range []interface{ Use(...Hook) }{
|
||||||
c.ScaAuthRole.Use(hooks...)
|
c.ScaAuthPermissionRule, c.ScaAuthRole, c.ScaAuthUser, c.ScaAuthUserDevice,
|
||||||
c.ScaAuthUser.Use(hooks...)
|
c.ScaAuthUserSocial, c.ScaCommentLikes, c.ScaCommentMessage, c.ScaCommentReply,
|
||||||
c.ScaAuthUserDevice.Use(hooks...)
|
c.ScaUserFollows, c.ScaUserLevel,
|
||||||
c.ScaAuthUserSocial.Use(hooks...)
|
} {
|
||||||
|
n.Use(hooks...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intercept adds the query interceptors to all the entity clients.
|
// Intercept adds the query interceptors to all the entity clients.
|
||||||
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
|
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
|
||||||
func (c *Client) Intercept(interceptors ...Interceptor) {
|
func (c *Client) Intercept(interceptors ...Interceptor) {
|
||||||
c.ScaAuthPermissionRule.Intercept(interceptors...)
|
for _, n := range []interface{ Intercept(...Interceptor) }{
|
||||||
c.ScaAuthRole.Intercept(interceptors...)
|
c.ScaAuthPermissionRule, c.ScaAuthRole, c.ScaAuthUser, c.ScaAuthUserDevice,
|
||||||
c.ScaAuthUser.Intercept(interceptors...)
|
c.ScaAuthUserSocial, c.ScaCommentLikes, c.ScaCommentMessage, c.ScaCommentReply,
|
||||||
c.ScaAuthUserDevice.Intercept(interceptors...)
|
c.ScaUserFollows, c.ScaUserLevel,
|
||||||
c.ScaAuthUserSocial.Intercept(interceptors...)
|
} {
|
||||||
|
n.Intercept(interceptors...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mutate implements the ent.Mutator interface.
|
// Mutate implements the ent.Mutator interface.
|
||||||
@@ -232,6 +266,16 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
|
|||||||
return c.ScaAuthUserDevice.mutate(ctx, m)
|
return c.ScaAuthUserDevice.mutate(ctx, m)
|
||||||
case *ScaAuthUserSocialMutation:
|
case *ScaAuthUserSocialMutation:
|
||||||
return c.ScaAuthUserSocial.mutate(ctx, m)
|
return c.ScaAuthUserSocial.mutate(ctx, m)
|
||||||
|
case *ScaCommentLikesMutation:
|
||||||
|
return c.ScaCommentLikes.mutate(ctx, m)
|
||||||
|
case *ScaCommentMessageMutation:
|
||||||
|
return c.ScaCommentMessage.mutate(ctx, m)
|
||||||
|
case *ScaCommentReplyMutation:
|
||||||
|
return c.ScaCommentReply.mutate(ctx, m)
|
||||||
|
case *ScaUserFollowsMutation:
|
||||||
|
return c.ScaUserFollows.mutate(ctx, m)
|
||||||
|
case *ScaUserLevelMutation:
|
||||||
|
return c.ScaUserLevel.mutate(ctx, m)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("ent: unknown mutation type %T", m)
|
return nil, fmt.Errorf("ent: unknown mutation type %T", m)
|
||||||
}
|
}
|
||||||
@@ -902,14 +946,681 @@ func (c *ScaAuthUserSocialClient) mutate(ctx context.Context, m *ScaAuthUserSoci
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesClient is a client for the ScaCommentLikes schema.
|
||||||
|
type ScaCommentLikesClient struct {
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewScaCommentLikesClient returns a client for the ScaCommentLikes from the given config.
|
||||||
|
func NewScaCommentLikesClient(c config) *ScaCommentLikesClient {
|
||||||
|
return &ScaCommentLikesClient{config: c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use adds a list of mutation hooks to the hooks stack.
|
||||||
|
// A call to `Use(f, g, h)` equals to `scacommentlikes.Hooks(f(g(h())))`.
|
||||||
|
func (c *ScaCommentLikesClient) Use(hooks ...Hook) {
|
||||||
|
c.hooks.ScaCommentLikes = append(c.hooks.ScaCommentLikes, hooks...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||||
|
// A call to `Intercept(f, g, h)` equals to `scacommentlikes.Intercept(f(g(h())))`.
|
||||||
|
func (c *ScaCommentLikesClient) Intercept(interceptors ...Interceptor) {
|
||||||
|
c.inters.ScaCommentLikes = append(c.inters.ScaCommentLikes, interceptors...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create returns a builder for creating a ScaCommentLikes entity.
|
||||||
|
func (c *ScaCommentLikesClient) Create() *ScaCommentLikesCreate {
|
||||||
|
mutation := newScaCommentLikesMutation(c.config, OpCreate)
|
||||||
|
return &ScaCommentLikesCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateBulk returns a builder for creating a bulk of ScaCommentLikes entities.
|
||||||
|
func (c *ScaCommentLikesClient) CreateBulk(builders ...*ScaCommentLikesCreate) *ScaCommentLikesCreateBulk {
|
||||||
|
return &ScaCommentLikesCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||||
|
// a builder and applies setFunc on it.
|
||||||
|
func (c *ScaCommentLikesClient) MapCreateBulk(slice any, setFunc func(*ScaCommentLikesCreate, int)) *ScaCommentLikesCreateBulk {
|
||||||
|
rv := reflect.ValueOf(slice)
|
||||||
|
if rv.Kind() != reflect.Slice {
|
||||||
|
return &ScaCommentLikesCreateBulk{err: fmt.Errorf("calling to ScaCommentLikesClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||||
|
}
|
||||||
|
builders := make([]*ScaCommentLikesCreate, rv.Len())
|
||||||
|
for i := 0; i < rv.Len(); i++ {
|
||||||
|
builders[i] = c.Create()
|
||||||
|
setFunc(builders[i], i)
|
||||||
|
}
|
||||||
|
return &ScaCommentLikesCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns an update builder for ScaCommentLikes.
|
||||||
|
func (c *ScaCommentLikesClient) Update() *ScaCommentLikesUpdate {
|
||||||
|
mutation := newScaCommentLikesMutation(c.config, OpUpdate)
|
||||||
|
return &ScaCommentLikesUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOne returns an update builder for the given entity.
|
||||||
|
func (c *ScaCommentLikesClient) UpdateOne(scl *ScaCommentLikes) *ScaCommentLikesUpdateOne {
|
||||||
|
mutation := newScaCommentLikesMutation(c.config, OpUpdateOne, withScaCommentLikes(scl))
|
||||||
|
return &ScaCommentLikesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOneID returns an update builder for the given id.
|
||||||
|
func (c *ScaCommentLikesClient) UpdateOneID(id int64) *ScaCommentLikesUpdateOne {
|
||||||
|
mutation := newScaCommentLikesMutation(c.config, OpUpdateOne, withScaCommentLikesID(id))
|
||||||
|
return &ScaCommentLikesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete returns a delete builder for ScaCommentLikes.
|
||||||
|
func (c *ScaCommentLikesClient) Delete() *ScaCommentLikesDelete {
|
||||||
|
mutation := newScaCommentLikesMutation(c.config, OpDelete)
|
||||||
|
return &ScaCommentLikesDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOne returns a builder for deleting the given entity.
|
||||||
|
func (c *ScaCommentLikesClient) DeleteOne(scl *ScaCommentLikes) *ScaCommentLikesDeleteOne {
|
||||||
|
return c.DeleteOneID(scl.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
|
func (c *ScaCommentLikesClient) DeleteOneID(id int64) *ScaCommentLikesDeleteOne {
|
||||||
|
builder := c.Delete().Where(scacommentlikes.ID(id))
|
||||||
|
builder.mutation.id = &id
|
||||||
|
builder.mutation.op = OpDeleteOne
|
||||||
|
return &ScaCommentLikesDeleteOne{builder}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query returns a query builder for ScaCommentLikes.
|
||||||
|
func (c *ScaCommentLikesClient) Query() *ScaCommentLikesQuery {
|
||||||
|
return &ScaCommentLikesQuery{
|
||||||
|
config: c.config,
|
||||||
|
ctx: &QueryContext{Type: TypeScaCommentLikes},
|
||||||
|
inters: c.Interceptors(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns a ScaCommentLikes entity by its id.
|
||||||
|
func (c *ScaCommentLikesClient) Get(ctx context.Context, id int64) (*ScaCommentLikes, error) {
|
||||||
|
return c.Query().Where(scacommentlikes.ID(id)).Only(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetX is like Get, but panics if an error occurs.
|
||||||
|
func (c *ScaCommentLikesClient) GetX(ctx context.Context, id int64) *ScaCommentLikes {
|
||||||
|
obj, err := c.Get(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hooks returns the client hooks.
|
||||||
|
func (c *ScaCommentLikesClient) Hooks() []Hook {
|
||||||
|
return c.hooks.ScaCommentLikes
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interceptors returns the client interceptors.
|
||||||
|
func (c *ScaCommentLikesClient) Interceptors() []Interceptor {
|
||||||
|
return c.inters.ScaCommentLikes
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ScaCommentLikesClient) mutate(ctx context.Context, m *ScaCommentLikesMutation) (Value, error) {
|
||||||
|
switch m.Op() {
|
||||||
|
case OpCreate:
|
||||||
|
return (&ScaCommentLikesCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdate:
|
||||||
|
return (&ScaCommentLikesUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdateOne:
|
||||||
|
return (&ScaCommentLikesUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpDelete, OpDeleteOne:
|
||||||
|
return (&ScaCommentLikesDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("ent: unknown ScaCommentLikes mutation op: %q", m.Op())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessageClient is a client for the ScaCommentMessage schema.
|
||||||
|
type ScaCommentMessageClient struct {
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewScaCommentMessageClient returns a client for the ScaCommentMessage from the given config.
|
||||||
|
func NewScaCommentMessageClient(c config) *ScaCommentMessageClient {
|
||||||
|
return &ScaCommentMessageClient{config: c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use adds a list of mutation hooks to the hooks stack.
|
||||||
|
// A call to `Use(f, g, h)` equals to `scacommentmessage.Hooks(f(g(h())))`.
|
||||||
|
func (c *ScaCommentMessageClient) Use(hooks ...Hook) {
|
||||||
|
c.hooks.ScaCommentMessage = append(c.hooks.ScaCommentMessage, hooks...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||||
|
// A call to `Intercept(f, g, h)` equals to `scacommentmessage.Intercept(f(g(h())))`.
|
||||||
|
func (c *ScaCommentMessageClient) Intercept(interceptors ...Interceptor) {
|
||||||
|
c.inters.ScaCommentMessage = append(c.inters.ScaCommentMessage, interceptors...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create returns a builder for creating a ScaCommentMessage entity.
|
||||||
|
func (c *ScaCommentMessageClient) Create() *ScaCommentMessageCreate {
|
||||||
|
mutation := newScaCommentMessageMutation(c.config, OpCreate)
|
||||||
|
return &ScaCommentMessageCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateBulk returns a builder for creating a bulk of ScaCommentMessage entities.
|
||||||
|
func (c *ScaCommentMessageClient) CreateBulk(builders ...*ScaCommentMessageCreate) *ScaCommentMessageCreateBulk {
|
||||||
|
return &ScaCommentMessageCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||||
|
// a builder and applies setFunc on it.
|
||||||
|
func (c *ScaCommentMessageClient) MapCreateBulk(slice any, setFunc func(*ScaCommentMessageCreate, int)) *ScaCommentMessageCreateBulk {
|
||||||
|
rv := reflect.ValueOf(slice)
|
||||||
|
if rv.Kind() != reflect.Slice {
|
||||||
|
return &ScaCommentMessageCreateBulk{err: fmt.Errorf("calling to ScaCommentMessageClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||||
|
}
|
||||||
|
builders := make([]*ScaCommentMessageCreate, rv.Len())
|
||||||
|
for i := 0; i < rv.Len(); i++ {
|
||||||
|
builders[i] = c.Create()
|
||||||
|
setFunc(builders[i], i)
|
||||||
|
}
|
||||||
|
return &ScaCommentMessageCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns an update builder for ScaCommentMessage.
|
||||||
|
func (c *ScaCommentMessageClient) Update() *ScaCommentMessageUpdate {
|
||||||
|
mutation := newScaCommentMessageMutation(c.config, OpUpdate)
|
||||||
|
return &ScaCommentMessageUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOne returns an update builder for the given entity.
|
||||||
|
func (c *ScaCommentMessageClient) UpdateOne(scm *ScaCommentMessage) *ScaCommentMessageUpdateOne {
|
||||||
|
mutation := newScaCommentMessageMutation(c.config, OpUpdateOne, withScaCommentMessage(scm))
|
||||||
|
return &ScaCommentMessageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOneID returns an update builder for the given id.
|
||||||
|
func (c *ScaCommentMessageClient) UpdateOneID(id int64) *ScaCommentMessageUpdateOne {
|
||||||
|
mutation := newScaCommentMessageMutation(c.config, OpUpdateOne, withScaCommentMessageID(id))
|
||||||
|
return &ScaCommentMessageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete returns a delete builder for ScaCommentMessage.
|
||||||
|
func (c *ScaCommentMessageClient) Delete() *ScaCommentMessageDelete {
|
||||||
|
mutation := newScaCommentMessageMutation(c.config, OpDelete)
|
||||||
|
return &ScaCommentMessageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOne returns a builder for deleting the given entity.
|
||||||
|
func (c *ScaCommentMessageClient) DeleteOne(scm *ScaCommentMessage) *ScaCommentMessageDeleteOne {
|
||||||
|
return c.DeleteOneID(scm.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
|
func (c *ScaCommentMessageClient) DeleteOneID(id int64) *ScaCommentMessageDeleteOne {
|
||||||
|
builder := c.Delete().Where(scacommentmessage.ID(id))
|
||||||
|
builder.mutation.id = &id
|
||||||
|
builder.mutation.op = OpDeleteOne
|
||||||
|
return &ScaCommentMessageDeleteOne{builder}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query returns a query builder for ScaCommentMessage.
|
||||||
|
func (c *ScaCommentMessageClient) Query() *ScaCommentMessageQuery {
|
||||||
|
return &ScaCommentMessageQuery{
|
||||||
|
config: c.config,
|
||||||
|
ctx: &QueryContext{Type: TypeScaCommentMessage},
|
||||||
|
inters: c.Interceptors(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns a ScaCommentMessage entity by its id.
|
||||||
|
func (c *ScaCommentMessageClient) Get(ctx context.Context, id int64) (*ScaCommentMessage, error) {
|
||||||
|
return c.Query().Where(scacommentmessage.ID(id)).Only(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetX is like Get, but panics if an error occurs.
|
||||||
|
func (c *ScaCommentMessageClient) GetX(ctx context.Context, id int64) *ScaCommentMessage {
|
||||||
|
obj, err := c.Get(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hooks returns the client hooks.
|
||||||
|
func (c *ScaCommentMessageClient) Hooks() []Hook {
|
||||||
|
return c.hooks.ScaCommentMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interceptors returns the client interceptors.
|
||||||
|
func (c *ScaCommentMessageClient) Interceptors() []Interceptor {
|
||||||
|
return c.inters.ScaCommentMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ScaCommentMessageClient) mutate(ctx context.Context, m *ScaCommentMessageMutation) (Value, error) {
|
||||||
|
switch m.Op() {
|
||||||
|
case OpCreate:
|
||||||
|
return (&ScaCommentMessageCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdate:
|
||||||
|
return (&ScaCommentMessageUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdateOne:
|
||||||
|
return (&ScaCommentMessageUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpDelete, OpDeleteOne:
|
||||||
|
return (&ScaCommentMessageDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("ent: unknown ScaCommentMessage mutation op: %q", m.Op())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentReplyClient is a client for the ScaCommentReply schema.
|
||||||
|
type ScaCommentReplyClient struct {
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewScaCommentReplyClient returns a client for the ScaCommentReply from the given config.
|
||||||
|
func NewScaCommentReplyClient(c config) *ScaCommentReplyClient {
|
||||||
|
return &ScaCommentReplyClient{config: c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use adds a list of mutation hooks to the hooks stack.
|
||||||
|
// A call to `Use(f, g, h)` equals to `scacommentreply.Hooks(f(g(h())))`.
|
||||||
|
func (c *ScaCommentReplyClient) Use(hooks ...Hook) {
|
||||||
|
c.hooks.ScaCommentReply = append(c.hooks.ScaCommentReply, hooks...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||||
|
// A call to `Intercept(f, g, h)` equals to `scacommentreply.Intercept(f(g(h())))`.
|
||||||
|
func (c *ScaCommentReplyClient) Intercept(interceptors ...Interceptor) {
|
||||||
|
c.inters.ScaCommentReply = append(c.inters.ScaCommentReply, interceptors...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create returns a builder for creating a ScaCommentReply entity.
|
||||||
|
func (c *ScaCommentReplyClient) Create() *ScaCommentReplyCreate {
|
||||||
|
mutation := newScaCommentReplyMutation(c.config, OpCreate)
|
||||||
|
return &ScaCommentReplyCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateBulk returns a builder for creating a bulk of ScaCommentReply entities.
|
||||||
|
func (c *ScaCommentReplyClient) CreateBulk(builders ...*ScaCommentReplyCreate) *ScaCommentReplyCreateBulk {
|
||||||
|
return &ScaCommentReplyCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||||
|
// a builder and applies setFunc on it.
|
||||||
|
func (c *ScaCommentReplyClient) MapCreateBulk(slice any, setFunc func(*ScaCommentReplyCreate, int)) *ScaCommentReplyCreateBulk {
|
||||||
|
rv := reflect.ValueOf(slice)
|
||||||
|
if rv.Kind() != reflect.Slice {
|
||||||
|
return &ScaCommentReplyCreateBulk{err: fmt.Errorf("calling to ScaCommentReplyClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||||
|
}
|
||||||
|
builders := make([]*ScaCommentReplyCreate, rv.Len())
|
||||||
|
for i := 0; i < rv.Len(); i++ {
|
||||||
|
builders[i] = c.Create()
|
||||||
|
setFunc(builders[i], i)
|
||||||
|
}
|
||||||
|
return &ScaCommentReplyCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns an update builder for ScaCommentReply.
|
||||||
|
func (c *ScaCommentReplyClient) Update() *ScaCommentReplyUpdate {
|
||||||
|
mutation := newScaCommentReplyMutation(c.config, OpUpdate)
|
||||||
|
return &ScaCommentReplyUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOne returns an update builder for the given entity.
|
||||||
|
func (c *ScaCommentReplyClient) UpdateOne(scr *ScaCommentReply) *ScaCommentReplyUpdateOne {
|
||||||
|
mutation := newScaCommentReplyMutation(c.config, OpUpdateOne, withScaCommentReply(scr))
|
||||||
|
return &ScaCommentReplyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOneID returns an update builder for the given id.
|
||||||
|
func (c *ScaCommentReplyClient) UpdateOneID(id int64) *ScaCommentReplyUpdateOne {
|
||||||
|
mutation := newScaCommentReplyMutation(c.config, OpUpdateOne, withScaCommentReplyID(id))
|
||||||
|
return &ScaCommentReplyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete returns a delete builder for ScaCommentReply.
|
||||||
|
func (c *ScaCommentReplyClient) Delete() *ScaCommentReplyDelete {
|
||||||
|
mutation := newScaCommentReplyMutation(c.config, OpDelete)
|
||||||
|
return &ScaCommentReplyDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOne returns a builder for deleting the given entity.
|
||||||
|
func (c *ScaCommentReplyClient) DeleteOne(scr *ScaCommentReply) *ScaCommentReplyDeleteOne {
|
||||||
|
return c.DeleteOneID(scr.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
|
func (c *ScaCommentReplyClient) DeleteOneID(id int64) *ScaCommentReplyDeleteOne {
|
||||||
|
builder := c.Delete().Where(scacommentreply.ID(id))
|
||||||
|
builder.mutation.id = &id
|
||||||
|
builder.mutation.op = OpDeleteOne
|
||||||
|
return &ScaCommentReplyDeleteOne{builder}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query returns a query builder for ScaCommentReply.
|
||||||
|
func (c *ScaCommentReplyClient) Query() *ScaCommentReplyQuery {
|
||||||
|
return &ScaCommentReplyQuery{
|
||||||
|
config: c.config,
|
||||||
|
ctx: &QueryContext{Type: TypeScaCommentReply},
|
||||||
|
inters: c.Interceptors(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns a ScaCommentReply entity by its id.
|
||||||
|
func (c *ScaCommentReplyClient) Get(ctx context.Context, id int64) (*ScaCommentReply, error) {
|
||||||
|
return c.Query().Where(scacommentreply.ID(id)).Only(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetX is like Get, but panics if an error occurs.
|
||||||
|
func (c *ScaCommentReplyClient) GetX(ctx context.Context, id int64) *ScaCommentReply {
|
||||||
|
obj, err := c.Get(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hooks returns the client hooks.
|
||||||
|
func (c *ScaCommentReplyClient) Hooks() []Hook {
|
||||||
|
return c.hooks.ScaCommentReply
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interceptors returns the client interceptors.
|
||||||
|
func (c *ScaCommentReplyClient) Interceptors() []Interceptor {
|
||||||
|
return c.inters.ScaCommentReply
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ScaCommentReplyClient) mutate(ctx context.Context, m *ScaCommentReplyMutation) (Value, error) {
|
||||||
|
switch m.Op() {
|
||||||
|
case OpCreate:
|
||||||
|
return (&ScaCommentReplyCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdate:
|
||||||
|
return (&ScaCommentReplyUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdateOne:
|
||||||
|
return (&ScaCommentReplyUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpDelete, OpDeleteOne:
|
||||||
|
return (&ScaCommentReplyDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("ent: unknown ScaCommentReply mutation op: %q", m.Op())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsClient is a client for the ScaUserFollows schema.
|
||||||
|
type ScaUserFollowsClient struct {
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewScaUserFollowsClient returns a client for the ScaUserFollows from the given config.
|
||||||
|
func NewScaUserFollowsClient(c config) *ScaUserFollowsClient {
|
||||||
|
return &ScaUserFollowsClient{config: c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use adds a list of mutation hooks to the hooks stack.
|
||||||
|
// A call to `Use(f, g, h)` equals to `scauserfollows.Hooks(f(g(h())))`.
|
||||||
|
func (c *ScaUserFollowsClient) Use(hooks ...Hook) {
|
||||||
|
c.hooks.ScaUserFollows = append(c.hooks.ScaUserFollows, hooks...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||||
|
// A call to `Intercept(f, g, h)` equals to `scauserfollows.Intercept(f(g(h())))`.
|
||||||
|
func (c *ScaUserFollowsClient) Intercept(interceptors ...Interceptor) {
|
||||||
|
c.inters.ScaUserFollows = append(c.inters.ScaUserFollows, interceptors...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create returns a builder for creating a ScaUserFollows entity.
|
||||||
|
func (c *ScaUserFollowsClient) Create() *ScaUserFollowsCreate {
|
||||||
|
mutation := newScaUserFollowsMutation(c.config, OpCreate)
|
||||||
|
return &ScaUserFollowsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateBulk returns a builder for creating a bulk of ScaUserFollows entities.
|
||||||
|
func (c *ScaUserFollowsClient) CreateBulk(builders ...*ScaUserFollowsCreate) *ScaUserFollowsCreateBulk {
|
||||||
|
return &ScaUserFollowsCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||||
|
// a builder and applies setFunc on it.
|
||||||
|
func (c *ScaUserFollowsClient) MapCreateBulk(slice any, setFunc func(*ScaUserFollowsCreate, int)) *ScaUserFollowsCreateBulk {
|
||||||
|
rv := reflect.ValueOf(slice)
|
||||||
|
if rv.Kind() != reflect.Slice {
|
||||||
|
return &ScaUserFollowsCreateBulk{err: fmt.Errorf("calling to ScaUserFollowsClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||||
|
}
|
||||||
|
builders := make([]*ScaUserFollowsCreate, rv.Len())
|
||||||
|
for i := 0; i < rv.Len(); i++ {
|
||||||
|
builders[i] = c.Create()
|
||||||
|
setFunc(builders[i], i)
|
||||||
|
}
|
||||||
|
return &ScaUserFollowsCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns an update builder for ScaUserFollows.
|
||||||
|
func (c *ScaUserFollowsClient) Update() *ScaUserFollowsUpdate {
|
||||||
|
mutation := newScaUserFollowsMutation(c.config, OpUpdate)
|
||||||
|
return &ScaUserFollowsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOne returns an update builder for the given entity.
|
||||||
|
func (c *ScaUserFollowsClient) UpdateOne(suf *ScaUserFollows) *ScaUserFollowsUpdateOne {
|
||||||
|
mutation := newScaUserFollowsMutation(c.config, OpUpdateOne, withScaUserFollows(suf))
|
||||||
|
return &ScaUserFollowsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOneID returns an update builder for the given id.
|
||||||
|
func (c *ScaUserFollowsClient) UpdateOneID(id int) *ScaUserFollowsUpdateOne {
|
||||||
|
mutation := newScaUserFollowsMutation(c.config, OpUpdateOne, withScaUserFollowsID(id))
|
||||||
|
return &ScaUserFollowsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete returns a delete builder for ScaUserFollows.
|
||||||
|
func (c *ScaUserFollowsClient) Delete() *ScaUserFollowsDelete {
|
||||||
|
mutation := newScaUserFollowsMutation(c.config, OpDelete)
|
||||||
|
return &ScaUserFollowsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOne returns a builder for deleting the given entity.
|
||||||
|
func (c *ScaUserFollowsClient) DeleteOne(suf *ScaUserFollows) *ScaUserFollowsDeleteOne {
|
||||||
|
return c.DeleteOneID(suf.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
|
func (c *ScaUserFollowsClient) DeleteOneID(id int) *ScaUserFollowsDeleteOne {
|
||||||
|
builder := c.Delete().Where(scauserfollows.ID(id))
|
||||||
|
builder.mutation.id = &id
|
||||||
|
builder.mutation.op = OpDeleteOne
|
||||||
|
return &ScaUserFollowsDeleteOne{builder}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query returns a query builder for ScaUserFollows.
|
||||||
|
func (c *ScaUserFollowsClient) Query() *ScaUserFollowsQuery {
|
||||||
|
return &ScaUserFollowsQuery{
|
||||||
|
config: c.config,
|
||||||
|
ctx: &QueryContext{Type: TypeScaUserFollows},
|
||||||
|
inters: c.Interceptors(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns a ScaUserFollows entity by its id.
|
||||||
|
func (c *ScaUserFollowsClient) Get(ctx context.Context, id int) (*ScaUserFollows, error) {
|
||||||
|
return c.Query().Where(scauserfollows.ID(id)).Only(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetX is like Get, but panics if an error occurs.
|
||||||
|
func (c *ScaUserFollowsClient) GetX(ctx context.Context, id int) *ScaUserFollows {
|
||||||
|
obj, err := c.Get(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hooks returns the client hooks.
|
||||||
|
func (c *ScaUserFollowsClient) Hooks() []Hook {
|
||||||
|
return c.hooks.ScaUserFollows
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interceptors returns the client interceptors.
|
||||||
|
func (c *ScaUserFollowsClient) Interceptors() []Interceptor {
|
||||||
|
return c.inters.ScaUserFollows
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ScaUserFollowsClient) mutate(ctx context.Context, m *ScaUserFollowsMutation) (Value, error) {
|
||||||
|
switch m.Op() {
|
||||||
|
case OpCreate:
|
||||||
|
return (&ScaUserFollowsCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdate:
|
||||||
|
return (&ScaUserFollowsUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdateOne:
|
||||||
|
return (&ScaUserFollowsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpDelete, OpDeleteOne:
|
||||||
|
return (&ScaUserFollowsDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("ent: unknown ScaUserFollows mutation op: %q", m.Op())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevelClient is a client for the ScaUserLevel schema.
|
||||||
|
type ScaUserLevelClient struct {
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewScaUserLevelClient returns a client for the ScaUserLevel from the given config.
|
||||||
|
func NewScaUserLevelClient(c config) *ScaUserLevelClient {
|
||||||
|
return &ScaUserLevelClient{config: c}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use adds a list of mutation hooks to the hooks stack.
|
||||||
|
// A call to `Use(f, g, h)` equals to `scauserlevel.Hooks(f(g(h())))`.
|
||||||
|
func (c *ScaUserLevelClient) Use(hooks ...Hook) {
|
||||||
|
c.hooks.ScaUserLevel = append(c.hooks.ScaUserLevel, hooks...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Intercept adds a list of query interceptors to the interceptors stack.
|
||||||
|
// A call to `Intercept(f, g, h)` equals to `scauserlevel.Intercept(f(g(h())))`.
|
||||||
|
func (c *ScaUserLevelClient) Intercept(interceptors ...Interceptor) {
|
||||||
|
c.inters.ScaUserLevel = append(c.inters.ScaUserLevel, interceptors...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create returns a builder for creating a ScaUserLevel entity.
|
||||||
|
func (c *ScaUserLevelClient) Create() *ScaUserLevelCreate {
|
||||||
|
mutation := newScaUserLevelMutation(c.config, OpCreate)
|
||||||
|
return &ScaUserLevelCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateBulk returns a builder for creating a bulk of ScaUserLevel entities.
|
||||||
|
func (c *ScaUserLevelClient) CreateBulk(builders ...*ScaUserLevelCreate) *ScaUserLevelCreateBulk {
|
||||||
|
return &ScaUserLevelCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
|
||||||
|
// a builder and applies setFunc on it.
|
||||||
|
func (c *ScaUserLevelClient) MapCreateBulk(slice any, setFunc func(*ScaUserLevelCreate, int)) *ScaUserLevelCreateBulk {
|
||||||
|
rv := reflect.ValueOf(slice)
|
||||||
|
if rv.Kind() != reflect.Slice {
|
||||||
|
return &ScaUserLevelCreateBulk{err: fmt.Errorf("calling to ScaUserLevelClient.MapCreateBulk with wrong type %T, need slice", slice)}
|
||||||
|
}
|
||||||
|
builders := make([]*ScaUserLevelCreate, rv.Len())
|
||||||
|
for i := 0; i < rv.Len(); i++ {
|
||||||
|
builders[i] = c.Create()
|
||||||
|
setFunc(builders[i], i)
|
||||||
|
}
|
||||||
|
return &ScaUserLevelCreateBulk{config: c.config, builders: builders}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns an update builder for ScaUserLevel.
|
||||||
|
func (c *ScaUserLevelClient) Update() *ScaUserLevelUpdate {
|
||||||
|
mutation := newScaUserLevelMutation(c.config, OpUpdate)
|
||||||
|
return &ScaUserLevelUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOne returns an update builder for the given entity.
|
||||||
|
func (c *ScaUserLevelClient) UpdateOne(sul *ScaUserLevel) *ScaUserLevelUpdateOne {
|
||||||
|
mutation := newScaUserLevelMutation(c.config, OpUpdateOne, withScaUserLevel(sul))
|
||||||
|
return &ScaUserLevelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateOneID returns an update builder for the given id.
|
||||||
|
func (c *ScaUserLevelClient) UpdateOneID(id int64) *ScaUserLevelUpdateOne {
|
||||||
|
mutation := newScaUserLevelMutation(c.config, OpUpdateOne, withScaUserLevelID(id))
|
||||||
|
return &ScaUserLevelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete returns a delete builder for ScaUserLevel.
|
||||||
|
func (c *ScaUserLevelClient) Delete() *ScaUserLevelDelete {
|
||||||
|
mutation := newScaUserLevelMutation(c.config, OpDelete)
|
||||||
|
return &ScaUserLevelDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOne returns a builder for deleting the given entity.
|
||||||
|
func (c *ScaUserLevelClient) DeleteOne(sul *ScaUserLevel) *ScaUserLevelDeleteOne {
|
||||||
|
return c.DeleteOneID(sul.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteOneID returns a builder for deleting the given entity by its id.
|
||||||
|
func (c *ScaUserLevelClient) DeleteOneID(id int64) *ScaUserLevelDeleteOne {
|
||||||
|
builder := c.Delete().Where(scauserlevel.ID(id))
|
||||||
|
builder.mutation.id = &id
|
||||||
|
builder.mutation.op = OpDeleteOne
|
||||||
|
return &ScaUserLevelDeleteOne{builder}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query returns a query builder for ScaUserLevel.
|
||||||
|
func (c *ScaUserLevelClient) Query() *ScaUserLevelQuery {
|
||||||
|
return &ScaUserLevelQuery{
|
||||||
|
config: c.config,
|
||||||
|
ctx: &QueryContext{Type: TypeScaUserLevel},
|
||||||
|
inters: c.Interceptors(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get returns a ScaUserLevel entity by its id.
|
||||||
|
func (c *ScaUserLevelClient) Get(ctx context.Context, id int64) (*ScaUserLevel, error) {
|
||||||
|
return c.Query().Where(scauserlevel.ID(id)).Only(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetX is like Get, but panics if an error occurs.
|
||||||
|
func (c *ScaUserLevelClient) GetX(ctx context.Context, id int64) *ScaUserLevel {
|
||||||
|
obj, err := c.Get(ctx, id)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hooks returns the client hooks.
|
||||||
|
func (c *ScaUserLevelClient) Hooks() []Hook {
|
||||||
|
return c.hooks.ScaUserLevel
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interceptors returns the client interceptors.
|
||||||
|
func (c *ScaUserLevelClient) Interceptors() []Interceptor {
|
||||||
|
return c.inters.ScaUserLevel
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ScaUserLevelClient) mutate(ctx context.Context, m *ScaUserLevelMutation) (Value, error) {
|
||||||
|
switch m.Op() {
|
||||||
|
case OpCreate:
|
||||||
|
return (&ScaUserLevelCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdate:
|
||||||
|
return (&ScaUserLevelUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpUpdateOne:
|
||||||
|
return (&ScaUserLevelUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
|
||||||
|
case OpDelete, OpDeleteOne:
|
||||||
|
return (&ScaUserLevelDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("ent: unknown ScaUserLevel mutation op: %q", m.Op())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// hooks and interceptors per client, for fast access.
|
// hooks and interceptors per client, for fast access.
|
||||||
type (
|
type (
|
||||||
hooks struct {
|
hooks struct {
|
||||||
ScaAuthPermissionRule, ScaAuthRole, ScaAuthUser, ScaAuthUserDevice,
|
ScaAuthPermissionRule, ScaAuthRole, ScaAuthUser, ScaAuthUserDevice,
|
||||||
ScaAuthUserSocial []ent.Hook
|
ScaAuthUserSocial, ScaCommentLikes, ScaCommentMessage, ScaCommentReply,
|
||||||
|
ScaUserFollows, ScaUserLevel []ent.Hook
|
||||||
}
|
}
|
||||||
inters struct {
|
inters struct {
|
||||||
ScaAuthPermissionRule, ScaAuthRole, ScaAuthUser, ScaAuthUserDevice,
|
ScaAuthPermissionRule, ScaAuthRole, ScaAuthUser, ScaAuthUserDevice,
|
||||||
ScaAuthUserSocial []ent.Interceptor
|
ScaAuthUserSocial, ScaCommentLikes, ScaCommentMessage, ScaCommentReply,
|
||||||
|
ScaUserFollows, ScaUserLevel []ent.Interceptor
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ import (
|
|||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
@@ -82,6 +87,11 @@ func checkColumn(table, column string) error {
|
|||||||
scaauthuser.Table: scaauthuser.ValidColumn,
|
scaauthuser.Table: scaauthuser.ValidColumn,
|
||||||
scaauthuserdevice.Table: scaauthuserdevice.ValidColumn,
|
scaauthuserdevice.Table: scaauthuserdevice.ValidColumn,
|
||||||
scaauthusersocial.Table: scaauthusersocial.ValidColumn,
|
scaauthusersocial.Table: scaauthusersocial.ValidColumn,
|
||||||
|
scacommentlikes.Table: scacommentlikes.ValidColumn,
|
||||||
|
scacommentmessage.Table: scacommentmessage.ValidColumn,
|
||||||
|
scacommentreply.Table: scacommentreply.ValidColumn,
|
||||||
|
scauserfollows.Table: scauserfollows.ValidColumn,
|
||||||
|
scauserlevel.Table: scauserlevel.ValidColumn,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return columnCheck(table, column)
|
return columnCheck(table, column)
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ import (
|
|||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
|
|
||||||
"entgo.io/ent/dialect/sql"
|
"entgo.io/ent/dialect/sql"
|
||||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
@@ -17,7 +22,7 @@ import (
|
|||||||
|
|
||||||
// schemaGraph holds a representation of ent/schema at runtime.
|
// schemaGraph holds a representation of ent/schema at runtime.
|
||||||
var schemaGraph = func() *sqlgraph.Schema {
|
var schemaGraph = func() *sqlgraph.Schema {
|
||||||
graph := &sqlgraph.Schema{Nodes: make([]*sqlgraph.Node, 5)}
|
graph := &sqlgraph.Schema{Nodes: make([]*sqlgraph.Node, 10)}
|
||||||
graph.Nodes[0] = &sqlgraph.Node{
|
graph.Nodes[0] = &sqlgraph.Node{
|
||||||
NodeSpec: sqlgraph.NodeSpec{
|
NodeSpec: sqlgraph.NodeSpec{
|
||||||
Table: scaauthpermissionrule.Table,
|
Table: scaauthpermissionrule.Table,
|
||||||
@@ -134,6 +139,112 @@ var schemaGraph = func() *sqlgraph.Schema {
|
|||||||
scaauthusersocial.FieldStatus: {Type: field.TypeInt, Column: scaauthusersocial.FieldStatus},
|
scaauthusersocial.FieldStatus: {Type: field.TypeInt, Column: scaauthusersocial.FieldStatus},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
graph.Nodes[5] = &sqlgraph.Node{
|
||||||
|
NodeSpec: sqlgraph.NodeSpec{
|
||||||
|
Table: scacommentlikes.Table,
|
||||||
|
Columns: scacommentlikes.Columns,
|
||||||
|
ID: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt64,
|
||||||
|
Column: scacommentlikes.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Type: "ScaCommentLikes",
|
||||||
|
Fields: map[string]*sqlgraph.FieldSpec{
|
||||||
|
scacommentlikes.FieldTopicID: {Type: field.TypeString, Column: scacommentlikes.FieldTopicID},
|
||||||
|
scacommentlikes.FieldUserID: {Type: field.TypeString, Column: scacommentlikes.FieldUserID},
|
||||||
|
scacommentlikes.FieldCommentID: {Type: field.TypeInt64, Column: scacommentlikes.FieldCommentID},
|
||||||
|
scacommentlikes.FieldLikeTime: {Type: field.TypeTime, Column: scacommentlikes.FieldLikeTime},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
graph.Nodes[6] = &sqlgraph.Node{
|
||||||
|
NodeSpec: sqlgraph.NodeSpec{
|
||||||
|
Table: scacommentmessage.Table,
|
||||||
|
Columns: scacommentmessage.Columns,
|
||||||
|
ID: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt64,
|
||||||
|
Column: scacommentmessage.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Type: "ScaCommentMessage",
|
||||||
|
Fields: map[string]*sqlgraph.FieldSpec{
|
||||||
|
scacommentmessage.FieldCreatedAt: {Type: field.TypeTime, Column: scacommentmessage.FieldCreatedAt},
|
||||||
|
scacommentmessage.FieldUpdatedAt: {Type: field.TypeTime, Column: scacommentmessage.FieldUpdatedAt},
|
||||||
|
scacommentmessage.FieldDeleted: {Type: field.TypeInt8, Column: scacommentmessage.FieldDeleted},
|
||||||
|
scacommentmessage.FieldTopicID: {Type: field.TypeString, Column: scacommentmessage.FieldTopicID},
|
||||||
|
scacommentmessage.FieldFromID: {Type: field.TypeString, Column: scacommentmessage.FieldFromID},
|
||||||
|
scacommentmessage.FieldToID: {Type: field.TypeString, Column: scacommentmessage.FieldToID},
|
||||||
|
scacommentmessage.FieldContent: {Type: field.TypeString, Column: scacommentmessage.FieldContent},
|
||||||
|
scacommentmessage.FieldIsRead: {Type: field.TypeInt, Column: scacommentmessage.FieldIsRead},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
graph.Nodes[7] = &sqlgraph.Node{
|
||||||
|
NodeSpec: sqlgraph.NodeSpec{
|
||||||
|
Table: scacommentreply.Table,
|
||||||
|
Columns: scacommentreply.Columns,
|
||||||
|
ID: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt64,
|
||||||
|
Column: scacommentreply.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Type: "ScaCommentReply",
|
||||||
|
Fields: map[string]*sqlgraph.FieldSpec{
|
||||||
|
scacommentreply.FieldCreatedAt: {Type: field.TypeTime, Column: scacommentreply.FieldCreatedAt},
|
||||||
|
scacommentreply.FieldUpdatedAt: {Type: field.TypeTime, Column: scacommentreply.FieldUpdatedAt},
|
||||||
|
scacommentreply.FieldDeleted: {Type: field.TypeInt8, Column: scacommentreply.FieldDeleted},
|
||||||
|
scacommentreply.FieldUserID: {Type: field.TypeString, Column: scacommentreply.FieldUserID},
|
||||||
|
scacommentreply.FieldTopicID: {Type: field.TypeString, Column: scacommentreply.FieldTopicID},
|
||||||
|
scacommentreply.FieldTopicType: {Type: field.TypeInt, Column: scacommentreply.FieldTopicType},
|
||||||
|
scacommentreply.FieldContent: {Type: field.TypeString, Column: scacommentreply.FieldContent},
|
||||||
|
scacommentreply.FieldCommentType: {Type: field.TypeInt, Column: scacommentreply.FieldCommentType},
|
||||||
|
scacommentreply.FieldReplyTo: {Type: field.TypeInt64, Column: scacommentreply.FieldReplyTo},
|
||||||
|
scacommentreply.FieldReplyID: {Type: field.TypeInt64, Column: scacommentreply.FieldReplyID},
|
||||||
|
scacommentreply.FieldReplyUser: {Type: field.TypeString, Column: scacommentreply.FieldReplyUser},
|
||||||
|
scacommentreply.FieldAuthor: {Type: field.TypeInt, Column: scacommentreply.FieldAuthor},
|
||||||
|
scacommentreply.FieldLikes: {Type: field.TypeInt64, Column: scacommentreply.FieldLikes},
|
||||||
|
scacommentreply.FieldReplyCount: {Type: field.TypeInt64, Column: scacommentreply.FieldReplyCount},
|
||||||
|
scacommentreply.FieldBrowser: {Type: field.TypeString, Column: scacommentreply.FieldBrowser},
|
||||||
|
scacommentreply.FieldOperatingSystem: {Type: field.TypeString, Column: scacommentreply.FieldOperatingSystem},
|
||||||
|
scacommentreply.FieldCommentIP: {Type: field.TypeString, Column: scacommentreply.FieldCommentIP},
|
||||||
|
scacommentreply.FieldLocation: {Type: field.TypeString, Column: scacommentreply.FieldLocation},
|
||||||
|
scacommentreply.FieldAgent: {Type: field.TypeString, Column: scacommentreply.FieldAgent},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
graph.Nodes[8] = &sqlgraph.Node{
|
||||||
|
NodeSpec: sqlgraph.NodeSpec{
|
||||||
|
Table: scauserfollows.Table,
|
||||||
|
Columns: scauserfollows.Columns,
|
||||||
|
ID: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt,
|
||||||
|
Column: scauserfollows.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Type: "ScaUserFollows",
|
||||||
|
Fields: map[string]*sqlgraph.FieldSpec{
|
||||||
|
scauserfollows.FieldFollowerID: {Type: field.TypeString, Column: scauserfollows.FieldFollowerID},
|
||||||
|
scauserfollows.FieldFolloweeID: {Type: field.TypeString, Column: scauserfollows.FieldFolloweeID},
|
||||||
|
scauserfollows.FieldStatus: {Type: field.TypeUint8, Column: scauserfollows.FieldStatus},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
graph.Nodes[9] = &sqlgraph.Node{
|
||||||
|
NodeSpec: sqlgraph.NodeSpec{
|
||||||
|
Table: scauserlevel.Table,
|
||||||
|
Columns: scauserlevel.Columns,
|
||||||
|
ID: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeInt64,
|
||||||
|
Column: scauserlevel.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Type: "ScaUserLevel",
|
||||||
|
Fields: map[string]*sqlgraph.FieldSpec{
|
||||||
|
scauserlevel.FieldUserID: {Type: field.TypeString, Column: scauserlevel.FieldUserID},
|
||||||
|
scauserlevel.FieldLevelType: {Type: field.TypeUint8, Column: scauserlevel.FieldLevelType},
|
||||||
|
scauserlevel.FieldLevel: {Type: field.TypeInt, Column: scauserlevel.FieldLevel},
|
||||||
|
scauserlevel.FieldLevelName: {Type: field.TypeString, Column: scauserlevel.FieldLevelName},
|
||||||
|
scauserlevel.FieldExpStart: {Type: field.TypeInt64, Column: scauserlevel.FieldExpStart},
|
||||||
|
scauserlevel.FieldExpEnd: {Type: field.TypeInt64, Column: scauserlevel.FieldExpEnd},
|
||||||
|
scauserlevel.FieldLevelDescription: {Type: field.TypeString, Column: scauserlevel.FieldLevelDescription},
|
||||||
|
},
|
||||||
|
}
|
||||||
return graph
|
return graph
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@@ -597,3 +708,408 @@ func (f *ScaAuthUserSocialFilter) WhereSource(p entql.StringP) {
|
|||||||
func (f *ScaAuthUserSocialFilter) WhereStatus(p entql.IntP) {
|
func (f *ScaAuthUserSocialFilter) WhereStatus(p entql.IntP) {
|
||||||
f.Where(p.Field(scaauthusersocial.FieldStatus))
|
f.Where(p.Field(scaauthusersocial.FieldStatus))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (sclq *ScaCommentLikesQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
sclq.predicates = append(sclq.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns a Filter implementation to apply filters on the ScaCommentLikesQuery builder.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Filter() *ScaCommentLikesFilter {
|
||||||
|
return &ScaCommentLikesFilter{config: sclq.config, predicateAdder: sclq}
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (m *ScaCommentLikesMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
m.predicates = append(m.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns an entql.Where implementation to apply filters on the ScaCommentLikesMutation builder.
|
||||||
|
func (m *ScaCommentLikesMutation) Filter() *ScaCommentLikesFilter {
|
||||||
|
return &ScaCommentLikesFilter{config: m.config, predicateAdder: m}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesFilter provides a generic filtering capability at runtime for ScaCommentLikesQuery.
|
||||||
|
type ScaCommentLikesFilter struct {
|
||||||
|
predicateAdder
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where applies the entql predicate on the query filter.
|
||||||
|
func (f *ScaCommentLikesFilter) Where(p entql.P) {
|
||||||
|
f.addPredicate(func(s *sql.Selector) {
|
||||||
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[5].Type, p, s); err != nil {
|
||||||
|
s.AddError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereID applies the entql int64 predicate on the id field.
|
||||||
|
func (f *ScaCommentLikesFilter) WhereID(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentlikes.FieldID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereTopicID applies the entql string predicate on the topic_id field.
|
||||||
|
func (f *ScaCommentLikesFilter) WhereTopicID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentlikes.FieldTopicID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereUserID applies the entql string predicate on the user_id field.
|
||||||
|
func (f *ScaCommentLikesFilter) WhereUserID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentlikes.FieldUserID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereCommentID applies the entql int64 predicate on the comment_id field.
|
||||||
|
func (f *ScaCommentLikesFilter) WhereCommentID(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentlikes.FieldCommentID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereLikeTime applies the entql time.Time predicate on the like_time field.
|
||||||
|
func (f *ScaCommentLikesFilter) WhereLikeTime(p entql.TimeP) {
|
||||||
|
f.Where(p.Field(scacommentlikes.FieldLikeTime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (scmq *ScaCommentMessageQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
scmq.predicates = append(scmq.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns a Filter implementation to apply filters on the ScaCommentMessageQuery builder.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Filter() *ScaCommentMessageFilter {
|
||||||
|
return &ScaCommentMessageFilter{config: scmq.config, predicateAdder: scmq}
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (m *ScaCommentMessageMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
m.predicates = append(m.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns an entql.Where implementation to apply filters on the ScaCommentMessageMutation builder.
|
||||||
|
func (m *ScaCommentMessageMutation) Filter() *ScaCommentMessageFilter {
|
||||||
|
return &ScaCommentMessageFilter{config: m.config, predicateAdder: m}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessageFilter provides a generic filtering capability at runtime for ScaCommentMessageQuery.
|
||||||
|
type ScaCommentMessageFilter struct {
|
||||||
|
predicateAdder
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where applies the entql predicate on the query filter.
|
||||||
|
func (f *ScaCommentMessageFilter) Where(p entql.P) {
|
||||||
|
f.addPredicate(func(s *sql.Selector) {
|
||||||
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[6].Type, p, s); err != nil {
|
||||||
|
s.AddError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereID applies the entql int64 predicate on the id field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereID(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereCreatedAt(p entql.TimeP) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldCreatedAt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereUpdatedAt(p entql.TimeP) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldUpdatedAt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereDeleted applies the entql int8 predicate on the deleted field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereDeleted(p entql.Int8P) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldDeleted))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereTopicID applies the entql string predicate on the topic_id field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereTopicID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldTopicID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereFromID applies the entql string predicate on the from_id field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereFromID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldFromID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereToID applies the entql string predicate on the to_id field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereToID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldToID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereContent applies the entql string predicate on the content field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereContent(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldContent))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereIsRead applies the entql int predicate on the is_read field.
|
||||||
|
func (f *ScaCommentMessageFilter) WhereIsRead(p entql.IntP) {
|
||||||
|
f.Where(p.Field(scacommentmessage.FieldIsRead))
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (scrq *ScaCommentReplyQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
scrq.predicates = append(scrq.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns a Filter implementation to apply filters on the ScaCommentReplyQuery builder.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Filter() *ScaCommentReplyFilter {
|
||||||
|
return &ScaCommentReplyFilter{config: scrq.config, predicateAdder: scrq}
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (m *ScaCommentReplyMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
m.predicates = append(m.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns an entql.Where implementation to apply filters on the ScaCommentReplyMutation builder.
|
||||||
|
func (m *ScaCommentReplyMutation) Filter() *ScaCommentReplyFilter {
|
||||||
|
return &ScaCommentReplyFilter{config: m.config, predicateAdder: m}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentReplyFilter provides a generic filtering capability at runtime for ScaCommentReplyQuery.
|
||||||
|
type ScaCommentReplyFilter struct {
|
||||||
|
predicateAdder
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where applies the entql predicate on the query filter.
|
||||||
|
func (f *ScaCommentReplyFilter) Where(p entql.P) {
|
||||||
|
f.addPredicate(func(s *sql.Selector) {
|
||||||
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[7].Type, p, s); err != nil {
|
||||||
|
s.AddError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereID applies the entql int64 predicate on the id field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereID(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereCreatedAt(p entql.TimeP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldCreatedAt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereUpdatedAt(p entql.TimeP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldUpdatedAt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereDeleted applies the entql int8 predicate on the deleted field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereDeleted(p entql.Int8P) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldDeleted))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereUserID applies the entql string predicate on the user_id field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereUserID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldUserID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereTopicID applies the entql string predicate on the topic_id field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereTopicID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldTopicID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereTopicType applies the entql int predicate on the topic_type field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereTopicType(p entql.IntP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldTopicType))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereContent applies the entql string predicate on the content field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereContent(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldContent))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereCommentType applies the entql int predicate on the comment_type field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereCommentType(p entql.IntP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldCommentType))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereReplyTo applies the entql int64 predicate on the reply_to field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereReplyTo(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldReplyTo))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereReplyID applies the entql int64 predicate on the reply_id field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereReplyID(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldReplyID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereReplyUser applies the entql string predicate on the reply_user field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereReplyUser(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldReplyUser))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereAuthor applies the entql int predicate on the author field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereAuthor(p entql.IntP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldAuthor))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereLikes applies the entql int64 predicate on the likes field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereLikes(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldLikes))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereReplyCount applies the entql int64 predicate on the reply_count field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereReplyCount(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldReplyCount))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereBrowser applies the entql string predicate on the browser field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereBrowser(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldBrowser))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereOperatingSystem applies the entql string predicate on the operating_system field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereOperatingSystem(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldOperatingSystem))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereCommentIP applies the entql string predicate on the comment_ip field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereCommentIP(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldCommentIP))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereLocation applies the entql string predicate on the location field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereLocation(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldLocation))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereAgent applies the entql string predicate on the agent field.
|
||||||
|
func (f *ScaCommentReplyFilter) WhereAgent(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scacommentreply.FieldAgent))
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (sufq *ScaUserFollowsQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
sufq.predicates = append(sufq.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns a Filter implementation to apply filters on the ScaUserFollowsQuery builder.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Filter() *ScaUserFollowsFilter {
|
||||||
|
return &ScaUserFollowsFilter{config: sufq.config, predicateAdder: sufq}
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (m *ScaUserFollowsMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
m.predicates = append(m.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns an entql.Where implementation to apply filters on the ScaUserFollowsMutation builder.
|
||||||
|
func (m *ScaUserFollowsMutation) Filter() *ScaUserFollowsFilter {
|
||||||
|
return &ScaUserFollowsFilter{config: m.config, predicateAdder: m}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsFilter provides a generic filtering capability at runtime for ScaUserFollowsQuery.
|
||||||
|
type ScaUserFollowsFilter struct {
|
||||||
|
predicateAdder
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where applies the entql predicate on the query filter.
|
||||||
|
func (f *ScaUserFollowsFilter) Where(p entql.P) {
|
||||||
|
f.addPredicate(func(s *sql.Selector) {
|
||||||
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[8].Type, p, s); err != nil {
|
||||||
|
s.AddError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereID applies the entql int predicate on the id field.
|
||||||
|
func (f *ScaUserFollowsFilter) WhereID(p entql.IntP) {
|
||||||
|
f.Where(p.Field(scauserfollows.FieldID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereFollowerID applies the entql string predicate on the follower_id field.
|
||||||
|
func (f *ScaUserFollowsFilter) WhereFollowerID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scauserfollows.FieldFollowerID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereFolloweeID applies the entql string predicate on the followee_id field.
|
||||||
|
func (f *ScaUserFollowsFilter) WhereFolloweeID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scauserfollows.FieldFolloweeID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereStatus applies the entql uint8 predicate on the status field.
|
||||||
|
func (f *ScaUserFollowsFilter) WhereStatus(p entql.Uint8P) {
|
||||||
|
f.Where(p.Field(scauserfollows.FieldStatus))
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (sulq *ScaUserLevelQuery) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
sulq.predicates = append(sulq.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns a Filter implementation to apply filters on the ScaUserLevelQuery builder.
|
||||||
|
func (sulq *ScaUserLevelQuery) Filter() *ScaUserLevelFilter {
|
||||||
|
return &ScaUserLevelFilter{config: sulq.config, predicateAdder: sulq}
|
||||||
|
}
|
||||||
|
|
||||||
|
// addPredicate implements the predicateAdder interface.
|
||||||
|
func (m *ScaUserLevelMutation) addPredicate(pred func(s *sql.Selector)) {
|
||||||
|
m.predicates = append(m.predicates, pred)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter returns an entql.Where implementation to apply filters on the ScaUserLevelMutation builder.
|
||||||
|
func (m *ScaUserLevelMutation) Filter() *ScaUserLevelFilter {
|
||||||
|
return &ScaUserLevelFilter{config: m.config, predicateAdder: m}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevelFilter provides a generic filtering capability at runtime for ScaUserLevelQuery.
|
||||||
|
type ScaUserLevelFilter struct {
|
||||||
|
predicateAdder
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where applies the entql predicate on the query filter.
|
||||||
|
func (f *ScaUserLevelFilter) Where(p entql.P) {
|
||||||
|
f.addPredicate(func(s *sql.Selector) {
|
||||||
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[9].Type, p, s); err != nil {
|
||||||
|
s.AddError(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereID applies the entql int64 predicate on the id field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereID(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereUserID applies the entql string predicate on the user_id field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereUserID(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldUserID))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereLevelType applies the entql uint8 predicate on the level_type field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereLevelType(p entql.Uint8P) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldLevelType))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereLevel applies the entql int predicate on the level field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereLevel(p entql.IntP) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldLevel))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereLevelName applies the entql string predicate on the level_name field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereLevelName(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldLevelName))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereExpStart applies the entql int64 predicate on the exp_start field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereExpStart(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldExpStart))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereExpEnd applies the entql int64 predicate on the exp_end field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereExpEnd(p entql.Int64P) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldExpEnd))
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhereLevelDescription applies the entql string predicate on the level_description field.
|
||||||
|
func (f *ScaUserLevelFilter) WhereLevelDescription(p entql.StringP) {
|
||||||
|
f.Where(p.Field(scauserlevel.FieldLevelDescription))
|
||||||
|
}
|
||||||
|
|||||||
@@ -68,6 +68,66 @@ func (f ScaAuthUserSocialFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.
|
|||||||
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScaAuthUserSocialMutation", m)
|
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScaAuthUserSocialMutation", m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The ScaCommentLikesFunc type is an adapter to allow the use of ordinary
|
||||||
|
// function as ScaCommentLikes mutator.
|
||||||
|
type ScaCommentLikesFunc func(context.Context, *ent.ScaCommentLikesMutation) (ent.Value, error)
|
||||||
|
|
||||||
|
// Mutate calls f(ctx, m).
|
||||||
|
func (f ScaCommentLikesFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||||
|
if mv, ok := m.(*ent.ScaCommentLikesMutation); ok {
|
||||||
|
return f(ctx, mv)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScaCommentLikesMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaCommentMessageFunc type is an adapter to allow the use of ordinary
|
||||||
|
// function as ScaCommentMessage mutator.
|
||||||
|
type ScaCommentMessageFunc func(context.Context, *ent.ScaCommentMessageMutation) (ent.Value, error)
|
||||||
|
|
||||||
|
// Mutate calls f(ctx, m).
|
||||||
|
func (f ScaCommentMessageFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||||
|
if mv, ok := m.(*ent.ScaCommentMessageMutation); ok {
|
||||||
|
return f(ctx, mv)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScaCommentMessageMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaCommentReplyFunc type is an adapter to allow the use of ordinary
|
||||||
|
// function as ScaCommentReply mutator.
|
||||||
|
type ScaCommentReplyFunc func(context.Context, *ent.ScaCommentReplyMutation) (ent.Value, error)
|
||||||
|
|
||||||
|
// Mutate calls f(ctx, m).
|
||||||
|
func (f ScaCommentReplyFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||||
|
if mv, ok := m.(*ent.ScaCommentReplyMutation); ok {
|
||||||
|
return f(ctx, mv)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScaCommentReplyMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaUserFollowsFunc type is an adapter to allow the use of ordinary
|
||||||
|
// function as ScaUserFollows mutator.
|
||||||
|
type ScaUserFollowsFunc func(context.Context, *ent.ScaUserFollowsMutation) (ent.Value, error)
|
||||||
|
|
||||||
|
// Mutate calls f(ctx, m).
|
||||||
|
func (f ScaUserFollowsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||||
|
if mv, ok := m.(*ent.ScaUserFollowsMutation); ok {
|
||||||
|
return f(ctx, mv)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScaUserFollowsMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaUserLevelFunc type is an adapter to allow the use of ordinary
|
||||||
|
// function as ScaUserLevel mutator.
|
||||||
|
type ScaUserLevelFunc func(context.Context, *ent.ScaUserLevelMutation) (ent.Value, error)
|
||||||
|
|
||||||
|
// Mutate calls f(ctx, m).
|
||||||
|
func (f ScaUserLevelFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||||
|
if mv, ok := m.(*ent.ScaUserLevelMutation); ok {
|
||||||
|
return f(ctx, mv)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.ScaUserLevelMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
// Condition is a hook condition function.
|
// Condition is a hook condition function.
|
||||||
type Condition func(context.Context, ent.Mutation) bool
|
type Condition func(context.Context, ent.Mutation) bool
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,121 @@ var (
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
// ScaCommentLikesColumns holds the columns for the "sca_comment_likes" table.
|
||||||
|
ScaCommentLikesColumns = []*schema.Column{
|
||||||
|
{Name: "id", Type: field.TypeInt64, Increment: true, Comment: "主键id"},
|
||||||
|
{Name: "topic_id", Type: field.TypeString, Comment: "话题ID"},
|
||||||
|
{Name: "user_id", Type: field.TypeString, Comment: "用户ID"},
|
||||||
|
{Name: "comment_id", Type: field.TypeInt64, Comment: "评论ID"},
|
||||||
|
{Name: "like_time", Type: field.TypeTime, Comment: "点赞时间"},
|
||||||
|
}
|
||||||
|
// ScaCommentLikesTable holds the schema information for the "sca_comment_likes" table.
|
||||||
|
ScaCommentLikesTable = &schema.Table{
|
||||||
|
Name: "sca_comment_likes",
|
||||||
|
Comment: "评论点赞表",
|
||||||
|
Columns: ScaCommentLikesColumns,
|
||||||
|
PrimaryKey: []*schema.Column{ScaCommentLikesColumns[0]},
|
||||||
|
Indexes: []*schema.Index{
|
||||||
|
{
|
||||||
|
Name: "scacommentlikes_user_id",
|
||||||
|
Unique: false,
|
||||||
|
Columns: []*schema.Column{ScaCommentLikesColumns[2]},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "scacommentlikes_comment_id",
|
||||||
|
Unique: false,
|
||||||
|
Columns: []*schema.Column{ScaCommentLikesColumns[3]},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
// ScaCommentMessageColumns holds the columns for the "sca_comment_message" table.
|
||||||
|
ScaCommentMessageColumns = []*schema.Column{
|
||||||
|
{Name: "id", Type: field.TypeInt64, Increment: true, Comment: "主键"},
|
||||||
|
{Name: "created_at", Type: field.TypeTime, Comment: "创建时间"},
|
||||||
|
{Name: "updated_at", Type: field.TypeTime, Nullable: true, Comment: "更新时间"},
|
||||||
|
{Name: "deleted", Type: field.TypeInt8, Comment: "是否删除 0 未删除 1 已删除", Default: 0},
|
||||||
|
{Name: "topic_id", Type: field.TypeString, Comment: "话题Id"},
|
||||||
|
{Name: "from_id", Type: field.TypeString, Comment: "来自人"},
|
||||||
|
{Name: "to_id", Type: field.TypeString, Comment: "送达人"},
|
||||||
|
{Name: "content", Type: field.TypeString, Comment: "消息内容"},
|
||||||
|
{Name: "is_read", Type: field.TypeInt, Nullable: true, Comment: "是否已读"},
|
||||||
|
}
|
||||||
|
// ScaCommentMessageTable holds the schema information for the "sca_comment_message" table.
|
||||||
|
ScaCommentMessageTable = &schema.Table{
|
||||||
|
Name: "sca_comment_message",
|
||||||
|
Comment: "评论消息表",
|
||||||
|
Columns: ScaCommentMessageColumns,
|
||||||
|
PrimaryKey: []*schema.Column{ScaCommentMessageColumns[0]},
|
||||||
|
}
|
||||||
|
// ScaCommentReplyColumns holds the columns for the "sca_comment_reply" table.
|
||||||
|
ScaCommentReplyColumns = []*schema.Column{
|
||||||
|
{Name: "id", Type: field.TypeInt64, Increment: true, Comment: "主键id", SchemaType: map[string]string{"mysql": "bigint(20)"}},
|
||||||
|
{Name: "created_at", Type: field.TypeTime, Comment: "创建时间"},
|
||||||
|
{Name: "updated_at", Type: field.TypeTime, Nullable: true, Comment: "更新时间"},
|
||||||
|
{Name: "deleted", Type: field.TypeInt8, Comment: "是否删除 0 未删除 1 已删除", Default: 0},
|
||||||
|
{Name: "user_id", Type: field.TypeString, Comment: "评论用户id"},
|
||||||
|
{Name: "topic_id", Type: field.TypeString, Comment: "评论话题id"},
|
||||||
|
{Name: "topic_type", Type: field.TypeInt, Comment: "话题类型"},
|
||||||
|
{Name: "content", Type: field.TypeString, Comment: "评论内容"},
|
||||||
|
{Name: "comment_type", Type: field.TypeInt, Comment: "评论类型 0评论 1 回复"},
|
||||||
|
{Name: "reply_to", Type: field.TypeInt64, Nullable: true, Comment: "回复子评论ID", SchemaType: map[string]string{"mysql": "bigint(20)"}},
|
||||||
|
{Name: "reply_id", Type: field.TypeInt64, Nullable: true, Comment: "回复父评论Id", SchemaType: map[string]string{"mysql": "bigint(20)"}},
|
||||||
|
{Name: "reply_user", Type: field.TypeString, Nullable: true, Comment: "回复人id"},
|
||||||
|
{Name: "author", Type: field.TypeInt, Comment: "评论回复是否作者 0否 1是", Default: 0},
|
||||||
|
{Name: "likes", Type: field.TypeInt64, Nullable: true, Comment: "点赞数", Default: 0, SchemaType: map[string]string{"mysql": "bigint(20)"}},
|
||||||
|
{Name: "reply_count", Type: field.TypeInt64, Nullable: true, Comment: "回复数量", Default: 0, SchemaType: map[string]string{"mysql": "bigint(20)"}},
|
||||||
|
{Name: "browser", Type: field.TypeString, Comment: "浏览器"},
|
||||||
|
{Name: "operating_system", Type: field.TypeString, Comment: "操作系统"},
|
||||||
|
{Name: "comment_ip", Type: field.TypeString, Comment: "IP地址"},
|
||||||
|
{Name: "location", Type: field.TypeString, Comment: "地址"},
|
||||||
|
{Name: "agent", Type: field.TypeString, Size: 255, Comment: "设备信息"},
|
||||||
|
}
|
||||||
|
// ScaCommentReplyTable holds the schema information for the "sca_comment_reply" table.
|
||||||
|
ScaCommentReplyTable = &schema.Table{
|
||||||
|
Name: "sca_comment_reply",
|
||||||
|
Comment: "评论回复表",
|
||||||
|
Columns: ScaCommentReplyColumns,
|
||||||
|
PrimaryKey: []*schema.Column{ScaCommentReplyColumns[0]},
|
||||||
|
Indexes: []*schema.Index{
|
||||||
|
{
|
||||||
|
Name: "scacommentreply_id",
|
||||||
|
Unique: true,
|
||||||
|
Columns: []*schema.Column{ScaCommentReplyColumns[0]},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
// ScaUserFollowsColumns holds the columns for the "sca_user_follows" table.
|
||||||
|
ScaUserFollowsColumns = []*schema.Column{
|
||||||
|
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||||
|
{Name: "follower_id", Type: field.TypeString, Comment: "关注者"},
|
||||||
|
{Name: "followee_id", Type: field.TypeString, Comment: "被关注者"},
|
||||||
|
{Name: "status", Type: field.TypeUint8, Comment: "关注状态(0 未互关 1 互关)", Default: 0},
|
||||||
|
}
|
||||||
|
// ScaUserFollowsTable holds the schema information for the "sca_user_follows" table.
|
||||||
|
ScaUserFollowsTable = &schema.Table{
|
||||||
|
Name: "sca_user_follows",
|
||||||
|
Comment: "用户关注表",
|
||||||
|
Columns: ScaUserFollowsColumns,
|
||||||
|
PrimaryKey: []*schema.Column{ScaUserFollowsColumns[0]},
|
||||||
|
}
|
||||||
|
// ScaUserLevelColumns holds the columns for the "sca_user_level" table.
|
||||||
|
ScaUserLevelColumns = []*schema.Column{
|
||||||
|
{Name: "id", Type: field.TypeInt64, Increment: true, Comment: "主键"},
|
||||||
|
{Name: "user_id", Type: field.TypeString, Comment: "用户Id"},
|
||||||
|
{Name: "level_type", Type: field.TypeUint8, Comment: "等级类型"},
|
||||||
|
{Name: "level", Type: field.TypeInt, Comment: "等级"},
|
||||||
|
{Name: "level_name", Type: field.TypeString, Size: 50, Comment: "等级名称"},
|
||||||
|
{Name: "exp_start", Type: field.TypeInt64, Comment: "开始经验值"},
|
||||||
|
{Name: "exp_end", Type: field.TypeInt64, Comment: "结束经验值"},
|
||||||
|
{Name: "level_description", Type: field.TypeString, Nullable: true, Size: 2147483647, Comment: "等级描述"},
|
||||||
|
}
|
||||||
|
// ScaUserLevelTable holds the schema information for the "sca_user_level" table.
|
||||||
|
ScaUserLevelTable = &schema.Table{
|
||||||
|
Name: "sca_user_level",
|
||||||
|
Comment: "用户等级表",
|
||||||
|
Columns: ScaUserLevelColumns,
|
||||||
|
PrimaryKey: []*schema.Column{ScaUserLevelColumns[0]},
|
||||||
|
}
|
||||||
// Tables holds all the tables in the schema.
|
// Tables holds all the tables in the schema.
|
||||||
Tables = []*schema.Table{
|
Tables = []*schema.Table{
|
||||||
ScaAuthPermissionRuleTable,
|
ScaAuthPermissionRuleTable,
|
||||||
@@ -163,6 +278,11 @@ var (
|
|||||||
ScaAuthUserTable,
|
ScaAuthUserTable,
|
||||||
ScaAuthUserDeviceTable,
|
ScaAuthUserDeviceTable,
|
||||||
ScaAuthUserSocialTable,
|
ScaAuthUserSocialTable,
|
||||||
|
ScaCommentLikesTable,
|
||||||
|
ScaCommentMessageTable,
|
||||||
|
ScaCommentReplyTable,
|
||||||
|
ScaUserFollowsTable,
|
||||||
|
ScaUserLevelTable,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -182,4 +302,19 @@ func init() {
|
|||||||
ScaAuthUserSocialTable.Annotation = &entsql.Annotation{
|
ScaAuthUserSocialTable.Annotation = &entsql.Annotation{
|
||||||
Table: "sca_auth_user_social",
|
Table: "sca_auth_user_social",
|
||||||
}
|
}
|
||||||
|
ScaCommentLikesTable.Annotation = &entsql.Annotation{
|
||||||
|
Table: "sca_comment_likes",
|
||||||
|
}
|
||||||
|
ScaCommentMessageTable.Annotation = &entsql.Annotation{
|
||||||
|
Table: "sca_comment_message",
|
||||||
|
}
|
||||||
|
ScaCommentReplyTable.Annotation = &entsql.Annotation{
|
||||||
|
Table: "sca_comment_reply",
|
||||||
|
}
|
||||||
|
ScaUserFollowsTable.Annotation = &entsql.Annotation{
|
||||||
|
Table: "sca_user_follows",
|
||||||
|
}
|
||||||
|
ScaUserLevelTable.Annotation = &entsql.Annotation{
|
||||||
|
Table: "sca_user_level",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -20,3 +20,18 @@ type ScaAuthUserDevice func(*sql.Selector)
|
|||||||
|
|
||||||
// ScaAuthUserSocial is the predicate function for scaauthusersocial builders.
|
// ScaAuthUserSocial is the predicate function for scaauthusersocial builders.
|
||||||
type ScaAuthUserSocial func(*sql.Selector)
|
type ScaAuthUserSocial func(*sql.Selector)
|
||||||
|
|
||||||
|
// ScaCommentLikes is the predicate function for scacommentlikes builders.
|
||||||
|
type ScaCommentLikes func(*sql.Selector)
|
||||||
|
|
||||||
|
// ScaCommentMessage is the predicate function for scacommentmessage builders.
|
||||||
|
type ScaCommentMessage func(*sql.Selector)
|
||||||
|
|
||||||
|
// ScaCommentReply is the predicate function for scacommentreply builders.
|
||||||
|
type ScaCommentReply func(*sql.Selector)
|
||||||
|
|
||||||
|
// ScaUserFollows is the predicate function for scauserfollows builders.
|
||||||
|
type ScaUserFollows func(*sql.Selector)
|
||||||
|
|
||||||
|
// ScaUserLevel is the predicate function for scauserlevel builders.
|
||||||
|
type ScaUserLevel func(*sql.Selector)
|
||||||
|
|||||||
@@ -231,6 +231,126 @@ func (f ScaAuthUserSocialMutationRuleFunc) EvalMutation(ctx context.Context, m e
|
|||||||
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaAuthUserSocialMutation", m)
|
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaAuthUserSocialMutation", m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The ScaCommentLikesQueryRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a query rule.
|
||||||
|
type ScaCommentLikesQueryRuleFunc func(context.Context, *ent.ScaCommentLikesQuery) error
|
||||||
|
|
||||||
|
// EvalQuery return f(ctx, q).
|
||||||
|
func (f ScaCommentLikesQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
|
||||||
|
if q, ok := q.(*ent.ScaCommentLikesQuery); ok {
|
||||||
|
return f(ctx, q)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaCommentLikesQuery", q)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaCommentLikesMutationRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a mutation rule.
|
||||||
|
type ScaCommentLikesMutationRuleFunc func(context.Context, *ent.ScaCommentLikesMutation) error
|
||||||
|
|
||||||
|
// EvalMutation calls f(ctx, m).
|
||||||
|
func (f ScaCommentLikesMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
|
||||||
|
if m, ok := m.(*ent.ScaCommentLikesMutation); ok {
|
||||||
|
return f(ctx, m)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaCommentLikesMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaCommentMessageQueryRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a query rule.
|
||||||
|
type ScaCommentMessageQueryRuleFunc func(context.Context, *ent.ScaCommentMessageQuery) error
|
||||||
|
|
||||||
|
// EvalQuery return f(ctx, q).
|
||||||
|
func (f ScaCommentMessageQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
|
||||||
|
if q, ok := q.(*ent.ScaCommentMessageQuery); ok {
|
||||||
|
return f(ctx, q)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaCommentMessageQuery", q)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaCommentMessageMutationRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a mutation rule.
|
||||||
|
type ScaCommentMessageMutationRuleFunc func(context.Context, *ent.ScaCommentMessageMutation) error
|
||||||
|
|
||||||
|
// EvalMutation calls f(ctx, m).
|
||||||
|
func (f ScaCommentMessageMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
|
||||||
|
if m, ok := m.(*ent.ScaCommentMessageMutation); ok {
|
||||||
|
return f(ctx, m)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaCommentMessageMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaCommentReplyQueryRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a query rule.
|
||||||
|
type ScaCommentReplyQueryRuleFunc func(context.Context, *ent.ScaCommentReplyQuery) error
|
||||||
|
|
||||||
|
// EvalQuery return f(ctx, q).
|
||||||
|
func (f ScaCommentReplyQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
|
||||||
|
if q, ok := q.(*ent.ScaCommentReplyQuery); ok {
|
||||||
|
return f(ctx, q)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaCommentReplyQuery", q)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaCommentReplyMutationRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a mutation rule.
|
||||||
|
type ScaCommentReplyMutationRuleFunc func(context.Context, *ent.ScaCommentReplyMutation) error
|
||||||
|
|
||||||
|
// EvalMutation calls f(ctx, m).
|
||||||
|
func (f ScaCommentReplyMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
|
||||||
|
if m, ok := m.(*ent.ScaCommentReplyMutation); ok {
|
||||||
|
return f(ctx, m)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaCommentReplyMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaUserFollowsQueryRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a query rule.
|
||||||
|
type ScaUserFollowsQueryRuleFunc func(context.Context, *ent.ScaUserFollowsQuery) error
|
||||||
|
|
||||||
|
// EvalQuery return f(ctx, q).
|
||||||
|
func (f ScaUserFollowsQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
|
||||||
|
if q, ok := q.(*ent.ScaUserFollowsQuery); ok {
|
||||||
|
return f(ctx, q)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaUserFollowsQuery", q)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaUserFollowsMutationRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a mutation rule.
|
||||||
|
type ScaUserFollowsMutationRuleFunc func(context.Context, *ent.ScaUserFollowsMutation) error
|
||||||
|
|
||||||
|
// EvalMutation calls f(ctx, m).
|
||||||
|
func (f ScaUserFollowsMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
|
||||||
|
if m, ok := m.(*ent.ScaUserFollowsMutation); ok {
|
||||||
|
return f(ctx, m)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaUserFollowsMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaUserLevelQueryRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a query rule.
|
||||||
|
type ScaUserLevelQueryRuleFunc func(context.Context, *ent.ScaUserLevelQuery) error
|
||||||
|
|
||||||
|
// EvalQuery return f(ctx, q).
|
||||||
|
func (f ScaUserLevelQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
|
||||||
|
if q, ok := q.(*ent.ScaUserLevelQuery); ok {
|
||||||
|
return f(ctx, q)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaUserLevelQuery", q)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The ScaUserLevelMutationRuleFunc type is an adapter to allow the use of ordinary
|
||||||
|
// functions as a mutation rule.
|
||||||
|
type ScaUserLevelMutationRuleFunc func(context.Context, *ent.ScaUserLevelMutation) error
|
||||||
|
|
||||||
|
// EvalMutation calls f(ctx, m).
|
||||||
|
func (f ScaUserLevelMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
|
||||||
|
if m, ok := m.(*ent.ScaUserLevelMutation); ok {
|
||||||
|
return f(ctx, m)
|
||||||
|
}
|
||||||
|
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaUserLevelMutation", m)
|
||||||
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// Filter is the interface that wraps the Where function
|
// Filter is the interface that wraps the Where function
|
||||||
// for filtering nodes in queries and mutations.
|
// for filtering nodes in queries and mutations.
|
||||||
@@ -276,6 +396,16 @@ func queryFilter(q ent.Query) (Filter, error) {
|
|||||||
return q.Filter(), nil
|
return q.Filter(), nil
|
||||||
case *ent.ScaAuthUserSocialQuery:
|
case *ent.ScaAuthUserSocialQuery:
|
||||||
return q.Filter(), nil
|
return q.Filter(), nil
|
||||||
|
case *ent.ScaCommentLikesQuery:
|
||||||
|
return q.Filter(), nil
|
||||||
|
case *ent.ScaCommentMessageQuery:
|
||||||
|
return q.Filter(), nil
|
||||||
|
case *ent.ScaCommentReplyQuery:
|
||||||
|
return q.Filter(), nil
|
||||||
|
case *ent.ScaUserFollowsQuery:
|
||||||
|
return q.Filter(), nil
|
||||||
|
case *ent.ScaUserLevelQuery:
|
||||||
|
return q.Filter(), nil
|
||||||
default:
|
default:
|
||||||
return nil, Denyf("ent/privacy: unexpected query type %T for query filter", q)
|
return nil, Denyf("ent/privacy: unexpected query type %T for query filter", q)
|
||||||
}
|
}
|
||||||
@@ -293,6 +423,16 @@ func mutationFilter(m ent.Mutation) (Filter, error) {
|
|||||||
return m.Filter(), nil
|
return m.Filter(), nil
|
||||||
case *ent.ScaAuthUserSocialMutation:
|
case *ent.ScaAuthUserSocialMutation:
|
||||||
return m.Filter(), nil
|
return m.Filter(), nil
|
||||||
|
case *ent.ScaCommentLikesMutation:
|
||||||
|
return m.Filter(), nil
|
||||||
|
case *ent.ScaCommentMessageMutation:
|
||||||
|
return m.Filter(), nil
|
||||||
|
case *ent.ScaCommentReplyMutation:
|
||||||
|
return m.Filter(), nil
|
||||||
|
case *ent.ScaUserFollowsMutation:
|
||||||
|
return m.Filter(), nil
|
||||||
|
case *ent.ScaUserLevelMutation:
|
||||||
|
return m.Filter(), nil
|
||||||
default:
|
default:
|
||||||
return nil, Denyf("ent/privacy: unexpected mutation type %T for mutation filter", m)
|
return nil, Denyf("ent/privacy: unexpected mutation type %T for mutation filter", m)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ import (
|
|||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuser"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthuserdevice"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scaauthusersocial"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -234,4 +239,76 @@ func init() {
|
|||||||
scaauthusersocialDescStatus := scaauthusersocialFields[4].Descriptor()
|
scaauthusersocialDescStatus := scaauthusersocialFields[4].Descriptor()
|
||||||
// scaauthusersocial.DefaultStatus holds the default value on creation for the status field.
|
// scaauthusersocial.DefaultStatus holds the default value on creation for the status field.
|
||||||
scaauthusersocial.DefaultStatus = scaauthusersocialDescStatus.Default.(int)
|
scaauthusersocial.DefaultStatus = scaauthusersocialDescStatus.Default.(int)
|
||||||
|
scacommentlikesFields := model.ScaCommentLikes{}.Fields()
|
||||||
|
_ = scacommentlikesFields
|
||||||
|
// scacommentlikesDescLikeTime is the schema descriptor for like_time field.
|
||||||
|
scacommentlikesDescLikeTime := scacommentlikesFields[4].Descriptor()
|
||||||
|
// scacommentlikes.DefaultLikeTime holds the default value on creation for the like_time field.
|
||||||
|
scacommentlikes.DefaultLikeTime = scacommentlikesDescLikeTime.Default.(func() time.Time)
|
||||||
|
scacommentmessageMixin := model.ScaCommentMessage{}.Mixin()
|
||||||
|
scacommentmessageMixinFields0 := scacommentmessageMixin[0].Fields()
|
||||||
|
_ = scacommentmessageMixinFields0
|
||||||
|
scacommentmessageFields := model.ScaCommentMessage{}.Fields()
|
||||||
|
_ = scacommentmessageFields
|
||||||
|
// scacommentmessageDescCreatedAt is the schema descriptor for created_at field.
|
||||||
|
scacommentmessageDescCreatedAt := scacommentmessageMixinFields0[0].Descriptor()
|
||||||
|
// scacommentmessage.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||||
|
scacommentmessage.DefaultCreatedAt = scacommentmessageDescCreatedAt.Default.(func() time.Time)
|
||||||
|
// scacommentmessageDescUpdatedAt is the schema descriptor for updated_at field.
|
||||||
|
scacommentmessageDescUpdatedAt := scacommentmessageMixinFields0[1].Descriptor()
|
||||||
|
// scacommentmessage.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
||||||
|
scacommentmessage.UpdateDefaultUpdatedAt = scacommentmessageDescUpdatedAt.UpdateDefault.(func() time.Time)
|
||||||
|
// scacommentmessageDescDeleted is the schema descriptor for deleted field.
|
||||||
|
scacommentmessageDescDeleted := scacommentmessageMixinFields0[2].Descriptor()
|
||||||
|
// scacommentmessage.DefaultDeleted holds the default value on creation for the deleted field.
|
||||||
|
scacommentmessage.DefaultDeleted = scacommentmessageDescDeleted.Default.(int8)
|
||||||
|
// scacommentmessage.DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
|
||||||
|
scacommentmessage.DeletedValidator = scacommentmessageDescDeleted.Validators[0].(func(int8) error)
|
||||||
|
scacommentreplyMixin := model.ScaCommentReply{}.Mixin()
|
||||||
|
scacommentreplyMixinFields0 := scacommentreplyMixin[0].Fields()
|
||||||
|
_ = scacommentreplyMixinFields0
|
||||||
|
scacommentreplyFields := model.ScaCommentReply{}.Fields()
|
||||||
|
_ = scacommentreplyFields
|
||||||
|
// scacommentreplyDescCreatedAt is the schema descriptor for created_at field.
|
||||||
|
scacommentreplyDescCreatedAt := scacommentreplyMixinFields0[0].Descriptor()
|
||||||
|
// scacommentreply.DefaultCreatedAt holds the default value on creation for the created_at field.
|
||||||
|
scacommentreply.DefaultCreatedAt = scacommentreplyDescCreatedAt.Default.(func() time.Time)
|
||||||
|
// scacommentreplyDescUpdatedAt is the schema descriptor for updated_at field.
|
||||||
|
scacommentreplyDescUpdatedAt := scacommentreplyMixinFields0[1].Descriptor()
|
||||||
|
// scacommentreply.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
|
||||||
|
scacommentreply.UpdateDefaultUpdatedAt = scacommentreplyDescUpdatedAt.UpdateDefault.(func() time.Time)
|
||||||
|
// scacommentreplyDescDeleted is the schema descriptor for deleted field.
|
||||||
|
scacommentreplyDescDeleted := scacommentreplyMixinFields0[2].Descriptor()
|
||||||
|
// scacommentreply.DefaultDeleted holds the default value on creation for the deleted field.
|
||||||
|
scacommentreply.DefaultDeleted = scacommentreplyDescDeleted.Default.(int8)
|
||||||
|
// scacommentreply.DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
|
||||||
|
scacommentreply.DeletedValidator = scacommentreplyDescDeleted.Validators[0].(func(int8) error)
|
||||||
|
// scacommentreplyDescAuthor is the schema descriptor for author field.
|
||||||
|
scacommentreplyDescAuthor := scacommentreplyFields[9].Descriptor()
|
||||||
|
// scacommentreply.DefaultAuthor holds the default value on creation for the author field.
|
||||||
|
scacommentreply.DefaultAuthor = scacommentreplyDescAuthor.Default.(int)
|
||||||
|
// scacommentreplyDescLikes is the schema descriptor for likes field.
|
||||||
|
scacommentreplyDescLikes := scacommentreplyFields[10].Descriptor()
|
||||||
|
// scacommentreply.DefaultLikes holds the default value on creation for the likes field.
|
||||||
|
scacommentreply.DefaultLikes = scacommentreplyDescLikes.Default.(int64)
|
||||||
|
// scacommentreplyDescReplyCount is the schema descriptor for reply_count field.
|
||||||
|
scacommentreplyDescReplyCount := scacommentreplyFields[11].Descriptor()
|
||||||
|
// scacommentreply.DefaultReplyCount holds the default value on creation for the reply_count field.
|
||||||
|
scacommentreply.DefaultReplyCount = scacommentreplyDescReplyCount.Default.(int64)
|
||||||
|
// scacommentreplyDescAgent is the schema descriptor for agent field.
|
||||||
|
scacommentreplyDescAgent := scacommentreplyFields[16].Descriptor()
|
||||||
|
// scacommentreply.AgentValidator is a validator for the "agent" field. It is called by the builders before save.
|
||||||
|
scacommentreply.AgentValidator = scacommentreplyDescAgent.Validators[0].(func(string) error)
|
||||||
|
scauserfollowsFields := model.ScaUserFollows{}.Fields()
|
||||||
|
_ = scauserfollowsFields
|
||||||
|
// scauserfollowsDescStatus is the schema descriptor for status field.
|
||||||
|
scauserfollowsDescStatus := scauserfollowsFields[2].Descriptor()
|
||||||
|
// scauserfollows.DefaultStatus holds the default value on creation for the status field.
|
||||||
|
scauserfollows.DefaultStatus = scauserfollowsDescStatus.Default.(uint8)
|
||||||
|
scauserlevelFields := model.ScaUserLevel{}.Fields()
|
||||||
|
_ = scauserlevelFields
|
||||||
|
// scauserlevelDescLevelName is the schema descriptor for level_name field.
|
||||||
|
scauserlevelDescLevelName := scauserlevelFields[4].Descriptor()
|
||||||
|
// scauserlevel.LevelNameValidator is a validator for the "level_name" field. It is called by the builders before save.
|
||||||
|
scauserlevel.LevelNameValidator = scauserlevelDescLevelName.Validators[0].(func(string) error)
|
||||||
}
|
}
|
||||||
|
|||||||
140
app/core/api/repository/mysql/ent/scacommentlikes.go
Normal file
140
app/core/api/repository/mysql/ent/scacommentlikes.go
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 评论点赞表
|
||||||
|
type ScaCommentLikes struct {
|
||||||
|
config `json:"-"`
|
||||||
|
// ID of the ent.
|
||||||
|
// 主键id
|
||||||
|
ID int64 `json:"id,omitempty"`
|
||||||
|
// 话题ID
|
||||||
|
TopicID string `json:"topic_id,omitempty"`
|
||||||
|
// 用户ID
|
||||||
|
UserID string `json:"user_id,omitempty"`
|
||||||
|
// 评论ID
|
||||||
|
CommentID int64 `json:"comment_id,omitempty"`
|
||||||
|
// 点赞时间
|
||||||
|
LikeTime time.Time `json:"like_time,omitempty"`
|
||||||
|
selectValues sql.SelectValues
|
||||||
|
}
|
||||||
|
|
||||||
|
// scanValues returns the types for scanning values from sql.Rows.
|
||||||
|
func (*ScaCommentLikes) scanValues(columns []string) ([]any, error) {
|
||||||
|
values := make([]any, len(columns))
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scacommentlikes.FieldID, scacommentlikes.FieldCommentID:
|
||||||
|
values[i] = new(sql.NullInt64)
|
||||||
|
case scacommentlikes.FieldTopicID, scacommentlikes.FieldUserID:
|
||||||
|
values[i] = new(sql.NullString)
|
||||||
|
case scacommentlikes.FieldLikeTime:
|
||||||
|
values[i] = new(sql.NullTime)
|
||||||
|
default:
|
||||||
|
values[i] = new(sql.UnknownType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||||
|
// to the ScaCommentLikes fields.
|
||||||
|
func (scl *ScaCommentLikes) assignValues(columns []string, values []any) error {
|
||||||
|
if m, n := len(values), len(columns); m < n {
|
||||||
|
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||||
|
}
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scacommentlikes.FieldID:
|
||||||
|
value, ok := values[i].(*sql.NullInt64)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field id", value)
|
||||||
|
}
|
||||||
|
scl.ID = int64(value.Int64)
|
||||||
|
case scacommentlikes.FieldTopicID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field topic_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scl.TopicID = value.String
|
||||||
|
}
|
||||||
|
case scacommentlikes.FieldUserID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field user_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scl.UserID = value.String
|
||||||
|
}
|
||||||
|
case scacommentlikes.FieldCommentID:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field comment_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scl.CommentID = value.Int64
|
||||||
|
}
|
||||||
|
case scacommentlikes.FieldLikeTime:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field like_time", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scl.LikeTime = value.Time
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
scl.selectValues.Set(columns[i], values[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value returns the ent.Value that was dynamically selected and assigned to the ScaCommentLikes.
|
||||||
|
// This includes values selected through modifiers, order, etc.
|
||||||
|
func (scl *ScaCommentLikes) Value(name string) (ent.Value, error) {
|
||||||
|
return scl.selectValues.Get(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns a builder for updating this ScaCommentLikes.
|
||||||
|
// Note that you need to call ScaCommentLikes.Unwrap() before calling this method if this ScaCommentLikes
|
||||||
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||||
|
func (scl *ScaCommentLikes) Update() *ScaCommentLikesUpdateOne {
|
||||||
|
return NewScaCommentLikesClient(scl.config).UpdateOne(scl)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap unwraps the ScaCommentLikes entity that was returned from a transaction after it was closed,
|
||||||
|
// so that all future queries will be executed through the driver which created the transaction.
|
||||||
|
func (scl *ScaCommentLikes) Unwrap() *ScaCommentLikes {
|
||||||
|
_tx, ok := scl.config.driver.(*txDriver)
|
||||||
|
if !ok {
|
||||||
|
panic("ent: ScaCommentLikes is not a transactional entity")
|
||||||
|
}
|
||||||
|
scl.config.driver = _tx.drv
|
||||||
|
return scl
|
||||||
|
}
|
||||||
|
|
||||||
|
// String implements the fmt.Stringer.
|
||||||
|
func (scl *ScaCommentLikes) String() string {
|
||||||
|
var builder strings.Builder
|
||||||
|
builder.WriteString("ScaCommentLikes(")
|
||||||
|
builder.WriteString(fmt.Sprintf("id=%v, ", scl.ID))
|
||||||
|
builder.WriteString("topic_id=")
|
||||||
|
builder.WriteString(scl.TopicID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("user_id=")
|
||||||
|
builder.WriteString(scl.UserID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("comment_id=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scl.CommentID))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("like_time=")
|
||||||
|
builder.WriteString(scl.LikeTime.Format(time.ANSIC))
|
||||||
|
builder.WriteByte(')')
|
||||||
|
return builder.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesSlice is a parsable slice of ScaCommentLikes.
|
||||||
|
type ScaCommentLikesSlice []*ScaCommentLikes
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scacommentlikes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Label holds the string label denoting the scacommentlikes type in the database.
|
||||||
|
Label = "sca_comment_likes"
|
||||||
|
// FieldID holds the string denoting the id field in the database.
|
||||||
|
FieldID = "id"
|
||||||
|
// FieldTopicID holds the string denoting the topic_id field in the database.
|
||||||
|
FieldTopicID = "topic_id"
|
||||||
|
// FieldUserID holds the string denoting the user_id field in the database.
|
||||||
|
FieldUserID = "user_id"
|
||||||
|
// FieldCommentID holds the string denoting the comment_id field in the database.
|
||||||
|
FieldCommentID = "comment_id"
|
||||||
|
// FieldLikeTime holds the string denoting the like_time field in the database.
|
||||||
|
FieldLikeTime = "like_time"
|
||||||
|
// Table holds the table name of the scacommentlikes in the database.
|
||||||
|
Table = "sca_comment_likes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Columns holds all SQL columns for scacommentlikes fields.
|
||||||
|
var Columns = []string{
|
||||||
|
FieldID,
|
||||||
|
FieldTopicID,
|
||||||
|
FieldUserID,
|
||||||
|
FieldCommentID,
|
||||||
|
FieldLikeTime,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
|
func ValidColumn(column string) bool {
|
||||||
|
for i := range Columns {
|
||||||
|
if column == Columns[i] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// DefaultLikeTime holds the default value on creation for the "like_time" field.
|
||||||
|
DefaultLikeTime func() time.Time
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderOption defines the ordering options for the ScaCommentLikes queries.
|
||||||
|
type OrderOption func(*sql.Selector)
|
||||||
|
|
||||||
|
// ByID orders the results by the id field.
|
||||||
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByTopicID orders the results by the topic_id field.
|
||||||
|
func ByTopicID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldTopicID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByUserID orders the results by the user_id field.
|
||||||
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByCommentID orders the results by the comment_id field.
|
||||||
|
func ByCommentID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCommentID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByLikeTime orders the results by the like_time field.
|
||||||
|
func ByLikeTime(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldLikeTime, opts...).ToFunc()
|
||||||
|
}
|
||||||
300
app/core/api/repository/mysql/ent/scacommentlikes/where.go
Normal file
300
app/core/api/repository/mysql/ent/scacommentlikes/where.go
Normal file
@@ -0,0 +1,300 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scacommentlikes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ID filters vertices based on their ID field.
|
||||||
|
func ID(id int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDEQ applies the EQ predicate on the ID field.
|
||||||
|
func IDEQ(id int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNEQ applies the NEQ predicate on the ID field.
|
||||||
|
func IDNEQ(id int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDIn applies the In predicate on the ID field.
|
||||||
|
func IDIn(ids ...int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNotIn applies the NotIn predicate on the ID field.
|
||||||
|
func IDNotIn(ids ...int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNotIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGT applies the GT predicate on the ID field.
|
||||||
|
func IDGT(id int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGTE applies the GTE predicate on the ID field.
|
||||||
|
func IDGTE(id int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLT applies the LT predicate on the ID field.
|
||||||
|
func IDLT(id int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLTE applies the LTE predicate on the ID field.
|
||||||
|
func IDLTE(id int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicID applies equality check predicate on the "topic_id" field. It's identical to TopicIDEQ.
|
||||||
|
func TopicID(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
||||||
|
func UserID(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentID applies equality check predicate on the "comment_id" field. It's identical to CommentIDEQ.
|
||||||
|
func CommentID(v int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldCommentID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTime applies equality check predicate on the "like_time" field. It's identical to LikeTimeEQ.
|
||||||
|
func LikeTime(v time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldLikeTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDEQ applies the EQ predicate on the "topic_id" field.
|
||||||
|
func TopicIDEQ(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDNEQ applies the NEQ predicate on the "topic_id" field.
|
||||||
|
func TopicIDNEQ(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNEQ(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDIn applies the In predicate on the "topic_id" field.
|
||||||
|
func TopicIDIn(vs ...string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldIn(FieldTopicID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDNotIn applies the NotIn predicate on the "topic_id" field.
|
||||||
|
func TopicIDNotIn(vs ...string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNotIn(FieldTopicID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDGT applies the GT predicate on the "topic_id" field.
|
||||||
|
func TopicIDGT(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGT(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDGTE applies the GTE predicate on the "topic_id" field.
|
||||||
|
func TopicIDGTE(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGTE(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDLT applies the LT predicate on the "topic_id" field.
|
||||||
|
func TopicIDLT(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLT(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDLTE applies the LTE predicate on the "topic_id" field.
|
||||||
|
func TopicIDLTE(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLTE(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDContains applies the Contains predicate on the "topic_id" field.
|
||||||
|
func TopicIDContains(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldContains(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDHasPrefix applies the HasPrefix predicate on the "topic_id" field.
|
||||||
|
func TopicIDHasPrefix(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldHasPrefix(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDHasSuffix applies the HasSuffix predicate on the "topic_id" field.
|
||||||
|
func TopicIDHasSuffix(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldHasSuffix(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDEqualFold applies the EqualFold predicate on the "topic_id" field.
|
||||||
|
func TopicIDEqualFold(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEqualFold(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDContainsFold applies the ContainsFold predicate on the "topic_id" field.
|
||||||
|
func TopicIDContainsFold(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldContainsFold(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
||||||
|
func UserIDEQ(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
|
||||||
|
func UserIDNEQ(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNEQ(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDIn applies the In predicate on the "user_id" field.
|
||||||
|
func UserIDIn(vs ...string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldIn(FieldUserID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
|
||||||
|
func UserIDNotIn(vs ...string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNotIn(FieldUserID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDGT applies the GT predicate on the "user_id" field.
|
||||||
|
func UserIDGT(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGT(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDGTE applies the GTE predicate on the "user_id" field.
|
||||||
|
func UserIDGTE(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGTE(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDLT applies the LT predicate on the "user_id" field.
|
||||||
|
func UserIDLT(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLT(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDLTE applies the LTE predicate on the "user_id" field.
|
||||||
|
func UserIDLTE(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLTE(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDContains applies the Contains predicate on the "user_id" field.
|
||||||
|
func UserIDContains(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldContains(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDHasPrefix applies the HasPrefix predicate on the "user_id" field.
|
||||||
|
func UserIDHasPrefix(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldHasPrefix(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDHasSuffix applies the HasSuffix predicate on the "user_id" field.
|
||||||
|
func UserIDHasSuffix(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldHasSuffix(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDEqualFold applies the EqualFold predicate on the "user_id" field.
|
||||||
|
func UserIDEqualFold(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEqualFold(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDContainsFold applies the ContainsFold predicate on the "user_id" field.
|
||||||
|
func UserIDContainsFold(v string) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldContainsFold(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDEQ applies the EQ predicate on the "comment_id" field.
|
||||||
|
func CommentIDEQ(v int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldCommentID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDNEQ applies the NEQ predicate on the "comment_id" field.
|
||||||
|
func CommentIDNEQ(v int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNEQ(FieldCommentID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDIn applies the In predicate on the "comment_id" field.
|
||||||
|
func CommentIDIn(vs ...int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldIn(FieldCommentID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDNotIn applies the NotIn predicate on the "comment_id" field.
|
||||||
|
func CommentIDNotIn(vs ...int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNotIn(FieldCommentID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDGT applies the GT predicate on the "comment_id" field.
|
||||||
|
func CommentIDGT(v int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGT(FieldCommentID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDGTE applies the GTE predicate on the "comment_id" field.
|
||||||
|
func CommentIDGTE(v int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGTE(FieldCommentID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDLT applies the LT predicate on the "comment_id" field.
|
||||||
|
func CommentIDLT(v int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLT(FieldCommentID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CommentIDLTE applies the LTE predicate on the "comment_id" field.
|
||||||
|
func CommentIDLTE(v int64) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLTE(FieldCommentID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeEQ applies the EQ predicate on the "like_time" field.
|
||||||
|
func LikeTimeEQ(v time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldEQ(FieldLikeTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeNEQ applies the NEQ predicate on the "like_time" field.
|
||||||
|
func LikeTimeNEQ(v time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNEQ(FieldLikeTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeIn applies the In predicate on the "like_time" field.
|
||||||
|
func LikeTimeIn(vs ...time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldIn(FieldLikeTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeNotIn applies the NotIn predicate on the "like_time" field.
|
||||||
|
func LikeTimeNotIn(vs ...time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldNotIn(FieldLikeTime, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeGT applies the GT predicate on the "like_time" field.
|
||||||
|
func LikeTimeGT(v time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGT(FieldLikeTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeGTE applies the GTE predicate on the "like_time" field.
|
||||||
|
func LikeTimeGTE(v time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldGTE(FieldLikeTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeLT applies the LT predicate on the "like_time" field.
|
||||||
|
func LikeTimeLT(v time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLT(FieldLikeTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LikeTimeLTE applies the LTE predicate on the "like_time" field.
|
||||||
|
func LikeTimeLTE(v time.Time) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.FieldLTE(FieldLikeTime, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// And groups predicates with the AND operator between them.
|
||||||
|
func And(predicates ...predicate.ScaCommentLikes) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.AndPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or groups predicates with the OR operator between them.
|
||||||
|
func Or(predicates ...predicate.ScaCommentLikes) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.OrPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not applies the not operator on the given predicate.
|
||||||
|
func Not(p predicate.ScaCommentLikes) predicate.ScaCommentLikes {
|
||||||
|
return predicate.ScaCommentLikes(sql.NotPredicates(p))
|
||||||
|
}
|
||||||
253
app/core/api/repository/mysql/ent/scacommentlikes_create.go
Normal file
253
app/core/api/repository/mysql/ent/scacommentlikes_create.go
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentLikesCreate is the builder for creating a ScaCommentLikes entity.
|
||||||
|
type ScaCommentLikesCreate struct {
|
||||||
|
config
|
||||||
|
mutation *ScaCommentLikesMutation
|
||||||
|
hooks []Hook
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicID sets the "topic_id" field.
|
||||||
|
func (sclc *ScaCommentLikesCreate) SetTopicID(s string) *ScaCommentLikesCreate {
|
||||||
|
sclc.mutation.SetTopicID(s)
|
||||||
|
return sclc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUserID sets the "user_id" field.
|
||||||
|
func (sclc *ScaCommentLikesCreate) SetUserID(s string) *ScaCommentLikesCreate {
|
||||||
|
sclc.mutation.SetUserID(s)
|
||||||
|
return sclc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCommentID sets the "comment_id" field.
|
||||||
|
func (sclc *ScaCommentLikesCreate) SetCommentID(i int64) *ScaCommentLikesCreate {
|
||||||
|
sclc.mutation.SetCommentID(i)
|
||||||
|
return sclc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLikeTime sets the "like_time" field.
|
||||||
|
func (sclc *ScaCommentLikesCreate) SetLikeTime(t time.Time) *ScaCommentLikesCreate {
|
||||||
|
sclc.mutation.SetLikeTime(t)
|
||||||
|
return sclc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLikeTime sets the "like_time" field if the given value is not nil.
|
||||||
|
func (sclc *ScaCommentLikesCreate) SetNillableLikeTime(t *time.Time) *ScaCommentLikesCreate {
|
||||||
|
if t != nil {
|
||||||
|
sclc.SetLikeTime(*t)
|
||||||
|
}
|
||||||
|
return sclc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID sets the "id" field.
|
||||||
|
func (sclc *ScaCommentLikesCreate) SetID(i int64) *ScaCommentLikesCreate {
|
||||||
|
sclc.mutation.SetID(i)
|
||||||
|
return sclc
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaCommentLikesMutation object of the builder.
|
||||||
|
func (sclc *ScaCommentLikesCreate) Mutation() *ScaCommentLikesMutation {
|
||||||
|
return sclc.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaCommentLikes in the database.
|
||||||
|
func (sclc *ScaCommentLikesCreate) Save(ctx context.Context) (*ScaCommentLikes, error) {
|
||||||
|
sclc.defaults()
|
||||||
|
return withHooks(ctx, sclc.sqlSave, sclc.mutation, sclc.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX calls Save and panics if Save returns an error.
|
||||||
|
func (sclc *ScaCommentLikesCreate) SaveX(ctx context.Context) *ScaCommentLikes {
|
||||||
|
v, err := sclc.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sclc *ScaCommentLikesCreate) Exec(ctx context.Context) error {
|
||||||
|
_, err := sclc.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sclc *ScaCommentLikesCreate) ExecX(ctx context.Context) {
|
||||||
|
if err := sclc.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaults sets the default values of the builder before save.
|
||||||
|
func (sclc *ScaCommentLikesCreate) defaults() {
|
||||||
|
if _, ok := sclc.mutation.LikeTime(); !ok {
|
||||||
|
v := scacommentlikes.DefaultLikeTime()
|
||||||
|
sclc.mutation.SetLikeTime(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (sclc *ScaCommentLikesCreate) check() error {
|
||||||
|
if _, ok := sclc.mutation.TopicID(); !ok {
|
||||||
|
return &ValidationError{Name: "topic_id", err: errors.New(`ent: missing required field "ScaCommentLikes.topic_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sclc.mutation.UserID(); !ok {
|
||||||
|
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "ScaCommentLikes.user_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sclc.mutation.CommentID(); !ok {
|
||||||
|
return &ValidationError{Name: "comment_id", err: errors.New(`ent: missing required field "ScaCommentLikes.comment_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sclc.mutation.LikeTime(); !ok {
|
||||||
|
return &ValidationError{Name: "like_time", err: errors.New(`ent: missing required field "ScaCommentLikes.like_time"`)}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclc *ScaCommentLikesCreate) sqlSave(ctx context.Context) (*ScaCommentLikes, error) {
|
||||||
|
if err := sclc.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_node, _spec := sclc.createSpec()
|
||||||
|
if err := sqlgraph.CreateNode(ctx, sclc.driver, _spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if _spec.ID.Value != _node.ID {
|
||||||
|
id := _spec.ID.Value.(int64)
|
||||||
|
_node.ID = int64(id)
|
||||||
|
}
|
||||||
|
sclc.mutation.id = &_node.ID
|
||||||
|
sclc.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclc *ScaCommentLikesCreate) createSpec() (*ScaCommentLikes, *sqlgraph.CreateSpec) {
|
||||||
|
var (
|
||||||
|
_node = &ScaCommentLikes{config: sclc.config}
|
||||||
|
_spec = sqlgraph.NewCreateSpec(scacommentlikes.Table, sqlgraph.NewFieldSpec(scacommentlikes.FieldID, field.TypeInt64))
|
||||||
|
)
|
||||||
|
if id, ok := sclc.mutation.ID(); ok {
|
||||||
|
_node.ID = id
|
||||||
|
_spec.ID.Value = id
|
||||||
|
}
|
||||||
|
if value, ok := sclc.mutation.TopicID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldTopicID, field.TypeString, value)
|
||||||
|
_node.TopicID = value
|
||||||
|
}
|
||||||
|
if value, ok := sclc.mutation.UserID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldUserID, field.TypeString, value)
|
||||||
|
_node.UserID = value
|
||||||
|
}
|
||||||
|
if value, ok := sclc.mutation.CommentID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldCommentID, field.TypeInt64, value)
|
||||||
|
_node.CommentID = value
|
||||||
|
}
|
||||||
|
if value, ok := sclc.mutation.LikeTime(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldLikeTime, field.TypeTime, value)
|
||||||
|
_node.LikeTime = value
|
||||||
|
}
|
||||||
|
return _node, _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesCreateBulk is the builder for creating many ScaCommentLikes entities in bulk.
|
||||||
|
type ScaCommentLikesCreateBulk struct {
|
||||||
|
config
|
||||||
|
err error
|
||||||
|
builders []*ScaCommentLikesCreate
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaCommentLikes entities in the database.
|
||||||
|
func (sclcb *ScaCommentLikesCreateBulk) Save(ctx context.Context) ([]*ScaCommentLikes, error) {
|
||||||
|
if sclcb.err != nil {
|
||||||
|
return nil, sclcb.err
|
||||||
|
}
|
||||||
|
specs := make([]*sqlgraph.CreateSpec, len(sclcb.builders))
|
||||||
|
nodes := make([]*ScaCommentLikes, len(sclcb.builders))
|
||||||
|
mutators := make([]Mutator, len(sclcb.builders))
|
||||||
|
for i := range sclcb.builders {
|
||||||
|
func(i int, root context.Context) {
|
||||||
|
builder := sclcb.builders[i]
|
||||||
|
builder.defaults()
|
||||||
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||||
|
mutation, ok := m.(*ScaCommentLikesMutation)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||||
|
}
|
||||||
|
if err := builder.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
builder.mutation = mutation
|
||||||
|
var err error
|
||||||
|
nodes[i], specs[i] = builder.createSpec()
|
||||||
|
if i < len(mutators)-1 {
|
||||||
|
_, err = mutators[i+1].Mutate(root, sclcb.builders[i+1].mutation)
|
||||||
|
} else {
|
||||||
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||||
|
// Invoke the actual operation on the latest mutation in the chain.
|
||||||
|
if err = sqlgraph.BatchCreate(ctx, sclcb.driver, spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
mutation.id = &nodes[i].ID
|
||||||
|
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||||
|
id := specs[i].ID.Value.(int64)
|
||||||
|
nodes[i].ID = int64(id)
|
||||||
|
}
|
||||||
|
mutation.done = true
|
||||||
|
return nodes[i], nil
|
||||||
|
})
|
||||||
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||||
|
mut = builder.hooks[i](mut)
|
||||||
|
}
|
||||||
|
mutators[i] = mut
|
||||||
|
}(i, ctx)
|
||||||
|
}
|
||||||
|
if len(mutators) > 0 {
|
||||||
|
if _, err := mutators[0].Mutate(ctx, sclcb.builders[0].mutation); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (sclcb *ScaCommentLikesCreateBulk) SaveX(ctx context.Context) []*ScaCommentLikes {
|
||||||
|
v, err := sclcb.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sclcb *ScaCommentLikesCreateBulk) Exec(ctx context.Context) error {
|
||||||
|
_, err := sclcb.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sclcb *ScaCommentLikesCreateBulk) ExecX(ctx context.Context) {
|
||||||
|
if err := sclcb.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
88
app/core/api/repository/mysql/ent/scacommentlikes_delete.go
Normal file
88
app/core/api/repository/mysql/ent/scacommentlikes_delete.go
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentLikesDelete is the builder for deleting a ScaCommentLikes entity.
|
||||||
|
type ScaCommentLikesDelete struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaCommentLikesMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentLikesDelete builder.
|
||||||
|
func (scld *ScaCommentLikesDelete) Where(ps ...predicate.ScaCommentLikes) *ScaCommentLikesDelete {
|
||||||
|
scld.mutation.Where(ps...)
|
||||||
|
return scld
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||||
|
func (scld *ScaCommentLikesDelete) Exec(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, scld.sqlExec, scld.mutation, scld.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scld *ScaCommentLikesDelete) ExecX(ctx context.Context) int {
|
||||||
|
n, err := scld.Exec(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scld *ScaCommentLikesDelete) sqlExec(ctx context.Context) (int, error) {
|
||||||
|
_spec := sqlgraph.NewDeleteSpec(scacommentlikes.Table, sqlgraph.NewFieldSpec(scacommentlikes.FieldID, field.TypeInt64))
|
||||||
|
if ps := scld.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
affected, err := sqlgraph.DeleteNodes(ctx, scld.driver, _spec)
|
||||||
|
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
scld.mutation.done = true
|
||||||
|
return affected, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesDeleteOne is the builder for deleting a single ScaCommentLikes entity.
|
||||||
|
type ScaCommentLikesDeleteOne struct {
|
||||||
|
scld *ScaCommentLikesDelete
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentLikesDelete builder.
|
||||||
|
func (scldo *ScaCommentLikesDeleteOne) Where(ps ...predicate.ScaCommentLikes) *ScaCommentLikesDeleteOne {
|
||||||
|
scldo.scld.mutation.Where(ps...)
|
||||||
|
return scldo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query.
|
||||||
|
func (scldo *ScaCommentLikesDeleteOne) Exec(ctx context.Context) error {
|
||||||
|
n, err := scldo.scld.Exec(ctx)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
|
case n == 0:
|
||||||
|
return &NotFoundError{scacommentlikes.Label}
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scldo *ScaCommentLikesDeleteOne) ExecX(ctx context.Context) {
|
||||||
|
if err := scldo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
527
app/core/api/repository/mysql/ent/scacommentlikes_query.go
Normal file
527
app/core/api/repository/mysql/ent/scacommentlikes_query.go
Normal file
@@ -0,0 +1,527 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentLikesQuery is the builder for querying ScaCommentLikes entities.
|
||||||
|
type ScaCommentLikesQuery struct {
|
||||||
|
config
|
||||||
|
ctx *QueryContext
|
||||||
|
order []scacommentlikes.OrderOption
|
||||||
|
inters []Interceptor
|
||||||
|
predicates []predicate.ScaCommentLikes
|
||||||
|
// intermediate query (i.e. traversal path).
|
||||||
|
sql *sql.Selector
|
||||||
|
path func(context.Context) (*sql.Selector, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where adds a new predicate for the ScaCommentLikesQuery builder.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Where(ps ...predicate.ScaCommentLikes) *ScaCommentLikesQuery {
|
||||||
|
sclq.predicates = append(sclq.predicates, ps...)
|
||||||
|
return sclq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit the number of records to be returned by this query.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Limit(limit int) *ScaCommentLikesQuery {
|
||||||
|
sclq.ctx.Limit = &limit
|
||||||
|
return sclq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset to start from.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Offset(offset int) *ScaCommentLikesQuery {
|
||||||
|
sclq.ctx.Offset = &offset
|
||||||
|
return sclq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unique configures the query builder to filter duplicate records on query.
|
||||||
|
// By default, unique is set to true, and can be disabled using this method.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Unique(unique bool) *ScaCommentLikesQuery {
|
||||||
|
sclq.ctx.Unique = &unique
|
||||||
|
return sclq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Order specifies how the records should be ordered.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Order(o ...scacommentlikes.OrderOption) *ScaCommentLikesQuery {
|
||||||
|
sclq.order = append(sclq.order, o...)
|
||||||
|
return sclq
|
||||||
|
}
|
||||||
|
|
||||||
|
// First returns the first ScaCommentLikes entity from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentLikes was found.
|
||||||
|
func (sclq *ScaCommentLikesQuery) First(ctx context.Context) (*ScaCommentLikes, error) {
|
||||||
|
nodes, err := sclq.Limit(1).All(setContextOp(ctx, sclq.ctx, ent.OpQueryFirst))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nil, &NotFoundError{scacommentlikes.Label}
|
||||||
|
}
|
||||||
|
return nodes[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstX is like First, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) FirstX(ctx context.Context) *ScaCommentLikes {
|
||||||
|
node, err := sclq.First(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstID returns the first ScaCommentLikes ID from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentLikes ID was found.
|
||||||
|
func (sclq *ScaCommentLikesQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = sclq.Limit(1).IDs(setContextOp(ctx, sclq.ctx, ent.OpQueryFirstID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(ids) == 0 {
|
||||||
|
err = &NotFoundError{scacommentlikes.Label}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return ids[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) FirstIDX(ctx context.Context) int64 {
|
||||||
|
id, err := sclq.FirstID(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only returns a single ScaCommentLikes entity found by the query, ensuring it only returns one.
|
||||||
|
// Returns a *NotSingularError when more than one ScaCommentLikes entity is found.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentLikes entities are found.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Only(ctx context.Context) (*ScaCommentLikes, error) {
|
||||||
|
nodes, err := sclq.Limit(2).All(setContextOp(ctx, sclq.ctx, ent.OpQueryOnly))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch len(nodes) {
|
||||||
|
case 1:
|
||||||
|
return nodes[0], nil
|
||||||
|
case 0:
|
||||||
|
return nil, &NotFoundError{scacommentlikes.Label}
|
||||||
|
default:
|
||||||
|
return nil, &NotSingularError{scacommentlikes.Label}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyX is like Only, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) OnlyX(ctx context.Context) *ScaCommentLikes {
|
||||||
|
node, err := sclq.Only(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyID is like Only, but returns the only ScaCommentLikes ID in the query.
|
||||||
|
// Returns a *NotSingularError when more than one ScaCommentLikes ID is found.
|
||||||
|
// Returns a *NotFoundError when no entities are found.
|
||||||
|
func (sclq *ScaCommentLikesQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = sclq.Limit(2).IDs(setContextOp(ctx, sclq.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch len(ids) {
|
||||||
|
case 1:
|
||||||
|
id = ids[0]
|
||||||
|
case 0:
|
||||||
|
err = &NotFoundError{scacommentlikes.Label}
|
||||||
|
default:
|
||||||
|
err = &NotSingularError{scacommentlikes.Label}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) OnlyIDX(ctx context.Context) int64 {
|
||||||
|
id, err := sclq.OnlyID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// All executes the query and returns a list of ScaCommentLikesSlice.
|
||||||
|
func (sclq *ScaCommentLikesQuery) All(ctx context.Context) ([]*ScaCommentLikes, error) {
|
||||||
|
ctx = setContextOp(ctx, sclq.ctx, ent.OpQueryAll)
|
||||||
|
if err := sclq.prepareQuery(ctx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
qr := querierAll[[]*ScaCommentLikes, *ScaCommentLikesQuery]()
|
||||||
|
return withInterceptors[[]*ScaCommentLikes](ctx, sclq, qr, sclq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllX is like All, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) AllX(ctx context.Context) []*ScaCommentLikes {
|
||||||
|
nodes, err := sclq.All(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDs executes the query and returns a list of ScaCommentLikes IDs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||||
|
if sclq.ctx.Unique == nil && sclq.path != nil {
|
||||||
|
sclq.Unique(true)
|
||||||
|
}
|
||||||
|
ctx = setContextOp(ctx, sclq.ctx, ent.OpQueryIDs)
|
||||||
|
if err = sclq.Select(scacommentlikes.FieldID).Scan(ctx, &ids); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ids, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDsX is like IDs, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) IDsX(ctx context.Context) []int64 {
|
||||||
|
ids, err := sclq.IDs(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the count of the given query.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Count(ctx context.Context) (int, error) {
|
||||||
|
ctx = setContextOp(ctx, sclq.ctx, ent.OpQueryCount)
|
||||||
|
if err := sclq.prepareQuery(ctx); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return withInterceptors[int](ctx, sclq, querierCount[*ScaCommentLikesQuery](), sclq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CountX is like Count, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) CountX(ctx context.Context) int {
|
||||||
|
count, err := sclq.Count(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exist returns true if the query has elements in the graph.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Exist(ctx context.Context) (bool, error) {
|
||||||
|
ctx = setContextOp(ctx, sclq.ctx, ent.OpQueryExist)
|
||||||
|
switch _, err := sclq.FirstID(ctx); {
|
||||||
|
case IsNotFound(err):
|
||||||
|
return false, nil
|
||||||
|
case err != nil:
|
||||||
|
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||||
|
default:
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExistX is like Exist, but panics if an error occurs.
|
||||||
|
func (sclq *ScaCommentLikesQuery) ExistX(ctx context.Context) bool {
|
||||||
|
exist, err := sclq.Exist(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return exist
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone returns a duplicate of the ScaCommentLikesQuery builder, including all associated steps. It can be
|
||||||
|
// used to prepare common query builders and use them differently after the clone is made.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Clone() *ScaCommentLikesQuery {
|
||||||
|
if sclq == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &ScaCommentLikesQuery{
|
||||||
|
config: sclq.config,
|
||||||
|
ctx: sclq.ctx.Clone(),
|
||||||
|
order: append([]scacommentlikes.OrderOption{}, sclq.order...),
|
||||||
|
inters: append([]Interceptor{}, sclq.inters...),
|
||||||
|
predicates: append([]predicate.ScaCommentLikes{}, sclq.predicates...),
|
||||||
|
// clone intermediate query.
|
||||||
|
sql: sclq.sql.Clone(),
|
||||||
|
path: sclq.path,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupBy is used to group vertices by one or more fields/columns.
|
||||||
|
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// TopicID string `json:"topic_id,omitempty"`
|
||||||
|
// Count int `json:"count,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaCommentLikes.Query().
|
||||||
|
// GroupBy(scacommentlikes.FieldTopicID).
|
||||||
|
// Aggregate(ent.Count()).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (sclq *ScaCommentLikesQuery) GroupBy(field string, fields ...string) *ScaCommentLikesGroupBy {
|
||||||
|
sclq.ctx.Fields = append([]string{field}, fields...)
|
||||||
|
grbuild := &ScaCommentLikesGroupBy{build: sclq}
|
||||||
|
grbuild.flds = &sclq.ctx.Fields
|
||||||
|
grbuild.label = scacommentlikes.Label
|
||||||
|
grbuild.scan = grbuild.Scan
|
||||||
|
return grbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows the selection one or more fields/columns for the given query,
|
||||||
|
// instead of selecting all fields in the entity.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// TopicID string `json:"topic_id,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaCommentLikes.Query().
|
||||||
|
// Select(scacommentlikes.FieldTopicID).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (sclq *ScaCommentLikesQuery) Select(fields ...string) *ScaCommentLikesSelect {
|
||||||
|
sclq.ctx.Fields = append(sclq.ctx.Fields, fields...)
|
||||||
|
sbuild := &ScaCommentLikesSelect{ScaCommentLikesQuery: sclq}
|
||||||
|
sbuild.label = scacommentlikes.Label
|
||||||
|
sbuild.flds, sbuild.scan = &sclq.ctx.Fields, sbuild.Scan
|
||||||
|
return sbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a ScaCommentLikesSelect configured with the given aggregations.
|
||||||
|
func (sclq *ScaCommentLikesQuery) Aggregate(fns ...AggregateFunc) *ScaCommentLikesSelect {
|
||||||
|
return sclq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclq *ScaCommentLikesQuery) prepareQuery(ctx context.Context) error {
|
||||||
|
for _, inter := range sclq.inters {
|
||||||
|
if inter == nil {
|
||||||
|
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||||
|
}
|
||||||
|
if trv, ok := inter.(Traverser); ok {
|
||||||
|
if err := trv.Traverse(ctx, sclq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, f := range sclq.ctx.Fields {
|
||||||
|
if !scacommentlikes.ValidColumn(f) {
|
||||||
|
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sclq.path != nil {
|
||||||
|
prev, err := sclq.path(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sclq.sql = prev
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclq *ScaCommentLikesQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ScaCommentLikes, error) {
|
||||||
|
var (
|
||||||
|
nodes = []*ScaCommentLikes{}
|
||||||
|
_spec = sclq.querySpec()
|
||||||
|
)
|
||||||
|
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||||
|
return (*ScaCommentLikes).scanValues(nil, columns)
|
||||||
|
}
|
||||||
|
_spec.Assign = func(columns []string, values []any) error {
|
||||||
|
node := &ScaCommentLikes{config: sclq.config}
|
||||||
|
nodes = append(nodes, node)
|
||||||
|
return node.assignValues(columns, values)
|
||||||
|
}
|
||||||
|
for i := range hooks {
|
||||||
|
hooks[i](ctx, _spec)
|
||||||
|
}
|
||||||
|
if err := sqlgraph.QueryNodes(ctx, sclq.driver, _spec); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclq *ScaCommentLikesQuery) sqlCount(ctx context.Context) (int, error) {
|
||||||
|
_spec := sclq.querySpec()
|
||||||
|
_spec.Node.Columns = sclq.ctx.Fields
|
||||||
|
if len(sclq.ctx.Fields) > 0 {
|
||||||
|
_spec.Unique = sclq.ctx.Unique != nil && *sclq.ctx.Unique
|
||||||
|
}
|
||||||
|
return sqlgraph.CountNodes(ctx, sclq.driver, _spec)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclq *ScaCommentLikesQuery) querySpec() *sqlgraph.QuerySpec {
|
||||||
|
_spec := sqlgraph.NewQuerySpec(scacommentlikes.Table, scacommentlikes.Columns, sqlgraph.NewFieldSpec(scacommentlikes.FieldID, field.TypeInt64))
|
||||||
|
_spec.From = sclq.sql
|
||||||
|
if unique := sclq.ctx.Unique; unique != nil {
|
||||||
|
_spec.Unique = *unique
|
||||||
|
} else if sclq.path != nil {
|
||||||
|
_spec.Unique = true
|
||||||
|
}
|
||||||
|
if fields := sclq.ctx.Fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scacommentlikes.FieldID)
|
||||||
|
for i := range fields {
|
||||||
|
if fields[i] != scacommentlikes.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := sclq.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if limit := sclq.ctx.Limit; limit != nil {
|
||||||
|
_spec.Limit = *limit
|
||||||
|
}
|
||||||
|
if offset := sclq.ctx.Offset; offset != nil {
|
||||||
|
_spec.Offset = *offset
|
||||||
|
}
|
||||||
|
if ps := sclq.order; len(ps) > 0 {
|
||||||
|
_spec.Order = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclq *ScaCommentLikesQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||||
|
builder := sql.Dialect(sclq.driver.Dialect())
|
||||||
|
t1 := builder.Table(scacommentlikes.Table)
|
||||||
|
columns := sclq.ctx.Fields
|
||||||
|
if len(columns) == 0 {
|
||||||
|
columns = scacommentlikes.Columns
|
||||||
|
}
|
||||||
|
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||||
|
if sclq.sql != nil {
|
||||||
|
selector = sclq.sql
|
||||||
|
selector.Select(selector.Columns(columns...)...)
|
||||||
|
}
|
||||||
|
if sclq.ctx.Unique != nil && *sclq.ctx.Unique {
|
||||||
|
selector.Distinct()
|
||||||
|
}
|
||||||
|
for _, p := range sclq.predicates {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
for _, p := range sclq.order {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
if offset := sclq.ctx.Offset; offset != nil {
|
||||||
|
// limit is mandatory for offset clause. We start
|
||||||
|
// with default value, and override it below if needed.
|
||||||
|
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||||
|
}
|
||||||
|
if limit := sclq.ctx.Limit; limit != nil {
|
||||||
|
selector.Limit(*limit)
|
||||||
|
}
|
||||||
|
return selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesGroupBy is the group-by builder for ScaCommentLikes entities.
|
||||||
|
type ScaCommentLikesGroupBy struct {
|
||||||
|
selector
|
||||||
|
build *ScaCommentLikesQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the group-by query.
|
||||||
|
func (sclgb *ScaCommentLikesGroupBy) Aggregate(fns ...AggregateFunc) *ScaCommentLikesGroupBy {
|
||||||
|
sclgb.fns = append(sclgb.fns, fns...)
|
||||||
|
return sclgb
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (sclgb *ScaCommentLikesGroupBy) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, sclgb.build.ctx, ent.OpQueryGroupBy)
|
||||||
|
if err := sclgb.build.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaCommentLikesQuery, *ScaCommentLikesGroupBy](ctx, sclgb.build, sclgb, sclgb.build.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclgb *ScaCommentLikesGroupBy) sqlScan(ctx context.Context, root *ScaCommentLikesQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx).Select()
|
||||||
|
aggregation := make([]string, 0, len(sclgb.fns))
|
||||||
|
for _, fn := range sclgb.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
|
columns := make([]string, 0, len(*sclgb.flds)+len(sclgb.fns))
|
||||||
|
for _, f := range *sclgb.flds {
|
||||||
|
columns = append(columns, selector.C(f))
|
||||||
|
}
|
||||||
|
columns = append(columns, aggregation...)
|
||||||
|
selector.Select(columns...)
|
||||||
|
}
|
||||||
|
selector.GroupBy(selector.Columns(*sclgb.flds...)...)
|
||||||
|
if err := selector.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := sclgb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesSelect is the builder for selecting fields of ScaCommentLikes entities.
|
||||||
|
type ScaCommentLikesSelect struct {
|
||||||
|
*ScaCommentLikesQuery
|
||||||
|
selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (scls *ScaCommentLikesSelect) Aggregate(fns ...AggregateFunc) *ScaCommentLikesSelect {
|
||||||
|
scls.fns = append(scls.fns, fns...)
|
||||||
|
return scls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (scls *ScaCommentLikesSelect) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, scls.ctx, ent.OpQuerySelect)
|
||||||
|
if err := scls.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaCommentLikesQuery, *ScaCommentLikesSelect](ctx, scls.ScaCommentLikesQuery, scls, scls.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scls *ScaCommentLikesSelect) sqlScan(ctx context.Context, root *ScaCommentLikesQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx)
|
||||||
|
aggregation := make([]string, 0, len(scls.fns))
|
||||||
|
for _, fn := range scls.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
switch n := len(*scls.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
selector.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
selector.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := scls.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
332
app/core/api/repository/mysql/ent/scacommentlikes_update.go
Normal file
332
app/core/api/repository/mysql/ent/scacommentlikes_update.go
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentlikes"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentLikesUpdate is the builder for updating ScaCommentLikes entities.
|
||||||
|
type ScaCommentLikesUpdate struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaCommentLikesMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentLikesUpdate builder.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) Where(ps ...predicate.ScaCommentLikes) *ScaCommentLikesUpdate {
|
||||||
|
sclu.mutation.Where(ps...)
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicID sets the "topic_id" field.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetTopicID(s string) *ScaCommentLikesUpdate {
|
||||||
|
sclu.mutation.SetTopicID(s)
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableTopicID sets the "topic_id" field if the given value is not nil.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetNillableTopicID(s *string) *ScaCommentLikesUpdate {
|
||||||
|
if s != nil {
|
||||||
|
sclu.SetTopicID(*s)
|
||||||
|
}
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUserID sets the "user_id" field.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetUserID(s string) *ScaCommentLikesUpdate {
|
||||||
|
sclu.mutation.SetUserID(s)
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetNillableUserID(s *string) *ScaCommentLikesUpdate {
|
||||||
|
if s != nil {
|
||||||
|
sclu.SetUserID(*s)
|
||||||
|
}
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCommentID sets the "comment_id" field.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetCommentID(i int64) *ScaCommentLikesUpdate {
|
||||||
|
sclu.mutation.ResetCommentID()
|
||||||
|
sclu.mutation.SetCommentID(i)
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCommentID sets the "comment_id" field if the given value is not nil.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetNillableCommentID(i *int64) *ScaCommentLikesUpdate {
|
||||||
|
if i != nil {
|
||||||
|
sclu.SetCommentID(*i)
|
||||||
|
}
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddCommentID adds i to the "comment_id" field.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) AddCommentID(i int64) *ScaCommentLikesUpdate {
|
||||||
|
sclu.mutation.AddCommentID(i)
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLikeTime sets the "like_time" field.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetLikeTime(t time.Time) *ScaCommentLikesUpdate {
|
||||||
|
sclu.mutation.SetLikeTime(t)
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLikeTime sets the "like_time" field if the given value is not nil.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SetNillableLikeTime(t *time.Time) *ScaCommentLikesUpdate {
|
||||||
|
if t != nil {
|
||||||
|
sclu.SetLikeTime(*t)
|
||||||
|
}
|
||||||
|
return sclu
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaCommentLikesMutation object of the builder.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) Mutation() *ScaCommentLikesMutation {
|
||||||
|
return sclu.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) Save(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, sclu.sqlSave, sclu.mutation, sclu.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) SaveX(ctx context.Context) int {
|
||||||
|
affected, err := sclu.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return affected
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) Exec(ctx context.Context) error {
|
||||||
|
_, err := sclu.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sclu *ScaCommentLikesUpdate) ExecX(ctx context.Context) {
|
||||||
|
if err := sclu.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sclu *ScaCommentLikesUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scacommentlikes.Table, scacommentlikes.Columns, sqlgraph.NewFieldSpec(scacommentlikes.FieldID, field.TypeInt64))
|
||||||
|
if ps := sclu.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := sclu.mutation.TopicID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldTopicID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sclu.mutation.UserID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldUserID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sclu.mutation.CommentID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldCommentID, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := sclu.mutation.AddedCommentID(); ok {
|
||||||
|
_spec.AddField(scacommentlikes.FieldCommentID, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := sclu.mutation.LikeTime(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldLikeTime, field.TypeTime, value)
|
||||||
|
}
|
||||||
|
if n, err = sqlgraph.UpdateNodes(ctx, sclu.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scacommentlikes.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
sclu.mutation.done = true
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentLikesUpdateOne is the builder for updating a single ScaCommentLikes entity.
|
||||||
|
type ScaCommentLikesUpdateOne struct {
|
||||||
|
config
|
||||||
|
fields []string
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaCommentLikesMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicID sets the "topic_id" field.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetTopicID(s string) *ScaCommentLikesUpdateOne {
|
||||||
|
scluo.mutation.SetTopicID(s)
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableTopicID sets the "topic_id" field if the given value is not nil.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetNillableTopicID(s *string) *ScaCommentLikesUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
scluo.SetTopicID(*s)
|
||||||
|
}
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUserID sets the "user_id" field.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetUserID(s string) *ScaCommentLikesUpdateOne {
|
||||||
|
scluo.mutation.SetUserID(s)
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetNillableUserID(s *string) *ScaCommentLikesUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
scluo.SetUserID(*s)
|
||||||
|
}
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCommentID sets the "comment_id" field.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetCommentID(i int64) *ScaCommentLikesUpdateOne {
|
||||||
|
scluo.mutation.ResetCommentID()
|
||||||
|
scluo.mutation.SetCommentID(i)
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCommentID sets the "comment_id" field if the given value is not nil.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetNillableCommentID(i *int64) *ScaCommentLikesUpdateOne {
|
||||||
|
if i != nil {
|
||||||
|
scluo.SetCommentID(*i)
|
||||||
|
}
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddCommentID adds i to the "comment_id" field.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) AddCommentID(i int64) *ScaCommentLikesUpdateOne {
|
||||||
|
scluo.mutation.AddCommentID(i)
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLikeTime sets the "like_time" field.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetLikeTime(t time.Time) *ScaCommentLikesUpdateOne {
|
||||||
|
scluo.mutation.SetLikeTime(t)
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLikeTime sets the "like_time" field if the given value is not nil.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SetNillableLikeTime(t *time.Time) *ScaCommentLikesUpdateOne {
|
||||||
|
if t != nil {
|
||||||
|
scluo.SetLikeTime(*t)
|
||||||
|
}
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaCommentLikesMutation object of the builder.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) Mutation() *ScaCommentLikesMutation {
|
||||||
|
return scluo.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentLikesUpdate builder.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) Where(ps ...predicate.ScaCommentLikes) *ScaCommentLikesUpdateOne {
|
||||||
|
scluo.mutation.Where(ps...)
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||||
|
// The default is selecting all fields defined in the entity schema.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) Select(field string, fields ...string) *ScaCommentLikesUpdateOne {
|
||||||
|
scluo.fields = append([]string{field}, fields...)
|
||||||
|
return scluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the updated ScaCommentLikes entity.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) Save(ctx context.Context) (*ScaCommentLikes, error) {
|
||||||
|
return withHooks(ctx, scluo.sqlSave, scluo.mutation, scluo.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) SaveX(ctx context.Context) *ScaCommentLikes {
|
||||||
|
node, err := scluo.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query on the entity.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) Exec(ctx context.Context) error {
|
||||||
|
_, err := scluo.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) ExecX(ctx context.Context) {
|
||||||
|
if err := scluo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scluo *ScaCommentLikesUpdateOne) sqlSave(ctx context.Context) (_node *ScaCommentLikes, err error) {
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scacommentlikes.Table, scacommentlikes.Columns, sqlgraph.NewFieldSpec(scacommentlikes.FieldID, field.TypeInt64))
|
||||||
|
id, ok := scluo.mutation.ID()
|
||||||
|
if !ok {
|
||||||
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ScaCommentLikes.id" for update`)}
|
||||||
|
}
|
||||||
|
_spec.Node.ID.Value = id
|
||||||
|
if fields := scluo.fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scacommentlikes.FieldID)
|
||||||
|
for _, f := range fields {
|
||||||
|
if !scacommentlikes.ValidColumn(f) {
|
||||||
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
if f != scacommentlikes.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := scluo.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := scluo.mutation.TopicID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldTopicID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scluo.mutation.UserID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldUserID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scluo.mutation.CommentID(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldCommentID, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := scluo.mutation.AddedCommentID(); ok {
|
||||||
|
_spec.AddField(scacommentlikes.FieldCommentID, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := scluo.mutation.LikeTime(); ok {
|
||||||
|
_spec.SetField(scacommentlikes.FieldLikeTime, field.TypeTime, value)
|
||||||
|
}
|
||||||
|
_node = &ScaCommentLikes{config: scluo.config}
|
||||||
|
_spec.Assign = _node.assignValues
|
||||||
|
_spec.ScanValues = _node.scanValues
|
||||||
|
if err = sqlgraph.UpdateNode(ctx, scluo.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scacommentlikes.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
scluo.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
184
app/core/api/repository/mysql/ent/scacommentmessage.go
Normal file
184
app/core/api/repository/mysql/ent/scacommentmessage.go
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 评论消息表
|
||||||
|
type ScaCommentMessage struct {
|
||||||
|
config `json:"-"`
|
||||||
|
// ID of the ent.
|
||||||
|
// 主键
|
||||||
|
ID int64 `json:"id,omitempty"`
|
||||||
|
// 创建时间
|
||||||
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
|
// 更新时间
|
||||||
|
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||||
|
// 是否删除 0 未删除 1 已删除
|
||||||
|
Deleted int8 `json:"deleted,omitempty"`
|
||||||
|
// 话题Id
|
||||||
|
TopicID string `json:"topic_id,omitempty"`
|
||||||
|
// 来自人
|
||||||
|
FromID string `json:"from_id,omitempty"`
|
||||||
|
// 送达人
|
||||||
|
ToID string `json:"to_id,omitempty"`
|
||||||
|
// 消息内容
|
||||||
|
Content string `json:"content,omitempty"`
|
||||||
|
// 是否已读
|
||||||
|
IsRead int `json:"is_read,omitempty"`
|
||||||
|
selectValues sql.SelectValues
|
||||||
|
}
|
||||||
|
|
||||||
|
// scanValues returns the types for scanning values from sql.Rows.
|
||||||
|
func (*ScaCommentMessage) scanValues(columns []string) ([]any, error) {
|
||||||
|
values := make([]any, len(columns))
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scacommentmessage.FieldID, scacommentmessage.FieldDeleted, scacommentmessage.FieldIsRead:
|
||||||
|
values[i] = new(sql.NullInt64)
|
||||||
|
case scacommentmessage.FieldTopicID, scacommentmessage.FieldFromID, scacommentmessage.FieldToID, scacommentmessage.FieldContent:
|
||||||
|
values[i] = new(sql.NullString)
|
||||||
|
case scacommentmessage.FieldCreatedAt, scacommentmessage.FieldUpdatedAt:
|
||||||
|
values[i] = new(sql.NullTime)
|
||||||
|
default:
|
||||||
|
values[i] = new(sql.UnknownType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||||
|
// to the ScaCommentMessage fields.
|
||||||
|
func (scm *ScaCommentMessage) assignValues(columns []string, values []any) error {
|
||||||
|
if m, n := len(values), len(columns); m < n {
|
||||||
|
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||||
|
}
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scacommentmessage.FieldID:
|
||||||
|
value, ok := values[i].(*sql.NullInt64)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field id", value)
|
||||||
|
}
|
||||||
|
scm.ID = int64(value.Int64)
|
||||||
|
case scacommentmessage.FieldCreatedAt:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.CreatedAt = value.Time
|
||||||
|
}
|
||||||
|
case scacommentmessage.FieldUpdatedAt:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.UpdatedAt = value.Time
|
||||||
|
}
|
||||||
|
case scacommentmessage.FieldDeleted:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.Deleted = int8(value.Int64)
|
||||||
|
}
|
||||||
|
case scacommentmessage.FieldTopicID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field topic_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.TopicID = value.String
|
||||||
|
}
|
||||||
|
case scacommentmessage.FieldFromID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field from_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.FromID = value.String
|
||||||
|
}
|
||||||
|
case scacommentmessage.FieldToID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field to_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.ToID = value.String
|
||||||
|
}
|
||||||
|
case scacommentmessage.FieldContent:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field content", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.Content = value.String
|
||||||
|
}
|
||||||
|
case scacommentmessage.FieldIsRead:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field is_read", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scm.IsRead = int(value.Int64)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
scm.selectValues.Set(columns[i], values[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value returns the ent.Value that was dynamically selected and assigned to the ScaCommentMessage.
|
||||||
|
// This includes values selected through modifiers, order, etc.
|
||||||
|
func (scm *ScaCommentMessage) Value(name string) (ent.Value, error) {
|
||||||
|
return scm.selectValues.Get(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns a builder for updating this ScaCommentMessage.
|
||||||
|
// Note that you need to call ScaCommentMessage.Unwrap() before calling this method if this ScaCommentMessage
|
||||||
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||||
|
func (scm *ScaCommentMessage) Update() *ScaCommentMessageUpdateOne {
|
||||||
|
return NewScaCommentMessageClient(scm.config).UpdateOne(scm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap unwraps the ScaCommentMessage entity that was returned from a transaction after it was closed,
|
||||||
|
// so that all future queries will be executed through the driver which created the transaction.
|
||||||
|
func (scm *ScaCommentMessage) Unwrap() *ScaCommentMessage {
|
||||||
|
_tx, ok := scm.config.driver.(*txDriver)
|
||||||
|
if !ok {
|
||||||
|
panic("ent: ScaCommentMessage is not a transactional entity")
|
||||||
|
}
|
||||||
|
scm.config.driver = _tx.drv
|
||||||
|
return scm
|
||||||
|
}
|
||||||
|
|
||||||
|
// String implements the fmt.Stringer.
|
||||||
|
func (scm *ScaCommentMessage) String() string {
|
||||||
|
var builder strings.Builder
|
||||||
|
builder.WriteString("ScaCommentMessage(")
|
||||||
|
builder.WriteString(fmt.Sprintf("id=%v, ", scm.ID))
|
||||||
|
builder.WriteString("created_at=")
|
||||||
|
builder.WriteString(scm.CreatedAt.Format(time.ANSIC))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("updated_at=")
|
||||||
|
builder.WriteString(scm.UpdatedAt.Format(time.ANSIC))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("deleted=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scm.Deleted))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("topic_id=")
|
||||||
|
builder.WriteString(scm.TopicID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("from_id=")
|
||||||
|
builder.WriteString(scm.FromID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("to_id=")
|
||||||
|
builder.WriteString(scm.ToID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("content=")
|
||||||
|
builder.WriteString(scm.Content)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("is_read=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scm.IsRead))
|
||||||
|
builder.WriteByte(')')
|
||||||
|
return builder.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessages is a parsable slice of ScaCommentMessage.
|
||||||
|
type ScaCommentMessages []*ScaCommentMessage
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scacommentmessage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Label holds the string label denoting the scacommentmessage type in the database.
|
||||||
|
Label = "sca_comment_message"
|
||||||
|
// FieldID holds the string denoting the id field in the database.
|
||||||
|
FieldID = "id"
|
||||||
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||||
|
FieldCreatedAt = "created_at"
|
||||||
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
||||||
|
FieldUpdatedAt = "updated_at"
|
||||||
|
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||||
|
FieldDeleted = "deleted"
|
||||||
|
// FieldTopicID holds the string denoting the topic_id field in the database.
|
||||||
|
FieldTopicID = "topic_id"
|
||||||
|
// FieldFromID holds the string denoting the from_id field in the database.
|
||||||
|
FieldFromID = "from_id"
|
||||||
|
// FieldToID holds the string denoting the to_id field in the database.
|
||||||
|
FieldToID = "to_id"
|
||||||
|
// FieldContent holds the string denoting the content field in the database.
|
||||||
|
FieldContent = "content"
|
||||||
|
// FieldIsRead holds the string denoting the is_read field in the database.
|
||||||
|
FieldIsRead = "is_read"
|
||||||
|
// Table holds the table name of the scacommentmessage in the database.
|
||||||
|
Table = "sca_comment_message"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Columns holds all SQL columns for scacommentmessage fields.
|
||||||
|
var Columns = []string{
|
||||||
|
FieldID,
|
||||||
|
FieldCreatedAt,
|
||||||
|
FieldUpdatedAt,
|
||||||
|
FieldDeleted,
|
||||||
|
FieldTopicID,
|
||||||
|
FieldFromID,
|
||||||
|
FieldToID,
|
||||||
|
FieldContent,
|
||||||
|
FieldIsRead,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
|
func ValidColumn(column string) bool {
|
||||||
|
for i := range Columns {
|
||||||
|
if column == Columns[i] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||||
|
DefaultCreatedAt func() time.Time
|
||||||
|
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||||
|
UpdateDefaultUpdatedAt func() time.Time
|
||||||
|
// DefaultDeleted holds the default value on creation for the "deleted" field.
|
||||||
|
DefaultDeleted int8
|
||||||
|
// DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
|
||||||
|
DeletedValidator func(int8) error
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderOption defines the ordering options for the ScaCommentMessage queries.
|
||||||
|
type OrderOption func(*sql.Selector)
|
||||||
|
|
||||||
|
// ByID orders the results by the id field.
|
||||||
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByCreatedAt orders the results by the created_at field.
|
||||||
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByUpdatedAt orders the results by the updated_at field.
|
||||||
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByDeleted orders the results by the deleted field.
|
||||||
|
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByTopicID orders the results by the topic_id field.
|
||||||
|
func ByTopicID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldTopicID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByFromID orders the results by the from_id field.
|
||||||
|
func ByFromID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldFromID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByToID orders the results by the to_id field.
|
||||||
|
func ByToID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldToID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByContent orders the results by the content field.
|
||||||
|
func ByContent(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldContent, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByIsRead orders the results by the is_read field.
|
||||||
|
func ByIsRead(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldIsRead, opts...).ToFunc()
|
||||||
|
}
|
||||||
550
app/core/api/repository/mysql/ent/scacommentmessage/where.go
Normal file
550
app/core/api/repository/mysql/ent/scacommentmessage/where.go
Normal file
@@ -0,0 +1,550 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scacommentmessage
|
||||||
|
|
||||||
|
import (
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ID filters vertices based on their ID field.
|
||||||
|
func ID(id int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDEQ applies the EQ predicate on the ID field.
|
||||||
|
func IDEQ(id int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNEQ applies the NEQ predicate on the ID field.
|
||||||
|
func IDNEQ(id int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDIn applies the In predicate on the ID field.
|
||||||
|
func IDIn(ids ...int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNotIn applies the NotIn predicate on the ID field.
|
||||||
|
func IDNotIn(ids ...int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGT applies the GT predicate on the ID field.
|
||||||
|
func IDGT(id int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGTE applies the GTE predicate on the ID field.
|
||||||
|
func IDGTE(id int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLT applies the LT predicate on the ID field.
|
||||||
|
func IDLT(id int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLTE applies the LTE predicate on the ID field.
|
||||||
|
func IDLTE(id int64) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||||
|
func CreatedAt(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldCreatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
|
||||||
|
func UpdatedAt(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldUpdatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
|
||||||
|
func Deleted(v int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldDeleted, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicID applies equality check predicate on the "topic_id" field. It's identical to TopicIDEQ.
|
||||||
|
func TopicID(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromID applies equality check predicate on the "from_id" field. It's identical to FromIDEQ.
|
||||||
|
func FromID(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToID applies equality check predicate on the "to_id" field. It's identical to ToIDEQ.
|
||||||
|
func ToID(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Content applies equality check predicate on the "content" field. It's identical to ContentEQ.
|
||||||
|
func Content(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRead applies equality check predicate on the "is_read" field. It's identical to IsReadEQ.
|
||||||
|
func IsRead(v int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldIsRead, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||||
|
func CreatedAtEQ(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldCreatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||||||
|
func CreatedAtNEQ(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldCreatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||||
|
func CreatedAtIn(vs ...time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldCreatedAt, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||||
|
func CreatedAtNotIn(vs ...time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldCreatedAt, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||||||
|
func CreatedAtGT(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldCreatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||||||
|
func CreatedAtGTE(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldCreatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||||||
|
func CreatedAtLT(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldCreatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||||||
|
func CreatedAtLTE(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldCreatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtEQ(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldUpdatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtNEQ(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldUpdatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtIn(vs ...time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldUpdatedAt, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtNotIn(vs ...time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtGT(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldUpdatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtGTE(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldUpdatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtLT(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldUpdatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtLTE(v time.Time) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldUpdatedAt, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtIsNil applies the IsNil predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtIsNil() predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIsNull(FieldUpdatedAt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdatedAtNotNil applies the NotNil predicate on the "updated_at" field.
|
||||||
|
func UpdatedAtNotNil() predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotNull(FieldUpdatedAt))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedEQ applies the EQ predicate on the "deleted" field.
|
||||||
|
func DeletedEQ(v int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldDeleted, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
|
||||||
|
func DeletedNEQ(v int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldDeleted, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedIn applies the In predicate on the "deleted" field.
|
||||||
|
func DeletedIn(vs ...int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldDeleted, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
|
||||||
|
func DeletedNotIn(vs ...int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldDeleted, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedGT applies the GT predicate on the "deleted" field.
|
||||||
|
func DeletedGT(v int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldDeleted, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedGTE applies the GTE predicate on the "deleted" field.
|
||||||
|
func DeletedGTE(v int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldDeleted, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedLT applies the LT predicate on the "deleted" field.
|
||||||
|
func DeletedLT(v int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldDeleted, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeletedLTE applies the LTE predicate on the "deleted" field.
|
||||||
|
func DeletedLTE(v int8) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldDeleted, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDEQ applies the EQ predicate on the "topic_id" field.
|
||||||
|
func TopicIDEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDNEQ applies the NEQ predicate on the "topic_id" field.
|
||||||
|
func TopicIDNEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDIn applies the In predicate on the "topic_id" field.
|
||||||
|
func TopicIDIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldTopicID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDNotIn applies the NotIn predicate on the "topic_id" field.
|
||||||
|
func TopicIDNotIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldTopicID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDGT applies the GT predicate on the "topic_id" field.
|
||||||
|
func TopicIDGT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDGTE applies the GTE predicate on the "topic_id" field.
|
||||||
|
func TopicIDGTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDLT applies the LT predicate on the "topic_id" field.
|
||||||
|
func TopicIDLT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDLTE applies the LTE predicate on the "topic_id" field.
|
||||||
|
func TopicIDLTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDContains applies the Contains predicate on the "topic_id" field.
|
||||||
|
func TopicIDContains(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContains(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDHasPrefix applies the HasPrefix predicate on the "topic_id" field.
|
||||||
|
func TopicIDHasPrefix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasPrefix(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDHasSuffix applies the HasSuffix predicate on the "topic_id" field.
|
||||||
|
func TopicIDHasSuffix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasSuffix(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDEqualFold applies the EqualFold predicate on the "topic_id" field.
|
||||||
|
func TopicIDEqualFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEqualFold(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TopicIDContainsFold applies the ContainsFold predicate on the "topic_id" field.
|
||||||
|
func TopicIDContainsFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContainsFold(FieldTopicID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDEQ applies the EQ predicate on the "from_id" field.
|
||||||
|
func FromIDEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDNEQ applies the NEQ predicate on the "from_id" field.
|
||||||
|
func FromIDNEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDIn applies the In predicate on the "from_id" field.
|
||||||
|
func FromIDIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldFromID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDNotIn applies the NotIn predicate on the "from_id" field.
|
||||||
|
func FromIDNotIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldFromID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDGT applies the GT predicate on the "from_id" field.
|
||||||
|
func FromIDGT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDGTE applies the GTE predicate on the "from_id" field.
|
||||||
|
func FromIDGTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDLT applies the LT predicate on the "from_id" field.
|
||||||
|
func FromIDLT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDLTE applies the LTE predicate on the "from_id" field.
|
||||||
|
func FromIDLTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDContains applies the Contains predicate on the "from_id" field.
|
||||||
|
func FromIDContains(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContains(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDHasPrefix applies the HasPrefix predicate on the "from_id" field.
|
||||||
|
func FromIDHasPrefix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasPrefix(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDHasSuffix applies the HasSuffix predicate on the "from_id" field.
|
||||||
|
func FromIDHasSuffix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasSuffix(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDEqualFold applies the EqualFold predicate on the "from_id" field.
|
||||||
|
func FromIDEqualFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEqualFold(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FromIDContainsFold applies the ContainsFold predicate on the "from_id" field.
|
||||||
|
func FromIDContainsFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContainsFold(FieldFromID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDEQ applies the EQ predicate on the "to_id" field.
|
||||||
|
func ToIDEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDNEQ applies the NEQ predicate on the "to_id" field.
|
||||||
|
func ToIDNEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDIn applies the In predicate on the "to_id" field.
|
||||||
|
func ToIDIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldToID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDNotIn applies the NotIn predicate on the "to_id" field.
|
||||||
|
func ToIDNotIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldToID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDGT applies the GT predicate on the "to_id" field.
|
||||||
|
func ToIDGT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDGTE applies the GTE predicate on the "to_id" field.
|
||||||
|
func ToIDGTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDLT applies the LT predicate on the "to_id" field.
|
||||||
|
func ToIDLT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDLTE applies the LTE predicate on the "to_id" field.
|
||||||
|
func ToIDLTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDContains applies the Contains predicate on the "to_id" field.
|
||||||
|
func ToIDContains(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContains(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDHasPrefix applies the HasPrefix predicate on the "to_id" field.
|
||||||
|
func ToIDHasPrefix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasPrefix(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDHasSuffix applies the HasSuffix predicate on the "to_id" field.
|
||||||
|
func ToIDHasSuffix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasSuffix(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDEqualFold applies the EqualFold predicate on the "to_id" field.
|
||||||
|
func ToIDEqualFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEqualFold(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ToIDContainsFold applies the ContainsFold predicate on the "to_id" field.
|
||||||
|
func ToIDContainsFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContainsFold(FieldToID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentEQ applies the EQ predicate on the "content" field.
|
||||||
|
func ContentEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentNEQ applies the NEQ predicate on the "content" field.
|
||||||
|
func ContentNEQ(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentIn applies the In predicate on the "content" field.
|
||||||
|
func ContentIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldContent, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentNotIn applies the NotIn predicate on the "content" field.
|
||||||
|
func ContentNotIn(vs ...string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldContent, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentGT applies the GT predicate on the "content" field.
|
||||||
|
func ContentGT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentGTE applies the GTE predicate on the "content" field.
|
||||||
|
func ContentGTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentLT applies the LT predicate on the "content" field.
|
||||||
|
func ContentLT(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentLTE applies the LTE predicate on the "content" field.
|
||||||
|
func ContentLTE(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentContains applies the Contains predicate on the "content" field.
|
||||||
|
func ContentContains(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContains(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentHasPrefix applies the HasPrefix predicate on the "content" field.
|
||||||
|
func ContentHasPrefix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasPrefix(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentHasSuffix applies the HasSuffix predicate on the "content" field.
|
||||||
|
func ContentHasSuffix(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldHasSuffix(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentEqualFold applies the EqualFold predicate on the "content" field.
|
||||||
|
func ContentEqualFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEqualFold(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContentContainsFold applies the ContainsFold predicate on the "content" field.
|
||||||
|
func ContentContainsFold(v string) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldContainsFold(FieldContent, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadEQ applies the EQ predicate on the "is_read" field.
|
||||||
|
func IsReadEQ(v int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldEQ(FieldIsRead, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadNEQ applies the NEQ predicate on the "is_read" field.
|
||||||
|
func IsReadNEQ(v int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNEQ(FieldIsRead, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadIn applies the In predicate on the "is_read" field.
|
||||||
|
func IsReadIn(vs ...int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIn(FieldIsRead, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadNotIn applies the NotIn predicate on the "is_read" field.
|
||||||
|
func IsReadNotIn(vs ...int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotIn(FieldIsRead, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadGT applies the GT predicate on the "is_read" field.
|
||||||
|
func IsReadGT(v int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGT(FieldIsRead, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadGTE applies the GTE predicate on the "is_read" field.
|
||||||
|
func IsReadGTE(v int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldGTE(FieldIsRead, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadLT applies the LT predicate on the "is_read" field.
|
||||||
|
func IsReadLT(v int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLT(FieldIsRead, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadLTE applies the LTE predicate on the "is_read" field.
|
||||||
|
func IsReadLTE(v int) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldLTE(FieldIsRead, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadIsNil applies the IsNil predicate on the "is_read" field.
|
||||||
|
func IsReadIsNil() predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldIsNull(FieldIsRead))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsReadNotNil applies the NotNil predicate on the "is_read" field.
|
||||||
|
func IsReadNotNil() predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.FieldNotNull(FieldIsRead))
|
||||||
|
}
|
||||||
|
|
||||||
|
// And groups predicates with the AND operator between them.
|
||||||
|
func And(predicates ...predicate.ScaCommentMessage) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.AndPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or groups predicates with the OR operator between them.
|
||||||
|
func Or(predicates ...predicate.ScaCommentMessage) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.OrPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not applies the not operator on the given predicate.
|
||||||
|
func Not(p predicate.ScaCommentMessage) predicate.ScaCommentMessage {
|
||||||
|
return predicate.ScaCommentMessage(sql.NotPredicates(p))
|
||||||
|
}
|
||||||
332
app/core/api/repository/mysql/ent/scacommentmessage_create.go
Normal file
332
app/core/api/repository/mysql/ent/scacommentmessage_create.go
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentMessageCreate is the builder for creating a ScaCommentMessage entity.
|
||||||
|
type ScaCommentMessageCreate struct {
|
||||||
|
config
|
||||||
|
mutation *ScaCommentMessageMutation
|
||||||
|
hooks []Hook
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCreatedAt sets the "created_at" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetCreatedAt(t time.Time) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetCreatedAt(t)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetNillableCreatedAt(t *time.Time) *ScaCommentMessageCreate {
|
||||||
|
if t != nil {
|
||||||
|
scmc.SetCreatedAt(*t)
|
||||||
|
}
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUpdatedAt sets the "updated_at" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetUpdatedAt(t time.Time) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetUpdatedAt(t)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetNillableUpdatedAt(t *time.Time) *ScaCommentMessageCreate {
|
||||||
|
if t != nil {
|
||||||
|
scmc.SetUpdatedAt(*t)
|
||||||
|
}
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDeleted sets the "deleted" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetDeleted(i int8) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetDeleted(i)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetNillableDeleted(i *int8) *ScaCommentMessageCreate {
|
||||||
|
if i != nil {
|
||||||
|
scmc.SetDeleted(*i)
|
||||||
|
}
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicID sets the "topic_id" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetTopicID(s string) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetTopicID(s)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFromID sets the "from_id" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetFromID(s string) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetFromID(s)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetToID sets the "to_id" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetToID(s string) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetToID(s)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContent sets the "content" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetContent(s string) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetContent(s)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIsRead sets the "is_read" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetIsRead(i int) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetIsRead(i)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableIsRead sets the "is_read" field if the given value is not nil.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetNillableIsRead(i *int) *ScaCommentMessageCreate {
|
||||||
|
if i != nil {
|
||||||
|
scmc.SetIsRead(*i)
|
||||||
|
}
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID sets the "id" field.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SetID(i int64) *ScaCommentMessageCreate {
|
||||||
|
scmc.mutation.SetID(i)
|
||||||
|
return scmc
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaCommentMessageMutation object of the builder.
|
||||||
|
func (scmc *ScaCommentMessageCreate) Mutation() *ScaCommentMessageMutation {
|
||||||
|
return scmc.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaCommentMessage in the database.
|
||||||
|
func (scmc *ScaCommentMessageCreate) Save(ctx context.Context) (*ScaCommentMessage, error) {
|
||||||
|
scmc.defaults()
|
||||||
|
return withHooks(ctx, scmc.sqlSave, scmc.mutation, scmc.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX calls Save and panics if Save returns an error.
|
||||||
|
func (scmc *ScaCommentMessageCreate) SaveX(ctx context.Context) *ScaCommentMessage {
|
||||||
|
v, err := scmc.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (scmc *ScaCommentMessageCreate) Exec(ctx context.Context) error {
|
||||||
|
_, err := scmc.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scmc *ScaCommentMessageCreate) ExecX(ctx context.Context) {
|
||||||
|
if err := scmc.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaults sets the default values of the builder before save.
|
||||||
|
func (scmc *ScaCommentMessageCreate) defaults() {
|
||||||
|
if _, ok := scmc.mutation.CreatedAt(); !ok {
|
||||||
|
v := scacommentmessage.DefaultCreatedAt()
|
||||||
|
scmc.mutation.SetCreatedAt(v)
|
||||||
|
}
|
||||||
|
if _, ok := scmc.mutation.Deleted(); !ok {
|
||||||
|
v := scacommentmessage.DefaultDeleted
|
||||||
|
scmc.mutation.SetDeleted(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (scmc *ScaCommentMessageCreate) check() error {
|
||||||
|
if _, ok := scmc.mutation.CreatedAt(); !ok {
|
||||||
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaCommentMessage.created_at"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scmc.mutation.Deleted(); !ok {
|
||||||
|
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "ScaCommentMessage.deleted"`)}
|
||||||
|
}
|
||||||
|
if v, ok := scmc.mutation.Deleted(); ok {
|
||||||
|
if err := scacommentmessage.DeletedValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaCommentMessage.deleted": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ok := scmc.mutation.TopicID(); !ok {
|
||||||
|
return &ValidationError{Name: "topic_id", err: errors.New(`ent: missing required field "ScaCommentMessage.topic_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scmc.mutation.FromID(); !ok {
|
||||||
|
return &ValidationError{Name: "from_id", err: errors.New(`ent: missing required field "ScaCommentMessage.from_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scmc.mutation.ToID(); !ok {
|
||||||
|
return &ValidationError{Name: "to_id", err: errors.New(`ent: missing required field "ScaCommentMessage.to_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scmc.mutation.Content(); !ok {
|
||||||
|
return &ValidationError{Name: "content", err: errors.New(`ent: missing required field "ScaCommentMessage.content"`)}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmc *ScaCommentMessageCreate) sqlSave(ctx context.Context) (*ScaCommentMessage, error) {
|
||||||
|
if err := scmc.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_node, _spec := scmc.createSpec()
|
||||||
|
if err := sqlgraph.CreateNode(ctx, scmc.driver, _spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if _spec.ID.Value != _node.ID {
|
||||||
|
id := _spec.ID.Value.(int64)
|
||||||
|
_node.ID = int64(id)
|
||||||
|
}
|
||||||
|
scmc.mutation.id = &_node.ID
|
||||||
|
scmc.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmc *ScaCommentMessageCreate) createSpec() (*ScaCommentMessage, *sqlgraph.CreateSpec) {
|
||||||
|
var (
|
||||||
|
_node = &ScaCommentMessage{config: scmc.config}
|
||||||
|
_spec = sqlgraph.NewCreateSpec(scacommentmessage.Table, sqlgraph.NewFieldSpec(scacommentmessage.FieldID, field.TypeInt64))
|
||||||
|
)
|
||||||
|
if id, ok := scmc.mutation.ID(); ok {
|
||||||
|
_node.ID = id
|
||||||
|
_spec.ID.Value = id
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.CreatedAt(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldCreatedAt, field.TypeTime, value)
|
||||||
|
_node.CreatedAt = value
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.UpdatedAt(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldUpdatedAt, field.TypeTime, value)
|
||||||
|
_node.UpdatedAt = value
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.Deleted(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldDeleted, field.TypeInt8, value)
|
||||||
|
_node.Deleted = value
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.TopicID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldTopicID, field.TypeString, value)
|
||||||
|
_node.TopicID = value
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.FromID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldFromID, field.TypeString, value)
|
||||||
|
_node.FromID = value
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.ToID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldToID, field.TypeString, value)
|
||||||
|
_node.ToID = value
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.Content(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldContent, field.TypeString, value)
|
||||||
|
_node.Content = value
|
||||||
|
}
|
||||||
|
if value, ok := scmc.mutation.IsRead(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldIsRead, field.TypeInt, value)
|
||||||
|
_node.IsRead = value
|
||||||
|
}
|
||||||
|
return _node, _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessageCreateBulk is the builder for creating many ScaCommentMessage entities in bulk.
|
||||||
|
type ScaCommentMessageCreateBulk struct {
|
||||||
|
config
|
||||||
|
err error
|
||||||
|
builders []*ScaCommentMessageCreate
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaCommentMessage entities in the database.
|
||||||
|
func (scmcb *ScaCommentMessageCreateBulk) Save(ctx context.Context) ([]*ScaCommentMessage, error) {
|
||||||
|
if scmcb.err != nil {
|
||||||
|
return nil, scmcb.err
|
||||||
|
}
|
||||||
|
specs := make([]*sqlgraph.CreateSpec, len(scmcb.builders))
|
||||||
|
nodes := make([]*ScaCommentMessage, len(scmcb.builders))
|
||||||
|
mutators := make([]Mutator, len(scmcb.builders))
|
||||||
|
for i := range scmcb.builders {
|
||||||
|
func(i int, root context.Context) {
|
||||||
|
builder := scmcb.builders[i]
|
||||||
|
builder.defaults()
|
||||||
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||||
|
mutation, ok := m.(*ScaCommentMessageMutation)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||||
|
}
|
||||||
|
if err := builder.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
builder.mutation = mutation
|
||||||
|
var err error
|
||||||
|
nodes[i], specs[i] = builder.createSpec()
|
||||||
|
if i < len(mutators)-1 {
|
||||||
|
_, err = mutators[i+1].Mutate(root, scmcb.builders[i+1].mutation)
|
||||||
|
} else {
|
||||||
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||||
|
// Invoke the actual operation on the latest mutation in the chain.
|
||||||
|
if err = sqlgraph.BatchCreate(ctx, scmcb.driver, spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
mutation.id = &nodes[i].ID
|
||||||
|
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||||
|
id := specs[i].ID.Value.(int64)
|
||||||
|
nodes[i].ID = int64(id)
|
||||||
|
}
|
||||||
|
mutation.done = true
|
||||||
|
return nodes[i], nil
|
||||||
|
})
|
||||||
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||||
|
mut = builder.hooks[i](mut)
|
||||||
|
}
|
||||||
|
mutators[i] = mut
|
||||||
|
}(i, ctx)
|
||||||
|
}
|
||||||
|
if len(mutators) > 0 {
|
||||||
|
if _, err := mutators[0].Mutate(ctx, scmcb.builders[0].mutation); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (scmcb *ScaCommentMessageCreateBulk) SaveX(ctx context.Context) []*ScaCommentMessage {
|
||||||
|
v, err := scmcb.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (scmcb *ScaCommentMessageCreateBulk) Exec(ctx context.Context) error {
|
||||||
|
_, err := scmcb.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scmcb *ScaCommentMessageCreateBulk) ExecX(ctx context.Context) {
|
||||||
|
if err := scmcb.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentMessageDelete is the builder for deleting a ScaCommentMessage entity.
|
||||||
|
type ScaCommentMessageDelete struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaCommentMessageMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentMessageDelete builder.
|
||||||
|
func (scmd *ScaCommentMessageDelete) Where(ps ...predicate.ScaCommentMessage) *ScaCommentMessageDelete {
|
||||||
|
scmd.mutation.Where(ps...)
|
||||||
|
return scmd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||||
|
func (scmd *ScaCommentMessageDelete) Exec(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, scmd.sqlExec, scmd.mutation, scmd.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scmd *ScaCommentMessageDelete) ExecX(ctx context.Context) int {
|
||||||
|
n, err := scmd.Exec(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmd *ScaCommentMessageDelete) sqlExec(ctx context.Context) (int, error) {
|
||||||
|
_spec := sqlgraph.NewDeleteSpec(scacommentmessage.Table, sqlgraph.NewFieldSpec(scacommentmessage.FieldID, field.TypeInt64))
|
||||||
|
if ps := scmd.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
affected, err := sqlgraph.DeleteNodes(ctx, scmd.driver, _spec)
|
||||||
|
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
scmd.mutation.done = true
|
||||||
|
return affected, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessageDeleteOne is the builder for deleting a single ScaCommentMessage entity.
|
||||||
|
type ScaCommentMessageDeleteOne struct {
|
||||||
|
scmd *ScaCommentMessageDelete
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentMessageDelete builder.
|
||||||
|
func (scmdo *ScaCommentMessageDeleteOne) Where(ps ...predicate.ScaCommentMessage) *ScaCommentMessageDeleteOne {
|
||||||
|
scmdo.scmd.mutation.Where(ps...)
|
||||||
|
return scmdo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query.
|
||||||
|
func (scmdo *ScaCommentMessageDeleteOne) Exec(ctx context.Context) error {
|
||||||
|
n, err := scmdo.scmd.Exec(ctx)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
|
case n == 0:
|
||||||
|
return &NotFoundError{scacommentmessage.Label}
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scmdo *ScaCommentMessageDeleteOne) ExecX(ctx context.Context) {
|
||||||
|
if err := scmdo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
527
app/core/api/repository/mysql/ent/scacommentmessage_query.go
Normal file
527
app/core/api/repository/mysql/ent/scacommentmessage_query.go
Normal file
@@ -0,0 +1,527 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentMessageQuery is the builder for querying ScaCommentMessage entities.
|
||||||
|
type ScaCommentMessageQuery struct {
|
||||||
|
config
|
||||||
|
ctx *QueryContext
|
||||||
|
order []scacommentmessage.OrderOption
|
||||||
|
inters []Interceptor
|
||||||
|
predicates []predicate.ScaCommentMessage
|
||||||
|
// intermediate query (i.e. traversal path).
|
||||||
|
sql *sql.Selector
|
||||||
|
path func(context.Context) (*sql.Selector, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where adds a new predicate for the ScaCommentMessageQuery builder.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Where(ps ...predicate.ScaCommentMessage) *ScaCommentMessageQuery {
|
||||||
|
scmq.predicates = append(scmq.predicates, ps...)
|
||||||
|
return scmq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit the number of records to be returned by this query.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Limit(limit int) *ScaCommentMessageQuery {
|
||||||
|
scmq.ctx.Limit = &limit
|
||||||
|
return scmq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset to start from.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Offset(offset int) *ScaCommentMessageQuery {
|
||||||
|
scmq.ctx.Offset = &offset
|
||||||
|
return scmq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unique configures the query builder to filter duplicate records on query.
|
||||||
|
// By default, unique is set to true, and can be disabled using this method.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Unique(unique bool) *ScaCommentMessageQuery {
|
||||||
|
scmq.ctx.Unique = &unique
|
||||||
|
return scmq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Order specifies how the records should be ordered.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Order(o ...scacommentmessage.OrderOption) *ScaCommentMessageQuery {
|
||||||
|
scmq.order = append(scmq.order, o...)
|
||||||
|
return scmq
|
||||||
|
}
|
||||||
|
|
||||||
|
// First returns the first ScaCommentMessage entity from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentMessage was found.
|
||||||
|
func (scmq *ScaCommentMessageQuery) First(ctx context.Context) (*ScaCommentMessage, error) {
|
||||||
|
nodes, err := scmq.Limit(1).All(setContextOp(ctx, scmq.ctx, ent.OpQueryFirst))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nil, &NotFoundError{scacommentmessage.Label}
|
||||||
|
}
|
||||||
|
return nodes[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstX is like First, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) FirstX(ctx context.Context) *ScaCommentMessage {
|
||||||
|
node, err := scmq.First(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstID returns the first ScaCommentMessage ID from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentMessage ID was found.
|
||||||
|
func (scmq *ScaCommentMessageQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = scmq.Limit(1).IDs(setContextOp(ctx, scmq.ctx, ent.OpQueryFirstID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(ids) == 0 {
|
||||||
|
err = &NotFoundError{scacommentmessage.Label}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return ids[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) FirstIDX(ctx context.Context) int64 {
|
||||||
|
id, err := scmq.FirstID(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only returns a single ScaCommentMessage entity found by the query, ensuring it only returns one.
|
||||||
|
// Returns a *NotSingularError when more than one ScaCommentMessage entity is found.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentMessage entities are found.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Only(ctx context.Context) (*ScaCommentMessage, error) {
|
||||||
|
nodes, err := scmq.Limit(2).All(setContextOp(ctx, scmq.ctx, ent.OpQueryOnly))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch len(nodes) {
|
||||||
|
case 1:
|
||||||
|
return nodes[0], nil
|
||||||
|
case 0:
|
||||||
|
return nil, &NotFoundError{scacommentmessage.Label}
|
||||||
|
default:
|
||||||
|
return nil, &NotSingularError{scacommentmessage.Label}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyX is like Only, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) OnlyX(ctx context.Context) *ScaCommentMessage {
|
||||||
|
node, err := scmq.Only(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyID is like Only, but returns the only ScaCommentMessage ID in the query.
|
||||||
|
// Returns a *NotSingularError when more than one ScaCommentMessage ID is found.
|
||||||
|
// Returns a *NotFoundError when no entities are found.
|
||||||
|
func (scmq *ScaCommentMessageQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = scmq.Limit(2).IDs(setContextOp(ctx, scmq.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch len(ids) {
|
||||||
|
case 1:
|
||||||
|
id = ids[0]
|
||||||
|
case 0:
|
||||||
|
err = &NotFoundError{scacommentmessage.Label}
|
||||||
|
default:
|
||||||
|
err = &NotSingularError{scacommentmessage.Label}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) OnlyIDX(ctx context.Context) int64 {
|
||||||
|
id, err := scmq.OnlyID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// All executes the query and returns a list of ScaCommentMessages.
|
||||||
|
func (scmq *ScaCommentMessageQuery) All(ctx context.Context) ([]*ScaCommentMessage, error) {
|
||||||
|
ctx = setContextOp(ctx, scmq.ctx, ent.OpQueryAll)
|
||||||
|
if err := scmq.prepareQuery(ctx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
qr := querierAll[[]*ScaCommentMessage, *ScaCommentMessageQuery]()
|
||||||
|
return withInterceptors[[]*ScaCommentMessage](ctx, scmq, qr, scmq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllX is like All, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) AllX(ctx context.Context) []*ScaCommentMessage {
|
||||||
|
nodes, err := scmq.All(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDs executes the query and returns a list of ScaCommentMessage IDs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||||
|
if scmq.ctx.Unique == nil && scmq.path != nil {
|
||||||
|
scmq.Unique(true)
|
||||||
|
}
|
||||||
|
ctx = setContextOp(ctx, scmq.ctx, ent.OpQueryIDs)
|
||||||
|
if err = scmq.Select(scacommentmessage.FieldID).Scan(ctx, &ids); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ids, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDsX is like IDs, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) IDsX(ctx context.Context) []int64 {
|
||||||
|
ids, err := scmq.IDs(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the count of the given query.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Count(ctx context.Context) (int, error) {
|
||||||
|
ctx = setContextOp(ctx, scmq.ctx, ent.OpQueryCount)
|
||||||
|
if err := scmq.prepareQuery(ctx); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return withInterceptors[int](ctx, scmq, querierCount[*ScaCommentMessageQuery](), scmq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CountX is like Count, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) CountX(ctx context.Context) int {
|
||||||
|
count, err := scmq.Count(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exist returns true if the query has elements in the graph.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Exist(ctx context.Context) (bool, error) {
|
||||||
|
ctx = setContextOp(ctx, scmq.ctx, ent.OpQueryExist)
|
||||||
|
switch _, err := scmq.FirstID(ctx); {
|
||||||
|
case IsNotFound(err):
|
||||||
|
return false, nil
|
||||||
|
case err != nil:
|
||||||
|
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||||
|
default:
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExistX is like Exist, but panics if an error occurs.
|
||||||
|
func (scmq *ScaCommentMessageQuery) ExistX(ctx context.Context) bool {
|
||||||
|
exist, err := scmq.Exist(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return exist
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone returns a duplicate of the ScaCommentMessageQuery builder, including all associated steps. It can be
|
||||||
|
// used to prepare common query builders and use them differently after the clone is made.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Clone() *ScaCommentMessageQuery {
|
||||||
|
if scmq == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &ScaCommentMessageQuery{
|
||||||
|
config: scmq.config,
|
||||||
|
ctx: scmq.ctx.Clone(),
|
||||||
|
order: append([]scacommentmessage.OrderOption{}, scmq.order...),
|
||||||
|
inters: append([]Interceptor{}, scmq.inters...),
|
||||||
|
predicates: append([]predicate.ScaCommentMessage{}, scmq.predicates...),
|
||||||
|
// clone intermediate query.
|
||||||
|
sql: scmq.sql.Clone(),
|
||||||
|
path: scmq.path,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupBy is used to group vertices by one or more fields/columns.
|
||||||
|
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
|
// Count int `json:"count,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaCommentMessage.Query().
|
||||||
|
// GroupBy(scacommentmessage.FieldCreatedAt).
|
||||||
|
// Aggregate(ent.Count()).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (scmq *ScaCommentMessageQuery) GroupBy(field string, fields ...string) *ScaCommentMessageGroupBy {
|
||||||
|
scmq.ctx.Fields = append([]string{field}, fields...)
|
||||||
|
grbuild := &ScaCommentMessageGroupBy{build: scmq}
|
||||||
|
grbuild.flds = &scmq.ctx.Fields
|
||||||
|
grbuild.label = scacommentmessage.Label
|
||||||
|
grbuild.scan = grbuild.Scan
|
||||||
|
return grbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows the selection one or more fields/columns for the given query,
|
||||||
|
// instead of selecting all fields in the entity.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaCommentMessage.Query().
|
||||||
|
// Select(scacommentmessage.FieldCreatedAt).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (scmq *ScaCommentMessageQuery) Select(fields ...string) *ScaCommentMessageSelect {
|
||||||
|
scmq.ctx.Fields = append(scmq.ctx.Fields, fields...)
|
||||||
|
sbuild := &ScaCommentMessageSelect{ScaCommentMessageQuery: scmq}
|
||||||
|
sbuild.label = scacommentmessage.Label
|
||||||
|
sbuild.flds, sbuild.scan = &scmq.ctx.Fields, sbuild.Scan
|
||||||
|
return sbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a ScaCommentMessageSelect configured with the given aggregations.
|
||||||
|
func (scmq *ScaCommentMessageQuery) Aggregate(fns ...AggregateFunc) *ScaCommentMessageSelect {
|
||||||
|
return scmq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmq *ScaCommentMessageQuery) prepareQuery(ctx context.Context) error {
|
||||||
|
for _, inter := range scmq.inters {
|
||||||
|
if inter == nil {
|
||||||
|
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||||
|
}
|
||||||
|
if trv, ok := inter.(Traverser); ok {
|
||||||
|
if err := trv.Traverse(ctx, scmq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, f := range scmq.ctx.Fields {
|
||||||
|
if !scacommentmessage.ValidColumn(f) {
|
||||||
|
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if scmq.path != nil {
|
||||||
|
prev, err := scmq.path(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
scmq.sql = prev
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmq *ScaCommentMessageQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ScaCommentMessage, error) {
|
||||||
|
var (
|
||||||
|
nodes = []*ScaCommentMessage{}
|
||||||
|
_spec = scmq.querySpec()
|
||||||
|
)
|
||||||
|
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||||
|
return (*ScaCommentMessage).scanValues(nil, columns)
|
||||||
|
}
|
||||||
|
_spec.Assign = func(columns []string, values []any) error {
|
||||||
|
node := &ScaCommentMessage{config: scmq.config}
|
||||||
|
nodes = append(nodes, node)
|
||||||
|
return node.assignValues(columns, values)
|
||||||
|
}
|
||||||
|
for i := range hooks {
|
||||||
|
hooks[i](ctx, _spec)
|
||||||
|
}
|
||||||
|
if err := sqlgraph.QueryNodes(ctx, scmq.driver, _spec); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmq *ScaCommentMessageQuery) sqlCount(ctx context.Context) (int, error) {
|
||||||
|
_spec := scmq.querySpec()
|
||||||
|
_spec.Node.Columns = scmq.ctx.Fields
|
||||||
|
if len(scmq.ctx.Fields) > 0 {
|
||||||
|
_spec.Unique = scmq.ctx.Unique != nil && *scmq.ctx.Unique
|
||||||
|
}
|
||||||
|
return sqlgraph.CountNodes(ctx, scmq.driver, _spec)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmq *ScaCommentMessageQuery) querySpec() *sqlgraph.QuerySpec {
|
||||||
|
_spec := sqlgraph.NewQuerySpec(scacommentmessage.Table, scacommentmessage.Columns, sqlgraph.NewFieldSpec(scacommentmessage.FieldID, field.TypeInt64))
|
||||||
|
_spec.From = scmq.sql
|
||||||
|
if unique := scmq.ctx.Unique; unique != nil {
|
||||||
|
_spec.Unique = *unique
|
||||||
|
} else if scmq.path != nil {
|
||||||
|
_spec.Unique = true
|
||||||
|
}
|
||||||
|
if fields := scmq.ctx.Fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scacommentmessage.FieldID)
|
||||||
|
for i := range fields {
|
||||||
|
if fields[i] != scacommentmessage.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := scmq.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if limit := scmq.ctx.Limit; limit != nil {
|
||||||
|
_spec.Limit = *limit
|
||||||
|
}
|
||||||
|
if offset := scmq.ctx.Offset; offset != nil {
|
||||||
|
_spec.Offset = *offset
|
||||||
|
}
|
||||||
|
if ps := scmq.order; len(ps) > 0 {
|
||||||
|
_spec.Order = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmq *ScaCommentMessageQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||||
|
builder := sql.Dialect(scmq.driver.Dialect())
|
||||||
|
t1 := builder.Table(scacommentmessage.Table)
|
||||||
|
columns := scmq.ctx.Fields
|
||||||
|
if len(columns) == 0 {
|
||||||
|
columns = scacommentmessage.Columns
|
||||||
|
}
|
||||||
|
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||||
|
if scmq.sql != nil {
|
||||||
|
selector = scmq.sql
|
||||||
|
selector.Select(selector.Columns(columns...)...)
|
||||||
|
}
|
||||||
|
if scmq.ctx.Unique != nil && *scmq.ctx.Unique {
|
||||||
|
selector.Distinct()
|
||||||
|
}
|
||||||
|
for _, p := range scmq.predicates {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
for _, p := range scmq.order {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
if offset := scmq.ctx.Offset; offset != nil {
|
||||||
|
// limit is mandatory for offset clause. We start
|
||||||
|
// with default value, and override it below if needed.
|
||||||
|
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||||
|
}
|
||||||
|
if limit := scmq.ctx.Limit; limit != nil {
|
||||||
|
selector.Limit(*limit)
|
||||||
|
}
|
||||||
|
return selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessageGroupBy is the group-by builder for ScaCommentMessage entities.
|
||||||
|
type ScaCommentMessageGroupBy struct {
|
||||||
|
selector
|
||||||
|
build *ScaCommentMessageQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the group-by query.
|
||||||
|
func (scmgb *ScaCommentMessageGroupBy) Aggregate(fns ...AggregateFunc) *ScaCommentMessageGroupBy {
|
||||||
|
scmgb.fns = append(scmgb.fns, fns...)
|
||||||
|
return scmgb
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (scmgb *ScaCommentMessageGroupBy) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, scmgb.build.ctx, ent.OpQueryGroupBy)
|
||||||
|
if err := scmgb.build.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaCommentMessageQuery, *ScaCommentMessageGroupBy](ctx, scmgb.build, scmgb, scmgb.build.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmgb *ScaCommentMessageGroupBy) sqlScan(ctx context.Context, root *ScaCommentMessageQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx).Select()
|
||||||
|
aggregation := make([]string, 0, len(scmgb.fns))
|
||||||
|
for _, fn := range scmgb.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
|
columns := make([]string, 0, len(*scmgb.flds)+len(scmgb.fns))
|
||||||
|
for _, f := range *scmgb.flds {
|
||||||
|
columns = append(columns, selector.C(f))
|
||||||
|
}
|
||||||
|
columns = append(columns, aggregation...)
|
||||||
|
selector.Select(columns...)
|
||||||
|
}
|
||||||
|
selector.GroupBy(selector.Columns(*scmgb.flds...)...)
|
||||||
|
if err := selector.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := scmgb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessageSelect is the builder for selecting fields of ScaCommentMessage entities.
|
||||||
|
type ScaCommentMessageSelect struct {
|
||||||
|
*ScaCommentMessageQuery
|
||||||
|
selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (scms *ScaCommentMessageSelect) Aggregate(fns ...AggregateFunc) *ScaCommentMessageSelect {
|
||||||
|
scms.fns = append(scms.fns, fns...)
|
||||||
|
return scms
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (scms *ScaCommentMessageSelect) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, scms.ctx, ent.OpQuerySelect)
|
||||||
|
if err := scms.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaCommentMessageQuery, *ScaCommentMessageSelect](ctx, scms.ScaCommentMessageQuery, scms, scms.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scms *ScaCommentMessageSelect) sqlScan(ctx context.Context, root *ScaCommentMessageQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx)
|
||||||
|
aggregation := make([]string, 0, len(scms.fns))
|
||||||
|
for _, fn := range scms.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
switch n := len(*scms.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
selector.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
selector.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := scms.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
518
app/core/api/repository/mysql/ent/scacommentmessage_update.go
Normal file
518
app/core/api/repository/mysql/ent/scacommentmessage_update.go
Normal file
@@ -0,0 +1,518 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentmessage"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentMessageUpdate is the builder for updating ScaCommentMessage entities.
|
||||||
|
type ScaCommentMessageUpdate struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaCommentMessageMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentMessageUpdate builder.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) Where(ps ...predicate.ScaCommentMessage) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.Where(ps...)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUpdatedAt sets the "updated_at" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetUpdatedAt(t time.Time) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.SetUpdatedAt(t)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) ClearUpdatedAt() *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.ClearUpdatedAt()
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDeleted sets the "deleted" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetDeleted(i int8) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.ResetDeleted()
|
||||||
|
scmu.mutation.SetDeleted(i)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetNillableDeleted(i *int8) *ScaCommentMessageUpdate {
|
||||||
|
if i != nil {
|
||||||
|
scmu.SetDeleted(*i)
|
||||||
|
}
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDeleted adds i to the "deleted" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) AddDeleted(i int8) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.AddDeleted(i)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicID sets the "topic_id" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetTopicID(s string) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.SetTopicID(s)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableTopicID sets the "topic_id" field if the given value is not nil.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetNillableTopicID(s *string) *ScaCommentMessageUpdate {
|
||||||
|
if s != nil {
|
||||||
|
scmu.SetTopicID(*s)
|
||||||
|
}
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFromID sets the "from_id" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetFromID(s string) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.SetFromID(s)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableFromID sets the "from_id" field if the given value is not nil.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetNillableFromID(s *string) *ScaCommentMessageUpdate {
|
||||||
|
if s != nil {
|
||||||
|
scmu.SetFromID(*s)
|
||||||
|
}
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetToID sets the "to_id" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetToID(s string) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.SetToID(s)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableToID sets the "to_id" field if the given value is not nil.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetNillableToID(s *string) *ScaCommentMessageUpdate {
|
||||||
|
if s != nil {
|
||||||
|
scmu.SetToID(*s)
|
||||||
|
}
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContent sets the "content" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetContent(s string) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.SetContent(s)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableContent sets the "content" field if the given value is not nil.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetNillableContent(s *string) *ScaCommentMessageUpdate {
|
||||||
|
if s != nil {
|
||||||
|
scmu.SetContent(*s)
|
||||||
|
}
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIsRead sets the "is_read" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetIsRead(i int) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.ResetIsRead()
|
||||||
|
scmu.mutation.SetIsRead(i)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableIsRead sets the "is_read" field if the given value is not nil.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SetNillableIsRead(i *int) *ScaCommentMessageUpdate {
|
||||||
|
if i != nil {
|
||||||
|
scmu.SetIsRead(*i)
|
||||||
|
}
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddIsRead adds i to the "is_read" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) AddIsRead(i int) *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.AddIsRead(i)
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearIsRead clears the value of the "is_read" field.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) ClearIsRead() *ScaCommentMessageUpdate {
|
||||||
|
scmu.mutation.ClearIsRead()
|
||||||
|
return scmu
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaCommentMessageMutation object of the builder.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) Mutation() *ScaCommentMessageMutation {
|
||||||
|
return scmu.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) Save(ctx context.Context) (int, error) {
|
||||||
|
scmu.defaults()
|
||||||
|
return withHooks(ctx, scmu.sqlSave, scmu.mutation, scmu.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) SaveX(ctx context.Context) int {
|
||||||
|
affected, err := scmu.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return affected
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) Exec(ctx context.Context) error {
|
||||||
|
_, err := scmu.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) ExecX(ctx context.Context) {
|
||||||
|
if err := scmu.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaults sets the default values of the builder before save.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) defaults() {
|
||||||
|
if _, ok := scmu.mutation.UpdatedAt(); !ok && !scmu.mutation.UpdatedAtCleared() {
|
||||||
|
v := scacommentmessage.UpdateDefaultUpdatedAt()
|
||||||
|
scmu.mutation.SetUpdatedAt(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (scmu *ScaCommentMessageUpdate) check() error {
|
||||||
|
if v, ok := scmu.mutation.Deleted(); ok {
|
||||||
|
if err := scacommentmessage.DeletedValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaCommentMessage.deleted": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmu *ScaCommentMessageUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
|
if err := scmu.check(); err != nil {
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scacommentmessage.Table, scacommentmessage.Columns, sqlgraph.NewFieldSpec(scacommentmessage.FieldID, field.TypeInt64))
|
||||||
|
if ps := scmu.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.UpdatedAt(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldUpdatedAt, field.TypeTime, value)
|
||||||
|
}
|
||||||
|
if scmu.mutation.UpdatedAtCleared() {
|
||||||
|
_spec.ClearField(scacommentmessage.FieldUpdatedAt, field.TypeTime)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.Deleted(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldDeleted, field.TypeInt8, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.AddedDeleted(); ok {
|
||||||
|
_spec.AddField(scacommentmessage.FieldDeleted, field.TypeInt8, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.TopicID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldTopicID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.FromID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldFromID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.ToID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldToID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.Content(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldContent, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.IsRead(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldIsRead, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmu.mutation.AddedIsRead(); ok {
|
||||||
|
_spec.AddField(scacommentmessage.FieldIsRead, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if scmu.mutation.IsReadCleared() {
|
||||||
|
_spec.ClearField(scacommentmessage.FieldIsRead, field.TypeInt)
|
||||||
|
}
|
||||||
|
if n, err = sqlgraph.UpdateNodes(ctx, scmu.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scacommentmessage.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
scmu.mutation.done = true
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentMessageUpdateOne is the builder for updating a single ScaCommentMessage entity.
|
||||||
|
type ScaCommentMessageUpdateOne struct {
|
||||||
|
config
|
||||||
|
fields []string
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaCommentMessageMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUpdatedAt sets the "updated_at" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetUpdatedAt(t time.Time) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.SetUpdatedAt(t)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearUpdatedAt clears the value of the "updated_at" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) ClearUpdatedAt() *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.ClearUpdatedAt()
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDeleted sets the "deleted" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetDeleted(i int8) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.ResetDeleted()
|
||||||
|
scmuo.mutation.SetDeleted(i)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetNillableDeleted(i *int8) *ScaCommentMessageUpdateOne {
|
||||||
|
if i != nil {
|
||||||
|
scmuo.SetDeleted(*i)
|
||||||
|
}
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddDeleted adds i to the "deleted" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) AddDeleted(i int8) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.AddDeleted(i)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicID sets the "topic_id" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetTopicID(s string) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.SetTopicID(s)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableTopicID sets the "topic_id" field if the given value is not nil.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetNillableTopicID(s *string) *ScaCommentMessageUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
scmuo.SetTopicID(*s)
|
||||||
|
}
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFromID sets the "from_id" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetFromID(s string) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.SetFromID(s)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableFromID sets the "from_id" field if the given value is not nil.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetNillableFromID(s *string) *ScaCommentMessageUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
scmuo.SetFromID(*s)
|
||||||
|
}
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetToID sets the "to_id" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetToID(s string) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.SetToID(s)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableToID sets the "to_id" field if the given value is not nil.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetNillableToID(s *string) *ScaCommentMessageUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
scmuo.SetToID(*s)
|
||||||
|
}
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContent sets the "content" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetContent(s string) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.SetContent(s)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableContent sets the "content" field if the given value is not nil.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetNillableContent(s *string) *ScaCommentMessageUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
scmuo.SetContent(*s)
|
||||||
|
}
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetIsRead sets the "is_read" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetIsRead(i int) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.ResetIsRead()
|
||||||
|
scmuo.mutation.SetIsRead(i)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableIsRead sets the "is_read" field if the given value is not nil.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SetNillableIsRead(i *int) *ScaCommentMessageUpdateOne {
|
||||||
|
if i != nil {
|
||||||
|
scmuo.SetIsRead(*i)
|
||||||
|
}
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddIsRead adds i to the "is_read" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) AddIsRead(i int) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.AddIsRead(i)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearIsRead clears the value of the "is_read" field.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) ClearIsRead() *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.ClearIsRead()
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaCommentMessageMutation object of the builder.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) Mutation() *ScaCommentMessageMutation {
|
||||||
|
return scmuo.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentMessageUpdate builder.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) Where(ps ...predicate.ScaCommentMessage) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.mutation.Where(ps...)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||||
|
// The default is selecting all fields defined in the entity schema.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) Select(field string, fields ...string) *ScaCommentMessageUpdateOne {
|
||||||
|
scmuo.fields = append([]string{field}, fields...)
|
||||||
|
return scmuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the updated ScaCommentMessage entity.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) Save(ctx context.Context) (*ScaCommentMessage, error) {
|
||||||
|
scmuo.defaults()
|
||||||
|
return withHooks(ctx, scmuo.sqlSave, scmuo.mutation, scmuo.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) SaveX(ctx context.Context) *ScaCommentMessage {
|
||||||
|
node, err := scmuo.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query on the entity.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) Exec(ctx context.Context) error {
|
||||||
|
_, err := scmuo.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) ExecX(ctx context.Context) {
|
||||||
|
if err := scmuo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaults sets the default values of the builder before save.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) defaults() {
|
||||||
|
if _, ok := scmuo.mutation.UpdatedAt(); !ok && !scmuo.mutation.UpdatedAtCleared() {
|
||||||
|
v := scacommentmessage.UpdateDefaultUpdatedAt()
|
||||||
|
scmuo.mutation.SetUpdatedAt(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) check() error {
|
||||||
|
if v, ok := scmuo.mutation.Deleted(); ok {
|
||||||
|
if err := scacommentmessage.DeletedValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaCommentMessage.deleted": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scmuo *ScaCommentMessageUpdateOne) sqlSave(ctx context.Context) (_node *ScaCommentMessage, err error) {
|
||||||
|
if err := scmuo.check(); err != nil {
|
||||||
|
return _node, err
|
||||||
|
}
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scacommentmessage.Table, scacommentmessage.Columns, sqlgraph.NewFieldSpec(scacommentmessage.FieldID, field.TypeInt64))
|
||||||
|
id, ok := scmuo.mutation.ID()
|
||||||
|
if !ok {
|
||||||
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ScaCommentMessage.id" for update`)}
|
||||||
|
}
|
||||||
|
_spec.Node.ID.Value = id
|
||||||
|
if fields := scmuo.fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scacommentmessage.FieldID)
|
||||||
|
for _, f := range fields {
|
||||||
|
if !scacommentmessage.ValidColumn(f) {
|
||||||
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
if f != scacommentmessage.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := scmuo.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.UpdatedAt(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldUpdatedAt, field.TypeTime, value)
|
||||||
|
}
|
||||||
|
if scmuo.mutation.UpdatedAtCleared() {
|
||||||
|
_spec.ClearField(scacommentmessage.FieldUpdatedAt, field.TypeTime)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.Deleted(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldDeleted, field.TypeInt8, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.AddedDeleted(); ok {
|
||||||
|
_spec.AddField(scacommentmessage.FieldDeleted, field.TypeInt8, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.TopicID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldTopicID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.FromID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldFromID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.ToID(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldToID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.Content(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldContent, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.IsRead(); ok {
|
||||||
|
_spec.SetField(scacommentmessage.FieldIsRead, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if value, ok := scmuo.mutation.AddedIsRead(); ok {
|
||||||
|
_spec.AddField(scacommentmessage.FieldIsRead, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if scmuo.mutation.IsReadCleared() {
|
||||||
|
_spec.ClearField(scacommentmessage.FieldIsRead, field.TypeInt)
|
||||||
|
}
|
||||||
|
_node = &ScaCommentMessage{config: scmuo.config}
|
||||||
|
_spec.Assign = _node.assignValues
|
||||||
|
_spec.ScanValues = _node.scanValues
|
||||||
|
if err = sqlgraph.UpdateNode(ctx, scmuo.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scacommentmessage.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
scmuo.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
305
app/core/api/repository/mysql/ent/scacommentreply.go
Normal file
305
app/core/api/repository/mysql/ent/scacommentreply.go
Normal file
@@ -0,0 +1,305 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 评论回复表
|
||||||
|
type ScaCommentReply struct {
|
||||||
|
config `json:"-"`
|
||||||
|
// ID of the ent.
|
||||||
|
// 主键id
|
||||||
|
ID int64 `json:"id,omitempty"`
|
||||||
|
// 创建时间
|
||||||
|
CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
|
// 更新时间
|
||||||
|
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
||||||
|
// 是否删除 0 未删除 1 已删除
|
||||||
|
Deleted int8 `json:"deleted,omitempty"`
|
||||||
|
// 评论用户id
|
||||||
|
UserID string `json:"user_id,omitempty"`
|
||||||
|
// 评论话题id
|
||||||
|
TopicID string `json:"topic_id,omitempty"`
|
||||||
|
// 话题类型
|
||||||
|
TopicType int `json:"topic_type,omitempty"`
|
||||||
|
// 评论内容
|
||||||
|
Content string `json:"content,omitempty"`
|
||||||
|
// 评论类型 0评论 1 回复
|
||||||
|
CommentType int `json:"comment_type,omitempty"`
|
||||||
|
// 回复子评论ID
|
||||||
|
ReplyTo int64 `json:"reply_to,omitempty"`
|
||||||
|
// 回复父评论Id
|
||||||
|
ReplyID int64 `json:"reply_id,omitempty"`
|
||||||
|
// 回复人id
|
||||||
|
ReplyUser string `json:"reply_user,omitempty"`
|
||||||
|
// 评论回复是否作者 0否 1是
|
||||||
|
Author int `json:"author,omitempty"`
|
||||||
|
// 点赞数
|
||||||
|
Likes int64 `json:"likes,omitempty"`
|
||||||
|
// 回复数量
|
||||||
|
ReplyCount int64 `json:"reply_count,omitempty"`
|
||||||
|
// 浏览器
|
||||||
|
Browser string `json:"browser,omitempty"`
|
||||||
|
// 操作系统
|
||||||
|
OperatingSystem string `json:"operating_system,omitempty"`
|
||||||
|
// IP地址
|
||||||
|
CommentIP string `json:"comment_ip,omitempty"`
|
||||||
|
// 地址
|
||||||
|
Location string `json:"location,omitempty"`
|
||||||
|
// 设备信息
|
||||||
|
Agent string `json:"agent,omitempty"`
|
||||||
|
selectValues sql.SelectValues
|
||||||
|
}
|
||||||
|
|
||||||
|
// scanValues returns the types for scanning values from sql.Rows.
|
||||||
|
func (*ScaCommentReply) scanValues(columns []string) ([]any, error) {
|
||||||
|
values := make([]any, len(columns))
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scacommentreply.FieldID, scacommentreply.FieldDeleted, scacommentreply.FieldTopicType, scacommentreply.FieldCommentType, scacommentreply.FieldReplyTo, scacommentreply.FieldReplyID, scacommentreply.FieldAuthor, scacommentreply.FieldLikes, scacommentreply.FieldReplyCount:
|
||||||
|
values[i] = new(sql.NullInt64)
|
||||||
|
case scacommentreply.FieldUserID, scacommentreply.FieldTopicID, scacommentreply.FieldContent, scacommentreply.FieldReplyUser, scacommentreply.FieldBrowser, scacommentreply.FieldOperatingSystem, scacommentreply.FieldCommentIP, scacommentreply.FieldLocation, scacommentreply.FieldAgent:
|
||||||
|
values[i] = new(sql.NullString)
|
||||||
|
case scacommentreply.FieldCreatedAt, scacommentreply.FieldUpdatedAt:
|
||||||
|
values[i] = new(sql.NullTime)
|
||||||
|
default:
|
||||||
|
values[i] = new(sql.UnknownType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||||
|
// to the ScaCommentReply fields.
|
||||||
|
func (scr *ScaCommentReply) assignValues(columns []string, values []any) error {
|
||||||
|
if m, n := len(values), len(columns); m < n {
|
||||||
|
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||||
|
}
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scacommentreply.FieldID:
|
||||||
|
value, ok := values[i].(*sql.NullInt64)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field id", value)
|
||||||
|
}
|
||||||
|
scr.ID = int64(value.Int64)
|
||||||
|
case scacommentreply.FieldCreatedAt:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.CreatedAt = value.Time
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldUpdatedAt:
|
||||||
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.UpdatedAt = value.Time
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldDeleted:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field deleted", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.Deleted = int8(value.Int64)
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldUserID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field user_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.UserID = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldTopicID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field topic_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.TopicID = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldTopicType:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field topic_type", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.TopicType = int(value.Int64)
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldContent:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field content", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.Content = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldCommentType:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field comment_type", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.CommentType = int(value.Int64)
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldReplyTo:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field reply_to", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.ReplyTo = value.Int64
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldReplyID:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field reply_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.ReplyID = value.Int64
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldReplyUser:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field reply_user", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.ReplyUser = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldAuthor:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field author", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.Author = int(value.Int64)
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldLikes:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field likes", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.Likes = value.Int64
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldReplyCount:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field reply_count", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.ReplyCount = value.Int64
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldBrowser:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field browser", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.Browser = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldOperatingSystem:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field operating_system", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.OperatingSystem = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldCommentIP:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field comment_ip", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.CommentIP = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldLocation:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field location", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.Location = value.String
|
||||||
|
}
|
||||||
|
case scacommentreply.FieldAgent:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field agent", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
scr.Agent = value.String
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
scr.selectValues.Set(columns[i], values[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value returns the ent.Value that was dynamically selected and assigned to the ScaCommentReply.
|
||||||
|
// This includes values selected through modifiers, order, etc.
|
||||||
|
func (scr *ScaCommentReply) Value(name string) (ent.Value, error) {
|
||||||
|
return scr.selectValues.Get(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns a builder for updating this ScaCommentReply.
|
||||||
|
// Note that you need to call ScaCommentReply.Unwrap() before calling this method if this ScaCommentReply
|
||||||
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||||
|
func (scr *ScaCommentReply) Update() *ScaCommentReplyUpdateOne {
|
||||||
|
return NewScaCommentReplyClient(scr.config).UpdateOne(scr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap unwraps the ScaCommentReply entity that was returned from a transaction after it was closed,
|
||||||
|
// so that all future queries will be executed through the driver which created the transaction.
|
||||||
|
func (scr *ScaCommentReply) Unwrap() *ScaCommentReply {
|
||||||
|
_tx, ok := scr.config.driver.(*txDriver)
|
||||||
|
if !ok {
|
||||||
|
panic("ent: ScaCommentReply is not a transactional entity")
|
||||||
|
}
|
||||||
|
scr.config.driver = _tx.drv
|
||||||
|
return scr
|
||||||
|
}
|
||||||
|
|
||||||
|
// String implements the fmt.Stringer.
|
||||||
|
func (scr *ScaCommentReply) String() string {
|
||||||
|
var builder strings.Builder
|
||||||
|
builder.WriteString("ScaCommentReply(")
|
||||||
|
builder.WriteString(fmt.Sprintf("id=%v, ", scr.ID))
|
||||||
|
builder.WriteString("created_at=")
|
||||||
|
builder.WriteString(scr.CreatedAt.Format(time.ANSIC))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("updated_at=")
|
||||||
|
builder.WriteString(scr.UpdatedAt.Format(time.ANSIC))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("deleted=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.Deleted))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("user_id=")
|
||||||
|
builder.WriteString(scr.UserID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("topic_id=")
|
||||||
|
builder.WriteString(scr.TopicID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("topic_type=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.TopicType))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("content=")
|
||||||
|
builder.WriteString(scr.Content)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("comment_type=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.CommentType))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("reply_to=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.ReplyTo))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("reply_id=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.ReplyID))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("reply_user=")
|
||||||
|
builder.WriteString(scr.ReplyUser)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("author=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.Author))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("likes=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.Likes))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("reply_count=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", scr.ReplyCount))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("browser=")
|
||||||
|
builder.WriteString(scr.Browser)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("operating_system=")
|
||||||
|
builder.WriteString(scr.OperatingSystem)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("comment_ip=")
|
||||||
|
builder.WriteString(scr.CommentIP)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("location=")
|
||||||
|
builder.WriteString(scr.Location)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("agent=")
|
||||||
|
builder.WriteString(scr.Agent)
|
||||||
|
builder.WriteByte(')')
|
||||||
|
return builder.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentReplies is a parsable slice of ScaCommentReply.
|
||||||
|
type ScaCommentReplies []*ScaCommentReply
|
||||||
@@ -0,0 +1,212 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scacommentreply
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Label holds the string label denoting the scacommentreply type in the database.
|
||||||
|
Label = "sca_comment_reply"
|
||||||
|
// FieldID holds the string denoting the id field in the database.
|
||||||
|
FieldID = "id"
|
||||||
|
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||||
|
FieldCreatedAt = "created_at"
|
||||||
|
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
||||||
|
FieldUpdatedAt = "updated_at"
|
||||||
|
// FieldDeleted holds the string denoting the deleted field in the database.
|
||||||
|
FieldDeleted = "deleted"
|
||||||
|
// FieldUserID holds the string denoting the user_id field in the database.
|
||||||
|
FieldUserID = "user_id"
|
||||||
|
// FieldTopicID holds the string denoting the topic_id field in the database.
|
||||||
|
FieldTopicID = "topic_id"
|
||||||
|
// FieldTopicType holds the string denoting the topic_type field in the database.
|
||||||
|
FieldTopicType = "topic_type"
|
||||||
|
// FieldContent holds the string denoting the content field in the database.
|
||||||
|
FieldContent = "content"
|
||||||
|
// FieldCommentType holds the string denoting the comment_type field in the database.
|
||||||
|
FieldCommentType = "comment_type"
|
||||||
|
// FieldReplyTo holds the string denoting the reply_to field in the database.
|
||||||
|
FieldReplyTo = "reply_to"
|
||||||
|
// FieldReplyID holds the string denoting the reply_id field in the database.
|
||||||
|
FieldReplyID = "reply_id"
|
||||||
|
// FieldReplyUser holds the string denoting the reply_user field in the database.
|
||||||
|
FieldReplyUser = "reply_user"
|
||||||
|
// FieldAuthor holds the string denoting the author field in the database.
|
||||||
|
FieldAuthor = "author"
|
||||||
|
// FieldLikes holds the string denoting the likes field in the database.
|
||||||
|
FieldLikes = "likes"
|
||||||
|
// FieldReplyCount holds the string denoting the reply_count field in the database.
|
||||||
|
FieldReplyCount = "reply_count"
|
||||||
|
// FieldBrowser holds the string denoting the browser field in the database.
|
||||||
|
FieldBrowser = "browser"
|
||||||
|
// FieldOperatingSystem holds the string denoting the operating_system field in the database.
|
||||||
|
FieldOperatingSystem = "operating_system"
|
||||||
|
// FieldCommentIP holds the string denoting the comment_ip field in the database.
|
||||||
|
FieldCommentIP = "comment_ip"
|
||||||
|
// FieldLocation holds the string denoting the location field in the database.
|
||||||
|
FieldLocation = "location"
|
||||||
|
// FieldAgent holds the string denoting the agent field in the database.
|
||||||
|
FieldAgent = "agent"
|
||||||
|
// Table holds the table name of the scacommentreply in the database.
|
||||||
|
Table = "sca_comment_reply"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Columns holds all SQL columns for scacommentreply fields.
|
||||||
|
var Columns = []string{
|
||||||
|
FieldID,
|
||||||
|
FieldCreatedAt,
|
||||||
|
FieldUpdatedAt,
|
||||||
|
FieldDeleted,
|
||||||
|
FieldUserID,
|
||||||
|
FieldTopicID,
|
||||||
|
FieldTopicType,
|
||||||
|
FieldContent,
|
||||||
|
FieldCommentType,
|
||||||
|
FieldReplyTo,
|
||||||
|
FieldReplyID,
|
||||||
|
FieldReplyUser,
|
||||||
|
FieldAuthor,
|
||||||
|
FieldLikes,
|
||||||
|
FieldReplyCount,
|
||||||
|
FieldBrowser,
|
||||||
|
FieldOperatingSystem,
|
||||||
|
FieldCommentIP,
|
||||||
|
FieldLocation,
|
||||||
|
FieldAgent,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
|
func ValidColumn(column string) bool {
|
||||||
|
for i := range Columns {
|
||||||
|
if column == Columns[i] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||||
|
DefaultCreatedAt func() time.Time
|
||||||
|
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||||
|
UpdateDefaultUpdatedAt func() time.Time
|
||||||
|
// DefaultDeleted holds the default value on creation for the "deleted" field.
|
||||||
|
DefaultDeleted int8
|
||||||
|
// DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
|
||||||
|
DeletedValidator func(int8) error
|
||||||
|
// DefaultAuthor holds the default value on creation for the "author" field.
|
||||||
|
DefaultAuthor int
|
||||||
|
// DefaultLikes holds the default value on creation for the "likes" field.
|
||||||
|
DefaultLikes int64
|
||||||
|
// DefaultReplyCount holds the default value on creation for the "reply_count" field.
|
||||||
|
DefaultReplyCount int64
|
||||||
|
// AgentValidator is a validator for the "agent" field. It is called by the builders before save.
|
||||||
|
AgentValidator func(string) error
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderOption defines the ordering options for the ScaCommentReply queries.
|
||||||
|
type OrderOption func(*sql.Selector)
|
||||||
|
|
||||||
|
// ByID orders the results by the id field.
|
||||||
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByCreatedAt orders the results by the created_at field.
|
||||||
|
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByUpdatedAt orders the results by the updated_at field.
|
||||||
|
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByDeleted orders the results by the deleted field.
|
||||||
|
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByUserID orders the results by the user_id field.
|
||||||
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByTopicID orders the results by the topic_id field.
|
||||||
|
func ByTopicID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldTopicID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByTopicType orders the results by the topic_type field.
|
||||||
|
func ByTopicType(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldTopicType, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByContent orders the results by the content field.
|
||||||
|
func ByContent(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldContent, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByCommentType orders the results by the comment_type field.
|
||||||
|
func ByCommentType(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCommentType, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByReplyTo orders the results by the reply_to field.
|
||||||
|
func ByReplyTo(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldReplyTo, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByReplyID orders the results by the reply_id field.
|
||||||
|
func ByReplyID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldReplyID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByReplyUser orders the results by the reply_user field.
|
||||||
|
func ByReplyUser(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldReplyUser, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByAuthor orders the results by the author field.
|
||||||
|
func ByAuthor(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldAuthor, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByLikes orders the results by the likes field.
|
||||||
|
func ByLikes(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldLikes, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByReplyCount orders the results by the reply_count field.
|
||||||
|
func ByReplyCount(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldReplyCount, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByBrowser orders the results by the browser field.
|
||||||
|
func ByBrowser(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldBrowser, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByOperatingSystem orders the results by the operating_system field.
|
||||||
|
func ByOperatingSystem(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldOperatingSystem, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByCommentIP orders the results by the comment_ip field.
|
||||||
|
func ByCommentIP(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldCommentIP, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByLocation orders the results by the location field.
|
||||||
|
func ByLocation(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldLocation, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByAgent orders the results by the agent field.
|
||||||
|
func ByAgent(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldAgent, opts...).ToFunc()
|
||||||
|
}
|
||||||
1210
app/core/api/repository/mysql/ent/scacommentreply/where.go
Normal file
1210
app/core/api/repository/mysql/ent/scacommentreply/where.go
Normal file
File diff suppressed because it is too large
Load Diff
520
app/core/api/repository/mysql/ent/scacommentreply_create.go
Normal file
520
app/core/api/repository/mysql/ent/scacommentreply_create.go
Normal file
@@ -0,0 +1,520 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentReplyCreate is the builder for creating a ScaCommentReply entity.
|
||||||
|
type ScaCommentReplyCreate struct {
|
||||||
|
config
|
||||||
|
mutation *ScaCommentReplyMutation
|
||||||
|
hooks []Hook
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCreatedAt sets the "created_at" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetCreatedAt(t time.Time) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetCreatedAt(t)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableCreatedAt(t *time.Time) *ScaCommentReplyCreate {
|
||||||
|
if t != nil {
|
||||||
|
scrc.SetCreatedAt(*t)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUpdatedAt sets the "updated_at" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetUpdatedAt(t time.Time) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetUpdatedAt(t)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableUpdatedAt(t *time.Time) *ScaCommentReplyCreate {
|
||||||
|
if t != nil {
|
||||||
|
scrc.SetUpdatedAt(*t)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetDeleted sets the "deleted" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetDeleted(i int8) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetDeleted(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableDeleted(i *int8) *ScaCommentReplyCreate {
|
||||||
|
if i != nil {
|
||||||
|
scrc.SetDeleted(*i)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUserID sets the "user_id" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetUserID(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetUserID(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicID sets the "topic_id" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetTopicID(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetTopicID(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetTopicType sets the "topic_type" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetTopicType(i int) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetTopicType(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContent sets the "content" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetContent(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetContent(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCommentType sets the "comment_type" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetCommentType(i int) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetCommentType(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReplyTo sets the "reply_to" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetReplyTo(i int64) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetReplyTo(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableReplyTo sets the "reply_to" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableReplyTo(i *int64) *ScaCommentReplyCreate {
|
||||||
|
if i != nil {
|
||||||
|
scrc.SetReplyTo(*i)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReplyID sets the "reply_id" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetReplyID(i int64) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetReplyID(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableReplyID sets the "reply_id" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableReplyID(i *int64) *ScaCommentReplyCreate {
|
||||||
|
if i != nil {
|
||||||
|
scrc.SetReplyID(*i)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReplyUser sets the "reply_user" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetReplyUser(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetReplyUser(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableReplyUser sets the "reply_user" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableReplyUser(s *string) *ScaCommentReplyCreate {
|
||||||
|
if s != nil {
|
||||||
|
scrc.SetReplyUser(*s)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAuthor sets the "author" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetAuthor(i int) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetAuthor(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableAuthor sets the "author" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableAuthor(i *int) *ScaCommentReplyCreate {
|
||||||
|
if i != nil {
|
||||||
|
scrc.SetAuthor(*i)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLikes sets the "likes" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetLikes(i int64) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetLikes(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLikes sets the "likes" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableLikes(i *int64) *ScaCommentReplyCreate {
|
||||||
|
if i != nil {
|
||||||
|
scrc.SetLikes(*i)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetReplyCount sets the "reply_count" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetReplyCount(i int64) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetReplyCount(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableReplyCount sets the "reply_count" field if the given value is not nil.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetNillableReplyCount(i *int64) *ScaCommentReplyCreate {
|
||||||
|
if i != nil {
|
||||||
|
scrc.SetReplyCount(*i)
|
||||||
|
}
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetBrowser sets the "browser" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetBrowser(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetBrowser(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOperatingSystem sets the "operating_system" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetOperatingSystem(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetOperatingSystem(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetCommentIP sets the "comment_ip" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetCommentIP(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetCommentIP(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLocation sets the "location" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetLocation(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetLocation(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetAgent sets the "agent" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetAgent(s string) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetAgent(s)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID sets the "id" field.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SetID(i int64) *ScaCommentReplyCreate {
|
||||||
|
scrc.mutation.SetID(i)
|
||||||
|
return scrc
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaCommentReplyMutation object of the builder.
|
||||||
|
func (scrc *ScaCommentReplyCreate) Mutation() *ScaCommentReplyMutation {
|
||||||
|
return scrc.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaCommentReply in the database.
|
||||||
|
func (scrc *ScaCommentReplyCreate) Save(ctx context.Context) (*ScaCommentReply, error) {
|
||||||
|
scrc.defaults()
|
||||||
|
return withHooks(ctx, scrc.sqlSave, scrc.mutation, scrc.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX calls Save and panics if Save returns an error.
|
||||||
|
func (scrc *ScaCommentReplyCreate) SaveX(ctx context.Context) *ScaCommentReply {
|
||||||
|
v, err := scrc.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (scrc *ScaCommentReplyCreate) Exec(ctx context.Context) error {
|
||||||
|
_, err := scrc.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scrc *ScaCommentReplyCreate) ExecX(ctx context.Context) {
|
||||||
|
if err := scrc.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaults sets the default values of the builder before save.
|
||||||
|
func (scrc *ScaCommentReplyCreate) defaults() {
|
||||||
|
if _, ok := scrc.mutation.CreatedAt(); !ok {
|
||||||
|
v := scacommentreply.DefaultCreatedAt()
|
||||||
|
scrc.mutation.SetCreatedAt(v)
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Deleted(); !ok {
|
||||||
|
v := scacommentreply.DefaultDeleted
|
||||||
|
scrc.mutation.SetDeleted(v)
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Author(); !ok {
|
||||||
|
v := scacommentreply.DefaultAuthor
|
||||||
|
scrc.mutation.SetAuthor(v)
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Likes(); !ok {
|
||||||
|
v := scacommentreply.DefaultLikes
|
||||||
|
scrc.mutation.SetLikes(v)
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.ReplyCount(); !ok {
|
||||||
|
v := scacommentreply.DefaultReplyCount
|
||||||
|
scrc.mutation.SetReplyCount(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (scrc *ScaCommentReplyCreate) check() error {
|
||||||
|
if _, ok := scrc.mutation.CreatedAt(); !ok {
|
||||||
|
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaCommentReply.created_at"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Deleted(); !ok {
|
||||||
|
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "ScaCommentReply.deleted"`)}
|
||||||
|
}
|
||||||
|
if v, ok := scrc.mutation.Deleted(); ok {
|
||||||
|
if err := scacommentreply.DeletedValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaCommentReply.deleted": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.UserID(); !ok {
|
||||||
|
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "ScaCommentReply.user_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.TopicID(); !ok {
|
||||||
|
return &ValidationError{Name: "topic_id", err: errors.New(`ent: missing required field "ScaCommentReply.topic_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.TopicType(); !ok {
|
||||||
|
return &ValidationError{Name: "topic_type", err: errors.New(`ent: missing required field "ScaCommentReply.topic_type"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Content(); !ok {
|
||||||
|
return &ValidationError{Name: "content", err: errors.New(`ent: missing required field "ScaCommentReply.content"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.CommentType(); !ok {
|
||||||
|
return &ValidationError{Name: "comment_type", err: errors.New(`ent: missing required field "ScaCommentReply.comment_type"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Author(); !ok {
|
||||||
|
return &ValidationError{Name: "author", err: errors.New(`ent: missing required field "ScaCommentReply.author"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Browser(); !ok {
|
||||||
|
return &ValidationError{Name: "browser", err: errors.New(`ent: missing required field "ScaCommentReply.browser"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.OperatingSystem(); !ok {
|
||||||
|
return &ValidationError{Name: "operating_system", err: errors.New(`ent: missing required field "ScaCommentReply.operating_system"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.CommentIP(); !ok {
|
||||||
|
return &ValidationError{Name: "comment_ip", err: errors.New(`ent: missing required field "ScaCommentReply.comment_ip"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Location(); !ok {
|
||||||
|
return &ValidationError{Name: "location", err: errors.New(`ent: missing required field "ScaCommentReply.location"`)}
|
||||||
|
}
|
||||||
|
if _, ok := scrc.mutation.Agent(); !ok {
|
||||||
|
return &ValidationError{Name: "agent", err: errors.New(`ent: missing required field "ScaCommentReply.agent"`)}
|
||||||
|
}
|
||||||
|
if v, ok := scrc.mutation.Agent(); ok {
|
||||||
|
if err := scacommentreply.AgentValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "agent", err: fmt.Errorf(`ent: validator failed for field "ScaCommentReply.agent": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrc *ScaCommentReplyCreate) sqlSave(ctx context.Context) (*ScaCommentReply, error) {
|
||||||
|
if err := scrc.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_node, _spec := scrc.createSpec()
|
||||||
|
if err := sqlgraph.CreateNode(ctx, scrc.driver, _spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if _spec.ID.Value != _node.ID {
|
||||||
|
id := _spec.ID.Value.(int64)
|
||||||
|
_node.ID = int64(id)
|
||||||
|
}
|
||||||
|
scrc.mutation.id = &_node.ID
|
||||||
|
scrc.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrc *ScaCommentReplyCreate) createSpec() (*ScaCommentReply, *sqlgraph.CreateSpec) {
|
||||||
|
var (
|
||||||
|
_node = &ScaCommentReply{config: scrc.config}
|
||||||
|
_spec = sqlgraph.NewCreateSpec(scacommentreply.Table, sqlgraph.NewFieldSpec(scacommentreply.FieldID, field.TypeInt64))
|
||||||
|
)
|
||||||
|
if id, ok := scrc.mutation.ID(); ok {
|
||||||
|
_node.ID = id
|
||||||
|
_spec.ID.Value = id
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.CreatedAt(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldCreatedAt, field.TypeTime, value)
|
||||||
|
_node.CreatedAt = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.UpdatedAt(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldUpdatedAt, field.TypeTime, value)
|
||||||
|
_node.UpdatedAt = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.Deleted(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldDeleted, field.TypeInt8, value)
|
||||||
|
_node.Deleted = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.UserID(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldUserID, field.TypeString, value)
|
||||||
|
_node.UserID = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.TopicID(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldTopicID, field.TypeString, value)
|
||||||
|
_node.TopicID = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.TopicType(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldTopicType, field.TypeInt, value)
|
||||||
|
_node.TopicType = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.Content(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldContent, field.TypeString, value)
|
||||||
|
_node.Content = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.CommentType(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldCommentType, field.TypeInt, value)
|
||||||
|
_node.CommentType = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.ReplyTo(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldReplyTo, field.TypeInt64, value)
|
||||||
|
_node.ReplyTo = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.ReplyID(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldReplyID, field.TypeInt64, value)
|
||||||
|
_node.ReplyID = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.ReplyUser(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldReplyUser, field.TypeString, value)
|
||||||
|
_node.ReplyUser = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.Author(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldAuthor, field.TypeInt, value)
|
||||||
|
_node.Author = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.Likes(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldLikes, field.TypeInt64, value)
|
||||||
|
_node.Likes = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.ReplyCount(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldReplyCount, field.TypeInt64, value)
|
||||||
|
_node.ReplyCount = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.Browser(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldBrowser, field.TypeString, value)
|
||||||
|
_node.Browser = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.OperatingSystem(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldOperatingSystem, field.TypeString, value)
|
||||||
|
_node.OperatingSystem = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.CommentIP(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldCommentIP, field.TypeString, value)
|
||||||
|
_node.CommentIP = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.Location(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldLocation, field.TypeString, value)
|
||||||
|
_node.Location = value
|
||||||
|
}
|
||||||
|
if value, ok := scrc.mutation.Agent(); ok {
|
||||||
|
_spec.SetField(scacommentreply.FieldAgent, field.TypeString, value)
|
||||||
|
_node.Agent = value
|
||||||
|
}
|
||||||
|
return _node, _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentReplyCreateBulk is the builder for creating many ScaCommentReply entities in bulk.
|
||||||
|
type ScaCommentReplyCreateBulk struct {
|
||||||
|
config
|
||||||
|
err error
|
||||||
|
builders []*ScaCommentReplyCreate
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaCommentReply entities in the database.
|
||||||
|
func (scrcb *ScaCommentReplyCreateBulk) Save(ctx context.Context) ([]*ScaCommentReply, error) {
|
||||||
|
if scrcb.err != nil {
|
||||||
|
return nil, scrcb.err
|
||||||
|
}
|
||||||
|
specs := make([]*sqlgraph.CreateSpec, len(scrcb.builders))
|
||||||
|
nodes := make([]*ScaCommentReply, len(scrcb.builders))
|
||||||
|
mutators := make([]Mutator, len(scrcb.builders))
|
||||||
|
for i := range scrcb.builders {
|
||||||
|
func(i int, root context.Context) {
|
||||||
|
builder := scrcb.builders[i]
|
||||||
|
builder.defaults()
|
||||||
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||||
|
mutation, ok := m.(*ScaCommentReplyMutation)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||||
|
}
|
||||||
|
if err := builder.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
builder.mutation = mutation
|
||||||
|
var err error
|
||||||
|
nodes[i], specs[i] = builder.createSpec()
|
||||||
|
if i < len(mutators)-1 {
|
||||||
|
_, err = mutators[i+1].Mutate(root, scrcb.builders[i+1].mutation)
|
||||||
|
} else {
|
||||||
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||||
|
// Invoke the actual operation on the latest mutation in the chain.
|
||||||
|
if err = sqlgraph.BatchCreate(ctx, scrcb.driver, spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
mutation.id = &nodes[i].ID
|
||||||
|
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||||
|
id := specs[i].ID.Value.(int64)
|
||||||
|
nodes[i].ID = int64(id)
|
||||||
|
}
|
||||||
|
mutation.done = true
|
||||||
|
return nodes[i], nil
|
||||||
|
})
|
||||||
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||||
|
mut = builder.hooks[i](mut)
|
||||||
|
}
|
||||||
|
mutators[i] = mut
|
||||||
|
}(i, ctx)
|
||||||
|
}
|
||||||
|
if len(mutators) > 0 {
|
||||||
|
if _, err := mutators[0].Mutate(ctx, scrcb.builders[0].mutation); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (scrcb *ScaCommentReplyCreateBulk) SaveX(ctx context.Context) []*ScaCommentReply {
|
||||||
|
v, err := scrcb.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (scrcb *ScaCommentReplyCreateBulk) Exec(ctx context.Context) error {
|
||||||
|
_, err := scrcb.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scrcb *ScaCommentReplyCreateBulk) ExecX(ctx context.Context) {
|
||||||
|
if err := scrcb.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
88
app/core/api/repository/mysql/ent/scacommentreply_delete.go
Normal file
88
app/core/api/repository/mysql/ent/scacommentreply_delete.go
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentReplyDelete is the builder for deleting a ScaCommentReply entity.
|
||||||
|
type ScaCommentReplyDelete struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaCommentReplyMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentReplyDelete builder.
|
||||||
|
func (scrd *ScaCommentReplyDelete) Where(ps ...predicate.ScaCommentReply) *ScaCommentReplyDelete {
|
||||||
|
scrd.mutation.Where(ps...)
|
||||||
|
return scrd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||||
|
func (scrd *ScaCommentReplyDelete) Exec(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, scrd.sqlExec, scrd.mutation, scrd.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scrd *ScaCommentReplyDelete) ExecX(ctx context.Context) int {
|
||||||
|
n, err := scrd.Exec(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrd *ScaCommentReplyDelete) sqlExec(ctx context.Context) (int, error) {
|
||||||
|
_spec := sqlgraph.NewDeleteSpec(scacommentreply.Table, sqlgraph.NewFieldSpec(scacommentreply.FieldID, field.TypeInt64))
|
||||||
|
if ps := scrd.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
affected, err := sqlgraph.DeleteNodes(ctx, scrd.driver, _spec)
|
||||||
|
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
scrd.mutation.done = true
|
||||||
|
return affected, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentReplyDeleteOne is the builder for deleting a single ScaCommentReply entity.
|
||||||
|
type ScaCommentReplyDeleteOne struct {
|
||||||
|
scrd *ScaCommentReplyDelete
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaCommentReplyDelete builder.
|
||||||
|
func (scrdo *ScaCommentReplyDeleteOne) Where(ps ...predicate.ScaCommentReply) *ScaCommentReplyDeleteOne {
|
||||||
|
scrdo.scrd.mutation.Where(ps...)
|
||||||
|
return scrdo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query.
|
||||||
|
func (scrdo *ScaCommentReplyDeleteOne) Exec(ctx context.Context) error {
|
||||||
|
n, err := scrdo.scrd.Exec(ctx)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
|
case n == 0:
|
||||||
|
return &NotFoundError{scacommentreply.Label}
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (scrdo *ScaCommentReplyDeleteOne) ExecX(ctx context.Context) {
|
||||||
|
if err := scrdo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
527
app/core/api/repository/mysql/ent/scacommentreply_query.go
Normal file
527
app/core/api/repository/mysql/ent/scacommentreply_query.go
Normal file
@@ -0,0 +1,527 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scacommentreply"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentReplyQuery is the builder for querying ScaCommentReply entities.
|
||||||
|
type ScaCommentReplyQuery struct {
|
||||||
|
config
|
||||||
|
ctx *QueryContext
|
||||||
|
order []scacommentreply.OrderOption
|
||||||
|
inters []Interceptor
|
||||||
|
predicates []predicate.ScaCommentReply
|
||||||
|
// intermediate query (i.e. traversal path).
|
||||||
|
sql *sql.Selector
|
||||||
|
path func(context.Context) (*sql.Selector, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where adds a new predicate for the ScaCommentReplyQuery builder.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Where(ps ...predicate.ScaCommentReply) *ScaCommentReplyQuery {
|
||||||
|
scrq.predicates = append(scrq.predicates, ps...)
|
||||||
|
return scrq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit the number of records to be returned by this query.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Limit(limit int) *ScaCommentReplyQuery {
|
||||||
|
scrq.ctx.Limit = &limit
|
||||||
|
return scrq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset to start from.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Offset(offset int) *ScaCommentReplyQuery {
|
||||||
|
scrq.ctx.Offset = &offset
|
||||||
|
return scrq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unique configures the query builder to filter duplicate records on query.
|
||||||
|
// By default, unique is set to true, and can be disabled using this method.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Unique(unique bool) *ScaCommentReplyQuery {
|
||||||
|
scrq.ctx.Unique = &unique
|
||||||
|
return scrq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Order specifies how the records should be ordered.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Order(o ...scacommentreply.OrderOption) *ScaCommentReplyQuery {
|
||||||
|
scrq.order = append(scrq.order, o...)
|
||||||
|
return scrq
|
||||||
|
}
|
||||||
|
|
||||||
|
// First returns the first ScaCommentReply entity from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentReply was found.
|
||||||
|
func (scrq *ScaCommentReplyQuery) First(ctx context.Context) (*ScaCommentReply, error) {
|
||||||
|
nodes, err := scrq.Limit(1).All(setContextOp(ctx, scrq.ctx, ent.OpQueryFirst))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nil, &NotFoundError{scacommentreply.Label}
|
||||||
|
}
|
||||||
|
return nodes[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstX is like First, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) FirstX(ctx context.Context) *ScaCommentReply {
|
||||||
|
node, err := scrq.First(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstID returns the first ScaCommentReply ID from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentReply ID was found.
|
||||||
|
func (scrq *ScaCommentReplyQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = scrq.Limit(1).IDs(setContextOp(ctx, scrq.ctx, ent.OpQueryFirstID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(ids) == 0 {
|
||||||
|
err = &NotFoundError{scacommentreply.Label}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return ids[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) FirstIDX(ctx context.Context) int64 {
|
||||||
|
id, err := scrq.FirstID(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only returns a single ScaCommentReply entity found by the query, ensuring it only returns one.
|
||||||
|
// Returns a *NotSingularError when more than one ScaCommentReply entity is found.
|
||||||
|
// Returns a *NotFoundError when no ScaCommentReply entities are found.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Only(ctx context.Context) (*ScaCommentReply, error) {
|
||||||
|
nodes, err := scrq.Limit(2).All(setContextOp(ctx, scrq.ctx, ent.OpQueryOnly))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch len(nodes) {
|
||||||
|
case 1:
|
||||||
|
return nodes[0], nil
|
||||||
|
case 0:
|
||||||
|
return nil, &NotFoundError{scacommentreply.Label}
|
||||||
|
default:
|
||||||
|
return nil, &NotSingularError{scacommentreply.Label}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyX is like Only, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) OnlyX(ctx context.Context) *ScaCommentReply {
|
||||||
|
node, err := scrq.Only(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyID is like Only, but returns the only ScaCommentReply ID in the query.
|
||||||
|
// Returns a *NotSingularError when more than one ScaCommentReply ID is found.
|
||||||
|
// Returns a *NotFoundError when no entities are found.
|
||||||
|
func (scrq *ScaCommentReplyQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = scrq.Limit(2).IDs(setContextOp(ctx, scrq.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch len(ids) {
|
||||||
|
case 1:
|
||||||
|
id = ids[0]
|
||||||
|
case 0:
|
||||||
|
err = &NotFoundError{scacommentreply.Label}
|
||||||
|
default:
|
||||||
|
err = &NotSingularError{scacommentreply.Label}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) OnlyIDX(ctx context.Context) int64 {
|
||||||
|
id, err := scrq.OnlyID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// All executes the query and returns a list of ScaCommentReplies.
|
||||||
|
func (scrq *ScaCommentReplyQuery) All(ctx context.Context) ([]*ScaCommentReply, error) {
|
||||||
|
ctx = setContextOp(ctx, scrq.ctx, ent.OpQueryAll)
|
||||||
|
if err := scrq.prepareQuery(ctx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
qr := querierAll[[]*ScaCommentReply, *ScaCommentReplyQuery]()
|
||||||
|
return withInterceptors[[]*ScaCommentReply](ctx, scrq, qr, scrq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllX is like All, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) AllX(ctx context.Context) []*ScaCommentReply {
|
||||||
|
nodes, err := scrq.All(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDs executes the query and returns a list of ScaCommentReply IDs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||||
|
if scrq.ctx.Unique == nil && scrq.path != nil {
|
||||||
|
scrq.Unique(true)
|
||||||
|
}
|
||||||
|
ctx = setContextOp(ctx, scrq.ctx, ent.OpQueryIDs)
|
||||||
|
if err = scrq.Select(scacommentreply.FieldID).Scan(ctx, &ids); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ids, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDsX is like IDs, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) IDsX(ctx context.Context) []int64 {
|
||||||
|
ids, err := scrq.IDs(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the count of the given query.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Count(ctx context.Context) (int, error) {
|
||||||
|
ctx = setContextOp(ctx, scrq.ctx, ent.OpQueryCount)
|
||||||
|
if err := scrq.prepareQuery(ctx); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return withInterceptors[int](ctx, scrq, querierCount[*ScaCommentReplyQuery](), scrq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CountX is like Count, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) CountX(ctx context.Context) int {
|
||||||
|
count, err := scrq.Count(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exist returns true if the query has elements in the graph.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Exist(ctx context.Context) (bool, error) {
|
||||||
|
ctx = setContextOp(ctx, scrq.ctx, ent.OpQueryExist)
|
||||||
|
switch _, err := scrq.FirstID(ctx); {
|
||||||
|
case IsNotFound(err):
|
||||||
|
return false, nil
|
||||||
|
case err != nil:
|
||||||
|
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||||
|
default:
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExistX is like Exist, but panics if an error occurs.
|
||||||
|
func (scrq *ScaCommentReplyQuery) ExistX(ctx context.Context) bool {
|
||||||
|
exist, err := scrq.Exist(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return exist
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone returns a duplicate of the ScaCommentReplyQuery builder, including all associated steps. It can be
|
||||||
|
// used to prepare common query builders and use them differently after the clone is made.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Clone() *ScaCommentReplyQuery {
|
||||||
|
if scrq == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &ScaCommentReplyQuery{
|
||||||
|
config: scrq.config,
|
||||||
|
ctx: scrq.ctx.Clone(),
|
||||||
|
order: append([]scacommentreply.OrderOption{}, scrq.order...),
|
||||||
|
inters: append([]Interceptor{}, scrq.inters...),
|
||||||
|
predicates: append([]predicate.ScaCommentReply{}, scrq.predicates...),
|
||||||
|
// clone intermediate query.
|
||||||
|
sql: scrq.sql.Clone(),
|
||||||
|
path: scrq.path,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupBy is used to group vertices by one or more fields/columns.
|
||||||
|
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
|
// Count int `json:"count,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaCommentReply.Query().
|
||||||
|
// GroupBy(scacommentreply.FieldCreatedAt).
|
||||||
|
// Aggregate(ent.Count()).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (scrq *ScaCommentReplyQuery) GroupBy(field string, fields ...string) *ScaCommentReplyGroupBy {
|
||||||
|
scrq.ctx.Fields = append([]string{field}, fields...)
|
||||||
|
grbuild := &ScaCommentReplyGroupBy{build: scrq}
|
||||||
|
grbuild.flds = &scrq.ctx.Fields
|
||||||
|
grbuild.label = scacommentreply.Label
|
||||||
|
grbuild.scan = grbuild.Scan
|
||||||
|
return grbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows the selection one or more fields/columns for the given query,
|
||||||
|
// instead of selecting all fields in the entity.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// CreatedAt time.Time `json:"created_at,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaCommentReply.Query().
|
||||||
|
// Select(scacommentreply.FieldCreatedAt).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (scrq *ScaCommentReplyQuery) Select(fields ...string) *ScaCommentReplySelect {
|
||||||
|
scrq.ctx.Fields = append(scrq.ctx.Fields, fields...)
|
||||||
|
sbuild := &ScaCommentReplySelect{ScaCommentReplyQuery: scrq}
|
||||||
|
sbuild.label = scacommentreply.Label
|
||||||
|
sbuild.flds, sbuild.scan = &scrq.ctx.Fields, sbuild.Scan
|
||||||
|
return sbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a ScaCommentReplySelect configured with the given aggregations.
|
||||||
|
func (scrq *ScaCommentReplyQuery) Aggregate(fns ...AggregateFunc) *ScaCommentReplySelect {
|
||||||
|
return scrq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrq *ScaCommentReplyQuery) prepareQuery(ctx context.Context) error {
|
||||||
|
for _, inter := range scrq.inters {
|
||||||
|
if inter == nil {
|
||||||
|
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||||
|
}
|
||||||
|
if trv, ok := inter.(Traverser); ok {
|
||||||
|
if err := trv.Traverse(ctx, scrq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, f := range scrq.ctx.Fields {
|
||||||
|
if !scacommentreply.ValidColumn(f) {
|
||||||
|
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if scrq.path != nil {
|
||||||
|
prev, err := scrq.path(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
scrq.sql = prev
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrq *ScaCommentReplyQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ScaCommentReply, error) {
|
||||||
|
var (
|
||||||
|
nodes = []*ScaCommentReply{}
|
||||||
|
_spec = scrq.querySpec()
|
||||||
|
)
|
||||||
|
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||||
|
return (*ScaCommentReply).scanValues(nil, columns)
|
||||||
|
}
|
||||||
|
_spec.Assign = func(columns []string, values []any) error {
|
||||||
|
node := &ScaCommentReply{config: scrq.config}
|
||||||
|
nodes = append(nodes, node)
|
||||||
|
return node.assignValues(columns, values)
|
||||||
|
}
|
||||||
|
for i := range hooks {
|
||||||
|
hooks[i](ctx, _spec)
|
||||||
|
}
|
||||||
|
if err := sqlgraph.QueryNodes(ctx, scrq.driver, _spec); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrq *ScaCommentReplyQuery) sqlCount(ctx context.Context) (int, error) {
|
||||||
|
_spec := scrq.querySpec()
|
||||||
|
_spec.Node.Columns = scrq.ctx.Fields
|
||||||
|
if len(scrq.ctx.Fields) > 0 {
|
||||||
|
_spec.Unique = scrq.ctx.Unique != nil && *scrq.ctx.Unique
|
||||||
|
}
|
||||||
|
return sqlgraph.CountNodes(ctx, scrq.driver, _spec)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrq *ScaCommentReplyQuery) querySpec() *sqlgraph.QuerySpec {
|
||||||
|
_spec := sqlgraph.NewQuerySpec(scacommentreply.Table, scacommentreply.Columns, sqlgraph.NewFieldSpec(scacommentreply.FieldID, field.TypeInt64))
|
||||||
|
_spec.From = scrq.sql
|
||||||
|
if unique := scrq.ctx.Unique; unique != nil {
|
||||||
|
_spec.Unique = *unique
|
||||||
|
} else if scrq.path != nil {
|
||||||
|
_spec.Unique = true
|
||||||
|
}
|
||||||
|
if fields := scrq.ctx.Fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scacommentreply.FieldID)
|
||||||
|
for i := range fields {
|
||||||
|
if fields[i] != scacommentreply.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := scrq.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if limit := scrq.ctx.Limit; limit != nil {
|
||||||
|
_spec.Limit = *limit
|
||||||
|
}
|
||||||
|
if offset := scrq.ctx.Offset; offset != nil {
|
||||||
|
_spec.Offset = *offset
|
||||||
|
}
|
||||||
|
if ps := scrq.order; len(ps) > 0 {
|
||||||
|
_spec.Order = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrq *ScaCommentReplyQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||||
|
builder := sql.Dialect(scrq.driver.Dialect())
|
||||||
|
t1 := builder.Table(scacommentreply.Table)
|
||||||
|
columns := scrq.ctx.Fields
|
||||||
|
if len(columns) == 0 {
|
||||||
|
columns = scacommentreply.Columns
|
||||||
|
}
|
||||||
|
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||||
|
if scrq.sql != nil {
|
||||||
|
selector = scrq.sql
|
||||||
|
selector.Select(selector.Columns(columns...)...)
|
||||||
|
}
|
||||||
|
if scrq.ctx.Unique != nil && *scrq.ctx.Unique {
|
||||||
|
selector.Distinct()
|
||||||
|
}
|
||||||
|
for _, p := range scrq.predicates {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
for _, p := range scrq.order {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
if offset := scrq.ctx.Offset; offset != nil {
|
||||||
|
// limit is mandatory for offset clause. We start
|
||||||
|
// with default value, and override it below if needed.
|
||||||
|
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||||
|
}
|
||||||
|
if limit := scrq.ctx.Limit; limit != nil {
|
||||||
|
selector.Limit(*limit)
|
||||||
|
}
|
||||||
|
return selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentReplyGroupBy is the group-by builder for ScaCommentReply entities.
|
||||||
|
type ScaCommentReplyGroupBy struct {
|
||||||
|
selector
|
||||||
|
build *ScaCommentReplyQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the group-by query.
|
||||||
|
func (scrgb *ScaCommentReplyGroupBy) Aggregate(fns ...AggregateFunc) *ScaCommentReplyGroupBy {
|
||||||
|
scrgb.fns = append(scrgb.fns, fns...)
|
||||||
|
return scrgb
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (scrgb *ScaCommentReplyGroupBy) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, scrgb.build.ctx, ent.OpQueryGroupBy)
|
||||||
|
if err := scrgb.build.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaCommentReplyQuery, *ScaCommentReplyGroupBy](ctx, scrgb.build, scrgb, scrgb.build.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrgb *ScaCommentReplyGroupBy) sqlScan(ctx context.Context, root *ScaCommentReplyQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx).Select()
|
||||||
|
aggregation := make([]string, 0, len(scrgb.fns))
|
||||||
|
for _, fn := range scrgb.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
|
columns := make([]string, 0, len(*scrgb.flds)+len(scrgb.fns))
|
||||||
|
for _, f := range *scrgb.flds {
|
||||||
|
columns = append(columns, selector.C(f))
|
||||||
|
}
|
||||||
|
columns = append(columns, aggregation...)
|
||||||
|
selector.Select(columns...)
|
||||||
|
}
|
||||||
|
selector.GroupBy(selector.Columns(*scrgb.flds...)...)
|
||||||
|
if err := selector.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := scrgb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaCommentReplySelect is the builder for selecting fields of ScaCommentReply entities.
|
||||||
|
type ScaCommentReplySelect struct {
|
||||||
|
*ScaCommentReplyQuery
|
||||||
|
selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (scrs *ScaCommentReplySelect) Aggregate(fns ...AggregateFunc) *ScaCommentReplySelect {
|
||||||
|
scrs.fns = append(scrs.fns, fns...)
|
||||||
|
return scrs
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (scrs *ScaCommentReplySelect) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, scrs.ctx, ent.OpQuerySelect)
|
||||||
|
if err := scrs.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaCommentReplyQuery, *ScaCommentReplySelect](ctx, scrs.ScaCommentReplyQuery, scrs, scrs.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (scrs *ScaCommentReplySelect) sqlScan(ctx context.Context, root *ScaCommentReplyQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx)
|
||||||
|
aggregation := make([]string, 0, len(scrs.fns))
|
||||||
|
for _, fn := range scrs.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
switch n := len(*scrs.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
selector.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
selector.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := scrs.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
1094
app/core/api/repository/mysql/ent/scacommentreply_update.go
Normal file
1094
app/core/api/repository/mysql/ent/scacommentreply_update.go
Normal file
File diff suppressed because it is too large
Load Diff
125
app/core/api/repository/mysql/ent/scauserfollows.go
Normal file
125
app/core/api/repository/mysql/ent/scauserfollows.go
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 用户关注表
|
||||||
|
type ScaUserFollows struct {
|
||||||
|
config `json:"-"`
|
||||||
|
// ID of the ent.
|
||||||
|
ID int `json:"id,omitempty"`
|
||||||
|
// 关注者
|
||||||
|
FollowerID string `json:"follower_id,omitempty"`
|
||||||
|
// 被关注者
|
||||||
|
FolloweeID string `json:"followee_id,omitempty"`
|
||||||
|
// 关注状态(0 未互关 1 互关)
|
||||||
|
Status uint8 `json:"status,omitempty"`
|
||||||
|
selectValues sql.SelectValues
|
||||||
|
}
|
||||||
|
|
||||||
|
// scanValues returns the types for scanning values from sql.Rows.
|
||||||
|
func (*ScaUserFollows) scanValues(columns []string) ([]any, error) {
|
||||||
|
values := make([]any, len(columns))
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scauserfollows.FieldID, scauserfollows.FieldStatus:
|
||||||
|
values[i] = new(sql.NullInt64)
|
||||||
|
case scauserfollows.FieldFollowerID, scauserfollows.FieldFolloweeID:
|
||||||
|
values[i] = new(sql.NullString)
|
||||||
|
default:
|
||||||
|
values[i] = new(sql.UnknownType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||||
|
// to the ScaUserFollows fields.
|
||||||
|
func (suf *ScaUserFollows) assignValues(columns []string, values []any) error {
|
||||||
|
if m, n := len(values), len(columns); m < n {
|
||||||
|
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||||
|
}
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scauserfollows.FieldID:
|
||||||
|
value, ok := values[i].(*sql.NullInt64)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field id", value)
|
||||||
|
}
|
||||||
|
suf.ID = int(value.Int64)
|
||||||
|
case scauserfollows.FieldFollowerID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field follower_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
suf.FollowerID = value.String
|
||||||
|
}
|
||||||
|
case scauserfollows.FieldFolloweeID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field followee_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
suf.FolloweeID = value.String
|
||||||
|
}
|
||||||
|
case scauserfollows.FieldStatus:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field status", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
suf.Status = uint8(value.Int64)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
suf.selectValues.Set(columns[i], values[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value returns the ent.Value that was dynamically selected and assigned to the ScaUserFollows.
|
||||||
|
// This includes values selected through modifiers, order, etc.
|
||||||
|
func (suf *ScaUserFollows) Value(name string) (ent.Value, error) {
|
||||||
|
return suf.selectValues.Get(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns a builder for updating this ScaUserFollows.
|
||||||
|
// Note that you need to call ScaUserFollows.Unwrap() before calling this method if this ScaUserFollows
|
||||||
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||||
|
func (suf *ScaUserFollows) Update() *ScaUserFollowsUpdateOne {
|
||||||
|
return NewScaUserFollowsClient(suf.config).UpdateOne(suf)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap unwraps the ScaUserFollows entity that was returned from a transaction after it was closed,
|
||||||
|
// so that all future queries will be executed through the driver which created the transaction.
|
||||||
|
func (suf *ScaUserFollows) Unwrap() *ScaUserFollows {
|
||||||
|
_tx, ok := suf.config.driver.(*txDriver)
|
||||||
|
if !ok {
|
||||||
|
panic("ent: ScaUserFollows is not a transactional entity")
|
||||||
|
}
|
||||||
|
suf.config.driver = _tx.drv
|
||||||
|
return suf
|
||||||
|
}
|
||||||
|
|
||||||
|
// String implements the fmt.Stringer.
|
||||||
|
func (suf *ScaUserFollows) String() string {
|
||||||
|
var builder strings.Builder
|
||||||
|
builder.WriteString("ScaUserFollows(")
|
||||||
|
builder.WriteString(fmt.Sprintf("id=%v, ", suf.ID))
|
||||||
|
builder.WriteString("follower_id=")
|
||||||
|
builder.WriteString(suf.FollowerID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("followee_id=")
|
||||||
|
builder.WriteString(suf.FolloweeID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("status=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", suf.Status))
|
||||||
|
builder.WriteByte(')')
|
||||||
|
return builder.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsSlice is a parsable slice of ScaUserFollows.
|
||||||
|
type ScaUserFollowsSlice []*ScaUserFollows
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scauserfollows
|
||||||
|
|
||||||
|
import (
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Label holds the string label denoting the scauserfollows type in the database.
|
||||||
|
Label = "sca_user_follows"
|
||||||
|
// FieldID holds the string denoting the id field in the database.
|
||||||
|
FieldID = "id"
|
||||||
|
// FieldFollowerID holds the string denoting the follower_id field in the database.
|
||||||
|
FieldFollowerID = "follower_id"
|
||||||
|
// FieldFolloweeID holds the string denoting the followee_id field in the database.
|
||||||
|
FieldFolloweeID = "followee_id"
|
||||||
|
// FieldStatus holds the string denoting the status field in the database.
|
||||||
|
FieldStatus = "status"
|
||||||
|
// Table holds the table name of the scauserfollows in the database.
|
||||||
|
Table = "sca_user_follows"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Columns holds all SQL columns for scauserfollows fields.
|
||||||
|
var Columns = []string{
|
||||||
|
FieldID,
|
||||||
|
FieldFollowerID,
|
||||||
|
FieldFolloweeID,
|
||||||
|
FieldStatus,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
|
func ValidColumn(column string) bool {
|
||||||
|
for i := range Columns {
|
||||||
|
if column == Columns[i] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// DefaultStatus holds the default value on creation for the "status" field.
|
||||||
|
DefaultStatus uint8
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderOption defines the ordering options for the ScaUserFollows queries.
|
||||||
|
type OrderOption func(*sql.Selector)
|
||||||
|
|
||||||
|
// ByID orders the results by the id field.
|
||||||
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByFollowerID orders the results by the follower_id field.
|
||||||
|
func ByFollowerID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldFollowerID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByFolloweeID orders the results by the followee_id field.
|
||||||
|
func ByFolloweeID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldFolloweeID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByStatus orders the results by the status field.
|
||||||
|
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||||
|
}
|
||||||
254
app/core/api/repository/mysql/ent/scauserfollows/where.go
Normal file
254
app/core/api/repository/mysql/ent/scauserfollows/where.go
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scauserfollows
|
||||||
|
|
||||||
|
import (
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ID filters vertices based on their ID field.
|
||||||
|
func ID(id int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDEQ applies the EQ predicate on the ID field.
|
||||||
|
func IDEQ(id int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNEQ applies the NEQ predicate on the ID field.
|
||||||
|
func IDNEQ(id int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDIn applies the In predicate on the ID field.
|
||||||
|
func IDIn(ids ...int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNotIn applies the NotIn predicate on the ID field.
|
||||||
|
func IDNotIn(ids ...int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNotIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGT applies the GT predicate on the ID field.
|
||||||
|
func IDGT(id int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGTE applies the GTE predicate on the ID field.
|
||||||
|
func IDGTE(id int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLT applies the LT predicate on the ID field.
|
||||||
|
func IDLT(id int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLTE applies the LTE predicate on the ID field.
|
||||||
|
func IDLTE(id int) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerID applies equality check predicate on the "follower_id" field. It's identical to FollowerIDEQ.
|
||||||
|
func FollowerID(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeID applies equality check predicate on the "followee_id" field. It's identical to FolloweeIDEQ.
|
||||||
|
func FolloweeID(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
||||||
|
func Status(v uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldStatus, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDEQ applies the EQ predicate on the "follower_id" field.
|
||||||
|
func FollowerIDEQ(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDNEQ applies the NEQ predicate on the "follower_id" field.
|
||||||
|
func FollowerIDNEQ(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNEQ(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDIn applies the In predicate on the "follower_id" field.
|
||||||
|
func FollowerIDIn(vs ...string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldIn(FieldFollowerID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDNotIn applies the NotIn predicate on the "follower_id" field.
|
||||||
|
func FollowerIDNotIn(vs ...string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNotIn(FieldFollowerID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDGT applies the GT predicate on the "follower_id" field.
|
||||||
|
func FollowerIDGT(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGT(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDGTE applies the GTE predicate on the "follower_id" field.
|
||||||
|
func FollowerIDGTE(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGTE(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDLT applies the LT predicate on the "follower_id" field.
|
||||||
|
func FollowerIDLT(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLT(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDLTE applies the LTE predicate on the "follower_id" field.
|
||||||
|
func FollowerIDLTE(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLTE(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDContains applies the Contains predicate on the "follower_id" field.
|
||||||
|
func FollowerIDContains(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldContains(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDHasPrefix applies the HasPrefix predicate on the "follower_id" field.
|
||||||
|
func FollowerIDHasPrefix(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldHasPrefix(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDHasSuffix applies the HasSuffix predicate on the "follower_id" field.
|
||||||
|
func FollowerIDHasSuffix(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldHasSuffix(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDEqualFold applies the EqualFold predicate on the "follower_id" field.
|
||||||
|
func FollowerIDEqualFold(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEqualFold(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FollowerIDContainsFold applies the ContainsFold predicate on the "follower_id" field.
|
||||||
|
func FollowerIDContainsFold(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldContainsFold(FieldFollowerID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDEQ applies the EQ predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDEQ(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDNEQ applies the NEQ predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDNEQ(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNEQ(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDIn applies the In predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDIn(vs ...string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldIn(FieldFolloweeID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDNotIn applies the NotIn predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDNotIn(vs ...string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNotIn(FieldFolloweeID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDGT applies the GT predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDGT(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGT(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDGTE applies the GTE predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDGTE(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGTE(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDLT applies the LT predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDLT(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLT(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDLTE applies the LTE predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDLTE(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLTE(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDContains applies the Contains predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDContains(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldContains(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDHasPrefix applies the HasPrefix predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDHasPrefix(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldHasPrefix(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDHasSuffix applies the HasSuffix predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDHasSuffix(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldHasSuffix(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDEqualFold applies the EqualFold predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDEqualFold(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEqualFold(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// FolloweeIDContainsFold applies the ContainsFold predicate on the "followee_id" field.
|
||||||
|
func FolloweeIDContainsFold(v string) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldContainsFold(FieldFolloweeID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusEQ applies the EQ predicate on the "status" field.
|
||||||
|
func StatusEQ(v uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldEQ(FieldStatus, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusNEQ applies the NEQ predicate on the "status" field.
|
||||||
|
func StatusNEQ(v uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNEQ(FieldStatus, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusIn applies the In predicate on the "status" field.
|
||||||
|
func StatusIn(vs ...uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldIn(FieldStatus, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusNotIn applies the NotIn predicate on the "status" field.
|
||||||
|
func StatusNotIn(vs ...uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldNotIn(FieldStatus, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusGT applies the GT predicate on the "status" field.
|
||||||
|
func StatusGT(v uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGT(FieldStatus, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusGTE applies the GTE predicate on the "status" field.
|
||||||
|
func StatusGTE(v uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldGTE(FieldStatus, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusLT applies the LT predicate on the "status" field.
|
||||||
|
func StatusLT(v uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLT(FieldStatus, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatusLTE applies the LTE predicate on the "status" field.
|
||||||
|
func StatusLTE(v uint8) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.FieldLTE(FieldStatus, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// And groups predicates with the AND operator between them.
|
||||||
|
func And(predicates ...predicate.ScaUserFollows) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.AndPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or groups predicates with the OR operator between them.
|
||||||
|
func Or(predicates ...predicate.ScaUserFollows) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.OrPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not applies the not operator on the given predicate.
|
||||||
|
func Not(p predicate.ScaUserFollows) predicate.ScaUserFollows {
|
||||||
|
return predicate.ScaUserFollows(sql.NotPredicates(p))
|
||||||
|
}
|
||||||
227
app/core/api/repository/mysql/ent/scauserfollows_create.go
Normal file
227
app/core/api/repository/mysql/ent/scauserfollows_create.go
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserFollowsCreate is the builder for creating a ScaUserFollows entity.
|
||||||
|
type ScaUserFollowsCreate struct {
|
||||||
|
config
|
||||||
|
mutation *ScaUserFollowsMutation
|
||||||
|
hooks []Hook
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFollowerID sets the "follower_id" field.
|
||||||
|
func (sufc *ScaUserFollowsCreate) SetFollowerID(s string) *ScaUserFollowsCreate {
|
||||||
|
sufc.mutation.SetFollowerID(s)
|
||||||
|
return sufc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFolloweeID sets the "followee_id" field.
|
||||||
|
func (sufc *ScaUserFollowsCreate) SetFolloweeID(s string) *ScaUserFollowsCreate {
|
||||||
|
sufc.mutation.SetFolloweeID(s)
|
||||||
|
return sufc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetStatus sets the "status" field.
|
||||||
|
func (sufc *ScaUserFollowsCreate) SetStatus(u uint8) *ScaUserFollowsCreate {
|
||||||
|
sufc.mutation.SetStatus(u)
|
||||||
|
return sufc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||||
|
func (sufc *ScaUserFollowsCreate) SetNillableStatus(u *uint8) *ScaUserFollowsCreate {
|
||||||
|
if u != nil {
|
||||||
|
sufc.SetStatus(*u)
|
||||||
|
}
|
||||||
|
return sufc
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaUserFollowsMutation object of the builder.
|
||||||
|
func (sufc *ScaUserFollowsCreate) Mutation() *ScaUserFollowsMutation {
|
||||||
|
return sufc.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaUserFollows in the database.
|
||||||
|
func (sufc *ScaUserFollowsCreate) Save(ctx context.Context) (*ScaUserFollows, error) {
|
||||||
|
sufc.defaults()
|
||||||
|
return withHooks(ctx, sufc.sqlSave, sufc.mutation, sufc.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX calls Save and panics if Save returns an error.
|
||||||
|
func (sufc *ScaUserFollowsCreate) SaveX(ctx context.Context) *ScaUserFollows {
|
||||||
|
v, err := sufc.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sufc *ScaUserFollowsCreate) Exec(ctx context.Context) error {
|
||||||
|
_, err := sufc.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sufc *ScaUserFollowsCreate) ExecX(ctx context.Context) {
|
||||||
|
if err := sufc.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaults sets the default values of the builder before save.
|
||||||
|
func (sufc *ScaUserFollowsCreate) defaults() {
|
||||||
|
if _, ok := sufc.mutation.Status(); !ok {
|
||||||
|
v := scauserfollows.DefaultStatus
|
||||||
|
sufc.mutation.SetStatus(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (sufc *ScaUserFollowsCreate) check() error {
|
||||||
|
if _, ok := sufc.mutation.FollowerID(); !ok {
|
||||||
|
return &ValidationError{Name: "follower_id", err: errors.New(`ent: missing required field "ScaUserFollows.follower_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sufc.mutation.FolloweeID(); !ok {
|
||||||
|
return &ValidationError{Name: "followee_id", err: errors.New(`ent: missing required field "ScaUserFollows.followee_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sufc.mutation.Status(); !ok {
|
||||||
|
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "ScaUserFollows.status"`)}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufc *ScaUserFollowsCreate) sqlSave(ctx context.Context) (*ScaUserFollows, error) {
|
||||||
|
if err := sufc.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_node, _spec := sufc.createSpec()
|
||||||
|
if err := sqlgraph.CreateNode(ctx, sufc.driver, _spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
id := _spec.ID.Value.(int64)
|
||||||
|
_node.ID = int(id)
|
||||||
|
sufc.mutation.id = &_node.ID
|
||||||
|
sufc.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufc *ScaUserFollowsCreate) createSpec() (*ScaUserFollows, *sqlgraph.CreateSpec) {
|
||||||
|
var (
|
||||||
|
_node = &ScaUserFollows{config: sufc.config}
|
||||||
|
_spec = sqlgraph.NewCreateSpec(scauserfollows.Table, sqlgraph.NewFieldSpec(scauserfollows.FieldID, field.TypeInt))
|
||||||
|
)
|
||||||
|
if value, ok := sufc.mutation.FollowerID(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldFollowerID, field.TypeString, value)
|
||||||
|
_node.FollowerID = value
|
||||||
|
}
|
||||||
|
if value, ok := sufc.mutation.FolloweeID(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldFolloweeID, field.TypeString, value)
|
||||||
|
_node.FolloweeID = value
|
||||||
|
}
|
||||||
|
if value, ok := sufc.mutation.Status(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldStatus, field.TypeUint8, value)
|
||||||
|
_node.Status = value
|
||||||
|
}
|
||||||
|
return _node, _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsCreateBulk is the builder for creating many ScaUserFollows entities in bulk.
|
||||||
|
type ScaUserFollowsCreateBulk struct {
|
||||||
|
config
|
||||||
|
err error
|
||||||
|
builders []*ScaUserFollowsCreate
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaUserFollows entities in the database.
|
||||||
|
func (sufcb *ScaUserFollowsCreateBulk) Save(ctx context.Context) ([]*ScaUserFollows, error) {
|
||||||
|
if sufcb.err != nil {
|
||||||
|
return nil, sufcb.err
|
||||||
|
}
|
||||||
|
specs := make([]*sqlgraph.CreateSpec, len(sufcb.builders))
|
||||||
|
nodes := make([]*ScaUserFollows, len(sufcb.builders))
|
||||||
|
mutators := make([]Mutator, len(sufcb.builders))
|
||||||
|
for i := range sufcb.builders {
|
||||||
|
func(i int, root context.Context) {
|
||||||
|
builder := sufcb.builders[i]
|
||||||
|
builder.defaults()
|
||||||
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||||
|
mutation, ok := m.(*ScaUserFollowsMutation)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||||
|
}
|
||||||
|
if err := builder.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
builder.mutation = mutation
|
||||||
|
var err error
|
||||||
|
nodes[i], specs[i] = builder.createSpec()
|
||||||
|
if i < len(mutators)-1 {
|
||||||
|
_, err = mutators[i+1].Mutate(root, sufcb.builders[i+1].mutation)
|
||||||
|
} else {
|
||||||
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||||
|
// Invoke the actual operation on the latest mutation in the chain.
|
||||||
|
if err = sqlgraph.BatchCreate(ctx, sufcb.driver, spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
mutation.id = &nodes[i].ID
|
||||||
|
if specs[i].ID.Value != nil {
|
||||||
|
id := specs[i].ID.Value.(int64)
|
||||||
|
nodes[i].ID = int(id)
|
||||||
|
}
|
||||||
|
mutation.done = true
|
||||||
|
return nodes[i], nil
|
||||||
|
})
|
||||||
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||||
|
mut = builder.hooks[i](mut)
|
||||||
|
}
|
||||||
|
mutators[i] = mut
|
||||||
|
}(i, ctx)
|
||||||
|
}
|
||||||
|
if len(mutators) > 0 {
|
||||||
|
if _, err := mutators[0].Mutate(ctx, sufcb.builders[0].mutation); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (sufcb *ScaUserFollowsCreateBulk) SaveX(ctx context.Context) []*ScaUserFollows {
|
||||||
|
v, err := sufcb.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sufcb *ScaUserFollowsCreateBulk) Exec(ctx context.Context) error {
|
||||||
|
_, err := sufcb.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sufcb *ScaUserFollowsCreateBulk) ExecX(ctx context.Context) {
|
||||||
|
if err := sufcb.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
88
app/core/api/repository/mysql/ent/scauserfollows_delete.go
Normal file
88
app/core/api/repository/mysql/ent/scauserfollows_delete.go
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserFollowsDelete is the builder for deleting a ScaUserFollows entity.
|
||||||
|
type ScaUserFollowsDelete struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaUserFollowsMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserFollowsDelete builder.
|
||||||
|
func (sufd *ScaUserFollowsDelete) Where(ps ...predicate.ScaUserFollows) *ScaUserFollowsDelete {
|
||||||
|
sufd.mutation.Where(ps...)
|
||||||
|
return sufd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||||
|
func (sufd *ScaUserFollowsDelete) Exec(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, sufd.sqlExec, sufd.mutation, sufd.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sufd *ScaUserFollowsDelete) ExecX(ctx context.Context) int {
|
||||||
|
n, err := sufd.Exec(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufd *ScaUserFollowsDelete) sqlExec(ctx context.Context) (int, error) {
|
||||||
|
_spec := sqlgraph.NewDeleteSpec(scauserfollows.Table, sqlgraph.NewFieldSpec(scauserfollows.FieldID, field.TypeInt))
|
||||||
|
if ps := sufd.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
affected, err := sqlgraph.DeleteNodes(ctx, sufd.driver, _spec)
|
||||||
|
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
sufd.mutation.done = true
|
||||||
|
return affected, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsDeleteOne is the builder for deleting a single ScaUserFollows entity.
|
||||||
|
type ScaUserFollowsDeleteOne struct {
|
||||||
|
sufd *ScaUserFollowsDelete
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserFollowsDelete builder.
|
||||||
|
func (sufdo *ScaUserFollowsDeleteOne) Where(ps ...predicate.ScaUserFollows) *ScaUserFollowsDeleteOne {
|
||||||
|
sufdo.sufd.mutation.Where(ps...)
|
||||||
|
return sufdo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query.
|
||||||
|
func (sufdo *ScaUserFollowsDeleteOne) Exec(ctx context.Context) error {
|
||||||
|
n, err := sufdo.sufd.Exec(ctx)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
|
case n == 0:
|
||||||
|
return &NotFoundError{scauserfollows.Label}
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sufdo *ScaUserFollowsDeleteOne) ExecX(ctx context.Context) {
|
||||||
|
if err := sufdo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
527
app/core/api/repository/mysql/ent/scauserfollows_query.go
Normal file
527
app/core/api/repository/mysql/ent/scauserfollows_query.go
Normal file
@@ -0,0 +1,527 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserFollowsQuery is the builder for querying ScaUserFollows entities.
|
||||||
|
type ScaUserFollowsQuery struct {
|
||||||
|
config
|
||||||
|
ctx *QueryContext
|
||||||
|
order []scauserfollows.OrderOption
|
||||||
|
inters []Interceptor
|
||||||
|
predicates []predicate.ScaUserFollows
|
||||||
|
// intermediate query (i.e. traversal path).
|
||||||
|
sql *sql.Selector
|
||||||
|
path func(context.Context) (*sql.Selector, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where adds a new predicate for the ScaUserFollowsQuery builder.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Where(ps ...predicate.ScaUserFollows) *ScaUserFollowsQuery {
|
||||||
|
sufq.predicates = append(sufq.predicates, ps...)
|
||||||
|
return sufq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit the number of records to be returned by this query.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Limit(limit int) *ScaUserFollowsQuery {
|
||||||
|
sufq.ctx.Limit = &limit
|
||||||
|
return sufq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset to start from.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Offset(offset int) *ScaUserFollowsQuery {
|
||||||
|
sufq.ctx.Offset = &offset
|
||||||
|
return sufq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unique configures the query builder to filter duplicate records on query.
|
||||||
|
// By default, unique is set to true, and can be disabled using this method.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Unique(unique bool) *ScaUserFollowsQuery {
|
||||||
|
sufq.ctx.Unique = &unique
|
||||||
|
return sufq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Order specifies how the records should be ordered.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Order(o ...scauserfollows.OrderOption) *ScaUserFollowsQuery {
|
||||||
|
sufq.order = append(sufq.order, o...)
|
||||||
|
return sufq
|
||||||
|
}
|
||||||
|
|
||||||
|
// First returns the first ScaUserFollows entity from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaUserFollows was found.
|
||||||
|
func (sufq *ScaUserFollowsQuery) First(ctx context.Context) (*ScaUserFollows, error) {
|
||||||
|
nodes, err := sufq.Limit(1).All(setContextOp(ctx, sufq.ctx, ent.OpQueryFirst))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nil, &NotFoundError{scauserfollows.Label}
|
||||||
|
}
|
||||||
|
return nodes[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstX is like First, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) FirstX(ctx context.Context) *ScaUserFollows {
|
||||||
|
node, err := sufq.First(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstID returns the first ScaUserFollows ID from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaUserFollows ID was found.
|
||||||
|
func (sufq *ScaUserFollowsQuery) FirstID(ctx context.Context) (id int, err error) {
|
||||||
|
var ids []int
|
||||||
|
if ids, err = sufq.Limit(1).IDs(setContextOp(ctx, sufq.ctx, ent.OpQueryFirstID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(ids) == 0 {
|
||||||
|
err = &NotFoundError{scauserfollows.Label}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return ids[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) FirstIDX(ctx context.Context) int {
|
||||||
|
id, err := sufq.FirstID(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only returns a single ScaUserFollows entity found by the query, ensuring it only returns one.
|
||||||
|
// Returns a *NotSingularError when more than one ScaUserFollows entity is found.
|
||||||
|
// Returns a *NotFoundError when no ScaUserFollows entities are found.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Only(ctx context.Context) (*ScaUserFollows, error) {
|
||||||
|
nodes, err := sufq.Limit(2).All(setContextOp(ctx, sufq.ctx, ent.OpQueryOnly))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch len(nodes) {
|
||||||
|
case 1:
|
||||||
|
return nodes[0], nil
|
||||||
|
case 0:
|
||||||
|
return nil, &NotFoundError{scauserfollows.Label}
|
||||||
|
default:
|
||||||
|
return nil, &NotSingularError{scauserfollows.Label}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyX is like Only, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) OnlyX(ctx context.Context) *ScaUserFollows {
|
||||||
|
node, err := sufq.Only(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyID is like Only, but returns the only ScaUserFollows ID in the query.
|
||||||
|
// Returns a *NotSingularError when more than one ScaUserFollows ID is found.
|
||||||
|
// Returns a *NotFoundError when no entities are found.
|
||||||
|
func (sufq *ScaUserFollowsQuery) OnlyID(ctx context.Context) (id int, err error) {
|
||||||
|
var ids []int
|
||||||
|
if ids, err = sufq.Limit(2).IDs(setContextOp(ctx, sufq.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch len(ids) {
|
||||||
|
case 1:
|
||||||
|
id = ids[0]
|
||||||
|
case 0:
|
||||||
|
err = &NotFoundError{scauserfollows.Label}
|
||||||
|
default:
|
||||||
|
err = &NotSingularError{scauserfollows.Label}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) OnlyIDX(ctx context.Context) int {
|
||||||
|
id, err := sufq.OnlyID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// All executes the query and returns a list of ScaUserFollowsSlice.
|
||||||
|
func (sufq *ScaUserFollowsQuery) All(ctx context.Context) ([]*ScaUserFollows, error) {
|
||||||
|
ctx = setContextOp(ctx, sufq.ctx, ent.OpQueryAll)
|
||||||
|
if err := sufq.prepareQuery(ctx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
qr := querierAll[[]*ScaUserFollows, *ScaUserFollowsQuery]()
|
||||||
|
return withInterceptors[[]*ScaUserFollows](ctx, sufq, qr, sufq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllX is like All, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) AllX(ctx context.Context) []*ScaUserFollows {
|
||||||
|
nodes, err := sufq.All(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDs executes the query and returns a list of ScaUserFollows IDs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) IDs(ctx context.Context) (ids []int, err error) {
|
||||||
|
if sufq.ctx.Unique == nil && sufq.path != nil {
|
||||||
|
sufq.Unique(true)
|
||||||
|
}
|
||||||
|
ctx = setContextOp(ctx, sufq.ctx, ent.OpQueryIDs)
|
||||||
|
if err = sufq.Select(scauserfollows.FieldID).Scan(ctx, &ids); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ids, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDsX is like IDs, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) IDsX(ctx context.Context) []int {
|
||||||
|
ids, err := sufq.IDs(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the count of the given query.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Count(ctx context.Context) (int, error) {
|
||||||
|
ctx = setContextOp(ctx, sufq.ctx, ent.OpQueryCount)
|
||||||
|
if err := sufq.prepareQuery(ctx); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return withInterceptors[int](ctx, sufq, querierCount[*ScaUserFollowsQuery](), sufq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CountX is like Count, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) CountX(ctx context.Context) int {
|
||||||
|
count, err := sufq.Count(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exist returns true if the query has elements in the graph.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Exist(ctx context.Context) (bool, error) {
|
||||||
|
ctx = setContextOp(ctx, sufq.ctx, ent.OpQueryExist)
|
||||||
|
switch _, err := sufq.FirstID(ctx); {
|
||||||
|
case IsNotFound(err):
|
||||||
|
return false, nil
|
||||||
|
case err != nil:
|
||||||
|
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||||
|
default:
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExistX is like Exist, but panics if an error occurs.
|
||||||
|
func (sufq *ScaUserFollowsQuery) ExistX(ctx context.Context) bool {
|
||||||
|
exist, err := sufq.Exist(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return exist
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone returns a duplicate of the ScaUserFollowsQuery builder, including all associated steps. It can be
|
||||||
|
// used to prepare common query builders and use them differently after the clone is made.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Clone() *ScaUserFollowsQuery {
|
||||||
|
if sufq == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &ScaUserFollowsQuery{
|
||||||
|
config: sufq.config,
|
||||||
|
ctx: sufq.ctx.Clone(),
|
||||||
|
order: append([]scauserfollows.OrderOption{}, sufq.order...),
|
||||||
|
inters: append([]Interceptor{}, sufq.inters...),
|
||||||
|
predicates: append([]predicate.ScaUserFollows{}, sufq.predicates...),
|
||||||
|
// clone intermediate query.
|
||||||
|
sql: sufq.sql.Clone(),
|
||||||
|
path: sufq.path,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupBy is used to group vertices by one or more fields/columns.
|
||||||
|
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// FollowerID string `json:"follower_id,omitempty"`
|
||||||
|
// Count int `json:"count,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaUserFollows.Query().
|
||||||
|
// GroupBy(scauserfollows.FieldFollowerID).
|
||||||
|
// Aggregate(ent.Count()).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (sufq *ScaUserFollowsQuery) GroupBy(field string, fields ...string) *ScaUserFollowsGroupBy {
|
||||||
|
sufq.ctx.Fields = append([]string{field}, fields...)
|
||||||
|
grbuild := &ScaUserFollowsGroupBy{build: sufq}
|
||||||
|
grbuild.flds = &sufq.ctx.Fields
|
||||||
|
grbuild.label = scauserfollows.Label
|
||||||
|
grbuild.scan = grbuild.Scan
|
||||||
|
return grbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows the selection one or more fields/columns for the given query,
|
||||||
|
// instead of selecting all fields in the entity.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// FollowerID string `json:"follower_id,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaUserFollows.Query().
|
||||||
|
// Select(scauserfollows.FieldFollowerID).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (sufq *ScaUserFollowsQuery) Select(fields ...string) *ScaUserFollowsSelect {
|
||||||
|
sufq.ctx.Fields = append(sufq.ctx.Fields, fields...)
|
||||||
|
sbuild := &ScaUserFollowsSelect{ScaUserFollowsQuery: sufq}
|
||||||
|
sbuild.label = scauserfollows.Label
|
||||||
|
sbuild.flds, sbuild.scan = &sufq.ctx.Fields, sbuild.Scan
|
||||||
|
return sbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a ScaUserFollowsSelect configured with the given aggregations.
|
||||||
|
func (sufq *ScaUserFollowsQuery) Aggregate(fns ...AggregateFunc) *ScaUserFollowsSelect {
|
||||||
|
return sufq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufq *ScaUserFollowsQuery) prepareQuery(ctx context.Context) error {
|
||||||
|
for _, inter := range sufq.inters {
|
||||||
|
if inter == nil {
|
||||||
|
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||||
|
}
|
||||||
|
if trv, ok := inter.(Traverser); ok {
|
||||||
|
if err := trv.Traverse(ctx, sufq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, f := range sufq.ctx.Fields {
|
||||||
|
if !scauserfollows.ValidColumn(f) {
|
||||||
|
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sufq.path != nil {
|
||||||
|
prev, err := sufq.path(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sufq.sql = prev
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufq *ScaUserFollowsQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ScaUserFollows, error) {
|
||||||
|
var (
|
||||||
|
nodes = []*ScaUserFollows{}
|
||||||
|
_spec = sufq.querySpec()
|
||||||
|
)
|
||||||
|
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||||
|
return (*ScaUserFollows).scanValues(nil, columns)
|
||||||
|
}
|
||||||
|
_spec.Assign = func(columns []string, values []any) error {
|
||||||
|
node := &ScaUserFollows{config: sufq.config}
|
||||||
|
nodes = append(nodes, node)
|
||||||
|
return node.assignValues(columns, values)
|
||||||
|
}
|
||||||
|
for i := range hooks {
|
||||||
|
hooks[i](ctx, _spec)
|
||||||
|
}
|
||||||
|
if err := sqlgraph.QueryNodes(ctx, sufq.driver, _spec); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufq *ScaUserFollowsQuery) sqlCount(ctx context.Context) (int, error) {
|
||||||
|
_spec := sufq.querySpec()
|
||||||
|
_spec.Node.Columns = sufq.ctx.Fields
|
||||||
|
if len(sufq.ctx.Fields) > 0 {
|
||||||
|
_spec.Unique = sufq.ctx.Unique != nil && *sufq.ctx.Unique
|
||||||
|
}
|
||||||
|
return sqlgraph.CountNodes(ctx, sufq.driver, _spec)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufq *ScaUserFollowsQuery) querySpec() *sqlgraph.QuerySpec {
|
||||||
|
_spec := sqlgraph.NewQuerySpec(scauserfollows.Table, scauserfollows.Columns, sqlgraph.NewFieldSpec(scauserfollows.FieldID, field.TypeInt))
|
||||||
|
_spec.From = sufq.sql
|
||||||
|
if unique := sufq.ctx.Unique; unique != nil {
|
||||||
|
_spec.Unique = *unique
|
||||||
|
} else if sufq.path != nil {
|
||||||
|
_spec.Unique = true
|
||||||
|
}
|
||||||
|
if fields := sufq.ctx.Fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scauserfollows.FieldID)
|
||||||
|
for i := range fields {
|
||||||
|
if fields[i] != scauserfollows.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := sufq.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if limit := sufq.ctx.Limit; limit != nil {
|
||||||
|
_spec.Limit = *limit
|
||||||
|
}
|
||||||
|
if offset := sufq.ctx.Offset; offset != nil {
|
||||||
|
_spec.Offset = *offset
|
||||||
|
}
|
||||||
|
if ps := sufq.order; len(ps) > 0 {
|
||||||
|
_spec.Order = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufq *ScaUserFollowsQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||||
|
builder := sql.Dialect(sufq.driver.Dialect())
|
||||||
|
t1 := builder.Table(scauserfollows.Table)
|
||||||
|
columns := sufq.ctx.Fields
|
||||||
|
if len(columns) == 0 {
|
||||||
|
columns = scauserfollows.Columns
|
||||||
|
}
|
||||||
|
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||||
|
if sufq.sql != nil {
|
||||||
|
selector = sufq.sql
|
||||||
|
selector.Select(selector.Columns(columns...)...)
|
||||||
|
}
|
||||||
|
if sufq.ctx.Unique != nil && *sufq.ctx.Unique {
|
||||||
|
selector.Distinct()
|
||||||
|
}
|
||||||
|
for _, p := range sufq.predicates {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
for _, p := range sufq.order {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
if offset := sufq.ctx.Offset; offset != nil {
|
||||||
|
// limit is mandatory for offset clause. We start
|
||||||
|
// with default value, and override it below if needed.
|
||||||
|
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||||
|
}
|
||||||
|
if limit := sufq.ctx.Limit; limit != nil {
|
||||||
|
selector.Limit(*limit)
|
||||||
|
}
|
||||||
|
return selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsGroupBy is the group-by builder for ScaUserFollows entities.
|
||||||
|
type ScaUserFollowsGroupBy struct {
|
||||||
|
selector
|
||||||
|
build *ScaUserFollowsQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the group-by query.
|
||||||
|
func (sufgb *ScaUserFollowsGroupBy) Aggregate(fns ...AggregateFunc) *ScaUserFollowsGroupBy {
|
||||||
|
sufgb.fns = append(sufgb.fns, fns...)
|
||||||
|
return sufgb
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (sufgb *ScaUserFollowsGroupBy) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, sufgb.build.ctx, ent.OpQueryGroupBy)
|
||||||
|
if err := sufgb.build.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaUserFollowsQuery, *ScaUserFollowsGroupBy](ctx, sufgb.build, sufgb, sufgb.build.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufgb *ScaUserFollowsGroupBy) sqlScan(ctx context.Context, root *ScaUserFollowsQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx).Select()
|
||||||
|
aggregation := make([]string, 0, len(sufgb.fns))
|
||||||
|
for _, fn := range sufgb.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
|
columns := make([]string, 0, len(*sufgb.flds)+len(sufgb.fns))
|
||||||
|
for _, f := range *sufgb.flds {
|
||||||
|
columns = append(columns, selector.C(f))
|
||||||
|
}
|
||||||
|
columns = append(columns, aggregation...)
|
||||||
|
selector.Select(columns...)
|
||||||
|
}
|
||||||
|
selector.GroupBy(selector.Columns(*sufgb.flds...)...)
|
||||||
|
if err := selector.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := sufgb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsSelect is the builder for selecting fields of ScaUserFollows entities.
|
||||||
|
type ScaUserFollowsSelect struct {
|
||||||
|
*ScaUserFollowsQuery
|
||||||
|
selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (sufs *ScaUserFollowsSelect) Aggregate(fns ...AggregateFunc) *ScaUserFollowsSelect {
|
||||||
|
sufs.fns = append(sufs.fns, fns...)
|
||||||
|
return sufs
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (sufs *ScaUserFollowsSelect) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, sufs.ctx, ent.OpQuerySelect)
|
||||||
|
if err := sufs.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaUserFollowsQuery, *ScaUserFollowsSelect](ctx, sufs.ScaUserFollowsQuery, sufs, sufs.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufs *ScaUserFollowsSelect) sqlScan(ctx context.Context, root *ScaUserFollowsQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx)
|
||||||
|
aggregation := make([]string, 0, len(sufs.fns))
|
||||||
|
for _, fn := range sufs.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
switch n := len(*sufs.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
selector.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
selector.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := sufs.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
297
app/core/api/repository/mysql/ent/scauserfollows_update.go
Normal file
297
app/core/api/repository/mysql/ent/scauserfollows_update.go
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserfollows"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserFollowsUpdate is the builder for updating ScaUserFollows entities.
|
||||||
|
type ScaUserFollowsUpdate struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaUserFollowsMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserFollowsUpdate builder.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) Where(ps ...predicate.ScaUserFollows) *ScaUserFollowsUpdate {
|
||||||
|
sufu.mutation.Where(ps...)
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFollowerID sets the "follower_id" field.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) SetFollowerID(s string) *ScaUserFollowsUpdate {
|
||||||
|
sufu.mutation.SetFollowerID(s)
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableFollowerID sets the "follower_id" field if the given value is not nil.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) SetNillableFollowerID(s *string) *ScaUserFollowsUpdate {
|
||||||
|
if s != nil {
|
||||||
|
sufu.SetFollowerID(*s)
|
||||||
|
}
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFolloweeID sets the "followee_id" field.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) SetFolloweeID(s string) *ScaUserFollowsUpdate {
|
||||||
|
sufu.mutation.SetFolloweeID(s)
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableFolloweeID sets the "followee_id" field if the given value is not nil.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) SetNillableFolloweeID(s *string) *ScaUserFollowsUpdate {
|
||||||
|
if s != nil {
|
||||||
|
sufu.SetFolloweeID(*s)
|
||||||
|
}
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetStatus sets the "status" field.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) SetStatus(u uint8) *ScaUserFollowsUpdate {
|
||||||
|
sufu.mutation.ResetStatus()
|
||||||
|
sufu.mutation.SetStatus(u)
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) SetNillableStatus(u *uint8) *ScaUserFollowsUpdate {
|
||||||
|
if u != nil {
|
||||||
|
sufu.SetStatus(*u)
|
||||||
|
}
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStatus adds u to the "status" field.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) AddStatus(u int8) *ScaUserFollowsUpdate {
|
||||||
|
sufu.mutation.AddStatus(u)
|
||||||
|
return sufu
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaUserFollowsMutation object of the builder.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) Mutation() *ScaUserFollowsMutation {
|
||||||
|
return sufu.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) Save(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, sufu.sqlSave, sufu.mutation, sufu.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) SaveX(ctx context.Context) int {
|
||||||
|
affected, err := sufu.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return affected
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) Exec(ctx context.Context) error {
|
||||||
|
_, err := sufu.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sufu *ScaUserFollowsUpdate) ExecX(ctx context.Context) {
|
||||||
|
if err := sufu.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufu *ScaUserFollowsUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scauserfollows.Table, scauserfollows.Columns, sqlgraph.NewFieldSpec(scauserfollows.FieldID, field.TypeInt))
|
||||||
|
if ps := sufu.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := sufu.mutation.FollowerID(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldFollowerID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sufu.mutation.FolloweeID(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldFolloweeID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sufu.mutation.Status(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldStatus, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
if value, ok := sufu.mutation.AddedStatus(); ok {
|
||||||
|
_spec.AddField(scauserfollows.FieldStatus, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
if n, err = sqlgraph.UpdateNodes(ctx, sufu.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scauserfollows.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
sufu.mutation.done = true
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserFollowsUpdateOne is the builder for updating a single ScaUserFollows entity.
|
||||||
|
type ScaUserFollowsUpdateOne struct {
|
||||||
|
config
|
||||||
|
fields []string
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaUserFollowsMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFollowerID sets the "follower_id" field.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) SetFollowerID(s string) *ScaUserFollowsUpdateOne {
|
||||||
|
sufuo.mutation.SetFollowerID(s)
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableFollowerID sets the "follower_id" field if the given value is not nil.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) SetNillableFollowerID(s *string) *ScaUserFollowsUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
sufuo.SetFollowerID(*s)
|
||||||
|
}
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetFolloweeID sets the "followee_id" field.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) SetFolloweeID(s string) *ScaUserFollowsUpdateOne {
|
||||||
|
sufuo.mutation.SetFolloweeID(s)
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableFolloweeID sets the "followee_id" field if the given value is not nil.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) SetNillableFolloweeID(s *string) *ScaUserFollowsUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
sufuo.SetFolloweeID(*s)
|
||||||
|
}
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetStatus sets the "status" field.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) SetStatus(u uint8) *ScaUserFollowsUpdateOne {
|
||||||
|
sufuo.mutation.ResetStatus()
|
||||||
|
sufuo.mutation.SetStatus(u)
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) SetNillableStatus(u *uint8) *ScaUserFollowsUpdateOne {
|
||||||
|
if u != nil {
|
||||||
|
sufuo.SetStatus(*u)
|
||||||
|
}
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddStatus adds u to the "status" field.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) AddStatus(u int8) *ScaUserFollowsUpdateOne {
|
||||||
|
sufuo.mutation.AddStatus(u)
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaUserFollowsMutation object of the builder.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) Mutation() *ScaUserFollowsMutation {
|
||||||
|
return sufuo.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserFollowsUpdate builder.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) Where(ps ...predicate.ScaUserFollows) *ScaUserFollowsUpdateOne {
|
||||||
|
sufuo.mutation.Where(ps...)
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||||
|
// The default is selecting all fields defined in the entity schema.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) Select(field string, fields ...string) *ScaUserFollowsUpdateOne {
|
||||||
|
sufuo.fields = append([]string{field}, fields...)
|
||||||
|
return sufuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the updated ScaUserFollows entity.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) Save(ctx context.Context) (*ScaUserFollows, error) {
|
||||||
|
return withHooks(ctx, sufuo.sqlSave, sufuo.mutation, sufuo.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) SaveX(ctx context.Context) *ScaUserFollows {
|
||||||
|
node, err := sufuo.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query on the entity.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) Exec(ctx context.Context) error {
|
||||||
|
_, err := sufuo.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) ExecX(ctx context.Context) {
|
||||||
|
if err := sufuo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sufuo *ScaUserFollowsUpdateOne) sqlSave(ctx context.Context) (_node *ScaUserFollows, err error) {
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scauserfollows.Table, scauserfollows.Columns, sqlgraph.NewFieldSpec(scauserfollows.FieldID, field.TypeInt))
|
||||||
|
id, ok := sufuo.mutation.ID()
|
||||||
|
if !ok {
|
||||||
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ScaUserFollows.id" for update`)}
|
||||||
|
}
|
||||||
|
_spec.Node.ID.Value = id
|
||||||
|
if fields := sufuo.fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scauserfollows.FieldID)
|
||||||
|
for _, f := range fields {
|
||||||
|
if !scauserfollows.ValidColumn(f) {
|
||||||
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
if f != scauserfollows.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := sufuo.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := sufuo.mutation.FollowerID(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldFollowerID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sufuo.mutation.FolloweeID(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldFolloweeID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sufuo.mutation.Status(); ok {
|
||||||
|
_spec.SetField(scauserfollows.FieldStatus, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
if value, ok := sufuo.mutation.AddedStatus(); ok {
|
||||||
|
_spec.AddField(scauserfollows.FieldStatus, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
_node = &ScaUserFollows{config: sufuo.config}
|
||||||
|
_spec.Assign = _node.assignValues
|
||||||
|
_spec.ScanValues = _node.scanValues
|
||||||
|
if err = sqlgraph.UpdateNode(ctx, sufuo.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scauserfollows.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
sufuo.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
170
app/core/api/repository/mysql/ent/scauserlevel.go
Normal file
170
app/core/api/repository/mysql/ent/scauserlevel.go
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 用户等级表
|
||||||
|
type ScaUserLevel struct {
|
||||||
|
config `json:"-"`
|
||||||
|
// ID of the ent.
|
||||||
|
// 主键
|
||||||
|
ID int64 `json:"id,omitempty"`
|
||||||
|
// 用户Id
|
||||||
|
UserID string `json:"user_id,omitempty"`
|
||||||
|
// 等级类型
|
||||||
|
LevelType uint8 `json:"level_type,omitempty"`
|
||||||
|
// 等级
|
||||||
|
Level int `json:"level,omitempty"`
|
||||||
|
// 等级名称
|
||||||
|
LevelName string `json:"level_name,omitempty"`
|
||||||
|
// 开始经验值
|
||||||
|
ExpStart int64 `json:"exp_start,omitempty"`
|
||||||
|
// 结束经验值
|
||||||
|
ExpEnd int64 `json:"exp_end,omitempty"`
|
||||||
|
// 等级描述
|
||||||
|
LevelDescription string `json:"level_description,omitempty"`
|
||||||
|
selectValues sql.SelectValues
|
||||||
|
}
|
||||||
|
|
||||||
|
// scanValues returns the types for scanning values from sql.Rows.
|
||||||
|
func (*ScaUserLevel) scanValues(columns []string) ([]any, error) {
|
||||||
|
values := make([]any, len(columns))
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scauserlevel.FieldID, scauserlevel.FieldLevelType, scauserlevel.FieldLevel, scauserlevel.FieldExpStart, scauserlevel.FieldExpEnd:
|
||||||
|
values[i] = new(sql.NullInt64)
|
||||||
|
case scauserlevel.FieldUserID, scauserlevel.FieldLevelName, scauserlevel.FieldLevelDescription:
|
||||||
|
values[i] = new(sql.NullString)
|
||||||
|
default:
|
||||||
|
values[i] = new(sql.UnknownType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||||
|
// to the ScaUserLevel fields.
|
||||||
|
func (sul *ScaUserLevel) assignValues(columns []string, values []any) error {
|
||||||
|
if m, n := len(values), len(columns); m < n {
|
||||||
|
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||||
|
}
|
||||||
|
for i := range columns {
|
||||||
|
switch columns[i] {
|
||||||
|
case scauserlevel.FieldID:
|
||||||
|
value, ok := values[i].(*sql.NullInt64)
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field id", value)
|
||||||
|
}
|
||||||
|
sul.ID = int64(value.Int64)
|
||||||
|
case scauserlevel.FieldUserID:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field user_id", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
sul.UserID = value.String
|
||||||
|
}
|
||||||
|
case scauserlevel.FieldLevelType:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field level_type", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
sul.LevelType = uint8(value.Int64)
|
||||||
|
}
|
||||||
|
case scauserlevel.FieldLevel:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field level", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
sul.Level = int(value.Int64)
|
||||||
|
}
|
||||||
|
case scauserlevel.FieldLevelName:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field level_name", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
sul.LevelName = value.String
|
||||||
|
}
|
||||||
|
case scauserlevel.FieldExpStart:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field exp_start", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
sul.ExpStart = value.Int64
|
||||||
|
}
|
||||||
|
case scauserlevel.FieldExpEnd:
|
||||||
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field exp_end", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
sul.ExpEnd = value.Int64
|
||||||
|
}
|
||||||
|
case scauserlevel.FieldLevelDescription:
|
||||||
|
if value, ok := values[i].(*sql.NullString); !ok {
|
||||||
|
return fmt.Errorf("unexpected type %T for field level_description", values[i])
|
||||||
|
} else if value.Valid {
|
||||||
|
sul.LevelDescription = value.String
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
sul.selectValues.Set(columns[i], values[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value returns the ent.Value that was dynamically selected and assigned to the ScaUserLevel.
|
||||||
|
// This includes values selected through modifiers, order, etc.
|
||||||
|
func (sul *ScaUserLevel) Value(name string) (ent.Value, error) {
|
||||||
|
return sul.selectValues.Get(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update returns a builder for updating this ScaUserLevel.
|
||||||
|
// Note that you need to call ScaUserLevel.Unwrap() before calling this method if this ScaUserLevel
|
||||||
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
||||||
|
func (sul *ScaUserLevel) Update() *ScaUserLevelUpdateOne {
|
||||||
|
return NewScaUserLevelClient(sul.config).UpdateOne(sul)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap unwraps the ScaUserLevel entity that was returned from a transaction after it was closed,
|
||||||
|
// so that all future queries will be executed through the driver which created the transaction.
|
||||||
|
func (sul *ScaUserLevel) Unwrap() *ScaUserLevel {
|
||||||
|
_tx, ok := sul.config.driver.(*txDriver)
|
||||||
|
if !ok {
|
||||||
|
panic("ent: ScaUserLevel is not a transactional entity")
|
||||||
|
}
|
||||||
|
sul.config.driver = _tx.drv
|
||||||
|
return sul
|
||||||
|
}
|
||||||
|
|
||||||
|
// String implements the fmt.Stringer.
|
||||||
|
func (sul *ScaUserLevel) String() string {
|
||||||
|
var builder strings.Builder
|
||||||
|
builder.WriteString("ScaUserLevel(")
|
||||||
|
builder.WriteString(fmt.Sprintf("id=%v, ", sul.ID))
|
||||||
|
builder.WriteString("user_id=")
|
||||||
|
builder.WriteString(sul.UserID)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("level_type=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", sul.LevelType))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("level=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", sul.Level))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("level_name=")
|
||||||
|
builder.WriteString(sul.LevelName)
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("exp_start=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", sul.ExpStart))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("exp_end=")
|
||||||
|
builder.WriteString(fmt.Sprintf("%v", sul.ExpEnd))
|
||||||
|
builder.WriteString(", ")
|
||||||
|
builder.WriteString("level_description=")
|
||||||
|
builder.WriteString(sul.LevelDescription)
|
||||||
|
builder.WriteByte(')')
|
||||||
|
return builder.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevels is a parsable slice of ScaUserLevel.
|
||||||
|
type ScaUserLevels []*ScaUserLevel
|
||||||
100
app/core/api/repository/mysql/ent/scauserlevel/scauserlevel.go
Normal file
100
app/core/api/repository/mysql/ent/scauserlevel/scauserlevel.go
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scauserlevel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Label holds the string label denoting the scauserlevel type in the database.
|
||||||
|
Label = "sca_user_level"
|
||||||
|
// FieldID holds the string denoting the id field in the database.
|
||||||
|
FieldID = "id"
|
||||||
|
// FieldUserID holds the string denoting the user_id field in the database.
|
||||||
|
FieldUserID = "user_id"
|
||||||
|
// FieldLevelType holds the string denoting the level_type field in the database.
|
||||||
|
FieldLevelType = "level_type"
|
||||||
|
// FieldLevel holds the string denoting the level field in the database.
|
||||||
|
FieldLevel = "level"
|
||||||
|
// FieldLevelName holds the string denoting the level_name field in the database.
|
||||||
|
FieldLevelName = "level_name"
|
||||||
|
// FieldExpStart holds the string denoting the exp_start field in the database.
|
||||||
|
FieldExpStart = "exp_start"
|
||||||
|
// FieldExpEnd holds the string denoting the exp_end field in the database.
|
||||||
|
FieldExpEnd = "exp_end"
|
||||||
|
// FieldLevelDescription holds the string denoting the level_description field in the database.
|
||||||
|
FieldLevelDescription = "level_description"
|
||||||
|
// Table holds the table name of the scauserlevel in the database.
|
||||||
|
Table = "sca_user_level"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Columns holds all SQL columns for scauserlevel fields.
|
||||||
|
var Columns = []string{
|
||||||
|
FieldID,
|
||||||
|
FieldUserID,
|
||||||
|
FieldLevelType,
|
||||||
|
FieldLevel,
|
||||||
|
FieldLevelName,
|
||||||
|
FieldExpStart,
|
||||||
|
FieldExpEnd,
|
||||||
|
FieldLevelDescription,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||||
|
func ValidColumn(column string) bool {
|
||||||
|
for i := range Columns {
|
||||||
|
if column == Columns[i] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// LevelNameValidator is a validator for the "level_name" field. It is called by the builders before save.
|
||||||
|
LevelNameValidator func(string) error
|
||||||
|
)
|
||||||
|
|
||||||
|
// OrderOption defines the ordering options for the ScaUserLevel queries.
|
||||||
|
type OrderOption func(*sql.Selector)
|
||||||
|
|
||||||
|
// ByID orders the results by the id field.
|
||||||
|
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByUserID orders the results by the user_id field.
|
||||||
|
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByLevelType orders the results by the level_type field.
|
||||||
|
func ByLevelType(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldLevelType, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByLevel orders the results by the level field.
|
||||||
|
func ByLevel(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldLevel, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByLevelName orders the results by the level_name field.
|
||||||
|
func ByLevelName(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldLevelName, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByExpStart orders the results by the exp_start field.
|
||||||
|
func ByExpStart(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldExpStart, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByExpEnd orders the results by the exp_end field.
|
||||||
|
func ByExpEnd(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldExpEnd, opts...).ToFunc()
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByLevelDescription orders the results by the level_description field.
|
||||||
|
func ByLevelDescription(opts ...sql.OrderTermOption) OrderOption {
|
||||||
|
return sql.OrderByField(FieldLevelDescription, opts...).ToFunc()
|
||||||
|
}
|
||||||
469
app/core/api/repository/mysql/ent/scauserlevel/where.go
Normal file
469
app/core/api/repository/mysql/ent/scauserlevel/where.go
Normal file
@@ -0,0 +1,469 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package scauserlevel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ID filters vertices based on their ID field.
|
||||||
|
func ID(id int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDEQ applies the EQ predicate on the ID field.
|
||||||
|
func IDEQ(id int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNEQ applies the NEQ predicate on the ID field.
|
||||||
|
func IDNEQ(id int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDIn applies the In predicate on the ID field.
|
||||||
|
func IDIn(ids ...int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDNotIn applies the NotIn predicate on the ID field.
|
||||||
|
func IDNotIn(ids ...int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldID, ids...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGT applies the GT predicate on the ID field.
|
||||||
|
func IDGT(id int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDGTE applies the GTE predicate on the ID field.
|
||||||
|
func IDGTE(id int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLT applies the LT predicate on the ID field.
|
||||||
|
func IDLT(id int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDLTE applies the LTE predicate on the ID field.
|
||||||
|
func IDLTE(id int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldID, id))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
||||||
|
func UserID(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelType applies equality check predicate on the "level_type" field. It's identical to LevelTypeEQ.
|
||||||
|
func LevelType(v uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevelType, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Level applies equality check predicate on the "level" field. It's identical to LevelEQ.
|
||||||
|
func Level(v int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevel, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelName applies equality check predicate on the "level_name" field. It's identical to LevelNameEQ.
|
||||||
|
func LevelName(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStart applies equality check predicate on the "exp_start" field. It's identical to ExpStartEQ.
|
||||||
|
func ExpStart(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldExpStart, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEnd applies equality check predicate on the "exp_end" field. It's identical to ExpEndEQ.
|
||||||
|
func ExpEnd(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldExpEnd, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescription applies equality check predicate on the "level_description" field. It's identical to LevelDescriptionEQ.
|
||||||
|
func LevelDescription(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
||||||
|
func UserIDEQ(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
|
||||||
|
func UserIDNEQ(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDIn applies the In predicate on the "user_id" field.
|
||||||
|
func UserIDIn(vs ...string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldUserID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
|
||||||
|
func UserIDNotIn(vs ...string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldUserID, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDGT applies the GT predicate on the "user_id" field.
|
||||||
|
func UserIDGT(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDGTE applies the GTE predicate on the "user_id" field.
|
||||||
|
func UserIDGTE(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDLT applies the LT predicate on the "user_id" field.
|
||||||
|
func UserIDLT(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDLTE applies the LTE predicate on the "user_id" field.
|
||||||
|
func UserIDLTE(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDContains applies the Contains predicate on the "user_id" field.
|
||||||
|
func UserIDContains(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldContains(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDHasPrefix applies the HasPrefix predicate on the "user_id" field.
|
||||||
|
func UserIDHasPrefix(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldHasPrefix(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDHasSuffix applies the HasSuffix predicate on the "user_id" field.
|
||||||
|
func UserIDHasSuffix(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldHasSuffix(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDEqualFold applies the EqualFold predicate on the "user_id" field.
|
||||||
|
func UserIDEqualFold(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEqualFold(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserIDContainsFold applies the ContainsFold predicate on the "user_id" field.
|
||||||
|
func UserIDContainsFold(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldContainsFold(FieldUserID, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeEQ applies the EQ predicate on the "level_type" field.
|
||||||
|
func LevelTypeEQ(v uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevelType, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeNEQ applies the NEQ predicate on the "level_type" field.
|
||||||
|
func LevelTypeNEQ(v uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldLevelType, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeIn applies the In predicate on the "level_type" field.
|
||||||
|
func LevelTypeIn(vs ...uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldLevelType, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeNotIn applies the NotIn predicate on the "level_type" field.
|
||||||
|
func LevelTypeNotIn(vs ...uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldLevelType, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeGT applies the GT predicate on the "level_type" field.
|
||||||
|
func LevelTypeGT(v uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldLevelType, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeGTE applies the GTE predicate on the "level_type" field.
|
||||||
|
func LevelTypeGTE(v uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldLevelType, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeLT applies the LT predicate on the "level_type" field.
|
||||||
|
func LevelTypeLT(v uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldLevelType, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelTypeLTE applies the LTE predicate on the "level_type" field.
|
||||||
|
func LevelTypeLTE(v uint8) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldLevelType, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelEQ applies the EQ predicate on the "level" field.
|
||||||
|
func LevelEQ(v int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevel, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNEQ applies the NEQ predicate on the "level" field.
|
||||||
|
func LevelNEQ(v int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldLevel, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelIn applies the In predicate on the "level" field.
|
||||||
|
func LevelIn(vs ...int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldLevel, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNotIn applies the NotIn predicate on the "level" field.
|
||||||
|
func LevelNotIn(vs ...int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldLevel, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelGT applies the GT predicate on the "level" field.
|
||||||
|
func LevelGT(v int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldLevel, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelGTE applies the GTE predicate on the "level" field.
|
||||||
|
func LevelGTE(v int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldLevel, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelLT applies the LT predicate on the "level" field.
|
||||||
|
func LevelLT(v int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldLevel, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelLTE applies the LTE predicate on the "level" field.
|
||||||
|
func LevelLTE(v int) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldLevel, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameEQ applies the EQ predicate on the "level_name" field.
|
||||||
|
func LevelNameEQ(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameNEQ applies the NEQ predicate on the "level_name" field.
|
||||||
|
func LevelNameNEQ(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameIn applies the In predicate on the "level_name" field.
|
||||||
|
func LevelNameIn(vs ...string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldLevelName, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameNotIn applies the NotIn predicate on the "level_name" field.
|
||||||
|
func LevelNameNotIn(vs ...string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldLevelName, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameGT applies the GT predicate on the "level_name" field.
|
||||||
|
func LevelNameGT(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameGTE applies the GTE predicate on the "level_name" field.
|
||||||
|
func LevelNameGTE(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameLT applies the LT predicate on the "level_name" field.
|
||||||
|
func LevelNameLT(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameLTE applies the LTE predicate on the "level_name" field.
|
||||||
|
func LevelNameLTE(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameContains applies the Contains predicate on the "level_name" field.
|
||||||
|
func LevelNameContains(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldContains(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameHasPrefix applies the HasPrefix predicate on the "level_name" field.
|
||||||
|
func LevelNameHasPrefix(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldHasPrefix(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameHasSuffix applies the HasSuffix predicate on the "level_name" field.
|
||||||
|
func LevelNameHasSuffix(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldHasSuffix(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameEqualFold applies the EqualFold predicate on the "level_name" field.
|
||||||
|
func LevelNameEqualFold(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEqualFold(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelNameContainsFold applies the ContainsFold predicate on the "level_name" field.
|
||||||
|
func LevelNameContainsFold(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldContainsFold(FieldLevelName, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartEQ applies the EQ predicate on the "exp_start" field.
|
||||||
|
func ExpStartEQ(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldExpStart, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartNEQ applies the NEQ predicate on the "exp_start" field.
|
||||||
|
func ExpStartNEQ(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldExpStart, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartIn applies the In predicate on the "exp_start" field.
|
||||||
|
func ExpStartIn(vs ...int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldExpStart, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartNotIn applies the NotIn predicate on the "exp_start" field.
|
||||||
|
func ExpStartNotIn(vs ...int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldExpStart, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartGT applies the GT predicate on the "exp_start" field.
|
||||||
|
func ExpStartGT(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldExpStart, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartGTE applies the GTE predicate on the "exp_start" field.
|
||||||
|
func ExpStartGTE(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldExpStart, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartLT applies the LT predicate on the "exp_start" field.
|
||||||
|
func ExpStartLT(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldExpStart, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpStartLTE applies the LTE predicate on the "exp_start" field.
|
||||||
|
func ExpStartLTE(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldExpStart, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndEQ applies the EQ predicate on the "exp_end" field.
|
||||||
|
func ExpEndEQ(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldExpEnd, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndNEQ applies the NEQ predicate on the "exp_end" field.
|
||||||
|
func ExpEndNEQ(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldExpEnd, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndIn applies the In predicate on the "exp_end" field.
|
||||||
|
func ExpEndIn(vs ...int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldExpEnd, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndNotIn applies the NotIn predicate on the "exp_end" field.
|
||||||
|
func ExpEndNotIn(vs ...int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldExpEnd, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndGT applies the GT predicate on the "exp_end" field.
|
||||||
|
func ExpEndGT(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldExpEnd, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndGTE applies the GTE predicate on the "exp_end" field.
|
||||||
|
func ExpEndGTE(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldExpEnd, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndLT applies the LT predicate on the "exp_end" field.
|
||||||
|
func ExpEndLT(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldExpEnd, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpEndLTE applies the LTE predicate on the "exp_end" field.
|
||||||
|
func ExpEndLTE(v int64) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldExpEnd, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionEQ applies the EQ predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionEQ(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEQ(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionNEQ applies the NEQ predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionNEQ(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNEQ(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionIn applies the In predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionIn(vs ...string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIn(FieldLevelDescription, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionNotIn applies the NotIn predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionNotIn(vs ...string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotIn(FieldLevelDescription, vs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionGT applies the GT predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionGT(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGT(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionGTE applies the GTE predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionGTE(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldGTE(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionLT applies the LT predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionLT(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLT(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionLTE applies the LTE predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionLTE(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldLTE(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionContains applies the Contains predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionContains(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldContains(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionHasPrefix applies the HasPrefix predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionHasPrefix(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldHasPrefix(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionHasSuffix applies the HasSuffix predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionHasSuffix(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldHasSuffix(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionIsNil applies the IsNil predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionIsNil() predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldIsNull(FieldLevelDescription))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionNotNil applies the NotNil predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionNotNil() predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldNotNull(FieldLevelDescription))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionEqualFold applies the EqualFold predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionEqualFold(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldEqualFold(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// LevelDescriptionContainsFold applies the ContainsFold predicate on the "level_description" field.
|
||||||
|
func LevelDescriptionContainsFold(v string) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.FieldContainsFold(FieldLevelDescription, v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// And groups predicates with the AND operator between them.
|
||||||
|
func And(predicates ...predicate.ScaUserLevel) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.AndPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Or groups predicates with the OR operator between them.
|
||||||
|
func Or(predicates ...predicate.ScaUserLevel) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.OrPredicates(predicates...))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not applies the not operator on the given predicate.
|
||||||
|
func Not(p predicate.ScaUserLevel) predicate.ScaUserLevel {
|
||||||
|
return predicate.ScaUserLevel(sql.NotPredicates(p))
|
||||||
|
}
|
||||||
283
app/core/api/repository/mysql/ent/scauserlevel_create.go
Normal file
283
app/core/api/repository/mysql/ent/scauserlevel_create.go
Normal file
@@ -0,0 +1,283 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserLevelCreate is the builder for creating a ScaUserLevel entity.
|
||||||
|
type ScaUserLevelCreate struct {
|
||||||
|
config
|
||||||
|
mutation *ScaUserLevelMutation
|
||||||
|
hooks []Hook
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUserID sets the "user_id" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetUserID(s string) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetUserID(s)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelType sets the "level_type" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetLevelType(u uint8) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetLevelType(u)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevel sets the "level" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetLevel(i int) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetLevel(i)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelName sets the "level_name" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetLevelName(s string) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetLevelName(s)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExpStart sets the "exp_start" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetExpStart(i int64) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetExpStart(i)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExpEnd sets the "exp_end" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetExpEnd(i int64) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetExpEnd(i)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelDescription sets the "level_description" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetLevelDescription(s string) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetLevelDescription(s)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevelDescription sets the "level_description" field if the given value is not nil.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetNillableLevelDescription(s *string) *ScaUserLevelCreate {
|
||||||
|
if s != nil {
|
||||||
|
sulc.SetLevelDescription(*s)
|
||||||
|
}
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetID sets the "id" field.
|
||||||
|
func (sulc *ScaUserLevelCreate) SetID(i int64) *ScaUserLevelCreate {
|
||||||
|
sulc.mutation.SetID(i)
|
||||||
|
return sulc
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaUserLevelMutation object of the builder.
|
||||||
|
func (sulc *ScaUserLevelCreate) Mutation() *ScaUserLevelMutation {
|
||||||
|
return sulc.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaUserLevel in the database.
|
||||||
|
func (sulc *ScaUserLevelCreate) Save(ctx context.Context) (*ScaUserLevel, error) {
|
||||||
|
return withHooks(ctx, sulc.sqlSave, sulc.mutation, sulc.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX calls Save and panics if Save returns an error.
|
||||||
|
func (sulc *ScaUserLevelCreate) SaveX(ctx context.Context) *ScaUserLevel {
|
||||||
|
v, err := sulc.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sulc *ScaUserLevelCreate) Exec(ctx context.Context) error {
|
||||||
|
_, err := sulc.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sulc *ScaUserLevelCreate) ExecX(ctx context.Context) {
|
||||||
|
if err := sulc.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (sulc *ScaUserLevelCreate) check() error {
|
||||||
|
if _, ok := sulc.mutation.UserID(); !ok {
|
||||||
|
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "ScaUserLevel.user_id"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sulc.mutation.LevelType(); !ok {
|
||||||
|
return &ValidationError{Name: "level_type", err: errors.New(`ent: missing required field "ScaUserLevel.level_type"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sulc.mutation.Level(); !ok {
|
||||||
|
return &ValidationError{Name: "level", err: errors.New(`ent: missing required field "ScaUserLevel.level"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sulc.mutation.LevelName(); !ok {
|
||||||
|
return &ValidationError{Name: "level_name", err: errors.New(`ent: missing required field "ScaUserLevel.level_name"`)}
|
||||||
|
}
|
||||||
|
if v, ok := sulc.mutation.LevelName(); ok {
|
||||||
|
if err := scauserlevel.LevelNameValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "level_name", err: fmt.Errorf(`ent: validator failed for field "ScaUserLevel.level_name": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, ok := sulc.mutation.ExpStart(); !ok {
|
||||||
|
return &ValidationError{Name: "exp_start", err: errors.New(`ent: missing required field "ScaUserLevel.exp_start"`)}
|
||||||
|
}
|
||||||
|
if _, ok := sulc.mutation.ExpEnd(); !ok {
|
||||||
|
return &ValidationError{Name: "exp_end", err: errors.New(`ent: missing required field "ScaUserLevel.exp_end"`)}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulc *ScaUserLevelCreate) sqlSave(ctx context.Context) (*ScaUserLevel, error) {
|
||||||
|
if err := sulc.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_node, _spec := sulc.createSpec()
|
||||||
|
if err := sqlgraph.CreateNode(ctx, sulc.driver, _spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if _spec.ID.Value != _node.ID {
|
||||||
|
id := _spec.ID.Value.(int64)
|
||||||
|
_node.ID = int64(id)
|
||||||
|
}
|
||||||
|
sulc.mutation.id = &_node.ID
|
||||||
|
sulc.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulc *ScaUserLevelCreate) createSpec() (*ScaUserLevel, *sqlgraph.CreateSpec) {
|
||||||
|
var (
|
||||||
|
_node = &ScaUserLevel{config: sulc.config}
|
||||||
|
_spec = sqlgraph.NewCreateSpec(scauserlevel.Table, sqlgraph.NewFieldSpec(scauserlevel.FieldID, field.TypeInt64))
|
||||||
|
)
|
||||||
|
if id, ok := sulc.mutation.ID(); ok {
|
||||||
|
_node.ID = id
|
||||||
|
_spec.ID.Value = id
|
||||||
|
}
|
||||||
|
if value, ok := sulc.mutation.UserID(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldUserID, field.TypeString, value)
|
||||||
|
_node.UserID = value
|
||||||
|
}
|
||||||
|
if value, ok := sulc.mutation.LevelType(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelType, field.TypeUint8, value)
|
||||||
|
_node.LevelType = value
|
||||||
|
}
|
||||||
|
if value, ok := sulc.mutation.Level(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevel, field.TypeInt, value)
|
||||||
|
_node.Level = value
|
||||||
|
}
|
||||||
|
if value, ok := sulc.mutation.LevelName(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelName, field.TypeString, value)
|
||||||
|
_node.LevelName = value
|
||||||
|
}
|
||||||
|
if value, ok := sulc.mutation.ExpStart(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldExpStart, field.TypeInt64, value)
|
||||||
|
_node.ExpStart = value
|
||||||
|
}
|
||||||
|
if value, ok := sulc.mutation.ExpEnd(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldExpEnd, field.TypeInt64, value)
|
||||||
|
_node.ExpEnd = value
|
||||||
|
}
|
||||||
|
if value, ok := sulc.mutation.LevelDescription(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelDescription, field.TypeString, value)
|
||||||
|
_node.LevelDescription = value
|
||||||
|
}
|
||||||
|
return _node, _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevelCreateBulk is the builder for creating many ScaUserLevel entities in bulk.
|
||||||
|
type ScaUserLevelCreateBulk struct {
|
||||||
|
config
|
||||||
|
err error
|
||||||
|
builders []*ScaUserLevelCreate
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save creates the ScaUserLevel entities in the database.
|
||||||
|
func (sulcb *ScaUserLevelCreateBulk) Save(ctx context.Context) ([]*ScaUserLevel, error) {
|
||||||
|
if sulcb.err != nil {
|
||||||
|
return nil, sulcb.err
|
||||||
|
}
|
||||||
|
specs := make([]*sqlgraph.CreateSpec, len(sulcb.builders))
|
||||||
|
nodes := make([]*ScaUserLevel, len(sulcb.builders))
|
||||||
|
mutators := make([]Mutator, len(sulcb.builders))
|
||||||
|
for i := range sulcb.builders {
|
||||||
|
func(i int, root context.Context) {
|
||||||
|
builder := sulcb.builders[i]
|
||||||
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||||
|
mutation, ok := m.(*ScaUserLevelMutation)
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||||
|
}
|
||||||
|
if err := builder.check(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
builder.mutation = mutation
|
||||||
|
var err error
|
||||||
|
nodes[i], specs[i] = builder.createSpec()
|
||||||
|
if i < len(mutators)-1 {
|
||||||
|
_, err = mutators[i+1].Mutate(root, sulcb.builders[i+1].mutation)
|
||||||
|
} else {
|
||||||
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
||||||
|
// Invoke the actual operation on the latest mutation in the chain.
|
||||||
|
if err = sqlgraph.BatchCreate(ctx, sulcb.driver, spec); err != nil {
|
||||||
|
if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
mutation.id = &nodes[i].ID
|
||||||
|
if specs[i].ID.Value != nil && nodes[i].ID == 0 {
|
||||||
|
id := specs[i].ID.Value.(int64)
|
||||||
|
nodes[i].ID = int64(id)
|
||||||
|
}
|
||||||
|
mutation.done = true
|
||||||
|
return nodes[i], nil
|
||||||
|
})
|
||||||
|
for i := len(builder.hooks) - 1; i >= 0; i-- {
|
||||||
|
mut = builder.hooks[i](mut)
|
||||||
|
}
|
||||||
|
mutators[i] = mut
|
||||||
|
}(i, ctx)
|
||||||
|
}
|
||||||
|
if len(mutators) > 0 {
|
||||||
|
if _, err := mutators[0].Mutate(ctx, sulcb.builders[0].mutation); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (sulcb *ScaUserLevelCreateBulk) SaveX(ctx context.Context) []*ScaUserLevel {
|
||||||
|
v, err := sulcb.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sulcb *ScaUserLevelCreateBulk) Exec(ctx context.Context) error {
|
||||||
|
_, err := sulcb.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sulcb *ScaUserLevelCreateBulk) ExecX(ctx context.Context) {
|
||||||
|
if err := sulcb.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
88
app/core/api/repository/mysql/ent/scauserlevel_delete.go
Normal file
88
app/core/api/repository/mysql/ent/scauserlevel_delete.go
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserLevelDelete is the builder for deleting a ScaUserLevel entity.
|
||||||
|
type ScaUserLevelDelete struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaUserLevelMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserLevelDelete builder.
|
||||||
|
func (suld *ScaUserLevelDelete) Where(ps ...predicate.ScaUserLevel) *ScaUserLevelDelete {
|
||||||
|
suld.mutation.Where(ps...)
|
||||||
|
return suld
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query and returns how many vertices were deleted.
|
||||||
|
func (suld *ScaUserLevelDelete) Exec(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, suld.sqlExec, suld.mutation, suld.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (suld *ScaUserLevelDelete) ExecX(ctx context.Context) int {
|
||||||
|
n, err := suld.Exec(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suld *ScaUserLevelDelete) sqlExec(ctx context.Context) (int, error) {
|
||||||
|
_spec := sqlgraph.NewDeleteSpec(scauserlevel.Table, sqlgraph.NewFieldSpec(scauserlevel.FieldID, field.TypeInt64))
|
||||||
|
if ps := suld.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
affected, err := sqlgraph.DeleteNodes(ctx, suld.driver, _spec)
|
||||||
|
if err != nil && sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
suld.mutation.done = true
|
||||||
|
return affected, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevelDeleteOne is the builder for deleting a single ScaUserLevel entity.
|
||||||
|
type ScaUserLevelDeleteOne struct {
|
||||||
|
suld *ScaUserLevelDelete
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserLevelDelete builder.
|
||||||
|
func (suldo *ScaUserLevelDeleteOne) Where(ps ...predicate.ScaUserLevel) *ScaUserLevelDeleteOne {
|
||||||
|
suldo.suld.mutation.Where(ps...)
|
||||||
|
return suldo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the deletion query.
|
||||||
|
func (suldo *ScaUserLevelDeleteOne) Exec(ctx context.Context) error {
|
||||||
|
n, err := suldo.suld.Exec(ctx)
|
||||||
|
switch {
|
||||||
|
case err != nil:
|
||||||
|
return err
|
||||||
|
case n == 0:
|
||||||
|
return &NotFoundError{scauserlevel.Label}
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (suldo *ScaUserLevelDeleteOne) ExecX(ctx context.Context) {
|
||||||
|
if err := suldo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
527
app/core/api/repository/mysql/ent/scauserlevel_query.go
Normal file
527
app/core/api/repository/mysql/ent/scauserlevel_query.go
Normal file
@@ -0,0 +1,527 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserLevelQuery is the builder for querying ScaUserLevel entities.
|
||||||
|
type ScaUserLevelQuery struct {
|
||||||
|
config
|
||||||
|
ctx *QueryContext
|
||||||
|
order []scauserlevel.OrderOption
|
||||||
|
inters []Interceptor
|
||||||
|
predicates []predicate.ScaUserLevel
|
||||||
|
// intermediate query (i.e. traversal path).
|
||||||
|
sql *sql.Selector
|
||||||
|
path func(context.Context) (*sql.Selector, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where adds a new predicate for the ScaUserLevelQuery builder.
|
||||||
|
func (sulq *ScaUserLevelQuery) Where(ps ...predicate.ScaUserLevel) *ScaUserLevelQuery {
|
||||||
|
sulq.predicates = append(sulq.predicates, ps...)
|
||||||
|
return sulq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit the number of records to be returned by this query.
|
||||||
|
func (sulq *ScaUserLevelQuery) Limit(limit int) *ScaUserLevelQuery {
|
||||||
|
sulq.ctx.Limit = &limit
|
||||||
|
return sulq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Offset to start from.
|
||||||
|
func (sulq *ScaUserLevelQuery) Offset(offset int) *ScaUserLevelQuery {
|
||||||
|
sulq.ctx.Offset = &offset
|
||||||
|
return sulq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unique configures the query builder to filter duplicate records on query.
|
||||||
|
// By default, unique is set to true, and can be disabled using this method.
|
||||||
|
func (sulq *ScaUserLevelQuery) Unique(unique bool) *ScaUserLevelQuery {
|
||||||
|
sulq.ctx.Unique = &unique
|
||||||
|
return sulq
|
||||||
|
}
|
||||||
|
|
||||||
|
// Order specifies how the records should be ordered.
|
||||||
|
func (sulq *ScaUserLevelQuery) Order(o ...scauserlevel.OrderOption) *ScaUserLevelQuery {
|
||||||
|
sulq.order = append(sulq.order, o...)
|
||||||
|
return sulq
|
||||||
|
}
|
||||||
|
|
||||||
|
// First returns the first ScaUserLevel entity from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaUserLevel was found.
|
||||||
|
func (sulq *ScaUserLevelQuery) First(ctx context.Context) (*ScaUserLevel, error) {
|
||||||
|
nodes, err := sulq.Limit(1).All(setContextOp(ctx, sulq.ctx, ent.OpQueryFirst))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nil, &NotFoundError{scauserlevel.Label}
|
||||||
|
}
|
||||||
|
return nodes[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstX is like First, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) FirstX(ctx context.Context) *ScaUserLevel {
|
||||||
|
node, err := sulq.First(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstID returns the first ScaUserLevel ID from the query.
|
||||||
|
// Returns a *NotFoundError when no ScaUserLevel ID was found.
|
||||||
|
func (sulq *ScaUserLevelQuery) FirstID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = sulq.Limit(1).IDs(setContextOp(ctx, sulq.ctx, ent.OpQueryFirstID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(ids) == 0 {
|
||||||
|
err = &NotFoundError{scauserlevel.Label}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return ids[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// FirstIDX is like FirstID, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) FirstIDX(ctx context.Context) int64 {
|
||||||
|
id, err := sulq.FirstID(ctx)
|
||||||
|
if err != nil && !IsNotFound(err) {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only returns a single ScaUserLevel entity found by the query, ensuring it only returns one.
|
||||||
|
// Returns a *NotSingularError when more than one ScaUserLevel entity is found.
|
||||||
|
// Returns a *NotFoundError when no ScaUserLevel entities are found.
|
||||||
|
func (sulq *ScaUserLevelQuery) Only(ctx context.Context) (*ScaUserLevel, error) {
|
||||||
|
nodes, err := sulq.Limit(2).All(setContextOp(ctx, sulq.ctx, ent.OpQueryOnly))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch len(nodes) {
|
||||||
|
case 1:
|
||||||
|
return nodes[0], nil
|
||||||
|
case 0:
|
||||||
|
return nil, &NotFoundError{scauserlevel.Label}
|
||||||
|
default:
|
||||||
|
return nil, &NotSingularError{scauserlevel.Label}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyX is like Only, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) OnlyX(ctx context.Context) *ScaUserLevel {
|
||||||
|
node, err := sulq.Only(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyID is like Only, but returns the only ScaUserLevel ID in the query.
|
||||||
|
// Returns a *NotSingularError when more than one ScaUserLevel ID is found.
|
||||||
|
// Returns a *NotFoundError when no entities are found.
|
||||||
|
func (sulq *ScaUserLevelQuery) OnlyID(ctx context.Context) (id int64, err error) {
|
||||||
|
var ids []int64
|
||||||
|
if ids, err = sulq.Limit(2).IDs(setContextOp(ctx, sulq.ctx, ent.OpQueryOnlyID)); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch len(ids) {
|
||||||
|
case 1:
|
||||||
|
id = ids[0]
|
||||||
|
case 0:
|
||||||
|
err = &NotFoundError{scauserlevel.Label}
|
||||||
|
default:
|
||||||
|
err = &NotSingularError{scauserlevel.Label}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnlyIDX is like OnlyID, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) OnlyIDX(ctx context.Context) int64 {
|
||||||
|
id, err := sulq.OnlyID(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
|
||||||
|
// All executes the query and returns a list of ScaUserLevels.
|
||||||
|
func (sulq *ScaUserLevelQuery) All(ctx context.Context) ([]*ScaUserLevel, error) {
|
||||||
|
ctx = setContextOp(ctx, sulq.ctx, ent.OpQueryAll)
|
||||||
|
if err := sulq.prepareQuery(ctx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
qr := querierAll[[]*ScaUserLevel, *ScaUserLevelQuery]()
|
||||||
|
return withInterceptors[[]*ScaUserLevel](ctx, sulq, qr, sulq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllX is like All, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) AllX(ctx context.Context) []*ScaUserLevel {
|
||||||
|
nodes, err := sulq.All(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDs executes the query and returns a list of ScaUserLevel IDs.
|
||||||
|
func (sulq *ScaUserLevelQuery) IDs(ctx context.Context) (ids []int64, err error) {
|
||||||
|
if sulq.ctx.Unique == nil && sulq.path != nil {
|
||||||
|
sulq.Unique(true)
|
||||||
|
}
|
||||||
|
ctx = setContextOp(ctx, sulq.ctx, ent.OpQueryIDs)
|
||||||
|
if err = sulq.Select(scauserlevel.FieldID).Scan(ctx, &ids); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return ids, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDsX is like IDs, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) IDsX(ctx context.Context) []int64 {
|
||||||
|
ids, err := sulq.IDs(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return ids
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count returns the count of the given query.
|
||||||
|
func (sulq *ScaUserLevelQuery) Count(ctx context.Context) (int, error) {
|
||||||
|
ctx = setContextOp(ctx, sulq.ctx, ent.OpQueryCount)
|
||||||
|
if err := sulq.prepareQuery(ctx); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return withInterceptors[int](ctx, sulq, querierCount[*ScaUserLevelQuery](), sulq.inters)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CountX is like Count, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) CountX(ctx context.Context) int {
|
||||||
|
count, err := sulq.Count(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exist returns true if the query has elements in the graph.
|
||||||
|
func (sulq *ScaUserLevelQuery) Exist(ctx context.Context) (bool, error) {
|
||||||
|
ctx = setContextOp(ctx, sulq.ctx, ent.OpQueryExist)
|
||||||
|
switch _, err := sulq.FirstID(ctx); {
|
||||||
|
case IsNotFound(err):
|
||||||
|
return false, nil
|
||||||
|
case err != nil:
|
||||||
|
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||||
|
default:
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExistX is like Exist, but panics if an error occurs.
|
||||||
|
func (sulq *ScaUserLevelQuery) ExistX(ctx context.Context) bool {
|
||||||
|
exist, err := sulq.Exist(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return exist
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone returns a duplicate of the ScaUserLevelQuery builder, including all associated steps. It can be
|
||||||
|
// used to prepare common query builders and use them differently after the clone is made.
|
||||||
|
func (sulq *ScaUserLevelQuery) Clone() *ScaUserLevelQuery {
|
||||||
|
if sulq == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &ScaUserLevelQuery{
|
||||||
|
config: sulq.config,
|
||||||
|
ctx: sulq.ctx.Clone(),
|
||||||
|
order: append([]scauserlevel.OrderOption{}, sulq.order...),
|
||||||
|
inters: append([]Interceptor{}, sulq.inters...),
|
||||||
|
predicates: append([]predicate.ScaUserLevel{}, sulq.predicates...),
|
||||||
|
// clone intermediate query.
|
||||||
|
sql: sulq.sql.Clone(),
|
||||||
|
path: sulq.path,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupBy is used to group vertices by one or more fields/columns.
|
||||||
|
// It is often used with aggregate functions, like: count, max, mean, min, sum.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// UserID string `json:"user_id,omitempty"`
|
||||||
|
// Count int `json:"count,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaUserLevel.Query().
|
||||||
|
// GroupBy(scauserlevel.FieldUserID).
|
||||||
|
// Aggregate(ent.Count()).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (sulq *ScaUserLevelQuery) GroupBy(field string, fields ...string) *ScaUserLevelGroupBy {
|
||||||
|
sulq.ctx.Fields = append([]string{field}, fields...)
|
||||||
|
grbuild := &ScaUserLevelGroupBy{build: sulq}
|
||||||
|
grbuild.flds = &sulq.ctx.Fields
|
||||||
|
grbuild.label = scauserlevel.Label
|
||||||
|
grbuild.scan = grbuild.Scan
|
||||||
|
return grbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows the selection one or more fields/columns for the given query,
|
||||||
|
// instead of selecting all fields in the entity.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
//
|
||||||
|
// var v []struct {
|
||||||
|
// UserID string `json:"user_id,omitempty"`
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// client.ScaUserLevel.Query().
|
||||||
|
// Select(scauserlevel.FieldUserID).
|
||||||
|
// Scan(ctx, &v)
|
||||||
|
func (sulq *ScaUserLevelQuery) Select(fields ...string) *ScaUserLevelSelect {
|
||||||
|
sulq.ctx.Fields = append(sulq.ctx.Fields, fields...)
|
||||||
|
sbuild := &ScaUserLevelSelect{ScaUserLevelQuery: sulq}
|
||||||
|
sbuild.label = scauserlevel.Label
|
||||||
|
sbuild.flds, sbuild.scan = &sulq.ctx.Fields, sbuild.Scan
|
||||||
|
return sbuild
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate returns a ScaUserLevelSelect configured with the given aggregations.
|
||||||
|
func (sulq *ScaUserLevelQuery) Aggregate(fns ...AggregateFunc) *ScaUserLevelSelect {
|
||||||
|
return sulq.Select().Aggregate(fns...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulq *ScaUserLevelQuery) prepareQuery(ctx context.Context) error {
|
||||||
|
for _, inter := range sulq.inters {
|
||||||
|
if inter == nil {
|
||||||
|
return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
|
||||||
|
}
|
||||||
|
if trv, ok := inter.(Traverser); ok {
|
||||||
|
if err := trv.Traverse(ctx, sulq); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, f := range sulq.ctx.Fields {
|
||||||
|
if !scauserlevel.ValidColumn(f) {
|
||||||
|
return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sulq.path != nil {
|
||||||
|
prev, err := sulq.path(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sulq.sql = prev
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulq *ScaUserLevelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*ScaUserLevel, error) {
|
||||||
|
var (
|
||||||
|
nodes = []*ScaUserLevel{}
|
||||||
|
_spec = sulq.querySpec()
|
||||||
|
)
|
||||||
|
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||||
|
return (*ScaUserLevel).scanValues(nil, columns)
|
||||||
|
}
|
||||||
|
_spec.Assign = func(columns []string, values []any) error {
|
||||||
|
node := &ScaUserLevel{config: sulq.config}
|
||||||
|
nodes = append(nodes, node)
|
||||||
|
return node.assignValues(columns, values)
|
||||||
|
}
|
||||||
|
for i := range hooks {
|
||||||
|
hooks[i](ctx, _spec)
|
||||||
|
}
|
||||||
|
if err := sqlgraph.QueryNodes(ctx, sulq.driver, _spec); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(nodes) == 0 {
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
return nodes, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulq *ScaUserLevelQuery) sqlCount(ctx context.Context) (int, error) {
|
||||||
|
_spec := sulq.querySpec()
|
||||||
|
_spec.Node.Columns = sulq.ctx.Fields
|
||||||
|
if len(sulq.ctx.Fields) > 0 {
|
||||||
|
_spec.Unique = sulq.ctx.Unique != nil && *sulq.ctx.Unique
|
||||||
|
}
|
||||||
|
return sqlgraph.CountNodes(ctx, sulq.driver, _spec)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulq *ScaUserLevelQuery) querySpec() *sqlgraph.QuerySpec {
|
||||||
|
_spec := sqlgraph.NewQuerySpec(scauserlevel.Table, scauserlevel.Columns, sqlgraph.NewFieldSpec(scauserlevel.FieldID, field.TypeInt64))
|
||||||
|
_spec.From = sulq.sql
|
||||||
|
if unique := sulq.ctx.Unique; unique != nil {
|
||||||
|
_spec.Unique = *unique
|
||||||
|
} else if sulq.path != nil {
|
||||||
|
_spec.Unique = true
|
||||||
|
}
|
||||||
|
if fields := sulq.ctx.Fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scauserlevel.FieldID)
|
||||||
|
for i := range fields {
|
||||||
|
if fields[i] != scauserlevel.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := sulq.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if limit := sulq.ctx.Limit; limit != nil {
|
||||||
|
_spec.Limit = *limit
|
||||||
|
}
|
||||||
|
if offset := sulq.ctx.Offset; offset != nil {
|
||||||
|
_spec.Offset = *offset
|
||||||
|
}
|
||||||
|
if ps := sulq.order; len(ps) > 0 {
|
||||||
|
_spec.Order = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _spec
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulq *ScaUserLevelQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||||
|
builder := sql.Dialect(sulq.driver.Dialect())
|
||||||
|
t1 := builder.Table(scauserlevel.Table)
|
||||||
|
columns := sulq.ctx.Fields
|
||||||
|
if len(columns) == 0 {
|
||||||
|
columns = scauserlevel.Columns
|
||||||
|
}
|
||||||
|
selector := builder.Select(t1.Columns(columns...)...).From(t1)
|
||||||
|
if sulq.sql != nil {
|
||||||
|
selector = sulq.sql
|
||||||
|
selector.Select(selector.Columns(columns...)...)
|
||||||
|
}
|
||||||
|
if sulq.ctx.Unique != nil && *sulq.ctx.Unique {
|
||||||
|
selector.Distinct()
|
||||||
|
}
|
||||||
|
for _, p := range sulq.predicates {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
for _, p := range sulq.order {
|
||||||
|
p(selector)
|
||||||
|
}
|
||||||
|
if offset := sulq.ctx.Offset; offset != nil {
|
||||||
|
// limit is mandatory for offset clause. We start
|
||||||
|
// with default value, and override it below if needed.
|
||||||
|
selector.Offset(*offset).Limit(math.MaxInt32)
|
||||||
|
}
|
||||||
|
if limit := sulq.ctx.Limit; limit != nil {
|
||||||
|
selector.Limit(*limit)
|
||||||
|
}
|
||||||
|
return selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevelGroupBy is the group-by builder for ScaUserLevel entities.
|
||||||
|
type ScaUserLevelGroupBy struct {
|
||||||
|
selector
|
||||||
|
build *ScaUserLevelQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the group-by query.
|
||||||
|
func (sulgb *ScaUserLevelGroupBy) Aggregate(fns ...AggregateFunc) *ScaUserLevelGroupBy {
|
||||||
|
sulgb.fns = append(sulgb.fns, fns...)
|
||||||
|
return sulgb
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (sulgb *ScaUserLevelGroupBy) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, sulgb.build.ctx, ent.OpQueryGroupBy)
|
||||||
|
if err := sulgb.build.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaUserLevelQuery, *ScaUserLevelGroupBy](ctx, sulgb.build, sulgb, sulgb.build.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulgb *ScaUserLevelGroupBy) sqlScan(ctx context.Context, root *ScaUserLevelQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx).Select()
|
||||||
|
aggregation := make([]string, 0, len(sulgb.fns))
|
||||||
|
for _, fn := range sulgb.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
if len(selector.SelectedColumns()) == 0 {
|
||||||
|
columns := make([]string, 0, len(*sulgb.flds)+len(sulgb.fns))
|
||||||
|
for _, f := range *sulgb.flds {
|
||||||
|
columns = append(columns, selector.C(f))
|
||||||
|
}
|
||||||
|
columns = append(columns, aggregation...)
|
||||||
|
selector.Select(columns...)
|
||||||
|
}
|
||||||
|
selector.GroupBy(selector.Columns(*sulgb.flds...)...)
|
||||||
|
if err := selector.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := sulgb.build.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevelSelect is the builder for selecting fields of ScaUserLevel entities.
|
||||||
|
type ScaUserLevelSelect struct {
|
||||||
|
*ScaUserLevelQuery
|
||||||
|
selector
|
||||||
|
}
|
||||||
|
|
||||||
|
// Aggregate adds the given aggregation functions to the selector query.
|
||||||
|
func (suls *ScaUserLevelSelect) Aggregate(fns ...AggregateFunc) *ScaUserLevelSelect {
|
||||||
|
suls.fns = append(suls.fns, fns...)
|
||||||
|
return suls
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scan applies the selector query and scans the result into the given value.
|
||||||
|
func (suls *ScaUserLevelSelect) Scan(ctx context.Context, v any) error {
|
||||||
|
ctx = setContextOp(ctx, suls.ctx, ent.OpQuerySelect)
|
||||||
|
if err := suls.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return scanWithInterceptors[*ScaUserLevelQuery, *ScaUserLevelSelect](ctx, suls.ScaUserLevelQuery, suls, suls.inters, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suls *ScaUserLevelSelect) sqlScan(ctx context.Context, root *ScaUserLevelQuery, v any) error {
|
||||||
|
selector := root.sqlQuery(ctx)
|
||||||
|
aggregation := make([]string, 0, len(suls.fns))
|
||||||
|
for _, fn := range suls.fns {
|
||||||
|
aggregation = append(aggregation, fn(selector))
|
||||||
|
}
|
||||||
|
switch n := len(*suls.selector.flds); {
|
||||||
|
case n == 0 && len(aggregation) > 0:
|
||||||
|
selector.Select(aggregation...)
|
||||||
|
case n != 0 && len(aggregation) > 0:
|
||||||
|
selector.AppendSelect(aggregation...)
|
||||||
|
}
|
||||||
|
rows := &sql.Rows{}
|
||||||
|
query, args := selector.Query()
|
||||||
|
if err := suls.driver.Query(ctx, query, args, rows); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
return sql.ScanSlice(rows, v)
|
||||||
|
}
|
||||||
537
app/core/api/repository/mysql/ent/scauserlevel_update.go
Normal file
537
app/core/api/repository/mysql/ent/scauserlevel_update.go
Normal file
@@ -0,0 +1,537 @@
|
|||||||
|
// Code generated by ent, DO NOT EDIT.
|
||||||
|
|
||||||
|
package ent
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/predicate"
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/ent/scauserlevel"
|
||||||
|
|
||||||
|
"entgo.io/ent/dialect/sql"
|
||||||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserLevelUpdate is the builder for updating ScaUserLevel entities.
|
||||||
|
type ScaUserLevelUpdate struct {
|
||||||
|
config
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaUserLevelMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserLevelUpdate builder.
|
||||||
|
func (sulu *ScaUserLevelUpdate) Where(ps ...predicate.ScaUserLevel) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.Where(ps...)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUserID sets the "user_id" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetUserID(s string) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.SetUserID(s)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetNillableUserID(s *string) *ScaUserLevelUpdate {
|
||||||
|
if s != nil {
|
||||||
|
sulu.SetUserID(*s)
|
||||||
|
}
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelType sets the "level_type" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetLevelType(u uint8) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.ResetLevelType()
|
||||||
|
sulu.mutation.SetLevelType(u)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevelType sets the "level_type" field if the given value is not nil.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetNillableLevelType(u *uint8) *ScaUserLevelUpdate {
|
||||||
|
if u != nil {
|
||||||
|
sulu.SetLevelType(*u)
|
||||||
|
}
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLevelType adds u to the "level_type" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) AddLevelType(u int8) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.AddLevelType(u)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevel sets the "level" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetLevel(i int) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.ResetLevel()
|
||||||
|
sulu.mutation.SetLevel(i)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevel sets the "level" field if the given value is not nil.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetNillableLevel(i *int) *ScaUserLevelUpdate {
|
||||||
|
if i != nil {
|
||||||
|
sulu.SetLevel(*i)
|
||||||
|
}
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLevel adds i to the "level" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) AddLevel(i int) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.AddLevel(i)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelName sets the "level_name" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetLevelName(s string) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.SetLevelName(s)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevelName sets the "level_name" field if the given value is not nil.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetNillableLevelName(s *string) *ScaUserLevelUpdate {
|
||||||
|
if s != nil {
|
||||||
|
sulu.SetLevelName(*s)
|
||||||
|
}
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExpStart sets the "exp_start" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetExpStart(i int64) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.ResetExpStart()
|
||||||
|
sulu.mutation.SetExpStart(i)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableExpStart sets the "exp_start" field if the given value is not nil.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetNillableExpStart(i *int64) *ScaUserLevelUpdate {
|
||||||
|
if i != nil {
|
||||||
|
sulu.SetExpStart(*i)
|
||||||
|
}
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddExpStart adds i to the "exp_start" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) AddExpStart(i int64) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.AddExpStart(i)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExpEnd sets the "exp_end" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetExpEnd(i int64) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.ResetExpEnd()
|
||||||
|
sulu.mutation.SetExpEnd(i)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableExpEnd sets the "exp_end" field if the given value is not nil.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetNillableExpEnd(i *int64) *ScaUserLevelUpdate {
|
||||||
|
if i != nil {
|
||||||
|
sulu.SetExpEnd(*i)
|
||||||
|
}
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddExpEnd adds i to the "exp_end" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) AddExpEnd(i int64) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.AddExpEnd(i)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelDescription sets the "level_description" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetLevelDescription(s string) *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.SetLevelDescription(s)
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevelDescription sets the "level_description" field if the given value is not nil.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SetNillableLevelDescription(s *string) *ScaUserLevelUpdate {
|
||||||
|
if s != nil {
|
||||||
|
sulu.SetLevelDescription(*s)
|
||||||
|
}
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearLevelDescription clears the value of the "level_description" field.
|
||||||
|
func (sulu *ScaUserLevelUpdate) ClearLevelDescription() *ScaUserLevelUpdate {
|
||||||
|
sulu.mutation.ClearLevelDescription()
|
||||||
|
return sulu
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaUserLevelMutation object of the builder.
|
||||||
|
func (sulu *ScaUserLevelUpdate) Mutation() *ScaUserLevelMutation {
|
||||||
|
return sulu.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||||
|
func (sulu *ScaUserLevelUpdate) Save(ctx context.Context) (int, error) {
|
||||||
|
return withHooks(ctx, sulu.sqlSave, sulu.mutation, sulu.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (sulu *ScaUserLevelUpdate) SaveX(ctx context.Context) int {
|
||||||
|
affected, err := sulu.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return affected
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query.
|
||||||
|
func (sulu *ScaUserLevelUpdate) Exec(ctx context.Context) error {
|
||||||
|
_, err := sulu.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (sulu *ScaUserLevelUpdate) ExecX(ctx context.Context) {
|
||||||
|
if err := sulu.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (sulu *ScaUserLevelUpdate) check() error {
|
||||||
|
if v, ok := sulu.mutation.LevelName(); ok {
|
||||||
|
if err := scauserlevel.LevelNameValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "level_name", err: fmt.Errorf(`ent: validator failed for field "ScaUserLevel.level_name": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sulu *ScaUserLevelUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
|
if err := sulu.check(); err != nil {
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scauserlevel.Table, scauserlevel.Columns, sqlgraph.NewFieldSpec(scauserlevel.FieldID, field.TypeInt64))
|
||||||
|
if ps := sulu.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.UserID(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldUserID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.LevelType(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelType, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.AddedLevelType(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldLevelType, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.Level(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevel, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.AddedLevel(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldLevel, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.LevelName(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelName, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.ExpStart(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldExpStart, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.AddedExpStart(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldExpStart, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.ExpEnd(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldExpEnd, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.AddedExpEnd(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldExpEnd, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := sulu.mutation.LevelDescription(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelDescription, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if sulu.mutation.LevelDescriptionCleared() {
|
||||||
|
_spec.ClearField(scauserlevel.FieldLevelDescription, field.TypeString)
|
||||||
|
}
|
||||||
|
if n, err = sqlgraph.UpdateNodes(ctx, sulu.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scauserlevel.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
sulu.mutation.done = true
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ScaUserLevelUpdateOne is the builder for updating a single ScaUserLevel entity.
|
||||||
|
type ScaUserLevelUpdateOne struct {
|
||||||
|
config
|
||||||
|
fields []string
|
||||||
|
hooks []Hook
|
||||||
|
mutation *ScaUserLevelMutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUserID sets the "user_id" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetUserID(s string) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.SetUserID(s)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableUserID sets the "user_id" field if the given value is not nil.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetNillableUserID(s *string) *ScaUserLevelUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
suluo.SetUserID(*s)
|
||||||
|
}
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelType sets the "level_type" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetLevelType(u uint8) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.ResetLevelType()
|
||||||
|
suluo.mutation.SetLevelType(u)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevelType sets the "level_type" field if the given value is not nil.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetNillableLevelType(u *uint8) *ScaUserLevelUpdateOne {
|
||||||
|
if u != nil {
|
||||||
|
suluo.SetLevelType(*u)
|
||||||
|
}
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLevelType adds u to the "level_type" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) AddLevelType(u int8) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.AddLevelType(u)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevel sets the "level" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetLevel(i int) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.ResetLevel()
|
||||||
|
suluo.mutation.SetLevel(i)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevel sets the "level" field if the given value is not nil.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetNillableLevel(i *int) *ScaUserLevelUpdateOne {
|
||||||
|
if i != nil {
|
||||||
|
suluo.SetLevel(*i)
|
||||||
|
}
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLevel adds i to the "level" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) AddLevel(i int) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.AddLevel(i)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelName sets the "level_name" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetLevelName(s string) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.SetLevelName(s)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevelName sets the "level_name" field if the given value is not nil.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetNillableLevelName(s *string) *ScaUserLevelUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
suluo.SetLevelName(*s)
|
||||||
|
}
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExpStart sets the "exp_start" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetExpStart(i int64) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.ResetExpStart()
|
||||||
|
suluo.mutation.SetExpStart(i)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableExpStart sets the "exp_start" field if the given value is not nil.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetNillableExpStart(i *int64) *ScaUserLevelUpdateOne {
|
||||||
|
if i != nil {
|
||||||
|
suluo.SetExpStart(*i)
|
||||||
|
}
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddExpStart adds i to the "exp_start" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) AddExpStart(i int64) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.AddExpStart(i)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetExpEnd sets the "exp_end" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetExpEnd(i int64) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.ResetExpEnd()
|
||||||
|
suluo.mutation.SetExpEnd(i)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableExpEnd sets the "exp_end" field if the given value is not nil.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetNillableExpEnd(i *int64) *ScaUserLevelUpdateOne {
|
||||||
|
if i != nil {
|
||||||
|
suluo.SetExpEnd(*i)
|
||||||
|
}
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddExpEnd adds i to the "exp_end" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) AddExpEnd(i int64) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.AddExpEnd(i)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetLevelDescription sets the "level_description" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetLevelDescription(s string) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.SetLevelDescription(s)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetNillableLevelDescription sets the "level_description" field if the given value is not nil.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SetNillableLevelDescription(s *string) *ScaUserLevelUpdateOne {
|
||||||
|
if s != nil {
|
||||||
|
suluo.SetLevelDescription(*s)
|
||||||
|
}
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearLevelDescription clears the value of the "level_description" field.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) ClearLevelDescription() *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.ClearLevelDescription()
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutation returns the ScaUserLevelMutation object of the builder.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) Mutation() *ScaUserLevelMutation {
|
||||||
|
return suluo.mutation
|
||||||
|
}
|
||||||
|
|
||||||
|
// Where appends a list predicates to the ScaUserLevelUpdate builder.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) Where(ps ...predicate.ScaUserLevel) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.mutation.Where(ps...)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||||
|
// The default is selecting all fields defined in the entity schema.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) Select(field string, fields ...string) *ScaUserLevelUpdateOne {
|
||||||
|
suluo.fields = append([]string{field}, fields...)
|
||||||
|
return suluo
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save executes the query and returns the updated ScaUserLevel entity.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) Save(ctx context.Context) (*ScaUserLevel, error) {
|
||||||
|
return withHooks(ctx, suluo.sqlSave, suluo.mutation, suluo.hooks)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SaveX is like Save, but panics if an error occurs.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) SaveX(ctx context.Context) *ScaUserLevel {
|
||||||
|
node, err := suluo.Save(ctx)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return node
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exec executes the query on the entity.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) Exec(ctx context.Context) error {
|
||||||
|
_, err := suluo.Save(ctx)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecX is like Exec, but panics if an error occurs.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) ExecX(ctx context.Context) {
|
||||||
|
if err := suluo.Exec(ctx); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check runs all checks and user-defined validators on the builder.
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) check() error {
|
||||||
|
if v, ok := suluo.mutation.LevelName(); ok {
|
||||||
|
if err := scauserlevel.LevelNameValidator(v); err != nil {
|
||||||
|
return &ValidationError{Name: "level_name", err: fmt.Errorf(`ent: validator failed for field "ScaUserLevel.level_name": %w`, err)}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suluo *ScaUserLevelUpdateOne) sqlSave(ctx context.Context) (_node *ScaUserLevel, err error) {
|
||||||
|
if err := suluo.check(); err != nil {
|
||||||
|
return _node, err
|
||||||
|
}
|
||||||
|
_spec := sqlgraph.NewUpdateSpec(scauserlevel.Table, scauserlevel.Columns, sqlgraph.NewFieldSpec(scauserlevel.FieldID, field.TypeInt64))
|
||||||
|
id, ok := suluo.mutation.ID()
|
||||||
|
if !ok {
|
||||||
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ScaUserLevel.id" for update`)}
|
||||||
|
}
|
||||||
|
_spec.Node.ID.Value = id
|
||||||
|
if fields := suluo.fields; len(fields) > 0 {
|
||||||
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, scauserlevel.FieldID)
|
||||||
|
for _, f := range fields {
|
||||||
|
if !scauserlevel.ValidColumn(f) {
|
||||||
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
||||||
|
}
|
||||||
|
if f != scauserlevel.FieldID {
|
||||||
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ps := suluo.mutation.predicates; len(ps) > 0 {
|
||||||
|
_spec.Predicate = func(selector *sql.Selector) {
|
||||||
|
for i := range ps {
|
||||||
|
ps[i](selector)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.UserID(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldUserID, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.LevelType(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelType, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.AddedLevelType(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldLevelType, field.TypeUint8, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.Level(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevel, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.AddedLevel(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldLevel, field.TypeInt, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.LevelName(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelName, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.ExpStart(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldExpStart, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.AddedExpStart(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldExpStart, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.ExpEnd(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldExpEnd, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.AddedExpEnd(); ok {
|
||||||
|
_spec.AddField(scauserlevel.FieldExpEnd, field.TypeInt64, value)
|
||||||
|
}
|
||||||
|
if value, ok := suluo.mutation.LevelDescription(); ok {
|
||||||
|
_spec.SetField(scauserlevel.FieldLevelDescription, field.TypeString, value)
|
||||||
|
}
|
||||||
|
if suluo.mutation.LevelDescriptionCleared() {
|
||||||
|
_spec.ClearField(scauserlevel.FieldLevelDescription, field.TypeString)
|
||||||
|
}
|
||||||
|
_node = &ScaUserLevel{config: suluo.config}
|
||||||
|
_spec.Assign = _node.assignValues
|
||||||
|
_spec.ScanValues = _node.scanValues
|
||||||
|
if err = sqlgraph.UpdateNode(ctx, suluo.driver, _spec); err != nil {
|
||||||
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
||||||
|
err = &NotFoundError{scauserlevel.Label}
|
||||||
|
} else if sqlgraph.IsConstraintError(err) {
|
||||||
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
suluo.mutation.done = true
|
||||||
|
return _node, nil
|
||||||
|
}
|
||||||
@@ -22,6 +22,16 @@ type Tx struct {
|
|||||||
ScaAuthUserDevice *ScaAuthUserDeviceClient
|
ScaAuthUserDevice *ScaAuthUserDeviceClient
|
||||||
// ScaAuthUserSocial is the client for interacting with the ScaAuthUserSocial builders.
|
// ScaAuthUserSocial is the client for interacting with the ScaAuthUserSocial builders.
|
||||||
ScaAuthUserSocial *ScaAuthUserSocialClient
|
ScaAuthUserSocial *ScaAuthUserSocialClient
|
||||||
|
// ScaCommentLikes is the client for interacting with the ScaCommentLikes builders.
|
||||||
|
ScaCommentLikes *ScaCommentLikesClient
|
||||||
|
// ScaCommentMessage is the client for interacting with the ScaCommentMessage builders.
|
||||||
|
ScaCommentMessage *ScaCommentMessageClient
|
||||||
|
// ScaCommentReply is the client for interacting with the ScaCommentReply builders.
|
||||||
|
ScaCommentReply *ScaCommentReplyClient
|
||||||
|
// ScaUserFollows is the client for interacting with the ScaUserFollows builders.
|
||||||
|
ScaUserFollows *ScaUserFollowsClient
|
||||||
|
// ScaUserLevel is the client for interacting with the ScaUserLevel builders.
|
||||||
|
ScaUserLevel *ScaUserLevelClient
|
||||||
|
|
||||||
// lazily loaded.
|
// lazily loaded.
|
||||||
client *Client
|
client *Client
|
||||||
@@ -158,6 +168,11 @@ func (tx *Tx) init() {
|
|||||||
tx.ScaAuthUser = NewScaAuthUserClient(tx.config)
|
tx.ScaAuthUser = NewScaAuthUserClient(tx.config)
|
||||||
tx.ScaAuthUserDevice = NewScaAuthUserDeviceClient(tx.config)
|
tx.ScaAuthUserDevice = NewScaAuthUserDeviceClient(tx.config)
|
||||||
tx.ScaAuthUserSocial = NewScaAuthUserSocialClient(tx.config)
|
tx.ScaAuthUserSocial = NewScaAuthUserSocialClient(tx.config)
|
||||||
|
tx.ScaCommentLikes = NewScaCommentLikesClient(tx.config)
|
||||||
|
tx.ScaCommentMessage = NewScaCommentMessageClient(tx.config)
|
||||||
|
tx.ScaCommentReply = NewScaCommentReplyClient(tx.config)
|
||||||
|
tx.ScaUserFollows = NewScaUserFollowsClient(tx.config)
|
||||||
|
tx.ScaUserLevel = NewScaUserLevelClient(tx.config)
|
||||||
}
|
}
|
||||||
|
|
||||||
// txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation.
|
// txDriver wraps the given dialect.Tx with a nop dialect.Driver implementation.
|
||||||
|
|||||||
58
app/core/api/repository/mysql/model/sca_comment_likes.go
Normal file
58
app/core/api/repository/mysql/model/sca_comment_likes.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/entsql"
|
||||||
|
"entgo.io/ent/schema"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
"entgo.io/ent/schema/index"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentLikes holds the model definition for the ScaCommentLikes entity.
|
||||||
|
type ScaCommentLikes struct {
|
||||||
|
ent.Schema
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields of the ScaCommentLikes.
|
||||||
|
func (ScaCommentLikes) Fields() []ent.Field {
|
||||||
|
return []ent.Field{
|
||||||
|
field.Int64("id").
|
||||||
|
Unique().
|
||||||
|
Comment("主键id"),
|
||||||
|
field.String("topic_id").
|
||||||
|
Comment("话题ID"),
|
||||||
|
field.String("user_id").
|
||||||
|
Comment("用户ID"),
|
||||||
|
field.Int64("comment_id").
|
||||||
|
Comment("评论ID"),
|
||||||
|
field.Time("like_time").
|
||||||
|
Default(time.Now).
|
||||||
|
Comment("点赞时间"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edges of the ScaCommentLikes.
|
||||||
|
func (ScaCommentLikes) Edges() []ent.Edge {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indexes of the ScaCommentLikes.
|
||||||
|
func (ScaCommentLikes) Indexes() []ent.Index {
|
||||||
|
return []ent.Index{
|
||||||
|
index.Fields("user_id"),
|
||||||
|
index.Fields("comment_id"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Annotations of the ScaCommentLikes.
|
||||||
|
func (ScaCommentLikes) Annotations() []schema.Annotation {
|
||||||
|
return []schema.Annotation{
|
||||||
|
entsql.WithComments(true),
|
||||||
|
schema.Comment("评论点赞表"),
|
||||||
|
entsql.Annotation{
|
||||||
|
Table: "sca_comment_likes",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
62
app/core/api/repository/mysql/model/sca_comment_message.go
Normal file
62
app/core/api/repository/mysql/model/sca_comment_message.go
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/entsql"
|
||||||
|
"entgo.io/ent/schema"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model/mixin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentMessage holds the model definition for the ScaCommentMessage entity.
|
||||||
|
type ScaCommentMessage struct {
|
||||||
|
ent.Schema
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ScaCommentMessage) Mixin() []ent.Mixin {
|
||||||
|
return []ent.Mixin{
|
||||||
|
mixin.DefaultMixin{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields of the ScaCommentMessage.
|
||||||
|
func (ScaCommentMessage) Fields() []ent.Field {
|
||||||
|
return []ent.Field{
|
||||||
|
field.Int64("id").
|
||||||
|
Unique().
|
||||||
|
Comment("主键"),
|
||||||
|
field.String("topic_id").
|
||||||
|
Comment("话题Id"),
|
||||||
|
field.String("from_id").
|
||||||
|
Comment("来自人"),
|
||||||
|
field.String("to_id").
|
||||||
|
Comment("送达人"),
|
||||||
|
field.String("content").
|
||||||
|
Comment("消息内容"),
|
||||||
|
field.Int("is_read").
|
||||||
|
Optional().
|
||||||
|
Comment("是否已读"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edges of the ScaCommentMessage.
|
||||||
|
func (ScaCommentMessage) Edges() []ent.Edge {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indexes of the ScaCommentMessage.
|
||||||
|
func (ScaCommentMessage) Indexes() []ent.Index {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Annotations of the ScaCommentMessage.
|
||||||
|
func (ScaCommentMessage) Annotations() []schema.Annotation {
|
||||||
|
return []schema.Annotation{
|
||||||
|
entsql.WithComments(true),
|
||||||
|
schema.Comment("评论消息表"),
|
||||||
|
entsql.Annotation{
|
||||||
|
Table: "sca_comment_message",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
112
app/core/api/repository/mysql/model/sca_comment_reply.go
Normal file
112
app/core/api/repository/mysql/model/sca_comment_reply.go
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect"
|
||||||
|
"entgo.io/ent/dialect/entsql"
|
||||||
|
"entgo.io/ent/schema"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
"entgo.io/ent/schema/index"
|
||||||
|
|
||||||
|
"schisandra-album-cloud-microservices/app/core/api/repository/mysql/model/mixin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaCommentReply holds the model definition for the ScaCommentReply entity.
|
||||||
|
type ScaCommentReply struct {
|
||||||
|
ent.Schema
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ScaCommentReply) Mixin() []ent.Mixin {
|
||||||
|
return []ent.Mixin{
|
||||||
|
mixin.DefaultMixin{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields of the ScaCommentReply.
|
||||||
|
func (ScaCommentReply) Fields() []ent.Field {
|
||||||
|
return []ent.Field{
|
||||||
|
field.Int64("id").
|
||||||
|
SchemaType(map[string]string{
|
||||||
|
dialect.MySQL: "bigint(20)",
|
||||||
|
}).
|
||||||
|
Unique().
|
||||||
|
Comment("主键id"),
|
||||||
|
field.String("user_id").
|
||||||
|
Comment("评论用户id"),
|
||||||
|
field.String("topic_id").
|
||||||
|
Comment("评论话题id"),
|
||||||
|
field.Int("topic_type").
|
||||||
|
Comment("话题类型"),
|
||||||
|
field.String("content").
|
||||||
|
Comment("评论内容"),
|
||||||
|
field.Int("comment_type").
|
||||||
|
Comment("评论类型 0评论 1 回复"),
|
||||||
|
field.Int64("reply_to").
|
||||||
|
SchemaType(map[string]string{
|
||||||
|
dialect.MySQL: "bigint(20)",
|
||||||
|
}).
|
||||||
|
Optional().
|
||||||
|
Comment("回复子评论ID"),
|
||||||
|
field.Int64("reply_id").
|
||||||
|
SchemaType(map[string]string{
|
||||||
|
dialect.MySQL: "bigint(20)",
|
||||||
|
}).
|
||||||
|
Optional().
|
||||||
|
Comment("回复父评论Id"),
|
||||||
|
field.String("reply_user").
|
||||||
|
Optional().
|
||||||
|
Comment("回复人id"),
|
||||||
|
field.Int("author").
|
||||||
|
Default(0).
|
||||||
|
Comment("评论回复是否作者 0否 1是"),
|
||||||
|
field.Int64("likes").
|
||||||
|
SchemaType(map[string]string{
|
||||||
|
dialect.MySQL: "bigint(20)",
|
||||||
|
}).
|
||||||
|
Optional().
|
||||||
|
Default(0).
|
||||||
|
Comment("点赞数"),
|
||||||
|
field.Int64("reply_count").
|
||||||
|
SchemaType(map[string]string{
|
||||||
|
dialect.MySQL: "bigint(20)",
|
||||||
|
}).
|
||||||
|
Optional().
|
||||||
|
Default(0).
|
||||||
|
Comment("回复数量"),
|
||||||
|
field.String("browser").
|
||||||
|
Comment("浏览器"),
|
||||||
|
field.String("operating_system").
|
||||||
|
Comment("操作系统"),
|
||||||
|
field.String("comment_ip").
|
||||||
|
Comment("IP地址"),
|
||||||
|
field.String("location").
|
||||||
|
Comment("地址"),
|
||||||
|
field.String("agent").
|
||||||
|
MaxLen(255).
|
||||||
|
Comment("设备信息"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edges of the ScaCommentReply.
|
||||||
|
func (ScaCommentReply) Edges() []ent.Edge {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indexes of the ScaCommentReply.
|
||||||
|
func (ScaCommentReply) Indexes() []ent.Index {
|
||||||
|
return []ent.Index{
|
||||||
|
index.Fields("id").
|
||||||
|
Unique(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Annotations of the ScaCommentReply.
|
||||||
|
func (ScaCommentReply) Annotations() []schema.Annotation {
|
||||||
|
return []schema.Annotation{
|
||||||
|
entsql.WithComments(true),
|
||||||
|
schema.Comment("评论回复表"),
|
||||||
|
entsql.Annotation{
|
||||||
|
Table: "sca_comment_reply",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
47
app/core/api/repository/mysql/model/sca_user_follows.go
Normal file
47
app/core/api/repository/mysql/model/sca_user_follows.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/entsql"
|
||||||
|
"entgo.io/ent/schema"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserFollows holds the model definition for the ScaUserFollows entity.
|
||||||
|
type ScaUserFollows struct {
|
||||||
|
ent.Schema
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields of the ScaUserFollows.
|
||||||
|
func (ScaUserFollows) Fields() []ent.Field {
|
||||||
|
return []ent.Field{
|
||||||
|
field.String("follower_id").
|
||||||
|
Comment("关注者"),
|
||||||
|
field.String("followee_id").
|
||||||
|
Comment("被关注者"),
|
||||||
|
field.Uint8("status").
|
||||||
|
Default(0).
|
||||||
|
Comment("关注状态(0 未互关 1 互关)"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edges of the ScaUserFollows.
|
||||||
|
func (ScaUserFollows) Edges() []ent.Edge {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indexes of the ScaUserFollows.
|
||||||
|
func (ScaUserFollows) Indexes() []ent.Index {
|
||||||
|
return []ent.Index{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Annotations of the ScaUserFollows.
|
||||||
|
func (ScaUserFollows) Annotations() []schema.Annotation {
|
||||||
|
return []schema.Annotation{
|
||||||
|
entsql.WithComments(true),
|
||||||
|
schema.Comment("用户关注表"),
|
||||||
|
entsql.Annotation{
|
||||||
|
Table: "sca_user_follows",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
58
app/core/api/repository/mysql/model/sca_user_level.go
Normal file
58
app/core/api/repository/mysql/model/sca_user_level.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"entgo.io/ent"
|
||||||
|
"entgo.io/ent/dialect/entsql"
|
||||||
|
"entgo.io/ent/schema"
|
||||||
|
"entgo.io/ent/schema/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ScaUserLevel holds the model definition for the ScaUserLevel entity.
|
||||||
|
type ScaUserLevel struct {
|
||||||
|
ent.Schema
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fields of the ScaUserLevel.
|
||||||
|
func (ScaUserLevel) Fields() []ent.Field {
|
||||||
|
return []ent.Field{
|
||||||
|
field.Int64("id").
|
||||||
|
Comment("主键"),
|
||||||
|
field.String("user_id").
|
||||||
|
Comment("用户Id"),
|
||||||
|
field.Uint8("level_type").
|
||||||
|
Comment("等级类型"),
|
||||||
|
field.Int("level").
|
||||||
|
Comment("等级"),
|
||||||
|
field.String("level_name").
|
||||||
|
MaxLen(50).
|
||||||
|
Comment("等级名称"),
|
||||||
|
field.Int64("exp_start").
|
||||||
|
Comment("开始经验值"),
|
||||||
|
field.Int64("exp_end").
|
||||||
|
Comment("结束经验值"),
|
||||||
|
field.Text("level_description").
|
||||||
|
Optional().
|
||||||
|
Comment("等级描述"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edges of the ScaUserLevel.
|
||||||
|
func (ScaUserLevel) Edges() []ent.Edge {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Indexes of the ScaUserLevel.
|
||||||
|
func (ScaUserLevel) Indexes() []ent.Index {
|
||||||
|
return []ent.Index{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Annotations of the ScaUserLevel.
|
||||||
|
func (ScaUserLevel) Annotations() []schema.Annotation {
|
||||||
|
return []schema.Annotation{
|
||||||
|
entsql.WithComments(true),
|
||||||
|
schema.Comment("用户等级表"),
|
||||||
|
entsql.Annotation{
|
||||||
|
Table: "sca_user_level",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,4 +20,7 @@ loginSuccess = "login success!"
|
|||||||
[sms]
|
[sms]
|
||||||
smsSendTooFrequently = "sms send too frequently!"
|
smsSendTooFrequently = "sms send too frequently!"
|
||||||
smsSendFailed = "sms send failed!"
|
smsSendFailed = "sms send failed!"
|
||||||
smsSendSuccess = "sms send success!"
|
smsSendSuccess = "sms send success!"
|
||||||
|
[comment]
|
||||||
|
tooManyImages = "too many images!"
|
||||||
|
commentError = "comment error!"
|
||||||
@@ -21,3 +21,6 @@ loginSuccess = "登录成功!"
|
|||||||
smsSendTooFrequently = "验证码发送过于频繁,请稍后再试!"
|
smsSendTooFrequently = "验证码发送过于频繁,请稍后再试!"
|
||||||
smsSendFailed = "短信发送失败!"
|
smsSendFailed = "短信发送失败!"
|
||||||
smsSendSuccess = "短信发送成功!"
|
smsSendSuccess = "短信发送成功!"
|
||||||
|
[comment]
|
||||||
|
tooManyImages = "图片数量过多,请上传不超过3张!"
|
||||||
|
commentError = "评论失败!"
|
||||||
|
|||||||
12
go.sum
12
go.sum
@@ -118,6 +118,8 @@ github.com/hashicorp/hcl/v2 v2.13.0 h1:0Apadu1w6M11dyGFxWnmhhcMjkbAiKCv7G1r/2QgC
|
|||||||
github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
|
github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
|
||||||
github.com/imroc/req/v3 v3.48.0 h1:IYuMGetuwLzOOTzDCquDqs912WNwpsPK0TBXWPIvoqg=
|
github.com/imroc/req/v3 v3.48.0 h1:IYuMGetuwLzOOTzDCquDqs912WNwpsPK0TBXWPIvoqg=
|
||||||
github.com/imroc/req/v3 v3.48.0/go.mod h1:weam9gmyb00QnOtu6HXSnk44dNFkIUQb5QdMx13FeUU=
|
github.com/imroc/req/v3 v3.48.0/go.mod h1:weam9gmyb00QnOtu6HXSnk44dNFkIUQb5QdMx13FeUU=
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
@@ -140,6 +142,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
|||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||||
|
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
|
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
|
||||||
@@ -152,6 +156,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
|
|||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||||
github.com/nicksnyder/go-i18n/v2 v2.4.1 h1:zwzjtX4uYyiaU02K5Ia3zSkpJZrByARkRB4V3YPrr0g=
|
github.com/nicksnyder/go-i18n/v2 v2.4.1 h1:zwzjtX4uYyiaU02K5Ia3zSkpJZrByARkRB4V3YPrr0g=
|
||||||
github.com/nicksnyder/go-i18n/v2 v2.4.1/go.mod h1:++Pl70FR6Cki7hdzZRnEEqdc2dJt+SAGotyFg/SvZMk=
|
github.com/nicksnyder/go-i18n/v2 v2.4.1/go.mod h1:++Pl70FR6Cki7hdzZRnEEqdc2dJt+SAGotyFg/SvZMk=
|
||||||
|
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||||
|
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||||
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
|
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
|
||||||
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
|
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
|
||||||
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
|
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
|
||||||
@@ -192,12 +198,18 @@ github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa
|
|||||||
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
||||||
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
|
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
|
||||||
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
||||||
|
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||||
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
||||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||||
|
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||||
|
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
|||||||
Reference in New Issue
Block a user