mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
34 lines
734 B
Go
34 lines
734 B
Go
// Copyright 2019-present Facebook Inc. All rights reserved.
|
|
// This source code is licensed under the Apache 2.0 license found
|
|
// in the LICENSE file in the root directory of this source tree.
|
|
|
|
package schema
|
|
|
|
import (
|
|
"github.com/facebook/ent"
|
|
"github.com/facebook/ent/schema/field"
|
|
"github.com/facebook/ent/schema/index"
|
|
)
|
|
|
|
// Media holds the schema definition for the Media entity.
|
|
type Media struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Media.
|
|
func (Media) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("source").
|
|
Optional(),
|
|
field.String("source_uri").
|
|
Optional(),
|
|
}
|
|
}
|
|
|
|
// Indexes of the Media.
|
|
func (Media) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("source", "source_uri").Unique(),
|
|
}
|
|
}
|