add i18n support

This commit is contained in:
landaiqing
2024-11-12 22:59:39 +08:00
parent 97ca3fc7b0
commit ae743ba8a6
62 changed files with 4468 additions and 2797 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
out/
# User-specific stuff # User-specific stuff
.idea/**/workspace.xml .idea/**/workspace.xml
.idea/**/tasks.xml .idea/**/tasks.xml

547
.idea/GOHCache.xml generated

File diff suppressed because it is too large Load Diff

View File

@@ -49,7 +49,7 @@ type (
timeout: 10s // 超时时间 timeout: 10s // 超时时间
maxBytes: 1048576 // 最大请求大小 maxBytes: 1048576 // 最大请求大小
signature: true // 是否开启签名验证 signature: true // 是否开启签名验证
middleware: I18nMiddleware,SecurityHeadersMiddleware // 注册中间件 middleware: SecurityHeadersMiddleware // 注册中间件
MaxConns: true // 是否开启最大连接数限制 MaxConns: true // 是否开启最大连接数限制
Recover: true // 是否开启自动恢复 Recover: true // 是否开启自动恢复
) )

View File

@@ -3,11 +3,11 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"net/http"
"schisandra-album-cloud-microservices/app/auth/internal/config" "schisandra-album-cloud-microservices/app/auth/internal/config"
"schisandra-album-cloud-microservices/app/auth/internal/handler" "schisandra-album-cloud-microservices/app/auth/internal/handler"
"schisandra-album-cloud-microservices/app/auth/internal/svc" "schisandra-album-cloud-microservices/app/auth/internal/svc"
"schisandra-album-cloud-microservices/common/middleware"
"github.com/zeromicro/go-zero/core/conf" "github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/rest" "github.com/zeromicro/go-zero/rest"
@@ -21,14 +21,10 @@ func main() {
var c config.Config var c config.Config
conf.MustLoad(*configFile, &c) conf.MustLoad(*configFile, &c)
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(func(header http.Header) { server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(middleware.CORSMiddleware(), nil, "*"))
header.Set("Access-Control-Allow-Origin", "*")
header.Add("Access-Control-Allow-Headers", "UserHeader1, UserHeader2")
header.Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, PATCH")
header.Set("Access-Control-Expose-Headers", "Content-Length, Content-Type")
}, nil, "*"))
defer server.Stop() defer server.Stop()
// i18n middleware
server.Use(middleware.I18nMiddleware)
ctx := svc.NewServiceContext(c) ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx) handler.RegisterHandlers(server, ctx)

View File

@@ -2,4 +2,7 @@ Name: auth
Host: 0.0.0.0 Host: 0.0.0.0
Port: 8888 Port: 8888
Mysql: Mysql:
Dsn: root:1611@tcp(localhost:3306)/schisandra-cloud-album?charset=utf8mb4&parseTime=True&loc=Local DataSource: root:1611@tcp(localhost:3306)/schisandra-cloud-album?charset=utf8mb4&parseTime=True&loc=Local
Auth:
AccessSecret: uOvKLmVfztaXGpNYd4Z0I1SiT7MweJhl
AccessExpire: 86400

View File

@@ -4,7 +4,11 @@ import "github.com/zeromicro/go-zero/rest"
type Config struct { type Config struct {
rest.RestConf rest.RestConf
Auth struct {
AccessSecret string
AccessExpire int64
}
Mysql struct { Mysql struct {
Dsn string DataSource string
} }
} }

View File

@@ -16,7 +16,7 @@ import (
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes( server.AddRoutes(
rest.WithMiddlewares( rest.WithMiddlewares(
[]rest.Middleware{serverCtx.I18nMiddleware, serverCtx.SecurityHeadersMiddleware}, []rest.Middleware{serverCtx.SecurityHeadersMiddleware},
[]rest.Route{ []rest.Route{
{ {
Method: http.MethodPost, Method: http.MethodPost,

View File

@@ -5,6 +5,7 @@ import (
"schisandra-album-cloud-microservices/app/auth/internal/svc" "schisandra-album-cloud-microservices/app/auth/internal/svc"
"schisandra-album-cloud-microservices/app/auth/internal/types" "schisandra-album-cloud-microservices/app/auth/internal/types"
"schisandra-album-cloud-microservices/common/i18n"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
) )
@@ -25,6 +26,10 @@ func NewAccountLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Acco
func (l *AccountLoginLogic) AccountLogin(req *types.AccountLoginRequest) (resp *types.LoginResponse, err error) { func (l *AccountLoginLogic) AccountLogin(req *types.AccountLoginRequest) (resp *types.LoginResponse, err error) {
// todo: add your logic here and delete this line // todo: add your logic here and delete this line
i18n.IsHasI18n(l.ctx)
text := i18n.FormatText(l.ctx, "user.name", "landaiqing")
return return &types.LoginResponse{
AccessToken: text,
}, nil
} }

View File

@@ -1,19 +0,0 @@
package middleware
import "net/http"
type I18nMiddleware struct {
}
func NewI18nMiddleware() *I18nMiddleware {
return &I18nMiddleware{}
}
func (m *I18nMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
// TODO generate middleware implement function, delete after code implementation
// Passthrough to next handler if need
next(w, r)
}
}

View File

@@ -6,14 +6,14 @@ import (
"schisandra-album-cloud-microservices/app/auth/internal/config" "schisandra-album-cloud-microservices/app/auth/internal/config"
"schisandra-album-cloud-microservices/app/auth/internal/middleware" "schisandra-album-cloud-microservices/app/auth/internal/middleware"
"schisandra-album-cloud-microservices/common/core" "schisandra-album-cloud-microservices/common/core"
"schisandra-album-cloud-microservices/common/ent/gen/entschema" "schisandra-album-cloud-microservices/common/ent"
) )
type ServiceContext struct { type ServiceContext struct {
Config config.Config Config config.Config
I18nMiddleware rest.Middleware I18nMiddleware rest.Middleware
SecurityHeadersMiddleware rest.Middleware SecurityHeadersMiddleware rest.Middleware
DB *entschema.Client DB *ent.Client
} }
func NewServiceContext(c config.Config) *ServiceContext { func NewServiceContext(c config.Config) *ServiceContext {
@@ -21,6 +21,6 @@ func NewServiceContext(c config.Config) *ServiceContext {
Config: c, Config: c,
I18nMiddleware: middleware.NewI18nMiddleware().Handle, I18nMiddleware: middleware.NewI18nMiddleware().Handle,
SecurityHeadersMiddleware: middleware.NewSecurityHeadersMiddleware().Handle, SecurityHeadersMiddleware: middleware.NewSecurityHeadersMiddleware().Handle,
DB: core.InitMySQL(c.Mysql.Dsn), DB: core.InitMySQL(c.Mysql.DataSource),
} }
} }

View File

@@ -4,6 +4,7 @@ import (
"context" "context"
"database/sql" "database/sql"
"log" "log"
"time"
entsql "entgo.io/ent/dialect/sql" entsql "entgo.io/ent/dialect/sql"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
@@ -16,17 +17,19 @@ func InitMySQL(url string) *ent.Client {
db, err := sql.Open("mysql", url) db, err := sql.Open("mysql", url)
if err != nil { if err != nil {
log.Panicf("failed to connect to database: %v", err)
return nil return nil
} }
db.SetMaxOpenConns(100) db.SetMaxOpenConns(100)
db.SetMaxIdleConns(50) db.SetMaxIdleConns(10)
db.SetConnMaxLifetime(time.Hour)
drv := entsql.OpenDB("mysql", db) drv := entsql.OpenDB("mysql", db)
client := ent.NewClient(ent.Driver(drv)) client := ent.NewClient(ent.Driver(drv), ent.Debug())
defer client.Close() defer client.Close()
if err = client.Schema.Create(context.Background()); err != nil { if err = client.Schema.Create(context.Background()); err != nil {
log.Fatalf("failed creating schema resources: %v", err) log.Panicf("failed creating schema resources: %v", err)
} }
return client return client
} }

756
common/ent/entql.go Normal file
View File

@@ -0,0 +1,756 @@
// Code generated by ent, DO NOT EDIT.
package ent
import (
"schisandra-album-cloud-microservices/common/ent/predicate"
"schisandra-album-cloud-microservices/common/ent/scaauthpermissionrule"
"schisandra-album-cloud-microservices/common/ent/scaauthrole"
"schisandra-album-cloud-microservices/common/ent/scaauthuser"
"schisandra-album-cloud-microservices/common/ent/scaauthuserdevice"
"schisandra-album-cloud-microservices/common/ent/scaauthusersocial"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/entql"
"entgo.io/ent/schema/field"
)
// schemaGraph holds a representation of ent/schema at runtime.
var schemaGraph = func() *sqlgraph.Schema {
graph := &sqlgraph.Schema{Nodes: make([]*sqlgraph.Node, 5)}
graph.Nodes[0] = &sqlgraph.Node{
NodeSpec: sqlgraph.NodeSpec{
Table: scaauthpermissionrule.Table,
Columns: scaauthpermissionrule.Columns,
ID: &sqlgraph.FieldSpec{
Type: field.TypeInt64,
Column: scaauthpermissionrule.FieldID,
},
},
Type: "ScaAuthPermissionRule",
Fields: map[string]*sqlgraph.FieldSpec{
scaauthpermissionrule.FieldPtype: {Type: field.TypeString, Column: scaauthpermissionrule.FieldPtype},
scaauthpermissionrule.FieldV0: {Type: field.TypeString, Column: scaauthpermissionrule.FieldV0},
scaauthpermissionrule.FieldV1: {Type: field.TypeString, Column: scaauthpermissionrule.FieldV1},
scaauthpermissionrule.FieldV2: {Type: field.TypeString, Column: scaauthpermissionrule.FieldV2},
scaauthpermissionrule.FieldV3: {Type: field.TypeString, Column: scaauthpermissionrule.FieldV3},
scaauthpermissionrule.FieldV4: {Type: field.TypeString, Column: scaauthpermissionrule.FieldV4},
scaauthpermissionrule.FieldV5: {Type: field.TypeString, Column: scaauthpermissionrule.FieldV5},
},
}
graph.Nodes[1] = &sqlgraph.Node{
NodeSpec: sqlgraph.NodeSpec{
Table: scaauthrole.Table,
Columns: scaauthrole.Columns,
ID: &sqlgraph.FieldSpec{
Type: field.TypeInt64,
Column: scaauthrole.FieldID,
},
},
Type: "ScaAuthRole",
Fields: map[string]*sqlgraph.FieldSpec{
scaauthrole.FieldCreatedAt: {Type: field.TypeTime, Column: scaauthrole.FieldCreatedAt},
scaauthrole.FieldUpdatedAt: {Type: field.TypeTime, Column: scaauthrole.FieldUpdatedAt},
scaauthrole.FieldDeleted: {Type: field.TypeInt8, Column: scaauthrole.FieldDeleted},
scaauthrole.FieldRoleName: {Type: field.TypeString, Column: scaauthrole.FieldRoleName},
scaauthrole.FieldRoleKey: {Type: field.TypeString, Column: scaauthrole.FieldRoleKey},
},
}
graph.Nodes[2] = &sqlgraph.Node{
NodeSpec: sqlgraph.NodeSpec{
Table: scaauthuser.Table,
Columns: scaauthuser.Columns,
ID: &sqlgraph.FieldSpec{
Type: field.TypeInt64,
Column: scaauthuser.FieldID,
},
},
Type: "ScaAuthUser",
Fields: map[string]*sqlgraph.FieldSpec{
scaauthuser.FieldCreatedAt: {Type: field.TypeTime, Column: scaauthuser.FieldCreatedAt},
scaauthuser.FieldUpdatedAt: {Type: field.TypeTime, Column: scaauthuser.FieldUpdatedAt},
scaauthuser.FieldDeleted: {Type: field.TypeInt8, Column: scaauthuser.FieldDeleted},
scaauthuser.FieldUID: {Type: field.TypeString, Column: scaauthuser.FieldUID},
scaauthuser.FieldUsername: {Type: field.TypeString, Column: scaauthuser.FieldUsername},
scaauthuser.FieldNickname: {Type: field.TypeString, Column: scaauthuser.FieldNickname},
scaauthuser.FieldEmail: {Type: field.TypeString, Column: scaauthuser.FieldEmail},
scaauthuser.FieldPhone: {Type: field.TypeString, Column: scaauthuser.FieldPhone},
scaauthuser.FieldPassword: {Type: field.TypeString, Column: scaauthuser.FieldPassword},
scaauthuser.FieldGender: {Type: field.TypeString, Column: scaauthuser.FieldGender},
scaauthuser.FieldAvatar: {Type: field.TypeString, Column: scaauthuser.FieldAvatar},
scaauthuser.FieldStatus: {Type: field.TypeInt8, Column: scaauthuser.FieldStatus},
scaauthuser.FieldIntroduce: {Type: field.TypeString, Column: scaauthuser.FieldIntroduce},
scaauthuser.FieldBlog: {Type: field.TypeString, Column: scaauthuser.FieldBlog},
scaauthuser.FieldLocation: {Type: field.TypeString, Column: scaauthuser.FieldLocation},
scaauthuser.FieldCompany: {Type: field.TypeString, Column: scaauthuser.FieldCompany},
},
}
graph.Nodes[3] = &sqlgraph.Node{
NodeSpec: sqlgraph.NodeSpec{
Table: scaauthuserdevice.Table,
Columns: scaauthuserdevice.Columns,
ID: &sqlgraph.FieldSpec{
Type: field.TypeInt64,
Column: scaauthuserdevice.FieldID,
},
},
Type: "ScaAuthUserDevice",
Fields: map[string]*sqlgraph.FieldSpec{
scaauthuserdevice.FieldCreatedAt: {Type: field.TypeTime, Column: scaauthuserdevice.FieldCreatedAt},
scaauthuserdevice.FieldUpdatedAt: {Type: field.TypeTime, Column: scaauthuserdevice.FieldUpdatedAt},
scaauthuserdevice.FieldDeleted: {Type: field.TypeInt8, Column: scaauthuserdevice.FieldDeleted},
scaauthuserdevice.FieldUserID: {Type: field.TypeString, Column: scaauthuserdevice.FieldUserID},
scaauthuserdevice.FieldIP: {Type: field.TypeString, Column: scaauthuserdevice.FieldIP},
scaauthuserdevice.FieldLocation: {Type: field.TypeString, Column: scaauthuserdevice.FieldLocation},
scaauthuserdevice.FieldAgent: {Type: field.TypeString, Column: scaauthuserdevice.FieldAgent},
scaauthuserdevice.FieldBrowser: {Type: field.TypeString, Column: scaauthuserdevice.FieldBrowser},
scaauthuserdevice.FieldOperatingSystem: {Type: field.TypeString, Column: scaauthuserdevice.FieldOperatingSystem},
scaauthuserdevice.FieldBrowserVersion: {Type: field.TypeString, Column: scaauthuserdevice.FieldBrowserVersion},
scaauthuserdevice.FieldMobile: {Type: field.TypeInt, Column: scaauthuserdevice.FieldMobile},
scaauthuserdevice.FieldBot: {Type: field.TypeInt, Column: scaauthuserdevice.FieldBot},
scaauthuserdevice.FieldMozilla: {Type: field.TypeString, Column: scaauthuserdevice.FieldMozilla},
scaauthuserdevice.FieldPlatform: {Type: field.TypeString, Column: scaauthuserdevice.FieldPlatform},
scaauthuserdevice.FieldEngineName: {Type: field.TypeString, Column: scaauthuserdevice.FieldEngineName},
scaauthuserdevice.FieldEngineVersion: {Type: field.TypeString, Column: scaauthuserdevice.FieldEngineVersion},
},
}
graph.Nodes[4] = &sqlgraph.Node{
NodeSpec: sqlgraph.NodeSpec{
Table: scaauthusersocial.Table,
Columns: scaauthusersocial.Columns,
ID: &sqlgraph.FieldSpec{
Type: field.TypeInt64,
Column: scaauthusersocial.FieldID,
},
},
Type: "ScaAuthUserSocial",
Fields: map[string]*sqlgraph.FieldSpec{
scaauthusersocial.FieldCreatedAt: {Type: field.TypeTime, Column: scaauthusersocial.FieldCreatedAt},
scaauthusersocial.FieldUpdatedAt: {Type: field.TypeTime, Column: scaauthusersocial.FieldUpdatedAt},
scaauthusersocial.FieldDeleted: {Type: field.TypeInt8, Column: scaauthusersocial.FieldDeleted},
scaauthusersocial.FieldUserID: {Type: field.TypeString, Column: scaauthusersocial.FieldUserID},
scaauthusersocial.FieldOpenID: {Type: field.TypeString, Column: scaauthusersocial.FieldOpenID},
scaauthusersocial.FieldSource: {Type: field.TypeString, Column: scaauthusersocial.FieldSource},
scaauthusersocial.FieldStatus: {Type: field.TypeInt, Column: scaauthusersocial.FieldStatus},
},
}
graph.MustAddE(
"sca_auth_role",
&sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: scaauthpermissionrule.ScaAuthRoleTable,
Columns: []string{scaauthpermissionrule.ScaAuthRoleColumn},
Bidi: false,
},
"ScaAuthPermissionRule",
"ScaAuthRole",
)
graph.MustAddE(
"sca_auth_permission_rule",
&sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: scaauthrole.ScaAuthPermissionRuleTable,
Columns: []string{scaauthrole.ScaAuthPermissionRuleColumn},
Bidi: false,
},
"ScaAuthRole",
"ScaAuthPermissionRule",
)
graph.MustAddE(
"sca_auth_user_social",
&sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: scaauthuser.ScaAuthUserSocialTable,
Columns: []string{scaauthuser.ScaAuthUserSocialColumn},
Bidi: false,
},
"ScaAuthUser",
"ScaAuthUserSocial",
)
graph.MustAddE(
"sca_auth_user_device",
&sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: scaauthuser.ScaAuthUserDeviceTable,
Columns: []string{scaauthuser.ScaAuthUserDeviceColumn},
Bidi: false,
},
"ScaAuthUser",
"ScaAuthUserDevice",
)
graph.MustAddE(
"sca_auth_user",
&sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: scaauthuserdevice.ScaAuthUserTable,
Columns: []string{scaauthuserdevice.ScaAuthUserColumn},
Bidi: false,
},
"ScaAuthUserDevice",
"ScaAuthUser",
)
graph.MustAddE(
"sca_auth_user",
&sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: scaauthusersocial.ScaAuthUserTable,
Columns: []string{scaauthusersocial.ScaAuthUserColumn},
Bidi: false,
},
"ScaAuthUserSocial",
"ScaAuthUser",
)
return graph
}()
// predicateAdder wraps the addPredicate method.
// All update, update-one and query builders implement this interface.
type predicateAdder interface {
addPredicate(func(s *sql.Selector))
}
// addPredicate implements the predicateAdder interface.
func (saprq *ScaAuthPermissionRuleQuery) addPredicate(pred func(s *sql.Selector)) {
saprq.predicates = append(saprq.predicates, pred)
}
// Filter returns a Filter implementation to apply filters on the ScaAuthPermissionRuleQuery builder.
func (saprq *ScaAuthPermissionRuleQuery) Filter() *ScaAuthPermissionRuleFilter {
return &ScaAuthPermissionRuleFilter{config: saprq.config, predicateAdder: saprq}
}
// addPredicate implements the predicateAdder interface.
func (m *ScaAuthPermissionRuleMutation) addPredicate(pred func(s *sql.Selector)) {
m.predicates = append(m.predicates, pred)
}
// Filter returns an entql.Where implementation to apply filters on the ScaAuthPermissionRuleMutation builder.
func (m *ScaAuthPermissionRuleMutation) Filter() *ScaAuthPermissionRuleFilter {
return &ScaAuthPermissionRuleFilter{config: m.config, predicateAdder: m}
}
// ScaAuthPermissionRuleFilter provides a generic filtering capability at runtime for ScaAuthPermissionRuleQuery.
type ScaAuthPermissionRuleFilter struct {
predicateAdder
config
}
// Where applies the entql predicate on the query filter.
func (f *ScaAuthPermissionRuleFilter) Where(p entql.P) {
f.addPredicate(func(s *sql.Selector) {
if err := schemaGraph.EvalP(schemaGraph.Nodes[0].Type, p, s); err != nil {
s.AddError(err)
}
})
}
// WhereID applies the entql int64 predicate on the id field.
func (f *ScaAuthPermissionRuleFilter) WhereID(p entql.Int64P) {
f.Where(p.Field(scaauthpermissionrule.FieldID))
}
// WherePtype applies the entql string predicate on the ptype field.
func (f *ScaAuthPermissionRuleFilter) WherePtype(p entql.StringP) {
f.Where(p.Field(scaauthpermissionrule.FieldPtype))
}
// WhereV0 applies the entql string predicate on the v0 field.
func (f *ScaAuthPermissionRuleFilter) WhereV0(p entql.StringP) {
f.Where(p.Field(scaauthpermissionrule.FieldV0))
}
// WhereV1 applies the entql string predicate on the v1 field.
func (f *ScaAuthPermissionRuleFilter) WhereV1(p entql.StringP) {
f.Where(p.Field(scaauthpermissionrule.FieldV1))
}
// WhereV2 applies the entql string predicate on the v2 field.
func (f *ScaAuthPermissionRuleFilter) WhereV2(p entql.StringP) {
f.Where(p.Field(scaauthpermissionrule.FieldV2))
}
// WhereV3 applies the entql string predicate on the v3 field.
func (f *ScaAuthPermissionRuleFilter) WhereV3(p entql.StringP) {
f.Where(p.Field(scaauthpermissionrule.FieldV3))
}
// WhereV4 applies the entql string predicate on the v4 field.
func (f *ScaAuthPermissionRuleFilter) WhereV4(p entql.StringP) {
f.Where(p.Field(scaauthpermissionrule.FieldV4))
}
// WhereV5 applies the entql string predicate on the v5 field.
func (f *ScaAuthPermissionRuleFilter) WhereV5(p entql.StringP) {
f.Where(p.Field(scaauthpermissionrule.FieldV5))
}
// WhereHasScaAuthRole applies a predicate to check if query has an edge sca_auth_role.
func (f *ScaAuthPermissionRuleFilter) WhereHasScaAuthRole() {
f.Where(entql.HasEdge("sca_auth_role"))
}
// WhereHasScaAuthRoleWith applies a predicate to check if query has an edge sca_auth_role with a given conditions (other predicates).
func (f *ScaAuthPermissionRuleFilter) WhereHasScaAuthRoleWith(preds ...predicate.ScaAuthRole) {
f.Where(entql.HasEdgeWith("sca_auth_role", sqlgraph.WrapFunc(func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})))
}
// addPredicate implements the predicateAdder interface.
func (sarq *ScaAuthRoleQuery) addPredicate(pred func(s *sql.Selector)) {
sarq.predicates = append(sarq.predicates, pred)
}
// Filter returns a Filter implementation to apply filters on the ScaAuthRoleQuery builder.
func (sarq *ScaAuthRoleQuery) Filter() *ScaAuthRoleFilter {
return &ScaAuthRoleFilter{config: sarq.config, predicateAdder: sarq}
}
// addPredicate implements the predicateAdder interface.
func (m *ScaAuthRoleMutation) addPredicate(pred func(s *sql.Selector)) {
m.predicates = append(m.predicates, pred)
}
// Filter returns an entql.Where implementation to apply filters on the ScaAuthRoleMutation builder.
func (m *ScaAuthRoleMutation) Filter() *ScaAuthRoleFilter {
return &ScaAuthRoleFilter{config: m.config, predicateAdder: m}
}
// ScaAuthRoleFilter provides a generic filtering capability at runtime for ScaAuthRoleQuery.
type ScaAuthRoleFilter struct {
predicateAdder
config
}
// Where applies the entql predicate on the query filter.
func (f *ScaAuthRoleFilter) Where(p entql.P) {
f.addPredicate(func(s *sql.Selector) {
if err := schemaGraph.EvalP(schemaGraph.Nodes[1].Type, p, s); err != nil {
s.AddError(err)
}
})
}
// WhereID applies the entql int64 predicate on the id field.
func (f *ScaAuthRoleFilter) WhereID(p entql.Int64P) {
f.Where(p.Field(scaauthrole.FieldID))
}
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
func (f *ScaAuthRoleFilter) WhereCreatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthrole.FieldCreatedAt))
}
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
func (f *ScaAuthRoleFilter) WhereUpdatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthrole.FieldUpdatedAt))
}
// WhereDeleted applies the entql int8 predicate on the deleted field.
func (f *ScaAuthRoleFilter) WhereDeleted(p entql.Int8P) {
f.Where(p.Field(scaauthrole.FieldDeleted))
}
// WhereRoleName applies the entql string predicate on the role_name field.
func (f *ScaAuthRoleFilter) WhereRoleName(p entql.StringP) {
f.Where(p.Field(scaauthrole.FieldRoleName))
}
// WhereRoleKey applies the entql string predicate on the role_key field.
func (f *ScaAuthRoleFilter) WhereRoleKey(p entql.StringP) {
f.Where(p.Field(scaauthrole.FieldRoleKey))
}
// WhereHasScaAuthPermissionRule applies a predicate to check if query has an edge sca_auth_permission_rule.
func (f *ScaAuthRoleFilter) WhereHasScaAuthPermissionRule() {
f.Where(entql.HasEdge("sca_auth_permission_rule"))
}
// WhereHasScaAuthPermissionRuleWith applies a predicate to check if query has an edge sca_auth_permission_rule with a given conditions (other predicates).
func (f *ScaAuthRoleFilter) WhereHasScaAuthPermissionRuleWith(preds ...predicate.ScaAuthPermissionRule) {
f.Where(entql.HasEdgeWith("sca_auth_permission_rule", sqlgraph.WrapFunc(func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})))
}
// addPredicate implements the predicateAdder interface.
func (sauq *ScaAuthUserQuery) addPredicate(pred func(s *sql.Selector)) {
sauq.predicates = append(sauq.predicates, pred)
}
// Filter returns a Filter implementation to apply filters on the ScaAuthUserQuery builder.
func (sauq *ScaAuthUserQuery) Filter() *ScaAuthUserFilter {
return &ScaAuthUserFilter{config: sauq.config, predicateAdder: sauq}
}
// addPredicate implements the predicateAdder interface.
func (m *ScaAuthUserMutation) addPredicate(pred func(s *sql.Selector)) {
m.predicates = append(m.predicates, pred)
}
// Filter returns an entql.Where implementation to apply filters on the ScaAuthUserMutation builder.
func (m *ScaAuthUserMutation) Filter() *ScaAuthUserFilter {
return &ScaAuthUserFilter{config: m.config, predicateAdder: m}
}
// ScaAuthUserFilter provides a generic filtering capability at runtime for ScaAuthUserQuery.
type ScaAuthUserFilter struct {
predicateAdder
config
}
// Where applies the entql predicate on the query filter.
func (f *ScaAuthUserFilter) Where(p entql.P) {
f.addPredicate(func(s *sql.Selector) {
if err := schemaGraph.EvalP(schemaGraph.Nodes[2].Type, p, s); err != nil {
s.AddError(err)
}
})
}
// WhereID applies the entql int64 predicate on the id field.
func (f *ScaAuthUserFilter) WhereID(p entql.Int64P) {
f.Where(p.Field(scaauthuser.FieldID))
}
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
func (f *ScaAuthUserFilter) WhereCreatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthuser.FieldCreatedAt))
}
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
func (f *ScaAuthUserFilter) WhereUpdatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthuser.FieldUpdatedAt))
}
// WhereDeleted applies the entql int8 predicate on the deleted field.
func (f *ScaAuthUserFilter) WhereDeleted(p entql.Int8P) {
f.Where(p.Field(scaauthuser.FieldDeleted))
}
// WhereUID applies the entql string predicate on the uid field.
func (f *ScaAuthUserFilter) WhereUID(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldUID))
}
// WhereUsername applies the entql string predicate on the username field.
func (f *ScaAuthUserFilter) WhereUsername(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldUsername))
}
// WhereNickname applies the entql string predicate on the nickname field.
func (f *ScaAuthUserFilter) WhereNickname(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldNickname))
}
// WhereEmail applies the entql string predicate on the email field.
func (f *ScaAuthUserFilter) WhereEmail(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldEmail))
}
// WherePhone applies the entql string predicate on the phone field.
func (f *ScaAuthUserFilter) WherePhone(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldPhone))
}
// WherePassword applies the entql string predicate on the password field.
func (f *ScaAuthUserFilter) WherePassword(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldPassword))
}
// WhereGender applies the entql string predicate on the gender field.
func (f *ScaAuthUserFilter) WhereGender(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldGender))
}
// WhereAvatar applies the entql string predicate on the avatar field.
func (f *ScaAuthUserFilter) WhereAvatar(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldAvatar))
}
// WhereStatus applies the entql int8 predicate on the status field.
func (f *ScaAuthUserFilter) WhereStatus(p entql.Int8P) {
f.Where(p.Field(scaauthuser.FieldStatus))
}
// WhereIntroduce applies the entql string predicate on the introduce field.
func (f *ScaAuthUserFilter) WhereIntroduce(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldIntroduce))
}
// WhereBlog applies the entql string predicate on the blog field.
func (f *ScaAuthUserFilter) WhereBlog(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldBlog))
}
// WhereLocation applies the entql string predicate on the location field.
func (f *ScaAuthUserFilter) WhereLocation(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldLocation))
}
// WhereCompany applies the entql string predicate on the company field.
func (f *ScaAuthUserFilter) WhereCompany(p entql.StringP) {
f.Where(p.Field(scaauthuser.FieldCompany))
}
// WhereHasScaAuthUserSocial applies a predicate to check if query has an edge sca_auth_user_social.
func (f *ScaAuthUserFilter) WhereHasScaAuthUserSocial() {
f.Where(entql.HasEdge("sca_auth_user_social"))
}
// WhereHasScaAuthUserSocialWith applies a predicate to check if query has an edge sca_auth_user_social with a given conditions (other predicates).
func (f *ScaAuthUserFilter) WhereHasScaAuthUserSocialWith(preds ...predicate.ScaAuthUserSocial) {
f.Where(entql.HasEdgeWith("sca_auth_user_social", sqlgraph.WrapFunc(func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})))
}
// WhereHasScaAuthUserDevice applies a predicate to check if query has an edge sca_auth_user_device.
func (f *ScaAuthUserFilter) WhereHasScaAuthUserDevice() {
f.Where(entql.HasEdge("sca_auth_user_device"))
}
// WhereHasScaAuthUserDeviceWith applies a predicate to check if query has an edge sca_auth_user_device with a given conditions (other predicates).
func (f *ScaAuthUserFilter) WhereHasScaAuthUserDeviceWith(preds ...predicate.ScaAuthUserDevice) {
f.Where(entql.HasEdgeWith("sca_auth_user_device", sqlgraph.WrapFunc(func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})))
}
// addPredicate implements the predicateAdder interface.
func (saudq *ScaAuthUserDeviceQuery) addPredicate(pred func(s *sql.Selector)) {
saudq.predicates = append(saudq.predicates, pred)
}
// Filter returns a Filter implementation to apply filters on the ScaAuthUserDeviceQuery builder.
func (saudq *ScaAuthUserDeviceQuery) Filter() *ScaAuthUserDeviceFilter {
return &ScaAuthUserDeviceFilter{config: saudq.config, predicateAdder: saudq}
}
// addPredicate implements the predicateAdder interface.
func (m *ScaAuthUserDeviceMutation) addPredicate(pred func(s *sql.Selector)) {
m.predicates = append(m.predicates, pred)
}
// Filter returns an entql.Where implementation to apply filters on the ScaAuthUserDeviceMutation builder.
func (m *ScaAuthUserDeviceMutation) Filter() *ScaAuthUserDeviceFilter {
return &ScaAuthUserDeviceFilter{config: m.config, predicateAdder: m}
}
// ScaAuthUserDeviceFilter provides a generic filtering capability at runtime for ScaAuthUserDeviceQuery.
type ScaAuthUserDeviceFilter struct {
predicateAdder
config
}
// Where applies the entql predicate on the query filter.
func (f *ScaAuthUserDeviceFilter) Where(p entql.P) {
f.addPredicate(func(s *sql.Selector) {
if err := schemaGraph.EvalP(schemaGraph.Nodes[3].Type, p, s); err != nil {
s.AddError(err)
}
})
}
// WhereID applies the entql int64 predicate on the id field.
func (f *ScaAuthUserDeviceFilter) WhereID(p entql.Int64P) {
f.Where(p.Field(scaauthuserdevice.FieldID))
}
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
func (f *ScaAuthUserDeviceFilter) WhereCreatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthuserdevice.FieldCreatedAt))
}
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
func (f *ScaAuthUserDeviceFilter) WhereUpdatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthuserdevice.FieldUpdatedAt))
}
// WhereDeleted applies the entql int8 predicate on the deleted field.
func (f *ScaAuthUserDeviceFilter) WhereDeleted(p entql.Int8P) {
f.Where(p.Field(scaauthuserdevice.FieldDeleted))
}
// WhereUserID applies the entql string predicate on the user_id field.
func (f *ScaAuthUserDeviceFilter) WhereUserID(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldUserID))
}
// WhereIP applies the entql string predicate on the ip field.
func (f *ScaAuthUserDeviceFilter) WhereIP(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldIP))
}
// WhereLocation applies the entql string predicate on the location field.
func (f *ScaAuthUserDeviceFilter) WhereLocation(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldLocation))
}
// WhereAgent applies the entql string predicate on the agent field.
func (f *ScaAuthUserDeviceFilter) WhereAgent(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldAgent))
}
// WhereBrowser applies the entql string predicate on the browser field.
func (f *ScaAuthUserDeviceFilter) WhereBrowser(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldBrowser))
}
// WhereOperatingSystem applies the entql string predicate on the operating_system field.
func (f *ScaAuthUserDeviceFilter) WhereOperatingSystem(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldOperatingSystem))
}
// WhereBrowserVersion applies the entql string predicate on the browser_version field.
func (f *ScaAuthUserDeviceFilter) WhereBrowserVersion(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldBrowserVersion))
}
// WhereMobile applies the entql int predicate on the mobile field.
func (f *ScaAuthUserDeviceFilter) WhereMobile(p entql.IntP) {
f.Where(p.Field(scaauthuserdevice.FieldMobile))
}
// WhereBot applies the entql int predicate on the bot field.
func (f *ScaAuthUserDeviceFilter) WhereBot(p entql.IntP) {
f.Where(p.Field(scaauthuserdevice.FieldBot))
}
// WhereMozilla applies the entql string predicate on the mozilla field.
func (f *ScaAuthUserDeviceFilter) WhereMozilla(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldMozilla))
}
// WherePlatform applies the entql string predicate on the platform field.
func (f *ScaAuthUserDeviceFilter) WherePlatform(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldPlatform))
}
// WhereEngineName applies the entql string predicate on the engine_name field.
func (f *ScaAuthUserDeviceFilter) WhereEngineName(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldEngineName))
}
// WhereEngineVersion applies the entql string predicate on the engine_version field.
func (f *ScaAuthUserDeviceFilter) WhereEngineVersion(p entql.StringP) {
f.Where(p.Field(scaauthuserdevice.FieldEngineVersion))
}
// WhereHasScaAuthUser applies a predicate to check if query has an edge sca_auth_user.
func (f *ScaAuthUserDeviceFilter) WhereHasScaAuthUser() {
f.Where(entql.HasEdge("sca_auth_user"))
}
// WhereHasScaAuthUserWith applies a predicate to check if query has an edge sca_auth_user with a given conditions (other predicates).
func (f *ScaAuthUserDeviceFilter) WhereHasScaAuthUserWith(preds ...predicate.ScaAuthUser) {
f.Where(entql.HasEdgeWith("sca_auth_user", sqlgraph.WrapFunc(func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})))
}
// addPredicate implements the predicateAdder interface.
func (sausq *ScaAuthUserSocialQuery) addPredicate(pred func(s *sql.Selector)) {
sausq.predicates = append(sausq.predicates, pred)
}
// Filter returns a Filter implementation to apply filters on the ScaAuthUserSocialQuery builder.
func (sausq *ScaAuthUserSocialQuery) Filter() *ScaAuthUserSocialFilter {
return &ScaAuthUserSocialFilter{config: sausq.config, predicateAdder: sausq}
}
// addPredicate implements the predicateAdder interface.
func (m *ScaAuthUserSocialMutation) addPredicate(pred func(s *sql.Selector)) {
m.predicates = append(m.predicates, pred)
}
// Filter returns an entql.Where implementation to apply filters on the ScaAuthUserSocialMutation builder.
func (m *ScaAuthUserSocialMutation) Filter() *ScaAuthUserSocialFilter {
return &ScaAuthUserSocialFilter{config: m.config, predicateAdder: m}
}
// ScaAuthUserSocialFilter provides a generic filtering capability at runtime for ScaAuthUserSocialQuery.
type ScaAuthUserSocialFilter struct {
predicateAdder
config
}
// Where applies the entql predicate on the query filter.
func (f *ScaAuthUserSocialFilter) Where(p entql.P) {
f.addPredicate(func(s *sql.Selector) {
if err := schemaGraph.EvalP(schemaGraph.Nodes[4].Type, p, s); err != nil {
s.AddError(err)
}
})
}
// WhereID applies the entql int64 predicate on the id field.
func (f *ScaAuthUserSocialFilter) WhereID(p entql.Int64P) {
f.Where(p.Field(scaauthusersocial.FieldID))
}
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
func (f *ScaAuthUserSocialFilter) WhereCreatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthusersocial.FieldCreatedAt))
}
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
func (f *ScaAuthUserSocialFilter) WhereUpdatedAt(p entql.TimeP) {
f.Where(p.Field(scaauthusersocial.FieldUpdatedAt))
}
// WhereDeleted applies the entql int8 predicate on the deleted field.
func (f *ScaAuthUserSocialFilter) WhereDeleted(p entql.Int8P) {
f.Where(p.Field(scaauthusersocial.FieldDeleted))
}
// WhereUserID applies the entql string predicate on the user_id field.
func (f *ScaAuthUserSocialFilter) WhereUserID(p entql.StringP) {
f.Where(p.Field(scaauthusersocial.FieldUserID))
}
// WhereOpenID applies the entql string predicate on the open_id field.
func (f *ScaAuthUserSocialFilter) WhereOpenID(p entql.StringP) {
f.Where(p.Field(scaauthusersocial.FieldOpenID))
}
// WhereSource applies the entql string predicate on the source field.
func (f *ScaAuthUserSocialFilter) WhereSource(p entql.StringP) {
f.Where(p.Field(scaauthusersocial.FieldSource))
}
// WhereStatus applies the entql int predicate on the status field.
func (f *ScaAuthUserSocialFilter) WhereStatus(p entql.IntP) {
f.Where(p.Field(scaauthusersocial.FieldStatus))
}
// WhereHasScaAuthUser applies a predicate to check if query has an edge sca_auth_user.
func (f *ScaAuthUserSocialFilter) WhereHasScaAuthUser() {
f.Where(entql.HasEdge("sca_auth_user"))
}
// WhereHasScaAuthUserWith applies a predicate to check if query has an edge sca_auth_user with a given conditions (other predicates).
func (f *ScaAuthUserSocialFilter) WhereHasScaAuthUserWith(preds ...predicate.ScaAuthUser) {
f.Where(entql.HasEdgeWith("sca_auth_user", sqlgraph.WrapFunc(func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})))
}

