snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
Atlas CI Public / lint (push) Failing after 13s
Atlas CI Public / sync (push) Has been skipped

This commit is contained in:
upstream-mirror
2026-09-15 22:12:36 +05:00
commit 4b3ad0b611
2680 changed files with 719472 additions and 0 deletions

View File

@@ -0,0 +1,208 @@
// 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.
// Code generated by ent, DO NOT EDIT.
package file
import (
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the file type in the database.
Label = "file"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldSetID holds the string denoting the set_id field in the database.
FieldSetID = "set_id"
// FieldSize holds the string denoting the size field in the database.
FieldSize = "fsize"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
// FieldUser holds the string denoting the user field in the database.
FieldUser = "user"
// FieldGroup holds the string denoting the group field in the database.
FieldGroup = "group"
// FieldOp holds the string denoting the op field in the database.
FieldOp = "op"
// FieldFieldID holds the string denoting the field_id field in the database.
FieldFieldID = "field_id"
// FieldCreateTime holds the string denoting the create_time field in the database.
FieldCreateTime = "create_time"
// EdgeOwner holds the string denoting the owner edge name in mutations.
EdgeOwner = "owner"
// EdgeType holds the string denoting the type edge name in mutations.
EdgeType = "type"
// EdgeField holds the string denoting the field edge name in mutations.
EdgeField = "field"
// Table holds the table name of the file in the database.
Table = "files"
// OwnerTable is the table that holds the owner relation/edge.
OwnerTable = "files"
// OwnerInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
OwnerInverseTable = "users"
// OwnerColumn is the table column denoting the owner relation/edge.
OwnerColumn = "user_files"
// TypeTable is the table that holds the type relation/edge.
TypeTable = "files"
// TypeInverseTable is the table name for the FileType entity.
// It exists in this package in order to avoid circular dependency with the "filetype" package.
TypeInverseTable = "file_types"
// TypeColumn is the table column denoting the type relation/edge.
TypeColumn = "file_type_files"
// FieldTable is the table that holds the field relation/edge.
FieldTable = "field_types"
// FieldInverseTable is the table name for the FieldType entity.
// It exists in this package in order to avoid circular dependency with the "fieldtype" package.
FieldInverseTable = "field_types"
// FieldColumn is the table column denoting the field relation/edge.
FieldColumn = "file_field"
)
// Columns holds all SQL columns for file fields.
var Columns = []string{
FieldID,
FieldSetID,
FieldSize,
FieldName,
FieldUser,
FieldGroup,
FieldOp,
FieldFieldID,
FieldCreateTime,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "files"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"file_type_files",
"group_files",
"user_files",
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
var (
// SetIDValidator is a validator for the "set_id" field. It is called by the builders before save.
SetIDValidator func(int) error
// DefaultSize holds the default value on creation for the "size" field.
DefaultSize int
// SizeValidator is a validator for the "size" field. It is called by the builders before save.
SizeValidator func(int) error
)
// OrderOption defines the ordering options for the File queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// BySetID orders the results by the set_id field.
func BySetID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSetID, opts...).ToFunc()
}
// BySize orders the results by the size field.
func BySize(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSize, opts...).ToFunc()
}
// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
// ByUser orders the results by the user field.
func ByUser(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUser, opts...).ToFunc()
}
// ByGroup orders the results by the group field.
func ByGroup(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldGroup, opts...).ToFunc()
}
// ByOp orders the results by the op field.
func ByOp(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldOp, opts...).ToFunc()
}
// ByFieldID orders the results by the field_id field.
func ByFieldID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldFieldID, opts...).ToFunc()
}
// ByCreateTime orders the results by the create_time field.
func ByCreateTime(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreateTime, opts...).ToFunc()
}
// ByOwnerField orders the results by owner field.
func ByOwnerField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newOwnerStep(), sql.OrderByField(field, opts...))
}
}
// ByTypeField orders the results by type field.
func ByTypeField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTypeStep(), sql.OrderByField(field, opts...))
}
}
// ByFieldCount orders the results by field count.
func ByFieldCount(opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborsCount(s, newFieldStep(), opts...)
}
}
// ByField orders the results by field terms.
func ByField(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newFieldStep(), append([]sql.OrderTerm{term}, terms...)...)
}
}
func newOwnerStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(OwnerInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
)
}
func newTypeStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TypeInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, TypeTable, TypeColumn),
)
}
func newFieldStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(FieldInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, FieldTable, FieldColumn),
)
}
// comment from another template.

View File

