541 lines
14 KiB
Go
541 lines
14 KiB
Go
// 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 exvaluescan
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"math/big"
|
|
"net/url"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/gremlin/graph/dsl"
|
|
"entgo.io/ent/entc/integration/gremlin/ent/predicate"
|
|
)
|
|
|
|
// Mutation represents an operation that mutates the ExValueScan nodes in the graph.
|
|
type Mutation struct {
|
|
op ent.Op
|
|
typ string
|
|
binary **url.URL
|
|
binary_bytes **url.URL
|
|
binary_optional **url.URL
|
|
text **big.Int
|
|
text_optional **big.Int
|
|
base64 *string
|
|
custom *string
|
|
custom_optional *string
|
|
clearedFields map[string]struct{}
|
|
predicates []predicate.ExValueScan
|
|
}
|
|
|
|
// NewMutation creates a new Mutation for the ExValueScan entity.
|
|
func NewMutation(op ent.Op) *Mutation {
|
|
return &Mutation{
|
|
op: op,
|
|
typ: "ExValueScan",
|
|
clearedFields: make(map[string]struct{}),
|
|
}
|
|
}
|
|
|
|
// Predicates returns the list of predicates set on the mutation.
|
|
func (m *Mutation) Predicates() []predicate.ExValueScan {
|
|
return m.predicates
|
|
}
|
|
|
|
// SetBinary sets the "binary" field.
|
|
func (m *Mutation) SetBinary(u *url.URL) {
|
|
m.binary = &u
|
|
}
|
|
|
|
// Binary returns the value of the "binary" field in the mutation.
|
|
func (m *Mutation) Binary() (r *url.URL, exists bool) {
|
|
v := m.binary
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetBinary resets all changes to the "binary" field.
|
|
func (m *Mutation) ResetBinary() {
|
|
m.binary = nil
|
|
}
|
|
|
|
// SetBinaryBytes sets the "binary_bytes" field.
|
|
func (m *Mutation) SetBinaryBytes(u *url.URL) {
|
|
m.binary_bytes = &u
|
|
}
|
|
|
|
// BinaryBytes returns the value of the "binary_bytes" field in the mutation.
|
|
func (m *Mutation) BinaryBytes() (r *url.URL, exists bool) {
|
|
v := m.binary_bytes
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetBinaryBytes resets all changes to the "binary_bytes" field.
|
|
func (m *Mutation) ResetBinaryBytes() {
|
|
m.binary_bytes = nil
|
|
}
|
|
|
|
// SetBinaryOptional sets the "binary_optional" field.
|
|
func (m *Mutation) SetBinaryOptional(u *url.URL) {
|
|
m.binary_optional = &u
|
|
}
|
|
|
|
// BinaryOptional returns the value of the "binary_optional" field in the mutation.
|
|
func (m *Mutation) BinaryOptional() (r *url.URL, exists bool) {
|
|
v := m.binary_optional
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearBinaryOptional clears the value of the "binary_optional" field.
|
|
func (m *Mutation) ClearBinaryOptional() {
|
|
m.binary_optional = nil
|
|
m.clearedFields[FieldBinaryOptional] = struct{}{}
|
|
}
|
|
|
|
// BinaryOptionalCleared returns if the "binary_optional" field was cleared in this mutation.
|
|
func (m *Mutation) BinaryOptionalCleared() bool {
|
|
_, ok := m.clearedFields[FieldBinaryOptional]
|
|
return ok
|
|
}
|
|
|
|
// ResetBinaryOptional resets all changes to the "binary_optional" field.
|
|
func (m *Mutation) ResetBinaryOptional() {
|
|
m.binary_optional = nil
|
|
delete(m.clearedFields, FieldBinaryOptional)
|
|
}
|
|
|
|
// SetText sets the "text" field.
|
|
func (m *Mutation) SetText(b *big.Int) {
|
|
m.text = &b
|
|
}
|
|
|
|
// Text returns the value of the "text" field in the mutation.
|
|
func (m *Mutation) Text() (r *big.Int, exists bool) {
|
|
v := m.text
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetText resets all changes to the "text" field.
|
|
func (m *Mutation) ResetText() {
|
|
m.text = nil
|
|
}
|
|
|
|
// SetTextOptional sets the "text_optional" field.
|
|
func (m *Mutation) SetTextOptional(b *big.Int) {
|
|
m.text_optional = &b
|
|
}
|
|
|
|
// TextOptional returns the value of the "text_optional" field in the mutation.
|
|
func (m *Mutation) TextOptional() (r *big.Int, exists bool) {
|
|
v := m.text_optional
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearTextOptional clears the value of the "text_optional" field.
|
|
func (m *Mutation) ClearTextOptional() {
|
|
m.text_optional = nil
|
|
m.clearedFields[FieldTextOptional] = struct{}{}
|
|
}
|
|
|
|
// TextOptionalCleared returns if the "text_optional" field was cleared in this mutation.
|
|
func (m *Mutation) TextOptionalCleared() bool {
|
|
_, ok := m.clearedFields[FieldTextOptional]
|
|
return ok
|
|
}
|
|
|
|
// ResetTextOptional resets all changes to the "text_optional" field.
|
|
func (m *Mutation) ResetTextOptional() {
|
|
m.text_optional = nil
|
|
delete(m.clearedFields, FieldTextOptional)
|
|
}
|
|
|
|
// SetBase64 sets the "base64" field.
|
|
func (m *Mutation) SetBase64(s string) {
|
|
m.base64 = &s
|
|
}
|
|
|
|
// Base64 returns the value of the "base64" field in the mutation.
|
|
func (m *Mutation) Base64() (r string, exists bool) {
|
|
v := m.base64
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetBase64 resets all changes to the "base64" field.
|
|
func (m *Mutation) ResetBase64() {
|
|
m.base64 = nil
|
|
}
|
|
|
|
// SetCustom sets the "custom" field.
|
|
func (m *Mutation) SetCustom(s string) {
|
|
m.custom = &s
|
|
}
|
|
|
|
// Custom returns the value of the "custom" field in the mutation.
|
|
func (m *Mutation) Custom() (r string, exists bool) {
|
|
v := m.custom
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ResetCustom resets all changes to the "custom" field.
|
|
func (m *Mutation) ResetCustom() {
|
|
m.custom = nil
|
|
}
|
|
|
|
// SetCustomOptional sets the "custom_optional" field.
|
|
func (m *Mutation) SetCustomOptional(s string) {
|
|
m.custom_optional = &s
|
|
}
|
|
|
|
// CustomOptional returns the value of the "custom_optional" field in the mutation.
|
|
func (m *Mutation) CustomOptional() (r string, exists bool) {
|
|
v := m.custom_optional
|
|
if v == nil {
|
|
return
|
|
}
|
|
return *v, true
|
|
}
|
|
|
|
// ClearCustomOptional clears the value of the "custom_optional" field.
|
|
func (m *Mutation) ClearCustomOptional() {
|
|
m.custom_optional = nil
|
|
m.clearedFields[FieldCustomOptional] = struct{}{}
|
|
}
|
|
|
|
// CustomOptionalCleared returns if the "custom_optional" field was cleared in this mutation.
|
|
func (m *Mutation) CustomOptionalCleared() bool {
|
|
_, ok := m.clearedFields[FieldCustomOptional]
|
|
return ok
|
|
}
|
|
|
|
// ResetCustomOptional resets all changes to the "custom_optional" field.
|
|
func (m *Mutation) ResetCustomOptional() {
|
|
m.custom_optional = nil
|
|
delete(m.clearedFields, FieldCustomOptional)
|
|
}
|
|
|
|
// Where appends a list predicates to the Mutation builder.
|
|
func (m *Mutation) Where(ps ...predicate.ExValueScan) {
|
|
m.predicates = append(m.predicates, ps...)
|
|
}
|
|
|
|
// WhereP appends storage-level predicates to the Mutation builder. Using this method,
|
|
// users can use type-assertion to append predicates that do not depend on any generated package.
|
|
func (m *Mutation) WhereP(ps ...func(*dsl.Traversal)) {
|
|
p := make([]predicate.ExValueScan, 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 (ExValueScan).
|
|
func (m *Mutation) Type() string {
|
|
return m.typ
|
|
}
|
|
|
|
// Fields returns all fields that were changed during this mutation. Note that in
|
|
// order to get all numeric fields that were incremented/decremented, call
|
|
// AddedFields().
|
|
func (m *Mutation) Fields() []string {
|
|
fields := make([]string, 0, 8)
|
|
if m.binary != nil {
|
|
fields = append(fields, FieldBinary)
|
|
}
|
|
if m.binary_bytes != nil {
|
|
fields = append(fields, FieldBinaryBytes)
|
|
}
|
|
if m.binary_optional != nil {
|
|
fields = append(fields, FieldBinaryOptional)
|
|
}
|
|
if m.text != nil {
|
|
fields = append(fields, FieldText)
|
|
}
|
|
if m.text_optional != nil {
|
|
fields = append(fields, FieldTextOptional)
|
|
}
|
|
if m.base64 != nil {
|
|
fields = append(fields, FieldBase64)
|
|
}
|
|
if m.custom != nil {
|
|
fields = append(fields, FieldCustom)
|
|
}
|
|
if m.custom_optional != nil {
|
|
fields = append(fields, FieldCustomOptional)
|
|
}
|
|
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 FieldBinary:
|
|
return m.Binary()
|
|
case FieldBinaryBytes:
|
|
return m.BinaryBytes()
|
|
case FieldBinaryOptional:
|
|
return m.BinaryOptional()
|
|
case FieldText:
|
|
return m.Text()
|
|
case FieldTextOptional:
|
|
return m.TextOptional()
|
|
case FieldBase64:
|
|
return m.Base64()
|
|
case FieldCustom:
|
|
return m.Custom()
|
|
case FieldCustomOptional:
|
|
return m.CustomOptional()
|
|
}
|
|
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 ExValueScan 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 FieldBinary:
|
|
v, ok := value.(*url.URL)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBinary(v)
|
|
return nil
|
|
case FieldBinaryBytes:
|
|
v, ok := value.(*url.URL)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBinaryBytes(v)
|
|
return nil
|
|
case FieldBinaryOptional:
|
|
v, ok := value.(*url.URL)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBinaryOptional(v)
|
|
return nil
|
|
case FieldText:
|
|
v, ok := value.(*big.Int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetText(v)
|
|
return nil
|
|
case FieldTextOptional:
|
|
v, ok := value.(*big.Int)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetTextOptional(v)
|
|
return nil
|
|
case FieldBase64:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetBase64(v)
|
|
return nil
|
|
case FieldCustom:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCustom(v)
|
|
return nil
|
|
case FieldCustomOptional:
|
|
v, ok := value.(string)
|
|
if !ok {
|
|
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
|
}
|
|
m.SetCustomOptional(v)
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ExValueScan field %s", name)
|
|
}
|
|
|
|
// AddedFields returns all numeric fields that were incremented/decremented during
|
|
// this mutation.
|
|
func (m *Mutation) AddedFields() []string {
|
|
return nil
|
|
}
|
|
|
|
// 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) {
|
|
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 ExValueScan 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(FieldBinaryOptional) {
|
|
fields = append(fields, FieldBinaryOptional)
|
|
}
|
|
if m.FieldCleared(FieldTextOptional) {
|
|
fields = append(fields, FieldTextOptional)
|
|
}
|
|
if m.FieldCleared(FieldCustomOptional) {
|
|
fields = append(fields, FieldCustomOptional)
|
|
}
|
|
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 FieldBinaryOptional:
|
|
m.ClearBinaryOptional()
|
|
return nil
|
|
case FieldTextOptional:
|
|
m.ClearTextOptional()
|
|
return nil
|
|
case FieldCustomOptional:
|
|
m.ClearCustomOptional()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ExValueScan 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 FieldBinary:
|
|
m.ResetBinary()
|
|
return nil
|
|
case FieldBinaryBytes:
|
|
m.ResetBinaryBytes()
|
|
return nil
|
|
case FieldBinaryOptional:
|
|
m.ResetBinaryOptional()
|
|
return nil
|
|
case FieldText:
|
|
m.ResetText()
|
|
return nil
|
|
case FieldTextOptional:
|
|
m.ResetTextOptional()
|
|
return nil
|
|
case FieldBase64:
|
|
m.ResetBase64()
|
|
return nil
|
|
case FieldCustom:
|
|
m.ResetCustom()
|
|
return nil
|
|
case FieldCustomOptional:
|
|
m.ResetCustomOptional()
|
|
return nil
|
|
}
|
|
return fmt.Errorf("unknown ExValueScan field %s", name)
|
|
}
|
|
|
|
// AddedEdges returns all edge names that were set/added in this mutation.
|
|
func (m *Mutation) AddedEdges() []string {
|
|
edges := make([]string, 0, 0)
|
|
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 {
|
|
return nil
|
|
}
|
|
|
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
|
func (m *Mutation) RemovedEdges() []string {
|
|
edges := make([]string, 0, 0)
|
|
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, 0)
|
|
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 {
|
|
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 {
|
|
return fmt.Errorf("unknown ExValueScan 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 {
|
|
return fmt.Errorf("unknown ExValueScan edge %s", name)
|
|
}
|