View File

@@ -1,3 +1,3 @@
package ent package ent
//go:generate go run -mod=mod entgo.io/ent/cmd/ent generate ./schema //go:generate go run -mod=mod entgo.io/ent/cmd/ent generate --feature privacy,entql ./schema

View File

@@ -3,13 +3,14 @@
package migrate package migrate
import ( import (
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/dialect/sql/schema" "entgo.io/ent/dialect/sql/schema"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
) )
var ( var (
// ScaAuthPermissionRulesColumns holds the columns for the "sca_auth_permission_rules" table. // ScaAuthPermissionRuleColumns holds the columns for the "sca_auth_permission_rule" table.
ScaAuthPermissionRulesColumns = []*schema.Column{ ScaAuthPermissionRuleColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true, SchemaType: map[string]string{"mysql": "bigint(20) unsigned"}}, {Name: "id", Type: field.TypeInt64, Increment: true, SchemaType: map[string]string{"mysql": "bigint(20) unsigned"}},
{Name: "ptype", Type: field.TypeString, Size: 100}, {Name: "ptype", Type: field.TypeString, Size: 100},
{Name: "v0", Type: field.TypeString, Size: 100}, {Name: "v0", Type: field.TypeString, Size: 100},
@@ -20,109 +21,113 @@ var (
{Name: "v5", Type: field.TypeString, Nullable: true, Size: 100}, {Name: "v5", Type: field.TypeString, Nullable: true, Size: 100},
{Name: "sca_auth_role_sca_auth_permission_rule", Type: field.TypeInt64, Nullable: true, SchemaType: map[string]string{"mysql": "bigint(20)"}}, {Name: "sca_auth_role_sca_auth_permission_rule", Type: field.TypeInt64, Nullable: true, SchemaType: map[string]string{"mysql": "bigint(20)"}},
} }
// ScaAuthPermissionRulesTable holds the schema information for the "sca_auth_permission_rules" table. // ScaAuthPermissionRuleTable holds the schema information for the "sca_auth_permission_rule" table.
ScaAuthPermissionRulesTable = &schema.Table{ ScaAuthPermissionRuleTable = &schema.Table{
Name: "sca_auth_permission_rules", Name: "sca_auth_permission_rule",
Columns: ScaAuthPermissionRulesColumns, Comment: "角色权限规则表",
PrimaryKey: []*schema.Column{ScaAuthPermissionRulesColumns[0]}, Columns: ScaAuthPermissionRuleColumns,
PrimaryKey: []*schema.Column{ScaAuthPermissionRuleColumns[0]},
ForeignKeys: []*schema.ForeignKey{ ForeignKeys: []*schema.ForeignKey{
{ {
Symbol: "sca_auth_permission_rules_sca_auth_roles_sca_auth_permission_rule", Symbol: "sca_auth_permission_rule_sca_auth_role_sca_auth_permission_rule",
Columns: []*schema.Column{ScaAuthPermissionRulesColumns[8]}, Columns: []*schema.Column{ScaAuthPermissionRuleColumns[8]},
RefColumns: []*schema.Column{ScaAuthRolesColumns[0]}, RefColumns: []*schema.Column{ScaAuthRoleColumns[0]},
OnDelete: schema.SetNull, OnDelete: schema.SetNull,
}, },
}, },
} }
// ScaAuthRolesColumns holds the columns for the "sca_auth_roles" table. // ScaAuthRoleColumns holds the columns for the "sca_auth_role" table.
ScaAuthRolesColumns = []*schema.Column{ ScaAuthRoleColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true, SchemaType: map[string]string{"mysql": "bigint(20)"}}, {Name: "id", Type: field.TypeInt64, Increment: true, Comment: "主键ID", SchemaType: map[string]string{"mysql": "bigint(20)"}},
{Name: "role_name", Type: field.TypeString, Size: 32}, {Name: "created_at", Type: field.TypeTime, Comment: "创建时间"},
{Name: "role_key", Type: field.TypeString, Size: 64}, {Name: "updated_at", Type: field.TypeTime, Comment: "更新时间"},
{Name: "created_at", Type: field.TypeTime}, {Name: "deleted", Type: field.TypeInt8, Nullable: true, Comment: "是否删除 0 未删除 1 已删除", Default: 0},
{Name: "update_at", Type: field.TypeTime}, {Name: "role_name", Type: field.TypeString, Size: 32, Comment: "角色名称"},
{Name: "deleted", Type: field.TypeInt, Default: 0}, {Name: "role_key", Type: field.TypeString, Size: 64, Comment: "角色关键字"},
} }
// ScaAuthRolesTable holds the schema information for the "sca_auth_roles" table. // ScaAuthRoleTable holds the schema information for the "sca_auth_role" table.
ScaAuthRolesTable = &schema.Table{ ScaAuthRoleTable = &schema.Table{
Name: "sca_auth_roles", Name: "sca_auth_role",
Columns: ScaAuthRolesColumns, Comment: "角色表",
PrimaryKey: []*schema.Column{ScaAuthRolesColumns[0]}, Columns: ScaAuthRoleColumns,
PrimaryKey: []*schema.Column{ScaAuthRoleColumns[0]},
} }
// ScaAuthUsersColumns holds the columns for the "sca_auth_users" table. // ScaAuthUserColumns holds the columns for the "sca_auth_user" table.
ScaAuthUsersColumns = []*schema.Column{ ScaAuthUserColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true, SchemaType: map[string]string{"mysql": "bigint(20)"}}, {Name: "id", Type: field.TypeInt64, Increment: true, Comment: "自增ID", SchemaType: map[string]string{"mysql": "bigint(20)"}},
{Name: "uid", Type: field.TypeString, Unique: true, Size: 20}, {Name: "created_at", Type: field.TypeTime, Comment: "创建时间"},
{Name: "username", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "updated_at", Type: field.TypeTime, Comment: "更新时间"},
{Name: "nickname", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "deleted", Type: field.TypeInt8, Nullable: true, Comment: "是否删除 0 未删除 1 已删除", Default: 0},
{Name: "email", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "uid", Type: field.TypeString, Unique: true, Size: 20, Comment: "唯一ID"},
{Name: "phone", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "username", Type: field.TypeString, Nullable: true, Size: 32, Comment: "用户名"},
{Name: "password", Type: field.TypeString, Nullable: true, Size: 64}, {Name: "nickname", Type: field.TypeString, Nullable: true, Size: 32, Comment: "昵称"},
{Name: "gender", Type: field.TypeString, Nullable: true, Size: 32}, {Name: "email", Type: field.TypeString, Nullable: true, Size: 32, Comment: "邮箱"},
{Name: "avatar", Type: field.TypeString, Nullable: true}, {Name: "phone", Type: field.TypeString, Nullable: true, Size: 32, Comment: "电话"},
{Name: "status", Type: field.TypeInt8, Nullable: true, Default: 0}, {Name: "password", Type: field.TypeString, Nullable: true, Size: 64, Comment: "密码"},
{Name: "introduce", Type: field.TypeString, Nullable: true, Size: 255}, {Name: "gender", Type: field.TypeString, Nullable: true, Size: 32, Comment: "性别"},
{Name: "created_at", Type: field.TypeTime}, {Name: "avatar", Type: field.TypeString, Nullable: true, Comment: "头像"},
{Name: "update_at", Type: field.TypeTime, Nullable: true}, {Name: "status", Type: field.TypeInt8, Nullable: true, Comment: "状态 0 正常 1 封禁", Default: 0},
{Name: "deleted", Type: field.TypeInt8, Default: 0}, {Name: "introduce", Type: field.TypeString, Nullable: true, Size: 255, Comment: "介绍"},
{Name: "blog", Type: field.TypeString, Nullable: true, Size: 30}, {Name: "blog", Type: field.TypeString, Nullable: true, Size: 30, Comment: "博客"},
{Name: "location", Type: field.TypeString, Nullable: true, Size: 50}, {Name: "location", Type: field.TypeString, Nullable: true, Size: 50, Comment: "地址"},
{Name: "company", Type: field.TypeString, Nullable: true, Size: 50}, {Name: "company", Type: field.TypeString, Nullable: true, Size: 50, Comment: "公司"},
} }
// ScaAuthUsersTable holds the schema information for the "sca_auth_users" table. // ScaAuthUserTable holds the schema information for the "sca_auth_user" table.
ScaAuthUsersTable = &schema.Table{ ScaAuthUserTable = &schema.Table{
Name: "sca_auth_users", Name: "sca_auth_user",
Columns: ScaAuthUsersColumns, Comment: "用户表",
PrimaryKey: []*schema.Column{ScaAuthUsersColumns[0]}, Columns: ScaAuthUserColumns,
PrimaryKey: []*schema.Column{ScaAuthUserColumns[0]},
Indexes: []*schema.Index{ Indexes: []*schema.Index{
{ {
Name: "scaauthuser_id", Name: "scaauthuser_id",
Unique: true, Unique: true,
Columns: []*schema.Column{ScaAuthUsersColumns[0]}, Columns: []*schema.Column{ScaAuthUserColumns[0]},
}, },
{ {
Name: "scaauthuser_uid", Name: "scaauthuser_uid",
Unique: true, Unique: true,
Columns: []*schema.Column{ScaAuthUsersColumns[1]}, Columns: []*schema.Column{ScaAuthUserColumns[4]},
}, },
{ {
Name: "scaauthuser_phone", Name: "scaauthuser_phone",
Unique: true, Unique: true,
Columns: []*schema.Column{ScaAuthUsersColumns[5]}, Columns: []*schema.Column{ScaAuthUserColumns[8]},
}, },
}, },
} }
// ScaAuthUserDevicesColumns holds the columns for the "sca_auth_user_devices" table. // ScaAuthUserDeviceColumns holds the columns for the "sca_auth_user_device" table.
ScaAuthUserDevicesColumns = []*schema.Column{ ScaAuthUserDeviceColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true, SchemaType: map[string]string{"mysql": "bigint(20)"}}, {Name: "id", Type: field.TypeInt64, Increment: true, Comment: "主键ID", SchemaType: map[string]string{"mysql": "bigint(20)"}},
{Name: "user_id", Type: field.TypeString, Size: 20}, {Name: "created_at", Type: field.TypeTime, Comment: "创建时间"},
{Name: "ip", Type: field.TypeString, Size: 20}, {Name: "updated_at", Type: field.TypeTime, Comment: "更新时间"},
{Name: "location", Type: field.TypeString, Size: 20}, {Name: "deleted", Type: field.TypeInt8, Nullable: true, Comment: "是否删除 0 未删除 1 已删除", Default: 0},
{Name: "agent", Type: field.TypeString, Size: 255}, {Name: "user_id", Type: field.TypeString, Size: 20, Comment: "用户ID"},
{Name: "created_at", Type: field.TypeTime, Nullable: true}, {Name: "ip", Type: field.TypeString, Size: 20, Comment: "登录IP"},
{Name: "update_at", Type: field.TypeTime}, {Name: "location", Type: field.TypeString, Size: 20, Comment: "地址"},
{Name: "deleted", Type: field.TypeInt, Default: 0}, {Name: "agent", Type: field.TypeString, Size: 255, Comment: "设备信息"},
{Name: "browser", Type: field.TypeString, Size: 20}, {Name: "browser", Type: field.TypeString, Size: 20, Comment: "浏览器"},
{Name: "operating_system", Type: field.TypeString, Size: 20}, {Name: "operating_system", Type: field.TypeString, Size: 20, Comment: "操作系统"},
{Name: "browser_version", Type: field.TypeString, Size: 20}, {Name: "browser_version", Type: field.TypeString, Size: 20, Comment: "浏览器版本"},
{Name: "mobile", Type: field.TypeInt}, {Name: "mobile", Type: field.TypeInt, Comment: "是否为手机 0否1是"},
{Name: "bot", Type: field.TypeInt}, {Name: "bot", Type: field.TypeInt, Comment: "是否为bot 0否1是"},
{Name: "mozilla", Type: field.TypeString, Size: 10}, {Name: "mozilla", Type: field.TypeString, Size: 10, Comment: "火狐版本"},
{Name: "platform", Type: field.TypeString, Size: 20}, {Name: "platform", Type: field.TypeString, Size: 20, Comment: "平台"},
{Name: "engine_name", Type: field.TypeString, Size: 20}, {Name: "engine_name", Type: field.TypeString, Size: 20, Comment: "引擎名称"},
{Name: "engine_version", Type: field.TypeString, Size: 20}, {Name: "engine_version", Type: field.TypeString, Size: 20, Comment: "引擎版本"},
{Name: "sca_auth_user_sca_auth_user_device", Type: field.TypeInt64, Nullable: true, SchemaType: map[string]string{"mysql": "bigint(20)"}}, {Name: "sca_auth_user_sca_auth_user_device", Type: field.TypeInt64, Nullable: true, SchemaType: map[string]string{"mysql": "bigint(20)"}},
} }
// ScaAuthUserDevicesTable holds the schema information for the "sca_auth_user_devices" table. // ScaAuthUserDeviceTable holds the schema information for the "sca_auth_user_device" table.
ScaAuthUserDevicesTable = &schema.Table{ ScaAuthUserDeviceTable = &schema.Table{
Name: "sca_auth_user_devices", Name: "sca_auth_user_device",
Columns: ScaAuthUserDevicesColumns, Comment: "用户设备表",
PrimaryKey: []*schema.Column{ScaAuthUserDevicesColumns[0]}, Columns: ScaAuthUserDeviceColumns,
PrimaryKey: []*schema.Column{ScaAuthUserDeviceColumns[0]},
ForeignKeys: []*schema.ForeignKey{ ForeignKeys: []*schema.ForeignKey{
{ {
Symbol: "sca_auth_user_devices_sca_auth_users_sca_auth_user_device", Symbol: "sca_auth_user_device_sca_auth_user_sca_auth_user_device",
Columns: []*schema.Column{ScaAuthUserDevicesColumns[17]}, Columns: []*schema.Column{ScaAuthUserDeviceColumns[17]},
RefColumns: []*schema.Column{ScaAuthUsersColumns[0]}, RefColumns: []*schema.Column{ScaAuthUserColumns[0]},
OnDelete: schema.SetNull, OnDelete: schema.SetNull,
}, },
}, },
@@ -130,55 +135,81 @@ var (
{ {
Name: "scaauthuserdevice_id", Name: "scaauthuserdevice_id",
Unique: true, Unique: true,
Columns: []*schema.Column{ScaAuthUserDevicesColumns[0]}, Columns: []*schema.Column{ScaAuthUserDeviceColumns[0]},
}, },
}, },
} }
// ScaAuthUserSocialsColumns holds the columns for the "sca_auth_user_socials" table. // ScaAuthUserSocialColumns holds the columns for the "sca_auth_user_social" table.
ScaAuthUserSocialsColumns = []*schema.Column{ ScaAuthUserSocialColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt64, Increment: true, SchemaType: map[string]string{"mysql": "bigint(20)"}}, {Name: "id", Type: field.TypeInt64, Increment: true, Comment: "主键ID", SchemaType: map[string]string{"mysql": "bigint(20)"}},
{Name: "user_id", Type: field.TypeString, Size: 20}, {Name: "created_at", Type: field.TypeTime, Comment: "创建时间"},
{Name: "open_id", Type: field.TypeString, Size: 50}, {Name: "updated_at", Type: field.TypeTime, Comment: "更新时间"},
{Name: "source", Type: field.TypeString, Size: 10}, {Name: "deleted", Type: field.TypeInt8, Nullable: true, Comment: "是否删除 0 未删除 1 已删除", Default: 0},
{Name: "status", Type: field.TypeInt, Default: 0}, {Name: "user_id", Type: field.TypeString, Size: 20, Comment: "用户ID"},
{Name: "created_at", Type: field.TypeTime}, {Name: "open_id", Type: field.TypeString, Size: 50, Comment: "第三方用户的 open id"},
{Name: "update_at", Type: field.TypeTime, Nullable: true}, {Name: "source", Type: field.TypeString, Size: 10, Comment: "第三方用户来源"},
{Name: "deleted", Type: field.TypeInt, Default: 0}, {Name: "status", Type: field.TypeInt, Comment: "状态 0正常 1 封禁", Default: 0},
{Name: "sca_auth_user_sca_auth_user_social", Type: field.TypeInt64, Nullable: true, SchemaType: map[string]string{"mysql": "bigint(20)"}}, {Name: "sca_auth_user_sca_auth_user_social", Type: field.TypeInt64, Nullable: true, SchemaType: map[string]string{"mysql": "bigint(20)"}},
} }
// ScaAuthUserSocialsTable holds the schema information for the "sca_auth_user_socials" table. // ScaAuthUserSocialTable holds the schema information for the "sca_auth_user_social" table.
ScaAuthUserSocialsTable = &schema.Table{ ScaAuthUserSocialTable = &schema.Table{
Name: "sca_auth_user_socials", Name: "sca_auth_user_social",
Columns: ScaAuthUserSocialsColumns, Comment: "用户第三方登录信息",
PrimaryKey: []*schema.Column{ScaAuthUserSocialsColumns[0]}, Columns: ScaAuthUserSocialColumns,
PrimaryKey: []*schema.Column{ScaAuthUserSocialColumns[0]},
ForeignKeys: []*schema.ForeignKey{ ForeignKeys: []*schema.ForeignKey{
{ {
Symbol: "sca_auth_user_socials_sca_auth_users_sca_auth_user_social", Symbol: "sca_auth_user_social_sca_auth_user_sca_auth_user_social",
Columns: []*schema.Column{ScaAuthUserSocialsColumns[8]}, Columns: []*schema.Column{ScaAuthUserSocialColumns[8]},
RefColumns: []*schema.Column{ScaAuthUsersColumns[0]}, RefColumns: []*schema.Column{ScaAuthUserColumns[0]},
OnDelete: schema.SetNull, OnDelete: schema.SetNull,
}, },
}, },
Indexes: []*schema.Index{ Indexes: []*schema.Index{
{ {
Name: "scaauthusersocial_id_user_id_open_id", Name: "scaauthusersocial_id",
Unique: true, Unique: true,
Columns: []*schema.Column{ScaAuthUserSocialsColumns[0], ScaAuthUserSocialsColumns[1], ScaAuthUserSocialsColumns[2]}, Columns: []*schema.Column{ScaAuthUserSocialColumns[0]},
},
{
Name: "scaauthusersocial_user_id",
Unique: true,
Columns: []*schema.Column{ScaAuthUserSocialColumns[4]},
},
{
Name: "scaauthusersocial_open_id",
Unique: true,
Columns: []*schema.Column{ScaAuthUserSocialColumns[5]},
}, },
}, },
} }
// Tables holds all the tables in the schema. // Tables holds all the tables in the schema.
Tables = []*schema.Table{ Tables = []*schema.Table{
ScaAuthPermissionRulesTable, ScaAuthPermissionRuleTable,
ScaAuthRolesTable, ScaAuthRoleTable,
ScaAuthUsersTable, ScaAuthUserTable,
ScaAuthUserDevicesTable, ScaAuthUserDeviceTable,
ScaAuthUserSocialsTable, ScaAuthUserSocialTable,
} }
) )
func init() { func init() {
ScaAuthPermissionRulesTable.ForeignKeys[0].RefTable = ScaAuthRolesTable ScaAuthPermissionRuleTable.ForeignKeys[0].RefTable = ScaAuthRoleTable
ScaAuthUserDevicesTable.ForeignKeys[0].RefTable = ScaAuthUsersTable ScaAuthPermissionRuleTable.Annotation = &entsql.Annotation{
ScaAuthUserSocialsTable.ForeignKeys[0].RefTable = ScaAuthUsersTable Table: "sca_auth_permission_rule",
}
ScaAuthRoleTable.Annotation = &entsql.Annotation{
Table: "sca_auth_role",
}
ScaAuthUserTable.Annotation = &entsql.Annotation{
Table: "sca_auth_user",
}
ScaAuthUserDeviceTable.ForeignKeys[0].RefTable = ScaAuthUserTable
ScaAuthUserDeviceTable.Annotation = &entsql.Annotation{
Table: "sca_auth_user_device",
}
ScaAuthUserSocialTable.ForeignKeys[0].RefTable = ScaAuthUserTable
ScaAuthUserSocialTable.Annotation = &entsql.Annotation{
Table: "sca_auth_user_social",
}
} }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,299 @@
// Code generated by ent, DO NOT EDIT.
package privacy
import (
"context"
"schisandra-album-cloud-microservices/common/ent"
"entgo.io/ent/entql"
"entgo.io/ent/privacy"
)
var (
// Allow may be returned by rules to indicate that the policy
// evaluation should terminate with allow decision.
Allow = privacy.Allow
// Deny may be returned by rules to indicate that the policy
// evaluation should terminate with deny decision.
Deny = privacy.Deny
// Skip may be returned by rules to indicate that the policy
// evaluation should continue to the next rule.
Skip = privacy.Skip
)
// Allowf returns a formatted wrapped Allow decision.
func Allowf(format string, a ...any) error {
return privacy.Allowf(format, a...)
}
// Denyf returns a formatted wrapped Deny decision.
func Denyf(format string, a ...any) error {
return privacy.Denyf(format, a...)
}
// Skipf returns a formatted wrapped Skip decision.
func Skipf(format string, a ...any) error {
return privacy.Skipf(format, a...)
}
// DecisionContext creates a new context from the given parent context with
// a policy decision attach to it.
func DecisionContext(parent context.Context, decision error) context.Context {
return privacy.DecisionContext(parent, decision)
}
// DecisionFromContext retrieves the policy decision from the context.
func DecisionFromContext(ctx context.Context) (error, bool) {
return privacy.DecisionFromContext(ctx)
}
type (
// Policy groups query and mutation policies.
Policy = privacy.Policy
// QueryRule defines the interface deciding whether a
// query is allowed and optionally modify it.
QueryRule = privacy.QueryRule
// QueryPolicy combines multiple query rules into a single policy.
QueryPolicy = privacy.QueryPolicy
// MutationRule defines the interface which decides whether a
// mutation is allowed and optionally modifies it.
MutationRule = privacy.MutationRule
// MutationPolicy combines multiple mutation rules into a single policy.
MutationPolicy = privacy.MutationPolicy
// MutationRuleFunc type is an adapter which allows the use of
// ordinary functions as mutation rules.
MutationRuleFunc = privacy.MutationRuleFunc
// QueryMutationRule is an interface which groups query and mutation rules.
QueryMutationRule = privacy.QueryMutationRule
)
// QueryRuleFunc type is an adapter to allow the use of
// ordinary functions as query rules.
type QueryRuleFunc func(context.Context, ent.Query) error
// Eval returns f(ctx, q).
func (f QueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
return f(ctx, q)
}
// AlwaysAllowRule returns a rule that returns an allow decision.
func AlwaysAllowRule() QueryMutationRule {
return privacy.AlwaysAllowRule()
}
// AlwaysDenyRule returns a rule that returns a deny decision.
func AlwaysDenyRule() QueryMutationRule {
return privacy.AlwaysDenyRule()
}
// ContextQueryMutationRule creates a query/mutation rule from a context eval func.
func ContextQueryMutationRule(eval func(context.Context) error) QueryMutationRule {
return privacy.ContextQueryMutationRule(eval)
}
// OnMutationOperation evaluates the given rule only on a given mutation operation.
func OnMutationOperation(rule MutationRule, op ent.Op) MutationRule {
return privacy.OnMutationOperation(rule, op)
}
// DenyMutationOperationRule returns a rule denying specified mutation operation.
func DenyMutationOperationRule(op ent.Op) MutationRule {
rule := MutationRuleFunc(func(_ context.Context, m ent.Mutation) error {
return Denyf("ent/privacy: operation %s is not allowed", m.Op())
})
return OnMutationOperation(rule, op)
}
// The ScaAuthPermissionRuleQueryRuleFunc type is an adapter to allow the use of ordinary
// functions as a query rule.
type ScaAuthPermissionRuleQueryRuleFunc func(context.Context, *ent.ScaAuthPermissionRuleQuery) error
// EvalQuery return f(ctx, q).
func (f ScaAuthPermissionRuleQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.ScaAuthPermissionRuleQuery); ok {
return f(ctx, q)
}
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaAuthPermissionRuleQuery", q)
}
// The ScaAuthPermissionRuleMutationRuleFunc type is an adapter to allow the use of ordinary
// functions as a mutation rule.
type ScaAuthPermissionRuleMutationRuleFunc func(context.Context, *ent.ScaAuthPermissionRuleMutation) error
// EvalMutation calls f(ctx, m).
func (f ScaAuthPermissionRuleMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
if m, ok := m.(*ent.ScaAuthPermissionRuleMutation); ok {
return f(ctx, m)
}
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaAuthPermissionRuleMutation", m)
}
// The ScaAuthRoleQueryRuleFunc type is an adapter to allow the use of ordinary
// functions as a query rule.
type ScaAuthRoleQueryRuleFunc func(context.Context, *ent.ScaAuthRoleQuery) error
// EvalQuery return f(ctx, q).
func (f ScaAuthRoleQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.ScaAuthRoleQuery); ok {
return f(ctx, q)
}
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaAuthRoleQuery", q)
}
// The ScaAuthRoleMutationRuleFunc type is an adapter to allow the use of ordinary
// functions as a mutation rule.
type ScaAuthRoleMutationRuleFunc func(context.Context, *ent.ScaAuthRoleMutation) error
// EvalMutation calls f(ctx, m).
func (f ScaAuthRoleMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
if m, ok := m.(*ent.ScaAuthRoleMutation); ok {
return f(ctx, m)
}
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaAuthRoleMutation", m)
}
// The ScaAuthUserQueryRuleFunc type is an adapter to allow the use of ordinary
// functions as a query rule.
type ScaAuthUserQueryRuleFunc func(context.Context, *ent.ScaAuthUserQuery) error
// EvalQuery return f(ctx, q).
func (f ScaAuthUserQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.ScaAuthUserQuery); ok {
return f(ctx, q)
}
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaAuthUserQuery", q)
}
// The ScaAuthUserMutationRuleFunc type is an adapter to allow the use of ordinary
// functions as a mutation rule.
type ScaAuthUserMutationRuleFunc func(context.Context, *ent.ScaAuthUserMutation) error
// EvalMutation calls f(ctx, m).
func (f ScaAuthUserMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
if m, ok := m.(*ent.ScaAuthUserMutation); ok {
return f(ctx, m)
}
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaAuthUserMutation", m)
}
// The ScaAuthUserDeviceQueryRuleFunc type is an adapter to allow the use of ordinary
// functions as a query rule.
type ScaAuthUserDeviceQueryRuleFunc func(context.Context, *ent.ScaAuthUserDeviceQuery) error
// EvalQuery return f(ctx, q).
func (f ScaAuthUserDeviceQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.ScaAuthUserDeviceQuery); ok {
return f(ctx, q)
}
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaAuthUserDeviceQuery", q)
}
// The ScaAuthUserDeviceMutationRuleFunc type is an adapter to allow the use of ordinary
// functions as a mutation rule.
type ScaAuthUserDeviceMutationRuleFunc func(context.Context, *ent.ScaAuthUserDeviceMutation) error
// EvalMutation calls f(ctx, m).
func (f ScaAuthUserDeviceMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
if m, ok := m.(*ent.ScaAuthUserDeviceMutation); ok {
return f(ctx, m)
}
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaAuthUserDeviceMutation", m)
}
// The ScaAuthUserSocialQueryRuleFunc type is an adapter to allow the use of ordinary
// functions as a query rule.
type ScaAuthUserSocialQueryRuleFunc func(context.Context, *ent.ScaAuthUserSocialQuery) error
// EvalQuery return f(ctx, q).
func (f ScaAuthUserSocialQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error {
if q, ok := q.(*ent.ScaAuthUserSocialQuery); ok {
return f(ctx, q)
}
return Denyf("ent/privacy: unexpected query type %T, expect *ent.ScaAuthUserSocialQuery", q)
}
// The ScaAuthUserSocialMutationRuleFunc type is an adapter to allow the use of ordinary
// functions as a mutation rule.
type ScaAuthUserSocialMutationRuleFunc func(context.Context, *ent.ScaAuthUserSocialMutation) error
// EvalMutation calls f(ctx, m).
func (f ScaAuthUserSocialMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
if m, ok := m.(*ent.ScaAuthUserSocialMutation); ok {
return f(ctx, m)
}
return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.ScaAuthUserSocialMutation", m)
}
type (
// Filter is the interface that wraps the Where function
// for filtering nodes in queries and mutations.
Filter interface {
// Where applies a filter on the executed query/mutation.
Where(entql.P)
}
// The FilterFunc type is an adapter that allows the use of ordinary
// functions as filters for query and mutation types.
FilterFunc func(context.Context, Filter) error
)
// EvalQuery calls f(ctx, q) if the query implements the Filter interface, otherwise it is denied.
func (f FilterFunc) EvalQuery(ctx context.Context, q ent.Query) error {
fr, err := queryFilter(q)
if err != nil {
return err
}
return f(ctx, fr)
}
// EvalMutation calls f(ctx, q) if the mutation implements the Filter interface, otherwise it is denied.
func (f FilterFunc) EvalMutation(ctx context.Context, m ent.Mutation) error {
fr, err := mutationFilter(m)
if err != nil {
return err
}
return f(ctx, fr)
}
var _ QueryMutationRule = FilterFunc(nil)
func queryFilter(q ent.Query) (Filter, error) {
switch q := q.(type) {
case *ent.ScaAuthPermissionRuleQuery:
return q.Filter(), nil
case *ent.ScaAuthRoleQuery:
return q.Filter(), nil
case *ent.ScaAuthUserQuery:
return q.Filter(), nil
case *ent.ScaAuthUserDeviceQuery:
return q.Filter(), nil
case *ent.ScaAuthUserSocialQuery:
return q.Filter(), nil
default:
return nil, Denyf("ent/privacy: unexpected query type %T for query filter", q)
}
}
func mutationFilter(m ent.Mutation) (Filter, error) {
switch m := m.(type) {
case *ent.ScaAuthPermissionRuleMutation:
return m.Filter(), nil
case *ent.ScaAuthRoleMutation:
return m.Filter(), nil
case *ent.ScaAuthUserMutation:
return m.Filter(), nil
case *ent.ScaAuthUserDeviceMutation:
return m.Filter(), nil
case *ent.ScaAuthUserSocialMutation:
return m.Filter(), nil
default:
return nil, Denyf("ent/privacy: unexpected mutation type %T for mutation filter", m)
}
}

View File

@@ -46,8 +46,27 @@ func init() {
scaauthpermissionruleDescV5 := scaauthpermissionruleFields[7].Descriptor() scaauthpermissionruleDescV5 := scaauthpermissionruleFields[7].Descriptor()
// scaauthpermissionrule.V5Validator is a validator for the "v5" field. It is called by the builders before save. // scaauthpermissionrule.V5Validator is a validator for the "v5" field. It is called by the builders before save.
scaauthpermissionrule.V5Validator = scaauthpermissionruleDescV5.Validators[0].(func(string) error) scaauthpermissionrule.V5Validator = scaauthpermissionruleDescV5.Validators[0].(func(string) error)
scaauthroleMixin := schema.ScaAuthRole{}.Mixin()
scaauthroleMixinFields0 := scaauthroleMixin[0].Fields()
_ = scaauthroleMixinFields0
scaauthroleFields := schema.ScaAuthRole{}.Fields() scaauthroleFields := schema.ScaAuthRole{}.Fields()
_ = scaauthroleFields _ = scaauthroleFields
// scaauthroleDescCreatedAt is the schema descriptor for created_at field.
scaauthroleDescCreatedAt := scaauthroleMixinFields0[0].Descriptor()
// scaauthrole.DefaultCreatedAt holds the default value on creation for the created_at field.
scaauthrole.DefaultCreatedAt = scaauthroleDescCreatedAt.Default.(func() time.Time)
// scaauthroleDescUpdatedAt is the schema descriptor for updated_at field.
scaauthroleDescUpdatedAt := scaauthroleMixinFields0[1].Descriptor()
// scaauthrole.DefaultUpdatedAt holds the default value on creation for the updated_at field.
scaauthrole.DefaultUpdatedAt = scaauthroleDescUpdatedAt.Default.(func() time.Time)
// scaauthrole.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
scaauthrole.UpdateDefaultUpdatedAt = scaauthroleDescUpdatedAt.UpdateDefault.(func() time.Time)
// scaauthroleDescDeleted is the schema descriptor for deleted field.
scaauthroleDescDeleted := scaauthroleMixinFields0[2].Descriptor()
// scaauthrole.DefaultDeleted holds the default value on creation for the deleted field.
scaauthrole.DefaultDeleted = scaauthroleDescDeleted.Default.(int8)
// scaauthrole.DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
scaauthrole.DeletedValidator = scaauthroleDescDeleted.Validators[0].(func(int8) error)
// scaauthroleDescRoleName is the schema descriptor for role_name field. // scaauthroleDescRoleName is the schema descriptor for role_name field.
scaauthroleDescRoleName := scaauthroleFields[1].Descriptor() scaauthroleDescRoleName := scaauthroleFields[1].Descriptor()
// scaauthrole.RoleNameValidator is a validator for the "role_name" field. It is called by the builders before save. // scaauthrole.RoleNameValidator is a validator for the "role_name" field. It is called by the builders before save.
@@ -56,22 +75,27 @@ func init() {
scaauthroleDescRoleKey := scaauthroleFields[2].Descriptor() scaauthroleDescRoleKey := scaauthroleFields[2].Descriptor()
// scaauthrole.RoleKeyValidator is a validator for the "role_key" field. It is called by the builders before save. // scaauthrole.RoleKeyValidator is a validator for the "role_key" field. It is called by the builders before save.
scaauthrole.RoleKeyValidator = scaauthroleDescRoleKey.Validators[0].(func(string) error) scaauthrole.RoleKeyValidator = scaauthroleDescRoleKey.Validators[0].(func(string) error)
// scaauthroleDescCreatedAt is the schema descriptor for created_at field. scaauthuserMixin := schema.ScaAuthUser{}.Mixin()
scaauthroleDescCreatedAt := scaauthroleFields[3].Descriptor() scaauthuserMixinFields0 := scaauthuserMixin[0].Fields()
// scaauthrole.DefaultCreatedAt holds the default value on creation for the created_at field. _ = scaauthuserMixinFields0
scaauthrole.DefaultCreatedAt = scaauthroleDescCreatedAt.Default.(func() time.Time)
// scaauthroleDescUpdateAt is the schema descriptor for update_at field.
scaauthroleDescUpdateAt := scaauthroleFields[4].Descriptor()
// scaauthrole.DefaultUpdateAt holds the default value on creation for the update_at field.
scaauthrole.DefaultUpdateAt = scaauthroleDescUpdateAt.Default.(func() time.Time)
// scaauthrole.UpdateDefaultUpdateAt holds the default value on update for the update_at field.
scaauthrole.UpdateDefaultUpdateAt = scaauthroleDescUpdateAt.UpdateDefault.(func() time.Time)
// scaauthroleDescDeleted is the schema descriptor for deleted field.
scaauthroleDescDeleted := scaauthroleFields[5].Descriptor()
// scaauthrole.DefaultDeleted holds the default value on creation for the deleted field.
scaauthrole.DefaultDeleted = scaauthroleDescDeleted.Default.(int)
scaauthuserFields := schema.ScaAuthUser{}.Fields() scaauthuserFields := schema.ScaAuthUser{}.Fields()
_ = scaauthuserFields _ = scaauthuserFields
// scaauthuserDescCreatedAt is the schema descriptor for created_at field.
scaauthuserDescCreatedAt := scaauthuserMixinFields0[0].Descriptor()
// scaauthuser.DefaultCreatedAt holds the default value on creation for the created_at field.
scaauthuser.DefaultCreatedAt = scaauthuserDescCreatedAt.Default.(func() time.Time)
// scaauthuserDescUpdatedAt is the schema descriptor for updated_at field.
scaauthuserDescUpdatedAt := scaauthuserMixinFields0[1].Descriptor()
// scaauthuser.DefaultUpdatedAt holds the default value on creation for the updated_at field.
scaauthuser.DefaultUpdatedAt = scaauthuserDescUpdatedAt.Default.(func() time.Time)
// scaauthuser.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
scaauthuser.UpdateDefaultUpdatedAt = scaauthuserDescUpdatedAt.UpdateDefault.(func() time.Time)
// scaauthuserDescDeleted is the schema descriptor for deleted field.
scaauthuserDescDeleted := scaauthuserMixinFields0[2].Descriptor()
// scaauthuser.DefaultDeleted holds the default value on creation for the deleted field.
scaauthuser.DefaultDeleted = scaauthuserDescDeleted.Default.(int8)
// scaauthuser.DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
scaauthuser.DeletedValidator = scaauthuserDescDeleted.Validators[0].(func(int8) error)
// scaauthuserDescUID is the schema descriptor for uid field. // scaauthuserDescUID is the schema descriptor for uid field.
scaauthuserDescUID := scaauthuserFields[1].Descriptor() scaauthuserDescUID := scaauthuserFields[1].Descriptor()
// scaauthuser.UIDValidator is a validator for the "uid" field. It is called by the builders before save. // scaauthuser.UIDValidator is a validator for the "uid" field. It is called by the builders before save.
@@ -108,34 +132,39 @@ func init() {
scaauthuserDescIntroduce := scaauthuserFields[10].Descriptor() scaauthuserDescIntroduce := scaauthuserFields[10].Descriptor()
// scaauthuser.IntroduceValidator is a validator for the "introduce" field. It is called by the builders before save. // scaauthuser.IntroduceValidator is a validator for the "introduce" field. It is called by the builders before save.
scaauthuser.IntroduceValidator = scaauthuserDescIntroduce.Validators[0].(func(string) error) scaauthuser.IntroduceValidator = scaauthuserDescIntroduce.Validators[0].(func(string) error)
// scaauthuserDescCreatedAt is the schema descriptor for created_at field.
scaauthuserDescCreatedAt := scaauthuserFields[11].Descriptor()
// scaauthuser.DefaultCreatedAt holds the default value on creation for the created_at field.
scaauthuser.DefaultCreatedAt = scaauthuserDescCreatedAt.Default.(func() time.Time)
// scaauthuserDescUpdateAt is the schema descriptor for update_at field.
scaauthuserDescUpdateAt := scaauthuserFields[12].Descriptor()
// scaauthuser.DefaultUpdateAt holds the default value on creation for the update_at field.
scaauthuser.DefaultUpdateAt = scaauthuserDescUpdateAt.Default.(func() time.Time)
// scaauthuser.UpdateDefaultUpdateAt holds the default value on update for the update_at field.
scaauthuser.UpdateDefaultUpdateAt = scaauthuserDescUpdateAt.UpdateDefault.(func() time.Time)
// scaauthuserDescDeleted is the schema descriptor for deleted field.
scaauthuserDescDeleted := scaauthuserFields[13].Descriptor()
// scaauthuser.DefaultDeleted holds the default value on creation for the deleted field.
scaauthuser.DefaultDeleted = scaauthuserDescDeleted.Default.(int8)
// scaauthuserDescBlog is the schema descriptor for blog field. // scaauthuserDescBlog is the schema descriptor for blog field.
scaauthuserDescBlog := scaauthuserFields[14].Descriptor() scaauthuserDescBlog := scaauthuserFields[11].Descriptor()
// scaauthuser.BlogValidator is a validator for the "blog" field. It is called by the builders before save. // scaauthuser.BlogValidator is a validator for the "blog" field. It is called by the builders before save.
scaauthuser.BlogValidator = scaauthuserDescBlog.Validators[0].(func(string) error) scaauthuser.BlogValidator = scaauthuserDescBlog.Validators[0].(func(string) error)
// scaauthuserDescLocation is the schema descriptor for location field. // scaauthuserDescLocation is the schema descriptor for location field.
scaauthuserDescLocation := scaauthuserFields[15].Descriptor() scaauthuserDescLocation := scaauthuserFields[12].Descriptor()
// scaauthuser.LocationValidator is a validator for the "location" field. It is called by the builders before save. // scaauthuser.LocationValidator is a validator for the "location" field. It is called by the builders before save.
scaauthuser.LocationValidator = scaauthuserDescLocation.Validators[0].(func(string) error) scaauthuser.LocationValidator = scaauthuserDescLocation.Validators[0].(func(string) error)
// scaauthuserDescCompany is the schema descriptor for company field. // scaauthuserDescCompany is the schema descriptor for company field.
scaauthuserDescCompany := scaauthuserFields[16].Descriptor() scaauthuserDescCompany := scaauthuserFields[13].Descriptor()
// scaauthuser.CompanyValidator is a validator for the "company" field. It is called by the builders before save. // scaauthuser.CompanyValidator is a validator for the "company" field. It is called by the builders before save.
scaauthuser.CompanyValidator = scaauthuserDescCompany.Validators[0].(func(string) error) scaauthuser.CompanyValidator = scaauthuserDescCompany.Validators[0].(func(string) error)
scaauthuserdeviceMixin := schema.ScaAuthUserDevice{}.Mixin()
scaauthuserdeviceMixinFields0 := scaauthuserdeviceMixin[0].Fields()
_ = scaauthuserdeviceMixinFields0
scaauthuserdeviceFields := schema.ScaAuthUserDevice{}.Fields() scaauthuserdeviceFields := schema.ScaAuthUserDevice{}.Fields()
_ = scaauthuserdeviceFields _ = scaauthuserdeviceFields
// scaauthuserdeviceDescCreatedAt is the schema descriptor for created_at field.
scaauthuserdeviceDescCreatedAt := scaauthuserdeviceMixinFields0[0].Descriptor()
// scaauthuserdevice.DefaultCreatedAt holds the default value on creation for the created_at field.
scaauthuserdevice.DefaultCreatedAt = scaauthuserdeviceDescCreatedAt.Default.(func() time.Time)
// scaauthuserdeviceDescUpdatedAt is the schema descriptor for updated_at field.
scaauthuserdeviceDescUpdatedAt := scaauthuserdeviceMixinFields0[1].Descriptor()
// scaauthuserdevice.DefaultUpdatedAt holds the default value on creation for the updated_at field.
scaauthuserdevice.DefaultUpdatedAt = scaauthuserdeviceDescUpdatedAt.Default.(func() time.Time)
// scaauthuserdevice.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
scaauthuserdevice.UpdateDefaultUpdatedAt = scaauthuserdeviceDescUpdatedAt.UpdateDefault.(func() time.Time)
// scaauthuserdeviceDescDeleted is the schema descriptor for deleted field.
scaauthuserdeviceDescDeleted := scaauthuserdeviceMixinFields0[2].Descriptor()
// scaauthuserdevice.DefaultDeleted holds the default value on creation for the deleted field.
scaauthuserdevice.DefaultDeleted = scaauthuserdeviceDescDeleted.Default.(int8)
// scaauthuserdevice.DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
scaauthuserdevice.DeletedValidator = scaauthuserdeviceDescDeleted.Validators[0].(func(int8) error)
// scaauthuserdeviceDescUserID is the schema descriptor for user_id field. // scaauthuserdeviceDescUserID is the schema descriptor for user_id field.
scaauthuserdeviceDescUserID := scaauthuserdeviceFields[1].Descriptor() scaauthuserdeviceDescUserID := scaauthuserdeviceFields[1].Descriptor()
// scaauthuserdevice.UserIDValidator is a validator for the "user_id" field. It is called by the builders before save. // scaauthuserdevice.UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
@@ -152,50 +181,55 @@ func init() {
scaauthuserdeviceDescAgent := scaauthuserdeviceFields[4].Descriptor() scaauthuserdeviceDescAgent := scaauthuserdeviceFields[4].Descriptor()
// scaauthuserdevice.AgentValidator is a validator for the "agent" field. It is called by the builders before save. // scaauthuserdevice.AgentValidator is a validator for the "agent" field. It is called by the builders before save.
scaauthuserdevice.AgentValidator = scaauthuserdeviceDescAgent.Validators[0].(func(string) error) scaauthuserdevice.AgentValidator = scaauthuserdeviceDescAgent.Validators[0].(func(string) error)
// scaauthuserdeviceDescCreatedAt is the schema descriptor for created_at field.
scaauthuserdeviceDescCreatedAt := scaauthuserdeviceFields[5].Descriptor()
// scaauthuserdevice.DefaultCreatedAt holds the default value on creation for the created_at field.
scaauthuserdevice.DefaultCreatedAt = scaauthuserdeviceDescCreatedAt.Default.(func() time.Time)
// scaauthuserdeviceDescUpdateAt is the schema descriptor for update_at field.
scaauthuserdeviceDescUpdateAt := scaauthuserdeviceFields[6].Descriptor()
// scaauthuserdevice.DefaultUpdateAt holds the default value on creation for the update_at field.
scaauthuserdevice.DefaultUpdateAt = scaauthuserdeviceDescUpdateAt.Default.(func() time.Time)
// scaauthuserdevice.UpdateDefaultUpdateAt holds the default value on update for the update_at field.
scaauthuserdevice.UpdateDefaultUpdateAt = scaauthuserdeviceDescUpdateAt.UpdateDefault.(func() time.Time)
// scaauthuserdeviceDescDeleted is the schema descriptor for deleted field.
scaauthuserdeviceDescDeleted := scaauthuserdeviceFields[7].Descriptor()
// scaauthuserdevice.DefaultDeleted holds the default value on creation for the deleted field.
scaauthuserdevice.DefaultDeleted = scaauthuserdeviceDescDeleted.Default.(int)
// scaauthuserdeviceDescBrowser is the schema descriptor for browser field. // scaauthuserdeviceDescBrowser is the schema descriptor for browser field.
scaauthuserdeviceDescBrowser := scaauthuserdeviceFields[8].Descriptor() scaauthuserdeviceDescBrowser := scaauthuserdeviceFields[5].Descriptor()
// scaauthuserdevice.BrowserValidator is a validator for the "browser" field. It is called by the builders before save. // scaauthuserdevice.BrowserValidator is a validator for the "browser" field. It is called by the builders before save.
scaauthuserdevice.BrowserValidator = scaauthuserdeviceDescBrowser.Validators[0].(func(string) error) scaauthuserdevice.BrowserValidator = scaauthuserdeviceDescBrowser.Validators[0].(func(string) error)
// scaauthuserdeviceDescOperatingSystem is the schema descriptor for operating_system field. // scaauthuserdeviceDescOperatingSystem is the schema descriptor for operating_system field.
scaauthuserdeviceDescOperatingSystem := scaauthuserdeviceFields[9].Descriptor() scaauthuserdeviceDescOperatingSystem := scaauthuserdeviceFields[6].Descriptor()
// scaauthuserdevice.OperatingSystemValidator is a validator for the "operating_system" field. It is called by the builders before save. // scaauthuserdevice.OperatingSystemValidator is a validator for the "operating_system" field. It is called by the builders before save.
scaauthuserdevice.OperatingSystemValidator = scaauthuserdeviceDescOperatingSystem.Validators[0].(func(string) error) scaauthuserdevice.OperatingSystemValidator = scaauthuserdeviceDescOperatingSystem.Validators[0].(func(string) error)
// scaauthuserdeviceDescBrowserVersion is the schema descriptor for browser_version field. // scaauthuserdeviceDescBrowserVersion is the schema descriptor for browser_version field.
scaauthuserdeviceDescBrowserVersion := scaauthuserdeviceFields[10].Descriptor() scaauthuserdeviceDescBrowserVersion := scaauthuserdeviceFields[7].Descriptor()
// scaauthuserdevice.BrowserVersionValidator is a validator for the "browser_version" field. It is called by the builders before save. // scaauthuserdevice.BrowserVersionValidator is a validator for the "browser_version" field. It is called by the builders before save.
scaauthuserdevice.BrowserVersionValidator = scaauthuserdeviceDescBrowserVersion.Validators[0].(func(string) error) scaauthuserdevice.BrowserVersionValidator = scaauthuserdeviceDescBrowserVersion.Validators[0].(func(string) error)
// scaauthuserdeviceDescMozilla is the schema descriptor for mozilla field. // scaauthuserdeviceDescMozilla is the schema descriptor for mozilla field.
scaauthuserdeviceDescMozilla := scaauthuserdeviceFields[13].Descriptor() scaauthuserdeviceDescMozilla := scaauthuserdeviceFields[10].Descriptor()
// scaauthuserdevice.MozillaValidator is a validator for the "mozilla" field. It is called by the builders before save. // scaauthuserdevice.MozillaValidator is a validator for the "mozilla" field. It is called by the builders before save.
scaauthuserdevice.MozillaValidator = scaauthuserdeviceDescMozilla.Validators[0].(func(string) error) scaauthuserdevice.MozillaValidator = scaauthuserdeviceDescMozilla.Validators[0].(func(string) error)
// scaauthuserdeviceDescPlatform is the schema descriptor for platform field. // scaauthuserdeviceDescPlatform is the schema descriptor for platform field.
scaauthuserdeviceDescPlatform := scaauthuserdeviceFields[14].Descriptor() scaauthuserdeviceDescPlatform := scaauthuserdeviceFields[11].Descriptor()
// scaauthuserdevice.PlatformValidator is a validator for the "platform" field. It is called by the builders before save. // scaauthuserdevice.PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
scaauthuserdevice.PlatformValidator = scaauthuserdeviceDescPlatform.Validators[0].(func(string) error) scaauthuserdevice.PlatformValidator = scaauthuserdeviceDescPlatform.Validators[0].(func(string) error)
// scaauthuserdeviceDescEngineName is the schema descriptor for engine_name field. // scaauthuserdeviceDescEngineName is the schema descriptor for engine_name field.
scaauthuserdeviceDescEngineName := scaauthuserdeviceFields[15].Descriptor() scaauthuserdeviceDescEngineName := scaauthuserdeviceFields[12].Descriptor()
// scaauthuserdevice.EngineNameValidator is a validator for the "engine_name" field. It is called by the builders before save. // scaauthuserdevice.EngineNameValidator is a validator for the "engine_name" field. It is called by the builders before save.
scaauthuserdevice.EngineNameValidator = scaauthuserdeviceDescEngineName.Validators[0].(func(string) error) scaauthuserdevice.EngineNameValidator = scaauthuserdeviceDescEngineName.Validators[0].(func(string) error)
// scaauthuserdeviceDescEngineVersion is the schema descriptor for engine_version field. // scaauthuserdeviceDescEngineVersion is the schema descriptor for engine_version field.
scaauthuserdeviceDescEngineVersion := scaauthuserdeviceFields[16].Descriptor() scaauthuserdeviceDescEngineVersion := scaauthuserdeviceFields[13].Descriptor()
// scaauthuserdevice.EngineVersionValidator is a validator for the "engine_version" field. It is called by the builders before save. // scaauthuserdevice.EngineVersionValidator is a validator for the "engine_version" field. It is called by the builders before save.
scaauthuserdevice.EngineVersionValidator = scaauthuserdeviceDescEngineVersion.Validators[0].(func(string) error) scaauthuserdevice.EngineVersionValidator = scaauthuserdeviceDescEngineVersion.Validators[0].(func(string) error)
scaauthusersocialMixin := schema.ScaAuthUserSocial{}.Mixin()
scaauthusersocialMixinFields0 := scaauthusersocialMixin[0].Fields()
_ = scaauthusersocialMixinFields0
scaauthusersocialFields := schema.ScaAuthUserSocial{}.Fields() scaauthusersocialFields := schema.ScaAuthUserSocial{}.Fields()
_ = scaauthusersocialFields _ = scaauthusersocialFields
// scaauthusersocialDescCreatedAt is the schema descriptor for created_at field.
scaauthusersocialDescCreatedAt := scaauthusersocialMixinFields0[0].Descriptor()
// scaauthusersocial.DefaultCreatedAt holds the default value on creation for the created_at field.
scaauthusersocial.DefaultCreatedAt = scaauthusersocialDescCreatedAt.Default.(func() time.Time)
// scaauthusersocialDescUpdatedAt is the schema descriptor for updated_at field.
scaauthusersocialDescUpdatedAt := scaauthusersocialMixinFields0[1].Descriptor()
// scaauthusersocial.DefaultUpdatedAt holds the default value on creation for the updated_at field.
scaauthusersocial.DefaultUpdatedAt = scaauthusersocialDescUpdatedAt.Default.(func() time.Time)
// scaauthusersocial.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
scaauthusersocial.UpdateDefaultUpdatedAt = scaauthusersocialDescUpdatedAt.UpdateDefault.(func() time.Time)
// scaauthusersocialDescDeleted is the schema descriptor for deleted field.
scaauthusersocialDescDeleted := scaauthusersocialMixinFields0[2].Descriptor()
// scaauthusersocial.DefaultDeleted holds the default value on creation for the deleted field.
scaauthusersocial.DefaultDeleted = scaauthusersocialDescDeleted.Default.(int8)
// scaauthusersocial.DeletedValidator is a validator for the "deleted" field. It is called by the builders before save.
scaauthusersocial.DeletedValidator = scaauthusersocialDescDeleted.Validators[0].(func(int8) error)
// scaauthusersocialDescUserID is the schema descriptor for user_id field. // scaauthusersocialDescUserID is the schema descriptor for user_id field.
scaauthusersocialDescUserID := scaauthusersocialFields[1].Descriptor() scaauthusersocialDescUserID := scaauthusersocialFields[1].Descriptor()
// scaauthusersocial.UserIDValidator is a validator for the "user_id" field. It is called by the builders before save. // scaauthusersocial.UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
@@ -212,18 +246,4 @@ 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)
// scaauthusersocialDescCreatedAt is the schema descriptor for created_at field.
scaauthusersocialDescCreatedAt := scaauthusersocialFields[5].Descriptor()
// scaauthusersocial.DefaultCreatedAt holds the default value on creation for the created_at field.
scaauthusersocial.DefaultCreatedAt = scaauthusersocialDescCreatedAt.Default.(func() time.Time)
// scaauthusersocialDescUpdateAt is the schema descriptor for update_at field.
scaauthusersocialDescUpdateAt := scaauthusersocialFields[6].Descriptor()
// scaauthusersocial.DefaultUpdateAt holds the default value on creation for the update_at field.
scaauthusersocial.DefaultUpdateAt = scaauthusersocialDescUpdateAt.Default.(func() time.Time)
// scaauthusersocial.UpdateDefaultUpdateAt holds the default value on update for the update_at field.
scaauthusersocial.UpdateDefaultUpdateAt = scaauthusersocialDescUpdateAt.UpdateDefault.(func() time.Time)
// scaauthusersocialDescDeleted is the schema descriptor for deleted field.
scaauthusersocialDescDeleted := scaauthusersocialFields[7].Descriptor()
// scaauthusersocial.DefaultDeleted holds the default value on creation for the deleted field.
scaauthusersocial.DefaultDeleted = scaauthusersocialDescDeleted.Default.(int)
} }

View File

@@ -12,7 +12,7 @@ import (
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql"
) )
// ScaAuthPermissionRule is the model entity for the ScaAuthPermissionRule schema. // 角色权限规则表
type ScaAuthPermissionRule struct { type ScaAuthPermissionRule struct {
config `json:"-"` config `json:"-"`
// ID of the ent. // ID of the ent.

View File

@@ -29,12 +29,12 @@ const (
// EdgeScaAuthRole holds the string denoting the sca_auth_role edge name in mutations. // EdgeScaAuthRole holds the string denoting the sca_auth_role edge name in mutations.
EdgeScaAuthRole = "sca_auth_role" EdgeScaAuthRole = "sca_auth_role"
// Table holds the table name of the scaauthpermissionrule in the database. // Table holds the table name of the scaauthpermissionrule in the database.
Table = "sca_auth_permission_rules" Table = "sca_auth_permission_rule"
// ScaAuthRoleTable is the table that holds the sca_auth_role relation/edge. // ScaAuthRoleTable is the table that holds the sca_auth_role relation/edge.
ScaAuthRoleTable = "sca_auth_permission_rules" ScaAuthRoleTable = "sca_auth_permission_rule"
// ScaAuthRoleInverseTable is the table name for the ScaAuthRole entity. // ScaAuthRoleInverseTable is the table name for the ScaAuthRole entity.
// It exists in this package in order to avoid circular dependency with the "scaauthrole" package. // It exists in this package in order to avoid circular dependency with the "scaauthrole" package.
ScaAuthRoleInverseTable = "sca_auth_roles" ScaAuthRoleInverseTable = "sca_auth_role"
// ScaAuthRoleColumn is the table column denoting the sca_auth_role relation/edge. // ScaAuthRoleColumn is the table column denoting the sca_auth_role relation/edge.
ScaAuthRoleColumn = "sca_auth_role_sca_auth_permission_rule" ScaAuthRoleColumn = "sca_auth_role_sca_auth_permission_rule"
) )
@@ -51,7 +51,7 @@ var Columns = []string{
FieldV5, FieldV5,
} }
// ForeignKeys holds the SQL foreign-keys that are owned by the "sca_auth_permission_rules" // ForeignKeys holds the SQL foreign-keys that are owned by the "sca_auth_permission_rule"
// table and are not defined as standalone fields in the schema. // table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{ var ForeignKeys = []string{
"sca_auth_role_sca_auth_permission_rule", "sca_auth_role_sca_auth_permission_rule",

View File

@@ -12,22 +12,22 @@ import (
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql"
) )
// ScaAuthRole is the model entity for the ScaAuthRole schema. // 角色表
type ScaAuthRole struct { type ScaAuthRole struct {
config `json:"-"` config `json:"-"`
// ID of the ent. // ID of the ent.
// 主键ID // 主键ID
ID int64 `json:"id,omitempty"` 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"`
// 角色名称 // 角色名称
RoleName string `json:"role_name,omitempty"` RoleName string `json:"role_name,omitempty"`
// 角色关键字 // 角色关键字
RoleKey string `json:"role_key,omitempty"` RoleKey string `json:"role_key,omitempty"`
// 创建时间
CreatedAt time.Time `json:"created_at,omitempty"`
// 更新时间
UpdateAt time.Time `json:"update_at,omitempty"`
// 是否删除 0 未删除 1已删除
Deleted int `json:"deleted,omitempty"`
// Edges holds the relations/edges for other nodes in the graph. // Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the ScaAuthRoleQuery when eager-loading is set. // The values are being populated by the ScaAuthRoleQuery when eager-loading is set.
Edges ScaAuthRoleEdges `json:"edges"` Edges ScaAuthRoleEdges `json:"edges"`
@@ -61,7 +61,7 @@ func (*ScaAuthRole) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
case scaauthrole.FieldRoleName, scaauthrole.FieldRoleKey: case scaauthrole.FieldRoleName, scaauthrole.FieldRoleKey:
values[i] = new(sql.NullString) values[i] = new(sql.NullString)
case scaauthrole.FieldCreatedAt, scaauthrole.FieldUpdateAt: case scaauthrole.FieldCreatedAt, scaauthrole.FieldUpdatedAt:
values[i] = new(sql.NullTime) values[i] = new(sql.NullTime)
default: default:
values[i] = new(sql.UnknownType) values[i] = new(sql.UnknownType)
@@ -84,6 +84,24 @@ func (sar *ScaAuthRole) assignValues(columns []string, values []any) error {
return fmt.Errorf("unexpected type %T for field id", value) return fmt.Errorf("unexpected type %T for field id", value)
} }
sar.ID = int64(value.Int64) sar.ID = int64(value.Int64)
case scaauthrole.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 {
sar.CreatedAt = value.Time
}
case scaauthrole.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 {
sar.UpdatedAt = value.Time
}
case scaauthrole.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
sar.Deleted = int8(value.Int64)
}
case scaauthrole.FieldRoleName: case scaauthrole.FieldRoleName:
if value, ok := values[i].(*sql.NullString); !ok { if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field role_name", values[i]) return fmt.Errorf("unexpected type %T for field role_name", values[i])
@@ -96,24 +114,6 @@ func (sar *ScaAuthRole) assignValues(columns []string, values []any) error {
} else if value.Valid { } else if value.Valid {
sar.RoleKey = value.String sar.RoleKey = value.String
} }
case scaauthrole.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 {
sar.CreatedAt = value.Time
}
case scaauthrole.FieldUpdateAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field update_at", values[i])
} else if value.Valid {
sar.UpdateAt = value.Time
}
case scaauthrole.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
sar.Deleted = int(value.Int64)
}
default: default:
sar.selectValues.Set(columns[i], values[i]) sar.selectValues.Set(columns[i], values[i])
} }
@@ -155,20 +155,20 @@ func (sar *ScaAuthRole) String() string {
var builder strings.Builder var builder strings.Builder
builder.WriteString("ScaAuthRole(") builder.WriteString("ScaAuthRole(")
builder.WriteString(fmt.Sprintf("id=%v, ", sar.ID)) builder.WriteString(fmt.Sprintf("id=%v, ", sar.ID))
builder.WriteString("created_at=")
builder.WriteString(sar.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(sar.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", sar.Deleted))
builder.WriteString(", ")
builder.WriteString("role_name=") builder.WriteString("role_name=")
builder.WriteString(sar.RoleName) builder.WriteString(sar.RoleName)
builder.WriteString(", ") builder.WriteString(", ")
builder.WriteString("role_key=") builder.WriteString("role_key=")
builder.WriteString(sar.RoleKey) builder.WriteString(sar.RoleKey)
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(sar.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("update_at=")
builder.WriteString(sar.UpdateAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", sar.Deleted))
builder.WriteByte(')') builder.WriteByte(')')
return builder.String() return builder.String()
} }

View File

@@ -14,25 +14,25 @@ const (
Label = "sca_auth_role" Label = "sca_auth_role"
// FieldID holds the string denoting the id field in the database. // FieldID holds the string denoting the id field in the database.
FieldID = "id" 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"
// FieldRoleName holds the string denoting the role_name field in the database. // FieldRoleName holds the string denoting the role_name field in the database.
FieldRoleName = "role_name" FieldRoleName = "role_name"
// FieldRoleKey holds the string denoting the role_key field in the database. // FieldRoleKey holds the string denoting the role_key field in the database.
FieldRoleKey = "role_key" FieldRoleKey = "role_key"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdateAt holds the string denoting the update_at field in the database.
FieldUpdateAt = "update_at"
// FieldDeleted holds the string denoting the deleted field in the database.
FieldDeleted = "deleted"
// EdgeScaAuthPermissionRule holds the string denoting the sca_auth_permission_rule edge name in mutations. // EdgeScaAuthPermissionRule holds the string denoting the sca_auth_permission_rule edge name in mutations.
EdgeScaAuthPermissionRule = "sca_auth_permission_rule" EdgeScaAuthPermissionRule = "sca_auth_permission_rule"
// Table holds the table name of the scaauthrole in the database. // Table holds the table name of the scaauthrole in the database.
Table = "sca_auth_roles" Table = "sca_auth_role"
// ScaAuthPermissionRuleTable is the table that holds the sca_auth_permission_rule relation/edge. // ScaAuthPermissionRuleTable is the table that holds the sca_auth_permission_rule relation/edge.
ScaAuthPermissionRuleTable = "sca_auth_permission_rules" ScaAuthPermissionRuleTable = "sca_auth_permission_rule"
// ScaAuthPermissionRuleInverseTable is the table name for the ScaAuthPermissionRule entity. // ScaAuthPermissionRuleInverseTable is the table name for the ScaAuthPermissionRule entity.
// It exists in this package in order to avoid circular dependency with the "scaauthpermissionrule" package. // It exists in this package in order to avoid circular dependency with the "scaauthpermissionrule" package.
ScaAuthPermissionRuleInverseTable = "sca_auth_permission_rules" ScaAuthPermissionRuleInverseTable = "sca_auth_permission_rule"
// ScaAuthPermissionRuleColumn is the table column denoting the sca_auth_permission_rule relation/edge. // ScaAuthPermissionRuleColumn is the table column denoting the sca_auth_permission_rule relation/edge.
ScaAuthPermissionRuleColumn = "sca_auth_role_sca_auth_permission_rule" ScaAuthPermissionRuleColumn = "sca_auth_role_sca_auth_permission_rule"
) )
@@ -40,11 +40,11 @@ const (
// Columns holds all SQL columns for scaauthrole fields. // Columns holds all SQL columns for scaauthrole fields.
var Columns = []string{ var Columns = []string{
FieldID, FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeleted,
FieldRoleName, FieldRoleName,
FieldRoleKey, FieldRoleKey,
FieldCreatedAt,
FieldUpdateAt,
FieldDeleted,
} }
// ValidColumn reports if the column name is valid (part of the table columns). // ValidColumn reports if the column name is valid (part of the table columns).
@@ -58,18 +58,20 @@ func ValidColumn(column string) bool {
} }
var ( var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// 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
// RoleNameValidator is a validator for the "role_name" field. It is called by the builders before save. // RoleNameValidator is a validator for the "role_name" field. It is called by the builders before save.
RoleNameValidator func(string) error RoleNameValidator func(string) error
// RoleKeyValidator is a validator for the "role_key" field. It is called by the builders before save. // RoleKeyValidator is a validator for the "role_key" field. It is called by the builders before save.
RoleKeyValidator func(string) error RoleKeyValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdateAt holds the default value on creation for the "update_at" field.
DefaultUpdateAt func() time.Time
// UpdateDefaultUpdateAt holds the default value on update for the "update_at" field.
UpdateDefaultUpdateAt func() time.Time
// DefaultDeleted holds the default value on creation for the "deleted" field.
DefaultDeleted int
) )
// OrderOption defines the ordering options for the ScaAuthRole queries. // OrderOption defines the ordering options for the ScaAuthRole queries.
@@ -80,6 +82,21 @@ func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc() 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()
}
// ByRoleName orders the results by the role_name field. // ByRoleName orders the results by the role_name field.
func ByRoleName(opts ...sql.OrderTermOption) OrderOption { func ByRoleName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRoleName, opts...).ToFunc() return sql.OrderByField(FieldRoleName, opts...).ToFunc()
@@ -90,21 +107,6 @@ func ByRoleKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRoleKey, opts...).ToFunc() return sql.OrderByField(FieldRoleKey, opts...).ToFunc()
} }
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdateAt orders the results by the update_at field.
func ByUpdateAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateAt, opts...).ToFunc()
}
// ByDeleted orders the results by the deleted field.
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
}
// ByScaAuthPermissionRuleCount orders the results by sca_auth_permission_rule count. // ByScaAuthPermissionRuleCount orders the results by sca_auth_permission_rule count.
func ByScaAuthPermissionRuleCount(opts ...sql.OrderTermOption) OrderOption { func ByScaAuthPermissionRuleCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) { return func(s *sql.Selector) {

View File

@@ -55,6 +55,21 @@ func IDLTE(id int64) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLTE(FieldID, id)) return predicate.ScaAuthRole(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.ScaAuthRole {
return predicate.ScaAuthRole(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.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldUpdatedAt, v))
}
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
func Deleted(v int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldDeleted, v))
}
// RoleName applies equality check predicate on the "role_name" field. It's identical to RoleNameEQ. // RoleName applies equality check predicate on the "role_name" field. It's identical to RoleNameEQ.
func RoleName(v string) predicate.ScaAuthRole { func RoleName(v string) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldRoleName, v)) return predicate.ScaAuthRole(sql.FieldEQ(FieldRoleName, v))
@@ -65,21 +80,136 @@ func RoleKey(v string) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldRoleKey, v)) return predicate.ScaAuthRole(sql.FieldEQ(FieldRoleKey, v))
} }
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. // CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAt(v time.Time) predicate.ScaAuthRole { func CreatedAtEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldCreatedAt, v)) return predicate.ScaAuthRole(sql.FieldEQ(FieldCreatedAt, v))
} }
// UpdateAt applies equality check predicate on the "update_at" field. It's identical to UpdateAtEQ. // CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func UpdateAt(v time.Time) predicate.ScaAuthRole { func CreatedAtNEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldUpdateAt, v)) return predicate.ScaAuthRole(sql.FieldNEQ(FieldCreatedAt, v))
} }
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ. // CreatedAtIn applies the In predicate on the "created_at" field.
func Deleted(v int) predicate.ScaAuthRole { func CreatedAtIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLTE(FieldUpdatedAt, v))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldDeleted, v)) return predicate.ScaAuthRole(sql.FieldEQ(FieldDeleted, v))
} }
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int8) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLTE(FieldDeleted, v))
}
// DeletedIsNil applies the IsNil predicate on the "deleted" field.
func DeletedIsNil() predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldIsNull(FieldDeleted))
}
// DeletedNotNil applies the NotNil predicate on the "deleted" field.
func DeletedNotNil() predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNotNull(FieldDeleted))
}
// RoleNameEQ applies the EQ predicate on the "role_name" field. // RoleNameEQ applies the EQ predicate on the "role_name" field.
func RoleNameEQ(v string) predicate.ScaAuthRole { func RoleNameEQ(v string) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldRoleName, v)) return predicate.ScaAuthRole(sql.FieldEQ(FieldRoleName, v))
@@ -210,126 +340,6 @@ func RoleKeyContainsFold(v string) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldContainsFold(FieldRoleKey, v)) return predicate.ScaAuthRole(sql.FieldContainsFold(FieldRoleKey, v))
} }
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdateAtEQ applies the EQ predicate on the "update_at" field.
func UpdateAtEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldUpdateAt, v))
}
// UpdateAtNEQ applies the NEQ predicate on the "update_at" field.
func UpdateAtNEQ(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNEQ(FieldUpdateAt, v))
}
// UpdateAtIn applies the In predicate on the "update_at" field.
func UpdateAtIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldIn(FieldUpdateAt, vs...))
}
// UpdateAtNotIn applies the NotIn predicate on the "update_at" field.
func UpdateAtNotIn(vs ...time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNotIn(FieldUpdateAt, vs...))
}
// UpdateAtGT applies the GT predicate on the "update_at" field.
func UpdateAtGT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGT(FieldUpdateAt, v))
}
// UpdateAtGTE applies the GTE predicate on the "update_at" field.
func UpdateAtGTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGTE(FieldUpdateAt, v))
}
// UpdateAtLT applies the LT predicate on the "update_at" field.
func UpdateAtLT(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLT(FieldUpdateAt, v))
}
// UpdateAtLTE applies the LTE predicate on the "update_at" field.
func UpdateAtLTE(v time.Time) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLTE(FieldUpdateAt, v))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldEQ(FieldDeleted, v))
}
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int) predicate.ScaAuthRole {
return predicate.ScaAuthRole(sql.FieldLTE(FieldDeleted, v))
}
// HasScaAuthPermissionRule applies the HasEdge predicate on the "sca_auth_permission_rule" edge. // HasScaAuthPermissionRule applies the HasEdge predicate on the "sca_auth_permission_rule" edge.
func HasScaAuthPermissionRule() predicate.ScaAuthRole { func HasScaAuthPermissionRule() predicate.ScaAuthRole {
return predicate.ScaAuthRole(func(s *sql.Selector) { return predicate.ScaAuthRole(func(s *sql.Selector) {

View File

@@ -21,18 +21,6 @@ type ScaAuthRoleCreate struct {
hooks []Hook hooks []Hook
} }
// SetRoleName sets the "role_name" field.
func (sarc *ScaAuthRoleCreate) SetRoleName(s string) *ScaAuthRoleCreate {
sarc.mutation.SetRoleName(s)
return sarc
}
// SetRoleKey sets the "role_key" field.
func (sarc *ScaAuthRoleCreate) SetRoleKey(s string) *ScaAuthRoleCreate {
sarc.mutation.SetRoleKey(s)
return sarc
}
// SetCreatedAt sets the "created_at" field. // SetCreatedAt sets the "created_at" field.
func (sarc *ScaAuthRoleCreate) SetCreatedAt(t time.Time) *ScaAuthRoleCreate { func (sarc *ScaAuthRoleCreate) SetCreatedAt(t time.Time) *ScaAuthRoleCreate {
sarc.mutation.SetCreatedAt(t) sarc.mutation.SetCreatedAt(t)
@@ -47,34 +35,46 @@ func (sarc *ScaAuthRoleCreate) SetNillableCreatedAt(t *time.Time) *ScaAuthRoleCr
return sarc return sarc
} }
// SetUpdateAt sets the "update_at" field. // SetUpdatedAt sets the "updated_at" field.
func (sarc *ScaAuthRoleCreate) SetUpdateAt(t time.Time) *ScaAuthRoleCreate { func (sarc *ScaAuthRoleCreate) SetUpdatedAt(t time.Time) *ScaAuthRoleCreate {
sarc.mutation.SetUpdateAt(t) sarc.mutation.SetUpdatedAt(t)
return sarc return sarc
} }
// SetNillableUpdateAt sets the "update_at" field if the given value is not nil. // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (sarc *ScaAuthRoleCreate) SetNillableUpdateAt(t *time.Time) *ScaAuthRoleCreate { func (sarc *ScaAuthRoleCreate) SetNillableUpdatedAt(t *time.Time) *ScaAuthRoleCreate {
if t != nil { if t != nil {
sarc.SetUpdateAt(*t) sarc.SetUpdatedAt(*t)
} }
return sarc return sarc
} }
// SetDeleted sets the "deleted" field. // SetDeleted sets the "deleted" field.
func (sarc *ScaAuthRoleCreate) SetDeleted(i int) *ScaAuthRoleCreate { func (sarc *ScaAuthRoleCreate) SetDeleted(i int8) *ScaAuthRoleCreate {
sarc.mutation.SetDeleted(i) sarc.mutation.SetDeleted(i)
return sarc return sarc
} }
// SetNillableDeleted sets the "deleted" field if the given value is not nil. // SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sarc *ScaAuthRoleCreate) SetNillableDeleted(i *int) *ScaAuthRoleCreate { func (sarc *ScaAuthRoleCreate) SetNillableDeleted(i *int8) *ScaAuthRoleCreate {
if i != nil { if i != nil {
sarc.SetDeleted(*i) sarc.SetDeleted(*i)
} }
return sarc return sarc
} }
// SetRoleName sets the "role_name" field.
func (sarc *ScaAuthRoleCreate) SetRoleName(s string) *ScaAuthRoleCreate {
sarc.mutation.SetRoleName(s)
return sarc
}
// SetRoleKey sets the "role_key" field.
func (sarc *ScaAuthRoleCreate) SetRoleKey(s string) *ScaAuthRoleCreate {
sarc.mutation.SetRoleKey(s)
return sarc
}
// SetID sets the "id" field. // SetID sets the "id" field.
func (sarc *ScaAuthRoleCreate) SetID(i int64) *ScaAuthRoleCreate { func (sarc *ScaAuthRoleCreate) SetID(i int64) *ScaAuthRoleCreate {
sarc.mutation.SetID(i) sarc.mutation.SetID(i)
@@ -135,9 +135,9 @@ func (sarc *ScaAuthRoleCreate) defaults() {
v := scaauthrole.DefaultCreatedAt() v := scaauthrole.DefaultCreatedAt()
sarc.mutation.SetCreatedAt(v) sarc.mutation.SetCreatedAt(v)
} }
if _, ok := sarc.mutation.UpdateAt(); !ok { if _, ok := sarc.mutation.UpdatedAt(); !ok {
v := scaauthrole.DefaultUpdateAt() v := scaauthrole.DefaultUpdatedAt()
sarc.mutation.SetUpdateAt(v) sarc.mutation.SetUpdatedAt(v)
} }
if _, ok := sarc.mutation.Deleted(); !ok { if _, ok := sarc.mutation.Deleted(); !ok {
v := scaauthrole.DefaultDeleted v := scaauthrole.DefaultDeleted
@@ -147,6 +147,17 @@ func (sarc *ScaAuthRoleCreate) defaults() {
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sarc *ScaAuthRoleCreate) check() error { func (sarc *ScaAuthRoleCreate) check() error {
if _, ok := sarc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaAuthRole.created_at"`)}
}
if _, ok := sarc.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ScaAuthRole.updated_at"`)}
}
if v, ok := sarc.mutation.Deleted(); ok {
if err := scaauthrole.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.deleted": %w`, err)}
}
}
if _, ok := sarc.mutation.RoleName(); !ok { if _, ok := sarc.mutation.RoleName(); !ok {
return &ValidationError{Name: "role_name", err: errors.New(`ent: missing required field "ScaAuthRole.role_name"`)} return &ValidationError{Name: "role_name", err: errors.New(`ent: missing required field "ScaAuthRole.role_name"`)}
} }
@@ -163,15 +174,6 @@ func (sarc *ScaAuthRoleCreate) check() error {
return &ValidationError{Name: "role_key", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.role_key": %w`, err)} return &ValidationError{Name: "role_key", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.role_key": %w`, err)}
} }
} }
if _, ok := sarc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaAuthRole.created_at"`)}
}
if _, ok := sarc.mutation.UpdateAt(); !ok {
return &ValidationError{Name: "update_at", err: errors.New(`ent: missing required field "ScaAuthRole.update_at"`)}
}
if _, ok := sarc.mutation.Deleted(); !ok {
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "ScaAuthRole.deleted"`)}
}
return nil return nil
} }
@@ -204,6 +206,18 @@ func (sarc *ScaAuthRoleCreate) createSpec() (*ScaAuthRole, *sqlgraph.CreateSpec)
_node.ID = id _node.ID = id
_spec.ID.Value = id _spec.ID.Value = id
} }
if value, ok := sarc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthrole.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := sarc.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthrole.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := sarc.mutation.Deleted(); ok {
_spec.SetField(scaauthrole.FieldDeleted, field.TypeInt8, value)
_node.Deleted = value
}
if value, ok := sarc.mutation.RoleName(); ok { if value, ok := sarc.mutation.RoleName(); ok {
_spec.SetField(scaauthrole.FieldRoleName, field.TypeString, value) _spec.SetField(scaauthrole.FieldRoleName, field.TypeString, value)
_node.RoleName = value _node.RoleName = value
@@ -212,18 +226,6 @@ func (sarc *ScaAuthRoleCreate) createSpec() (*ScaAuthRole, *sqlgraph.CreateSpec)
_spec.SetField(scaauthrole.FieldRoleKey, field.TypeString, value) _spec.SetField(scaauthrole.FieldRoleKey, field.TypeString, value)
_node.RoleKey = value _node.RoleKey = value
} }
if value, ok := sarc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthrole.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := sarc.mutation.UpdateAt(); ok {
_spec.SetField(scaauthrole.FieldUpdateAt, field.TypeTime, value)
_node.UpdateAt = value
}
if value, ok := sarc.mutation.Deleted(); ok {
_spec.SetField(scaauthrole.FieldDeleted, field.TypeInt, value)
_node.Deleted = value
}
if nodes := sarc.mutation.ScaAuthPermissionRuleIDs(); len(nodes) > 0 { if nodes := sarc.mutation.ScaAuthPermissionRuleIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M, Rel: sqlgraph.O2M,

View File

@@ -299,12 +299,12 @@ func (sarq *ScaAuthRoleQuery) WithScaAuthPermissionRule(opts ...func(*ScaAuthPer
// Example: // Example:
// //
// var v []struct { // var v []struct {
// RoleName string `json:"role_name,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"` // Count int `json:"count,omitempty"`
// } // }
// //
// client.ScaAuthRole.Query(). // client.ScaAuthRole.Query().
// GroupBy(scaauthrole.FieldRoleName). // GroupBy(scaauthrole.FieldCreatedAt).
// Aggregate(ent.Count()). // Aggregate(ent.Count()).
// Scan(ctx, &v) // Scan(ctx, &v)
func (sarq *ScaAuthRoleQuery) GroupBy(field string, fields ...string) *ScaAuthRoleGroupBy { func (sarq *ScaAuthRoleQuery) GroupBy(field string, fields ...string) *ScaAuthRoleGroupBy {
@@ -322,11 +322,11 @@ func (sarq *ScaAuthRoleQuery) GroupBy(field string, fields ...string) *ScaAuthRo
// Example: // Example:
// //
// var v []struct { // var v []struct {
// RoleName string `json:"role_name,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// } // }
// //
// client.ScaAuthRole.Query(). // client.ScaAuthRole.Query().
// Select(scaauthrole.FieldRoleName). // Select(scaauthrole.FieldCreatedAt).
// Scan(ctx, &v) // Scan(ctx, &v)
func (sarq *ScaAuthRoleQuery) Select(fields ...string) *ScaAuthRoleSelect { func (sarq *ScaAuthRoleQuery) Select(fields ...string) *ScaAuthRoleSelect {
sarq.ctx.Fields = append(sarq.ctx.Fields, fields...) sarq.ctx.Fields = append(sarq.ctx.Fields, fields...)

View File

@@ -29,6 +29,39 @@ func (saru *ScaAuthRoleUpdate) Where(ps ...predicate.ScaAuthRole) *ScaAuthRoleUp
return saru return saru
} }
// SetUpdatedAt sets the "updated_at" field.
func (saru *ScaAuthRoleUpdate) SetUpdatedAt(t time.Time) *ScaAuthRoleUpdate {
saru.mutation.SetUpdatedAt(t)
return saru
}
// SetDeleted sets the "deleted" field.
func (saru *ScaAuthRoleUpdate) SetDeleted(i int8) *ScaAuthRoleUpdate {
saru.mutation.ResetDeleted()
saru.mutation.SetDeleted(i)
return saru
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saru *ScaAuthRoleUpdate) SetNillableDeleted(i *int8) *ScaAuthRoleUpdate {
if i != nil {
saru.SetDeleted(*i)
}
return saru
}
// AddDeleted adds i to the "deleted" field.
func (saru *ScaAuthRoleUpdate) AddDeleted(i int8) *ScaAuthRoleUpdate {
saru.mutation.AddDeleted(i)
return saru
}
// ClearDeleted clears the value of the "deleted" field.
func (saru *ScaAuthRoleUpdate) ClearDeleted() *ScaAuthRoleUpdate {
saru.mutation.ClearDeleted()
return saru
}
// SetRoleName sets the "role_name" field. // SetRoleName sets the "role_name" field.
func (saru *ScaAuthRoleUpdate) SetRoleName(s string) *ScaAuthRoleUpdate { func (saru *ScaAuthRoleUpdate) SetRoleName(s string) *ScaAuthRoleUpdate {
saru.mutation.SetRoleName(s) saru.mutation.SetRoleName(s)
@@ -57,33 +90,6 @@ func (saru *ScaAuthRoleUpdate) SetNillableRoleKey(s *string) *ScaAuthRoleUpdate
return saru return saru
} }
// SetUpdateAt sets the "update_at" field.
func (saru *ScaAuthRoleUpdate) SetUpdateAt(t time.Time) *ScaAuthRoleUpdate {
saru.mutation.SetUpdateAt(t)
return saru
}
// SetDeleted sets the "deleted" field.
func (saru *ScaAuthRoleUpdate) SetDeleted(i int) *ScaAuthRoleUpdate {
saru.mutation.ResetDeleted()
saru.mutation.SetDeleted(i)
return saru
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saru *ScaAuthRoleUpdate) SetNillableDeleted(i *int) *ScaAuthRoleUpdate {
if i != nil {
saru.SetDeleted(*i)
}
return saru
}
// AddDeleted adds i to the "deleted" field.
func (saru *ScaAuthRoleUpdate) AddDeleted(i int) *ScaAuthRoleUpdate {
saru.mutation.AddDeleted(i)
return saru
}
// AddScaAuthPermissionRuleIDs adds the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity by IDs. // AddScaAuthPermissionRuleIDs adds the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity by IDs.
func (saru *ScaAuthRoleUpdate) AddScaAuthPermissionRuleIDs(ids ...int64) *ScaAuthRoleUpdate { func (saru *ScaAuthRoleUpdate) AddScaAuthPermissionRuleIDs(ids ...int64) *ScaAuthRoleUpdate {
saru.mutation.AddScaAuthPermissionRuleIDs(ids...) saru.mutation.AddScaAuthPermissionRuleIDs(ids...)
@@ -155,14 +161,19 @@ func (saru *ScaAuthRoleUpdate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (saru *ScaAuthRoleUpdate) defaults() { func (saru *ScaAuthRoleUpdate) defaults() {
if _, ok := saru.mutation.UpdateAt(); !ok { if _, ok := saru.mutation.UpdatedAt(); !ok {
v := scaauthrole.UpdateDefaultUpdateAt() v := scaauthrole.UpdateDefaultUpdatedAt()
saru.mutation.SetUpdateAt(v) saru.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (saru *ScaAuthRoleUpdate) check() error { func (saru *ScaAuthRoleUpdate) check() error {
if v, ok := saru.mutation.Deleted(); ok {
if err := scaauthrole.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.deleted": %w`, err)}
}
}
if v, ok := saru.mutation.RoleName(); ok { if v, ok := saru.mutation.RoleName(); ok {
if err := scaauthrole.RoleNameValidator(v); err != nil { if err := scaauthrole.RoleNameValidator(v); err != nil {
return &ValidationError{Name: "role_name", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.role_name": %w`, err)} return &ValidationError{Name: "role_name", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.role_name": %w`, err)}
@@ -188,21 +199,24 @@ func (saru *ScaAuthRoleUpdate) sqlSave(ctx context.Context) (n int, err error) {
} }
} }
} }
if value, ok := saru.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthrole.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := saru.mutation.Deleted(); ok {
_spec.SetField(scaauthrole.FieldDeleted, field.TypeInt8, value)
}
if value, ok := saru.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthrole.FieldDeleted, field.TypeInt8, value)
}
if saru.mutation.DeletedCleared() {
_spec.ClearField(scaauthrole.FieldDeleted, field.TypeInt8)
}
if value, ok := saru.mutation.RoleName(); ok { if value, ok := saru.mutation.RoleName(); ok {
_spec.SetField(scaauthrole.FieldRoleName, field.TypeString, value) _spec.SetField(scaauthrole.FieldRoleName, field.TypeString, value)
} }
if value, ok := saru.mutation.RoleKey(); ok { if value, ok := saru.mutation.RoleKey(); ok {
_spec.SetField(scaauthrole.FieldRoleKey, field.TypeString, value) _spec.SetField(scaauthrole.FieldRoleKey, field.TypeString, value)
} }
if value, ok := saru.mutation.UpdateAt(); ok {
_spec.SetField(scaauthrole.FieldUpdateAt, field.TypeTime, value)
}
if value, ok := saru.mutation.Deleted(); ok {
_spec.SetField(scaauthrole.FieldDeleted, field.TypeInt, value)
}
if value, ok := saru.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthrole.FieldDeleted, field.TypeInt, value)
}
if saru.mutation.ScaAuthPermissionRuleCleared() { if saru.mutation.ScaAuthPermissionRuleCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M, Rel: sqlgraph.O2M,
@@ -268,6 +282,39 @@ type ScaAuthRoleUpdateOne struct {
mutation *ScaAuthRoleMutation mutation *ScaAuthRoleMutation
} }
// SetUpdatedAt sets the "updated_at" field.
func (saruo *ScaAuthRoleUpdateOne) SetUpdatedAt(t time.Time) *ScaAuthRoleUpdateOne {
saruo.mutation.SetUpdatedAt(t)
return saruo
}
// SetDeleted sets the "deleted" field.
func (saruo *ScaAuthRoleUpdateOne) SetDeleted(i int8) *ScaAuthRoleUpdateOne {
saruo.mutation.ResetDeleted()
saruo.mutation.SetDeleted(i)
return saruo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saruo *ScaAuthRoleUpdateOne) SetNillableDeleted(i *int8) *ScaAuthRoleUpdateOne {
if i != nil {
saruo.SetDeleted(*i)
}
return saruo
}
// AddDeleted adds i to the "deleted" field.
func (saruo *ScaAuthRoleUpdateOne) AddDeleted(i int8) *ScaAuthRoleUpdateOne {
saruo.mutation.AddDeleted(i)
return saruo
}
// ClearDeleted clears the value of the "deleted" field.
func (saruo *ScaAuthRoleUpdateOne) ClearDeleted() *ScaAuthRoleUpdateOne {
saruo.mutation.ClearDeleted()
return saruo
}
// SetRoleName sets the "role_name" field. // SetRoleName sets the "role_name" field.
func (saruo *ScaAuthRoleUpdateOne) SetRoleName(s string) *ScaAuthRoleUpdateOne { func (saruo *ScaAuthRoleUpdateOne) SetRoleName(s string) *ScaAuthRoleUpdateOne {
saruo.mutation.SetRoleName(s) saruo.mutation.SetRoleName(s)
@@ -296,33 +343,6 @@ func (saruo *ScaAuthRoleUpdateOne) SetNillableRoleKey(s *string) *ScaAuthRoleUpd
return saruo return saruo
} }
// SetUpdateAt sets the "update_at" field.
func (saruo *ScaAuthRoleUpdateOne) SetUpdateAt(t time.Time) *ScaAuthRoleUpdateOne {
saruo.mutation.SetUpdateAt(t)
return saruo
}
// SetDeleted sets the "deleted" field.
func (saruo *ScaAuthRoleUpdateOne) SetDeleted(i int) *ScaAuthRoleUpdateOne {
saruo.mutation.ResetDeleted()
saruo.mutation.SetDeleted(i)
return saruo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saruo *ScaAuthRoleUpdateOne) SetNillableDeleted(i *int) *ScaAuthRoleUpdateOne {
if i != nil {
saruo.SetDeleted(*i)
}
return saruo
}
// AddDeleted adds i to the "deleted" field.
func (saruo *ScaAuthRoleUpdateOne) AddDeleted(i int) *ScaAuthRoleUpdateOne {
saruo.mutation.AddDeleted(i)
return saruo
}
// AddScaAuthPermissionRuleIDs adds the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity by IDs. // AddScaAuthPermissionRuleIDs adds the "sca_auth_permission_rule" edge to the ScaAuthPermissionRule entity by IDs.
func (saruo *ScaAuthRoleUpdateOne) AddScaAuthPermissionRuleIDs(ids ...int64) *ScaAuthRoleUpdateOne { func (saruo *ScaAuthRoleUpdateOne) AddScaAuthPermissionRuleIDs(ids ...int64) *ScaAuthRoleUpdateOne {
saruo.mutation.AddScaAuthPermissionRuleIDs(ids...) saruo.mutation.AddScaAuthPermissionRuleIDs(ids...)
@@ -407,14 +427,19 @@ func (saruo *ScaAuthRoleUpdateOne) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (saruo *ScaAuthRoleUpdateOne) defaults() { func (saruo *ScaAuthRoleUpdateOne) defaults() {
if _, ok := saruo.mutation.UpdateAt(); !ok { if _, ok := saruo.mutation.UpdatedAt(); !ok {
v := scaauthrole.UpdateDefaultUpdateAt() v := scaauthrole.UpdateDefaultUpdatedAt()
saruo.mutation.SetUpdateAt(v) saruo.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (saruo *ScaAuthRoleUpdateOne) check() error { func (saruo *ScaAuthRoleUpdateOne) check() error {
if v, ok := saruo.mutation.Deleted(); ok {
if err := scaauthrole.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.deleted": %w`, err)}
}
}
if v, ok := saruo.mutation.RoleName(); ok { if v, ok := saruo.mutation.RoleName(); ok {
if err := scaauthrole.RoleNameValidator(v); err != nil { if err := scaauthrole.RoleNameValidator(v); err != nil {
return &ValidationError{Name: "role_name", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.role_name": %w`, err)} return &ValidationError{Name: "role_name", err: fmt.Errorf(`ent: validator failed for field "ScaAuthRole.role_name": %w`, err)}
@@ -457,21 +482,24 @@ func (saruo *ScaAuthRoleUpdateOne) sqlSave(ctx context.Context) (_node *ScaAuthR
} }
} }
} }
if value, ok := saruo.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthrole.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := saruo.mutation.Deleted(); ok {
_spec.SetField(scaauthrole.FieldDeleted, field.TypeInt8, value)
}
if value, ok := saruo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthrole.FieldDeleted, field.TypeInt8, value)
}
if saruo.mutation.DeletedCleared() {
_spec.ClearField(scaauthrole.FieldDeleted, field.TypeInt8)
}
if value, ok := saruo.mutation.RoleName(); ok { if value, ok := saruo.mutation.RoleName(); ok {
_spec.SetField(scaauthrole.FieldRoleName, field.TypeString, value) _spec.SetField(scaauthrole.FieldRoleName, field.TypeString, value)
} }
if value, ok := saruo.mutation.RoleKey(); ok { if value, ok := saruo.mutation.RoleKey(); ok {
_spec.SetField(scaauthrole.FieldRoleKey, field.TypeString, value) _spec.SetField(scaauthrole.FieldRoleKey, field.TypeString, value)
} }
if value, ok := saruo.mutation.UpdateAt(); ok {
_spec.SetField(scaauthrole.FieldUpdateAt, field.TypeTime, value)
}
if value, ok := saruo.mutation.Deleted(); ok {
_spec.SetField(scaauthrole.FieldDeleted, field.TypeInt, value)
}
if value, ok := saruo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthrole.FieldDeleted, field.TypeInt, value)
}
if saruo.mutation.ScaAuthPermissionRuleCleared() { if saruo.mutation.ScaAuthPermissionRuleCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M, Rel: sqlgraph.O2M,

View File

@@ -12,12 +12,18 @@ import (
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql"
) )
// ScaAuthUser is the model entity for the ScaAuthUser schema. // 用户表
type ScaAuthUser struct { type ScaAuthUser struct {
config `json:"-"` config `json:"-"`
// ID of the ent. // ID of the ent.
// 自增ID // 自增ID
ID int64 `json:"id,omitempty"` 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 // 唯一ID
UID string `json:"uid,omitempty"` UID string `json:"uid,omitempty"`
// 用户名 // 用户名
@@ -38,12 +44,6 @@ type ScaAuthUser struct {
Status int8 `json:"status,omitempty"` Status int8 `json:"status,omitempty"`
// 介绍 // 介绍
Introduce string `json:"introduce,omitempty"` Introduce string `json:"introduce,omitempty"`
// 创建时间
CreatedAt time.Time `json:"created_at,omitempty"`
// 更新时间
UpdateAt *time.Time `json:"update_at,omitempty"`
// 是否删除 0 未删除 1 已删除
Deleted int8 `json:"deleted,omitempty"`
// 博客 // 博客
Blog *string `json:"blog,omitempty"` Blog *string `json:"blog,omitempty"`
// 地址 // 地址
@@ -90,11 +90,11 @@ func (*ScaAuthUser) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case scaauthuser.FieldID, scaauthuser.FieldStatus, scaauthuser.FieldDeleted: case scaauthuser.FieldID, scaauthuser.FieldDeleted, scaauthuser.FieldStatus:
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
case scaauthuser.FieldUID, scaauthuser.FieldUsername, scaauthuser.FieldNickname, scaauthuser.FieldEmail, scaauthuser.FieldPhone, scaauthuser.FieldPassword, scaauthuser.FieldGender, scaauthuser.FieldAvatar, scaauthuser.FieldIntroduce, scaauthuser.FieldBlog, scaauthuser.FieldLocation, scaauthuser.FieldCompany: case scaauthuser.FieldUID, scaauthuser.FieldUsername, scaauthuser.FieldNickname, scaauthuser.FieldEmail, scaauthuser.FieldPhone, scaauthuser.FieldPassword, scaauthuser.FieldGender, scaauthuser.FieldAvatar, scaauthuser.FieldIntroduce, scaauthuser.FieldBlog, scaauthuser.FieldLocation, scaauthuser.FieldCompany:
values[i] = new(sql.NullString) values[i] = new(sql.NullString)
case scaauthuser.FieldCreatedAt, scaauthuser.FieldUpdateAt: case scaauthuser.FieldCreatedAt, scaauthuser.FieldUpdatedAt:
values[i] = new(sql.NullTime) values[i] = new(sql.NullTime)
default: default:
values[i] = new(sql.UnknownType) values[i] = new(sql.UnknownType)
@@ -117,6 +117,24 @@ func (sau *ScaAuthUser) assignValues(columns []string, values []any) error {
return fmt.Errorf("unexpected type %T for field id", value) return fmt.Errorf("unexpected type %T for field id", value)
} }
sau.ID = int64(value.Int64) sau.ID = int64(value.Int64)
case scaauthuser.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 {
sau.CreatedAt = value.Time
}
case scaauthuser.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 {
sau.UpdatedAt = value.Time
}
case scaauthuser.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
sau.Deleted = int8(value.Int64)
}
case scaauthuser.FieldUID: case scaauthuser.FieldUID:
if value, ok := values[i].(*sql.NullString); !ok { if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field uid", values[i]) return fmt.Errorf("unexpected type %T for field uid", values[i])
@@ -177,25 +195,6 @@ func (sau *ScaAuthUser) assignValues(columns []string, values []any) error {
} else if value.Valid { } else if value.Valid {
sau.Introduce = value.String sau.Introduce = value.String
} }
case scaauthuser.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 {
sau.CreatedAt = value.Time
}
case scaauthuser.FieldUpdateAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field update_at", values[i])
} else if value.Valid {
sau.UpdateAt = new(time.Time)
*sau.UpdateAt = value.Time
}
case scaauthuser.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
sau.Deleted = int8(value.Int64)
}
case scaauthuser.FieldBlog: case scaauthuser.FieldBlog:
if value, ok := values[i].(*sql.NullString); !ok { if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field blog", values[i]) return fmt.Errorf("unexpected type %T for field blog", values[i])
@@ -263,6 +262,15 @@ func (sau *ScaAuthUser) String() string {
var builder strings.Builder var builder strings.Builder
builder.WriteString("ScaAuthUser(") builder.WriteString("ScaAuthUser(")
builder.WriteString(fmt.Sprintf("id=%v, ", sau.ID)) builder.WriteString(fmt.Sprintf("id=%v, ", sau.ID))
builder.WriteString("created_at=")
builder.WriteString(sau.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(sau.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", sau.Deleted))
builder.WriteString(", ")
builder.WriteString("uid=") builder.WriteString("uid=")
builder.WriteString(sau.UID) builder.WriteString(sau.UID)
builder.WriteString(", ") builder.WriteString(", ")
@@ -292,17 +300,6 @@ func (sau *ScaAuthUser) String() string {
builder.WriteString("introduce=") builder.WriteString("introduce=")
builder.WriteString(sau.Introduce) builder.WriteString(sau.Introduce)
builder.WriteString(", ") builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(sau.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
if v := sau.UpdateAt; v != nil {
builder.WriteString("update_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", sau.Deleted))
builder.WriteString(", ")
if v := sau.Blog; v != nil { if v := sau.Blog; v != nil {
builder.WriteString("blog=") builder.WriteString("blog=")
builder.WriteString(*v) builder.WriteString(*v)

View File

@@ -14,6 +14,12 @@ const (
Label = "sca_auth_user" Label = "sca_auth_user"
// FieldID holds the string denoting the id field in the database. // FieldID holds the string denoting the id field in the database.
FieldID = "id" 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"
// FieldUID holds the string denoting the uid field in the database. // FieldUID holds the string denoting the uid field in the database.
FieldUID = "uid" FieldUID = "uid"
// FieldUsername holds the string denoting the username field in the database. // FieldUsername holds the string denoting the username field in the database.
@@ -34,12 +40,6 @@ const (
FieldStatus = "status" FieldStatus = "status"
// FieldIntroduce holds the string denoting the introduce field in the database. // FieldIntroduce holds the string denoting the introduce field in the database.
FieldIntroduce = "introduce" FieldIntroduce = "introduce"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdateAt holds the string denoting the update_at field in the database.
FieldUpdateAt = "update_at"
// FieldDeleted holds the string denoting the deleted field in the database.
FieldDeleted = "deleted"
// FieldBlog holds the string denoting the blog field in the database. // FieldBlog holds the string denoting the blog field in the database.
FieldBlog = "blog" FieldBlog = "blog"
// FieldLocation holds the string denoting the location field in the database. // FieldLocation holds the string denoting the location field in the database.
@@ -51,19 +51,19 @@ const (
// EdgeScaAuthUserDevice holds the string denoting the sca_auth_user_device edge name in mutations. // EdgeScaAuthUserDevice holds the string denoting the sca_auth_user_device edge name in mutations.
EdgeScaAuthUserDevice = "sca_auth_user_device" EdgeScaAuthUserDevice = "sca_auth_user_device"
// Table holds the table name of the scaauthuser in the database. // Table holds the table name of the scaauthuser in the database.
Table = "sca_auth_users" Table = "sca_auth_user"
// ScaAuthUserSocialTable is the table that holds the sca_auth_user_social relation/edge. // ScaAuthUserSocialTable is the table that holds the sca_auth_user_social relation/edge.
ScaAuthUserSocialTable = "sca_auth_user_socials" ScaAuthUserSocialTable = "sca_auth_user_social"
// ScaAuthUserSocialInverseTable is the table name for the ScaAuthUserSocial entity. // ScaAuthUserSocialInverseTable is the table name for the ScaAuthUserSocial entity.
// It exists in this package in order to avoid circular dependency with the "scaauthusersocial" package. // It exists in this package in order to avoid circular dependency with the "scaauthusersocial" package.
ScaAuthUserSocialInverseTable = "sca_auth_user_socials" ScaAuthUserSocialInverseTable = "sca_auth_user_social"
// ScaAuthUserSocialColumn is the table column denoting the sca_auth_user_social relation/edge. // ScaAuthUserSocialColumn is the table column denoting the sca_auth_user_social relation/edge.
ScaAuthUserSocialColumn = "sca_auth_user_sca_auth_user_social" ScaAuthUserSocialColumn = "sca_auth_user_sca_auth_user_social"
// ScaAuthUserDeviceTable is the table that holds the sca_auth_user_device relation/edge. // ScaAuthUserDeviceTable is the table that holds the sca_auth_user_device relation/edge.
ScaAuthUserDeviceTable = "sca_auth_user_devices" ScaAuthUserDeviceTable = "sca_auth_user_device"
// ScaAuthUserDeviceInverseTable is the table name for the ScaAuthUserDevice entity. // ScaAuthUserDeviceInverseTable is the table name for the ScaAuthUserDevice entity.
// It exists in this package in order to avoid circular dependency with the "scaauthuserdevice" package. // It exists in this package in order to avoid circular dependency with the "scaauthuserdevice" package.
ScaAuthUserDeviceInverseTable = "sca_auth_user_devices" ScaAuthUserDeviceInverseTable = "sca_auth_user_device"
// ScaAuthUserDeviceColumn is the table column denoting the sca_auth_user_device relation/edge. // ScaAuthUserDeviceColumn is the table column denoting the sca_auth_user_device relation/edge.
ScaAuthUserDeviceColumn = "sca_auth_user_sca_auth_user_device" ScaAuthUserDeviceColumn = "sca_auth_user_sca_auth_user_device"
) )
@@ -71,6 +71,9 @@ const (
// Columns holds all SQL columns for scaauthuser fields. // Columns holds all SQL columns for scaauthuser fields.
var Columns = []string{ var Columns = []string{
FieldID, FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeleted,
FieldUID, FieldUID,
FieldUsername, FieldUsername,
FieldNickname, FieldNickname,
@@ -81,9 +84,6 @@ var Columns = []string{
FieldAvatar, FieldAvatar,
FieldStatus, FieldStatus,
FieldIntroduce, FieldIntroduce,
FieldCreatedAt,
FieldUpdateAt,
FieldDeleted,
FieldBlog, FieldBlog,
FieldLocation, FieldLocation,
FieldCompany, FieldCompany,
@@ -100,6 +100,16 @@ func ValidColumn(column string) bool {
} }
var ( var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// 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
// UIDValidator is a validator for the "uid" field. It is called by the builders before save. // UIDValidator is a validator for the "uid" field. It is called by the builders before save.
UIDValidator func(string) error UIDValidator func(string) error
// UsernameValidator is a validator for the "username" field. It is called by the builders before save. // UsernameValidator is a validator for the "username" field. It is called by the builders before save.
@@ -118,14 +128,6 @@ var (
DefaultStatus int8 DefaultStatus int8
// IntroduceValidator is a validator for the "introduce" field. It is called by the builders before save. // IntroduceValidator is a validator for the "introduce" field. It is called by the builders before save.
IntroduceValidator func(string) error IntroduceValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdateAt holds the default value on creation for the "update_at" field.
DefaultUpdateAt func() time.Time
// UpdateDefaultUpdateAt holds the default value on update for the "update_at" field.
UpdateDefaultUpdateAt func() time.Time
// DefaultDeleted holds the default value on creation for the "deleted" field.
DefaultDeleted int8
// BlogValidator is a validator for the "blog" field. It is called by the builders before save. // BlogValidator is a validator for the "blog" field. It is called by the builders before save.
BlogValidator func(string) error BlogValidator func(string) error
// LocationValidator is a validator for the "location" field. It is called by the builders before save. // LocationValidator is a validator for the "location" field. It is called by the builders before save.
@@ -142,6 +144,21 @@ func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc() 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()
}
// ByUID orders the results by the uid field. // ByUID orders the results by the uid field.
func ByUID(opts ...sql.OrderTermOption) OrderOption { func ByUID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUID, opts...).ToFunc() return sql.OrderByField(FieldUID, opts...).ToFunc()
@@ -192,21 +209,6 @@ func ByIntroduce(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIntroduce, opts...).ToFunc() return sql.OrderByField(FieldIntroduce, opts...).ToFunc()
} }
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdateAt orders the results by the update_at field.
func ByUpdateAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateAt, opts...).ToFunc()
}
// ByDeleted orders the results by the deleted field.
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
}
// ByBlog orders the results by the blog field. // ByBlog orders the results by the blog field.
func ByBlog(opts ...sql.OrderTermOption) OrderOption { func ByBlog(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBlog, opts...).ToFunc() return sql.OrderByField(FieldBlog, opts...).ToFunc()

View File

@@ -55,6 +55,21 @@ func IDLTE(id int64) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLTE(FieldID, id)) return predicate.ScaAuthUser(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.ScaAuthUser {
return predicate.ScaAuthUser(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.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldUpdatedAt, v))
}
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
func Deleted(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldDeleted, v))
}
// UID applies equality check predicate on the "uid" field. It's identical to UIDEQ. // UID applies equality check predicate on the "uid" field. It's identical to UIDEQ.
func UID(v string) predicate.ScaAuthUser { func UID(v string) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldUID, v)) return predicate.ScaAuthUser(sql.FieldEQ(FieldUID, v))
@@ -105,21 +120,6 @@ func Introduce(v string) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldIntroduce, v)) return predicate.ScaAuthUser(sql.FieldEQ(FieldIntroduce, v))
} }
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdateAt applies equality check predicate on the "update_at" field. It's identical to UpdateAtEQ.
func UpdateAt(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldUpdateAt, v))
}
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
func Deleted(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldDeleted, v))
}
// Blog applies equality check predicate on the "blog" field. It's identical to BlogEQ. // Blog applies equality check predicate on the "blog" field. It's identical to BlogEQ.
func Blog(v string) predicate.ScaAuthUser { func Blog(v string) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldBlog, v)) return predicate.ScaAuthUser(sql.FieldEQ(FieldBlog, v))
@@ -135,6 +135,136 @@ func Company(v string) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldCompany, v)) return predicate.ScaAuthUser(sql.FieldEQ(FieldCompany, v))
} }
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLTE(FieldUpdatedAt, v))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldDeleted, v))
}
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLTE(FieldDeleted, v))
}
// DeletedIsNil applies the IsNil predicate on the "deleted" field.
func DeletedIsNil() predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIsNull(FieldDeleted))
}
// DeletedNotNil applies the NotNil predicate on the "deleted" field.
func DeletedNotNil() predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotNull(FieldDeleted))
}
// UIDEQ applies the EQ predicate on the "uid" field. // UIDEQ applies the EQ predicate on the "uid" field.
func UIDEQ(v string) predicate.ScaAuthUser { func UIDEQ(v string) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldUID, v)) return predicate.ScaAuthUser(sql.FieldEQ(FieldUID, v))
@@ -850,136 +980,6 @@ func IntroduceContainsFold(v string) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldContainsFold(FieldIntroduce, v)) return predicate.ScaAuthUser(sql.FieldContainsFold(FieldIntroduce, v))
} }
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdateAtEQ applies the EQ predicate on the "update_at" field.
func UpdateAtEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldUpdateAt, v))
}
// UpdateAtNEQ applies the NEQ predicate on the "update_at" field.
func UpdateAtNEQ(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNEQ(FieldUpdateAt, v))
}
// UpdateAtIn applies the In predicate on the "update_at" field.
func UpdateAtIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIn(FieldUpdateAt, vs...))
}
// UpdateAtNotIn applies the NotIn predicate on the "update_at" field.
func UpdateAtNotIn(vs ...time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotIn(FieldUpdateAt, vs...))
}
// UpdateAtGT applies the GT predicate on the "update_at" field.
func UpdateAtGT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGT(FieldUpdateAt, v))
}
// UpdateAtGTE applies the GTE predicate on the "update_at" field.
func UpdateAtGTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGTE(FieldUpdateAt, v))
}
// UpdateAtLT applies the LT predicate on the "update_at" field.
func UpdateAtLT(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLT(FieldUpdateAt, v))
}
// UpdateAtLTE applies the LTE predicate on the "update_at" field.
func UpdateAtLTE(v time.Time) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLTE(FieldUpdateAt, v))
}
// UpdateAtIsNil applies the IsNil predicate on the "update_at" field.
func UpdateAtIsNil() predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIsNull(FieldUpdateAt))
}
// UpdateAtNotNil applies the NotNil predicate on the "update_at" field.
func UpdateAtNotNil() predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotNull(FieldUpdateAt))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldDeleted, v))
}
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int8) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldLTE(FieldDeleted, v))
}
// BlogEQ applies the EQ predicate on the "blog" field. // BlogEQ applies the EQ predicate on the "blog" field.
func BlogEQ(v string) predicate.ScaAuthUser { func BlogEQ(v string) predicate.ScaAuthUser {
return predicate.ScaAuthUser(sql.FieldEQ(FieldBlog, v)) return predicate.ScaAuthUser(sql.FieldEQ(FieldBlog, v))

View File

@@ -22,6 +22,48 @@ type ScaAuthUserCreate struct {
hooks []Hook hooks []Hook
} }
// SetCreatedAt sets the "created_at" field.
func (sauc *ScaAuthUserCreate) SetCreatedAt(t time.Time) *ScaAuthUserCreate {
sauc.mutation.SetCreatedAt(t)
return sauc
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (sauc *ScaAuthUserCreate) SetNillableCreatedAt(t *time.Time) *ScaAuthUserCreate {
if t != nil {
sauc.SetCreatedAt(*t)
}
return sauc
}
// SetUpdatedAt sets the "updated_at" field.
func (sauc *ScaAuthUserCreate) SetUpdatedAt(t time.Time) *ScaAuthUserCreate {
sauc.mutation.SetUpdatedAt(t)
return sauc
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (sauc *ScaAuthUserCreate) SetNillableUpdatedAt(t *time.Time) *ScaAuthUserCreate {
if t != nil {
sauc.SetUpdatedAt(*t)
}
return sauc
}
// SetDeleted sets the "deleted" field.
func (sauc *ScaAuthUserCreate) SetDeleted(i int8) *ScaAuthUserCreate {
sauc.mutation.SetDeleted(i)
return sauc
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauc *ScaAuthUserCreate) SetNillableDeleted(i *int8) *ScaAuthUserCreate {
if i != nil {
sauc.SetDeleted(*i)
}
return sauc
}
// SetUID sets the "uid" field. // SetUID sets the "uid" field.
func (sauc *ScaAuthUserCreate) SetUID(s string) *ScaAuthUserCreate { func (sauc *ScaAuthUserCreate) SetUID(s string) *ScaAuthUserCreate {
sauc.mutation.SetUID(s) sauc.mutation.SetUID(s)
@@ -154,48 +196,6 @@ func (sauc *ScaAuthUserCreate) SetNillableIntroduce(s *string) *ScaAuthUserCreat
return sauc return sauc
} }
// SetCreatedAt sets the "created_at" field.
func (sauc *ScaAuthUserCreate) SetCreatedAt(t time.Time) *ScaAuthUserCreate {
sauc.mutation.SetCreatedAt(t)
return sauc
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (sauc *ScaAuthUserCreate) SetNillableCreatedAt(t *time.Time) *ScaAuthUserCreate {
if t != nil {
sauc.SetCreatedAt(*t)
}
return sauc
}
// SetUpdateAt sets the "update_at" field.
func (sauc *ScaAuthUserCreate) SetUpdateAt(t time.Time) *ScaAuthUserCreate {
sauc.mutation.SetUpdateAt(t)
return sauc
}
// SetNillableUpdateAt sets the "update_at" field if the given value is not nil.
func (sauc *ScaAuthUserCreate) SetNillableUpdateAt(t *time.Time) *ScaAuthUserCreate {
if t != nil {
sauc.SetUpdateAt(*t)
}
return sauc
}
// SetDeleted sets the "deleted" field.
func (sauc *ScaAuthUserCreate) SetDeleted(i int8) *ScaAuthUserCreate {
sauc.mutation.SetDeleted(i)
return sauc
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauc *ScaAuthUserCreate) SetNillableDeleted(i *int8) *ScaAuthUserCreate {
if i != nil {
sauc.SetDeleted(*i)
}
return sauc
}
// SetBlog sets the "blog" field. // SetBlog sets the "blog" field.
func (sauc *ScaAuthUserCreate) SetBlog(s string) *ScaAuthUserCreate { func (sauc *ScaAuthUserCreate) SetBlog(s string) *ScaAuthUserCreate {
sauc.mutation.SetBlog(s) sauc.mutation.SetBlog(s)
@@ -309,26 +309,37 @@ func (sauc *ScaAuthUserCreate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (sauc *ScaAuthUserCreate) defaults() { func (sauc *ScaAuthUserCreate) defaults() {
if _, ok := sauc.mutation.Status(); !ok {
v := scaauthuser.DefaultStatus
sauc.mutation.SetStatus(v)
}
if _, ok := sauc.mutation.CreatedAt(); !ok { if _, ok := sauc.mutation.CreatedAt(); !ok {
v := scaauthuser.DefaultCreatedAt() v := scaauthuser.DefaultCreatedAt()
sauc.mutation.SetCreatedAt(v) sauc.mutation.SetCreatedAt(v)
} }
if _, ok := sauc.mutation.UpdateAt(); !ok { if _, ok := sauc.mutation.UpdatedAt(); !ok {
v := scaauthuser.DefaultUpdateAt() v := scaauthuser.DefaultUpdatedAt()
sauc.mutation.SetUpdateAt(v) sauc.mutation.SetUpdatedAt(v)
} }
if _, ok := sauc.mutation.Deleted(); !ok { if _, ok := sauc.mutation.Deleted(); !ok {
v := scaauthuser.DefaultDeleted v := scaauthuser.DefaultDeleted
sauc.mutation.SetDeleted(v) sauc.mutation.SetDeleted(v)
} }
if _, ok := sauc.mutation.Status(); !ok {
v := scaauthuser.DefaultStatus
sauc.mutation.SetStatus(v)
}
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sauc *ScaAuthUserCreate) check() error { func (sauc *ScaAuthUserCreate) check() error {
if _, ok := sauc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaAuthUser.created_at"`)}
}
if _, ok := sauc.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ScaAuthUser.updated_at"`)}
}
if v, ok := sauc.mutation.Deleted(); ok {
if err := scaauthuser.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.deleted": %w`, err)}
}
}
if _, ok := sauc.mutation.UID(); !ok { if _, ok := sauc.mutation.UID(); !ok {
return &ValidationError{Name: "uid", err: errors.New(`ent: missing required field "ScaAuthUser.uid"`)} return &ValidationError{Name: "uid", err: errors.New(`ent: missing required field "ScaAuthUser.uid"`)}
} }
@@ -372,12 +383,6 @@ func (sauc *ScaAuthUserCreate) check() error {
return &ValidationError{Name: "introduce", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.introduce": %w`, err)} return &ValidationError{Name: "introduce", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.introduce": %w`, err)}
} }
} }
if _, ok := sauc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaAuthUser.created_at"`)}
}
if _, ok := sauc.mutation.Deleted(); !ok {
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "ScaAuthUser.deleted"`)}
}
if v, ok := sauc.mutation.Blog(); ok { if v, ok := sauc.mutation.Blog(); ok {
if err := scaauthuser.BlogValidator(v); err != nil { if err := scaauthuser.BlogValidator(v); err != nil {
return &ValidationError{Name: "blog", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.blog": %w`, err)} return &ValidationError{Name: "blog", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.blog": %w`, err)}
@@ -425,6 +430,18 @@ func (sauc *ScaAuthUserCreate) createSpec() (*ScaAuthUser, *sqlgraph.CreateSpec)
_node.ID = id _node.ID = id
_spec.ID.Value = id _spec.ID.Value = id
} }
if value, ok := sauc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthuser.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := sauc.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthuser.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := sauc.mutation.Deleted(); ok {
_spec.SetField(scaauthuser.FieldDeleted, field.TypeInt8, value)
_node.Deleted = value
}
if value, ok := sauc.mutation.UID(); ok { if value, ok := sauc.mutation.UID(); ok {
_spec.SetField(scaauthuser.FieldUID, field.TypeString, value) _spec.SetField(scaauthuser.FieldUID, field.TypeString, value)
_node.UID = value _node.UID = value
@@ -465,18 +482,6 @@ func (sauc *ScaAuthUserCreate) createSpec() (*ScaAuthUser, *sqlgraph.CreateSpec)
_spec.SetField(scaauthuser.FieldIntroduce, field.TypeString, value) _spec.SetField(scaauthuser.FieldIntroduce, field.TypeString, value)
_node.Introduce = value _node.Introduce = value
} }
if value, ok := sauc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthuser.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := sauc.mutation.UpdateAt(); ok {
_spec.SetField(scaauthuser.FieldUpdateAt, field.TypeTime, value)
_node.UpdateAt = &value
}
if value, ok := sauc.mutation.Deleted(); ok {
_spec.SetField(scaauthuser.FieldDeleted, field.TypeInt8, value)
_node.Deleted = value
}
if value, ok := sauc.mutation.Blog(); ok { if value, ok := sauc.mutation.Blog(); ok {
_spec.SetField(scaauthuser.FieldBlog, field.TypeString, value) _spec.SetField(scaauthuser.FieldBlog, field.TypeString, value)
_node.Blog = &value _node.Blog = &value

View File

@@ -335,12 +335,12 @@ func (sauq *ScaAuthUserQuery) WithScaAuthUserDevice(opts ...func(*ScaAuthUserDev
// Example: // Example:
// //
// var v []struct { // var v []struct {
// UID string `json:"uid,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"` // Count int `json:"count,omitempty"`
// } // }
// //
// client.ScaAuthUser.Query(). // client.ScaAuthUser.Query().
// GroupBy(scaauthuser.FieldUID). // GroupBy(scaauthuser.FieldCreatedAt).
// Aggregate(ent.Count()). // Aggregate(ent.Count()).
// Scan(ctx, &v) // Scan(ctx, &v)
func (sauq *ScaAuthUserQuery) GroupBy(field string, fields ...string) *ScaAuthUserGroupBy { func (sauq *ScaAuthUserQuery) GroupBy(field string, fields ...string) *ScaAuthUserGroupBy {
@@ -358,11 +358,11 @@ func (sauq *ScaAuthUserQuery) GroupBy(field string, fields ...string) *ScaAuthUs
// Example: // Example:
// //
// var v []struct { // var v []struct {
// UID string `json:"uid,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// } // }
// //
// client.ScaAuthUser.Query(). // client.ScaAuthUser.Query().
// Select(scaauthuser.FieldUID). // Select(scaauthuser.FieldCreatedAt).
// Scan(ctx, &v) // Scan(ctx, &v)
func (sauq *ScaAuthUserQuery) Select(fields ...string) *ScaAuthUserSelect { func (sauq *ScaAuthUserQuery) Select(fields ...string) *ScaAuthUserSelect {
sauq.ctx.Fields = append(sauq.ctx.Fields, fields...) sauq.ctx.Fields = append(sauq.ctx.Fields, fields...)

View File

@@ -30,6 +30,39 @@ func (sauu *ScaAuthUserUpdate) Where(ps ...predicate.ScaAuthUser) *ScaAuthUserUp
return sauu return sauu
} }
// SetUpdatedAt sets the "updated_at" field.
func (sauu *ScaAuthUserUpdate) SetUpdatedAt(t time.Time) *ScaAuthUserUpdate {
sauu.mutation.SetUpdatedAt(t)
return sauu
}
// SetDeleted sets the "deleted" field.
func (sauu *ScaAuthUserUpdate) SetDeleted(i int8) *ScaAuthUserUpdate {
sauu.mutation.ResetDeleted()
sauu.mutation.SetDeleted(i)
return sauu
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauu *ScaAuthUserUpdate) SetNillableDeleted(i *int8) *ScaAuthUserUpdate {
if i != nil {
sauu.SetDeleted(*i)
}
return sauu
}
// AddDeleted adds i to the "deleted" field.
func (sauu *ScaAuthUserUpdate) AddDeleted(i int8) *ScaAuthUserUpdate {
sauu.mutation.AddDeleted(i)
return sauu
}
// ClearDeleted clears the value of the "deleted" field.
func (sauu *ScaAuthUserUpdate) ClearDeleted() *ScaAuthUserUpdate {
sauu.mutation.ClearDeleted()
return sauu
}
// SetUID sets the "uid" field. // SetUID sets the "uid" field.
func (sauu *ScaAuthUserUpdate) SetUID(s string) *ScaAuthUserUpdate { func (sauu *ScaAuthUserUpdate) SetUID(s string) *ScaAuthUserUpdate {
sauu.mutation.SetUID(s) sauu.mutation.SetUID(s)
@@ -231,39 +264,6 @@ func (sauu *ScaAuthUserUpdate) ClearIntroduce() *ScaAuthUserUpdate {
return sauu return sauu
} }
// SetUpdateAt sets the "update_at" field.
func (sauu *ScaAuthUserUpdate) SetUpdateAt(t time.Time) *ScaAuthUserUpdate {
sauu.mutation.SetUpdateAt(t)
return sauu
}
// ClearUpdateAt clears the value of the "update_at" field.
func (sauu *ScaAuthUserUpdate) ClearUpdateAt() *ScaAuthUserUpdate {
sauu.mutation.ClearUpdateAt()
return sauu
}
// SetDeleted sets the "deleted" field.
func (sauu *ScaAuthUserUpdate) SetDeleted(i int8) *ScaAuthUserUpdate {
sauu.mutation.ResetDeleted()
sauu.mutation.SetDeleted(i)
return sauu
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauu *ScaAuthUserUpdate) SetNillableDeleted(i *int8) *ScaAuthUserUpdate {
if i != nil {
sauu.SetDeleted(*i)
}
return sauu
}
// AddDeleted adds i to the "deleted" field.
func (sauu *ScaAuthUserUpdate) AddDeleted(i int8) *ScaAuthUserUpdate {
sauu.mutation.AddDeleted(i)
return sauu
}
// SetBlog sets the "blog" field. // SetBlog sets the "blog" field.
func (sauu *ScaAuthUserUpdate) SetBlog(s string) *ScaAuthUserUpdate { func (sauu *ScaAuthUserUpdate) SetBlog(s string) *ScaAuthUserUpdate {
sauu.mutation.SetBlog(s) sauu.mutation.SetBlog(s)
@@ -431,14 +431,19 @@ func (sauu *ScaAuthUserUpdate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (sauu *ScaAuthUserUpdate) defaults() { func (sauu *ScaAuthUserUpdate) defaults() {
if _, ok := sauu.mutation.UpdateAt(); !ok && !sauu.mutation.UpdateAtCleared() { if _, ok := sauu.mutation.UpdatedAt(); !ok {
v := scaauthuser.UpdateDefaultUpdateAt() v := scaauthuser.UpdateDefaultUpdatedAt()
sauu.mutation.SetUpdateAt(v) sauu.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sauu *ScaAuthUserUpdate) check() error { func (sauu *ScaAuthUserUpdate) check() error {
if v, ok := sauu.mutation.Deleted(); ok {
if err := scaauthuser.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.deleted": %w`, err)}
}
}
if v, ok := sauu.mutation.UID(); ok { if v, ok := sauu.mutation.UID(); ok {
if err := scaauthuser.UIDValidator(v); err != nil { if err := scaauthuser.UIDValidator(v); err != nil {
return &ValidationError{Name: "uid", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.uid": %w`, err)} return &ValidationError{Name: "uid", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.uid": %w`, err)}
@@ -509,6 +514,18 @@ func (sauu *ScaAuthUserUpdate) sqlSave(ctx context.Context) (n int, err error) {
} }
} }
} }
if value, ok := sauu.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthuser.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := sauu.mutation.Deleted(); ok {
_spec.SetField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sauu.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if sauu.mutation.DeletedCleared() {
_spec.ClearField(scaauthuser.FieldDeleted, field.TypeInt8)
}
if value, ok := sauu.mutation.UID(); ok { if value, ok := sauu.mutation.UID(); ok {
_spec.SetField(scaauthuser.FieldUID, field.TypeString, value) _spec.SetField(scaauthuser.FieldUID, field.TypeString, value)
} }
@@ -569,18 +586,6 @@ func (sauu *ScaAuthUserUpdate) sqlSave(ctx context.Context) (n int, err error) {
if sauu.mutation.IntroduceCleared() { if sauu.mutation.IntroduceCleared() {
_spec.ClearField(scaauthuser.FieldIntroduce, field.TypeString) _spec.ClearField(scaauthuser.FieldIntroduce, field.TypeString)
} }
if value, ok := sauu.mutation.UpdateAt(); ok {
_spec.SetField(scaauthuser.FieldUpdateAt, field.TypeTime, value)
}
if sauu.mutation.UpdateAtCleared() {
_spec.ClearField(scaauthuser.FieldUpdateAt, field.TypeTime)
}
if value, ok := sauu.mutation.Deleted(); ok {
_spec.SetField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sauu.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sauu.mutation.Blog(); ok { if value, ok := sauu.mutation.Blog(); ok {
_spec.SetField(scaauthuser.FieldBlog, field.TypeString, value) _spec.SetField(scaauthuser.FieldBlog, field.TypeString, value)
} }
@@ -709,6 +714,39 @@ type ScaAuthUserUpdateOne struct {
mutation *ScaAuthUserMutation mutation *ScaAuthUserMutation
} }
// SetUpdatedAt sets the "updated_at" field.
func (sauuo *ScaAuthUserUpdateOne) SetUpdatedAt(t time.Time) *ScaAuthUserUpdateOne {
sauuo.mutation.SetUpdatedAt(t)
return sauuo
}
// SetDeleted sets the "deleted" field.
func (sauuo *ScaAuthUserUpdateOne) SetDeleted(i int8) *ScaAuthUserUpdateOne {
sauuo.mutation.ResetDeleted()
sauuo.mutation.SetDeleted(i)
return sauuo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauuo *ScaAuthUserUpdateOne) SetNillableDeleted(i *int8) *ScaAuthUserUpdateOne {
if i != nil {
sauuo.SetDeleted(*i)
}
return sauuo
}
// AddDeleted adds i to the "deleted" field.
func (sauuo *ScaAuthUserUpdateOne) AddDeleted(i int8) *ScaAuthUserUpdateOne {
sauuo.mutation.AddDeleted(i)
return sauuo
}
// ClearDeleted clears the value of the "deleted" field.
func (sauuo *ScaAuthUserUpdateOne) ClearDeleted() *ScaAuthUserUpdateOne {
sauuo.mutation.ClearDeleted()
return sauuo
}
// SetUID sets the "uid" field. // SetUID sets the "uid" field.
func (sauuo *ScaAuthUserUpdateOne) SetUID(s string) *ScaAuthUserUpdateOne { func (sauuo *ScaAuthUserUpdateOne) SetUID(s string) *ScaAuthUserUpdateOne {
sauuo.mutation.SetUID(s) sauuo.mutation.SetUID(s)
@@ -910,39 +948,6 @@ func (sauuo *ScaAuthUserUpdateOne) ClearIntroduce() *ScaAuthUserUpdateOne {
return sauuo return sauuo
} }
// SetUpdateAt sets the "update_at" field.
func (sauuo *ScaAuthUserUpdateOne) SetUpdateAt(t time.Time) *ScaAuthUserUpdateOne {
sauuo.mutation.SetUpdateAt(t)
return sauuo
}
// ClearUpdateAt clears the value of the "update_at" field.
func (sauuo *ScaAuthUserUpdateOne) ClearUpdateAt() *ScaAuthUserUpdateOne {
sauuo.mutation.ClearUpdateAt()
return sauuo
}
// SetDeleted sets the "deleted" field.
func (sauuo *ScaAuthUserUpdateOne) SetDeleted(i int8) *ScaAuthUserUpdateOne {
sauuo.mutation.ResetDeleted()
sauuo.mutation.SetDeleted(i)
return sauuo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauuo *ScaAuthUserUpdateOne) SetNillableDeleted(i *int8) *ScaAuthUserUpdateOne {
if i != nil {
sauuo.SetDeleted(*i)
}
return sauuo
}
// AddDeleted adds i to the "deleted" field.
func (sauuo *ScaAuthUserUpdateOne) AddDeleted(i int8) *ScaAuthUserUpdateOne {
sauuo.mutation.AddDeleted(i)
return sauuo
}
// SetBlog sets the "blog" field. // SetBlog sets the "blog" field.
func (sauuo *ScaAuthUserUpdateOne) SetBlog(s string) *ScaAuthUserUpdateOne { func (sauuo *ScaAuthUserUpdateOne) SetBlog(s string) *ScaAuthUserUpdateOne {
sauuo.mutation.SetBlog(s) sauuo.mutation.SetBlog(s)
@@ -1123,14 +1128,19 @@ func (sauuo *ScaAuthUserUpdateOne) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (sauuo *ScaAuthUserUpdateOne) defaults() { func (sauuo *ScaAuthUserUpdateOne) defaults() {
if _, ok := sauuo.mutation.UpdateAt(); !ok && !sauuo.mutation.UpdateAtCleared() { if _, ok := sauuo.mutation.UpdatedAt(); !ok {
v := scaauthuser.UpdateDefaultUpdateAt() v := scaauthuser.UpdateDefaultUpdatedAt()
sauuo.mutation.SetUpdateAt(v) sauuo.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sauuo *ScaAuthUserUpdateOne) check() error { func (sauuo *ScaAuthUserUpdateOne) check() error {
if v, ok := sauuo.mutation.Deleted(); ok {
if err := scaauthuser.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.deleted": %w`, err)}
}
}
if v, ok := sauuo.mutation.UID(); ok { if v, ok := sauuo.mutation.UID(); ok {
if err := scaauthuser.UIDValidator(v); err != nil { if err := scaauthuser.UIDValidator(v); err != nil {
return &ValidationError{Name: "uid", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.uid": %w`, err)} return &ValidationError{Name: "uid", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUser.uid": %w`, err)}
@@ -1218,6 +1228,18 @@ func (sauuo *ScaAuthUserUpdateOne) sqlSave(ctx context.Context) (_node *ScaAuthU
} }
} }
} }
if value, ok := sauuo.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthuser.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := sauuo.mutation.Deleted(); ok {
_spec.SetField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sauuo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if sauuo.mutation.DeletedCleared() {
_spec.ClearField(scaauthuser.FieldDeleted, field.TypeInt8)
}
if value, ok := sauuo.mutation.UID(); ok { if value, ok := sauuo.mutation.UID(); ok {
_spec.SetField(scaauthuser.FieldUID, field.TypeString, value) _spec.SetField(scaauthuser.FieldUID, field.TypeString, value)
} }
@@ -1278,18 +1300,6 @@ func (sauuo *ScaAuthUserUpdateOne) sqlSave(ctx context.Context) (_node *ScaAuthU
if sauuo.mutation.IntroduceCleared() { if sauuo.mutation.IntroduceCleared() {
_spec.ClearField(scaauthuser.FieldIntroduce, field.TypeString) _spec.ClearField(scaauthuser.FieldIntroduce, field.TypeString)
} }
if value, ok := sauuo.mutation.UpdateAt(); ok {
_spec.SetField(scaauthuser.FieldUpdateAt, field.TypeTime, value)
}
if sauuo.mutation.UpdateAtCleared() {
_spec.ClearField(scaauthuser.FieldUpdateAt, field.TypeTime)
}
if value, ok := sauuo.mutation.Deleted(); ok {
_spec.SetField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sauuo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuser.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sauuo.mutation.Blog(); ok { if value, ok := sauuo.mutation.Blog(); ok {
_spec.SetField(scaauthuser.FieldBlog, field.TypeString, value) _spec.SetField(scaauthuser.FieldBlog, field.TypeString, value)
} }

View File

@@ -13,12 +13,18 @@ import (
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql"
) )
// ScaAuthUserDevice is the model entity for the ScaAuthUserDevice schema. // 用户设备表
type ScaAuthUserDevice struct { type ScaAuthUserDevice struct {
config `json:"-"` config `json:"-"`
// ID of the ent. // ID of the ent.
// 主键ID // 主键ID
ID int64 `json:"id,omitempty"` 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 // 用户ID
UserID string `json:"user_id,omitempty"` UserID string `json:"user_id,omitempty"`
// 登录IP // 登录IP
@@ -27,12 +33,6 @@ type ScaAuthUserDevice struct {
Location string `json:"location,omitempty"` Location string `json:"location,omitempty"`
// 设备信息 // 设备信息
Agent string `json:"agent,omitempty"` Agent string `json:"agent,omitempty"`
// 创建时间
CreatedAt time.Time `json:"created_at,omitempty"`
// 更新时间
UpdateAt *time.Time `json:"update_at,omitempty"`
// 是否删除
Deleted int `json:"deleted,omitempty"`
// 浏览器 // 浏览器
Browser string `json:"browser,omitempty"` Browser string `json:"browser,omitempty"`
// 操作系统 // 操作系统
@@ -87,7 +87,7 @@ func (*ScaAuthUserDevice) scanValues(columns []string) ([]any, error) {
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
case scaauthuserdevice.FieldUserID, scaauthuserdevice.FieldIP, scaauthuserdevice.FieldLocation, scaauthuserdevice.FieldAgent, scaauthuserdevice.FieldBrowser, scaauthuserdevice.FieldOperatingSystem, scaauthuserdevice.FieldBrowserVersion, scaauthuserdevice.FieldMozilla, scaauthuserdevice.FieldPlatform, scaauthuserdevice.FieldEngineName, scaauthuserdevice.FieldEngineVersion: case scaauthuserdevice.FieldUserID, scaauthuserdevice.FieldIP, scaauthuserdevice.FieldLocation, scaauthuserdevice.FieldAgent, scaauthuserdevice.FieldBrowser, scaauthuserdevice.FieldOperatingSystem, scaauthuserdevice.FieldBrowserVersion, scaauthuserdevice.FieldMozilla, scaauthuserdevice.FieldPlatform, scaauthuserdevice.FieldEngineName, scaauthuserdevice.FieldEngineVersion:
values[i] = new(sql.NullString) values[i] = new(sql.NullString)
case scaauthuserdevice.FieldCreatedAt, scaauthuserdevice.FieldUpdateAt: case scaauthuserdevice.FieldCreatedAt, scaauthuserdevice.FieldUpdatedAt:
values[i] = new(sql.NullTime) values[i] = new(sql.NullTime)
case scaauthuserdevice.ForeignKeys[0]: // sca_auth_user_sca_auth_user_device case scaauthuserdevice.ForeignKeys[0]: // sca_auth_user_sca_auth_user_device
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
@@ -112,6 +112,24 @@ func (saud *ScaAuthUserDevice) assignValues(columns []string, values []any) erro
return fmt.Errorf("unexpected type %T for field id", value) return fmt.Errorf("unexpected type %T for field id", value)
} }
saud.ID = int64(value.Int64) saud.ID = int64(value.Int64)
case scaauthuserdevice.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 {
saud.CreatedAt = value.Time
}
case scaauthuserdevice.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 {
saud.UpdatedAt = value.Time
}
case scaauthuserdevice.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
saud.Deleted = int8(value.Int64)
}
case scaauthuserdevice.FieldUserID: case scaauthuserdevice.FieldUserID:
if value, ok := values[i].(*sql.NullString); !ok { if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field user_id", values[i]) return fmt.Errorf("unexpected type %T for field user_id", values[i])
@@ -136,25 +154,6 @@ func (saud *ScaAuthUserDevice) assignValues(columns []string, values []any) erro
} else if value.Valid { } else if value.Valid {
saud.Agent = value.String saud.Agent = value.String
} }
case scaauthuserdevice.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 {
saud.CreatedAt = value.Time
}
case scaauthuserdevice.FieldUpdateAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field update_at", values[i])
} else if value.Valid {
saud.UpdateAt = new(time.Time)
*saud.UpdateAt = value.Time
}
case scaauthuserdevice.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
saud.Deleted = int(value.Int64)
}
case scaauthuserdevice.FieldBrowser: case scaauthuserdevice.FieldBrowser:
if value, ok := values[i].(*sql.NullString); !ok { if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field browser", values[i]) return fmt.Errorf("unexpected type %T for field browser", values[i])
@@ -257,6 +256,15 @@ func (saud *ScaAuthUserDevice) String() string {
var builder strings.Builder var builder strings.Builder
builder.WriteString("ScaAuthUserDevice(") builder.WriteString("ScaAuthUserDevice(")
builder.WriteString(fmt.Sprintf("id=%v, ", saud.ID)) builder.WriteString(fmt.Sprintf("id=%v, ", saud.ID))
builder.WriteString("created_at=")
builder.WriteString(saud.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(saud.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", saud.Deleted))
builder.WriteString(", ")
builder.WriteString("user_id=") builder.WriteString("user_id=")
builder.WriteString(saud.UserID) builder.WriteString(saud.UserID)
builder.WriteString(", ") builder.WriteString(", ")
@@ -269,17 +277,6 @@ func (saud *ScaAuthUserDevice) String() string {
builder.WriteString("agent=") builder.WriteString("agent=")
builder.WriteString(saud.Agent) builder.WriteString(saud.Agent)
builder.WriteString(", ") builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(saud.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
if v := saud.UpdateAt; v != nil {
builder.WriteString("update_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", saud.Deleted))
builder.WriteString(", ")
builder.WriteString("browser=") builder.WriteString("browser=")
builder.WriteString(saud.Browser) builder.WriteString(saud.Browser)
builder.WriteString(", ") builder.WriteString(", ")

View File

@@ -14,6 +14,12 @@ const (
Label = "sca_auth_user_device" Label = "sca_auth_user_device"
// FieldID holds the string denoting the id field in the database. // FieldID holds the string denoting the id field in the database.
FieldID = "id" 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 holds the string denoting the user_id field in the database.
FieldUserID = "user_id" FieldUserID = "user_id"
// FieldIP holds the string denoting the ip field in the database. // FieldIP holds the string denoting the ip field in the database.
@@ -22,12 +28,6 @@ const (
FieldLocation = "location" FieldLocation = "location"
// FieldAgent holds the string denoting the agent field in the database. // FieldAgent holds the string denoting the agent field in the database.
FieldAgent = "agent" FieldAgent = "agent"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdateAt holds the string denoting the update_at field in the database.
FieldUpdateAt = "update_at"
// FieldDeleted holds the string denoting the deleted field in the database.
FieldDeleted = "deleted"
// FieldBrowser holds the string denoting the browser field in the database. // FieldBrowser holds the string denoting the browser field in the database.
FieldBrowser = "browser" FieldBrowser = "browser"
// FieldOperatingSystem holds the string denoting the operating_system field in the database. // FieldOperatingSystem holds the string denoting the operating_system field in the database.
@@ -49,12 +49,12 @@ const (
// EdgeScaAuthUser holds the string denoting the sca_auth_user edge name in mutations. // EdgeScaAuthUser holds the string denoting the sca_auth_user edge name in mutations.
EdgeScaAuthUser = "sca_auth_user" EdgeScaAuthUser = "sca_auth_user"
// Table holds the table name of the scaauthuserdevice in the database. // Table holds the table name of the scaauthuserdevice in the database.
Table = "sca_auth_user_devices" Table = "sca_auth_user_device"
// ScaAuthUserTable is the table that holds the sca_auth_user relation/edge. // ScaAuthUserTable is the table that holds the sca_auth_user relation/edge.
ScaAuthUserTable = "sca_auth_user_devices" ScaAuthUserTable = "sca_auth_user_device"
// ScaAuthUserInverseTable is the table name for the ScaAuthUser entity. // ScaAuthUserInverseTable is the table name for the ScaAuthUser entity.
// It exists in this package in order to avoid circular dependency with the "scaauthuser" package. // It exists in this package in order to avoid circular dependency with the "scaauthuser" package.
ScaAuthUserInverseTable = "sca_auth_users" ScaAuthUserInverseTable = "sca_auth_user"
// ScaAuthUserColumn is the table column denoting the sca_auth_user relation/edge. // ScaAuthUserColumn is the table column denoting the sca_auth_user relation/edge.
ScaAuthUserColumn = "sca_auth_user_sca_auth_user_device" ScaAuthUserColumn = "sca_auth_user_sca_auth_user_device"
) )
@@ -62,13 +62,13 @@ const (
// Columns holds all SQL columns for scaauthuserdevice fields. // Columns holds all SQL columns for scaauthuserdevice fields.
var Columns = []string{ var Columns = []string{
FieldID, FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeleted,
FieldUserID, FieldUserID,
FieldIP, FieldIP,
FieldLocation, FieldLocation,
FieldAgent, FieldAgent,
FieldCreatedAt,
FieldUpdateAt,
FieldDeleted,
FieldBrowser, FieldBrowser,
FieldOperatingSystem, FieldOperatingSystem,
FieldBrowserVersion, FieldBrowserVersion,
@@ -80,7 +80,7 @@ var Columns = []string{
FieldEngineVersion, FieldEngineVersion,
} }
// ForeignKeys holds the SQL foreign-keys that are owned by the "sca_auth_user_devices" // ForeignKeys holds the SQL foreign-keys that are owned by the "sca_auth_user_device"
// table and are not defined as standalone fields in the schema. // table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{ var ForeignKeys = []string{
"sca_auth_user_sca_auth_user_device", "sca_auth_user_sca_auth_user_device",
@@ -102,6 +102,16 @@ func ValidColumn(column string) bool {
} }
var ( var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// 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
// UserIDValidator is a validator for the "user_id" field. It is called by the builders before save. // UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
UserIDValidator func(string) error UserIDValidator func(string) error
// IPValidator is a validator for the "ip" field. It is called by the builders before save. // IPValidator is a validator for the "ip" field. It is called by the builders before save.
@@ -110,14 +120,6 @@ var (
LocationValidator func(string) error LocationValidator func(string) error
// AgentValidator is a validator for the "agent" field. It is called by the builders before save. // AgentValidator is a validator for the "agent" field. It is called by the builders before save.
AgentValidator func(string) error AgentValidator func(string) error
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdateAt holds the default value on creation for the "update_at" field.
DefaultUpdateAt func() time.Time
// UpdateDefaultUpdateAt holds the default value on update for the "update_at" field.
UpdateDefaultUpdateAt func() time.Time
// DefaultDeleted holds the default value on creation for the "deleted" field.
DefaultDeleted int
// BrowserValidator is a validator for the "browser" field. It is called by the builders before save. // BrowserValidator is a validator for the "browser" field. It is called by the builders before save.
BrowserValidator func(string) error BrowserValidator func(string) error
// OperatingSystemValidator is a validator for the "operating_system" field. It is called by the builders before save. // OperatingSystemValidator is a validator for the "operating_system" field. It is called by the builders before save.
@@ -142,6 +144,21 @@ func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc() 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. // ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption { func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc() return sql.OrderByField(FieldUserID, opts...).ToFunc()
@@ -162,21 +179,6 @@ func ByAgent(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldAgent, opts...).ToFunc() return sql.OrderByField(FieldAgent, opts...).ToFunc()
} }
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdateAt orders the results by the update_at field.
func ByUpdateAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateAt, opts...).ToFunc()
}
// ByDeleted orders the results by the deleted field.
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
}
// ByBrowser orders the results by the browser field. // ByBrowser orders the results by the browser field.
func ByBrowser(opts ...sql.OrderTermOption) OrderOption { func ByBrowser(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBrowser, opts...).ToFunc() return sql.OrderByField(FieldBrowser, opts...).ToFunc()

View File

@@ -55,6 +55,21 @@ func IDLTE(id int64) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLTE(FieldID, id)) return predicate.ScaAuthUserDevice(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.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(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.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUpdatedAt, v))
}
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
func Deleted(v int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldDeleted, v))
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ. // UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func UserID(v string) predicate.ScaAuthUserDevice { func UserID(v string) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUserID, v)) return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUserID, v))
@@ -75,21 +90,6 @@ func Agent(v string) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldAgent, v)) return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldAgent, v))
} }
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdateAt applies equality check predicate on the "update_at" field. It's identical to UpdateAtEQ.
func UpdateAt(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUpdateAt, v))
}
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
func Deleted(v int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldDeleted, v))
}
// Browser applies equality check predicate on the "browser" field. It's identical to BrowserEQ. // Browser applies equality check predicate on the "browser" field. It's identical to BrowserEQ.
func Browser(v string) predicate.ScaAuthUserDevice { func Browser(v string) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldBrowser, v)) return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldBrowser, v))
@@ -135,6 +135,136 @@ func EngineVersion(v string) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldEngineVersion, v)) return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldEngineVersion, v))
} }
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLTE(FieldUpdatedAt, v))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldDeleted, v))
}
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int8) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLTE(FieldDeleted, v))
}
// DeletedIsNil applies the IsNil predicate on the "deleted" field.
func DeletedIsNil() predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIsNull(FieldDeleted))
}
// DeletedNotNil applies the NotNil predicate on the "deleted" field.
func DeletedNotNil() predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotNull(FieldDeleted))
}
// UserIDEQ applies the EQ predicate on the "user_id" field. // UserIDEQ applies the EQ predicate on the "user_id" field.
func UserIDEQ(v string) predicate.ScaAuthUserDevice { func UserIDEQ(v string) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUserID, v)) return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUserID, v))
@@ -395,136 +525,6 @@ func AgentContainsFold(v string) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldContainsFold(FieldAgent, v)) return predicate.ScaAuthUserDevice(sql.FieldContainsFold(FieldAgent, v))
} }
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLTE(FieldCreatedAt, v))
}
// CreatedAtIsNil applies the IsNil predicate on the "created_at" field.
func CreatedAtIsNil() predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIsNull(FieldCreatedAt))
}
// CreatedAtNotNil applies the NotNil predicate on the "created_at" field.
func CreatedAtNotNil() predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotNull(FieldCreatedAt))
}
// UpdateAtEQ applies the EQ predicate on the "update_at" field.
func UpdateAtEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldUpdateAt, v))
}
// UpdateAtNEQ applies the NEQ predicate on the "update_at" field.
func UpdateAtNEQ(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNEQ(FieldUpdateAt, v))
}
// UpdateAtIn applies the In predicate on the "update_at" field.
func UpdateAtIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIn(FieldUpdateAt, vs...))
}
// UpdateAtNotIn applies the NotIn predicate on the "update_at" field.
func UpdateAtNotIn(vs ...time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotIn(FieldUpdateAt, vs...))
}
// UpdateAtGT applies the GT predicate on the "update_at" field.
func UpdateAtGT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGT(FieldUpdateAt, v))
}
// UpdateAtGTE applies the GTE predicate on the "update_at" field.
func UpdateAtGTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGTE(FieldUpdateAt, v))
}
// UpdateAtLT applies the LT predicate on the "update_at" field.
func UpdateAtLT(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLT(FieldUpdateAt, v))
}
// UpdateAtLTE applies the LTE predicate on the "update_at" field.
func UpdateAtLTE(v time.Time) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLTE(FieldUpdateAt, v))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldDeleted, v))
}
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldLTE(FieldDeleted, v))
}
// BrowserEQ applies the EQ predicate on the "browser" field. // BrowserEQ applies the EQ predicate on the "browser" field.
func BrowserEQ(v string) predicate.ScaAuthUserDevice { func BrowserEQ(v string) predicate.ScaAuthUserDevice {
return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldBrowser, v)) return predicate.ScaAuthUserDevice(sql.FieldEQ(FieldBrowser, v))

View File

@@ -21,6 +21,48 @@ type ScaAuthUserDeviceCreate struct {
hooks []Hook hooks []Hook
} }
// SetCreatedAt sets the "created_at" field.
func (saudc *ScaAuthUserDeviceCreate) SetCreatedAt(t time.Time) *ScaAuthUserDeviceCreate {
saudc.mutation.SetCreatedAt(t)
return saudc
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (saudc *ScaAuthUserDeviceCreate) SetNillableCreatedAt(t *time.Time) *ScaAuthUserDeviceCreate {
if t != nil {
saudc.SetCreatedAt(*t)
}
return saudc
}
// SetUpdatedAt sets the "updated_at" field.
func (saudc *ScaAuthUserDeviceCreate) SetUpdatedAt(t time.Time) *ScaAuthUserDeviceCreate {
saudc.mutation.SetUpdatedAt(t)
return saudc
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (saudc *ScaAuthUserDeviceCreate) SetNillableUpdatedAt(t *time.Time) *ScaAuthUserDeviceCreate {
if t != nil {
saudc.SetUpdatedAt(*t)
}
return saudc
}
// SetDeleted sets the "deleted" field.
func (saudc *ScaAuthUserDeviceCreate) SetDeleted(i int8) *ScaAuthUserDeviceCreate {
saudc.mutation.SetDeleted(i)
return saudc
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saudc *ScaAuthUserDeviceCreate) SetNillableDeleted(i *int8) *ScaAuthUserDeviceCreate {
if i != nil {
saudc.SetDeleted(*i)
}
return saudc
}
// SetUserID sets the "user_id" field. // SetUserID sets the "user_id" field.
func (saudc *ScaAuthUserDeviceCreate) SetUserID(s string) *ScaAuthUserDeviceCreate { func (saudc *ScaAuthUserDeviceCreate) SetUserID(s string) *ScaAuthUserDeviceCreate {
saudc.mutation.SetUserID(s) saudc.mutation.SetUserID(s)
@@ -45,48 +87,6 @@ func (saudc *ScaAuthUserDeviceCreate) SetAgent(s string) *ScaAuthUserDeviceCreat
return saudc return saudc
} }
// SetCreatedAt sets the "created_at" field.
func (saudc *ScaAuthUserDeviceCreate) SetCreatedAt(t time.Time) *ScaAuthUserDeviceCreate {
saudc.mutation.SetCreatedAt(t)
return saudc
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (saudc *ScaAuthUserDeviceCreate) SetNillableCreatedAt(t *time.Time) *ScaAuthUserDeviceCreate {
if t != nil {
saudc.SetCreatedAt(*t)
}
return saudc
}
// SetUpdateAt sets the "update_at" field.
func (saudc *ScaAuthUserDeviceCreate) SetUpdateAt(t time.Time) *ScaAuthUserDeviceCreate {
saudc.mutation.SetUpdateAt(t)
return saudc
}
// SetNillableUpdateAt sets the "update_at" field if the given value is not nil.
func (saudc *ScaAuthUserDeviceCreate) SetNillableUpdateAt(t *time.Time) *ScaAuthUserDeviceCreate {
if t != nil {
saudc.SetUpdateAt(*t)
}
return saudc
}
// SetDeleted sets the "deleted" field.
func (saudc *ScaAuthUserDeviceCreate) SetDeleted(i int) *ScaAuthUserDeviceCreate {
saudc.mutation.SetDeleted(i)
return saudc
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saudc *ScaAuthUserDeviceCreate) SetNillableDeleted(i *int) *ScaAuthUserDeviceCreate {
if i != nil {
saudc.SetDeleted(*i)
}
return saudc
}
// SetBrowser sets the "browser" field. // SetBrowser sets the "browser" field.
func (saudc *ScaAuthUserDeviceCreate) SetBrowser(s string) *ScaAuthUserDeviceCreate { func (saudc *ScaAuthUserDeviceCreate) SetBrowser(s string) *ScaAuthUserDeviceCreate {
saudc.mutation.SetBrowser(s) saudc.mutation.SetBrowser(s)
@@ -205,9 +205,9 @@ func (saudc *ScaAuthUserDeviceCreate) defaults() {
v := scaauthuserdevice.DefaultCreatedAt() v := scaauthuserdevice.DefaultCreatedAt()
saudc.mutation.SetCreatedAt(v) saudc.mutation.SetCreatedAt(v)
} }
if _, ok := saudc.mutation.UpdateAt(); !ok { if _, ok := saudc.mutation.UpdatedAt(); !ok {
v := scaauthuserdevice.DefaultUpdateAt() v := scaauthuserdevice.DefaultUpdatedAt()
saudc.mutation.SetUpdateAt(v) saudc.mutation.SetUpdatedAt(v)
} }
if _, ok := saudc.mutation.Deleted(); !ok { if _, ok := saudc.mutation.Deleted(); !ok {
v := scaauthuserdevice.DefaultDeleted v := scaauthuserdevice.DefaultDeleted
@@ -217,6 +217,17 @@ func (saudc *ScaAuthUserDeviceCreate) defaults() {
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (saudc *ScaAuthUserDeviceCreate) check() error { func (saudc *ScaAuthUserDeviceCreate) check() error {
if _, ok := saudc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaAuthUserDevice.created_at"`)}
}
if _, ok := saudc.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ScaAuthUserDevice.updated_at"`)}
}
if v, ok := saudc.mutation.Deleted(); ok {
if err := scaauthuserdevice.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.deleted": %w`, err)}
}
}
if _, ok := saudc.mutation.UserID(); !ok { if _, ok := saudc.mutation.UserID(); !ok {
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "ScaAuthUserDevice.user_id"`)} return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "ScaAuthUserDevice.user_id"`)}
} }
@@ -249,12 +260,6 @@ func (saudc *ScaAuthUserDeviceCreate) check() error {
return &ValidationError{Name: "agent", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.agent": %w`, err)} return &ValidationError{Name: "agent", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.agent": %w`, err)}
} }
} }
if _, ok := saudc.mutation.UpdateAt(); !ok {
return &ValidationError{Name: "update_at", err: errors.New(`ent: missing required field "ScaAuthUserDevice.update_at"`)}
}
if _, ok := saudc.mutation.Deleted(); !ok {
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "ScaAuthUserDevice.deleted"`)}
}
if _, ok := saudc.mutation.Browser(); !ok { if _, ok := saudc.mutation.Browser(); !ok {
return &ValidationError{Name: "browser", err: errors.New(`ent: missing required field "ScaAuthUserDevice.browser"`)} return &ValidationError{Name: "browser", err: errors.New(`ent: missing required field "ScaAuthUserDevice.browser"`)}
} }
@@ -349,6 +354,18 @@ func (saudc *ScaAuthUserDeviceCreate) createSpec() (*ScaAuthUserDevice, *sqlgrap
_node.ID = id _node.ID = id
_spec.ID.Value = id _spec.ID.Value = id
} }
if value, ok := saudc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthuserdevice.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := saudc.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthuserdevice.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := saudc.mutation.Deleted(); ok {
_spec.SetField(scaauthuserdevice.FieldDeleted, field.TypeInt8, value)
_node.Deleted = value
}
if value, ok := saudc.mutation.UserID(); ok { if value, ok := saudc.mutation.UserID(); ok {
_spec.SetField(scaauthuserdevice.FieldUserID, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldUserID, field.TypeString, value)
_node.UserID = value _node.UserID = value
@@ -365,18 +382,6 @@ func (saudc *ScaAuthUserDeviceCreate) createSpec() (*ScaAuthUserDevice, *sqlgrap
_spec.SetField(scaauthuserdevice.FieldAgent, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldAgent, field.TypeString, value)
_node.Agent = value _node.Agent = value
} }
if value, ok := saudc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthuserdevice.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := saudc.mutation.UpdateAt(); ok {
_spec.SetField(scaauthuserdevice.FieldUpdateAt, field.TypeTime, value)
_node.UpdateAt = &value
}
if value, ok := saudc.mutation.Deleted(); ok {
_spec.SetField(scaauthuserdevice.FieldDeleted, field.TypeInt, value)
_node.Deleted = value
}
if value, ok := saudc.mutation.Browser(); ok { if value, ok := saudc.mutation.Browser(); ok {
_spec.SetField(scaauthuserdevice.FieldBrowser, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldBrowser, field.TypeString, value)
_node.Browser = value _node.Browser = value

View File

@@ -299,12 +299,12 @@ func (saudq *ScaAuthUserDeviceQuery) WithScaAuthUser(opts ...func(*ScaAuthUserQu
// Example: // Example:
// //
// var v []struct { // var v []struct {
// UserID string `json:"user_id,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"` // Count int `json:"count,omitempty"`
// } // }
// //
// client.ScaAuthUserDevice.Query(). // client.ScaAuthUserDevice.Query().
// GroupBy(scaauthuserdevice.FieldUserID). // GroupBy(scaauthuserdevice.FieldCreatedAt).
// Aggregate(ent.Count()). // Aggregate(ent.Count()).
// Scan(ctx, &v) // Scan(ctx, &v)
func (saudq *ScaAuthUserDeviceQuery) GroupBy(field string, fields ...string) *ScaAuthUserDeviceGroupBy { func (saudq *ScaAuthUserDeviceQuery) GroupBy(field string, fields ...string) *ScaAuthUserDeviceGroupBy {
@@ -322,11 +322,11 @@ func (saudq *ScaAuthUserDeviceQuery) GroupBy(field string, fields ...string) *Sc
// Example: // Example:
// //
// var v []struct { // var v []struct {
// UserID string `json:"user_id,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// } // }
// //
// client.ScaAuthUserDevice.Query(). // client.ScaAuthUserDevice.Query().
// Select(scaauthuserdevice.FieldUserID). // Select(scaauthuserdevice.FieldCreatedAt).
// Scan(ctx, &v) // Scan(ctx, &v)
func (saudq *ScaAuthUserDeviceQuery) Select(fields ...string) *ScaAuthUserDeviceSelect { func (saudq *ScaAuthUserDeviceQuery) Select(fields ...string) *ScaAuthUserDeviceSelect {
saudq.ctx.Fields = append(saudq.ctx.Fields, fields...) saudq.ctx.Fields = append(saudq.ctx.Fields, fields...)

View File

@@ -29,6 +29,39 @@ func (saudu *ScaAuthUserDeviceUpdate) Where(ps ...predicate.ScaAuthUserDevice) *
return saudu return saudu
} }
// SetUpdatedAt sets the "updated_at" field.
func (saudu *ScaAuthUserDeviceUpdate) SetUpdatedAt(t time.Time) *ScaAuthUserDeviceUpdate {
saudu.mutation.SetUpdatedAt(t)
return saudu
}
// SetDeleted sets the "deleted" field.
func (saudu *ScaAuthUserDeviceUpdate) SetDeleted(i int8) *ScaAuthUserDeviceUpdate {
saudu.mutation.ResetDeleted()
saudu.mutation.SetDeleted(i)
return saudu
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saudu *ScaAuthUserDeviceUpdate) SetNillableDeleted(i *int8) *ScaAuthUserDeviceUpdate {
if i != nil {
saudu.SetDeleted(*i)
}
return saudu
}
// AddDeleted adds i to the "deleted" field.
func (saudu *ScaAuthUserDeviceUpdate) AddDeleted(i int8) *ScaAuthUserDeviceUpdate {
saudu.mutation.AddDeleted(i)
return saudu
}
// ClearDeleted clears the value of the "deleted" field.
func (saudu *ScaAuthUserDeviceUpdate) ClearDeleted() *ScaAuthUserDeviceUpdate {
saudu.mutation.ClearDeleted()
return saudu
}
// SetUserID sets the "user_id" field. // SetUserID sets the "user_id" field.
func (saudu *ScaAuthUserDeviceUpdate) SetUserID(s string) *ScaAuthUserDeviceUpdate { func (saudu *ScaAuthUserDeviceUpdate) SetUserID(s string) *ScaAuthUserDeviceUpdate {
saudu.mutation.SetUserID(s) saudu.mutation.SetUserID(s)
@@ -85,33 +118,6 @@ func (saudu *ScaAuthUserDeviceUpdate) SetNillableAgent(s *string) *ScaAuthUserDe
return saudu return saudu
} }
// SetUpdateAt sets the "update_at" field.
func (saudu *ScaAuthUserDeviceUpdate) SetUpdateAt(t time.Time) *ScaAuthUserDeviceUpdate {
saudu.mutation.SetUpdateAt(t)
return saudu
}
// SetDeleted sets the "deleted" field.
func (saudu *ScaAuthUserDeviceUpdate) SetDeleted(i int) *ScaAuthUserDeviceUpdate {
saudu.mutation.ResetDeleted()
saudu.mutation.SetDeleted(i)
return saudu
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (saudu *ScaAuthUserDeviceUpdate) SetNillableDeleted(i *int) *ScaAuthUserDeviceUpdate {
if i != nil {
saudu.SetDeleted(*i)
}
return saudu
}
// AddDeleted adds i to the "deleted" field.
func (saudu *ScaAuthUserDeviceUpdate) AddDeleted(i int) *ScaAuthUserDeviceUpdate {
saudu.mutation.AddDeleted(i)
return saudu
}
// SetBrowser sets the "browser" field. // SetBrowser sets the "browser" field.
func (saudu *ScaAuthUserDeviceUpdate) SetBrowser(s string) *ScaAuthUserDeviceUpdate { func (saudu *ScaAuthUserDeviceUpdate) SetBrowser(s string) *ScaAuthUserDeviceUpdate {
saudu.mutation.SetBrowser(s) saudu.mutation.SetBrowser(s)
@@ -312,14 +318,19 @@ func (saudu *ScaAuthUserDeviceUpdate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (saudu *ScaAuthUserDeviceUpdate) defaults() { func (saudu *ScaAuthUserDeviceUpdate) defaults() {
if _, ok := saudu.mutation.UpdateAt(); !ok { if _, ok := saudu.mutation.UpdatedAt(); !ok {
v := scaauthuserdevice.UpdateDefaultUpdateAt() v := scaauthuserdevice.UpdateDefaultUpdatedAt()
saudu.mutation.SetUpdateAt(v) saudu.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (saudu *ScaAuthUserDeviceUpdate) check() error { func (saudu *ScaAuthUserDeviceUpdate) check() error {
if v, ok := saudu.mutation.Deleted(); ok {
if err := scaauthuserdevice.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.deleted": %w`, err)}
}
}
if v, ok := saudu.mutation.UserID(); ok { if v, ok := saudu.mutation.UserID(); ok {
if err := scaauthuserdevice.UserIDValidator(v); err != nil { if err := scaauthuserdevice.UserIDValidator(v); err != nil {
return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.user_id": %w`, err)} return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.user_id": %w`, err)}
@@ -390,6 +401,18 @@ func (saudu *ScaAuthUserDeviceUpdate) sqlSave(ctx context.Context) (n int, err e
} }
} }
} }
if value, ok := saudu.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthuserdevice.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := saudu.mutation.Deleted(); ok {
_spec.SetField(scaauthuserdevice.FieldDeleted, field.TypeInt8, value)
}
if value, ok := saudu.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuserdevice.FieldDeleted, field.TypeInt8, value)
}
if saudu.mutation.DeletedCleared() {
_spec.ClearField(scaauthuserdevice.FieldDeleted, field.TypeInt8)
}
if value, ok := saudu.mutation.UserID(); ok { if value, ok := saudu.mutation.UserID(); ok {
_spec.SetField(scaauthuserdevice.FieldUserID, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldUserID, field.TypeString, value)
} }
@@ -402,18 +425,6 @@ func (saudu *ScaAuthUserDeviceUpdate) sqlSave(ctx context.Context) (n int, err e
if value, ok := saudu.mutation.Agent(); ok { if value, ok := saudu.mutation.Agent(); ok {
_spec.SetField(scaauthuserdevice.FieldAgent, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldAgent, field.TypeString, value)
} }
if saudu.mutation.CreatedAtCleared() {
_spec.ClearField(scaauthuserdevice.FieldCreatedAt, field.TypeTime)
}
if value, ok := saudu.mutation.UpdateAt(); ok {
_spec.SetField(scaauthuserdevice.FieldUpdateAt, field.TypeTime, value)
}
if value, ok := saudu.mutation.Deleted(); ok {
_spec.SetField(scaauthuserdevice.FieldDeleted, field.TypeInt, value)
}
if value, ok := saudu.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuserdevice.FieldDeleted, field.TypeInt, value)
}
if value, ok := saudu.mutation.Browser(); ok { if value, ok := saudu.mutation.Browser(); ok {
_spec.SetField(scaauthuserdevice.FieldBrowser, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldBrowser, field.TypeString, value)
} }
@@ -496,6 +507,39 @@ type ScaAuthUserDeviceUpdateOne struct {
mutation *ScaAuthUserDeviceMutation mutation *ScaAuthUserDeviceMutation
} }
// SetUpdatedAt sets the "updated_at" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetUpdatedAt(t time.Time) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.SetUpdatedAt(t)
return sauduo
}
// SetDeleted sets the "deleted" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetDeleted(i int8) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.ResetDeleted()
sauduo.mutation.SetDeleted(i)
return sauduo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetNillableDeleted(i *int8) *ScaAuthUserDeviceUpdateOne {
if i != nil {
sauduo.SetDeleted(*i)
}
return sauduo
}
// AddDeleted adds i to the "deleted" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) AddDeleted(i int8) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.AddDeleted(i)
return sauduo
}
// ClearDeleted clears the value of the "deleted" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) ClearDeleted() *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.ClearDeleted()
return sauduo
}
// SetUserID sets the "user_id" field. // SetUserID sets the "user_id" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetUserID(s string) *ScaAuthUserDeviceUpdateOne { func (sauduo *ScaAuthUserDeviceUpdateOne) SetUserID(s string) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.SetUserID(s) sauduo.mutation.SetUserID(s)
@@ -552,33 +596,6 @@ func (sauduo *ScaAuthUserDeviceUpdateOne) SetNillableAgent(s *string) *ScaAuthUs
return sauduo return sauduo
} }
// SetUpdateAt sets the "update_at" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetUpdateAt(t time.Time) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.SetUpdateAt(t)
return sauduo
}
// SetDeleted sets the "deleted" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetDeleted(i int) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.ResetDeleted()
sauduo.mutation.SetDeleted(i)
return sauduo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetNillableDeleted(i *int) *ScaAuthUserDeviceUpdateOne {
if i != nil {
sauduo.SetDeleted(*i)
}
return sauduo
}
// AddDeleted adds i to the "deleted" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) AddDeleted(i int) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.AddDeleted(i)
return sauduo
}
// SetBrowser sets the "browser" field. // SetBrowser sets the "browser" field.
func (sauduo *ScaAuthUserDeviceUpdateOne) SetBrowser(s string) *ScaAuthUserDeviceUpdateOne { func (sauduo *ScaAuthUserDeviceUpdateOne) SetBrowser(s string) *ScaAuthUserDeviceUpdateOne {
sauduo.mutation.SetBrowser(s) sauduo.mutation.SetBrowser(s)
@@ -792,14 +809,19 @@ func (sauduo *ScaAuthUserDeviceUpdateOne) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (sauduo *ScaAuthUserDeviceUpdateOne) defaults() { func (sauduo *ScaAuthUserDeviceUpdateOne) defaults() {
if _, ok := sauduo.mutation.UpdateAt(); !ok { if _, ok := sauduo.mutation.UpdatedAt(); !ok {
v := scaauthuserdevice.UpdateDefaultUpdateAt() v := scaauthuserdevice.UpdateDefaultUpdatedAt()
sauduo.mutation.SetUpdateAt(v) sauduo.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sauduo *ScaAuthUserDeviceUpdateOne) check() error { func (sauduo *ScaAuthUserDeviceUpdateOne) check() error {
if v, ok := sauduo.mutation.Deleted(); ok {
if err := scaauthuserdevice.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.deleted": %w`, err)}
}
}
if v, ok := sauduo.mutation.UserID(); ok { if v, ok := sauduo.mutation.UserID(); ok {
if err := scaauthuserdevice.UserIDValidator(v); err != nil { if err := scaauthuserdevice.UserIDValidator(v); err != nil {
return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.user_id": %w`, err)} return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserDevice.user_id": %w`, err)}
@@ -887,6 +909,18 @@ func (sauduo *ScaAuthUserDeviceUpdateOne) sqlSave(ctx context.Context) (_node *S
} }
} }
} }
if value, ok := sauduo.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthuserdevice.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := sauduo.mutation.Deleted(); ok {
_spec.SetField(scaauthuserdevice.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sauduo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuserdevice.FieldDeleted, field.TypeInt8, value)
}
if sauduo.mutation.DeletedCleared() {
_spec.ClearField(scaauthuserdevice.FieldDeleted, field.TypeInt8)
}
if value, ok := sauduo.mutation.UserID(); ok { if value, ok := sauduo.mutation.UserID(); ok {
_spec.SetField(scaauthuserdevice.FieldUserID, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldUserID, field.TypeString, value)
} }
@@ -899,18 +933,6 @@ func (sauduo *ScaAuthUserDeviceUpdateOne) sqlSave(ctx context.Context) (_node *S
if value, ok := sauduo.mutation.Agent(); ok { if value, ok := sauduo.mutation.Agent(); ok {
_spec.SetField(scaauthuserdevice.FieldAgent, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldAgent, field.TypeString, value)
} }
if sauduo.mutation.CreatedAtCleared() {
_spec.ClearField(scaauthuserdevice.FieldCreatedAt, field.TypeTime)
}
if value, ok := sauduo.mutation.UpdateAt(); ok {
_spec.SetField(scaauthuserdevice.FieldUpdateAt, field.TypeTime, value)
}
if value, ok := sauduo.mutation.Deleted(); ok {
_spec.SetField(scaauthuserdevice.FieldDeleted, field.TypeInt, value)
}
if value, ok := sauduo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthuserdevice.FieldDeleted, field.TypeInt, value)
}
if value, ok := sauduo.mutation.Browser(); ok { if value, ok := sauduo.mutation.Browser(); ok {
_spec.SetField(scaauthuserdevice.FieldBrowser, field.TypeString, value) _spec.SetField(scaauthuserdevice.FieldBrowser, field.TypeString, value)
} }

View File

@@ -13,12 +13,18 @@ import (
"entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql"
) )
// ScaAuthUserSocial is the model entity for the ScaAuthUserSocial schema. // 用户第三方登录信息
type ScaAuthUserSocial struct { type ScaAuthUserSocial struct {
config `json:"-"` config `json:"-"`
// ID of the ent. // ID of the ent.
// 主键ID // 主键ID
ID int64 `json:"id,omitempty"` 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 // 用户ID
UserID string `json:"user_id,omitempty"` UserID string `json:"user_id,omitempty"`
// 第三方用户的 open id // 第三方用户的 open id
@@ -27,12 +33,6 @@ type ScaAuthUserSocial struct {
Source string `json:"source,omitempty"` Source string `json:"source,omitempty"`
// 状态 0正常 1 封禁 // 状态 0正常 1 封禁
Status int `json:"status,omitempty"` Status int `json:"status,omitempty"`
// 创建时间
CreatedAt time.Time `json:"created_at,omitempty"`
// 更新时间
UpdateAt *time.Time `json:"update_at,omitempty"`
// 是否删除
Deleted int `json:"deleted,omitempty"`
// Edges holds the relations/edges for other nodes in the graph. // Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the ScaAuthUserSocialQuery when eager-loading is set. // The values are being populated by the ScaAuthUserSocialQuery when eager-loading is set.
Edges ScaAuthUserSocialEdges `json:"edges"` Edges ScaAuthUserSocialEdges `json:"edges"`
@@ -65,11 +65,11 @@ func (*ScaAuthUserSocial) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case scaauthusersocial.FieldID, scaauthusersocial.FieldStatus, scaauthusersocial.FieldDeleted: case scaauthusersocial.FieldID, scaauthusersocial.FieldDeleted, scaauthusersocial.FieldStatus:
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
case scaauthusersocial.FieldUserID, scaauthusersocial.FieldOpenID, scaauthusersocial.FieldSource: case scaauthusersocial.FieldUserID, scaauthusersocial.FieldOpenID, scaauthusersocial.FieldSource:
values[i] = new(sql.NullString) values[i] = new(sql.NullString)
case scaauthusersocial.FieldCreatedAt, scaauthusersocial.FieldUpdateAt: case scaauthusersocial.FieldCreatedAt, scaauthusersocial.FieldUpdatedAt:
values[i] = new(sql.NullTime) values[i] = new(sql.NullTime)
case scaauthusersocial.ForeignKeys[0]: // sca_auth_user_sca_auth_user_social case scaauthusersocial.ForeignKeys[0]: // sca_auth_user_sca_auth_user_social
values[i] = new(sql.NullInt64) values[i] = new(sql.NullInt64)
@@ -94,6 +94,24 @@ func (saus *ScaAuthUserSocial) assignValues(columns []string, values []any) erro
return fmt.Errorf("unexpected type %T for field id", value) return fmt.Errorf("unexpected type %T for field id", value)
} }
saus.ID = int64(value.Int64) saus.ID = int64(value.Int64)
case scaauthusersocial.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 {
saus.CreatedAt = value.Time
}
case scaauthusersocial.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 {
saus.UpdatedAt = value.Time
}
case scaauthusersocial.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
saus.Deleted = int8(value.Int64)
}
case scaauthusersocial.FieldUserID: case scaauthusersocial.FieldUserID:
if value, ok := values[i].(*sql.NullString); !ok { if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field user_id", values[i]) return fmt.Errorf("unexpected type %T for field user_id", values[i])
@@ -118,25 +136,6 @@ func (saus *ScaAuthUserSocial) assignValues(columns []string, values []any) erro
} else if value.Valid { } else if value.Valid {
saus.Status = int(value.Int64) saus.Status = int(value.Int64)
} }
case scaauthusersocial.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 {
saus.CreatedAt = value.Time
}
case scaauthusersocial.FieldUpdateAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field update_at", values[i])
} else if value.Valid {
saus.UpdateAt = new(time.Time)
*saus.UpdateAt = value.Time
}
case scaauthusersocial.FieldDeleted:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
} else if value.Valid {
saus.Deleted = int(value.Int64)
}
case scaauthusersocial.ForeignKeys[0]: case scaauthusersocial.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullInt64); !ok { if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for edge-field sca_auth_user_sca_auth_user_social", value) return fmt.Errorf("unexpected type %T for edge-field sca_auth_user_sca_auth_user_social", value)
@@ -185,6 +184,15 @@ func (saus *ScaAuthUserSocial) String() string {
var builder strings.Builder var builder strings.Builder
builder.WriteString("ScaAuthUserSocial(") builder.WriteString("ScaAuthUserSocial(")
builder.WriteString(fmt.Sprintf("id=%v, ", saus.ID)) builder.WriteString(fmt.Sprintf("id=%v, ", saus.ID))
builder.WriteString("created_at=")
builder.WriteString(saus.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(saus.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", saus.Deleted))
builder.WriteString(", ")
builder.WriteString("user_id=") builder.WriteString("user_id=")
builder.WriteString(saus.UserID) builder.WriteString(saus.UserID)
builder.WriteString(", ") builder.WriteString(", ")
@@ -196,17 +204,6 @@ func (saus *ScaAuthUserSocial) String() string {
builder.WriteString(", ") builder.WriteString(", ")
builder.WriteString("status=") builder.WriteString("status=")
builder.WriteString(fmt.Sprintf("%v", saus.Status)) builder.WriteString(fmt.Sprintf("%v", saus.Status))
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(saus.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
if v := saus.UpdateAt; v != nil {
builder.WriteString("update_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", saus.Deleted))
builder.WriteByte(')') builder.WriteByte(')')
return builder.String() return builder.String()
} }

View File

@@ -14,6 +14,12 @@ const (
Label = "sca_auth_user_social" Label = "sca_auth_user_social"
// FieldID holds the string denoting the id field in the database. // FieldID holds the string denoting the id field in the database.
FieldID = "id" 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 holds the string denoting the user_id field in the database.
FieldUserID = "user_id" FieldUserID = "user_id"
// FieldOpenID holds the string denoting the open_id field in the database. // FieldOpenID holds the string denoting the open_id field in the database.
@@ -22,21 +28,15 @@ const (
FieldSource = "source" FieldSource = "source"
// FieldStatus holds the string denoting the status field in the database. // FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status" FieldStatus = "status"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdateAt holds the string denoting the update_at field in the database.
FieldUpdateAt = "update_at"
// FieldDeleted holds the string denoting the deleted field in the database.
FieldDeleted = "deleted"
// EdgeScaAuthUser holds the string denoting the sca_auth_user edge name in mutations. // EdgeScaAuthUser holds the string denoting the sca_auth_user edge name in mutations.
EdgeScaAuthUser = "sca_auth_user" EdgeScaAuthUser = "sca_auth_user"
// Table holds the table name of the scaauthusersocial in the database. // Table holds the table name of the scaauthusersocial in the database.
Table = "sca_auth_user_socials" Table = "sca_auth_user_social"
// ScaAuthUserTable is the table that holds the sca_auth_user relation/edge. // ScaAuthUserTable is the table that holds the sca_auth_user relation/edge.
ScaAuthUserTable = "sca_auth_user_socials" ScaAuthUserTable = "sca_auth_user_social"
// ScaAuthUserInverseTable is the table name for the ScaAuthUser entity. // ScaAuthUserInverseTable is the table name for the ScaAuthUser entity.
// It exists in this package in order to avoid circular dependency with the "scaauthuser" package. // It exists in this package in order to avoid circular dependency with the "scaauthuser" package.
ScaAuthUserInverseTable = "sca_auth_users" ScaAuthUserInverseTable = "sca_auth_user"
// ScaAuthUserColumn is the table column denoting the sca_auth_user relation/edge. // ScaAuthUserColumn is the table column denoting the sca_auth_user relation/edge.
ScaAuthUserColumn = "sca_auth_user_sca_auth_user_social" ScaAuthUserColumn = "sca_auth_user_sca_auth_user_social"
) )
@@ -44,16 +44,16 @@ const (
// Columns holds all SQL columns for scaauthusersocial fields. // Columns holds all SQL columns for scaauthusersocial fields.
var Columns = []string{ var Columns = []string{
FieldID, FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldDeleted,
FieldUserID, FieldUserID,
FieldOpenID, FieldOpenID,
FieldSource, FieldSource,
FieldStatus, FieldStatus,
FieldCreatedAt,
FieldUpdateAt,
FieldDeleted,
} }
// ForeignKeys holds the SQL foreign-keys that are owned by the "sca_auth_user_socials" // ForeignKeys holds the SQL foreign-keys that are owned by the "sca_auth_user_social"
// table and are not defined as standalone fields in the schema. // table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{ var ForeignKeys = []string{
"sca_auth_user_sca_auth_user_social", "sca_auth_user_sca_auth_user_social",
@@ -75,6 +75,16 @@ func ValidColumn(column string) bool {
} }
var ( var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// 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
// UserIDValidator is a validator for the "user_id" field. It is called by the builders before save. // UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
UserIDValidator func(string) error UserIDValidator func(string) error
// OpenIDValidator is a validator for the "open_id" field. It is called by the builders before save. // OpenIDValidator is a validator for the "open_id" field. It is called by the builders before save.
@@ -83,14 +93,6 @@ var (
SourceValidator func(string) error SourceValidator func(string) error
// DefaultStatus holds the default value on creation for the "status" field. // DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus int DefaultStatus int
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdateAt holds the default value on creation for the "update_at" field.
DefaultUpdateAt func() time.Time
// UpdateDefaultUpdateAt holds the default value on update for the "update_at" field.
UpdateDefaultUpdateAt func() time.Time
// DefaultDeleted holds the default value on creation for the "deleted" field.
DefaultDeleted int
) )
// OrderOption defines the ordering options for the ScaAuthUserSocial queries. // OrderOption defines the ordering options for the ScaAuthUserSocial queries.
@@ -101,6 +103,21 @@ func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc() 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. // ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption { func ByUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUserID, opts...).ToFunc() return sql.OrderByField(FieldUserID, opts...).ToFunc()
@@ -121,21 +138,6 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc() return sql.OrderByField(FieldStatus, opts...).ToFunc()
} }
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdateAt orders the results by the update_at field.
func ByUpdateAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdateAt, opts...).ToFunc()
}
// ByDeleted orders the results by the deleted field.
func ByDeleted(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDeleted, opts...).ToFunc()
}
// ByScaAuthUserField orders the results by sca_auth_user field. // ByScaAuthUserField orders the results by sca_auth_user field.
func ByScaAuthUserField(field string, opts ...sql.OrderTermOption) OrderOption { func ByScaAuthUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) { return func(s *sql.Selector) {

View File

@@ -55,6 +55,21 @@ func IDLTE(id int64) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldID, id)) return predicate.ScaAuthUserSocial(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.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(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.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUpdatedAt, v))
}
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ.
func Deleted(v int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldDeleted, v))
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ. // UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func UserID(v string) predicate.ScaAuthUserSocial { func UserID(v string) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUserID, v)) return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUserID, v))
@@ -75,21 +90,136 @@ func Status(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldStatus, v)) return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldStatus, v))
} }
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. // CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAt(v time.Time) predicate.ScaAuthUserSocial { func CreatedAtEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldCreatedAt, v)) return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldCreatedAt, v))
} }
// UpdateAt applies equality check predicate on the "update_at" field. It's identical to UpdateAtEQ. // CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func UpdateAt(v time.Time) predicate.ScaAuthUserSocial { func CreatedAtNEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUpdateAt, v)) return predicate.ScaAuthUserSocial(sql.FieldNEQ(FieldCreatedAt, v))
} }
// Deleted applies equality check predicate on the "deleted" field. It's identical to DeletedEQ. // CreatedAtIn applies the In predicate on the "created_at" field.
func Deleted(v int) predicate.ScaAuthUserSocial { func CreatedAtIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldUpdatedAt, v))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldDeleted, v)) return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldDeleted, v))
} }
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int8) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldDeleted, v))
}
// DeletedIsNil applies the IsNil predicate on the "deleted" field.
func DeletedIsNil() predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIsNull(FieldDeleted))
}
// DeletedNotNil applies the NotNil predicate on the "deleted" field.
func DeletedNotNil() predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotNull(FieldDeleted))
}
// UserIDEQ applies the EQ predicate on the "user_id" field. // UserIDEQ applies the EQ predicate on the "user_id" field.
func UserIDEQ(v string) predicate.ScaAuthUserSocial { func UserIDEQ(v string) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUserID, v)) return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUserID, v))
@@ -325,136 +455,6 @@ func StatusLTE(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldStatus, v)) return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldStatus, v))
} }
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdateAtEQ applies the EQ predicate on the "update_at" field.
func UpdateAtEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldUpdateAt, v))
}
// UpdateAtNEQ applies the NEQ predicate on the "update_at" field.
func UpdateAtNEQ(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNEQ(FieldUpdateAt, v))
}
// UpdateAtIn applies the In predicate on the "update_at" field.
func UpdateAtIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIn(FieldUpdateAt, vs...))
}
// UpdateAtNotIn applies the NotIn predicate on the "update_at" field.
func UpdateAtNotIn(vs ...time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotIn(FieldUpdateAt, vs...))
}
// UpdateAtGT applies the GT predicate on the "update_at" field.
func UpdateAtGT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGT(FieldUpdateAt, v))
}
// UpdateAtGTE applies the GTE predicate on the "update_at" field.
func UpdateAtGTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGTE(FieldUpdateAt, v))
}
// UpdateAtLT applies the LT predicate on the "update_at" field.
func UpdateAtLT(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLT(FieldUpdateAt, v))
}
// UpdateAtLTE applies the LTE predicate on the "update_at" field.
func UpdateAtLTE(v time.Time) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldUpdateAt, v))
}
// UpdateAtIsNil applies the IsNil predicate on the "update_at" field.
func UpdateAtIsNil() predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIsNull(FieldUpdateAt))
}
// UpdateAtNotNil applies the NotNil predicate on the "update_at" field.
func UpdateAtNotNil() predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotNull(FieldUpdateAt))
}
// DeletedEQ applies the EQ predicate on the "deleted" field.
func DeletedEQ(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldEQ(FieldDeleted, v))
}
// DeletedNEQ applies the NEQ predicate on the "deleted" field.
func DeletedNEQ(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNEQ(FieldDeleted, v))
}
// DeletedIn applies the In predicate on the "deleted" field.
func DeletedIn(vs ...int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldIn(FieldDeleted, vs...))
}
// DeletedNotIn applies the NotIn predicate on the "deleted" field.
func DeletedNotIn(vs ...int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldNotIn(FieldDeleted, vs...))
}
// DeletedGT applies the GT predicate on the "deleted" field.
func DeletedGT(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGT(FieldDeleted, v))
}
// DeletedGTE applies the GTE predicate on the "deleted" field.
func DeletedGTE(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldGTE(FieldDeleted, v))
}
// DeletedLT applies the LT predicate on the "deleted" field.
func DeletedLT(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLT(FieldDeleted, v))
}
// DeletedLTE applies the LTE predicate on the "deleted" field.
func DeletedLTE(v int) predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(sql.FieldLTE(FieldDeleted, v))
}
// HasScaAuthUser applies the HasEdge predicate on the "sca_auth_user" edge. // HasScaAuthUser applies the HasEdge predicate on the "sca_auth_user" edge.
func HasScaAuthUser() predicate.ScaAuthUserSocial { func HasScaAuthUser() predicate.ScaAuthUserSocial {
return predicate.ScaAuthUserSocial(func(s *sql.Selector) { return predicate.ScaAuthUserSocial(func(s *sql.Selector) {

View File

@@ -21,6 +21,48 @@ type ScaAuthUserSocialCreate struct {
hooks []Hook hooks []Hook
} }
// SetCreatedAt sets the "created_at" field.
func (sausc *ScaAuthUserSocialCreate) SetCreatedAt(t time.Time) *ScaAuthUserSocialCreate {
sausc.mutation.SetCreatedAt(t)
return sausc
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (sausc *ScaAuthUserSocialCreate) SetNillableCreatedAt(t *time.Time) *ScaAuthUserSocialCreate {
if t != nil {
sausc.SetCreatedAt(*t)
}
return sausc
}
// SetUpdatedAt sets the "updated_at" field.
func (sausc *ScaAuthUserSocialCreate) SetUpdatedAt(t time.Time) *ScaAuthUserSocialCreate {
sausc.mutation.SetUpdatedAt(t)
return sausc
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (sausc *ScaAuthUserSocialCreate) SetNillableUpdatedAt(t *time.Time) *ScaAuthUserSocialCreate {
if t != nil {
sausc.SetUpdatedAt(*t)
}
return sausc
}
// SetDeleted sets the "deleted" field.
func (sausc *ScaAuthUserSocialCreate) SetDeleted(i int8) *ScaAuthUserSocialCreate {
sausc.mutation.SetDeleted(i)
return sausc
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sausc *ScaAuthUserSocialCreate) SetNillableDeleted(i *int8) *ScaAuthUserSocialCreate {
if i != nil {
sausc.SetDeleted(*i)
}
return sausc
}
// SetUserID sets the "user_id" field. // SetUserID sets the "user_id" field.
func (sausc *ScaAuthUserSocialCreate) SetUserID(s string) *ScaAuthUserSocialCreate { func (sausc *ScaAuthUserSocialCreate) SetUserID(s string) *ScaAuthUserSocialCreate {
sausc.mutation.SetUserID(s) sausc.mutation.SetUserID(s)
@@ -53,48 +95,6 @@ func (sausc *ScaAuthUserSocialCreate) SetNillableStatus(i *int) *ScaAuthUserSoci
return sausc return sausc
} }
// SetCreatedAt sets the "created_at" field.
func (sausc *ScaAuthUserSocialCreate) SetCreatedAt(t time.Time) *ScaAuthUserSocialCreate {
sausc.mutation.SetCreatedAt(t)
return sausc
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (sausc *ScaAuthUserSocialCreate) SetNillableCreatedAt(t *time.Time) *ScaAuthUserSocialCreate {
if t != nil {
sausc.SetCreatedAt(*t)
}
return sausc
}
// SetUpdateAt sets the "update_at" field.
func (sausc *ScaAuthUserSocialCreate) SetUpdateAt(t time.Time) *ScaAuthUserSocialCreate {
sausc.mutation.SetUpdateAt(t)
return sausc
}
// SetNillableUpdateAt sets the "update_at" field if the given value is not nil.
func (sausc *ScaAuthUserSocialCreate) SetNillableUpdateAt(t *time.Time) *ScaAuthUserSocialCreate {
if t != nil {
sausc.SetUpdateAt(*t)
}
return sausc
}
// SetDeleted sets the "deleted" field.
func (sausc *ScaAuthUserSocialCreate) SetDeleted(i int) *ScaAuthUserSocialCreate {
sausc.mutation.SetDeleted(i)
return sausc
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sausc *ScaAuthUserSocialCreate) SetNillableDeleted(i *int) *ScaAuthUserSocialCreate {
if i != nil {
sausc.SetDeleted(*i)
}
return sausc
}
// SetID sets the "id" field. // SetID sets the "id" field.
func (sausc *ScaAuthUserSocialCreate) SetID(i int64) *ScaAuthUserSocialCreate { func (sausc *ScaAuthUserSocialCreate) SetID(i int64) *ScaAuthUserSocialCreate {
sausc.mutation.SetID(i) sausc.mutation.SetID(i)
@@ -155,26 +155,37 @@ func (sausc *ScaAuthUserSocialCreate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (sausc *ScaAuthUserSocialCreate) defaults() { func (sausc *ScaAuthUserSocialCreate) defaults() {
if _, ok := sausc.mutation.Status(); !ok {
v := scaauthusersocial.DefaultStatus
sausc.mutation.SetStatus(v)
}
if _, ok := sausc.mutation.CreatedAt(); !ok { if _, ok := sausc.mutation.CreatedAt(); !ok {
v := scaauthusersocial.DefaultCreatedAt() v := scaauthusersocial.DefaultCreatedAt()
sausc.mutation.SetCreatedAt(v) sausc.mutation.SetCreatedAt(v)
} }
if _, ok := sausc.mutation.UpdateAt(); !ok { if _, ok := sausc.mutation.UpdatedAt(); !ok {
v := scaauthusersocial.DefaultUpdateAt() v := scaauthusersocial.DefaultUpdatedAt()
sausc.mutation.SetUpdateAt(v) sausc.mutation.SetUpdatedAt(v)
} }
if _, ok := sausc.mutation.Deleted(); !ok { if _, ok := sausc.mutation.Deleted(); !ok {
v := scaauthusersocial.DefaultDeleted v := scaauthusersocial.DefaultDeleted
sausc.mutation.SetDeleted(v) sausc.mutation.SetDeleted(v)
} }
if _, ok := sausc.mutation.Status(); !ok {
v := scaauthusersocial.DefaultStatus
sausc.mutation.SetStatus(v)
}
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sausc *ScaAuthUserSocialCreate) check() error { func (sausc *ScaAuthUserSocialCreate) check() error {
if _, ok := sausc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaAuthUserSocial.created_at"`)}
}
if _, ok := sausc.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "ScaAuthUserSocial.updated_at"`)}
}
if v, ok := sausc.mutation.Deleted(); ok {
if err := scaauthusersocial.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserSocial.deleted": %w`, err)}
}
}
if _, ok := sausc.mutation.UserID(); !ok { if _, ok := sausc.mutation.UserID(); !ok {
return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "ScaAuthUserSocial.user_id"`)} return &ValidationError{Name: "user_id", err: errors.New(`ent: missing required field "ScaAuthUserSocial.user_id"`)}
} }
@@ -202,12 +213,6 @@ func (sausc *ScaAuthUserSocialCreate) check() error {
if _, ok := sausc.mutation.Status(); !ok { if _, ok := sausc.mutation.Status(); !ok {
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "ScaAuthUserSocial.status"`)} return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "ScaAuthUserSocial.status"`)}
} }
if _, ok := sausc.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "ScaAuthUserSocial.created_at"`)}
}
if _, ok := sausc.mutation.Deleted(); !ok {
return &ValidationError{Name: "deleted", err: errors.New(`ent: missing required field "ScaAuthUserSocial.deleted"`)}
}
return nil return nil
} }
@@ -240,6 +245,18 @@ func (sausc *ScaAuthUserSocialCreate) createSpec() (*ScaAuthUserSocial, *sqlgrap
_node.ID = id _node.ID = id
_spec.ID.Value = id _spec.ID.Value = id
} }
if value, ok := sausc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthusersocial.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := sausc.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthusersocial.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := sausc.mutation.Deleted(); ok {
_spec.SetField(scaauthusersocial.FieldDeleted, field.TypeInt8, value)
_node.Deleted = value
}
if value, ok := sausc.mutation.UserID(); ok { if value, ok := sausc.mutation.UserID(); ok {
_spec.SetField(scaauthusersocial.FieldUserID, field.TypeString, value) _spec.SetField(scaauthusersocial.FieldUserID, field.TypeString, value)
_node.UserID = value _node.UserID = value
@@ -256,18 +273,6 @@ func (sausc *ScaAuthUserSocialCreate) createSpec() (*ScaAuthUserSocial, *sqlgrap
_spec.SetField(scaauthusersocial.FieldStatus, field.TypeInt, value) _spec.SetField(scaauthusersocial.FieldStatus, field.TypeInt, value)
_node.Status = value _node.Status = value
} }
if value, ok := sausc.mutation.CreatedAt(); ok {
_spec.SetField(scaauthusersocial.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := sausc.mutation.UpdateAt(); ok {
_spec.SetField(scaauthusersocial.FieldUpdateAt, field.TypeTime, value)
_node.UpdateAt = &value
}
if value, ok := sausc.mutation.Deleted(); ok {
_spec.SetField(scaauthusersocial.FieldDeleted, field.TypeInt, value)
_node.Deleted = value
}
if nodes := sausc.mutation.ScaAuthUserIDs(); len(nodes) > 0 { if nodes := sausc.mutation.ScaAuthUserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O, Rel: sqlgraph.M2O,

View File

@@ -299,12 +299,12 @@ func (sausq *ScaAuthUserSocialQuery) WithScaAuthUser(opts ...func(*ScaAuthUserQu
// Example: // Example:
// //
// var v []struct { // var v []struct {
// UserID string `json:"user_id,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"` // Count int `json:"count,omitempty"`
// } // }
// //
// client.ScaAuthUserSocial.Query(). // client.ScaAuthUserSocial.Query().
// GroupBy(scaauthusersocial.FieldUserID). // GroupBy(scaauthusersocial.FieldCreatedAt).
// Aggregate(ent.Count()). // Aggregate(ent.Count()).
// Scan(ctx, &v) // Scan(ctx, &v)
func (sausq *ScaAuthUserSocialQuery) GroupBy(field string, fields ...string) *ScaAuthUserSocialGroupBy { func (sausq *ScaAuthUserSocialQuery) GroupBy(field string, fields ...string) *ScaAuthUserSocialGroupBy {
@@ -322,11 +322,11 @@ func (sausq *ScaAuthUserSocialQuery) GroupBy(field string, fields ...string) *Sc
// Example: // Example:
// //
// var v []struct { // var v []struct {
// UserID string `json:"user_id,omitempty"` // CreatedAt time.Time `json:"created_at,omitempty"`
// } // }
// //
// client.ScaAuthUserSocial.Query(). // client.ScaAuthUserSocial.Query().
// Select(scaauthusersocial.FieldUserID). // Select(scaauthusersocial.FieldCreatedAt).
// Scan(ctx, &v) // Scan(ctx, &v)
func (sausq *ScaAuthUserSocialQuery) Select(fields ...string) *ScaAuthUserSocialSelect { func (sausq *ScaAuthUserSocialQuery) Select(fields ...string) *ScaAuthUserSocialSelect {
sausq.ctx.Fields = append(sausq.ctx.Fields, fields...) sausq.ctx.Fields = append(sausq.ctx.Fields, fields...)

View File

@@ -29,6 +29,39 @@ func (sausu *ScaAuthUserSocialUpdate) Where(ps ...predicate.ScaAuthUserSocial) *
return sausu return sausu
} }
// SetUpdatedAt sets the "updated_at" field.
func (sausu *ScaAuthUserSocialUpdate) SetUpdatedAt(t time.Time) *ScaAuthUserSocialUpdate {
sausu.mutation.SetUpdatedAt(t)
return sausu
}
// SetDeleted sets the "deleted" field.
func (sausu *ScaAuthUserSocialUpdate) SetDeleted(i int8) *ScaAuthUserSocialUpdate {
sausu.mutation.ResetDeleted()
sausu.mutation.SetDeleted(i)
return sausu
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sausu *ScaAuthUserSocialUpdate) SetNillableDeleted(i *int8) *ScaAuthUserSocialUpdate {
if i != nil {
sausu.SetDeleted(*i)
}
return sausu
}
// AddDeleted adds i to the "deleted" field.
func (sausu *ScaAuthUserSocialUpdate) AddDeleted(i int8) *ScaAuthUserSocialUpdate {
sausu.mutation.AddDeleted(i)
return sausu
}
// ClearDeleted clears the value of the "deleted" field.
func (sausu *ScaAuthUserSocialUpdate) ClearDeleted() *ScaAuthUserSocialUpdate {
sausu.mutation.ClearDeleted()
return sausu
}
// SetUserID sets the "user_id" field. // SetUserID sets the "user_id" field.
func (sausu *ScaAuthUserSocialUpdate) SetUserID(s string) *ScaAuthUserSocialUpdate { func (sausu *ScaAuthUserSocialUpdate) SetUserID(s string) *ScaAuthUserSocialUpdate {
sausu.mutation.SetUserID(s) sausu.mutation.SetUserID(s)
@@ -92,39 +125,6 @@ func (sausu *ScaAuthUserSocialUpdate) AddStatus(i int) *ScaAuthUserSocialUpdate
return sausu return sausu
} }
// SetUpdateAt sets the "update_at" field.
func (sausu *ScaAuthUserSocialUpdate) SetUpdateAt(t time.Time) *ScaAuthUserSocialUpdate {
sausu.mutation.SetUpdateAt(t)
return sausu
}
// ClearUpdateAt clears the value of the "update_at" field.
func (sausu *ScaAuthUserSocialUpdate) ClearUpdateAt() *ScaAuthUserSocialUpdate {
sausu.mutation.ClearUpdateAt()
return sausu
}
// SetDeleted sets the "deleted" field.
func (sausu *ScaAuthUserSocialUpdate) SetDeleted(i int) *ScaAuthUserSocialUpdate {
sausu.mutation.ResetDeleted()
sausu.mutation.SetDeleted(i)
return sausu
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sausu *ScaAuthUserSocialUpdate) SetNillableDeleted(i *int) *ScaAuthUserSocialUpdate {
if i != nil {
sausu.SetDeleted(*i)
}
return sausu
}
// AddDeleted adds i to the "deleted" field.
func (sausu *ScaAuthUserSocialUpdate) AddDeleted(i int) *ScaAuthUserSocialUpdate {
sausu.mutation.AddDeleted(i)
return sausu
}
// SetScaAuthUserID sets the "sca_auth_user" edge to the ScaAuthUser entity by ID. // SetScaAuthUserID sets the "sca_auth_user" edge to the ScaAuthUser entity by ID.
func (sausu *ScaAuthUserSocialUpdate) SetScaAuthUserID(id int64) *ScaAuthUserSocialUpdate { func (sausu *ScaAuthUserSocialUpdate) SetScaAuthUserID(id int64) *ScaAuthUserSocialUpdate {
sausu.mutation.SetScaAuthUserID(id) sausu.mutation.SetScaAuthUserID(id)
@@ -185,14 +185,19 @@ func (sausu *ScaAuthUserSocialUpdate) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (sausu *ScaAuthUserSocialUpdate) defaults() { func (sausu *ScaAuthUserSocialUpdate) defaults() {
if _, ok := sausu.mutation.UpdateAt(); !ok && !sausu.mutation.UpdateAtCleared() { if _, ok := sausu.mutation.UpdatedAt(); !ok {
v := scaauthusersocial.UpdateDefaultUpdateAt() v := scaauthusersocial.UpdateDefaultUpdatedAt()
sausu.mutation.SetUpdateAt(v) sausu.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sausu *ScaAuthUserSocialUpdate) check() error { func (sausu *ScaAuthUserSocialUpdate) check() error {
if v, ok := sausu.mutation.Deleted(); ok {
if err := scaauthusersocial.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserSocial.deleted": %w`, err)}
}
}
if v, ok := sausu.mutation.UserID(); ok { if v, ok := sausu.mutation.UserID(); ok {
if err := scaauthusersocial.UserIDValidator(v); err != nil { if err := scaauthusersocial.UserIDValidator(v); err != nil {
return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserSocial.user_id": %w`, err)} return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserSocial.user_id": %w`, err)}
@@ -223,6 +228,18 @@ func (sausu *ScaAuthUserSocialUpdate) sqlSave(ctx context.Context) (n int, err e
} }
} }
} }
if value, ok := sausu.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthusersocial.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := sausu.mutation.Deleted(); ok {
_spec.SetField(scaauthusersocial.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sausu.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthusersocial.FieldDeleted, field.TypeInt8, value)
}
if sausu.mutation.DeletedCleared() {
_spec.ClearField(scaauthusersocial.FieldDeleted, field.TypeInt8)
}
if value, ok := sausu.mutation.UserID(); ok { if value, ok := sausu.mutation.UserID(); ok {
_spec.SetField(scaauthusersocial.FieldUserID, field.TypeString, value) _spec.SetField(scaauthusersocial.FieldUserID, field.TypeString, value)
} }
@@ -238,18 +255,6 @@ func (sausu *ScaAuthUserSocialUpdate) sqlSave(ctx context.Context) (n int, err e
if value, ok := sausu.mutation.AddedStatus(); ok { if value, ok := sausu.mutation.AddedStatus(); ok {
_spec.AddField(scaauthusersocial.FieldStatus, field.TypeInt, value) _spec.AddField(scaauthusersocial.FieldStatus, field.TypeInt, value)
} }
if value, ok := sausu.mutation.UpdateAt(); ok {
_spec.SetField(scaauthusersocial.FieldUpdateAt, field.TypeTime, value)
}
if sausu.mutation.UpdateAtCleared() {
_spec.ClearField(scaauthusersocial.FieldUpdateAt, field.TypeTime)
}
if value, ok := sausu.mutation.Deleted(); ok {
_spec.SetField(scaauthusersocial.FieldDeleted, field.TypeInt, value)
}
if value, ok := sausu.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthusersocial.FieldDeleted, field.TypeInt, value)
}
if sausu.mutation.ScaAuthUserCleared() { if sausu.mutation.ScaAuthUserCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O, Rel: sqlgraph.M2O,
@@ -299,6 +304,39 @@ type ScaAuthUserSocialUpdateOne struct {
mutation *ScaAuthUserSocialMutation mutation *ScaAuthUserSocialMutation
} }
// SetUpdatedAt sets the "updated_at" field.
func (sausuo *ScaAuthUserSocialUpdateOne) SetUpdatedAt(t time.Time) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.SetUpdatedAt(t)
return sausuo
}
// SetDeleted sets the "deleted" field.
func (sausuo *ScaAuthUserSocialUpdateOne) SetDeleted(i int8) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.ResetDeleted()
sausuo.mutation.SetDeleted(i)
return sausuo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sausuo *ScaAuthUserSocialUpdateOne) SetNillableDeleted(i *int8) *ScaAuthUserSocialUpdateOne {
if i != nil {
sausuo.SetDeleted(*i)
}
return sausuo
}
// AddDeleted adds i to the "deleted" field.
func (sausuo *ScaAuthUserSocialUpdateOne) AddDeleted(i int8) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.AddDeleted(i)
return sausuo
}
// ClearDeleted clears the value of the "deleted" field.
func (sausuo *ScaAuthUserSocialUpdateOne) ClearDeleted() *ScaAuthUserSocialUpdateOne {
sausuo.mutation.ClearDeleted()
return sausuo
}
// SetUserID sets the "user_id" field. // SetUserID sets the "user_id" field.
func (sausuo *ScaAuthUserSocialUpdateOne) SetUserID(s string) *ScaAuthUserSocialUpdateOne { func (sausuo *ScaAuthUserSocialUpdateOne) SetUserID(s string) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.SetUserID(s) sausuo.mutation.SetUserID(s)
@@ -362,39 +400,6 @@ func (sausuo *ScaAuthUserSocialUpdateOne) AddStatus(i int) *ScaAuthUserSocialUpd
return sausuo return sausuo
} }
// SetUpdateAt sets the "update_at" field.
func (sausuo *ScaAuthUserSocialUpdateOne) SetUpdateAt(t time.Time) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.SetUpdateAt(t)
return sausuo
}
// ClearUpdateAt clears the value of the "update_at" field.
func (sausuo *ScaAuthUserSocialUpdateOne) ClearUpdateAt() *ScaAuthUserSocialUpdateOne {
sausuo.mutation.ClearUpdateAt()
return sausuo
}
// SetDeleted sets the "deleted" field.
func (sausuo *ScaAuthUserSocialUpdateOne) SetDeleted(i int) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.ResetDeleted()
sausuo.mutation.SetDeleted(i)
return sausuo
}
// SetNillableDeleted sets the "deleted" field if the given value is not nil.
func (sausuo *ScaAuthUserSocialUpdateOne) SetNillableDeleted(i *int) *ScaAuthUserSocialUpdateOne {
if i != nil {
sausuo.SetDeleted(*i)
}
return sausuo
}
// AddDeleted adds i to the "deleted" field.
func (sausuo *ScaAuthUserSocialUpdateOne) AddDeleted(i int) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.AddDeleted(i)
return sausuo
}
// SetScaAuthUserID sets the "sca_auth_user" edge to the ScaAuthUser entity by ID. // SetScaAuthUserID sets the "sca_auth_user" edge to the ScaAuthUser entity by ID.
func (sausuo *ScaAuthUserSocialUpdateOne) SetScaAuthUserID(id int64) *ScaAuthUserSocialUpdateOne { func (sausuo *ScaAuthUserSocialUpdateOne) SetScaAuthUserID(id int64) *ScaAuthUserSocialUpdateOne {
sausuo.mutation.SetScaAuthUserID(id) sausuo.mutation.SetScaAuthUserID(id)
@@ -468,14 +473,19 @@ func (sausuo *ScaAuthUserSocialUpdateOne) ExecX(ctx context.Context) {
// defaults sets the default values of the builder before save. // defaults sets the default values of the builder before save.
func (sausuo *ScaAuthUserSocialUpdateOne) defaults() { func (sausuo *ScaAuthUserSocialUpdateOne) defaults() {
if _, ok := sausuo.mutation.UpdateAt(); !ok && !sausuo.mutation.UpdateAtCleared() { if _, ok := sausuo.mutation.UpdatedAt(); !ok {
v := scaauthusersocial.UpdateDefaultUpdateAt() v := scaauthusersocial.UpdateDefaultUpdatedAt()
sausuo.mutation.SetUpdateAt(v) sausuo.mutation.SetUpdatedAt(v)
} }
} }
// check runs all checks and user-defined validators on the builder. // check runs all checks and user-defined validators on the builder.
func (sausuo *ScaAuthUserSocialUpdateOne) check() error { func (sausuo *ScaAuthUserSocialUpdateOne) check() error {
if v, ok := sausuo.mutation.Deleted(); ok {
if err := scaauthusersocial.DeletedValidator(v); err != nil {
return &ValidationError{Name: "deleted", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserSocial.deleted": %w`, err)}
}
}
if v, ok := sausuo.mutation.UserID(); ok { if v, ok := sausuo.mutation.UserID(); ok {
if err := scaauthusersocial.UserIDValidator(v); err != nil { if err := scaauthusersocial.UserIDValidator(v); err != nil {
return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserSocial.user_id": %w`, err)} return &ValidationError{Name: "user_id", err: fmt.Errorf(`ent: validator failed for field "ScaAuthUserSocial.user_id": %w`, err)}
@@ -523,6 +533,18 @@ func (sausuo *ScaAuthUserSocialUpdateOne) sqlSave(ctx context.Context) (_node *S
} }
} }
} }
if value, ok := sausuo.mutation.UpdatedAt(); ok {
_spec.SetField(scaauthusersocial.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := sausuo.mutation.Deleted(); ok {
_spec.SetField(scaauthusersocial.FieldDeleted, field.TypeInt8, value)
}
if value, ok := sausuo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthusersocial.FieldDeleted, field.TypeInt8, value)
}
if sausuo.mutation.DeletedCleared() {
_spec.ClearField(scaauthusersocial.FieldDeleted, field.TypeInt8)
}
if value, ok := sausuo.mutation.UserID(); ok { if value, ok := sausuo.mutation.UserID(); ok {
_spec.SetField(scaauthusersocial.FieldUserID, field.TypeString, value) _spec.SetField(scaauthusersocial.FieldUserID, field.TypeString, value)
} }
@@ -538,18 +560,6 @@ func (sausuo *ScaAuthUserSocialUpdateOne) sqlSave(ctx context.Context) (_node *S
if value, ok := sausuo.mutation.AddedStatus(); ok { if value, ok := sausuo.mutation.AddedStatus(); ok {
_spec.AddField(scaauthusersocial.FieldStatus, field.TypeInt, value) _spec.AddField(scaauthusersocial.FieldStatus, field.TypeInt, value)
} }
if value, ok := sausuo.mutation.UpdateAt(); ok {
_spec.SetField(scaauthusersocial.FieldUpdateAt, field.TypeTime, value)
}
if sausuo.mutation.UpdateAtCleared() {
_spec.ClearField(scaauthusersocial.FieldUpdateAt, field.TypeTime)
}
if value, ok := sausuo.mutation.Deleted(); ok {
_spec.SetField(scaauthusersocial.FieldDeleted, field.TypeInt, value)
}
if value, ok := sausuo.mutation.AddedDeleted(); ok {
_spec.AddField(scaauthusersocial.FieldDeleted, field.TypeInt, value)
}
if sausuo.mutation.ScaAuthUserCleared() { if sausuo.mutation.ScaAuthUserCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O, Rel: sqlgraph.M2O,

View File

@@ -0,0 +1,31 @@
package mixin
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/mixin"
)
type DefaultMixin struct {
mixin.Schema
}
func (DefaultMixin) Fields() []ent.Field {
return []ent.Field{
field.Time("created_at").
Immutable().
Default(time.Now).
Comment("创建时间"),
field.Time("updated_at").
Default(time.Now).
Comment("更新时间").
UpdateDefault(time.Now),
field.Int8("deleted").
Default(0).
Max(1).
Optional().
Comment("是否删除 0 未删除 1 已删除"),
}
}

View File

@@ -3,6 +3,8 @@ package schema
import ( import (
"entgo.io/ent" "entgo.io/ent"
"entgo.io/ent/dialect" "entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge" "entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
) )
@@ -44,7 +46,9 @@ func (ScaAuthPermissionRule) Fields() []ent.Field {
field.String("v5"). field.String("v5").
MaxLen(100). MaxLen(100).
Optional(). Optional().
Nillable(), Nillable().Annotations(
entsql.WithComments(true),
),
} }
} }
@@ -56,3 +60,14 @@ func (ScaAuthPermissionRule) Edges() []ent.Edge {
Unique(), Unique(),
} }
} }
// Annotations of the ScaAuthPermissionRule.
func (ScaAuthPermissionRule) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("角色权限规则表"),
entsql.Annotation{
Table: "sca_auth_permission_rule",
},
}
}

View File

@@ -1,12 +1,14 @@
package schema package schema
import ( import (
"time"
"entgo.io/ent" "entgo.io/ent"
"entgo.io/ent/dialect" "entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge" "entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
"schisandra-album-cloud-microservices/common/ent/schema/mixin"
) )
// ScaAuthRole holds the schema definition for the ScaAuthRole entity. // ScaAuthRole holds the schema definition for the ScaAuthRole entity.
@@ -14,6 +16,12 @@ type ScaAuthRole struct {
ent.Schema ent.Schema
} }
func (ScaAuthRole) Mixin() []ent.Mixin {
return []ent.Mixin{
mixin.DefaultMixin{},
}
}
// Fields of the ScaAuthRole. // Fields of the ScaAuthRole.
func (ScaAuthRole) Fields() []ent.Field { func (ScaAuthRole) Fields() []ent.Field {
return []ent.Field{ return []ent.Field{
@@ -28,17 +36,10 @@ func (ScaAuthRole) Fields() []ent.Field {
Comment("角色名称"), Comment("角色名称"),
field.String("role_key"). field.String("role_key").
MaxLen(64). MaxLen(64).
Comment("角色关键字"), Comment("角色关键字").
field.Time("created_at"). Annotations(
Default(time.Now). entsql.WithComments(true),
Immutable(). ),
Comment("创建时间"),
field.Time("update_at").
Default(time.Now).UpdateDefault(time.Now).
Comment("更新时间"),
field.Int("deleted").
Default(0).
Comment("是否删除 0 未删除 1已删除"),
} }
} }
@@ -53,3 +54,14 @@ func (ScaAuthRole) Edges() []ent.Edge {
func (ScaAuthRole) Indexes() []ent.Index { func (ScaAuthRole) Indexes() []ent.Index {
return nil return nil
} }
// Annotations of the ScaAuthRole.
func (ScaAuthRole) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("角色表"),
entsql.Annotation{
Table: "sca_auth_role",
},
}
}

View File

@@ -1,13 +1,15 @@
package schema package schema
import ( import (
"time"
"entgo.io/ent" "entgo.io/ent"
"entgo.io/ent/dialect" "entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge" "entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
"entgo.io/ent/schema/index" "entgo.io/ent/schema/index"
"schisandra-album-cloud-microservices/common/ent/schema/mixin"
) )
// ScaAuthUser holds the schema definition for the ScaAuthUser entity. // ScaAuthUser holds the schema definition for the ScaAuthUser entity.
@@ -15,6 +17,12 @@ type ScaAuthUser struct {
ent.Schema ent.Schema
} }
func (ScaAuthUser) Mixin() []ent.Mixin {
return []ent.Mixin{
mixin.DefaultMixin{},
}
}
// Fields of the ScaAuthUser. // Fields of the ScaAuthUser.
func (ScaAuthUser) Fields() []ent.Field { func (ScaAuthUser) Fields() []ent.Field {
return []ent.Field{ return []ent.Field{
@@ -64,18 +72,6 @@ func (ScaAuthUser) Fields() []ent.Field {
MaxLen(255). MaxLen(255).
Optional(). Optional().
Comment("介绍"), Comment("介绍"),
field.Time("created_at").
Default(time.Now).
Immutable().
Comment("创建时间"),
field.Time("update_at").
Default(time.Now).UpdateDefault(time.Now).
Nillable().
Optional().
Comment("更新时间"),
field.Int8("deleted").
Default(0).
Comment("是否删除 0 未删除 1 已删除"),
field.String("blog"). field.String("blog").
MaxLen(30). MaxLen(30).
Nillable(). Nillable().
@@ -90,7 +86,10 @@ func (ScaAuthUser) Fields() []ent.Field {
MaxLen(50). MaxLen(50).
Nillable(). Nillable().
Optional(). Optional().
Comment("公司"), Comment("公司").
Annotations(
entsql.WithComments(true),
),
} }
} }
@@ -113,3 +112,14 @@ func (ScaAuthUser) Indexes() []ent.Index {
Unique(), Unique(),
} }
} }
// Annotations of the ScaAuthUser.
func (ScaAuthUser) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("用户表"),
entsql.Annotation{
Table: "sca_auth_user",
},
}
}

View File

@@ -1,13 +1,15 @@
package schema package schema
import ( import (
"time"
"entgo.io/ent" "entgo.io/ent"
"entgo.io/ent/dialect" "entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge" "entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
"entgo.io/ent/schema/index" "entgo.io/ent/schema/index"
"schisandra-album-cloud-microservices/common/ent/schema/mixin"
) )
// ScaAuthUserDevice holds the schema definition for the ScaAuthUserDevice entity. // ScaAuthUserDevice holds the schema definition for the ScaAuthUserDevice entity.
@@ -15,6 +17,12 @@ type ScaAuthUserDevice struct {
ent.Schema ent.Schema
} }
func (ScaAuthUserDevice) Mixin() []ent.Mixin {
return []ent.Mixin{
mixin.DefaultMixin{},
}
}
// Fields of the ScaAuthUserDevice. // Fields of the ScaAuthUserDevice.
func (ScaAuthUserDevice) Fields() []ent.Field { func (ScaAuthUserDevice) Fields() []ent.Field {
return []ent.Field{ return []ent.Field{
@@ -36,18 +44,6 @@ func (ScaAuthUserDevice) Fields() []ent.Field {
field.String("agent"). field.String("agent").
MaxLen(255). MaxLen(255).
Comment("设备信息"), Comment("设备信息"),
field.Time("created_at").
Default(time.Now).
Optional().
Immutable().
Comment("创建时间"),
field.Time("update_at").
Default(time.Now).UpdateDefault(time.Now).
Nillable().
Comment("更新时间"),
field.Int("deleted").
Default(0).
Comment("是否删除"),
field.String("browser"). field.String("browser").
MaxLen(20). MaxLen(20).
Comment("浏览器"), Comment("浏览器"),
@@ -72,7 +68,9 @@ func (ScaAuthUserDevice) Fields() []ent.Field {
Comment("引擎名称"), Comment("引擎名称"),
field.String("engine_version"). field.String("engine_version").
MaxLen(20). MaxLen(20).
Comment("引擎版本"), Comment("引擎版本").Annotations(
entsql.WithComments(true),
),
} }
} }
@@ -92,3 +90,14 @@ func (ScaAuthUserDevice) Indexes() []ent.Index {
Unique(), Unique(),
} }
} }
// Annotations of the ScaAuthUserDevice.
func (ScaAuthUserDevice) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("用户设备表"),
entsql.Annotation{
Table: "sca_auth_user_device",
},
}
}

View File

@@ -1,13 +1,15 @@
package schema package schema
import ( import (
"time"
"entgo.io/ent" "entgo.io/ent"
"entgo.io/ent/dialect" "entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge" "entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
"entgo.io/ent/schema/index" "entgo.io/ent/schema/index"
"schisandra-album-cloud-microservices/common/ent/schema/mixin"
) )
// ScaAuthUserSocial holds the schema definition for the ScaAuthUserSocial entity. // ScaAuthUserSocial holds the schema definition for the ScaAuthUserSocial entity.
@@ -15,6 +17,12 @@ type ScaAuthUserSocial struct {
ent.Schema ent.Schema
} }
func (ScaAuthUserSocial) Mixin() []ent.Mixin {
return []ent.Mixin{
mixin.DefaultMixin{},
}
}
// Fields of the ScaAuthUserSocial. // Fields of the ScaAuthUserSocial.
func (ScaAuthUserSocial) Fields() []ent.Field { func (ScaAuthUserSocial) Fields() []ent.Field {
return []ent.Field{ return []ent.Field{
@@ -35,19 +43,9 @@ func (ScaAuthUserSocial) Fields() []ent.Field {
Comment("第三方用户来源"), Comment("第三方用户来源"),
field.Int("status"). field.Int("status").
Default(0). Default(0).
Comment("状态 0正常 1 封禁"), Comment("状态 0正常 1 封禁").Annotations(
field.Time("created_at"). entsql.WithComments(true),
Default(time.Now). ),
Immutable().
Comment("创建时间"),
field.Time("update_at").
Default(time.Now).UpdateDefault(time.Now).
Optional().
Nillable().
Comment("更新时间"),
field.Int("deleted").
Default(0).
Comment("是否删除"),
} }
} }
@@ -63,7 +61,22 @@ func (ScaAuthUserSocial) Edges() []ent.Edge {
// Indexes of the ScaAuthUserSocial. // Indexes of the ScaAuthUserSocial.
func (ScaAuthUserSocial) Indexes() []ent.Index { func (ScaAuthUserSocial) Indexes() []ent.Index {
return []ent.Index{ return []ent.Index{
index.Fields("id", "user_id", "open_id"). index.Fields("id").
Unique(),
index.Fields("user_id").
Unique(),
index.Fields("open_id").
Unique(), Unique(),
} }
} }
// Annotations of the ScaAuthUserSocial.
func (ScaAuthUserSocial) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.WithComments(true),
schema.Comment("用户第三方登录信息"),
entsql.Annotation{
Table: "sca_auth_user_social",
},
}
}

16
common/i18n/bundle.go Normal file
View File

@@ -0,0 +1,16 @@
package i18n
import (
i18n2 "github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/pelletier/go-toml/v2"
"golang.org/x/text/language"
)
func NewBundle(tag language.Tag, configs ...string) *i18n2.Bundle {
bundle := i18n2.NewBundle(tag)
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
for _, file := range configs {
bundle.LoadMessageFile(file)
}
return bundle
}

62
common/i18n/cache.go Normal file
View File

@@ -0,0 +1,62 @@
package i18n
import (
"context"
"net/http"
i18n2 "github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
"google.golang.org/grpc/metadata"
)
/*
type Cache interface {
GetLocalizer() (*i18n2.Localizer, bool)
SetLocalizer(l *i18n2.Localizer)
}
*/
func getLocalizer(ctx context.Context) (*i18n2.Localizer, bool) {
v := ctx.Value(I18nKey)
if l, b := v.(*i18n2.Localizer); b {
return l, true
}
return nil, false
}
func withRequest(r *http.Request, currentLang language.Tag, bundle *i18n2.Bundle) *http.Request {
accept := r.Header.Get(defaultLangHeaderKey)
localizer := i18n2.NewLocalizer(bundle, accept)
ctx := setLocalizer(r.Context(), localizer)
ctx = setCurrentLang(ctx, currentLang)
ctx = metadata.AppendToOutgoingContext(ctx, defaultLangHeaderKey, accept)
return r.WithContext(ctx)
}
func setCurrentLang(ctx context.Context, currentLang language.Tag) context.Context {
return context.WithValue(ctx, I18nCurrentLangKey, currentLang)
}
func setLocalizer(ctx context.Context, l *i18n2.Localizer) context.Context {
return context.WithValue(ctx, I18nKey, l)
}
func IsHasI18n(ctx context.Context) bool {
v := ctx.Value(I18nKey)
if v != nil {
return true
}
return false
}
// func isHasI18n(ctx context.Context) bool {
// if use, exist := ctx.Value(isUseI18n).(bool); exist {
// return use
// }
// return false
// }
//
// func setHasI18n(ctx context.Context, use bool) context.Context {
// return context.WithValue(ctx, isUseI18n, use)
// }

61
common/i18n/i18n.go Normal file
View File

@@ -0,0 +1,61 @@
package i18n
import (
"context"
i18n2 "github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
)
func FormatText(ctx context.Context, msgId string, defaultText string) string {
return FormatTextWithData(ctx, msgId, defaultText, nil)
}
func FormatTextWithData(ctx context.Context, msgId string, defaultText string, args map[string]interface{}) string {
return FormatMessage(ctx, &i18n2.Message{
ID: msgId,
Other: defaultText,
}, args)
}
func FormatMessage(ctx context.Context, message *i18n2.Message, args map[string]interface{}) string {
if localizer, ok := getLocalizer(ctx); ok {
return localizer.MustLocalize(&i18n2.LocalizeConfig{
DefaultMessage: message,
TemplateData: args,
})
}
return formatInternalMessage(message, args)
}
func formatInternalMessage(message *i18n2.Message, args map[string]interface{}) string {
if args == nil {
return message.Other
}
tpl := i18n2.NewMessageTemplate(message)
msg, err := tpl.Execute("other", args, nil)
if err != nil {
panic(err)
}
return msg
}
func FetchCurrentLanguageFromCtx(ctx context.Context) (*language.Tag, bool) {
v := ctx.Value(I18nCurrentLangKey)
if l, b := v.(language.Tag); b {
return &l, true
}
return nil, false
}
func LocalizedString(ctx context.Context, defaultValue string, langMap map[language.Tag]string) string {
langTag, tagExists := FetchCurrentLanguageFromCtx(ctx)
if !tagExists {
return defaultValue
}
str, ok := langMap[*langTag]
if !ok {
return defaultValue
}
return str
}

21
common/i18n/keys.go Normal file
View File

@@ -0,0 +1,21 @@
package i18n
const I18nKey = "i18n"
const I18nCurrentLangKey = "lang"
var (
defaultLangHeaderKey = "Accept-Language"
defaultErrCode uint32 = 10001
)
// SetDefaultLangHeaderKey sets the default value of the lang header key.
// need to be set before use
func SetDefaultLangHeaderKey(key string) {
defaultLangHeaderKey = key
}
// SetDefaultErrCode sets the default value of the err code.
// need to be set before use
func SetDefaultErrCode(code uint32) {
defaultErrCode = code
}

28
common/i18n/middleware.go Normal file
View File

@@ -0,0 +1,28 @@
package i18n
import (
"net/http"
"golang.org/x/text/language"
)
type I18nMiddleware struct {
supportTags []language.Tag
localizationFiles []string
}
func NewI18nMiddleware(supportTags []language.Tag, localizationFiles []string) *I18nMiddleware {
return &I18nMiddleware{
supportTags: supportTags,
localizationFiles: localizationFiles,
}
}
func (m *I18nMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
lang := r.Header.Get(defaultLangHeaderKey)
langTag := MatchCurrentLanguageTag(lang, m.supportTags)
bundle := NewBundle(langTag, m.localizationFiles...)
next(w, withRequest(r, langTag, bundle))
}
}

14
common/i18n/parse.go Normal file
View File

@@ -0,0 +1,14 @@
package i18n
import "golang.org/x/text/language"
func MatchCurrentLanguageTag(accept string, supportTags []language.Tag) language.Tag {
langTags, _, err := language.ParseAcceptLanguage(accept)
if err != nil {
langTags = []language.Tag{language.English}
}
var matcher = language.NewMatcher(supportTags)
_, i, _ := matcher.Match(langTags...)
tag := supportTags[i]
return tag
}

View File

@@ -0,0 +1,74 @@
package i18n
import (
"context"
"log"
i18n2 "github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
var rpcInterceptorDebug = false
func WithRpcInterceptorDebug(debug bool) {
rpcInterceptorDebug = debug
}
type I18nGrpcInterceptor struct {
supportTags []language.Tag
localizationFiles []string
}
func NewI18nGrpcInterceptor(supportTags []language.Tag, localizationFiles []string) *I18nGrpcInterceptor {
if len(supportTags) == 0 {
panic("supportTags can not be empty")
}
return &I18nGrpcInterceptor{
supportTags: supportTags,
localizationFiles: localizationFiles,
}
}
func (i *I18nGrpcInterceptor) Interceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
ctx, err = i.saveLocalize(ctx)
if err != nil {
return nil, err
}
return handler(ctx, req)
}
func (i *I18nGrpcInterceptor) saveLocalize(ctx context.Context) (context.Context, error) {
respHeader, ok := metadata.FromIncomingContext(ctx)
// lang := "en-US" //language.English
langTag := i.supportTags[0]
lang := langTag.String()
if ok {
langs := respHeader.Get(defaultLangHeaderKey)
if len(langs) == 0 {
// return nil, status.Error(codes.Code(defaultErrCode), "can not correct get language")
if rpcInterceptorDebug {
log.Printf("can not correct get language")
}
} else {
lang = langs[0]
langTag = MatchCurrentLanguageTag(lang, i.supportTags)
}
} else {
if rpcInterceptorDebug {
log.Printf("can not correct get metadata1")
}
// return nil, status.Error(codes.Code(defaultErrCode), "can not correct get metadata1")
}
// lang := langs[0]
// langTag := MatchCurrentLanguageTag(lang, i.supportTags)
bundle := NewBundle(langTag, i.localizationFiles...)
localizer := i18n2.NewLocalizer(bundle, lang)
ctx = setLocalizer(ctx, localizer)
// Append the language metadata to the outgoing context
ctx = metadata.AppendToOutgoingContext(ctx, defaultLangHeaderKey, lang)
return ctx, nil
}

View File

@@ -0,0 +1,12 @@
package middleware
import "net/http"
func CORSMiddleware() func(http.Header) {
return func(header http.Header) {
header.Set("Access-Control-Allow-Origin", "*")
header.Add("Access-Control-Allow-Headers", "UserHeader1, UserHeader2")
header.Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, PATCH")
header.Set("Access-Control-Expose-Headers", "Content-Length, Content-Type")
}
}

View File

@@ -1,7 +1,16 @@
package middleware package middleware
import "net/http" import (
"net/http"
func I18nMiddleware(w http.ResponseWriter, r *http.Request) { "golang.org/x/text/language"
"schisandra-album-cloud-microservices/common/i18n"
)
func I18nMiddleware(next http.HandlerFunc) http.HandlerFunc {
return i18n.NewI18nMiddleware([]language.Tag{
language.English,
language.Chinese,
}, []string{"../../resources/language/active.en.toml", "../../resources/language/active.zh.toml"}).Handle(next)
} }

2
go.mod
View File

@@ -11,6 +11,7 @@ require (
require ( require (
ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 // indirect ariga.io/atlas v0.19.1-0.20240203083654-5948b60a8e43 // indirect
filippo.io/edwards25519 v1.1.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/agext/levenshtein v1.2.1 // indirect github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
@@ -30,6 +31,7 @@ require (
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nicksnyder/go-i18n/v2 v2.4.1 // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/prometheus/client_golang v1.20.5 // indirect github.com/prometheus/client_golang v1.20.5 // indirect

4
go.sum
View File

@@ -4,6 +4,8 @@ entgo.io/ent v0.14.1 h1:fUERL506Pqr92EPHJqr8EYxbPioflJo6PudkrEA8a/s=
entgo.io/ent v0.14.1/go.mod h1:MH6XLG0KXpkcDQhKiHfANZSzR55TJyPL5IGNpI8wpco= entgo.io/ent v0.14.1/go.mod h1:MH6XLG0KXpkcDQhKiHfANZSzR55TJyPL5IGNpI8wpco=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU= github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
@@ -73,6 +75,8 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzC
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
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/go.mod h1:++Pl70FR6Cki7hdzZRnEEqdc2dJt+SAGotyFg/SvZMk=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= 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/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg= github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=

View File

@@ -0,0 +1,2 @@
[user]
name = "John Doe"

View File

@@ -0,0 +1,2 @@
[user]
name = "张三"