1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package schema
- import (
- "entgo.io/ent/schema/index"
- "wechat-api/ent/schema/localmixin"
- "entgo.io/ent"
- "entgo.io/ent/dialect/entsql"
- "entgo.io/ent/schema"
- "entgo.io/ent/schema/field"
- "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
- )
- type CreditBalance struct {
- ent.Schema
- }
- func (CreditBalance) Fields() []ent.Field {
- return []ent.Field{
- field.String("user_id").Optional().Comment("user_id | 用户ID"),
- field.Float32("balance").Comment("role | 角色设定"),
- field.Int("status").Optional().Range(1, 2).Default(1).Comment("status | 状态 1-正常 2-禁用"),
- field.Uint64("organization_id").Optional().Comment("organization_id | 租户ID"),
- }
- }
- func (CreditBalance) Mixin() []ent.Mixin {
- return []ent.Mixin{
- mixins.IDMixin{},
- localmixin.SoftDeleteMixin{},
- }
- }
- func (CreditBalance) Edges() []ent.Edge {
- return nil
- }
- func (CreditBalance) Indexes() []ent.Index {
- return []ent.Index{
- index.Fields("user_id"),
- index.Fields("organization_id"),
- }
- }
- func (CreditBalance) Annotations() []schema.Annotation {
- return []schema.Annotation{
- entsql.WithComments(true),
- entsql.Annotation{Table: "credit_balance"},
- }
- }
|