12
This commit is contained in:
62
internal/ent/schema/cloudflarer2.go
Normal file
62
internal/ent/schema/cloudflarer2.go
Normal file
@ -0,0 +1,62 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CloudflareR2 holds the schema definition for the CloudflareR2 entity.
|
||||
type CloudflareR2 struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the CloudflareR2.
|
||||
func (CloudflareR2) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("owner_id").Comment("业务归属标识"),
|
||||
field.String("name").
|
||||
NotEmpty().
|
||||
Comment("桶名称(唯一)"),
|
||||
field.String("location").
|
||||
NotEmpty().
|
||||
Comment("桶区域,如 apac、eea、us"),
|
||||
field.String("storage_class").
|
||||
NotEmpty().
|
||||
Comment("存储类型,如 standard、infrequent-access"),
|
||||
field.Int8("status").
|
||||
Default(1).
|
||||
Comment("状态:1=启用,0=禁用"),
|
||||
field.Int64("payload_size").
|
||||
Default(0).
|
||||
Comment("对象数据体积(payloadSize),单位字节"),
|
||||
|
||||
field.Int64("metadata_size").
|
||||
Default(0).
|
||||
Comment("对象元数据大小(metadataSize),单位字节"),
|
||||
field.Int("object_count").
|
||||
Default(0).
|
||||
Comment("存储桶内对象总数"),
|
||||
field.Text("remark").
|
||||
Optional().
|
||||
Comment("备注"),
|
||||
field.Time("created_at").
|
||||
Default(time.Now).
|
||||
Immutable(),
|
||||
field.Time("updated_at").
|
||||
Default(time.Now).
|
||||
UpdateDefault(time.Now),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the CloudflareR2.
|
||||
func (CloudflareR2) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("cloudflare_account", CloudflareAccounts.Type).
|
||||
Ref("cloudflare_buckets").
|
||||
Unique().
|
||||
Required().
|
||||
Comment("所属 Cloudflare 账户"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user