snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
407
entc/integration/edgeschema/ent/usergroup/mutation.go
Normal file
407
entc/integration/edgeschema/ent/usergroup/mutation.go
Normal file
@@ -0,0 +1,407 @@
|
||||
// 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 usergroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/entc/integration/edgeschema/ent/predicate"
|
||||
)
|
||||
|
||||
// Mutation represents an operation that mutates the UserGroup nodes in the graph.
|
||||
type Mutation struct {
|
||||
op ent.Op
|
||||
typ string
|
||||
joined_at *time.Time
|
||||
clearedFields map[string]struct{}
|
||||
user *int
|
||||
cleareduser bool
|
||||
group *int
|
||||
clearedgroup bool
|
||||
predicates []predicate.UserGroup
|
||||
}
|
||||
|
||||
// NewMutation creates a new Mutation for the UserGroup entity.
|
||||
func NewMutation(op ent.Op) *Mutation {
|
||||
return &Mutation{
|
||||
op: op,
|
||||
typ: "UserGroup",
|
||||
clearedFields: make(map[string]struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
// Predicates returns the list of predicates set on the mutation.
|
||||
func (m *Mutation) Predicates() []predicate.UserGroup {
|
||||
return m.predicates
|
||||
}
|
||||
|
||||
// SetJoinedAt sets the "joined_at" field.
|
||||
func (m *Mutation) SetJoinedAt(t time.Time) {
|
||||
m.joined_at = &t
|
||||
}
|
||||
|
||||
// JoinedAt returns the value of the "joined_at" field in the mutation.
|
||||
func (m *Mutation) JoinedAt() (r time.Time, exists bool) {
|
||||
v := m.joined_at
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetJoinedAt resets all changes to the "joined_at" field.
|
||||
func (m *Mutation) ResetJoinedAt() {
|
||||
m.joined_at = nil
|
||||
}
|
||||
|
||||
// SetUserID sets the "user_id" field.
|
||||
func (m *Mutation) SetUserID(i int) {
|
||||
m.user = &i
|
||||
}
|
||||
|
||||
// UserID returns the value of the "user_id" field in the mutation.
|
||||
func (m *Mutation) UserID() (r int, exists bool) {
|
||||
v := m.user
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetUserID resets all changes to the "user_id" field.
|
||||
func (m *Mutation) ResetUserID() {
|
||||
m.user = nil
|
||||
}
|
||||
|
||||
// SetGroupID sets the "group_id" field.
|
||||
func (m *Mutation) SetGroupID(i int) {
|
||||
m.group = &i
|
||||
}
|
||||
|
||||
// GroupID returns the value of the "group_id" field in the mutation.
|
||||
func (m *Mutation) GroupID() (r int, exists bool) {
|
||||
v := m.group
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetGroupID resets all changes to the "group_id" field.
|
||||
func (m *Mutation) ResetGroupID() {
|
||||
m.group = nil
|
||||
}
|
||||
|
||||
// ClearUser clears the "user" edge to the User entity.
|
||||
func (m *Mutation) ClearUser() {
|
||||
m.cleareduser = true
|
||||
m.clearedFields[FieldUserID] = struct{}{}
|
||||
}
|
||||
|
||||
// UserCleared reports if the "user" edge to the User entity was cleared.
|
||||
func (m *Mutation) UserCleared() bool {
|
||||
return m.cleareduser
|
||||
}
|
||||
|
||||
// UserIDs returns the "user" edge IDs in the mutation.
|
||||
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
||||
// UserID instead. It exists only for internal usage by the builders.
|
||||
func (m *Mutation) UserIDs() (ids []int) {
|
||||
if id := m.user; id != nil {
|
||||
ids = append(ids, *id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetUser resets all changes to the "user" edge.
|
||||
func (m *Mutation) ResetUser() {
|
||||
m.user = nil
|
||||
m.cleareduser = false
|
||||
}
|
||||
|
||||
// ClearGroup clears the "group" edge to the Group entity.
|
||||
func (m *Mutation) ClearGroup() {
|
||||
m.clearedgroup = true
|
||||
m.clearedFields[FieldGroupID] = struct{}{}
|
||||
}
|
||||
|
||||
// GroupCleared reports if the "group" edge to the Group entity was cleared.
|
||||
func (m *Mutation) GroupCleared() bool {
|
||||
return m.clearedgroup
|
||||
}
|
||||
|
||||
// GroupIDs returns the "group" edge IDs in the mutation.
|
||||
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
||||
// GroupID instead. It exists only for internal usage by the builders.
|
||||
func (m *Mutation) GroupIDs() (ids []int) {
|
||||
if id := m.group; id != nil {
|
||||
ids = append(ids, *id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetGroup resets all changes to the "group" edge.
|
||||
func (m *Mutation) ResetGroup() {
|
||||
m.group = nil
|
||||
m.clearedgroup = false
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the Mutation builder.
|
||||
func (m *Mutation) Where(ps ...predicate.UserGroup) {
|
||||
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.UserGroup, 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 (UserGroup).
|
||||
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, 3)
|
||||
if m.joined_at != nil {
|
||||
fields = append(fields, FieldJoinedAt)
|
||||
}
|
||||
if m.user != nil {
|
||||
fields = append(fields, FieldUserID)
|
||||
}
|
||||
if m.group != nil {
|
||||
fields = append(fields, FieldGroupID)
|
||||
}
|
||||
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 FieldJoinedAt:
|
||||
return m.JoinedAt()
|
||||
case FieldUserID:
|
||||
return m.UserID()
|
||||
case FieldGroupID:
|
||||
return m.GroupID()
|
||||
}
|
||||
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 UserGroup 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 FieldJoinedAt:
|
||||
v, ok := value.(time.Time)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetJoinedAt(v)
|
||||
return nil
|
||||
case FieldUserID:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUserID(v)
|
||||
return nil
|
||||
case FieldGroupID:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetGroupID(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserGroup field %s", name)
|
||||
}
|
||||
|
||||
// AddedFields returns all numeric fields that were incremented/decremented during
|
||||
// this mutation.
|
||||
func (m *Mutation) AddedFields() []string {
|
||||
var fields []string
|
||||
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 {
|
||||
}
|
||||
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 {
|
||||
}
|
||||
return fmt.Errorf("unknown UserGroup numeric field %s", name)
|
||||
}
|
||||
|
||||
// ClearedFields returns all nullable fields that were cleared during this
|
||||
// mutation.
|
||||
func (m *Mutation) ClearedFields() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 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 {
|
||||
return fmt.Errorf("unknown UserGroup 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 FieldJoinedAt:
|
||||
m.ResetJoinedAt()
|
||||
return nil
|
||||
case FieldUserID:
|
||||
m.ResetUserID()
|
||||
return nil
|
||||
case FieldGroupID:
|
||||
m.ResetGroupID()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserGroup field %s", name)
|
||||
}
|
||||
|
||||
// AddedEdges returns all edge names that were set/added in this mutation.
|
||||
func (m *Mutation) AddedEdges() []string {
|
||||
edges := make([]string, 0, 2)
|
||||
if m.user != nil {
|
||||
edges = append(edges, EdgeUser)
|
||||
}
|
||||
if m.group != nil {
|
||||
edges = append(edges, EdgeGroup)
|
||||
}
|
||||
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 EdgeUser:
|
||||
if id := m.user; id != nil {
|
||||
return []ent.Value{*id}
|
||||
}
|
||||
case EdgeGroup:
|
||||
if id := m.group; 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, 2)
|
||||
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 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ClearedEdges returns all edge names that were cleared in this mutation.
|
||||
func (m *Mutation) ClearedEdges() []string {
|
||||
edges := make([]string, 0, 2)
|
||||
if m.cleareduser {
|
||||
edges = append(edges, EdgeUser)
|
||||
}
|
||||
if m.clearedgroup {
|
||||
edges = append(edges, EdgeGroup)
|
||||
}
|
||||
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 EdgeUser:
|
||||
return m.cleareduser
|
||||
case EdgeGroup:
|
||||
return m.clearedgroup
|
||||
}
|
||||
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 EdgeUser:
|
||||
m.ClearUser()
|
||||
return nil
|
||||
case EdgeGroup:
|
||||
m.ClearGroup()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserGroup 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 EdgeUser:
|
||||
m.ResetUser()
|
||||
return nil
|
||||
case EdgeGroup:
|
||||
m.ResetGroup()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown UserGroup edge %s", name)
|
||||
}
|
||||
121
entc/integration/edgeschema/ent/usergroup/usergroup.go
Normal file
121
entc/integration/edgeschema/ent/usergroup/usergroup.go
Normal file
@@ -0,0 +1,121 @@
|
||||
// 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 usergroup
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the usergroup type in the database.
|
||||
Label = "user_group"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldJoinedAt holds the string denoting the joined_at field in the database.
|
||||
FieldJoinedAt = "joined_at"
|
||||
// FieldUserID holds the string denoting the user_id field in the database.
|
||||
FieldUserID = "user_id"
|
||||
// FieldGroupID holds the string denoting the group_id field in the database.
|
||||
FieldGroupID = "group_id"
|
||||
// EdgeUser holds the string denoting the user edge name in mutations.
|
||||
EdgeUser = "user"
|
||||
// EdgeGroup holds the string denoting the group edge name in mutations.
|
||||
EdgeGroup = "group"
|
||||
// Table holds the table name of the usergroup in the database.
|
||||
Table = "user_groups"
|
||||
// UserTable is the table that holds the user relation/edge.
|
||||
UserTable = "user_groups"
|
||||
// UserInverseTable is the table name for the User entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "user" package.
|
||||
UserInverseTable = "users"
|
||||
// UserColumn is the table column denoting the user relation/edge.
|
||||
UserColumn = "user_id"
|
||||
// GroupTable is the table that holds the group relation/edge.
|
||||
GroupTable = "user_groups"
|
||||
// GroupInverseTable is the table name for the Group entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "group" package.
|
||||
GroupInverseTable = "groups"
|
||||
// GroupColumn is the table column denoting the group relation/edge.
|
||||
GroupColumn = "group_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for usergroup fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldJoinedAt,
|
||||
FieldUserID,
|
||||
FieldGroupID,
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// DefaultJoinedAt holds the default value on creation for the "joined_at" field.
|
||||
DefaultJoinedAt func() time.Time
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the UserGroup 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()
|
||||
}
|
||||
|
||||
// ByJoinedAt orders the results by the joined_at field.
|
||||
func ByJoinedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldJoinedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUserID orders the results by the user_id field.
|
||||
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUserID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByGroupID orders the results by the group_id field.
|
||||
func ByGroupID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldGroupID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUserField orders the results by user field.
|
||||
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
|
||||
// ByGroupField orders the results by group field.
|
||||
func ByGroupField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newGroupStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newUserStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(UserInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, false, UserTable, UserColumn),
|
||||
)
|
||||
}
|
||||
func newGroupStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(GroupInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, false, GroupTable, GroupColumn),
|
||||
)
|
||||
}
|
||||
216
entc/integration/edgeschema/ent/usergroup/where.go
Normal file
216
entc/integration/edgeschema/ent/usergroup/where.go
Normal file
@@ -0,0 +1,216 @@
|
||||
// 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 usergroup
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/entc/integration/edgeschema/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// JoinedAt applies equality check predicate on the "joined_at" field. It's identical to JoinedAtEQ.
|
||||
func JoinedAt(v time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldJoinedAt, v))
|
||||
}
|
||||
|
||||
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
||||
func UserID(v int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldUserID, v))
|
||||
}
|
||||
|
||||
// GroupID applies equality check predicate on the "group_id" field. It's identical to GroupIDEQ.
|
||||
func GroupID(v int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldGroupID, v))
|
||||
}
|
||||
|
||||
// JoinedAtEQ applies the EQ predicate on the "joined_at" field.
|
||||
func JoinedAtEQ(v time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldJoinedAt, v))
|
||||
}
|
||||
|
||||
// JoinedAtNEQ applies the NEQ predicate on the "joined_at" field.
|
||||
func JoinedAtNEQ(v time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNEQ(FieldJoinedAt, v))
|
||||
}
|
||||
|
||||
// JoinedAtIn applies the In predicate on the "joined_at" field.
|
||||
func JoinedAtIn(vs ...time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldIn(FieldJoinedAt, vs...))
|
||||
}
|
||||
|
||||
// JoinedAtNotIn applies the NotIn predicate on the "joined_at" field.
|
||||
func JoinedAtNotIn(vs ...time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNotIn(FieldJoinedAt, vs...))
|
||||
}
|
||||
|
||||
// JoinedAtGT applies the GT predicate on the "joined_at" field.
|
||||
func JoinedAtGT(v time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldGT(FieldJoinedAt, v))
|
||||
}
|
||||
|
||||
// JoinedAtGTE applies the GTE predicate on the "joined_at" field.
|
||||
func JoinedAtGTE(v time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldGTE(FieldJoinedAt, v))
|
||||
}
|
||||
|
||||
// JoinedAtLT applies the LT predicate on the "joined_at" field.
|
||||
func JoinedAtLT(v time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldLT(FieldJoinedAt, v))
|
||||
}
|
||||
|
||||
// JoinedAtLTE applies the LTE predicate on the "joined_at" field.
|
||||
func JoinedAtLTE(v time.Time) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldLTE(FieldJoinedAt, v))
|
||||
}
|
||||
|
||||
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
||||
func UserIDEQ(v int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldUserID, v))
|
||||
}
|
||||
|
||||
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
|
||||
func UserIDNEQ(v int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNEQ(FieldUserID, v))
|
||||
}
|
||||
|
||||
// UserIDIn applies the In predicate on the "user_id" field.
|
||||
func UserIDIn(vs ...int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldIn(FieldUserID, vs...))
|
||||
}
|
||||
|
||||
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
|
||||
func UserIDNotIn(vs ...int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNotIn(FieldUserID, vs...))
|
||||
}
|
||||
|
||||
// GroupIDEQ applies the EQ predicate on the "group_id" field.
|
||||
func GroupIDEQ(v int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldEQ(FieldGroupID, v))
|
||||
}
|
||||
|
||||
// GroupIDNEQ applies the NEQ predicate on the "group_id" field.
|
||||
func GroupIDNEQ(v int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNEQ(FieldGroupID, v))
|
||||
}
|
||||
|
||||
// GroupIDIn applies the In predicate on the "group_id" field.
|
||||
func GroupIDIn(vs ...int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldIn(FieldGroupID, vs...))
|
||||
}
|
||||
|
||||
// GroupIDNotIn applies the NotIn predicate on the "group_id" field.
|
||||
func GroupIDNotIn(vs ...int) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.FieldNotIn(FieldGroupID, vs...))
|
||||
}
|
||||
|
||||
// HasUser applies the HasEdge predicate on the "user" edge.
|
||||
func HasUser() predicate.UserGroup {
|
||||
return predicate.UserGroup(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, false, UserTable, UserColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasUserWith applies the HasEdge predicate on the "user" edge with a given conditions (other predicates).
|
||||
func HasUserWith(preds ...predicate.User) predicate.UserGroup {
|
||||
return predicate.UserGroup(func(s *sql.Selector) {
|
||||
step := newUserStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasGroup applies the HasEdge predicate on the "group" edge.
|
||||
func HasGroup() predicate.UserGroup {
|
||||
return predicate.UserGroup(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, false, GroupTable, GroupColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasGroupWith applies the HasEdge predicate on the "group" edge with a given conditions (other predicates).
|
||||
func HasGroupWith(preds ...predicate.Group) predicate.UserGroup {
|
||||
return predicate.UserGroup(func(s *sql.Selector) {
|
||||
step := newGroupStep()
|
||||
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.UserGroup) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.UserGroup) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.UserGroup) predicate.UserGroup {
|
||||
return predicate.UserGroup(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user