snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
62
entc/integration/gremlin/ent/group/group.go
Normal file
62
entc/integration/gremlin/ent/group/group.go
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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 group
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/gremlin/graph/dsl"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the group type in the database.
|
||||
Label = "group"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldActive holds the string denoting the active field in the database.
|
||||
FieldActive = "active"
|
||||
// FieldExpire holds the string denoting the expire field in the database.
|
||||
FieldExpire = "expire"
|
||||
// FieldType holds the string denoting the type field in the database.
|
||||
FieldType = "type"
|
||||
// FieldMaxUsers holds the string denoting the max_users field in the database.
|
||||
FieldMaxUsers = "max_users"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
// EdgeFiles holds the string denoting the files edge name in mutations.
|
||||
EdgeFiles = "files"
|
||||
// EdgeBlocked holds the string denoting the blocked edge name in mutations.
|
||||
EdgeBlocked = "blocked"
|
||||
// EdgeUsers holds the string denoting the users edge name in mutations.
|
||||
EdgeUsers = "users"
|
||||
// EdgeInfo holds the string denoting the info edge name in mutations.
|
||||
EdgeInfo = "info"
|
||||
// FilesLabel holds the string label denoting the files edge type in the database.
|
||||
FilesLabel = "group_files"
|
||||
// BlockedLabel holds the string label denoting the blocked edge type in the database.
|
||||
BlockedLabel = "group_blocked"
|
||||
// UsersInverseLabel holds the string label denoting the users inverse edge type in the database.
|
||||
UsersInverseLabel = "user_groups"
|
||||
// InfoLabel holds the string label denoting the info edge type in the database.
|
||||
InfoLabel = "group_info"
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultActive holds the default value on creation for the "active" field.
|
||||
DefaultActive bool
|
||||
// TypeValidator is a validator for the "type" field. It is called by the builders before save.
|
||||
TypeValidator func(string) error
|
||||
// DefaultMaxUsers holds the default value on creation for the "max_users" field.
|
||||
DefaultMaxUsers int
|
||||
// MaxUsersValidator is a validator for the "max_users" field. It is called by the builders before save.
|
||||
MaxUsersValidator func(int) error
|
||||
// NameValidator is a validator for the "name" field. It is called by the builders before save.
|
||||
NameValidator func(string) error
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Group queries.
|
||||
type OrderOption func(*dsl.Traversal)
|
||||
|
||||
// comment from another template.
|
||||
770
entc/integration/gremlin/ent/group/mutation.go
Normal file
770
entc/integration/gremlin/ent/group/mutation.go
Normal file
@@ -0,0 +1,770 @@
|
||||
// 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 group
|
||||
|
||||
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 Group nodes in the graph.
|
||||
type Mutation struct {
|
||||
op ent.Op
|
||||
typ string
|
||||
active *bool
|
||||
expire *time.Time
|
||||
_type *string
|
||||
max_users *int
|
||||
addmax_users *int
|
||||
name *string
|
||||
clearedFields map[string]struct{}
|
||||
files map[string]struct{}
|
||||
removedfiles map[string]struct{}
|
||||
clearedfiles bool
|
||||
blocked map[string]struct{}
|
||||
removedblocked map[string]struct{}
|
||||
clearedblocked bool
|
||||
users map[string]struct{}
|
||||
removedusers map[string]struct{}
|
||||
clearedusers bool
|
||||
info *string
|
||||
clearedinfo bool
|
||||
predicates []predicate.Group
|
||||
}
|
||||
|
||||
// NewMutation creates a new Mutation for the Group entity.
|
||||
func NewMutation(op ent.Op) *Mutation {
|
||||
return &Mutation{
|
||||
op: op,
|
||||
typ: "Group",
|
||||
clearedFields: make(map[string]struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
// Predicates returns the list of predicates set on the mutation.
|
||||
func (m *Mutation) Predicates() []predicate.Group {
|
||||
return m.predicates
|
||||
}
|
||||
|
||||
// SetActive sets the "active" field.
|
||||
func (m *Mutation) SetActive(b bool) {
|
||||
m.active = &b
|
||||
}
|
||||
|
||||
// Active returns the value of the "active" field in the mutation.
|
||||
func (m *Mutation) Active() (r bool, exists bool) {
|
||||
v := m.active
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetActive resets all changes to the "active" field.
|
||||
func (m *Mutation) ResetActive() {
|
||||
m.active = nil
|
||||
}
|
||||
|
||||
// SetExpire sets the "expire" field.
|
||||
func (m *Mutation) SetExpire(t time.Time) {
|
||||
m.expire = &t
|
||||
}
|
||||
|
||||
// Expire returns the value of the "expire" field in the mutation.
|
||||
func (m *Mutation) Expire() (r time.Time, exists bool) {
|
||||
v := m.expire
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetExpire resets all changes to the "expire" field.
|
||||
func (m *Mutation) ResetExpire() {
|
||||
m.expire = nil
|
||||
}
|
||||
|
||||
// SetType sets the "type" field.
|
||||
func (m *Mutation) SetType(s string) {
|
||||
m._type = &s
|
||||
}
|
||||
|
||||
// GetType returns the value of the "type" field in the mutation.
|
||||
func (m *Mutation) GetType() (r string, exists bool) {
|
||||
v := m._type
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearType clears the value of the "type" field.
|
||||
func (m *Mutation) ClearType() {
|
||||
m._type = nil
|
||||
m.clearedFields[FieldType] = struct{}{}
|
||||
}
|
||||
|
||||
// TypeCleared returns if the "type" field was cleared in this mutation.
|
||||
func (m *Mutation) TypeCleared() bool {
|
||||
_, ok := m.clearedFields[FieldType]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetType resets all changes to the "type" field.
|
||||
func (m *Mutation) ResetType() {
|
||||
m._type = nil
|
||||
delete(m.clearedFields, FieldType)
|
||||
}
|
||||
|
||||
// SetMaxUsers sets the "max_users" field.
|
||||
func (m *Mutation) SetMaxUsers(i int) {
|
||||
m.max_users = &i
|
||||
m.addmax_users = nil
|
||||
}
|
||||
|
||||
// MaxUsers returns the value of the "max_users" field in the mutation.
|
||||
func (m *Mutation) MaxUsers() (r int, exists bool) {
|
||||
v := m.max_users
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// AddMaxUsers adds i to the "max_users" field.
|
||||
func (m *Mutation) AddMaxUsers(i int) {
|
||||
if m.addmax_users != nil {
|
||||
*m.addmax_users += i
|
||||
} else {
|
||||
m.addmax_users = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedMaxUsers returns the value that was added to the "max_users" field in this mutation.
|
||||
func (m *Mutation) AddedMaxUsers() (r int, exists bool) {
|
||||
v := m.addmax_users
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearMaxUsers clears the value of the "max_users" field.
|
||||
func (m *Mutation) ClearMaxUsers() {
|
||||
m.max_users = nil
|
||||
m.addmax_users = nil
|
||||
m.clearedFields[FieldMaxUsers] = struct{}{}
|
||||
}
|
||||
|
||||
// MaxUsersCleared returns if the "max_users" field was cleared in this mutation.
|
||||
func (m *Mutation) MaxUsersCleared() bool {
|
||||
_, ok := m.clearedFields[FieldMaxUsers]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetMaxUsers resets all changes to the "max_users" field.
|
||||
func (m *Mutation) ResetMaxUsers() {
|
||||
m.max_users = nil
|
||||
m.addmax_users = nil
|
||||
delete(m.clearedFields, FieldMaxUsers)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// AddFileIDs adds the "files" edge to the File entity by ids.
|
||||
func (m *Mutation) AddFileIDs(ids ...string) {
|
||||
if m.files == nil {
|
||||
m.files = make(map[string]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
m.files[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// ClearFiles clears the "files" edge to the File entity.
|
||||
func (m *Mutation) ClearFiles() {
|
||||
m.clearedfiles = true
|
||||
}
|
||||
|
||||
// FilesCleared reports if the "files" edge to the File entity was cleared.
|
||||
func (m *Mutation) FilesCleared() bool {
|
||||
return m.clearedfiles
|
||||
}
|
||||
|
||||
// RemoveFileIDs removes the "files" edge to the File entity by IDs.
|
||||
func (m *Mutation) RemoveFileIDs(ids ...string) {
|
||||
if m.removedfiles == nil {
|
||||
m.removedfiles = make(map[string]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
delete(m.files, ids[i])
|
||||
m.removedfiles[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// RemovedFiles returns the removed IDs of the "files" edge to the File entity.
|
||||
func (m *Mutation) RemovedFilesIDs() (ids []string) {
|
||||
for id := range m.removedfiles {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// FilesIDs returns the "files" edge IDs in the mutation.
|
||||
func (m *Mutation) FilesIDs() (ids []string) {
|
||||
for id := range m.files {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetFiles resets all changes to the "files" edge.
|
||||
func (m *Mutation) ResetFiles() {
|
||||
m.files = nil
|
||||
m.clearedfiles = false
|
||||
m.removedfiles = nil
|
||||
}
|
||||
|
||||
// AddBlockedIDs adds the "blocked" edge to the User entity by ids.
|
||||
func (m *Mutation) AddBlockedIDs(ids ...string) {
|
||||
if m.blocked == nil {
|
||||
m.blocked = make(map[string]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
m.blocked[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// ClearBlocked clears the "blocked" edge to the User entity.
|
||||
func (m *Mutation) ClearBlocked() {
|
||||
m.clearedblocked = true
|
||||
}
|
||||
|
||||
// BlockedCleared reports if the "blocked" edge to the User entity was cleared.
|
||||
func (m *Mutation) BlockedCleared() bool {
|
||||
return m.clearedblocked
|
||||
}
|
||||
|
||||
// RemoveBlockedIDs removes the "blocked" edge to the User entity by IDs.
|
||||
func (m *Mutation) RemoveBlockedIDs(ids ...string) {
|
||||
if m.removedblocked == nil {
|
||||
m.removedblocked = make(map[string]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
delete(m.blocked, ids[i])
|
||||
m.removedblocked[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// RemovedBlocked returns the removed IDs of the "blocked" edge to the User entity.
|
||||
func (m *Mutation) RemovedBlockedIDs() (ids []string) {
|
||||
for id := range m.removedblocked {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BlockedIDs returns the "blocked" edge IDs in the mutation.
|
||||
func (m *Mutation) BlockedIDs() (ids []string) {
|
||||
for id := range m.blocked {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetBlocked resets all changes to the "blocked" edge.
|
||||
func (m *Mutation) ResetBlocked() {
|
||||
m.blocked = nil
|
||||
m.clearedblocked = false
|
||||
m.removedblocked = nil
|
||||
}
|
||||
|
||||
// AddUserIDs adds the "users" edge to the User entity by ids.
|
||||
func (m *Mutation) AddUserIDs(ids ...string) {
|
||||
if m.users == nil {
|
||||
m.users = make(map[string]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
m.users[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// ClearUsers clears the "users" edge to the User entity.
|
||||
func (m *Mutation) ClearUsers() {
|
||||
m.clearedusers = true
|
||||
}
|
||||
|
||||
// UsersCleared reports if the "users" edge to the User entity was cleared.
|
||||
func (m *Mutation) UsersCleared() bool {
|
||||
return m.clearedusers
|
||||
}
|
||||
|
||||
// RemoveUserIDs removes the "users" edge to the User entity by IDs.
|
||||
func (m *Mutation) RemoveUserIDs(ids ...string) {
|
||||
if m.removedusers == nil {
|
||||
m.removedusers = make(map[string]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
delete(m.users, ids[i])
|
||||
m.removedusers[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// RemovedUsers returns the removed IDs of the "users" edge to the User entity.
|
||||
func (m *Mutation) RemovedUsersIDs() (ids []string) {
|
||||
for id := range m.removedusers {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UsersIDs returns the "users" edge IDs in the mutation.
|
||||
func (m *Mutation) UsersIDs() (ids []string) {
|
||||
for id := range m.users {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetUsers resets all changes to the "users" edge.
|
||||
func (m *Mutation) ResetUsers() {
|
||||
m.users = nil
|
||||
m.clearedusers = false
|
||||
m.removedusers = nil
|
||||
}
|
||||
|
||||
// SetInfoID sets the "info" edge to the GroupInfo entity by id.
|
||||
func (m *Mutation) SetInfoID(id string) {
|
||||
m.info = &id
|
||||
}
|
||||
|
||||
// ClearInfo clears the "info" edge to the GroupInfo entity.
|
||||
func (m *Mutation) ClearInfo() {
|
||||
m.clearedinfo = true
|
||||
}
|
||||
|
||||
// InfoCleared reports if the "info" edge to the GroupInfo entity was cleared.
|
||||
func (m *Mutation) InfoCleared() bool {
|
||||
return m.clearedinfo
|
||||
}
|
||||
|
||||
// InfoID returns the "info" edge ID in the mutation.
|
||||
func (m *Mutation) InfoID() (id string, exists bool) {
|
||||
if m.info != nil {
|
||||
return *m.info, true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// InfoIDs returns the "info" edge IDs in the mutation.
|
||||
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
||||
// InfoID instead. It exists only for internal usage by the builders.
|
||||
func (m *Mutation) InfoIDs() (ids []string) {
|
||||
if id := m.info; id != nil {
|
||||
ids = append(ids, *id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetInfo resets all changes to the "info" edge.
|
||||
func (m *Mutation) ResetInfo() {
|
||||
m.info = nil
|
||||
m.clearedinfo = false
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the Mutation builder.
|
||||
func (m *Mutation) Where(ps ...predicate.Group) {
|
||||
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.Group, 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 (Group).
|
||||
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, 5)
|
||||
if m.active != nil {
|
||||
fields = append(fields, FieldActive)
|
||||
}
|
||||
if m.expire != nil {
|
||||
fields = append(fields, FieldExpire)
|
||||
}
|
||||
if m._type != nil {
|
||||
fields = append(fields, FieldType)
|
||||
}
|
||||
if m.max_users != nil {
|
||||
fields = append(fields, FieldMaxUsers)
|
||||
}
|
||||
if m.name != nil {
|
||||
fields = append(fields, FieldName)
|
||||
}
|
||||
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 FieldActive:
|
||||
return m.Active()
|
||||
case FieldExpire:
|
||||
return m.Expire()
|
||||
case FieldType:
|
||||
return m.GetType()
|
||||
case FieldMaxUsers:
|
||||
return m.MaxUsers()
|
||||
case FieldName:
|
||||
return m.Name()
|
||||
}
|
||||
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 Group 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 FieldActive:
|
||||
v, ok := value.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetActive(v)
|
||||
return nil
|
||||
case FieldExpire:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetExpire(v)
|
||||
return nil
|
||||
case FieldType:
|
||||
v, ok := value.(string)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetType(v)
|
||||
return nil
|
||||
case FieldMaxUsers:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetMaxUsers(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
|
||||
}
|
||||
return fmt.Errorf("unknown Group 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.addmax_users != nil {
|
||||
fields = append(fields, FieldMaxUsers)
|
||||
}
|
||||
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 FieldMaxUsers:
|
||||
return m.AddedMaxUsers()
|
||||
}
|
||||
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 FieldMaxUsers:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddMaxUsers(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group 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(FieldType) {
|
||||
fields = append(fields, FieldType)
|
||||
}
|
||||
if m.FieldCleared(FieldMaxUsers) {
|
||||
fields = append(fields, FieldMaxUsers)
|
||||
}
|
||||
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 FieldType:
|
||||
m.ClearType()
|
||||
return nil
|
||||
case FieldMaxUsers:
|
||||
m.ClearMaxUsers()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group 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 FieldActive:
|
||||
m.ResetActive()
|
||||
return nil
|
||||
case FieldExpire:
|
||||
m.ResetExpire()
|
||||
return nil
|
||||
case FieldType:
|
||||
m.ResetType()
|
||||
return nil
|
||||
case FieldMaxUsers:
|
||||
m.ResetMaxUsers()
|
||||
return nil
|
||||
case FieldName:
|
||||
m.ResetName()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group field %s", name)
|
||||
}
|
||||
|
||||
// AddedEdges returns all edge names that were set/added in this mutation.
|
||||
func (m *Mutation) AddedEdges() []string {
|
||||
edges := make([]string, 0, 4)
|
||||
if m.files != nil {
|
||||
edges = append(edges, EdgeFiles)
|
||||
}
|
||||
if m.blocked != nil {
|
||||
edges = append(edges, EdgeBlocked)
|
||||
}
|
||||
if m.users != nil {
|
||||
edges = append(edges, EdgeUsers)
|
||||
}
|
||||
if m.info != nil {
|
||||
edges = append(edges, EdgeInfo)
|
||||
}
|
||||
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 EdgeFiles:
|
||||
ids := make([]ent.Value, 0, len(m.files))
|
||||
for id := range m.files {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return ids
|
||||
case EdgeBlocked:
|
||||
ids := make([]ent.Value, 0, len(m.blocked))
|
||||
for id := range m.blocked {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return ids
|
||||
case EdgeUsers:
|
||||
ids := make([]ent.Value, 0, len(m.users))
|
||||
for id := range m.users {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return ids
|
||||
case EdgeInfo:
|
||||
if id := m.info; id != nil {
|
||||
return []ent.Value{*id}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemovedEdges returns all edge names that were removed in this mutation.
|
||||
func (m *Mutation) RemovedEdges() []string {
|
||||
edges := make([]string, 0, 4)
|
||||
if m.removedfiles != nil {
|
||||
edges = append(edges, EdgeFiles)
|
||||
}
|
||||
if m.removedblocked != nil {
|
||||
edges = append(edges, EdgeBlocked)
|
||||
}
|
||||
if m.removedusers != nil {
|
||||
edges = append(edges, EdgeUsers)
|
||||
}
|
||||
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 EdgeFiles:
|
||||
ids := make([]ent.Value, 0, len(m.removedfiles))
|
||||
for id := range m.removedfiles {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return ids
|
||||
case EdgeBlocked:
|
||||
ids := make([]ent.Value, 0, len(m.removedblocked))
|
||||
for id := range m.removedblocked {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return ids
|
||||
case EdgeUsers:
|
||||
ids := make([]ent.Value, 0, len(m.removedusers))
|
||||
for id := range m.removedusers {
|
||||
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, 4)
|
||||
if m.clearedfiles {
|
||||
edges = append(edges, EdgeFiles)
|
||||
}
|
||||
if m.clearedblocked {
|
||||
edges = append(edges, EdgeBlocked)
|
||||
}
|
||||
if m.clearedusers {
|
||||
edges = append(edges, EdgeUsers)
|
||||
}
|
||||
if m.clearedinfo {
|
||||
edges = append(edges, EdgeInfo)
|
||||
}
|
||||
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 EdgeFiles:
|
||||
return m.clearedfiles
|
||||
case EdgeBlocked:
|
||||
return m.clearedblocked
|
||||
case EdgeUsers:
|
||||
return m.clearedusers
|
||||
case EdgeInfo:
|
||||
return m.clearedinfo
|
||||
}
|
||||
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 EdgeInfo:
|
||||
m.ClearInfo()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group 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 EdgeFiles:
|
||||
m.ResetFiles()
|
||||
return nil
|
||||
case EdgeBlocked:
|
||||
m.ResetBlocked()
|
||||
return nil
|
||||
case EdgeUsers:
|
||||
m.ResetUsers()
|
||||
return nil
|
||||
case EdgeInfo:
|
||||
m.ResetInfo()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Group edge %s", name)
|
||||
}
|
||||
537
entc/integration/gremlin/ent/group/where.go
Normal file
537
entc/integration/gremlin/ent/group/where.go
Normal file
@@ -0,0 +1,537 @@
|
||||
// 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 group
|
||||
|
||||
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.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasID(id)
|
||||
})
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasID(p.EQ(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasID(p.NEQ(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...string) predicate.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasID(p.GT(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasID(p.GTE(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasID(p.LT(id))
|
||||
})
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasID(p.LTE(id))
|
||||
})
|
||||
}
|
||||
|
||||
// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ.
|
||||
func Active(v bool) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldActive, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// Expire applies equality check predicate on the "expire" field. It's identical to ExpireEQ.
|
||||
func Expire(v time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// Type applies equality check predicate on the "type" field. It's identical to TypeEQ.
|
||||
func Type(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsers applies equality check predicate on the "max_users" field. It's identical to MaxUsersEQ.
|
||||
func MaxUsers(v int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
||||
func Name(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ActiveEQ applies the EQ predicate on the "active" field.
|
||||
func ActiveEQ(v bool) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldActive, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ActiveNEQ applies the NEQ predicate on the "active" field.
|
||||
func ActiveNEQ(v bool) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldActive, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireEQ applies the EQ predicate on the "expire" field.
|
||||
func ExpireEQ(v time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireNEQ applies the NEQ predicate on the "expire" field.
|
||||
func ExpireNEQ(v time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireIn applies the In predicate on the "expire" field.
|
||||
func ExpireIn(vs ...time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireNotIn applies the NotIn predicate on the "expire" field.
|
||||
func ExpireNotIn(vs ...time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireGT applies the GT predicate on the "expire" field.
|
||||
func ExpireGT(v time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireGTE applies the GTE predicate on the "expire" field.
|
||||
func ExpireGTE(v time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireLT applies the LT predicate on the "expire" field.
|
||||
func ExpireLT(v time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// ExpireLTE applies the LTE predicate on the "expire" field.
|
||||
func ExpireLTE(v time.Time) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldExpire, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeEQ applies the EQ predicate on the "type" field.
|
||||
func TypeEQ(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeNEQ applies the NEQ predicate on the "type" field.
|
||||
func TypeNEQ(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeIn applies the In predicate on the "type" field.
|
||||
func TypeIn(vs ...string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeNotIn applies the NotIn predicate on the "type" field.
|
||||
func TypeNotIn(vs ...string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeGT applies the GT predicate on the "type" field.
|
||||
func TypeGT(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeGTE applies the GTE predicate on the "type" field.
|
||||
func TypeGTE(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeLT applies the LT predicate on the "type" field.
|
||||
func TypeLT(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeLTE applies the LTE predicate on the "type" field.
|
||||
func TypeLTE(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeContains applies the Contains predicate on the "type" field.
|
||||
func TypeContains(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.Containing(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeHasPrefix applies the HasPrefix predicate on the "type" field.
|
||||
func TypeHasPrefix(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.StartingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeHasSuffix applies the HasSuffix predicate on the "type" field.
|
||||
func TypeHasSuffix(v string) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldType, p.EndingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// TypeIsNil applies the IsNil predicate on the "type" field.
|
||||
func TypeIsNil() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldType)
|
||||
})
|
||||
}
|
||||
|
||||
// TypeNotNil applies the NotNil predicate on the "type" field.
|
||||
func TypeNotNil() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldType)
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersEQ applies the EQ predicate on the "max_users" field.
|
||||
func MaxUsersEQ(v int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.EQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersNEQ applies the NEQ predicate on the "max_users" field.
|
||||
func MaxUsersNEQ(v int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.NEQ(v))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersIn applies the In predicate on the "max_users" field.
|
||||
func MaxUsersIn(vs ...int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.Within(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersNotIn applies the NotIn predicate on the "max_users" field.
|
||||
func MaxUsersNotIn(vs ...int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.Without(vs...))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersGT applies the GT predicate on the "max_users" field.
|
||||
func MaxUsersGT(v int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.GT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersGTE applies the GTE predicate on the "max_users" field.
|
||||
func MaxUsersGTE(v int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.GTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersLT applies the LT predicate on the "max_users" field.
|
||||
func MaxUsersLT(v int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.LT(v))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersLTE applies the LTE predicate on the "max_users" field.
|
||||
func MaxUsersLTE(v int) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldMaxUsers, p.LTE(v))
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersIsNil applies the IsNil predicate on the "max_users" field.
|
||||
func MaxUsersIsNil() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).HasNot(FieldMaxUsers)
|
||||
})
|
||||
}
|
||||
|
||||
// MaxUsersNotNil applies the NotNil predicate on the "max_users" field.
|
||||
func MaxUsersNotNil() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.HasLabel(Label).Has(FieldMaxUsers)
|
||||
})
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(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.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.Has(Label, FieldName, p.EndingWith(v))
|
||||
})
|
||||
}
|
||||
|
||||
// HasFiles applies the HasEdge predicate on the "files" edge.
|
||||
func HasFiles() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.OutE(FilesLabel).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasFilesWith applies the HasEdge predicate on the "files" edge with a given conditions (other predicates).
|
||||
func HasFilesWith(preds ...predicate.File) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
tr := __.InV()
|
||||
for _, p := range preds {
|
||||
p(tr)
|
||||
}
|
||||
t.OutE(FilesLabel).Where(tr).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasBlocked applies the HasEdge predicate on the "blocked" edge.
|
||||
func HasBlocked() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.OutE(BlockedLabel).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasBlockedWith applies the HasEdge predicate on the "blocked" edge with a given conditions (other predicates).
|
||||
func HasBlockedWith(preds ...predicate.User) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
tr := __.InV()
|
||||
for _, p := range preds {
|
||||
p(tr)
|
||||
}
|
||||
t.OutE(BlockedLabel).Where(tr).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasUsers applies the HasEdge predicate on the "users" edge.
|
||||
func HasUsers() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.InE(UsersInverseLabel).InV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasUsersWith applies the HasEdge predicate on the "users" edge with a given conditions (other predicates).
|
||||
func HasUsersWith(preds ...predicate.User) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
tr := __.OutV()
|
||||
for _, p := range preds {
|
||||
p(tr)
|
||||
}
|
||||
t.InE(UsersInverseLabel).Where(tr).InV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasInfo applies the HasEdge predicate on the "info" edge.
|
||||
func HasInfo() predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
t.OutE(InfoLabel).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// HasInfoWith applies the HasEdge predicate on the "info" edge with a given conditions (other predicates).
|
||||
func HasInfoWith(preds ...predicate.GroupInfo) predicate.Group {
|
||||
return predicate.Group(func(t *dsl.Traversal) {
|
||||
tr := __.InV()
|
||||
for _, p := range preds {
|
||||
p(tr)
|
||||
}
|
||||
t.OutE(InfoLabel).Where(tr).OutV()
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Group) predicate.Group {
|
||||
return predicate.Group(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.Group) predicate.Group {
|
||||
return predicate.Group(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.Group) predicate.Group {
|
||||
return predicate.Group(func(tr *dsl.Traversal) {
|
||||
t := __.New()
|
||||
p(t)
|
||||
tr.Where(__.Not(t))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user