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

View File

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