2 Star 0 Fork 0

广东宇凌网络科技有限公司/simple-iot-basic-rpc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
company.go 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
HienGee 提交于 2024-04-26 11:19 . init
package schema
import (
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"github.com/suyuan32/simple-admin-common/orm/ent/mixins"
)
// Company holds the schema definition for the Company entity.
type Company struct {
ent.Schema
}
// Fields of the Company.
func (Company) Fields() []ent.Field {
return []ent.Field{
field.Int32("code").
Comment("Code | 公司编码").
Annotations(entsql.WithComments(true)),
field.String("nickname").
Comment("Nickname | 公司简称").
Annotations(entsql.WithComments(true)),
field.String("address").
Optional().
Comment("Address | 公司地址").
Annotations(entsql.WithComments(true)),
field.String("remark").
Optional().
Comment("Remark | 备注").
Annotations(entsql.WithComments(true)),
}
}
// Edges of the Company.
func (Company) Edges() []ent.Edge {
return []ent.Edge{
edge.To("devices", Device.Type),
edge.To("members", Member.Type),
}
}
// Mixin of the Company.
func (Company) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.IDMixin{},
mixins.StatusMixin{},
mixins.SortMixin{},
}
}
// Indexes of the Company.
func (Company) Indexes() []ent.Index {
return nil
}
// Annotations of the Company
func (Company) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "client_companies"},
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/yuLingNet/simple-iot-basic-rpc.git
git@gitee.com:yuLingNet/simple-iot-basic-rpc.git
yuLingNet
simple-iot-basic-rpc
simple-iot-basic-rpc
ca5a4cf0cee7

搜索帮助