snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
227
entc/integration/ent/group/group.go
Normal file
227
entc/integration/ent/group/group.go
Normal file
@@ -0,0 +1,227 @@
|
||||
// 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/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
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"
|
||||
// Table holds the table name of the group in the database.
|
||||
Table = "groups"
|
||||
// FilesTable is the table that holds the files relation/edge.
|
||||
FilesTable = "files"
|
||||
// FilesInverseTable is the table name for the File entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "file" package.
|
||||
FilesInverseTable = "files"
|
||||
// FilesColumn is the table column denoting the files relation/edge.
|
||||
FilesColumn = "group_files"
|
||||
// BlockedTable is the table that holds the blocked relation/edge.
|
||||
BlockedTable = "users"
|
||||
// BlockedInverseTable is the table name for the User entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "user" package.
|
||||
BlockedInverseTable = "users"
|
||||
// BlockedColumn is the table column denoting the blocked relation/edge.
|
||||
BlockedColumn = "group_blocked"
|
||||
// UsersTable is the table that holds the users relation/edge. The primary key declared below.
|
||||
UsersTable = "user_groups"
|
||||
// UsersInverseTable is the table name for the User entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "user" package.
|
||||
UsersInverseTable = "users"
|
||||
// InfoTable is the table that holds the info relation/edge.
|
||||
InfoTable = "groups"
|
||||
// InfoInverseTable is the table name for the GroupInfo entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "groupinfo" package.
|
||||
InfoInverseTable = "group_infos"
|
||||
// InfoColumn is the table column denoting the info relation/edge.
|
||||
InfoColumn = "group_info"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for group fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldActive,
|
||||
FieldExpire,
|
||||
FieldType,
|
||||
FieldMaxUsers,
|
||||
FieldName,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "groups"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"group_info",
|
||||
}
|
||||
|
||||
var (
|
||||
// UsersPrimaryKey and UsersColumn2 are the table columns denoting the
|
||||
// primary key for the users relation (M2M).
|
||||
UsersPrimaryKey = []string{"user_id", "group_id"}
|
||||
)
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
for i := range ForeignKeys {
|
||||
if column == ForeignKeys[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// 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(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByActive orders the results by the active field.
|
||||
func ByActive(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldActive, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByExpire orders the results by the expire field.
|
||||
func ByExpire(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldExpire, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByType orders the results by the type field.
|
||||
func ByType(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldType, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMaxUsers orders the results by the max_users field.
|
||||
func ByMaxUsers(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMaxUsers, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByName orders the results by the name field.
|
||||
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByFilesCount orders the results by files count.
|
||||
func ByFilesCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newFilesStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByFiles orders the results by files terms.
|
||||
func ByFiles(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newFilesStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByBlockedCount orders the results by blocked count.
|
||||
func ByBlockedCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newBlockedStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByBlocked orders the results by blocked terms.
|
||||
func ByBlocked(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newBlockedStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByUsersCount orders the results by users count.
|
||||
func ByUsersCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newUsersStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByUsers orders the results by users terms.
|
||||
func ByUsers(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newUsersStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByInfoField orders the results by info field.
|
||||
func ByInfoField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newInfoStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newFilesStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(FilesInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, FilesTable, FilesColumn),
|
||||
)
|
||||
}
|
||||
func newBlockedStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(BlockedInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, BlockedTable, BlockedColumn),
|
||||
)
|
||||
}
|
||||
func newUsersStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(UsersInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, UsersTable, UsersPrimaryKey...),
|
||||
)
|
||||
}
|
||||
func newInfoStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(InfoInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, false, InfoTable, InfoColumn),
|
||||
)
|
||||
}
|
||||
|
||||
// comment from another template.
|
||||
770
entc/integration/ent/group/mutation.go
Normal file
770
entc/integration/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/sql"
|
||||
"entgo.io/ent/entc/integration/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[int]struct{}
|
||||
removedfiles map[int]struct{}
|
||||
clearedfiles bool
|
||||
blocked map[int]struct{}
|
||||
removedblocked map[int]struct{}
|
||||
clearedblocked bool
|
||||
users map[int]struct{}
|
||||
removedusers map[int]struct{}
|
||||
clearedusers bool
|
||||
info *int
|
||||
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 ...int) {
|
||||
if m.files == nil {
|
||||
m.files = make(map[int]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 ...int) {
|
||||
if m.removedfiles == nil {
|
||||
m.removedfiles = make(map[int]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 []int) {
|
||||
for id := range m.removedfiles {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// FilesIDs returns the "files" edge IDs in the mutation.
|
||||
func (m *Mutation) FilesIDs() (ids []int) {
|
||||
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 ...int) {
|
||||
if m.blocked == nil {
|
||||
m.blocked = make(map[int]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 ...int) {
|
||||
if m.removedblocked == nil {
|
||||
m.removedblocked = make(map[int]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 []int) {
|
||||
for id := range m.removedblocked {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// BlockedIDs returns the "blocked" edge IDs in the mutation.
|
||||
func (m *Mutation) BlockedIDs() (ids []int) {
|
||||
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 ...int) {
|
||||
if m.users == nil {
|
||||
m.users = make(map[int]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 ...int) {
|
||||
if m.removedusers == nil {
|
||||
m.removedusers = make(map[int]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 []int) {
|
||||
for id := range m.removedusers {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UsersIDs returns the "users" edge IDs in the mutation.
|
||||
func (m *Mutation) UsersIDs() (ids []int) {
|
||||
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 int) {
|
||||
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 int, 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 []int) {
|
||||
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(*sql.Selector)) {
|
||||
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)
|
||||
}
|
||||
432
entc/integration/ent/group/where.go
Normal file
432
entc/integration/ent/group/where.go
Normal file
@@ -0,0 +1,432 @@
|
||||
// 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/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/entc/integration/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.Group {
|
||||
return predicate.Group(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int) predicate.Group {
|
||||
return predicate.Group(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int) predicate.Group {
|
||||
return predicate.Group(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.Group {
|
||||
return predicate.Group(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.Group {
|
||||
return predicate.Group(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.Group {
|
||||
return predicate.Group(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.Group {
|
||||
return predicate.Group(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// Active applies equality check predicate on the "active" field. It's identical to ActiveEQ.
|
||||
func Active(v bool) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldActive, 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(sql.FieldEQ(FieldExpire, v))
|
||||
}
|
||||
|
||||
// Type applies equality check predicate on the "type" field. It's identical to TypeEQ.
|
||||
func Type(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldType, 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(sql.FieldEQ(FieldMaxUsers, v))
|
||||
}
|
||||
|
||||
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
||||
func Name(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// ActiveEQ applies the EQ predicate on the "active" field.
|
||||
func ActiveEQ(v bool) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// ActiveNEQ applies the NEQ predicate on the "active" field.
|
||||
func ActiveNEQ(v bool) predicate.Group {
|
||||
return predicate.Group(sql.FieldNEQ(FieldActive, v))
|
||||
}
|
||||
|
||||
// ExpireEQ applies the EQ predicate on the "expire" field.
|
||||
func ExpireEQ(v time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldExpire, v))
|
||||
}
|
||||
|
||||
// ExpireNEQ applies the NEQ predicate on the "expire" field.
|
||||
func ExpireNEQ(v time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldNEQ(FieldExpire, v))
|
||||
}
|
||||
|
||||
// ExpireIn applies the In predicate on the "expire" field.
|
||||
func ExpireIn(vs ...time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldIn(FieldExpire, vs...))
|
||||
}
|
||||
|
||||
// ExpireNotIn applies the NotIn predicate on the "expire" field.
|
||||
func ExpireNotIn(vs ...time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldNotIn(FieldExpire, vs...))
|
||||
}
|
||||
|
||||
// ExpireGT applies the GT predicate on the "expire" field.
|
||||
func ExpireGT(v time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldGT(FieldExpire, v))
|
||||
}
|
||||
|
||||
// ExpireGTE applies the GTE predicate on the "expire" field.
|
||||
func ExpireGTE(v time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldGTE(FieldExpire, v))
|
||||
}
|
||||
|
||||
// ExpireLT applies the LT predicate on the "expire" field.
|
||||
func ExpireLT(v time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldLT(FieldExpire, v))
|
||||
}
|
||||
|
||||
// ExpireLTE applies the LTE predicate on the "expire" field.
|
||||
func ExpireLTE(v time.Time) predicate.Group {
|
||||
return predicate.Group(sql.FieldLTE(FieldExpire, v))
|
||||
}
|
||||
|
||||
// TypeEQ applies the EQ predicate on the "type" field.
|
||||
func TypeEQ(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeNEQ applies the NEQ predicate on the "type" field.
|
||||
func TypeNEQ(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldNEQ(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeIn applies the In predicate on the "type" field.
|
||||
func TypeIn(vs ...string) predicate.Group {
|
||||
return predicate.Group(sql.FieldIn(FieldType, vs...))
|
||||
}
|
||||
|
||||
// TypeNotIn applies the NotIn predicate on the "type" field.
|
||||
func TypeNotIn(vs ...string) predicate.Group {
|
||||
return predicate.Group(sql.FieldNotIn(FieldType, vs...))
|
||||
}
|
||||
|
||||
// TypeGT applies the GT predicate on the "type" field.
|
||||
func TypeGT(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldGT(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeGTE applies the GTE predicate on the "type" field.
|
||||
func TypeGTE(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldGTE(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeLT applies the LT predicate on the "type" field.
|
||||
func TypeLT(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldLT(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeLTE applies the LTE predicate on the "type" field.
|
||||
func TypeLTE(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldLTE(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeContains applies the Contains predicate on the "type" field.
|
||||
func TypeContains(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldContains(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeHasPrefix applies the HasPrefix predicate on the "type" field.
|
||||
func TypeHasPrefix(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldHasPrefix(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeHasSuffix applies the HasSuffix predicate on the "type" field.
|
||||
func TypeHasSuffix(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldHasSuffix(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeIsNil applies the IsNil predicate on the "type" field.
|
||||
func TypeIsNil() predicate.Group {
|
||||
return predicate.Group(sql.FieldIsNull(FieldType))
|
||||
}
|
||||
|
||||
// TypeNotNil applies the NotNil predicate on the "type" field.
|
||||
func TypeNotNil() predicate.Group {
|
||||
return predicate.Group(sql.FieldNotNull(FieldType))
|
||||
}
|
||||
|
||||
// TypeEqualFold applies the EqualFold predicate on the "type" field.
|
||||
func TypeEqualFold(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldEqualFold(FieldType, v))
|
||||
}
|
||||
|
||||
// TypeContainsFold applies the ContainsFold predicate on the "type" field.
|
||||
func TypeContainsFold(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldContainsFold(FieldType, v))
|
||||
}
|
||||
|
||||
// MaxUsersEQ applies the EQ predicate on the "max_users" field.
|
||||
func MaxUsersEQ(v int) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldMaxUsers, v))
|
||||
}
|
||||
|
||||
// MaxUsersNEQ applies the NEQ predicate on the "max_users" field.
|
||||
func MaxUsersNEQ(v int) predicate.Group {
|
||||
return predicate.Group(sql.FieldNEQ(FieldMaxUsers, v))
|
||||
}
|
||||
|
||||
// MaxUsersIn applies the In predicate on the "max_users" field.
|
||||
func MaxUsersIn(vs ...int) predicate.Group {
|
||||
return predicate.Group(sql.FieldIn(FieldMaxUsers, vs...))
|
||||
}
|
||||
|
||||
// MaxUsersNotIn applies the NotIn predicate on the "max_users" field.
|
||||
func MaxUsersNotIn(vs ...int) predicate.Group {
|
||||
return predicate.Group(sql.FieldNotIn(FieldMaxUsers, vs...))
|
||||
}
|
||||
|
||||
// MaxUsersGT applies the GT predicate on the "max_users" field.
|
||||
func MaxUsersGT(v int) predicate.Group {
|
||||
return predicate.Group(sql.FieldGT(FieldMaxUsers, v))
|
||||
}
|
||||
|
||||
// MaxUsersGTE applies the GTE predicate on the "max_users" field.
|
||||
func MaxUsersGTE(v int) predicate.Group {
|
||||
return predicate.Group(sql.FieldGTE(FieldMaxUsers, v))
|
||||
}
|
||||
|
||||
// MaxUsersLT applies the LT predicate on the "max_users" field.
|
||||
func MaxUsersLT(v int) predicate.Group {
|
||||
return predicate.Group(sql.FieldLT(FieldMaxUsers, v))
|
||||
}
|
||||
|
||||
// MaxUsersLTE applies the LTE predicate on the "max_users" field.
|
||||
func MaxUsersLTE(v int) predicate.Group {
|
||||
return predicate.Group(sql.FieldLTE(FieldMaxUsers, v))
|
||||
}
|
||||
|
||||
// MaxUsersIsNil applies the IsNil predicate on the "max_users" field.
|
||||
func MaxUsersIsNil() predicate.Group {
|
||||
return predicate.Group(sql.FieldIsNull(FieldMaxUsers))
|
||||
}
|
||||
|
||||
// MaxUsersNotNil applies the NotNil predicate on the "max_users" field.
|
||||
func MaxUsersNotNil() predicate.Group {
|
||||
return predicate.Group(sql.FieldNotNull(FieldMaxUsers))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// NameNEQ applies the NEQ predicate on the "name" field.
|
||||
func NameNEQ(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldNEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.Group {
|
||||
return predicate.Group(sql.FieldIn(FieldName, vs...))
|
||||
}
|
||||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.Group {
|
||||
return predicate.Group(sql.FieldNotIn(FieldName, vs...))
|
||||
}
|
||||
|
||||
// NameGT applies the GT predicate on the "name" field.
|
||||
func NameGT(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldGT(FieldName, v))
|
||||
}
|
||||
|
||||
// NameGTE applies the GTE predicate on the "name" field.
|
||||
func NameGTE(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldGTE(FieldName, v))
|
||||
}
|
||||
|
||||
// NameLT applies the LT predicate on the "name" field.
|
||||
func NameLT(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldLT(FieldName, v))
|
||||
}
|
||||
|
||||
// NameLTE applies the LTE predicate on the "name" field.
|
||||
func NameLTE(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldLTE(FieldName, v))
|
||||
}
|
||||
|
||||
// NameContains applies the Contains predicate on the "name" field.
|
||||
func NameContains(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldContains(FieldName, v))
|
||||
}
|
||||
|
||||
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
|
||||
func NameHasPrefix(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldHasPrefix(FieldName, v))
|
||||
}
|
||||
|
||||
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
|
||||
func NameHasSuffix(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldHasSuffix(FieldName, v))
|
||||
}
|
||||
|
||||
// NameEqualFold applies the EqualFold predicate on the "name" field.
|
||||
func NameEqualFold(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldEqualFold(FieldName, v))
|
||||
}
|
||||
|
||||
// NameContainsFold applies the ContainsFold predicate on the "name" field.
|
||||
func NameContainsFold(v string) predicate.Group {
|
||||
return predicate.Group(sql.FieldContainsFold(FieldName, v))
|
||||
}
|
||||
|
||||
// HasFiles applies the HasEdge predicate on the "files" edge.
|
||||
func HasFiles() predicate.Group {
|
||||
return predicate.Group(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, FilesTable, FilesColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// 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(s *sql.Selector) {
|
||||
step := newFilesStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasBlocked applies the HasEdge predicate on the "blocked" edge.
|
||||
func HasBlocked() predicate.Group {
|
||||
return predicate.Group(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, BlockedTable, BlockedColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// 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(s *sql.Selector) {
|
||||
step := newBlockedStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasUsers applies the HasEdge predicate on the "users" edge.
|
||||
func HasUsers() predicate.Group {
|
||||
return predicate.Group(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, UsersTable, UsersPrimaryKey...),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// 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(s *sql.Selector) {
|
||||
step := newUsersStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasInfo applies the HasEdge predicate on the "info" edge.
|
||||
func HasInfo() predicate.Group {
|
||||
return predicate.Group(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, false, InfoTable, InfoColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// 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(s *sql.Selector) {
|
||||
step := newInfoStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.Group) predicate.Group {
|
||||
return predicate.Group(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Group) predicate.Group {
|
||||
return predicate.Group(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Group) predicate.Group {
|
||||
return predicate.Group(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user