snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
162
entc/integration/customid/ent/blob/blob.go
Normal file
162
entc/integration/customid/ent/blob/blob.go
Normal file
@@ -0,0 +1,162 @@
|
||||
// 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 blob
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the blob type in the database.
|
||||
Label = "blob"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldUUID holds the string denoting the uuid field in the database.
|
||||
FieldUUID = "uuid"
|
||||
// FieldCount holds the string denoting the count field in the database.
|
||||
FieldCount = "count"
|
||||
// EdgeParent holds the string denoting the parent edge name in mutations.
|
||||
EdgeParent = "parent"
|
||||
// EdgeLinks holds the string denoting the links edge name in mutations.
|
||||
EdgeLinks = "links"
|
||||
// EdgeBlobLinks holds the string denoting the blob_links edge name in mutations.
|
||||
EdgeBlobLinks = "blob_links"
|
||||
// Table holds the table name of the blob in the database.
|
||||
Table = "blobs"
|
||||
// ParentTable is the table that holds the parent relation/edge.
|
||||
ParentTable = "blobs"
|
||||
// ParentColumn is the table column denoting the parent relation/edge.
|
||||
ParentColumn = "blob_parent"
|
||||
// LinksTable is the table that holds the links relation/edge. The primary key declared below.
|
||||
LinksTable = "blob_links"
|
||||
// BlobLinksTable is the table that holds the blob_links relation/edge.
|
||||
BlobLinksTable = "blob_links"
|
||||
// BlobLinksInverseTable is the table name for the BlobLink entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "bloblink" package.
|
||||
BlobLinksInverseTable = "blob_links"
|
||||
// BlobLinksColumn is the table column denoting the blob_links relation/edge.
|
||||
BlobLinksColumn = "blob_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for blob fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldUUID,
|
||||
FieldCount,
|
||||
}
|
||||
|
||||
// ForeignKeys holds the SQL foreign-keys that are owned by the "blobs"
|
||||
// table and are not defined as standalone fields in the schema.
|
||||
var ForeignKeys = []string{
|
||||
"blob_parent",
|
||||
}
|
||||
|
||||
var (
|
||||
// LinksPrimaryKey and LinksColumn2 are the table columns denoting the
|
||||
// primary key for the links relation (M2M).
|
||||
LinksPrimaryKey = []string{"blob_id", "link_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 (
|
||||
// DefaultUUID holds the default value on creation for the "uuid" field.
|
||||
DefaultUUID func() uuid.UUID
|
||||
// DefaultCount holds the default value on creation for the "count" field.
|
||||
DefaultCount int
|
||||
// DefaultID holds the default value on creation for the "id" field.
|
||||
DefaultID func() uuid.UUID
|
||||
)
|
||||
|
||||
// OrderOption defines the ordering options for the Blob 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()
|
||||
}
|
||||
|
||||
// ByUUID orders the results by the uuid field.
|
||||
func ByUUID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUUID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCount orders the results by the count field.
|
||||
func ByCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCount, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByParentField orders the results by parent field.
|
||||
func ByParentField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newParentStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
|
||||
// ByLinksCount orders the results by links count.
|
||||
func ByLinksCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newLinksStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByLinks orders the results by links terms.
|
||||
func ByLinks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newLinksStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByBlobLinksCount orders the results by blob_links count.
|
||||
func ByBlobLinksCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newBlobLinksStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByBlobLinks orders the results by blob_links terms.
|
||||
func ByBlobLinks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newBlobLinksStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newParentStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2O, false, ParentTable, ParentColumn),
|
||||
)
|
||||
}
|
||||
func newLinksStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, LinksTable, LinksPrimaryKey...),
|
||||
)
|
||||
}
|
||||
func newBlobLinksStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(BlobLinksInverseTable, BlobLinksColumn),
|
||||
sqlgraph.Edge(sqlgraph.O2M, true, BlobLinksTable, BlobLinksColumn),
|
||||
)
|
||||
}
|
||||
457
entc/integration/customid/ent/blob/mutation.go
Normal file
457
entc/integration/customid/ent/blob/mutation.go
Normal file
@@ -0,0 +1,457 @@
|
||||
// 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 blob
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/entc/integration/customid/ent/predicate"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// Mutation represents an operation that mutates the Blob nodes in the graph.
|
||||
type Mutation struct {
|
||||
op ent.Op
|
||||
typ string
|
||||
uuid *uuid.UUID
|
||||
count *int
|
||||
addcount *int
|
||||
clearedFields map[string]struct{}
|
||||
parent *uuid.UUID
|
||||
clearedparent bool
|
||||
links map[uuid.UUID]struct{}
|
||||
removedlinks map[uuid.UUID]struct{}
|
||||
clearedlinks bool
|
||||
predicates []predicate.Blob
|
||||
}
|
||||
|
||||
// NewMutation creates a new Mutation for the Blob entity.
|
||||
func NewMutation(op ent.Op) *Mutation {
|
||||
return &Mutation{
|
||||
op: op,
|
||||
typ: "Blob",
|
||||
clearedFields: make(map[string]struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
// Predicates returns the list of predicates set on the mutation.
|
||||
func (m *Mutation) Predicates() []predicate.Blob {
|
||||
return m.predicates
|
||||
}
|
||||
|
||||
// SetUUID sets the "uuid" field.
|
||||
func (m *Mutation) SetUUID(u uuid.UUID) {
|
||||
m.uuid = &u
|
||||
}
|
||||
|
||||
// UUID returns the value of the "uuid" field in the mutation.
|
||||
func (m *Mutation) UUID() (r uuid.UUID, exists bool) {
|
||||
v := m.uuid
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetUUID resets all changes to the "uuid" field.
|
||||
func (m *Mutation) ResetUUID() {
|
||||
m.uuid = nil
|
||||
}
|
||||
|
||||
// SetCount sets the "count" field.
|
||||
func (m *Mutation) SetCount(i int) {
|
||||
m.count = &i
|
||||
m.addcount = nil
|
||||
}
|
||||
|
||||
// Count returns the value of the "count" field in the mutation.
|
||||
func (m *Mutation) Count() (r int, exists bool) {
|
||||
v := m.count
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// AddCount adds i to the "count" field.
|
||||
func (m *Mutation) AddCount(i int) {
|
||||
if m.addcount != nil {
|
||||
*m.addcount += i
|
||||
} else {
|
||||
m.addcount = &i
|
||||
}
|
||||
}
|
||||
|
||||
// AddedCount returns the value that was added to the "count" field in this mutation.
|
||||
func (m *Mutation) AddedCount() (r int, exists bool) {
|
||||
v := m.addcount
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ResetCount resets all changes to the "count" field.
|
||||
func (m *Mutation) ResetCount() {
|
||||
m.count = nil
|
||||
m.addcount = nil
|
||||
}
|
||||
|
||||
// SetParentID sets the "parent" edge to the Blob entity by id.
|
||||
func (m *Mutation) SetParentID(id uuid.UUID) {
|
||||
m.parent = &id
|
||||
}
|
||||
|
||||
// ClearParent clears the "parent" edge to the Blob entity.
|
||||
func (m *Mutation) ClearParent() {
|
||||
m.clearedparent = true
|
||||
}
|
||||
|
||||
// ParentCleared reports if the "parent" edge to the Blob entity was cleared.
|
||||
func (m *Mutation) ParentCleared() bool {
|
||||
return m.clearedparent
|
||||
}
|
||||
|
||||
// ParentID returns the "parent" edge ID in the mutation.
|
||||
func (m *Mutation) ParentID() (id uuid.UUID, exists bool) {
|
||||
if m.parent != nil {
|
||||
return *m.parent, true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ParentIDs returns the "parent" edge IDs in the mutation.
|
||||
// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use
|
||||
// ParentID instead. It exists only for internal usage by the builders.
|
||||
func (m *Mutation) ParentIDs() (ids []uuid.UUID) {
|
||||
if id := m.parent; id != nil {
|
||||
ids = append(ids, *id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetParent resets all changes to the "parent" edge.
|
||||
func (m *Mutation) ResetParent() {
|
||||
m.parent = nil
|
||||
m.clearedparent = false
|
||||
}
|
||||
|
||||
// AddLinkIDs adds the "links" edge to the Blob entity by ids.
|
||||
func (m *Mutation) AddLinkIDs(ids ...uuid.UUID) {
|
||||
if m.links == nil {
|
||||
m.links = make(map[uuid.UUID]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
m.links[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// ClearLinks clears the "links" edge to the Blob entity.
|
||||
func (m *Mutation) ClearLinks() {
|
||||
m.clearedlinks = true
|
||||
}
|
||||
|
||||
// LinksCleared reports if the "links" edge to the Blob entity was cleared.
|
||||
func (m *Mutation) LinksCleared() bool {
|
||||
return m.clearedlinks
|
||||
}
|
||||
|
||||
// RemoveLinkIDs removes the "links" edge to the Blob entity by IDs.
|
||||
func (m *Mutation) RemoveLinkIDs(ids ...uuid.UUID) {
|
||||
if m.removedlinks == nil {
|
||||
m.removedlinks = make(map[uuid.UUID]struct{})
|
||||
}
|
||||
for i := range ids {
|
||||
delete(m.links, ids[i])
|
||||
m.removedlinks[ids[i]] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
// RemovedLinks returns the removed IDs of the "links" edge to the Blob entity.
|
||||
func (m *Mutation) RemovedLinksIDs() (ids []uuid.UUID) {
|
||||
for id := range m.removedlinks {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// LinksIDs returns the "links" edge IDs in the mutation.
|
||||
func (m *Mutation) LinksIDs() (ids []uuid.UUID) {
|
||||
for id := range m.links {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResetLinks resets all changes to the "links" edge.
|
||||
func (m *Mutation) ResetLinks() {
|
||||
m.links = nil
|
||||
m.clearedlinks = false
|
||||
m.removedlinks = nil
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the Mutation builder.
|
||||
func (m *Mutation) Where(ps ...predicate.Blob) {
|
||||
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.Blob, 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 (Blob).
|
||||
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, 2)
|
||||
if m.uuid != nil {
|
||||
fields = append(fields, FieldUUID)
|
||||
}
|
||||
if m.count != nil {
|
||||
fields = append(fields, FieldCount)
|
||||
}
|
||||
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 FieldUUID:
|
||||
return m.UUID()
|
||||
case FieldCount:
|
||||
return m.Count()
|
||||
}
|
||||
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 Blob 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 FieldUUID:
|
||||
v, ok := value.(uuid.UUID)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetUUID(v)
|
||||
return nil
|
||||
case FieldCount:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetCount(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blob 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.addcount != nil {
|
||||
fields = append(fields, FieldCount)
|
||||
}
|
||||
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 FieldCount:
|
||||
return m.AddedCount()
|
||||
}
|
||||
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 FieldCount:
|
||||
v, ok := value.(int)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddCount(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blob 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 Blob 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 FieldUUID:
|
||||
m.ResetUUID()
|
||||
return nil
|
||||
case FieldCount:
|
||||
m.ResetCount()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blob 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.parent != nil {
|
||||
edges = append(edges, EdgeParent)
|
||||
}
|
||||
if m.links != nil {
|
||||
edges = append(edges, EdgeLinks)
|
||||
}
|
||||
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 EdgeParent:
|
||||
if id := m.parent; id != nil {
|
||||
return []ent.Value{*id}
|
||||
}
|
||||
case EdgeLinks:
|
||||
ids := make([]ent.Value, 0, len(m.links))
|
||||
for id := range m.links {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemovedEdges returns all edge names that were removed in this mutation.
|
||||
func (m *Mutation) RemovedEdges() []string {
|
||||
edges := make([]string, 0, 2)
|
||||
if m.removedlinks != nil {
|
||||
edges = append(edges, EdgeLinks)
|
||||
}
|
||||
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 EdgeLinks:
|
||||
ids := make([]ent.Value, 0, len(m.removedlinks))
|
||||
for id := range m.removedlinks {
|
||||
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, 2)
|
||||
if m.clearedparent {
|
||||
edges = append(edges, EdgeParent)
|
||||
}
|
||||
if m.clearedlinks {
|
||||
edges = append(edges, EdgeLinks)
|
||||
}
|
||||
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 EdgeParent:
|
||||
return m.clearedparent
|
||||
case EdgeLinks:
|
||||
return m.clearedlinks
|
||||
}
|
||||
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 EdgeParent:
|
||||
m.ClearParent()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blob 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 EdgeParent:
|
||||
m.ResetParent()
|
||||
return nil
|
||||
case EdgeLinks:
|
||||
m.ResetLinks()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Blob edge %s", name)
|
||||
}
|
||||
233
entc/integration/customid/ent/blob/where.go
Normal file
233
entc/integration/customid/ent/blob/where.go
Normal file
@@ -0,0 +1,233 @@
|
||||
// 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 blob
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"entgo.io/ent/entc/integration/customid/ent/predicate"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// UUID applies equality check predicate on the "uuid" field. It's identical to UUIDEQ.
|
||||
func UUID(v uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldEQ(FieldUUID, v))
|
||||
}
|
||||
|
||||
// Count applies equality check predicate on the "count" field. It's identical to CountEQ.
|
||||
func Count(v int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldEQ(FieldCount, v))
|
||||
}
|
||||
|
||||
// UUIDEQ applies the EQ predicate on the "uuid" field.
|
||||
func UUIDEQ(v uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldEQ(FieldUUID, v))
|
||||
}
|
||||
|
||||
// UUIDNEQ applies the NEQ predicate on the "uuid" field.
|
||||
func UUIDNEQ(v uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldNEQ(FieldUUID, v))
|
||||
}
|
||||
|
||||
// UUIDIn applies the In predicate on the "uuid" field.
|
||||
func UUIDIn(vs ...uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldIn(FieldUUID, vs...))
|
||||
}
|
||||
|
||||
// UUIDNotIn applies the NotIn predicate on the "uuid" field.
|
||||
func UUIDNotIn(vs ...uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldNotIn(FieldUUID, vs...))
|
||||
}
|
||||
|
||||
// UUIDGT applies the GT predicate on the "uuid" field.
|
||||
func UUIDGT(v uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldGT(FieldUUID, v))
|
||||
}
|
||||
|
||||
// UUIDGTE applies the GTE predicate on the "uuid" field.
|
||||
func UUIDGTE(v uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldGTE(FieldUUID, v))
|
||||
}
|
||||
|
||||
// UUIDLT applies the LT predicate on the "uuid" field.
|
||||
func UUIDLT(v uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldLT(FieldUUID, v))
|
||||
}
|
||||
|
||||
// UUIDLTE applies the LTE predicate on the "uuid" field.
|
||||
func UUIDLTE(v uuid.UUID) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldLTE(FieldUUID, v))
|
||||
}
|
||||
|
||||
// CountEQ applies the EQ predicate on the "count" field.
|
||||
func CountEQ(v int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldEQ(FieldCount, v))
|
||||
}
|
||||
|
||||
// CountNEQ applies the NEQ predicate on the "count" field.
|
||||
func CountNEQ(v int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldNEQ(FieldCount, v))
|
||||
}
|
||||
|
||||
// CountIn applies the In predicate on the "count" field.
|
||||
func CountIn(vs ...int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldIn(FieldCount, vs...))
|
||||
}
|
||||
|
||||
// CountNotIn applies the NotIn predicate on the "count" field.
|
||||
func CountNotIn(vs ...int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldNotIn(FieldCount, vs...))
|
||||
}
|
||||
|
||||
// CountGT applies the GT predicate on the "count" field.
|
||||
func CountGT(v int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldGT(FieldCount, v))
|
||||
}
|
||||
|
||||
// CountGTE applies the GTE predicate on the "count" field.
|
||||
func CountGTE(v int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldGTE(FieldCount, v))
|
||||
}
|
||||
|
||||
// CountLT applies the LT predicate on the "count" field.
|
||||
func CountLT(v int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldLT(FieldCount, v))
|
||||
}
|
||||
|
||||
// CountLTE applies the LTE predicate on the "count" field.
|
||||
func CountLTE(v int) predicate.Blob {
|
||||
return predicate.Blob(sql.FieldLTE(FieldCount, v))
|
||||
}
|
||||
|
||||
// HasParent applies the HasEdge predicate on the "parent" edge.
|
||||
func HasParent() predicate.Blob {
|
||||
return predicate.Blob(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2O, false, ParentTable, ParentColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasParentWith applies the HasEdge predicate on the "parent" edge with a given conditions (other predicates).
|
||||
func HasParentWith(preds ...predicate.Blob) predicate.Blob {
|
||||
return predicate.Blob(func(s *sql.Selector) {
|
||||
step := newParentStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasLinks applies the HasEdge predicate on the "links" edge.
|
||||
func HasLinks() predicate.Blob {
|
||||
return predicate.Blob(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, LinksTable, LinksPrimaryKey...),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasLinksWith applies the HasEdge predicate on the "links" edge with a given conditions (other predicates).
|
||||
func HasLinksWith(preds ...predicate.Blob) predicate.Blob {
|
||||
return predicate.Blob(func(s *sql.Selector) {
|
||||
step := newLinksStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// HasBlobLinks applies the HasEdge predicate on the "blob_links" edge.
|
||||
func HasBlobLinks() predicate.Blob {
|
||||
return predicate.Blob(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, true, BlobLinksTable, BlobLinksColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasBlobLinksWith applies the HasEdge predicate on the "blob_links" edge with a given conditions (other predicates).
|
||||
func HasBlobLinksWith(preds ...predicate.BlobLink) predicate.Blob {
|
||||
return predicate.Blob(func(s *sql.Selector) {
|
||||
step := newBlobLinksStep()
|
||||
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.Blob) predicate.Blob {
|
||||
return predicate.Blob(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.Blob) predicate.Blob {
|
||||
return predicate.Blob(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.Blob) predicate.Blob {
|
||||
return predicate.Blob(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user