snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
60
entc/integration/gremlin/ent/file/file.go
Normal file
60
entc/integration/gremlin/ent/file/file.go
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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/gremlin/graph/dsl"
|
||||
)
|
||||
|
||||
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"
|
||||
// OwnerInverseLabel holds the string label denoting the owner inverse edge type in the database.
|
||||
OwnerInverseLabel = "user_files"
|
||||
// TypeInverseLabel holds the string label denoting the type inverse edge type in the database.
|
||||
TypeInverseLabel = "file_type_files"
|
||||
// FieldLabel holds the string label denoting the field edge type in the database.
|
||||
FieldLabel = "file_field"
|
||||
)
|
||||
|
||||
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(*dsl.Traversal)
|
||||
|
||||
// comment from another template.
|
||||
911
entc/integration/gremlin/ent/file/mutation.go
Normal file
911
entc/integration/gremlin/ent/file/mutation.go
Normal 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/gremlin/graph/dsl"
|
||||
"entgo.io/ent/entc/integration/gremlin/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 *string
|
||||
clearedowner bool
|
||||
_type *string
|
||||
cleared_type bool
|
||||
field map[string]struct{}
|
||||
removedfield map[string]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 string) {
|
||||
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 string, 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 []string) {
|
||||
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 string) {
|
||||
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 string, 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 []string) {
|
||||
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 ...string) {
|
||||
if m.field == nil {
|
||||
m.field = make(map[string]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 ...string) {
|
||||
if m.removedfield == nil {
|
||||
m.removedfield = make(map[string]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 []string) {
|
||||
for id := range m.removedfield {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// FieldIDs returns the "field" edge IDs in the mutation.
|
||||
func (m *Mutation) FieldIDs() (ids []string) {
|
||||
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(*dsl.Traversal)) {
|
||||
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)
|
||||
}
|
||||
778
entc/integration/gremlin/ent/file/where.go
Normal file
778
entc/integration/gremlin/ent/file/where.go
Normal file
@@ -0,0 +1,778 @@
|
||||
// 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/gremlin/graph/dsl"
|
||||
"entgo.io/ent/dialect/gremlin/graph/dsl/__"
|
||||
"entgo.io/ent/dialect/gremlin/graph/dsl/p"
|
||||
"entgo.io/ent/entc/integration/gremlin/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasID(id)
|
||||
})
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasID(p.EQ(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasID(p.NEQ(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
t.HasID(p.Within(v...))
|
||||
})
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
t.HasID(p.Without(v...))
|
||||
})
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasID(p.GT(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasID(p.GTE(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasID(p.LT(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasID(p.LTE(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(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// Size applies equality check predicate on the "size" field. It's identical to SizeEQ.
|
||||
func Size(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
||||
func Name(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// User applies equality check predicate on the "user" field. It's identical to UserEQ.
|
||||
func User(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// Group applies equality check predicate on the "group" field. It's identical to GroupEQ.
|
||||
func Group(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// Op applies equality check predicate on the "op" field. It's identical to OpEQ.
|
||||
func Op(v bool) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldOp, p.EQ(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(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDEQ applies the EQ predicate on the "set_id" field.
|
||||
func SetIDEQ(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDNEQ applies the NEQ predicate on the "set_id" field.
|
||||
func SetIDNEQ(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDIn applies the In predicate on the "set_id" field.
|
||||
func SetIDIn(vs ...int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDNotIn applies the NotIn predicate on the "set_id" field.
|
||||
func SetIDNotIn(vs ...int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDGT applies the GT predicate on the "set_id" field.
|
||||
func SetIDGT(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDGTE applies the GTE predicate on the "set_id" field.
|
||||
func SetIDGTE(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDLT applies the LT predicate on the "set_id" field.
|
||||
func SetIDLT(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDLTE applies the LTE predicate on the "set_id" field.
|
||||
func SetIDLTE(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSetID, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDIsNil applies the IsNil predicate on the "set_id" field.
|
||||
func SetIDIsNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldSetID)
|
||||
})
|
||||
}
|
||||
|
||||
// SetIDNotNil applies the NotNil predicate on the "set_id" field.
|
||||
func SetIDNotNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldSetID)
|
||||
})
|
||||
}
|
||||
|
||||
// SizeEQ applies the EQ predicate on the "size" field.
|
||||
func SizeEQ(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SizeNEQ applies the NEQ predicate on the "size" field.
|
||||
func SizeNEQ(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SizeIn applies the In predicate on the "size" field.
|
||||
func SizeIn(vs ...int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// SizeNotIn applies the NotIn predicate on the "size" field.
|
||||
func SizeNotIn(vs ...int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// SizeGT applies the GT predicate on the "size" field.
|
||||
func SizeGT(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SizeGTE applies the GTE predicate on the "size" field.
|
||||
func SizeGTE(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SizeLT applies the LT predicate on the "size" field.
|
||||
func SizeLT(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// SizeLTE applies the LTE predicate on the "size" field.
|
||||
func SizeLTE(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldSize, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameNEQ applies the NEQ predicate on the "name" field.
|
||||
func NameNEQ(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// NameGT applies the GT predicate on the "name" field.
|
||||
func NameGT(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameGTE applies the GTE predicate on the "name" field.
|
||||
func NameGTE(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameLT applies the LT predicate on the "name" field.
|
||||
func NameLT(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameLTE applies the LTE predicate on the "name" field.
|
||||
func NameLTE(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameContains applies the Contains predicate on the "name" field.
|
||||
func NameContains(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.Containing(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
|
||||
func NameHasPrefix(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.StartingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
|
||||
func NameHasSuffix(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.EndingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserEQ applies the EQ predicate on the "user" field.
|
||||
func UserEQ(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserNEQ applies the NEQ predicate on the "user" field.
|
||||
func UserNEQ(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIn applies the In predicate on the "user" field.
|
||||
func UserIn(vs ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// UserNotIn applies the NotIn predicate on the "user" field.
|
||||
func UserNotIn(vs ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// UserGT applies the GT predicate on the "user" field.
|
||||
func UserGT(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserGTE applies the GTE predicate on the "user" field.
|
||||
func UserGTE(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserLT applies the LT predicate on the "user" field.
|
||||
func UserLT(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserLTE applies the LTE predicate on the "user" field.
|
||||
func UserLTE(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserContains applies the Contains predicate on the "user" field.
|
||||
func UserContains(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.Containing(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserHasPrefix applies the HasPrefix predicate on the "user" field.
|
||||
func UserHasPrefix(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.StartingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserHasSuffix applies the HasSuffix predicate on the "user" field.
|
||||
func UserHasSuffix(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldUser, p.EndingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// UserIsNil applies the IsNil predicate on the "user" field.
|
||||
func UserIsNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldUser)
|
||||
})
|
||||
}
|
||||
|
||||
// UserNotNil applies the NotNil predicate on the "user" field.
|
||||
func UserNotNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldUser)
|
||||
})
|
||||
}
|
||||
|
||||
// GroupEQ applies the EQ predicate on the "group" field.
|
||||
func GroupEQ(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupNEQ applies the NEQ predicate on the "group" field.
|
||||
func GroupNEQ(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupIn applies the In predicate on the "group" field.
|
||||
func GroupIn(vs ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupNotIn applies the NotIn predicate on the "group" field.
|
||||
func GroupNotIn(vs ...string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupGT applies the GT predicate on the "group" field.
|
||||
func GroupGT(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupGTE applies the GTE predicate on the "group" field.
|
||||
func GroupGTE(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupLT applies the LT predicate on the "group" field.
|
||||
func GroupLT(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupLTE applies the LTE predicate on the "group" field.
|
||||
func GroupLTE(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupContains applies the Contains predicate on the "group" field.
|
||||
func GroupContains(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.Containing(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupHasPrefix applies the HasPrefix predicate on the "group" field.
|
||||
func GroupHasPrefix(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.StartingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupHasSuffix applies the HasSuffix predicate on the "group" field.
|
||||
func GroupHasSuffix(v string) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldGroup, p.EndingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// GroupIsNil applies the IsNil predicate on the "group" field.
|
||||
func GroupIsNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldGroup)
|
||||
})
|
||||
}
|
||||
|
||||
// GroupNotNil applies the NotNil predicate on the "group" field.
|
||||
func GroupNotNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldGroup)
|
||||
})
|
||||
}
|
||||
|
||||
// OpEQ applies the EQ predicate on the "op" field.
|
||||
func OpEQ(v bool) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldOp, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// OpNEQ applies the NEQ predicate on the "op" field.
|
||||
func OpNEQ(v bool) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldOp, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// OpIsNil applies the IsNil predicate on the "op" field.
|
||||
func OpIsNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldOp)
|
||||
})
|
||||
}
|
||||
|
||||
// OpNotNil applies the NotNil predicate on the "op" field.
|
||||
func OpNotNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldOp)
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDEQ applies the EQ predicate on the "field_id" field.
|
||||
func FieldIDEQ(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDNEQ applies the NEQ predicate on the "field_id" field.
|
||||
func FieldIDNEQ(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDIn applies the In predicate on the "field_id" field.
|
||||
func FieldIDIn(vs ...int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDNotIn applies the NotIn predicate on the "field_id" field.
|
||||
func FieldIDNotIn(vs ...int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDGT applies the GT predicate on the "field_id" field.
|
||||
func FieldIDGT(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDGTE applies the GTE predicate on the "field_id" field.
|
||||
func FieldIDGTE(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDLT applies the LT predicate on the "field_id" field.
|
||||
func FieldIDLT(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDLTE applies the LTE predicate on the "field_id" field.
|
||||
func FieldIDLTE(v int) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldFieldID, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDIsNil applies the IsNil predicate on the "field_id" field.
|
||||
func FieldIDIsNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldFieldID)
|
||||
})
|
||||
}
|
||||
|
||||
// FieldIDNotNil applies the NotNil predicate on the "field_id" field.
|
||||
func FieldIDNotNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldFieldID)
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeEQ applies the EQ predicate on the "create_time" field.
|
||||
func CreateTimeEQ(v time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeNEQ applies the NEQ predicate on the "create_time" field.
|
||||
func CreateTimeNEQ(v time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeIn applies the In predicate on the "create_time" field.
|
||||
func CreateTimeIn(vs ...time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeNotIn applies the NotIn predicate on the "create_time" field.
|
||||
func CreateTimeNotIn(vs ...time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeGT applies the GT predicate on the "create_time" field.
|
||||
func CreateTimeGT(v time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeGTE applies the GTE predicate on the "create_time" field.
|
||||
func CreateTimeGTE(v time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeLT applies the LT predicate on the "create_time" field.
|
||||
func CreateTimeLT(v time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeLTE applies the LTE predicate on the "create_time" field.
|
||||
func CreateTimeLTE(v time.Time) predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldCreateTime, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeIsNil applies the IsNil predicate on the "create_time" field.
|
||||
func CreateTimeIsNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldCreateTime)
|
||||
})
|
||||
}
|
||||
|
||||
// CreateTimeNotNil applies the NotNil predicate on the "create_time" field.
|
||||
func CreateTimeNotNil() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldCreateTime)
|
||||
})
|
||||
}
|
||||
|
||||
// HasOwner applies the HasEdge predicate on the "owner" edge.
|
||||
func HasOwner() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.InE(OwnerInverseLabel).InV()
|
||||
})
|
||||
}
|
||||
|
||||
// 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(t *dsl.Traversal) {
|
||||
tr := __.OutV()
|
||||
for _, p := range preds {
|
||||
p(tr)
|
||||
}
|
||||
t.InE(OwnerInverseLabel).Where(tr).InV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasType applies the HasEdge predicate on the "type" edge.
|
||||
func HasType() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.InE(TypeInverseLabel).InV()
|
||||
})
|
||||
}
|
||||
|
||||
// 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(t *dsl.Traversal) {
|
||||
tr := __.OutV()
|
||||
for _, p := range preds {
|
||||
p(tr)
|
||||
}
|
||||
t.InE(TypeInverseLabel).Where(tr).InV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasField applies the HasEdge predicate on the "field" edge.
|
||||
func HasField() predicate.File {
|
||||
return predicate.File(func(t *dsl.Traversal) {
|
||||
t.OutE(FieldLabel).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// 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(t *dsl.Traversal) {
|
||||
tr := __.InV()
|
||||
for _, p := range preds {
|
||||
p(tr)
|
||||
}
|
||||
t.OutE(FieldLabel).Where(tr).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.File) predicate.File {
|
||||
return predicate.File(func(tr *dsl.Traversal) {
|
||||
trs := make([]any, 0, len(predicates))
|
||||
for _, p := range predicates {
|
||||
t := __.New()
|
||||
p(t)
|
||||
trs = append(trs, t)
|
||||
}
|
||||
tr.Where(__.And(trs...))
|
||||
})
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.File) predicate.File {
|
||||
return predicate.File(func(tr *dsl.Traversal) {
|
||||
trs := make([]any, 0, len(predicates))
|
||||
for _, p := range predicates {
|
||||
t := __.New()
|
||||
p(t)
|
||||
trs = append(trs, t)
|
||||
}
|
||||
tr.Where(__.Or(trs...))
|
||||
})
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.File) predicate.File {
|
||||
return predicate.File(func(tr *dsl.Traversal) {
|
||||
t := __.New()
|
||||
p(t)
|
||||
tr.Where(__.Not(t))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user