@@ -0,0 +1,911 @@
// 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.
// Code generated by ent, DO NOT EDIT.
package file
import (
"context"
"fmt"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/entc/integration/ent/predicate"
)
// Mutation represents an operation that mutates the File nodes in the graph.
type Mutation struct {
op ent.Op
typ string
set_id *int
addset_id *int
size *int
addsize *int
name *string
user *string
group *string
_op *bool
field_id *int
addfield_id *int
create_time *time.Time
clearedFields map[string]struct{}
owner *int
clearedowner bool
_type *int
cleared_type bool
field map[int]struct{}
removedfield map[int]struct{}
clearedfield bool
predicates []predicate.File
}
// NewMutation creates a new Mutation for the File entity.
func NewMutation(op ent.Op) *Mutation {
return &Mutation{
op: op,
typ: "File",
clearedFields: make(map[string]struct{}),
}
}
// Predicates returns the list of predicates set on the mutation.
func (m *Mutation) Predicates() []predicate.File {
return m.predicates
}
// SetSetID sets the "set_id" field.
func (m *Mutation) SetSetID(i int) {
m.set_id = &i
m.addset_id = nil
}
// SetID returns the value of the "set_id" field in the mutation.
func (m *Mutation) SetID() (r int, exists bool) {
v := m.set_id
if v == nil {
return
}
return *v, true
}
// AddSetID adds i to the "set_id" field.
func (m *Mutation) AddSetID(i int) {
if m.addset_id != nil {
*m.addset_id += i
} else {
m.addset_id = &i
}
}
// AddedSetID returns the value that was added to the "set_id" field in this mutation.
func (m *Mutation) AddedSetID() (r int, exists bool) {
v := m.addset_id
if v == nil {
return
}
return *v, true
}
// ClearSetID clears the value of the "set_id" field.
func (m *Mutation) ClearSetID() {
m.set_id = nil
m.addset_id = nil
m.clearedFields[FieldSetID] = struct{}{}
}
// SetIDCleared returns if the "set_id" field was cleared in this mutation.
func (m *Mutation) SetIDCleared() bool {
_, ok := m.clearedFields[FieldSetID]
return ok
}
// ResetSetID resets all changes to the "set_id" field.
func (m *Mutation) ResetSetID() {
m.set_id = nil
m.addset_id = nil
delete(m.clearedFields, FieldSetID)
}
// SetSize sets the "size" field.
func (m *Mutation) SetSize(i int) {
m.size = &i
m.addsize = nil
}
// Size returns the value of the "size" field in the mutation.
func (m *Mutation) Size() (r int, exists bool) {
v := m.size
if v == nil {
return
}
return *v, true
}
// AddSize adds i to the "size" field.
func (m *Mutation) AddSize(i int) {
if m.addsize != nil {
*m.addsize += i
} else {
m.addsize = &i
}
}
// AddedSize returns the value that was added to the "size" field in this mutation.
func (m *Mutation) AddedSize() (r int, exists bool) {
v := m.addsize
if v == nil {
return
}
return *v, true
}
// ResetSize resets all changes to the "size" field.
func (m *Mutation) ResetSize() {
m.size = nil
m.addsize = nil
}
// SetName sets the "name" field.
func (m *Mutation) SetName(s string) {
m.name = &s
}
// Name returns the value of the "name" field in the mutation.
func (m *Mutation) Name() (r string, exists bool) {
v := m.name
if v == nil {
return
}
return *v, true
}
// ResetName resets all changes to the "name" field.
func (m *Mutation) ResetName() {
m.name = nil
}
// SetUser sets the "user" field.
func (m *Mutation) SetUser(s string) {
m.user = &s
}
// User returns the value of the "user" field in the mutation.
func (m *Mutation) User() (r string, exists bool) {
v := m.user
if v == nil {
return
}
return *v, true
}
// ClearUser clears the value of the "user" field.
func (m *Mutation) ClearUser() {
m.user = nil
m.clearedFields[FieldUser] = struct{}{}
}
// UserCleared returns if the "user" field was cleared in this mutation.
func (m *Mutation) UserCleared() bool {
_, ok := m.clearedFields[FieldUser]
return ok
}
// ResetUser resets all changes to the "user" field.
func (m *Mutation) ResetUser() {
m.user = nil
delete(m.clearedFields, FieldUser)
}
// SetGroup sets the "group" field.
func (m *Mutation) SetGroup(s string) {
m.group = &s
}
// Group returns the value of the "group" field in the mutation.
func (m *Mutation) Group() (r string, exists bool) {
v := m.group
if v == nil {
return
}
return *v, true
}
// ClearGroup clears the value of the "group" field.
func (m *Mutation) ClearGroup() {
m.group = nil
m.clearedFields[FieldGroup] = struct{}{}
}
// GroupCleared returns if the "group" field was cleared in this mutation.
func (m *Mutation) GroupCleared() bool {
_, ok := m.clearedFields[FieldGroup]
return ok
}
// ResetGroup resets all changes to the "group" field.
func (m *Mutation) ResetGroup() {
m.group = nil
delete(m.clearedFields, FieldGroup)
}
// SetOpField sets the "op" field.
func (m *Mutation) SetOpField(b bool) {
m._op = &b
}
// GetOp returns the value of the "op" field in the mutation.
func (m *Mutation) GetOp() (r bool, exists bool) {
v := m._op
if v == nil {
return
}
return *v, true
}
// ClearOp clears the value of the "op" field.
func (m *Mutation) ClearOp() {
m._op = nil
m.clearedFields[FieldOp] = struct{}{}
}
// OpCleared returns if the "op" field was cleared in this mutation.
func (m *Mutation) OpCleared() bool {
_, ok := m.clearedFields[FieldOp]
return ok
}
// ResetOp resets all changes to the "op" field.
func (m *Mutation) ResetOp() {
m._op = nil
delete(m.clearedFields, FieldOp)
}
// SetFieldID sets the "field_id" field.
func (m *Mutation) SetFieldID(i int) {
m.field_id = &i
m.addfield_id = nil
}
// FieldID returns the value of the "field_id" field in the mutation.
func (m *Mutation) FieldID() (r int, exists bool) {
v := m.field_id
if v == nil {
return
}
return *v, true
}
// AddFieldID adds i to the "field_id" field.
func (m *Mutation) AddFieldID(i int) {
if m.addfield_id != nil {
*m.addfield_id += i
} else {
m.addfield_id = &i
}
}
// AddedFieldID returns the value that was added to the "field_id" field in this mutation.
func (m *Mutation) AddedFieldID() (r int, exists bool) {
v := m.addfield_id
if v == nil {
return
}
return *v, true
}
// ClearFieldID clears the value of the "field_id" field.
func (m *Mutation) ClearFieldID() {
m.field_id = nil
m.addfield_id = nil
m.clearedFields[FieldFieldID] = struct{}{}
}
// FieldIDCleared returns if the "field_id" field was cleared in this mutation.
func (m *Mutation) FieldIDCleared() bool {
_, ok := m.clearedFields[FieldFieldID]
return ok
}
// ResetFieldID resets all changes to the "field_id" field.
func (m *Mutation) ResetFieldID() {
m.field_id = nil
m.addfield_id = nil
delete(m.clearedFields, FieldFieldID)
}
// SetCreateTime sets the "create_time" field.
func (m *Mutation) SetCreateTime(t time.Time) {
m.create_time = &t
}
// CreateTime returns the value of the "create_time" field in the mutation.
func (m *Mutation) CreateTime() (r time.Time, exists bool) {
v := m.create_time
if v == nil {
return
}
return *v, true
}
// ClearCreateTime clears the value of the "create_time" field.
func (m *Mutation) ClearCreateTime() {
m.create_time = nil
m.clearedFields[FieldCreateTime] = struct{}{}
}
// CreateTimeCleared returns if the "create_time" field was cleared in this mutation.
func (m *Mutation) CreateTimeCleared() bool {
_, ok := m.clearedFields[FieldCreateTime]
return ok
}
// ResetCreateTime resets all changes to the "create_time" field.
func (m *Mutation) ResetCreateTime() {
m.create_time = nil
delete(m.clearedFields, FieldCreateTime)
}
// SetOwnerID sets the "owner" edge to the User entity by id.
func (m *Mutation) SetOwnerID(id int) {
m.owner = &id
}
// ClearOwner clears the "owner" edge to the User entity.
func (m *Mutation) ClearOwner() {
m.clearedowner = true
}
// OwnerCleared reports if the "owner" edge to the User entity was cleared.
func (m *Mutation) OwnerCleared() bool {
return m.clearedowner
}
// OwnerID returns the "owner" edge ID in the mutation.
func (m *Mutation) OwnerID() (id int, exists bool) {
if m.owner != nil {
return *m.owner, true
}
return
}
// OwnerIDs returns the "owner" edge IDs in the mutation.
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
// OwnerID instead. It exists only for internal usage by the builders.
func (m *Mutation) OwnerIDs() (ids []int) {
if id := m.owner; id != nil {
ids = append(ids, *id)
}
return
}
// ResetOwner resets all changes to the "owner" edge.
func (m *Mutation) ResetOwner() {
m.owner = nil
m.clearedowner = false
}
// SetTypeID sets the "type" edge to the FileType entity by id.
func (m *Mutation) SetTypeID(id int) {
m._type = &id
}
// ClearType clears the "type" edge to the FileType entity.
func (m *Mutation) ClearType() {
m.cleared_type = true
}
// TypeCleared reports if the "type" edge to the FileType entity was cleared.
func (m *Mutation) TypeCleared() bool {
return m.cleared_type
}
// TypeID returns the "type" edge ID in the mutation.
func (m *Mutation) TypeID() (id int, exists bool) {
if m._type != nil {
return *m._type, true
}
return
}
// TypeIDs returns the "type" edge IDs in the mutation.
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
// TypeID instead. It exists only for internal usage by the builders.
func (m *Mutation) TypeIDs() (ids []int) {
if id := m._type; id != nil {
ids = append(ids, *id)
}
return
}
// ResetType resets all changes to the "type" edge.
func (m *Mutation) ResetType() {
m._type = nil
m.cleared_type = false
}
// AddFieldIDs adds the "field" edge to the FieldType entity by ids.
func (m *Mutation) AddFieldIDs(ids ...int) {
if m.field == nil {
m.field = make(map[int]struct{})
}
for i := range ids {
m.field[ids[i]] = struct{}{}
}
}
// ClearFieldEdge clears the "field" edge to the FieldType entity.
func (m *Mutation) ClearFieldEdge() {
m.clearedfield = true
}
// FieldEdgeCleared reports if the "field" edge to the FieldType entity was cleared.
func (m *Mutation) FieldEdgeCleared() bool {
return m.clearedfield
}
// RemoveFieldIDs removes the "field" edge to the FieldType entity by IDs.
func (m *Mutation) RemoveFieldIDs(ids ...int) {
if m.removedfield == nil {
m.removedfield = make(map[int]struct{})
}
for i := range ids {
delete(m.field, ids[i])
m.removedfield[ids[i]] = struct{}{}
}
}
// RemovedField returns the removed IDs of the "field" edge to the FieldType entity.
func (m *Mutation) RemovedFieldIDs() (ids []int) {
for id := range m.removedfield {
ids = append(ids, id)
}
return
}
// FieldIDs returns the "field" edge IDs in the mutation.
func (m *Mutation) FieldIDs() (ids []int) {
for id := range m.field {
ids = append(ids, id)
}
return
}
// ResetFieldEdge resets all changes to the "field" edge.
func (m *Mutation) ResetFieldEdge() {
m.field = nil
m.clearedfield = false
m.removedfield = nil
}
// Where appends a list predicates to the Mutation builder.
func (m *Mutation) Where(ps ...predicate.File) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the Mutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *Mutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.File, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *Mutation) Op() ent.Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *Mutation) SetOp(op ent.Op) {
m.op = op
}
// Type returns the node type of this mutation (File).
func (m *Mutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *Mutation) Fields() []string {
fields := make([]string, 0, 8)
if m.set_id != nil {
fields = append(fields, FieldSetID)
}
if m.size != nil {
fields = append(fields, FieldSize)
}
if m.name != nil {
fields = append(fields, FieldName)
}
if m.user != nil {
fields = append(fields, FieldUser)
}
if m.group != nil {
fields = append(fields, FieldGroup)
}
if m._op != nil {
fields = append(fields, FieldOp)
}
if m.field_id != nil {
fields = append(fields, FieldFieldID)
}
if m.create_time != nil {
fields = append(fields, FieldCreateTime)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *Mutation) Field(name string) (ent.Value, bool) {
switch name {
case FieldSetID:
return m.SetID()
case FieldSize:
return m.Size()
case FieldName:
return m.Name()
case FieldUser:
return m.User()
case FieldGroup:
return m.Group()
case FieldOp:
return m.GetOp()
case FieldFieldID:
return m.FieldID()
case FieldCreateTime:
return m.CreateTime()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *Mutation) OldField(ctx context.Context, name string) (ent.Value, error) {
return nil, fmt.Errorf("unknown File field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *Mutation) SetField(name string, value ent.Value) error {
switch name {
case FieldSetID:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSetID(v)
return nil
case FieldSize:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetSize(v)
return nil
case FieldName:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetName(v)
return nil
case FieldUser:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUser(v)
return nil
case FieldGroup:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetGroup(v)
return nil
case FieldOp:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetOpField(v)
return nil
case FieldFieldID:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetFieldID(v)
return nil
case FieldCreateTime:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreateTime(v)
return nil
}
return fmt.Errorf("unknown File field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *Mutation) AddedFields() []string {
var fields []string
if m.addset_id != nil {
fields = append(fields, FieldSetID)
}
if m.addsize != nil {
fields = append(fields, FieldSize)
}
if m.addfield_id != nil {
fields = append(fields, FieldFieldID)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *Mutation) AddedField(name string) (ent.Value, bool) {
switch name {
case FieldSetID:
return m.AddedSetID()
case FieldSize:
return m.AddedSize()
case FieldFieldID:
return m.AddedFieldID()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *Mutation) AddField(name string, value ent.Value) error {
switch name {
case FieldSetID:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddSetID(v)
return nil
case FieldSize:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddSize(v)
return nil
case FieldFieldID:
v, ok := value.(int)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddFieldID(v)
return nil
}
return fmt.Errorf("unknown File numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *Mutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(FieldSetID) {
fields = append(fields, FieldSetID)
}
if m.FieldCleared(FieldUser) {
fields = append(fields, FieldUser)
}
if m.FieldCleared(FieldGroup) {
fields = append(fields, FieldGroup)
}
if m.FieldCleared(FieldOp) {
fields = append(fields, FieldOp)
}
if m.FieldCleared(FieldFieldID) {
fields = append(fields, FieldFieldID)
}
if m.FieldCleared(FieldCreateTime) {
fields = append(fields, FieldCreateTime)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *Mutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *Mutation) ClearField(name string) error {
switch name {
case FieldSetID:
m.ClearSetID()
return nil
case FieldUser:
m.ClearUser()
return nil
case FieldGroup:
m.ClearGroup()
return nil
case FieldOp:
m.ClearOp()
return nil
case FieldFieldID:
m.ClearFieldID()
return nil
case FieldCreateTime:
m.ClearCreateTime()
return nil
}
return fmt.Errorf("unknown File nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *Mutation) ResetField(name string) error {
switch name {
case FieldSetID:
m.ResetSetID()
return nil
case FieldSize:
m.ResetSize()
return nil
case FieldName:
m.ResetName()
return nil
case FieldUser:
m.ResetUser()
return nil
case FieldGroup:
m.ResetGroup()
return nil
case FieldOp:
m.ResetOp()
return nil
case FieldFieldID:
m.ResetFieldID()
return nil
case FieldCreateTime:
m.ResetCreateTime()
return nil
}
return fmt.Errorf("unknown File field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *Mutation) AddedEdges() []string {
edges := make([]string, 0, 3)
if m.owner != nil {
edges = append(edges, EdgeOwner)
}
if m._type != nil {
edges = append(edges, EdgeType)
}
if m.field != nil {
edges = append(edges, EdgeField)
}
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *Mutation) AddedIDs(name string) []ent.Value {
switch name {
case EdgeOwner:
if id := m.owner; id != nil {
return []ent.Value{*id}
}
case EdgeType:
if id := m._type; id != nil {
return []ent.Value{*id}
}
case EdgeField:
ids := make([]ent.Value, 0, len(m.field))
for id := range m.field {
ids = append(ids, id)
}
return ids
}
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *Mutation) RemovedEdges() []string {
edges := make([]string, 0, 3)
if m.removedfield != nil {
edges = append(edges, EdgeField)
}
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *Mutation) RemovedIDs(name string) []ent.Value {
switch name {
case EdgeField:
ids := make([]ent.Value, 0, len(m.removedfield))
for id := range m.removedfield {
ids = append(ids, id)
}
return ids
}
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *Mutation) ClearedEdges() []string {
edges := make([]string, 0, 3)
if m.clearedowner {
edges = append(edges, EdgeOwner)
}
if m.cleared_type {
edges = append(edges, EdgeType)
}
if m.clearedfield {
edges = append(edges, EdgeField)
}
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *Mutation) EdgeCleared(name string) bool {
switch name {
case EdgeOwner:
return m.clearedowner
case EdgeType:
return m.cleared_type
case EdgeField:
return m.clearedfield
}
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *Mutation) ClearEdge(name string) error {
switch name {
case EdgeOwner:
m.ClearOwner()
return nil
case EdgeType:
m.ClearType()
return nil
}
return fmt.Errorf("unknown File unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *Mutation) ResetEdge(name string) error {
switch name {
case EdgeOwner:
m.ResetOwner()
return nil
case EdgeType:
m.ResetType()
return nil
case EdgeField:
m.ResetFieldEdge()
return nil
}
return fmt.Errorf("unknown File edge %s", name)
}

View File

@@ -0,0 +1,604 @@
// 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.
// Code generated by ent, DO NOT EDIT.
package file
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/entc/integration/ent/predicate"
)
// ID filters vertices based on their ID field.
func ID(id int) predicate.File {
return predicate.File(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int) predicate.File {
return predicate.File(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int) predicate.File {
return predicate.File(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int) predicate.File {
return predicate.File(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int) predicate.File {
return predicate.File(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int) predicate.File {
return predicate.File(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int) predicate.File {
return predicate.File(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int) predicate.File {
return predicate.File(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int) predicate.File {
return predicate.File(sql.FieldLTE(FieldID, id))
}
// SetID applies equality check predicate on the "set_id" field. It's identical to SetIDEQ.
func SetID(v int) predicate.File {
return predicate.File(sql.FieldEQ(FieldSetID, v))
}
// Size applies equality check predicate on the "size" field. It's identical to SizeEQ.
func Size(v int) predicate.File {
return predicate.File(sql.FieldEQ(FieldSize, v))
}
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
func Name(v string) predicate.File {
return predicate.File(sql.FieldEQ(FieldName, v))
}
// User applies equality check predicate on the "user" field. It's identical to UserEQ.
func User(v string) predicate.File {
return predicate.File(sql.FieldEQ(FieldUser, v))
}
// Group applies equality check predicate on the "group" field. It's identical to GroupEQ.
func Group(v string) predicate.File {
return predicate.File(sql.FieldEQ(FieldGroup, v))
}
// Op applies equality check predicate on the "op" field. It's identical to OpEQ.
func Op(v bool) predicate.File {
return predicate.File(sql.FieldEQ(FieldOp, v))
}
// CreateTime applies equality check predicate on the "create_time" field. It's identical to CreateTimeEQ.
func CreateTime(v time.Time) predicate.File {
return predicate.File(sql.FieldEQ(FieldCreateTime, v))
}
// SetIDEQ applies the EQ predicate on the "set_id" field.
func SetIDEQ(v int) predicate.File {
return predicate.File(sql.FieldEQ(FieldSetID, v))
}
// SetIDNEQ applies the NEQ predicate on the "set_id" field.
func SetIDNEQ(v int) predicate.File {
return predicate.File(sql.FieldNEQ(FieldSetID, v))
}
// SetIDIn applies the In predicate on the "set_id" field.
func SetIDIn(vs ...int) predicate.File {
return predicate.File(sql.FieldIn(FieldSetID, vs...))
}
// SetIDNotIn applies the NotIn predicate on the "set_id" field.
func SetIDNotIn(vs ...int) predicate.File {
return predicate.File(sql.FieldNotIn(FieldSetID, vs...))
}
// SetIDGT applies the GT predicate on the "set_id" field.
func SetIDGT(v int) predicate.File {
return predicate.File(sql.FieldGT(FieldSetID, v))
}
// SetIDGTE applies the GTE predicate on the "set_id" field.
func SetIDGTE(v int) predicate.File {
return predicate.File(sql.FieldGTE(FieldSetID, v))
}
// SetIDLT applies the LT predicate on the "set_id" field.
func SetIDLT(v int) predicate.File {
return predicate.File(sql.FieldLT(FieldSetID, v))
}
// SetIDLTE applies the LTE predicate on the "set_id" field.
func SetIDLTE(v int) predicate.File {
return predicate.File(sql.FieldLTE(FieldSetID, v))
}
// SetIDIsNil applies the IsNil predicate on the "set_id" field.
func SetIDIsNil() predicate.File {
return predicate.File(sql.FieldIsNull(FieldSetID))
}
// SetIDNotNil applies the NotNil predicate on the "set_id" field.
func SetIDNotNil() predicate.File {
return predicate.File(sql.FieldNotNull(FieldSetID))
}
// SizeEQ applies the EQ predicate on the "size" field.
func SizeEQ(v int) predicate.File {
return predicate.File(sql.FieldEQ(FieldSize, v))
}
// SizeNEQ applies the NEQ predicate on the "size" field.
func SizeNEQ(v int) predicate.File {
return predicate.File(sql.FieldNEQ(FieldSize, v))
}
// SizeIn applies the In predicate on the "size" field.
func SizeIn(vs ...int) predicate.File {
return predicate.File(sql.FieldIn(FieldSize, vs...))
}
// SizeNotIn applies the NotIn predicate on the "size" field.
func SizeNotIn(vs ...int) predicate.File {
return predicate.File(sql.FieldNotIn(FieldSize, vs...))
}
// SizeGT applies the GT predicate on the "size" field.
func SizeGT(v int) predicate.File {
return predicate.File(sql.FieldGT(FieldSize, v))
}
// SizeGTE applies the GTE predicate on the "size" field.
func SizeGTE(v int) predicate.File {
return predicate.File(sql.FieldGTE(FieldSize, v))
}
// SizeLT applies the LT predicate on the "size" field.
func SizeLT(v int) predicate.File {
return predicate.File(sql.FieldLT(FieldSize, v))
}
// SizeLTE applies the LTE predicate on the "size" field.
func SizeLTE(v int) predicate.File {
return predicate.File(sql.FieldLTE(FieldSize, v))
}
// NameEQ applies the EQ predicate on the "name" field.
func NameEQ(v string) predicate.File {
return predicate.File(sql.FieldEQ(FieldName, v))
}
// NameNEQ applies the NEQ predicate on the "name" field.
func NameNEQ(v string) predicate.File {
return predicate.File(sql.FieldNEQ(FieldName, v))
}
// NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.File {
return predicate.File(sql.FieldIn(FieldName, vs...))
}
// NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.File {
return predicate.File(sql.FieldNotIn(FieldName, vs...))
}
// NameGT applies the GT predicate on the "name" field.
func NameGT(v string) predicate.File {
return predicate.File(sql.FieldGT(FieldName, v))
}
// NameGTE applies the GTE predicate on the "name" field.
func NameGTE(v string) predicate.File {
return predicate.File(sql.FieldGTE(FieldName, v))
}
// NameLT applies the LT predicate on the "name" field.
func NameLT(v string) predicate.File {
return predicate.File(sql.FieldLT(FieldName, v))
}
// NameLTE applies the LTE predicate on the "name" field.
func NameLTE(v string) predicate.File {
return predicate.File(sql.FieldLTE(FieldName, v))
}
// NameContains applies the Contains predicate on the "name" field.
func NameContains(v string) predicate.File {
return predicate.File(sql.FieldContains(FieldName, v))
}
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
func NameHasPrefix(v string) predicate.File {
return predicate.File(sql.FieldHasPrefix(FieldName, v))
}
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
func NameHasSuffix(v string) predicate.File {
return predicate.File(sql.FieldHasSuffix(FieldName, v))
}
// NameEqualFold applies the EqualFold predicate on the "name" field.
func NameEqualFold(v string) predicate.File {
return predicate.File(sql.FieldEqualFold(FieldName, v))
}
// NameContainsFold applies the ContainsFold predicate on the "name" field.
func NameContainsFold(v string) predicate.File {
return predicate.File(sql.FieldContainsFold(FieldName, v))
}
// UserEQ applies the EQ predicate on the "user" field.
func UserEQ(v string) predicate.File {
return predicate.File(sql.FieldEQ(FieldUser, v))
}
// UserNEQ applies the NEQ predicate on the "user" field.
func UserNEQ(v string) predicate.File {
return predicate.File(sql.FieldNEQ(FieldUser, v))
}
// UserIn applies the In predicate on the "user" field.
func UserIn(vs ...string) predicate.File {
return predicate.File(sql.FieldIn(FieldUser, vs...))
}
// UserNotIn applies the NotIn predicate on the "user" field.
func UserNotIn(vs ...string) predicate.File {
return predicate.File(sql.FieldNotIn(FieldUser, vs...))
}
// UserGT applies the GT predicate on the "user" field.
func UserGT(v string) predicate.File {
return predicate.File(sql.FieldGT(FieldUser, v))
}
// UserGTE applies the GTE predicate on the "user" field.
func UserGTE(v string) predicate.File {
return predicate.File(sql.FieldGTE(FieldUser, v))
}
// UserLT applies the LT predicate on the "user" field.
func UserLT(v string) predicate.File {
return predicate.File(sql.FieldLT(FieldUser, v))
}
// UserLTE applies the LTE predicate on the "user" field.
func UserLTE(v string) predicate.File {
return predicate.File(sql.FieldLTE(FieldUser, v))
}
// UserContains applies the Contains predicate on the "user" field.
func UserContains(v string) predicate.File {
return predicate.File(sql.FieldContains(FieldUser, v))
}
// UserHasPrefix applies the HasPrefix predicate on the "user" field.
func UserHasPrefix(v string) predicate.File {
return predicate.File(sql.FieldHasPrefix(FieldUser, v))
}
// UserHasSuffix applies the HasSuffix predicate on the "user" field.
func UserHasSuffix(v string) predicate.File {
return predicate.File(sql.FieldHasSuffix(FieldUser, v))
}
// UserIsNil applies the IsNil predicate on the "user" field.
func UserIsNil() predicate.File {
return predicate.File(sql.FieldIsNull(FieldUser))
}
// UserNotNil applies the NotNil predicate on the "user" field.
func UserNotNil() predicate.File {
return predicate.File(sql.FieldNotNull(FieldUser))
}
// UserEqualFold applies the EqualFold predicate on the "user" field.
func UserEqualFold(v string) predicate.File {
return predicate.File(sql.FieldEqualFold(FieldUser, v))
}
// UserContainsFold applies the ContainsFold predicate on the "user" field.
func UserContainsFold(v string) predicate.File {
return predicate.File(sql.FieldContainsFold(FieldUser, v))
}
// GroupEQ applies the EQ predicate on the "group" field.
func GroupEQ(v string) predicate.File {
return predicate.File(sql.FieldEQ(FieldGroup, v))
}
// GroupNEQ applies the NEQ predicate on the "group" field.
func GroupNEQ(v string) predicate.File {
return predicate.File(sql.FieldNEQ(FieldGroup, v))
}
// GroupIn applies the In predicate on the "group" field.
func GroupIn(vs ...string) predicate.File {
return predicate.File(sql.FieldIn(FieldGroup, vs...))
}
// GroupNotIn applies the NotIn predicate on the "group" field.
func GroupNotIn(vs ...string) predicate.File {
return predicate.File(sql.FieldNotIn(FieldGroup, vs...))
}
// GroupGT applies the GT predicate on the "group" field.
func GroupGT(v string) predicate.File {
return predicate.File(sql.FieldGT(FieldGroup, v))
}
// GroupGTE applies the GTE predicate on the "group" field.
func GroupGTE(v string) predicate.File {
return predicate.File(sql.FieldGTE(FieldGroup, v))
}
// GroupLT applies the LT predicate on the "group" field.
func GroupLT(v string) predicate.File {
return predicate.File(sql.FieldLT(FieldGroup, v))
}
// GroupLTE applies the LTE predicate on the "group" field.
func GroupLTE(v string) predicate.File {
return predicate.File(sql.FieldLTE(FieldGroup, v))
}
// GroupContains applies the Contains predicate on the "group" field.
func GroupContains(v string) predicate.File {
return predicate.File(sql.FieldContains(FieldGroup, v))
}
// GroupHasPrefix applies the HasPrefix predicate on the "group" field.
func GroupHasPrefix(v string) predicate.File {
return predicate.File(sql.FieldHasPrefix(FieldGroup, v))
}
// GroupHasSuffix applies the HasSuffix predicate on the "group" field.
func GroupHasSuffix(v string) predicate.File {
return predicate.File(sql.FieldHasSuffix(FieldGroup, v))
}
// GroupIsNil applies the IsNil predicate on the "group" field.
func GroupIsNil() predicate.File {
return predicate.File(sql.FieldIsNull(FieldGroup))
}
// GroupNotNil applies the NotNil predicate on the "group" field.
func GroupNotNil() predicate.File {
return predicate.File(sql.FieldNotNull(FieldGroup))
}
// GroupEqualFold applies the EqualFold predicate on the "group" field.
func GroupEqualFold(v string) predicate.File {
return predicate.File(sql.FieldEqualFold(FieldGroup, v))
}
// GroupContainsFold applies the ContainsFold predicate on the "group" field.
func GroupContainsFold(v string) predicate.File {
return predicate.File(sql.FieldContainsFold(FieldGroup, v))
}
// OpEQ applies the EQ predicate on the "op" field.
func OpEQ(v bool) predicate.File {
return predicate.File(sql.FieldEQ(FieldOp, v))
}
// OpNEQ applies the NEQ predicate on the "op" field.
func OpNEQ(v bool) predicate.File {
return predicate.File(sql.FieldNEQ(FieldOp, v))
}
// OpIsNil applies the IsNil predicate on the "op" field.
func OpIsNil() predicate.File {
return predicate.File(sql.FieldIsNull(FieldOp))
}
// OpNotNil applies the NotNil predicate on the "op" field.
func OpNotNil() predicate.File {
return predicate.File(sql.FieldNotNull(FieldOp))
}
// FieldIDEQ applies the EQ predicate on the "field_id" field.
func FieldIDEQ(v int) predicate.File {
return predicate.File(sql.FieldEQ(FieldFieldID, v))
}
// FieldIDNEQ applies the NEQ predicate on the "field_id" field.
func FieldIDNEQ(v int) predicate.File {
return predicate.File(sql.FieldNEQ(FieldFieldID, v))
}
// FieldIDIn applies the In predicate on the "field_id" field.
func FieldIDIn(vs ...int) predicate.File {
return predicate.File(sql.FieldIn(FieldFieldID, vs...))
}
// FieldIDNotIn applies the NotIn predicate on the "field_id" field.
func FieldIDNotIn(vs ...int) predicate.File {
return predicate.File(sql.FieldNotIn(FieldFieldID, vs...))
}
// FieldIDGT applies the GT predicate on the "field_id" field.
func FieldIDGT(v int) predicate.File {
return predicate.File(sql.FieldGT(FieldFieldID, v))
}
// FieldIDGTE applies the GTE predicate on the "field_id" field.
func FieldIDGTE(v int) predicate.File {
return predicate.File(sql.FieldGTE(FieldFieldID, v))
}
// FieldIDLT applies the LT predicate on the "field_id" field.
func FieldIDLT(v int) predicate.File {
return predicate.File(sql.FieldLT(FieldFieldID, v))
}
// FieldIDLTE applies the LTE predicate on the "field_id" field.
func FieldIDLTE(v int) predicate.File {
return predicate.File(sql.FieldLTE(FieldFieldID, v))
}
// FieldIDIsNil applies the IsNil predicate on the "field_id" field.
func FieldIDIsNil() predicate.File {
return predicate.File(sql.FieldIsNull(FieldFieldID))
}
// FieldIDNotNil applies the NotNil predicate on the "field_id" field.
func FieldIDNotNil() predicate.File {
return predicate.File(sql.FieldNotNull(FieldFieldID))
}
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
func CreateTimeEQ(v time.Time) predicate.File {
return predicate.File(sql.FieldEQ(FieldCreateTime, v))
}
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
func CreateTimeNEQ(v time.Time) predicate.File {
return predicate.File(sql.FieldNEQ(FieldCreateTime, v))
}
// CreateTimeIn applies the In predicate on the "create_time" field.
func CreateTimeIn(vs ...time.Time) predicate.File {
return predicate.File(sql.FieldIn(FieldCreateTime, vs...))
}
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
func CreateTimeNotIn(vs ...time.Time) predicate.File {
return predicate.File(sql.FieldNotIn(FieldCreateTime, vs...))
}
// CreateTimeGT applies the GT predicate on the "create_time" field.
func CreateTimeGT(v time.Time) predicate.File {
return predicate.File(sql.FieldGT(FieldCreateTime, v))
}
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
func CreateTimeGTE(v time.Time) predicate.File {
return predicate.File(sql.FieldGTE(FieldCreateTime, v))
}
// CreateTimeLT applies the LT predicate on the "create_time" field.
func CreateTimeLT(v time.Time) predicate.File {
return predicate.File(sql.FieldLT(FieldCreateTime, v))
}
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
func CreateTimeLTE(v time.Time) predicate.File {
return predicate.File(sql.FieldLTE(FieldCreateTime, v))
}
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
func CreateTimeIsNil() predicate.File {
return predicate.File(sql.FieldIsNull(FieldCreateTime))
}
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
func CreateTimeNotNil() predicate.File {
return predicate.File(sql.FieldNotNull(FieldCreateTime))
}
// HasOwner applies the HasEdge predicate on the "owner" edge.
func HasOwner() predicate.File {
return predicate.File(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, OwnerTable, OwnerColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
func HasOwnerWith(preds ...predicate.User) predicate.File {
return predicate.File(func(s *sql.Selector) {
step := newOwnerStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasType applies the HasEdge predicate on the "type" edge.
func HasType() predicate.File {
return predicate.File(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, TypeTable, TypeColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasTypeWith applies the HasEdge predicate on the "type" edge with a given conditions (other predicates).
func HasTypeWith(preds ...predicate.FileType) predicate.File {
return predicate.File(func(s *sql.Selector) {
step := newTypeStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasField applies the HasEdge predicate on the "field" edge.
func HasField() predicate.File {
return predicate.File(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2M, false, FieldTable, FieldColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasFieldWith applies the HasEdge predicate on the "field" edge with a given conditions (other predicates).
func HasFieldWith(preds ...predicate.FieldType) predicate.File {
return predicate.File(func(s *sql.Selector) {
step := newFieldStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.File) predicate.File {
return predicate.File(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.File) predicate.File {
return predicate.File(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.File) predicate.File {
return predicate.File(sql.NotPredicates(p))
}