ent

package
v0.0.0-...-72a65b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeEvent             = "Event"
	TypeEventNameAutofill = "EventNameAutofill"
	TypeUser              = "User"
	TypeUsernameAutofill  = "UsernameAutofill"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

IsConstraintError returns a boolean indicating whether the error is a constraint failure.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns a boolean indicating whether the error is a not found error.

func IsNotLoaded

func IsNotLoaded(err error) bool

IsNotLoaded returns a boolean indicating whether the error is a not loaded error.

func IsNotSingular

func IsNotSingular(err error) bool

IsNotSingular returns a boolean indicating whether the error is a not singular error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError returns a boolean indicating whether the error is a validation error.

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

func NewContext(parent context.Context, c *Client) context.Context

NewContext returns a new context with the given Client attached.

func NewTxContext

func NewTxContext(parent context.Context, tx *Tx) context.Context

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

AggregateFunc applies an aggregation step on the group-by traversal/selector.

func As

As is a pseudo aggregation function for renaming another other functions with custom names. For example:

GroupBy(field1, field2).
Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

Count applies the "count" aggregation function on each group.

func Max

func Max(field string) AggregateFunc

Max applies the "max" aggregation function on the given field of each group.

func Mean

func Mean(field string) AggregateFunc

Mean applies the "mean" aggregation function on the given field of each group.

func Min

func Min(field string) AggregateFunc

Min applies the "min" aggregation function on the given field of each group.

func Sum

func Sum(field string) AggregateFunc

Sum applies the "sum" aggregation function on the given field of each group.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Event is the client for interacting with the Event builders.
	Event *EventClient
	// EventNameAutofill is the client for interacting with the EventNameAutofill builders.
	EventNameAutofill *EventNameAutofillClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UsernameAutofill is the client for interacting with the UsernameAutofill builders.
	UsernameAutofill *UsernameAutofillClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	Event.
	Query().
	Count(ctx)

func (*Client) Tx

func (c *Client) Tx(ctx context.Context) (*Tx, error)

Tx returns a new transactional client. The provided context is used until the transaction is committed or rolled back.

func (*Client) Use

func (c *Client) Use(hooks ...Hook)

Use adds the mutation hooks to all the entity clients. In order to add hooks to a specific client, call: `client.Node.Use(...)`.

type CommitFunc

type CommitFunc func(context.Context, *Tx) error

The CommitFunc type is an adapter to allow the use of ordinary function as a Committer. If f is a function with the appropriate signature, CommitFunc(f) is a Committer that calls f.

func (CommitFunc) Commit

func (f CommitFunc) Commit(ctx context.Context, tx *Tx) error

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

CommitHook defines the "commit middleware". A function that gets a Committer and returns a Committer. For example:

hook := func(next ent.Committer) ent.Committer {
	return ent.CommitFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Commit(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Committer

type Committer interface {
	Commit(context.Context, *Tx) error
}

Committer is the interface that wraps the Commit method.

type ConstraintError

type ConstraintError struct {
	// contains filtered or unexported fields
}

ConstraintError returns when trying to create/update one or more entities and one or more of their constraints failed. For example, violation of edge or field uniqueness.

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Event

type Event struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// EventTime holds the value of the "event_time" field.
	EventTime time.Time `json:"event_time,omitempty"`
	// EventName holds the value of the "event_name" field.
	EventName string `json:"event_name,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// Resource holds the value of the "resource" field.
	Resource string `json:"resource,omitempty"`
	// SourceIP holds the value of the "source_ip" field.
	SourceIP string `json:"source_ip,omitempty"`
	// RequestID holds the value of the "request_id" field.
	RequestID string `json:"request_id,omitempty"`
	// ReadOnly holds the value of the "read_only" field.
	ReadOnly bool `json:"read_only,omitempty"`
	// EventData holds the value of the "event_data" field.
	EventData map[string]interface{} `json:"event_data,omitempty"`
	// EventSource holds the value of the "event_source" field.
	EventSource string `json:"event_source,omitempty"`
	// contains filtered or unexported fields
}

Event is the model entity for the Event schema.

func (*Event) String

func (e *Event) String() string

String implements the fmt.Stringer.

func (*Event) Unwrap

func (e *Event) Unwrap() *Event

Unwrap unwraps the Event entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*Event) Update

func (e *Event) Update() *EventUpdateOne

Update returns a builder for updating this Event. Note that you need to call Event.Unwrap() before calling this method if this Event was returned from a transaction, and the transaction was committed or rolled back.

type EventClient

type EventClient struct {
	// contains filtered or unexported fields
}

EventClient is a client for the Event schema.

func NewEventClient

func NewEventClient(c config) *EventClient

NewEventClient returns a client for the Event from the given config.

func (*EventClient) Create

func (c *EventClient) Create() *EventCreate

Create returns a create builder for Event.

func (*EventClient) CreateBulk

func (c *EventClient) CreateBulk(builders ...*EventCreate) *EventCreateBulk

CreateBulk returns a builder for creating a bulk of Event entities.

func (*EventClient) Delete

func (c *EventClient) Delete() *EventDelete

Delete returns a delete builder for Event.

func (*EventClient) DeleteOne

func (c *EventClient) DeleteOne(e *Event) *EventDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*EventClient) DeleteOneID

func (c *EventClient) DeleteOneID(id uuid.UUID) *EventDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*EventClient) Get

func (c *EventClient) Get(ctx context.Context, id uuid.UUID) (*Event, error)

Get returns a Event entity by its id.

func (*EventClient) GetX

func (c *EventClient) GetX(ctx context.Context, id uuid.UUID) *Event

GetX is like Get, but panics if an error occurs.

func (*EventClient) Hooks

func (c *EventClient) Hooks() []Hook

Hooks returns the client hooks.

func (*EventClient) Query

func (c *EventClient) Query() *EventQuery

Query returns a query builder for Event.

func (*EventClient) Update

func (c *EventClient) Update() *EventUpdate

Update returns an update builder for Event.

func (*EventClient) UpdateOne

func (c *EventClient) UpdateOne(e *Event) *EventUpdateOne

UpdateOne returns an update builder for the given entity.

func (*EventClient) UpdateOneID

func (c *EventClient) UpdateOneID(id uuid.UUID) *EventUpdateOne

UpdateOneID returns an update builder for the given id.

func (*EventClient) Use

func (c *EventClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `event.Hooks(f(g(h())))`.

type EventCreate

type EventCreate struct {
	// contains filtered or unexported fields
}

EventCreate is the builder for creating a Event entity.

func (*EventCreate) Exec

func (ec *EventCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*EventCreate) ExecX

func (ec *EventCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventCreate) Mutation

func (ec *EventCreate) Mutation() *EventMutation

Mutation returns the EventMutation object of the builder.

func (*EventCreate) Save

func (ec *EventCreate) Save(ctx context.Context) (*Event, error)

Save creates the Event in the database.

func (*EventCreate) SaveX

func (ec *EventCreate) SaveX(ctx context.Context) *Event

SaveX calls Save and panics if Save returns an error.

func (*EventCreate) SetEventData

func (ec *EventCreate) SetEventData(m map[string]interface{}) *EventCreate

SetEventData sets the "event_data" field.

func (*EventCreate) SetEventName

func (ec *EventCreate) SetEventName(s string) *EventCreate

SetEventName sets the "event_name" field.

func (*EventCreate) SetEventSource

func (ec *EventCreate) SetEventSource(s string) *EventCreate

SetEventSource sets the "event_source" field.

func (*EventCreate) SetEventTime

func (ec *EventCreate) SetEventTime(t time.Time) *EventCreate

SetEventTime sets the "event_time" field.

func (*EventCreate) SetID

func (ec *EventCreate) SetID(u uuid.UUID) *EventCreate

SetID sets the "id" field.

func (*EventCreate) SetNillableEventSource

func (ec *EventCreate) SetNillableEventSource(s *string) *EventCreate

SetNillableEventSource sets the "event_source" field if the given value is not nil.

func (*EventCreate) SetNillableEventTime

func (ec *EventCreate) SetNillableEventTime(t *time.Time) *EventCreate

SetNillableEventTime sets the "event_time" field if the given value is not nil.

func (*EventCreate) SetNillableID

func (ec *EventCreate) SetNillableID(u *uuid.UUID) *EventCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*EventCreate) SetNillableReadOnly

func (ec *EventCreate) SetNillableReadOnly(b *bool) *EventCreate

SetNillableReadOnly sets the "read_only" field if the given value is not nil.

func (*EventCreate) SetNillableRequestID

func (ec *EventCreate) SetNillableRequestID(s *string) *EventCreate

SetNillableRequestID sets the "request_id" field if the given value is not nil.

func (*EventCreate) SetNillableResource

func (ec *EventCreate) SetNillableResource(s *string) *EventCreate

SetNillableResource sets the "resource" field if the given value is not nil.

func (*EventCreate) SetNillableSourceIP

func (ec *EventCreate) SetNillableSourceIP(s *string) *EventCreate

SetNillableSourceIP sets the "source_ip" field if the given value is not nil.

func (*EventCreate) SetReadOnly

func (ec *EventCreate) SetReadOnly(b bool) *EventCreate

SetReadOnly sets the "read_only" field.

func (*EventCreate) SetRequestID

func (ec *EventCreate) SetRequestID(s string) *EventCreate

SetRequestID sets the "request_id" field.

func (*EventCreate) SetResource

func (ec *EventCreate) SetResource(s string) *EventCreate

SetResource sets the "resource" field.

func (*EventCreate) SetSourceIP

func (ec *EventCreate) SetSourceIP(s string) *EventCreate

SetSourceIP sets the "source_ip" field.

func (*EventCreate) SetUsername

func (ec *EventCreate) SetUsername(s string) *EventCreate

SetUsername sets the "username" field.

type EventCreateBulk

type EventCreateBulk struct {
	// contains filtered or unexported fields
}

EventCreateBulk is the builder for creating many Event entities in bulk.

func (*EventCreateBulk) Exec

func (ecb *EventCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*EventCreateBulk) ExecX

func (ecb *EventCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventCreateBulk) Save

func (ecb *EventCreateBulk) Save(ctx context.Context) ([]*Event, error)

Save creates the Event entities in the database.

func (*EventCreateBulk) SaveX

func (ecb *EventCreateBulk) SaveX(ctx context.Context) []*Event

SaveX is like Save, but panics if an error occurs.

type EventDelete

type EventDelete struct {
	// contains filtered or unexported fields
}

EventDelete is the builder for deleting a Event entity.

func (*EventDelete) Exec

func (ed *EventDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*EventDelete) ExecX

func (ed *EventDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*EventDelete) Where

func (ed *EventDelete) Where(ps ...predicate.Event) *EventDelete

Where appends a list predicates to the EventDelete builder.

type EventDeleteOne

type EventDeleteOne struct {
	// contains filtered or unexported fields
}

EventDeleteOne is the builder for deleting a single Event entity.

func (*EventDeleteOne) Exec

func (edo *EventDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*EventDeleteOne) ExecX

func (edo *EventDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type EventGroupBy

type EventGroupBy struct {
	// contains filtered or unexported fields
}

EventGroupBy is the group-by builder for Event entities.

func (*EventGroupBy) Aggregate

func (egb *EventGroupBy) Aggregate(fns ...AggregateFunc) *EventGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*EventGroupBy) Bool

func (egb *EventGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) BoolX

func (egb *EventGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*EventGroupBy) Bools

func (egb *EventGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) BoolsX

func (egb *EventGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*EventGroupBy) Float64

func (egb *EventGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) Float64X

func (egb *EventGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*EventGroupBy) Float64s

func (egb *EventGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) Float64sX

func (egb *EventGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*EventGroupBy) Int

func (egb *EventGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) IntX

func (egb *EventGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*EventGroupBy) Ints

func (egb *EventGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) IntsX

func (egb *EventGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*EventGroupBy) Scan

func (egb *EventGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*EventGroupBy) ScanX

func (egb *EventGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*EventGroupBy) String

func (egb *EventGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) StringX

func (egb *EventGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*EventGroupBy) Strings

func (egb *EventGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*EventGroupBy) StringsX

func (egb *EventGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type EventMutation

type EventMutation struct {
	// contains filtered or unexported fields
}

EventMutation represents an operation that mutates the Event nodes in the graph.

func (*EventMutation) AddField

func (m *EventMutation) AddField(name string, value ent.Value) error

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 (*EventMutation) AddedEdges

func (m *EventMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*EventMutation) AddedField

func (m *EventMutation) AddedField(name string) (ent.Value, bool)

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 (*EventMutation) AddedFields

func (m *EventMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*EventMutation) AddedIDs

func (m *EventMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*EventMutation) ClearEdge

func (m *EventMutation) ClearEdge(name string) error

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 (*EventMutation) ClearField

func (m *EventMutation) ClearField(name string) error

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 (*EventMutation) ClearedEdges

func (m *EventMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*EventMutation) ClearedFields

func (m *EventMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (EventMutation) Client

func (m EventMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*EventMutation) EdgeCleared

func (m *EventMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*EventMutation) EventData

func (m *EventMutation) EventData() (r map[string]interface{}, exists bool)

EventData returns the value of the "event_data" field in the mutation.

func (*EventMutation) EventName

func (m *EventMutation) EventName() (r string, exists bool)

EventName returns the value of the "event_name" field in the mutation.

func (*EventMutation) EventSource

func (m *EventMutation) EventSource() (r string, exists bool)

EventSource returns the value of the "event_source" field in the mutation.

func (*EventMutation) EventTime

func (m *EventMutation) EventTime() (r time.Time, exists bool)

EventTime returns the value of the "event_time" field in the mutation.

func (*EventMutation) Field

func (m *EventMutation) Field(name string) (ent.Value, bool)

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 (*EventMutation) FieldCleared

func (m *EventMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*EventMutation) Fields

func (m *EventMutation) Fields() []string

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 (*EventMutation) ID

func (m *EventMutation) ID() (id uuid.UUID, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*EventMutation) IDs

func (m *EventMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*EventMutation) OldEventData

func (m *EventMutation) OldEventData(ctx context.Context) (v map[string]interface{}, err error)

OldEventData returns the old "event_data" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldEventName

func (m *EventMutation) OldEventName(ctx context.Context) (v string, err error)

OldEventName returns the old "event_name" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldEventSource

func (m *EventMutation) OldEventSource(ctx context.Context) (v string, err error)

OldEventSource returns the old "event_source" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldEventTime

func (m *EventMutation) OldEventTime(ctx context.Context) (v time.Time, err error)

OldEventTime returns the old "event_time" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldField

func (m *EventMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*EventMutation) OldReadOnly

func (m *EventMutation) OldReadOnly(ctx context.Context) (v bool, err error)

OldReadOnly returns the old "read_only" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldRequestID

func (m *EventMutation) OldRequestID(ctx context.Context) (v string, err error)

OldRequestID returns the old "request_id" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldResource

func (m *EventMutation) OldResource(ctx context.Context) (v string, err error)

OldResource returns the old "resource" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldSourceIP

func (m *EventMutation) OldSourceIP(ctx context.Context) (v string, err error)

OldSourceIP returns the old "source_ip" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) OldUsername

func (m *EventMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the Event entity. If the Event object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventMutation) Op

func (m *EventMutation) Op() Op

Op returns the operation name.

func (*EventMutation) ReadOnly

func (m *EventMutation) ReadOnly() (r bool, exists bool)

ReadOnly returns the value of the "read_only" field in the mutation.

func (*EventMutation) RemovedEdges

func (m *EventMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*EventMutation) RemovedIDs

func (m *EventMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*EventMutation) RequestID

func (m *EventMutation) RequestID() (r string, exists bool)

RequestID returns the value of the "request_id" field in the mutation.

func (*EventMutation) ResetEdge

func (m *EventMutation) ResetEdge(name string) error

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 (*EventMutation) ResetEventData

func (m *EventMutation) ResetEventData()

ResetEventData resets all changes to the "event_data" field.

func (*EventMutation) ResetEventName

func (m *EventMutation) ResetEventName()

ResetEventName resets all changes to the "event_name" field.

func (*EventMutation) ResetEventSource

func (m *EventMutation) ResetEventSource()

ResetEventSource resets all changes to the "event_source" field.

func (*EventMutation) ResetEventTime

func (m *EventMutation) ResetEventTime()

ResetEventTime resets all changes to the "event_time" field.

func (*EventMutation) ResetField

func (m *EventMutation) ResetField(name string) error

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 (*EventMutation) ResetReadOnly

func (m *EventMutation) ResetReadOnly()

ResetReadOnly resets all changes to the "read_only" field.

func (*EventMutation) ResetRequestID

func (m *EventMutation) ResetRequestID()

ResetRequestID resets all changes to the "request_id" field.

func (*EventMutation) ResetResource

func (m *EventMutation) ResetResource()

ResetResource resets all changes to the "resource" field.

func (*EventMutation) ResetSourceIP

func (m *EventMutation) ResetSourceIP()

ResetSourceIP resets all changes to the "source_ip" field.

func (*EventMutation) ResetUsername

func (m *EventMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*EventMutation) Resource

func (m *EventMutation) Resource() (r string, exists bool)

Resource returns the value of the "resource" field in the mutation.

func (*EventMutation) SetEventData

func (m *EventMutation) SetEventData(value map[string]interface{})

SetEventData sets the "event_data" field.

func (*EventMutation) SetEventName

func (m *EventMutation) SetEventName(s string)

SetEventName sets the "event_name" field.

func (*EventMutation) SetEventSource

func (m *EventMutation) SetEventSource(s string)

SetEventSource sets the "event_source" field.

func (*EventMutation) SetEventTime

func (m *EventMutation) SetEventTime(t time.Time)

SetEventTime sets the "event_time" field.

func (*EventMutation) SetField

func (m *EventMutation) SetField(name string, value ent.Value) error

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 (*EventMutation) SetID

func (m *EventMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of Event entities.

func (*EventMutation) SetReadOnly

func (m *EventMutation) SetReadOnly(b bool)

SetReadOnly sets the "read_only" field.

func (*EventMutation) SetRequestID

func (m *EventMutation) SetRequestID(s string)

SetRequestID sets the "request_id" field.

func (*EventMutation) SetResource

func (m *EventMutation) SetResource(s string)

SetResource sets the "resource" field.

func (*EventMutation) SetSourceIP

func (m *EventMutation) SetSourceIP(s string)

SetSourceIP sets the "source_ip" field.

func (*EventMutation) SetUsername

func (m *EventMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*EventMutation) SourceIP

func (m *EventMutation) SourceIP() (r string, exists bool)

SourceIP returns the value of the "source_ip" field in the mutation.

func (EventMutation) Tx

func (m EventMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*EventMutation) Type

func (m *EventMutation) Type() string

Type returns the node type of this mutation (Event).

func (*EventMutation) Username

func (m *EventMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*EventMutation) Where

func (m *EventMutation) Where(ps ...predicate.Event)

Where appends a list predicates to the EventMutation builder.

type EventNameAutofill

type EventNameAutofill struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// EventName holds the value of the "eventName" field.
	EventName string `json:"eventName,omitempty"`
	// contains filtered or unexported fields
}

EventNameAutofill is the model entity for the EventNameAutofill schema.

func (*EventNameAutofill) String

func (ena *EventNameAutofill) String() string

String implements the fmt.Stringer.

func (*EventNameAutofill) Unwrap

func (ena *EventNameAutofill) Unwrap() *EventNameAutofill

Unwrap unwraps the EventNameAutofill entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*EventNameAutofill) Update

Update returns a builder for updating this EventNameAutofill. Note that you need to call EventNameAutofill.Unwrap() before calling this method if this EventNameAutofill was returned from a transaction, and the transaction was committed or rolled back.

type EventNameAutofillClient

type EventNameAutofillClient struct {
	// contains filtered or unexported fields
}

EventNameAutofillClient is a client for the EventNameAutofill schema.

func NewEventNameAutofillClient

func NewEventNameAutofillClient(c config) *EventNameAutofillClient

NewEventNameAutofillClient returns a client for the EventNameAutofill from the given config.

func (*EventNameAutofillClient) Create

Create returns a create builder for EventNameAutofill.

func (*EventNameAutofillClient) CreateBulk

CreateBulk returns a builder for creating a bulk of EventNameAutofill entities.

func (*EventNameAutofillClient) Delete

Delete returns a delete builder for EventNameAutofill.

func (*EventNameAutofillClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*EventNameAutofillClient) DeleteOneID

DeleteOneID returns a delete builder for the given id.

func (*EventNameAutofillClient) Get

Get returns a EventNameAutofill entity by its id.

func (*EventNameAutofillClient) GetX

GetX is like Get, but panics if an error occurs.

func (*EventNameAutofillClient) Hooks

func (c *EventNameAutofillClient) Hooks() []Hook

Hooks returns the client hooks.

func (*EventNameAutofillClient) Query

Query returns a query builder for EventNameAutofill.

func (*EventNameAutofillClient) Update

Update returns an update builder for EventNameAutofill.

func (*EventNameAutofillClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*EventNameAutofillClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*EventNameAutofillClient) Use

func (c *EventNameAutofillClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `eventnameautofill.Hooks(f(g(h())))`.

type EventNameAutofillCreate

type EventNameAutofillCreate struct {
	// contains filtered or unexported fields
}

EventNameAutofillCreate is the builder for creating a EventNameAutofill entity.

func (*EventNameAutofillCreate) Exec

func (enac *EventNameAutofillCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*EventNameAutofillCreate) ExecX

func (enac *EventNameAutofillCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventNameAutofillCreate) Mutation

Mutation returns the EventNameAutofillMutation object of the builder.

func (*EventNameAutofillCreate) Save

Save creates the EventNameAutofill in the database.

func (*EventNameAutofillCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*EventNameAutofillCreate) SetEventName

SetEventName sets the "eventName" field.

type EventNameAutofillCreateBulk

type EventNameAutofillCreateBulk struct {
	// contains filtered or unexported fields
}

EventNameAutofillCreateBulk is the builder for creating many EventNameAutofill entities in bulk.

func (*EventNameAutofillCreateBulk) Exec

Exec executes the query.

func (*EventNameAutofillCreateBulk) ExecX

func (enacb *EventNameAutofillCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventNameAutofillCreateBulk) Save

Save creates the EventNameAutofill entities in the database.

func (*EventNameAutofillCreateBulk) SaveX

SaveX is like Save, but panics if an error occurs.

type EventNameAutofillDelete

type EventNameAutofillDelete struct {
	// contains filtered or unexported fields
}

EventNameAutofillDelete is the builder for deleting a EventNameAutofill entity.

func (*EventNameAutofillDelete) Exec

func (enad *EventNameAutofillDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*EventNameAutofillDelete) ExecX

func (enad *EventNameAutofillDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*EventNameAutofillDelete) Where

Where appends a list predicates to the EventNameAutofillDelete builder.

type EventNameAutofillDeleteOne

type EventNameAutofillDeleteOne struct {
	// contains filtered or unexported fields
}

EventNameAutofillDeleteOne is the builder for deleting a single EventNameAutofill entity.

func (*EventNameAutofillDeleteOne) Exec

Exec executes the deletion query.

func (*EventNameAutofillDeleteOne) ExecX

func (enado *EventNameAutofillDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type EventNameAutofillGroupBy

type EventNameAutofillGroupBy struct {
	// contains filtered or unexported fields
}

EventNameAutofillGroupBy is the group-by builder for EventNameAutofill entities.

func (*EventNameAutofillGroupBy) Aggregate

Aggregate adds the given aggregation functions to the group-by query.

func (*EventNameAutofillGroupBy) Bool

func (enagb *EventNameAutofillGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) BoolX

func (enagb *EventNameAutofillGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*EventNameAutofillGroupBy) Bools

func (enagb *EventNameAutofillGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) BoolsX

func (enagb *EventNameAutofillGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*EventNameAutofillGroupBy) Float64

func (enagb *EventNameAutofillGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) Float64X

func (enagb *EventNameAutofillGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*EventNameAutofillGroupBy) Float64s

func (enagb *EventNameAutofillGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) Float64sX

func (enagb *EventNameAutofillGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*EventNameAutofillGroupBy) Int

func (enagb *EventNameAutofillGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) IntX

func (enagb *EventNameAutofillGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*EventNameAutofillGroupBy) Ints

func (enagb *EventNameAutofillGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) IntsX

func (enagb *EventNameAutofillGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*EventNameAutofillGroupBy) Scan

func (enagb *EventNameAutofillGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*EventNameAutofillGroupBy) ScanX

func (enagb *EventNameAutofillGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*EventNameAutofillGroupBy) String

func (enagb *EventNameAutofillGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) StringX

func (enagb *EventNameAutofillGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*EventNameAutofillGroupBy) Strings

func (enagb *EventNameAutofillGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*EventNameAutofillGroupBy) StringsX

func (enagb *EventNameAutofillGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type EventNameAutofillMutation

type EventNameAutofillMutation struct {
	// contains filtered or unexported fields
}

EventNameAutofillMutation represents an operation that mutates the EventNameAutofill nodes in the graph.

func (*EventNameAutofillMutation) AddField

func (m *EventNameAutofillMutation) AddField(name string, value ent.Value) error

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 (*EventNameAutofillMutation) AddedEdges

func (m *EventNameAutofillMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*EventNameAutofillMutation) AddedField

func (m *EventNameAutofillMutation) AddedField(name string) (ent.Value, bool)

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 (*EventNameAutofillMutation) AddedFields

func (m *EventNameAutofillMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*EventNameAutofillMutation) AddedIDs

func (m *EventNameAutofillMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*EventNameAutofillMutation) ClearEdge

func (m *EventNameAutofillMutation) ClearEdge(name string) error

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 (*EventNameAutofillMutation) ClearField

func (m *EventNameAutofillMutation) ClearField(name string) error

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 (*EventNameAutofillMutation) ClearedEdges

func (m *EventNameAutofillMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*EventNameAutofillMutation) ClearedFields

func (m *EventNameAutofillMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (EventNameAutofillMutation) Client

func (m EventNameAutofillMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*EventNameAutofillMutation) EdgeCleared

func (m *EventNameAutofillMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*EventNameAutofillMutation) EventName

func (m *EventNameAutofillMutation) EventName() (r string, exists bool)

EventName returns the value of the "eventName" field in the mutation.

func (*EventNameAutofillMutation) Field

func (m *EventNameAutofillMutation) Field(name string) (ent.Value, bool)

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 (*EventNameAutofillMutation) FieldCleared

func (m *EventNameAutofillMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*EventNameAutofillMutation) Fields

func (m *EventNameAutofillMutation) Fields() []string

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 (*EventNameAutofillMutation) ID

func (m *EventNameAutofillMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*EventNameAutofillMutation) IDs

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*EventNameAutofillMutation) OldEventName

func (m *EventNameAutofillMutation) OldEventName(ctx context.Context) (v string, err error)

OldEventName returns the old "eventName" field's value of the EventNameAutofill entity. If the EventNameAutofill object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*EventNameAutofillMutation) OldField

func (m *EventNameAutofillMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*EventNameAutofillMutation) Op

func (m *EventNameAutofillMutation) Op() Op

Op returns the operation name.

func (*EventNameAutofillMutation) RemovedEdges

func (m *EventNameAutofillMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*EventNameAutofillMutation) RemovedIDs

func (m *EventNameAutofillMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*EventNameAutofillMutation) ResetEdge

func (m *EventNameAutofillMutation) ResetEdge(name string) error

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 (*EventNameAutofillMutation) ResetEventName

func (m *EventNameAutofillMutation) ResetEventName()

ResetEventName resets all changes to the "eventName" field.

func (*EventNameAutofillMutation) ResetField

func (m *EventNameAutofillMutation) ResetField(name string) error

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 (*EventNameAutofillMutation) SetEventName

func (m *EventNameAutofillMutation) SetEventName(s string)

SetEventName sets the "eventName" field.

func (*EventNameAutofillMutation) SetField

func (m *EventNameAutofillMutation) SetField(name string, value ent.Value) error

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 (EventNameAutofillMutation) Tx

func (m EventNameAutofillMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*EventNameAutofillMutation) Type

Type returns the node type of this mutation (EventNameAutofill).

func (*EventNameAutofillMutation) Where

Where appends a list predicates to the EventNameAutofillMutation builder.

type EventNameAutofillQuery

type EventNameAutofillQuery struct {
	// contains filtered or unexported fields
}

EventNameAutofillQuery is the builder for querying EventNameAutofill entities.

func (*EventNameAutofillQuery) All

All executes the query and returns a list of EventNameAutofills.

func (*EventNameAutofillQuery) AllX

AllX is like All, but panics if an error occurs.

func (*EventNameAutofillQuery) Clone

Clone returns a duplicate of the EventNameAutofillQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*EventNameAutofillQuery) Count

func (enaq *EventNameAutofillQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EventNameAutofillQuery) CountX

func (enaq *EventNameAutofillQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*EventNameAutofillQuery) Exist

func (enaq *EventNameAutofillQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*EventNameAutofillQuery) ExistX

func (enaq *EventNameAutofillQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*EventNameAutofillQuery) First

First returns the first EventNameAutofill entity from the query. Returns a *NotFoundError when no EventNameAutofill was found.

func (*EventNameAutofillQuery) FirstID

func (enaq *EventNameAutofillQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first EventNameAutofill ID from the query. Returns a *NotFoundError when no EventNameAutofill ID was found.

func (*EventNameAutofillQuery) FirstIDX

func (enaq *EventNameAutofillQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*EventNameAutofillQuery) FirstX

FirstX is like First, but panics if an error occurs.

func (*EventNameAutofillQuery) GroupBy

func (enaq *EventNameAutofillQuery) GroupBy(field string, fields ...string) *EventNameAutofillGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	EventName string `json:"eventName,omitempty"`
	Count int `json:"count,omitempty"`
}

client.EventNameAutofill.Query().
	GroupBy(eventnameautofill.FieldEventName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EventNameAutofillQuery) IDs

func (enaq *EventNameAutofillQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of EventNameAutofill IDs.

func (*EventNameAutofillQuery) IDsX

func (enaq *EventNameAutofillQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*EventNameAutofillQuery) Limit

Limit adds a limit step to the query.

func (*EventNameAutofillQuery) Offset

func (enaq *EventNameAutofillQuery) Offset(offset int) *EventNameAutofillQuery

Offset adds an offset step to the query.

func (*EventNameAutofillQuery) Only

Only returns a single EventNameAutofill entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one EventNameAutofill entity is found. Returns a *NotFoundError when no EventNameAutofill entities are found.

func (*EventNameAutofillQuery) OnlyID

func (enaq *EventNameAutofillQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only EventNameAutofill ID in the query. Returns a *NotSingularError when more than one EventNameAutofill ID is found. Returns a *NotFoundError when no entities are found.

func (*EventNameAutofillQuery) OnlyIDX

func (enaq *EventNameAutofillQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*EventNameAutofillQuery) OnlyX

OnlyX is like Only, but panics if an error occurs.

func (*EventNameAutofillQuery) Order

Order adds an order step to the query.

func (*EventNameAutofillQuery) Select

func (enaq *EventNameAutofillQuery) Select(fields ...string) *EventNameAutofillSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	EventName string `json:"eventName,omitempty"`
}

client.EventNameAutofill.Query().
	Select(eventnameautofill.FieldEventName).
	Scan(ctx, &v)

func (*EventNameAutofillQuery) Unique

func (enaq *EventNameAutofillQuery) Unique(unique bool) *EventNameAutofillQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*EventNameAutofillQuery) Where

Where adds a new predicate for the EventNameAutofillQuery builder.

type EventNameAutofillSelect

type EventNameAutofillSelect struct {
	*EventNameAutofillQuery
	// contains filtered or unexported fields
}

EventNameAutofillSelect is the builder for selecting fields of EventNameAutofill entities.

func (*EventNameAutofillSelect) Bool

func (enas *EventNameAutofillSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) BoolX

func (enas *EventNameAutofillSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*EventNameAutofillSelect) Bools

func (enas *EventNameAutofillSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) BoolsX

func (enas *EventNameAutofillSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*EventNameAutofillSelect) Float64

func (enas *EventNameAutofillSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) Float64X

func (enas *EventNameAutofillSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*EventNameAutofillSelect) Float64s

func (enas *EventNameAutofillSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) Float64sX

func (enas *EventNameAutofillSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*EventNameAutofillSelect) Int

func (enas *EventNameAutofillSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) IntX

func (enas *EventNameAutofillSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*EventNameAutofillSelect) Ints

func (enas *EventNameAutofillSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) IntsX

func (enas *EventNameAutofillSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*EventNameAutofillSelect) Scan

func (enas *EventNameAutofillSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*EventNameAutofillSelect) ScanX

func (enas *EventNameAutofillSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*EventNameAutofillSelect) String

func (enas *EventNameAutofillSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) StringX

func (enas *EventNameAutofillSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*EventNameAutofillSelect) Strings

func (enas *EventNameAutofillSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*EventNameAutofillSelect) StringsX

func (enas *EventNameAutofillSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type EventNameAutofillUpdate

type EventNameAutofillUpdate struct {
	// contains filtered or unexported fields
}

EventNameAutofillUpdate is the builder for updating EventNameAutofill entities.

func (*EventNameAutofillUpdate) Exec

func (enau *EventNameAutofillUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EventNameAutofillUpdate) ExecX

func (enau *EventNameAutofillUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventNameAutofillUpdate) Mutation

Mutation returns the EventNameAutofillMutation object of the builder.

func (*EventNameAutofillUpdate) Save

func (enau *EventNameAutofillUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*EventNameAutofillUpdate) SaveX

func (enau *EventNameAutofillUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*EventNameAutofillUpdate) SetEventName

SetEventName sets the "eventName" field.

func (*EventNameAutofillUpdate) Where

Where appends a list predicates to the EventNameAutofillUpdate builder.

type EventNameAutofillUpdateOne

type EventNameAutofillUpdateOne struct {
	// contains filtered or unexported fields
}

EventNameAutofillUpdateOne is the builder for updating a single EventNameAutofill entity.

func (*EventNameAutofillUpdateOne) Exec

Exec executes the query on the entity.

func (*EventNameAutofillUpdateOne) ExecX

func (enauo *EventNameAutofillUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventNameAutofillUpdateOne) Mutation

Mutation returns the EventNameAutofillMutation object of the builder.

func (*EventNameAutofillUpdateOne) Save

Save executes the query and returns the updated EventNameAutofill entity.

func (*EventNameAutofillUpdateOne) SaveX

SaveX is like Save, but panics if an error occurs.

func (*EventNameAutofillUpdateOne) Select

func (enauo *EventNameAutofillUpdateOne) Select(field string, fields ...string) *EventNameAutofillUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*EventNameAutofillUpdateOne) SetEventName

SetEventName sets the "eventName" field.

type EventNameAutofills

type EventNameAutofills []*EventNameAutofill

EventNameAutofills is a parsable slice of EventNameAutofill.

type EventQuery

type EventQuery struct {
	// contains filtered or unexported fields
}

EventQuery is the builder for querying Event entities.

func (*EventQuery) All

func (eq *EventQuery) All(ctx context.Context) ([]*Event, error)

All executes the query and returns a list of Events.

func (*EventQuery) AllX

func (eq *EventQuery) AllX(ctx context.Context) []*Event

AllX is like All, but panics if an error occurs.

func (*EventQuery) Clone

func (eq *EventQuery) Clone() *EventQuery

Clone returns a duplicate of the EventQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*EventQuery) Count

func (eq *EventQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*EventQuery) CountX

func (eq *EventQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*EventQuery) Exist

func (eq *EventQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*EventQuery) ExistX

func (eq *EventQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*EventQuery) First

func (eq *EventQuery) First(ctx context.Context) (*Event, error)

First returns the first Event entity from the query. Returns a *NotFoundError when no Event was found.

func (*EventQuery) FirstID

func (eq *EventQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first Event ID from the query. Returns a *NotFoundError when no Event ID was found.

func (*EventQuery) FirstIDX

func (eq *EventQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*EventQuery) FirstX

func (eq *EventQuery) FirstX(ctx context.Context) *Event

FirstX is like First, but panics if an error occurs.

func (*EventQuery) GroupBy

func (eq *EventQuery) GroupBy(field string, fields ...string) *EventGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	EventTime time.Time `json:"event_time,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Event.Query().
	GroupBy(event.FieldEventTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*EventQuery) IDs

func (eq *EventQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of Event IDs.

func (*EventQuery) IDsX

func (eq *EventQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*EventQuery) Limit

func (eq *EventQuery) Limit(limit int) *EventQuery

Limit adds a limit step to the query.

func (*EventQuery) Offset

func (eq *EventQuery) Offset(offset int) *EventQuery

Offset adds an offset step to the query.

func (*EventQuery) Only

func (eq *EventQuery) Only(ctx context.Context) (*Event, error)

Only returns a single Event entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one Event entity is found. Returns a *NotFoundError when no Event entities are found.

func (*EventQuery) OnlyID

func (eq *EventQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only Event ID in the query. Returns a *NotSingularError when more than one Event ID is found. Returns a *NotFoundError when no entities are found.

func (*EventQuery) OnlyIDX

func (eq *EventQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*EventQuery) OnlyX

func (eq *EventQuery) OnlyX(ctx context.Context) *Event

OnlyX is like Only, but panics if an error occurs.

func (*EventQuery) Order

func (eq *EventQuery) Order(o ...OrderFunc) *EventQuery

Order adds an order step to the query.

func (*EventQuery) Select

func (eq *EventQuery) Select(fields ...string) *EventSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	EventTime time.Time `json:"event_time,omitempty"`
}

client.Event.Query().
	Select(event.FieldEventTime).
	Scan(ctx, &v)

func (*EventQuery) Unique

func (eq *EventQuery) Unique(unique bool) *EventQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*EventQuery) Where

func (eq *EventQuery) Where(ps ...predicate.Event) *EventQuery

Where adds a new predicate for the EventQuery builder.

type EventSelect

type EventSelect struct {
	*EventQuery
	// contains filtered or unexported fields
}

EventSelect is the builder for selecting fields of Event entities.

func (*EventSelect) Bool

func (es *EventSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*EventSelect) BoolX

func (es *EventSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*EventSelect) Bools

func (es *EventSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*EventSelect) BoolsX

func (es *EventSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*EventSelect) Float64

func (es *EventSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*EventSelect) Float64X

func (es *EventSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*EventSelect) Float64s

func (es *EventSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*EventSelect) Float64sX

func (es *EventSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*EventSelect) Int

func (es *EventSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*EventSelect) IntX

func (es *EventSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*EventSelect) Ints

func (es *EventSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*EventSelect) IntsX

func (es *EventSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*EventSelect) Scan

func (es *EventSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*EventSelect) ScanX

func (es *EventSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*EventSelect) String

func (es *EventSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*EventSelect) StringX

func (es *EventSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*EventSelect) Strings

func (es *EventSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*EventSelect) StringsX

func (es *EventSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type EventUpdate

type EventUpdate struct {
	// contains filtered or unexported fields
}

EventUpdate is the builder for updating Event entities.

func (*EventUpdate) Exec

func (eu *EventUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*EventUpdate) ExecX

func (eu *EventUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventUpdate) Mutation

func (eu *EventUpdate) Mutation() *EventMutation

Mutation returns the EventMutation object of the builder.

func (*EventUpdate) Save

func (eu *EventUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*EventUpdate) SaveX

func (eu *EventUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*EventUpdate) SetEventData

func (eu *EventUpdate) SetEventData(m map[string]interface{}) *EventUpdate

SetEventData sets the "event_data" field.

func (*EventUpdate) SetEventName

func (eu *EventUpdate) SetEventName(s string) *EventUpdate

SetEventName sets the "event_name" field.

func (*EventUpdate) SetEventSource

func (eu *EventUpdate) SetEventSource(s string) *EventUpdate

SetEventSource sets the "event_source" field.

func (*EventUpdate) SetEventTime

func (eu *EventUpdate) SetEventTime(t time.Time) *EventUpdate

SetEventTime sets the "event_time" field.

func (*EventUpdate) SetNillableEventSource

func (eu *EventUpdate) SetNillableEventSource(s *string) *EventUpdate

SetNillableEventSource sets the "event_source" field if the given value is not nil.

func (*EventUpdate) SetNillableEventTime

func (eu *EventUpdate) SetNillableEventTime(t *time.Time) *EventUpdate

SetNillableEventTime sets the "event_time" field if the given value is not nil.

func (*EventUpdate) SetNillableReadOnly

func (eu *EventUpdate) SetNillableReadOnly(b *bool) *EventUpdate

SetNillableReadOnly sets the "read_only" field if the given value is not nil.

func (*EventUpdate) SetNillableRequestID

func (eu *EventUpdate) SetNillableRequestID(s *string) *EventUpdate

SetNillableRequestID sets the "request_id" field if the given value is not nil.

func (*EventUpdate) SetNillableResource

func (eu *EventUpdate) SetNillableResource(s *string) *EventUpdate

SetNillableResource sets the "resource" field if the given value is not nil.

func (*EventUpdate) SetNillableSourceIP

func (eu *EventUpdate) SetNillableSourceIP(s *string) *EventUpdate

SetNillableSourceIP sets the "source_ip" field if the given value is not nil.

func (*EventUpdate) SetReadOnly

func (eu *EventUpdate) SetReadOnly(b bool) *EventUpdate

SetReadOnly sets the "read_only" field.

func (*EventUpdate) SetRequestID

func (eu *EventUpdate) SetRequestID(s string) *EventUpdate

SetRequestID sets the "request_id" field.

func (*EventUpdate) SetResource

func (eu *EventUpdate) SetResource(s string) *EventUpdate

SetResource sets the "resource" field.

func (*EventUpdate) SetSourceIP

func (eu *EventUpdate) SetSourceIP(s string) *EventUpdate

SetSourceIP sets the "source_ip" field.

func (*EventUpdate) SetUsername

func (eu *EventUpdate) SetUsername(s string) *EventUpdate

SetUsername sets the "username" field.

func (*EventUpdate) Where

func (eu *EventUpdate) Where(ps ...predicate.Event) *EventUpdate

Where appends a list predicates to the EventUpdate builder.

type EventUpdateOne

type EventUpdateOne struct {
	// contains filtered or unexported fields
}

EventUpdateOne is the builder for updating a single Event entity.

func (*EventUpdateOne) Exec

func (euo *EventUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*EventUpdateOne) ExecX

func (euo *EventUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*EventUpdateOne) Mutation

func (euo *EventUpdateOne) Mutation() *EventMutation

Mutation returns the EventMutation object of the builder.

func (*EventUpdateOne) Save

func (euo *EventUpdateOne) Save(ctx context.Context) (*Event, error)

Save executes the query and returns the updated Event entity.

func (*EventUpdateOne) SaveX

func (euo *EventUpdateOne) SaveX(ctx context.Context) *Event

SaveX is like Save, but panics if an error occurs.

func (*EventUpdateOne) Select

func (euo *EventUpdateOne) Select(field string, fields ...string) *EventUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*EventUpdateOne) SetEventData

func (euo *EventUpdateOne) SetEventData(m map[string]interface{}) *EventUpdateOne

SetEventData sets the "event_data" field.

func (*EventUpdateOne) SetEventName

func (euo *EventUpdateOne) SetEventName(s string) *EventUpdateOne

SetEventName sets the "event_name" field.

func (*EventUpdateOne) SetEventSource

func (euo *EventUpdateOne) SetEventSource(s string) *EventUpdateOne

SetEventSource sets the "event_source" field.

func (*EventUpdateOne) SetEventTime

func (euo *EventUpdateOne) SetEventTime(t time.Time) *EventUpdateOne

SetEventTime sets the "event_time" field.

func (*EventUpdateOne) SetNillableEventSource

func (euo *EventUpdateOne) SetNillableEventSource(s *string) *EventUpdateOne

SetNillableEventSource sets the "event_source" field if the given value is not nil.

func (*EventUpdateOne) SetNillableEventTime

func (euo *EventUpdateOne) SetNillableEventTime(t *time.Time) *EventUpdateOne

SetNillableEventTime sets the "event_time" field if the given value is not nil.

func (*EventUpdateOne) SetNillableReadOnly

func (euo *EventUpdateOne) SetNillableReadOnly(b *bool) *EventUpdateOne

SetNillableReadOnly sets the "read_only" field if the given value is not nil.

func (*EventUpdateOne) SetNillableRequestID

func (euo *EventUpdateOne) SetNillableRequestID(s *string) *EventUpdateOne

SetNillableRequestID sets the "request_id" field if the given value is not nil.

func (*EventUpdateOne) SetNillableResource

func (euo *EventUpdateOne) SetNillableResource(s *string) *EventUpdateOne

SetNillableResource sets the "resource" field if the given value is not nil.

func (*EventUpdateOne) SetNillableSourceIP

func (euo *EventUpdateOne) SetNillableSourceIP(s *string) *EventUpdateOne

SetNillableSourceIP sets the "source_ip" field if the given value is not nil.

func (*EventUpdateOne) SetReadOnly

func (euo *EventUpdateOne) SetReadOnly(b bool) *EventUpdateOne

SetReadOnly sets the "read_only" field.

func (*EventUpdateOne) SetRequestID

func (euo *EventUpdateOne) SetRequestID(s string) *EventUpdateOne

SetRequestID sets the "request_id" field.

func (*EventUpdateOne) SetResource

func (euo *EventUpdateOne) SetResource(s string) *EventUpdateOne

SetResource sets the "resource" field.

func (*EventUpdateOne) SetSourceIP

func (euo *EventUpdateOne) SetSourceIP(s string) *EventUpdateOne

SetSourceIP sets the "source_ip" field.

func (*EventUpdateOne) SetUsername

func (euo *EventUpdateOne) SetUsername(s string) *EventUpdateOne

SetUsername sets the "username" field.

type Events

type Events []*Event

Events is a parsable slice of Event.

type Hook

type Hook = ent.Hook

ent aliases to avoid import conflicts in user's code.

type MutateFunc

type MutateFunc = ent.MutateFunc

ent aliases to avoid import conflicts in user's code.

type Mutation

type Mutation = ent.Mutation

ent aliases to avoid import conflicts in user's code.

type Mutator

type Mutator = ent.Mutator

ent aliases to avoid import conflicts in user's code.

type NotFoundError

type NotFoundError struct {
	// contains filtered or unexported fields
}

NotFoundError returns when trying to fetch a specific entity and it was not found in the database.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

type NotLoadedError struct {
	// contains filtered or unexported fields
}

NotLoadedError returns when trying to get a node that was not loaded by the query.

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

type NotSingularError struct {
	// contains filtered or unexported fields
}

NotSingularError returns when trying to fetch a singular entity and more then one was found in the database.

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

ent aliases to avoid import conflicts in user's code.

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

ent aliases to avoid import conflicts in user's code.

type Query

type Query = ent.Query

ent aliases to avoid import conflicts in user's code.

type RollbackFunc

type RollbackFunc func(context.Context, *Tx) error

The RollbackFunc type is an adapter to allow the use of ordinary function as a Rollbacker. If f is a function with the appropriate signature, RollbackFunc(f) is a Rollbacker that calls f.

func (RollbackFunc) Rollback

func (f RollbackFunc) Rollback(ctx context.Context, tx *Tx) error

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

RollbackHook defines the "rollback middleware". A function that gets a Rollbacker and returns a Rollbacker. For example:

hook := func(next ent.Rollbacker) ent.Rollbacker {
	return ent.RollbackFunc(func(ctx context.Context, tx *ent.Tx) error {
		// Do some stuff before.
		if err := next.Rollback(ctx, tx); err != nil {
			return err
		}
		// Do some stuff after.
		return nil
	})
}

type Rollbacker

type Rollbacker interface {
	Rollback(context.Context, *Tx) error
}

Rollbacker is the interface that wraps the Rollback method.

type Tx

type Tx struct {

	// Event is the client for interacting with the Event builders.
	Event *EventClient
	// EventNameAutofill is the client for interacting with the EventNameAutofill builders.
	EventNameAutofill *EventNameAutofillClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// UsernameAutofill is the client for interacting with the UsernameAutofill builders.
	UsernameAutofill *UsernameAutofillClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// HashedPassword holds the value of the "hashed_password" field.
	HashedPassword string `json:"hashed_password,omitempty"`
	// Role holds the value of the "role" field.
	Role string `json:"role,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// PasswordLastSetAt holds the value of the "password_last_set_at" field.
	PasswordLastSetAt time.Time `json:"password_last_set_at,omitempty"`
	// ForcePasswordChange holds the value of the "force_password_change" field.
	ForcePasswordChange bool `json:"force_password_change,omitempty"`
	// LastLogin holds the value of the "last_login" field.
	LastLogin time.Time `json:"last_login,omitempty"`
	// FailedLogins holds the value of the "failed_logins" field.
	FailedLogins int `json:"failed_logins,omitempty"`
	// Locked holds the value of the "locked" field.
	Locked bool `json:"locked,omitempty"`
	// LockedUntil holds the value of the "locked_until" field.
	LockedUntil time.Time `json:"locked_until,omitempty"`
	// MfaSecret holds the value of the "mfa_secret" field.
	MfaSecret string `json:"mfa_secret,omitempty"`
	// MfaSetupCompleted holds the value of the "mfa_setup_completed" field.
	MfaSetupCompleted bool `json:"mfa_setup_completed,omitempty"`
	// RecentPasswords holds the value of the "recent_passwords" field.
	RecentPasswords []string `json:"recent_passwords,omitempty"`
	// MfaImage holds the value of the "mfa_image" field.
	MfaImage []byte `json:"mfa_image,omitempty"`
	// Timezone holds the value of the "timezone" field.
	Timezone string `json:"timezone,omitempty"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

Update returns a builder for updating this User. Note that you need to call User.Unwrap() before calling this method if this User was returned from a transaction, and the transaction was committed or rolled back.

type UserClient

type UserClient struct {
	// contains filtered or unexported fields
}

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a create builder for User.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

CreateBulk returns a builder for creating a bulk of User entities.

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id uuid.UUID) *UserDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id uuid.UUID) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id uuid.UUID) *User

GetX is like Get, but panics if an error occurs.

func (*UserClient) Hooks

func (c *UserClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id uuid.UUID) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

func (c *UserClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `user.Hooks(f(g(h())))`.

type UserCreate

type UserCreate struct {
	// contains filtered or unexported fields
}

UserCreate is the builder for creating a User entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetFailedLogins

func (uc *UserCreate) SetFailedLogins(i int) *UserCreate

SetFailedLogins sets the "failed_logins" field.

func (*UserCreate) SetForcePasswordChange

func (uc *UserCreate) SetForcePasswordChange(b bool) *UserCreate

SetForcePasswordChange sets the "force_password_change" field.

func (*UserCreate) SetHashedPassword

func (uc *UserCreate) SetHashedPassword(s string) *UserCreate

SetHashedPassword sets the "hashed_password" field.

func (*UserCreate) SetID

func (uc *UserCreate) SetID(u uuid.UUID) *UserCreate

SetID sets the "id" field.

func (*UserCreate) SetLastLogin

func (uc *UserCreate) SetLastLogin(t time.Time) *UserCreate

SetLastLogin sets the "last_login" field.

func (*UserCreate) SetLocked

func (uc *UserCreate) SetLocked(b bool) *UserCreate

SetLocked sets the "locked" field.

func (*UserCreate) SetLockedUntil

func (uc *UserCreate) SetLockedUntil(t time.Time) *UserCreate

SetLockedUntil sets the "locked_until" field.

func (*UserCreate) SetMfaImage

func (uc *UserCreate) SetMfaImage(b []byte) *UserCreate

SetMfaImage sets the "mfa_image" field.

func (*UserCreate) SetMfaSecret

func (uc *UserCreate) SetMfaSecret(s string) *UserCreate

SetMfaSecret sets the "mfa_secret" field.

func (*UserCreate) SetMfaSetupCompleted

func (uc *UserCreate) SetMfaSetupCompleted(b bool) *UserCreate

SetMfaSetupCompleted sets the "mfa_setup_completed" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserCreate) SetNillableFailedLogins

func (uc *UserCreate) SetNillableFailedLogins(i *int) *UserCreate

SetNillableFailedLogins sets the "failed_logins" field if the given value is not nil.

func (*UserCreate) SetNillableForcePasswordChange

func (uc *UserCreate) SetNillableForcePasswordChange(b *bool) *UserCreate

SetNillableForcePasswordChange sets the "force_password_change" field if the given value is not nil.

func (*UserCreate) SetNillableID

func (uc *UserCreate) SetNillableID(u *uuid.UUID) *UserCreate

SetNillableID sets the "id" field if the given value is not nil.

func (*UserCreate) SetNillableLastLogin

func (uc *UserCreate) SetNillableLastLogin(t *time.Time) *UserCreate

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UserCreate) SetNillableLocked

func (uc *UserCreate) SetNillableLocked(b *bool) *UserCreate

SetNillableLocked sets the "locked" field if the given value is not nil.

func (*UserCreate) SetNillableLockedUntil

func (uc *UserCreate) SetNillableLockedUntil(t *time.Time) *UserCreate

SetNillableLockedUntil sets the "locked_until" field if the given value is not nil.

func (*UserCreate) SetNillableMfaSecret

func (uc *UserCreate) SetNillableMfaSecret(s *string) *UserCreate

SetNillableMfaSecret sets the "mfa_secret" field if the given value is not nil.

func (*UserCreate) SetNillableMfaSetupCompleted

func (uc *UserCreate) SetNillableMfaSetupCompleted(b *bool) *UserCreate

SetNillableMfaSetupCompleted sets the "mfa_setup_completed" field if the given value is not nil.

func (*UserCreate) SetNillablePasswordLastSetAt

func (uc *UserCreate) SetNillablePasswordLastSetAt(t *time.Time) *UserCreate

SetNillablePasswordLastSetAt sets the "password_last_set_at" field if the given value is not nil.

func (*UserCreate) SetNillableTimezone

func (uc *UserCreate) SetNillableTimezone(s *string) *UserCreate

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*UserCreate) SetPasswordLastSetAt

func (uc *UserCreate) SetPasswordLastSetAt(t time.Time) *UserCreate

SetPasswordLastSetAt sets the "password_last_set_at" field.

func (*UserCreate) SetRecentPasswords

func (uc *UserCreate) SetRecentPasswords(s []string) *UserCreate

SetRecentPasswords sets the "recent_passwords" field.

func (*UserCreate) SetRole

func (uc *UserCreate) SetRole(s string) *UserCreate

SetRole sets the "role" field.

func (*UserCreate) SetTimezone

func (uc *UserCreate) SetTimezone(s string) *UserCreate

SetTimezone sets the "timezone" field.

func (*UserCreate) SetUsername

func (uc *UserCreate) SetUsername(s string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk

type UserCreateBulk struct {
	// contains filtered or unexported fields
}

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

SaveX is like Save, but panics if an error occurs.

type UserDelete

type UserDelete struct {
	// contains filtered or unexported fields
}

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

type UserDeleteOne struct {
	// contains filtered or unexported fields
}

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type UserGroupBy

type UserGroupBy struct {
	// contains filtered or unexported fields
}

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

Aggregate adds the given aggregation functions to the group-by query.

func (*UserGroupBy) Bool

func (ugb *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolX

func (ugb *UserGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserGroupBy) Bools

func (ugb *UserGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) BoolsX

func (ugb *UserGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserGroupBy) Float64

func (ugb *UserGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64X

func (ugb *UserGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserGroupBy) Float64s

func (ugb *UserGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) Float64sX

func (ugb *UserGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserGroupBy) Int

func (ugb *UserGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntX

func (ugb *UserGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserGroupBy) Ints

func (ugb *UserGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) IntsX

func (ugb *UserGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UserGroupBy) ScanX

func (ugb *UserGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserGroupBy) String

func (ugb *UserGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringX

func (ugb *UserGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserGroupBy) Strings

func (ugb *UserGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UserGroupBy) StringsX

func (ugb *UserGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserMutation

type UserMutation struct {
	// contains filtered or unexported fields
}

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddFailedLogins

func (m *UserMutation) AddFailedLogins(i int)

AddFailedLogins adds i to the "failed_logins" field.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

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 (*UserMutation) AddedEdges

func (m *UserMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UserMutation) AddedFailedLogins

func (m *UserMutation) AddedFailedLogins() (r int, exists bool)

AddedFailedLogins returns the value that was added to the "failed_logins" field in this mutation.

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

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 (*UserMutation) AddedFields

func (m *UserMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UserMutation) AddedIDs

func (m *UserMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

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 (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

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 (*UserMutation) ClearMfaImage

func (m *UserMutation) ClearMfaImage()

ClearMfaImage clears the value of the "mfa_image" field.

func (*UserMutation) ClearMfaSecret

func (m *UserMutation) ClearMfaSecret()

ClearMfaSecret clears the value of the "mfa_secret" field.

func (*UserMutation) ClearRecentPasswords

func (m *UserMutation) ClearRecentPasswords()

ClearRecentPasswords clears the value of the "recent_passwords" field.

func (*UserMutation) ClearTimezone

func (m *UserMutation) ClearTimezone()

ClearTimezone clears the value of the "timezone" field.

func (*UserMutation) ClearedEdges

func (m *UserMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UserMutation) ClearedFields

func (m *UserMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

func (m *UserMutation) CreatedAt() (r time.Time, exists bool)

CreatedAt returns the value of the "created_at" field in the mutation.

func (*UserMutation) EdgeCleared

func (m *UserMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UserMutation) FailedLogins

func (m *UserMutation) FailedLogins() (r int, exists bool)

FailedLogins returns the value of the "failed_logins" field in the mutation.

func (*UserMutation) Field

func (m *UserMutation) Field(name string) (ent.Value, bool)

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 (*UserMutation) FieldCleared

func (m *UserMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UserMutation) Fields

func (m *UserMutation) Fields() []string

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 (*UserMutation) ForcePasswordChange

func (m *UserMutation) ForcePasswordChange() (r bool, exists bool)

ForcePasswordChange returns the value of the "force_password_change" field in the mutation.

func (*UserMutation) HashedPassword

func (m *UserMutation) HashedPassword() (r string, exists bool)

HashedPassword returns the value of the "hashed_password" field in the mutation.

func (*UserMutation) ID

func (m *UserMutation) ID() (id uuid.UUID, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UserMutation) LastLogin

func (m *UserMutation) LastLogin() (r time.Time, exists bool)

LastLogin returns the value of the "last_login" field in the mutation.

func (*UserMutation) Locked

func (m *UserMutation) Locked() (r bool, exists bool)

Locked returns the value of the "locked" field in the mutation.

func (*UserMutation) LockedUntil

func (m *UserMutation) LockedUntil() (r time.Time, exists bool)

LockedUntil returns the value of the "locked_until" field in the mutation.

func (*UserMutation) MfaImage

func (m *UserMutation) MfaImage() (r []byte, exists bool)

MfaImage returns the value of the "mfa_image" field in the mutation.

func (*UserMutation) MfaImageCleared

func (m *UserMutation) MfaImageCleared() bool

MfaImageCleared returns if the "mfa_image" field was cleared in this mutation.

func (*UserMutation) MfaSecret

func (m *UserMutation) MfaSecret() (r string, exists bool)

MfaSecret returns the value of the "mfa_secret" field in the mutation.

func (*UserMutation) MfaSecretCleared

func (m *UserMutation) MfaSecretCleared() bool

MfaSecretCleared returns if the "mfa_secret" field was cleared in this mutation.

func (*UserMutation) MfaSetupCompleted

func (m *UserMutation) MfaSetupCompleted() (r bool, exists bool)

MfaSetupCompleted returns the value of the "mfa_setup_completed" field in the mutation.

func (*UserMutation) OldCreatedAt

func (m *UserMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error)

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldFailedLogins

func (m *UserMutation) OldFailedLogins(ctx context.Context) (v int, err error)

OldFailedLogins returns the old "failed_logins" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*UserMutation) OldForcePasswordChange

func (m *UserMutation) OldForcePasswordChange(ctx context.Context) (v bool, err error)

OldForcePasswordChange returns the old "force_password_change" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldHashedPassword

func (m *UserMutation) OldHashedPassword(ctx context.Context) (v string, err error)

OldHashedPassword returns the old "hashed_password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldLastLogin

func (m *UserMutation) OldLastLogin(ctx context.Context) (v time.Time, err error)

OldLastLogin returns the old "last_login" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldLocked

func (m *UserMutation) OldLocked(ctx context.Context) (v bool, err error)

OldLocked returns the old "locked" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldLockedUntil

func (m *UserMutation) OldLockedUntil(ctx context.Context) (v time.Time, err error)

OldLockedUntil returns the old "locked_until" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldMfaImage

func (m *UserMutation) OldMfaImage(ctx context.Context) (v []byte, err error)

OldMfaImage returns the old "mfa_image" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldMfaSecret

func (m *UserMutation) OldMfaSecret(ctx context.Context) (v string, err error)

OldMfaSecret returns the old "mfa_secret" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldMfaSetupCompleted

func (m *UserMutation) OldMfaSetupCompleted(ctx context.Context) (v bool, err error)

OldMfaSetupCompleted returns the old "mfa_setup_completed" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPasswordLastSetAt

func (m *UserMutation) OldPasswordLastSetAt(ctx context.Context) (v time.Time, err error)

OldPasswordLastSetAt returns the old "password_last_set_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldRecentPasswords

func (m *UserMutation) OldRecentPasswords(ctx context.Context) (v []string, err error)

OldRecentPasswords returns the old "recent_passwords" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldRole

func (m *UserMutation) OldRole(ctx context.Context) (v string, err error)

OldRole returns the old "role" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldTimezone

func (m *UserMutation) OldTimezone(ctx context.Context) (v string, err error)

OldTimezone returns the old "timezone" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUsername

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) PasswordLastSetAt

func (m *UserMutation) PasswordLastSetAt() (r time.Time, exists bool)

PasswordLastSetAt returns the value of the "password_last_set_at" field in the mutation.

func (*UserMutation) RecentPasswords

func (m *UserMutation) RecentPasswords() (r []string, exists bool)

RecentPasswords returns the value of the "recent_passwords" field in the mutation.

func (*UserMutation) RecentPasswordsCleared

func (m *UserMutation) RecentPasswordsCleared() bool

RecentPasswordsCleared returns if the "recent_passwords" field was cleared in this mutation.

func (*UserMutation) RemovedEdges

func (m *UserMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UserMutation) RemovedIDs

func (m *UserMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

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 (*UserMutation) ResetFailedLogins

func (m *UserMutation) ResetFailedLogins()

ResetFailedLogins resets all changes to the "failed_logins" field.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

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 (*UserMutation) ResetForcePasswordChange

func (m *UserMutation) ResetForcePasswordChange()

ResetForcePasswordChange resets all changes to the "force_password_change" field.

func (*UserMutation) ResetHashedPassword

func (m *UserMutation) ResetHashedPassword()

ResetHashedPassword resets all changes to the "hashed_password" field.

func (*UserMutation) ResetLastLogin

func (m *UserMutation) ResetLastLogin()

ResetLastLogin resets all changes to the "last_login" field.

func (*UserMutation) ResetLocked

func (m *UserMutation) ResetLocked()

ResetLocked resets all changes to the "locked" field.

func (*UserMutation) ResetLockedUntil

func (m *UserMutation) ResetLockedUntil()

ResetLockedUntil resets all changes to the "locked_until" field.

func (*UserMutation) ResetMfaImage

func (m *UserMutation) ResetMfaImage()

ResetMfaImage resets all changes to the "mfa_image" field.

func (*UserMutation) ResetMfaSecret

func (m *UserMutation) ResetMfaSecret()

ResetMfaSecret resets all changes to the "mfa_secret" field.

func (*UserMutation) ResetMfaSetupCompleted

func (m *UserMutation) ResetMfaSetupCompleted()

ResetMfaSetupCompleted resets all changes to the "mfa_setup_completed" field.

func (*UserMutation) ResetPasswordLastSetAt

func (m *UserMutation) ResetPasswordLastSetAt()

ResetPasswordLastSetAt resets all changes to the "password_last_set_at" field.

func (*UserMutation) ResetRecentPasswords

func (m *UserMutation) ResetRecentPasswords()

ResetRecentPasswords resets all changes to the "recent_passwords" field.

func (*UserMutation) ResetRole

func (m *UserMutation) ResetRole()

ResetRole resets all changes to the "role" field.

func (*UserMutation) ResetTimezone

func (m *UserMutation) ResetTimezone()

ResetTimezone resets all changes to the "timezone" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) Role

func (m *UserMutation) Role() (r string, exists bool)

Role returns the value of the "role" field in the mutation.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetFailedLogins

func (m *UserMutation) SetFailedLogins(i int)

SetFailedLogins sets the "failed_logins" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

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 (*UserMutation) SetForcePasswordChange

func (m *UserMutation) SetForcePasswordChange(b bool)

SetForcePasswordChange sets the "force_password_change" field.

func (*UserMutation) SetHashedPassword

func (m *UserMutation) SetHashedPassword(s string)

SetHashedPassword sets the "hashed_password" field.

func (*UserMutation) SetID

func (m *UserMutation) SetID(id uuid.UUID)

SetID sets the value of the id field. Note that this operation is only accepted on creation of User entities.

func (*UserMutation) SetLastLogin

func (m *UserMutation) SetLastLogin(t time.Time)

SetLastLogin sets the "last_login" field.

func (*UserMutation) SetLocked

func (m *UserMutation) SetLocked(b bool)

SetLocked sets the "locked" field.

func (*UserMutation) SetLockedUntil

func (m *UserMutation) SetLockedUntil(t time.Time)

SetLockedUntil sets the "locked_until" field.

func (*UserMutation) SetMfaImage

func (m *UserMutation) SetMfaImage(b []byte)

SetMfaImage sets the "mfa_image" field.

func (*UserMutation) SetMfaSecret

func (m *UserMutation) SetMfaSecret(s string)

SetMfaSecret sets the "mfa_secret" field.

func (*UserMutation) SetMfaSetupCompleted

func (m *UserMutation) SetMfaSetupCompleted(b bool)

SetMfaSetupCompleted sets the "mfa_setup_completed" field.

func (*UserMutation) SetPasswordLastSetAt

func (m *UserMutation) SetPasswordLastSetAt(t time.Time)

SetPasswordLastSetAt sets the "password_last_set_at" field.

func (*UserMutation) SetRecentPasswords

func (m *UserMutation) SetRecentPasswords(s []string)

SetRecentPasswords sets the "recent_passwords" field.

func (*UserMutation) SetRole

func (m *UserMutation) SetRole(s string)

SetRole sets the "role" field.

func (*UserMutation) SetTimezone

func (m *UserMutation) SetTimezone(s string)

SetTimezone sets the "timezone" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (*UserMutation) Timezone

func (m *UserMutation) Timezone() (r string, exists bool)

Timezone returns the value of the "timezone" field in the mutation.

func (*UserMutation) TimezoneCleared

func (m *UserMutation) TimezoneCleared() bool

TimezoneCleared returns if the "timezone" field was cleared in this mutation.

func (UserMutation) Tx

func (m UserMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UserMutation) Type

func (m *UserMutation) Type() string

Type returns the node type of this mutation (User).

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

type UserQuery

type UserQuery struct {
	// contains filtered or unexported fields
}

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

AllX is like All, but panics if an error occurs.

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

Clone returns a duplicate of the UserQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

First returns the first User entity from the query. Returns a *NotFoundError when no User was found.

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

FirstID returns the first User ID from the query. Returns a *NotFoundError when no User ID was found.

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID

FirstIDX is like FirstID, but panics if an error occurs.

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

FirstX is like First, but panics if an error occurs.

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Username string `json:"username,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldUsername).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

IDs executes the query and returns a list of User IDs.

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID

IDsX is like IDs, but panics if an error occurs.

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

Only returns a single User entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one User entity is found. Returns a *NotFoundError when no User entities are found.

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

OnlyID is like Only, but returns the only User ID in the query. Returns a *NotSingularError when more than one User ID is found. Returns a *NotFoundError when no entities are found.

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

OnlyX is like Only, but panics if an error occurs.

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Username string `json:"username,omitempty"`
}

client.User.Query().
	Select(user.FieldUsername).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Bool

func (us *UserSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolX

func (us *UserSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UserSelect) Bools

func (us *UserSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UserSelect) BoolsX

func (us *UserSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UserSelect) Float64

func (us *UserSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64X

func (us *UserSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UserSelect) Float64s

func (us *UserSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UserSelect) Float64sX

func (us *UserSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UserSelect) Int

func (us *UserSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntX

func (us *UserSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UserSelect) Ints

func (us *UserSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UserSelect) IntsX

func (us *UserSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UserSelect) ScanX

func (us *UserSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UserSelect) String

func (us *UserSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringX

func (us *UserSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UserSelect) Strings

func (us *UserSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UserSelect) StringsX

func (us *UserSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UserUpdate

type UserUpdate struct {
	// contains filtered or unexported fields
}

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddFailedLogins

func (uu *UserUpdate) AddFailedLogins(i int) *UserUpdate

AddFailedLogins adds i to the "failed_logins" field.

func (*UserUpdate) ClearMfaImage

func (uu *UserUpdate) ClearMfaImage() *UserUpdate

ClearMfaImage clears the value of the "mfa_image" field.

func (*UserUpdate) ClearMfaSecret

func (uu *UserUpdate) ClearMfaSecret() *UserUpdate

ClearMfaSecret clears the value of the "mfa_secret" field.

func (*UserUpdate) ClearRecentPasswords

func (uu *UserUpdate) ClearRecentPasswords() *UserUpdate

ClearRecentPasswords clears the value of the "recent_passwords" field.

func (*UserUpdate) ClearTimezone

func (uu *UserUpdate) ClearTimezone() *UserUpdate

ClearTimezone clears the value of the "timezone" field.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UserUpdate) SetCreatedAt

func (uu *UserUpdate) SetCreatedAt(t time.Time) *UserUpdate

SetCreatedAt sets the "created_at" field.

func (*UserUpdate) SetFailedLogins

func (uu *UserUpdate) SetFailedLogins(i int) *UserUpdate

SetFailedLogins sets the "failed_logins" field.

func (*UserUpdate) SetForcePasswordChange

func (uu *UserUpdate) SetForcePasswordChange(b bool) *UserUpdate

SetForcePasswordChange sets the "force_password_change" field.

func (*UserUpdate) SetHashedPassword

func (uu *UserUpdate) SetHashedPassword(s string) *UserUpdate

SetHashedPassword sets the "hashed_password" field.

func (*UserUpdate) SetLastLogin

func (uu *UserUpdate) SetLastLogin(t time.Time) *UserUpdate

SetLastLogin sets the "last_login" field.

func (*UserUpdate) SetLocked

func (uu *UserUpdate) SetLocked(b bool) *UserUpdate

SetLocked sets the "locked" field.

func (*UserUpdate) SetLockedUntil

func (uu *UserUpdate) SetLockedUntil(t time.Time) *UserUpdate

SetLockedUntil sets the "locked_until" field.

func (*UserUpdate) SetMfaImage

func (uu *UserUpdate) SetMfaImage(b []byte) *UserUpdate

SetMfaImage sets the "mfa_image" field.

func (*UserUpdate) SetMfaSecret

func (uu *UserUpdate) SetMfaSecret(s string) *UserUpdate

SetMfaSecret sets the "mfa_secret" field.

func (*UserUpdate) SetMfaSetupCompleted

func (uu *UserUpdate) SetMfaSetupCompleted(b bool) *UserUpdate

SetMfaSetupCompleted sets the "mfa_setup_completed" field.

func (*UserUpdate) SetNillableCreatedAt

func (uu *UserUpdate) SetNillableCreatedAt(t *time.Time) *UserUpdate

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserUpdate) SetNillableFailedLogins

func (uu *UserUpdate) SetNillableFailedLogins(i *int) *UserUpdate

SetNillableFailedLogins sets the "failed_logins" field if the given value is not nil.

func (*UserUpdate) SetNillableForcePasswordChange

func (uu *UserUpdate) SetNillableForcePasswordChange(b *bool) *UserUpdate

SetNillableForcePasswordChange sets the "force_password_change" field if the given value is not nil.

func (*UserUpdate) SetNillableLastLogin

func (uu *UserUpdate) SetNillableLastLogin(t *time.Time) *UserUpdate

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UserUpdate) SetNillableLocked

func (uu *UserUpdate) SetNillableLocked(b *bool) *UserUpdate

SetNillableLocked sets the "locked" field if the given value is not nil.

func (*UserUpdate) SetNillableLockedUntil

func (uu *UserUpdate) SetNillableLockedUntil(t *time.Time) *UserUpdate

SetNillableLockedUntil sets the "locked_until" field if the given value is not nil.

func (*UserUpdate) SetNillableMfaSecret

func (uu *UserUpdate) SetNillableMfaSecret(s *string) *UserUpdate

SetNillableMfaSecret sets the "mfa_secret" field if the given value is not nil.

func (*UserUpdate) SetNillableMfaSetupCompleted

func (uu *UserUpdate) SetNillableMfaSetupCompleted(b *bool) *UserUpdate

SetNillableMfaSetupCompleted sets the "mfa_setup_completed" field if the given value is not nil.

func (*UserUpdate) SetNillablePasswordLastSetAt

func (uu *UserUpdate) SetNillablePasswordLastSetAt(t *time.Time) *UserUpdate

SetNillablePasswordLastSetAt sets the "password_last_set_at" field if the given value is not nil.

func (*UserUpdate) SetNillableTimezone

func (uu *UserUpdate) SetNillableTimezone(s *string) *UserUpdate

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*UserUpdate) SetPasswordLastSetAt

func (uu *UserUpdate) SetPasswordLastSetAt(t time.Time) *UserUpdate

SetPasswordLastSetAt sets the "password_last_set_at" field.

func (*UserUpdate) SetRecentPasswords

func (uu *UserUpdate) SetRecentPasswords(s []string) *UserUpdate

SetRecentPasswords sets the "recent_passwords" field.

func (*UserUpdate) SetRole

func (uu *UserUpdate) SetRole(s string) *UserUpdate

SetRole sets the "role" field.

func (*UserUpdate) SetTimezone

func (uu *UserUpdate) SetTimezone(s string) *UserUpdate

SetTimezone sets the "timezone" field.

func (*UserUpdate) SetUsername

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

type UserUpdateOne struct {
	// contains filtered or unexported fields
}

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddFailedLogins

func (uuo *UserUpdateOne) AddFailedLogins(i int) *UserUpdateOne

AddFailedLogins adds i to the "failed_logins" field.

func (*UserUpdateOne) ClearMfaImage

func (uuo *UserUpdateOne) ClearMfaImage() *UserUpdateOne

ClearMfaImage clears the value of the "mfa_image" field.

func (*UserUpdateOne) ClearMfaSecret

func (uuo *UserUpdateOne) ClearMfaSecret() *UserUpdateOne

ClearMfaSecret clears the value of the "mfa_secret" field.

func (*UserUpdateOne) ClearRecentPasswords

func (uuo *UserUpdateOne) ClearRecentPasswords() *UserUpdateOne

ClearRecentPasswords clears the value of the "recent_passwords" field.

func (*UserUpdateOne) ClearTimezone

func (uuo *UserUpdateOne) ClearTimezone() *UserUpdateOne

ClearTimezone clears the value of the "timezone" field.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

SaveX is like Save, but panics if an error occurs.

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UserUpdateOne) SetCreatedAt

func (uuo *UserUpdateOne) SetCreatedAt(t time.Time) *UserUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserUpdateOne) SetFailedLogins

func (uuo *UserUpdateOne) SetFailedLogins(i int) *UserUpdateOne

SetFailedLogins sets the "failed_logins" field.

func (*UserUpdateOne) SetForcePasswordChange

func (uuo *UserUpdateOne) SetForcePasswordChange(b bool) *UserUpdateOne

SetForcePasswordChange sets the "force_password_change" field.

func (*UserUpdateOne) SetHashedPassword

func (uuo *UserUpdateOne) SetHashedPassword(s string) *UserUpdateOne

SetHashedPassword sets the "hashed_password" field.

func (*UserUpdateOne) SetLastLogin

func (uuo *UserUpdateOne) SetLastLogin(t time.Time) *UserUpdateOne

SetLastLogin sets the "last_login" field.

func (*UserUpdateOne) SetLocked

func (uuo *UserUpdateOne) SetLocked(b bool) *UserUpdateOne

SetLocked sets the "locked" field.

func (*UserUpdateOne) SetLockedUntil

func (uuo *UserUpdateOne) SetLockedUntil(t time.Time) *UserUpdateOne

SetLockedUntil sets the "locked_until" field.

func (*UserUpdateOne) SetMfaImage

func (uuo *UserUpdateOne) SetMfaImage(b []byte) *UserUpdateOne

SetMfaImage sets the "mfa_image" field.

func (*UserUpdateOne) SetMfaSecret

func (uuo *UserUpdateOne) SetMfaSecret(s string) *UserUpdateOne

SetMfaSecret sets the "mfa_secret" field.

func (*UserUpdateOne) SetMfaSetupCompleted

func (uuo *UserUpdateOne) SetMfaSetupCompleted(b bool) *UserUpdateOne

SetMfaSetupCompleted sets the "mfa_setup_completed" field.

func (*UserUpdateOne) SetNillableCreatedAt

func (uuo *UserUpdateOne) SetNillableCreatedAt(t *time.Time) *UserUpdateOne

SetNillableCreatedAt sets the "created_at" field if the given value is not nil.

func (*UserUpdateOne) SetNillableFailedLogins

func (uuo *UserUpdateOne) SetNillableFailedLogins(i *int) *UserUpdateOne

SetNillableFailedLogins sets the "failed_logins" field if the given value is not nil.

func (*UserUpdateOne) SetNillableForcePasswordChange

func (uuo *UserUpdateOne) SetNillableForcePasswordChange(b *bool) *UserUpdateOne

SetNillableForcePasswordChange sets the "force_password_change" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLastLogin

func (uuo *UserUpdateOne) SetNillableLastLogin(t *time.Time) *UserUpdateOne

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLocked

func (uuo *UserUpdateOne) SetNillableLocked(b *bool) *UserUpdateOne

SetNillableLocked sets the "locked" field if the given value is not nil.

func (*UserUpdateOne) SetNillableLockedUntil

func (uuo *UserUpdateOne) SetNillableLockedUntil(t *time.Time) *UserUpdateOne

SetNillableLockedUntil sets the "locked_until" field if the given value is not nil.

func (*UserUpdateOne) SetNillableMfaSecret

func (uuo *UserUpdateOne) SetNillableMfaSecret(s *string) *UserUpdateOne

SetNillableMfaSecret sets the "mfa_secret" field if the given value is not nil.

func (*UserUpdateOne) SetNillableMfaSetupCompleted

func (uuo *UserUpdateOne) SetNillableMfaSetupCompleted(b *bool) *UserUpdateOne

SetNillableMfaSetupCompleted sets the "mfa_setup_completed" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePasswordLastSetAt

func (uuo *UserUpdateOne) SetNillablePasswordLastSetAt(t *time.Time) *UserUpdateOne

SetNillablePasswordLastSetAt sets the "password_last_set_at" field if the given value is not nil.

func (*UserUpdateOne) SetNillableTimezone

func (uuo *UserUpdateOne) SetNillableTimezone(s *string) *UserUpdateOne

SetNillableTimezone sets the "timezone" field if the given value is not nil.

func (*UserUpdateOne) SetPasswordLastSetAt

func (uuo *UserUpdateOne) SetPasswordLastSetAt(t time.Time) *UserUpdateOne

SetPasswordLastSetAt sets the "password_last_set_at" field.

func (*UserUpdateOne) SetRecentPasswords

func (uuo *UserUpdateOne) SetRecentPasswords(s []string) *UserUpdateOne

SetRecentPasswords sets the "recent_passwords" field.

func (*UserUpdateOne) SetRole

func (uuo *UserUpdateOne) SetRole(s string) *UserUpdateOne

SetRole sets the "role" field.

func (*UserUpdateOne) SetTimezone

func (uuo *UserUpdateOne) SetTimezone(s string) *UserUpdateOne

SetTimezone sets the "timezone" field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" field.

type UsernameAutofill

type UsernameAutofill struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Username holds the value of the "username" field.
	Username string `json:"username,omitempty"`
	// contains filtered or unexported fields
}

UsernameAutofill is the model entity for the UsernameAutofill schema.

func (*UsernameAutofill) String

func (ua *UsernameAutofill) String() string

String implements the fmt.Stringer.

func (*UsernameAutofill) Unwrap

func (ua *UsernameAutofill) Unwrap() *UsernameAutofill

Unwrap unwraps the UsernameAutofill entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*UsernameAutofill) Update

Update returns a builder for updating this UsernameAutofill. Note that you need to call UsernameAutofill.Unwrap() before calling this method if this UsernameAutofill was returned from a transaction, and the transaction was committed or rolled back.

type UsernameAutofillClient

type UsernameAutofillClient struct {
	// contains filtered or unexported fields
}

UsernameAutofillClient is a client for the UsernameAutofill schema.

func NewUsernameAutofillClient

func NewUsernameAutofillClient(c config) *UsernameAutofillClient

NewUsernameAutofillClient returns a client for the UsernameAutofill from the given config.

func (*UsernameAutofillClient) Create

Create returns a create builder for UsernameAutofill.

func (*UsernameAutofillClient) CreateBulk

CreateBulk returns a builder for creating a bulk of UsernameAutofill entities.

func (*UsernameAutofillClient) Delete

Delete returns a delete builder for UsernameAutofill.

func (*UsernameAutofillClient) DeleteOne

DeleteOne returns a delete builder for the given entity.

func (*UsernameAutofillClient) DeleteOneID

DeleteOneID returns a delete builder for the given id.

func (*UsernameAutofillClient) Get

Get returns a UsernameAutofill entity by its id.

func (*UsernameAutofillClient) GetX

GetX is like Get, but panics if an error occurs.

func (*UsernameAutofillClient) Hooks

func (c *UsernameAutofillClient) Hooks() []Hook

Hooks returns the client hooks.

func (*UsernameAutofillClient) Query

Query returns a query builder for UsernameAutofill.

func (*UsernameAutofillClient) Update

Update returns an update builder for UsernameAutofill.

func (*UsernameAutofillClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*UsernameAutofillClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*UsernameAutofillClient) Use

func (c *UsernameAutofillClient) Use(hooks ...Hook)

Use adds a list of mutation hooks to the hooks stack. A call to `Use(f, g, h)` equals to `usernameautofill.Hooks(f(g(h())))`.

type UsernameAutofillCreate

type UsernameAutofillCreate struct {
	// contains filtered or unexported fields
}

UsernameAutofillCreate is the builder for creating a UsernameAutofill entity.

func (*UsernameAutofillCreate) Exec

Exec executes the query.

func (*UsernameAutofillCreate) ExecX

func (uac *UsernameAutofillCreate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UsernameAutofillCreate) Mutation

Mutation returns the UsernameAutofillMutation object of the builder.

func (*UsernameAutofillCreate) Save

Save creates the UsernameAutofill in the database.

func (*UsernameAutofillCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*UsernameAutofillCreate) SetUsername

SetUsername sets the "username" field.

type UsernameAutofillCreateBulk

type UsernameAutofillCreateBulk struct {
	// contains filtered or unexported fields
}

UsernameAutofillCreateBulk is the builder for creating many UsernameAutofill entities in bulk.

func (*UsernameAutofillCreateBulk) Exec

Exec executes the query.

func (*UsernameAutofillCreateBulk) ExecX

func (uacb *UsernameAutofillCreateBulk) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UsernameAutofillCreateBulk) Save

Save creates the UsernameAutofill entities in the database.

func (*UsernameAutofillCreateBulk) SaveX

SaveX is like Save, but panics if an error occurs.

type UsernameAutofillDelete

type UsernameAutofillDelete struct {
	// contains filtered or unexported fields
}

UsernameAutofillDelete is the builder for deleting a UsernameAutofill entity.

func (*UsernameAutofillDelete) Exec

func (uad *UsernameAutofillDelete) Exec(ctx context.Context) (int, error)

Exec executes the deletion query and returns how many vertices were deleted.

func (*UsernameAutofillDelete) ExecX

func (uad *UsernameAutofillDelete) ExecX(ctx context.Context) int

ExecX is like Exec, but panics if an error occurs.

func (*UsernameAutofillDelete) Where

Where appends a list predicates to the UsernameAutofillDelete builder.

type UsernameAutofillDeleteOne

type UsernameAutofillDeleteOne struct {
	// contains filtered or unexported fields
}

UsernameAutofillDeleteOne is the builder for deleting a single UsernameAutofill entity.

func (*UsernameAutofillDeleteOne) Exec

Exec executes the deletion query.

func (*UsernameAutofillDeleteOne) ExecX

func (uado *UsernameAutofillDeleteOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

type UsernameAutofillGroupBy

type UsernameAutofillGroupBy struct {
	// contains filtered or unexported fields
}

UsernameAutofillGroupBy is the group-by builder for UsernameAutofill entities.

func (*UsernameAutofillGroupBy) Aggregate

Aggregate adds the given aggregation functions to the group-by query.

func (*UsernameAutofillGroupBy) Bool

func (uagb *UsernameAutofillGroupBy) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) BoolX

func (uagb *UsernameAutofillGroupBy) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UsernameAutofillGroupBy) Bools

func (uagb *UsernameAutofillGroupBy) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from group-by. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) BoolsX

func (uagb *UsernameAutofillGroupBy) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UsernameAutofillGroupBy) Float64

func (uagb *UsernameAutofillGroupBy) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) Float64X

func (uagb *UsernameAutofillGroupBy) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UsernameAutofillGroupBy) Float64s

func (uagb *UsernameAutofillGroupBy) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from group-by. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) Float64sX

func (uagb *UsernameAutofillGroupBy) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UsernameAutofillGroupBy) Int

func (uagb *UsernameAutofillGroupBy) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) IntX

func (uagb *UsernameAutofillGroupBy) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UsernameAutofillGroupBy) Ints

func (uagb *UsernameAutofillGroupBy) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from group-by. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) IntsX

func (uagb *UsernameAutofillGroupBy) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UsernameAutofillGroupBy) Scan

func (uagb *UsernameAutofillGroupBy) Scan(ctx context.Context, v interface{}) error

Scan applies the group-by query and scans the result into the given value.

func (*UsernameAutofillGroupBy) ScanX

func (uagb *UsernameAutofillGroupBy) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UsernameAutofillGroupBy) String

func (uagb *UsernameAutofillGroupBy) String(ctx context.Context) (_ string, err error)

String returns a single string from a group-by query. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) StringX

func (uagb *UsernameAutofillGroupBy) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UsernameAutofillGroupBy) Strings

func (uagb *UsernameAutofillGroupBy) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from group-by. It is only allowed when executing a group-by query with one field.

func (*UsernameAutofillGroupBy) StringsX

func (uagb *UsernameAutofillGroupBy) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UsernameAutofillMutation

type UsernameAutofillMutation struct {
	// contains filtered or unexported fields
}

UsernameAutofillMutation represents an operation that mutates the UsernameAutofill nodes in the graph.

func (*UsernameAutofillMutation) AddField

func (m *UsernameAutofillMutation) AddField(name string, value ent.Value) error

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 (*UsernameAutofillMutation) AddedEdges

func (m *UsernameAutofillMutation) AddedEdges() []string

AddedEdges returns all edge names that were set/added in this mutation.

func (*UsernameAutofillMutation) AddedField

func (m *UsernameAutofillMutation) AddedField(name string) (ent.Value, bool)

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 (*UsernameAutofillMutation) AddedFields

func (m *UsernameAutofillMutation) AddedFields() []string

AddedFields returns all numeric fields that were incremented/decremented during this mutation.

func (*UsernameAutofillMutation) AddedIDs

func (m *UsernameAutofillMutation) AddedIDs(name string) []ent.Value

AddedIDs returns all IDs (to other nodes) that were added for the given edge name in this mutation.

func (*UsernameAutofillMutation) ClearEdge

func (m *UsernameAutofillMutation) ClearEdge(name string) error

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 (*UsernameAutofillMutation) ClearField

func (m *UsernameAutofillMutation) ClearField(name string) error

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 (*UsernameAutofillMutation) ClearedEdges

func (m *UsernameAutofillMutation) ClearedEdges() []string

ClearedEdges returns all edge names that were cleared in this mutation.

func (*UsernameAutofillMutation) ClearedFields

func (m *UsernameAutofillMutation) ClearedFields() []string

ClearedFields returns all nullable fields that were cleared during this mutation.

func (UsernameAutofillMutation) Client

func (m UsernameAutofillMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UsernameAutofillMutation) EdgeCleared

func (m *UsernameAutofillMutation) EdgeCleared(name string) bool

EdgeCleared returns a boolean which indicates if the edge with the given name was cleared in this mutation.

func (*UsernameAutofillMutation) Field

func (m *UsernameAutofillMutation) Field(name string) (ent.Value, bool)

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 (*UsernameAutofillMutation) FieldCleared

func (m *UsernameAutofillMutation) FieldCleared(name string) bool

FieldCleared returns a boolean indicating if a field with the given name was cleared in this mutation.

func (*UsernameAutofillMutation) Fields

func (m *UsernameAutofillMutation) Fields() []string

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 (*UsernameAutofillMutation) ID

func (m *UsernameAutofillMutation) ID() (id int, exists bool)

ID returns the ID value in the mutation. Note that the ID is only available if it was provided to the builder or after it was returned from the database.

func (*UsernameAutofillMutation) IDs

IDs queries the database and returns the entity ids that match the mutation's predicate. That means, if the mutation is applied within a transaction with an isolation level such as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated or updated by the mutation.

func (*UsernameAutofillMutation) OldField

func (m *UsernameAutofillMutation) OldField(ctx context.Context, name string) (ent.Value, error)

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 (*UsernameAutofillMutation) OldUsername

func (m *UsernameAutofillMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the UsernameAutofill entity. If the UsernameAutofill object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UsernameAutofillMutation) Op

func (m *UsernameAutofillMutation) Op() Op

Op returns the operation name.

func (*UsernameAutofillMutation) RemovedEdges

func (m *UsernameAutofillMutation) RemovedEdges() []string

RemovedEdges returns all edge names that were removed in this mutation.

func (*UsernameAutofillMutation) RemovedIDs

func (m *UsernameAutofillMutation) RemovedIDs(name string) []ent.Value

RemovedIDs returns all IDs (to other nodes) that were removed for the edge with the given name in this mutation.

func (*UsernameAutofillMutation) ResetEdge

func (m *UsernameAutofillMutation) ResetEdge(name string) error

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 (*UsernameAutofillMutation) ResetField

func (m *UsernameAutofillMutation) ResetField(name string) error

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 (*UsernameAutofillMutation) ResetUsername

func (m *UsernameAutofillMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UsernameAutofillMutation) SetField

func (m *UsernameAutofillMutation) SetField(name string, value ent.Value) error

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 (*UsernameAutofillMutation) SetUsername

func (m *UsernameAutofillMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (UsernameAutofillMutation) Tx

func (m UsernameAutofillMutation) Tx() (*Tx, error)

Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.

func (*UsernameAutofillMutation) Type

func (m *UsernameAutofillMutation) Type() string

Type returns the node type of this mutation (UsernameAutofill).

func (*UsernameAutofillMutation) Username

func (m *UsernameAutofillMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UsernameAutofillMutation) Where

Where appends a list predicates to the UsernameAutofillMutation builder.

type UsernameAutofillQuery

type UsernameAutofillQuery struct {
	// contains filtered or unexported fields
}

UsernameAutofillQuery is the builder for querying UsernameAutofill entities.

func (*UsernameAutofillQuery) All

All executes the query and returns a list of UsernameAutofills.

func (*UsernameAutofillQuery) AllX

AllX is like All, but panics if an error occurs.

func (*UsernameAutofillQuery) Clone

Clone returns a duplicate of the UsernameAutofillQuery builder, including all associated steps. It can be used to prepare common query builders and use them differently after the clone is made.

func (*UsernameAutofillQuery) Count

func (uaq *UsernameAutofillQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UsernameAutofillQuery) CountX

func (uaq *UsernameAutofillQuery) CountX(ctx context.Context) int

CountX is like Count, but panics if an error occurs.

func (*UsernameAutofillQuery) Exist

func (uaq *UsernameAutofillQuery) Exist(ctx context.Context) (bool, error)

Exist returns true if the query has elements in the graph.

func (*UsernameAutofillQuery) ExistX

func (uaq *UsernameAutofillQuery) ExistX(ctx context.Context) bool

ExistX is like Exist, but panics if an error occurs.

func (*UsernameAutofillQuery) First

First returns the first UsernameAutofill entity from the query. Returns a *NotFoundError when no UsernameAutofill was found.

func (*UsernameAutofillQuery) FirstID

func (uaq *UsernameAutofillQuery) FirstID(ctx context.Context) (id int, err error)

FirstID returns the first UsernameAutofill ID from the query. Returns a *NotFoundError when no UsernameAutofill ID was found.

func (*UsernameAutofillQuery) FirstIDX

func (uaq *UsernameAutofillQuery) FirstIDX(ctx context.Context) int

FirstIDX is like FirstID, but panics if an error occurs.

func (*UsernameAutofillQuery) FirstX

FirstX is like First, but panics if an error occurs.

func (*UsernameAutofillQuery) GroupBy

func (uaq *UsernameAutofillQuery) GroupBy(field string, fields ...string) *UsernameAutofillGroupBy

GroupBy is used to group vertices by one or more fields/columns. It is often used with aggregate functions, like: count, max, mean, min, sum.

Example:

var v []struct {
	Username string `json:"username,omitempty"`
	Count int `json:"count,omitempty"`
}

client.UsernameAutofill.Query().
	GroupBy(usernameautofill.FieldUsername).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UsernameAutofillQuery) IDs

func (uaq *UsernameAutofillQuery) IDs(ctx context.Context) ([]int, error)

IDs executes the query and returns a list of UsernameAutofill IDs.

func (*UsernameAutofillQuery) IDsX

func (uaq *UsernameAutofillQuery) IDsX(ctx context.Context) []int

IDsX is like IDs, but panics if an error occurs.

func (*UsernameAutofillQuery) Limit

func (uaq *UsernameAutofillQuery) Limit(limit int) *UsernameAutofillQuery

Limit adds a limit step to the query.

func (*UsernameAutofillQuery) Offset

func (uaq *UsernameAutofillQuery) Offset(offset int) *UsernameAutofillQuery

Offset adds an offset step to the query.

func (*UsernameAutofillQuery) Only

Only returns a single UsernameAutofill entity found by the query, ensuring it only returns one. Returns a *NotSingularError when more than one UsernameAutofill entity is found. Returns a *NotFoundError when no UsernameAutofill entities are found.

func (*UsernameAutofillQuery) OnlyID

func (uaq *UsernameAutofillQuery) OnlyID(ctx context.Context) (id int, err error)

OnlyID is like Only, but returns the only UsernameAutofill ID in the query. Returns a *NotSingularError when more than one UsernameAutofill ID is found. Returns a *NotFoundError when no entities are found.

func (*UsernameAutofillQuery) OnlyIDX

func (uaq *UsernameAutofillQuery) OnlyIDX(ctx context.Context) int

OnlyIDX is like OnlyID, but panics if an error occurs.

func (*UsernameAutofillQuery) OnlyX

OnlyX is like Only, but panics if an error occurs.

func (*UsernameAutofillQuery) Order

Order adds an order step to the query.

func (*UsernameAutofillQuery) Select

func (uaq *UsernameAutofillQuery) Select(fields ...string) *UsernameAutofillSelect

Select allows the selection one or more fields/columns for the given query, instead of selecting all fields in the entity.

Example:

var v []struct {
	Username string `json:"username,omitempty"`
}

client.UsernameAutofill.Query().
	Select(usernameautofill.FieldUsername).
	Scan(ctx, &v)

func (*UsernameAutofillQuery) Unique

func (uaq *UsernameAutofillQuery) Unique(unique bool) *UsernameAutofillQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UsernameAutofillQuery) Where

Where adds a new predicate for the UsernameAutofillQuery builder.

type UsernameAutofillSelect

type UsernameAutofillSelect struct {
	*UsernameAutofillQuery
	// contains filtered or unexported fields
}

UsernameAutofillSelect is the builder for selecting fields of UsernameAutofill entities.

func (*UsernameAutofillSelect) Bool

func (uas *UsernameAutofillSelect) Bool(ctx context.Context) (_ bool, err error)

Bool returns a single bool from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) BoolX

func (uas *UsernameAutofillSelect) BoolX(ctx context.Context) bool

BoolX is like Bool, but panics if an error occurs.

func (*UsernameAutofillSelect) Bools

func (uas *UsernameAutofillSelect) Bools(ctx context.Context) ([]bool, error)

Bools returns list of bools from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) BoolsX

func (uas *UsernameAutofillSelect) BoolsX(ctx context.Context) []bool

BoolsX is like Bools, but panics if an error occurs.

func (*UsernameAutofillSelect) Float64

func (uas *UsernameAutofillSelect) Float64(ctx context.Context) (_ float64, err error)

Float64 returns a single float64 from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) Float64X

func (uas *UsernameAutofillSelect) Float64X(ctx context.Context) float64

Float64X is like Float64, but panics if an error occurs.

func (*UsernameAutofillSelect) Float64s

func (uas *UsernameAutofillSelect) Float64s(ctx context.Context) ([]float64, error)

Float64s returns list of float64s from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) Float64sX

func (uas *UsernameAutofillSelect) Float64sX(ctx context.Context) []float64

Float64sX is like Float64s, but panics if an error occurs.

func (*UsernameAutofillSelect) Int

func (uas *UsernameAutofillSelect) Int(ctx context.Context) (_ int, err error)

Int returns a single int from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) IntX

func (uas *UsernameAutofillSelect) IntX(ctx context.Context) int

IntX is like Int, but panics if an error occurs.

func (*UsernameAutofillSelect) Ints

func (uas *UsernameAutofillSelect) Ints(ctx context.Context) ([]int, error)

Ints returns list of ints from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) IntsX

func (uas *UsernameAutofillSelect) IntsX(ctx context.Context) []int

IntsX is like Ints, but panics if an error occurs.

func (*UsernameAutofillSelect) Scan

func (uas *UsernameAutofillSelect) Scan(ctx context.Context, v interface{}) error

Scan applies the selector query and scans the result into the given value.

func (*UsernameAutofillSelect) ScanX

func (uas *UsernameAutofillSelect) ScanX(ctx context.Context, v interface{})

ScanX is like Scan, but panics if an error occurs.

func (*UsernameAutofillSelect) String

func (uas *UsernameAutofillSelect) String(ctx context.Context) (_ string, err error)

String returns a single string from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) StringX

func (uas *UsernameAutofillSelect) StringX(ctx context.Context) string

StringX is like String, but panics if an error occurs.

func (*UsernameAutofillSelect) Strings

func (uas *UsernameAutofillSelect) Strings(ctx context.Context) ([]string, error)

Strings returns list of strings from a selector. It is only allowed when selecting one field.

func (*UsernameAutofillSelect) StringsX

func (uas *UsernameAutofillSelect) StringsX(ctx context.Context) []string

StringsX is like Strings, but panics if an error occurs.

type UsernameAutofillUpdate

type UsernameAutofillUpdate struct {
	// contains filtered or unexported fields
}

UsernameAutofillUpdate is the builder for updating UsernameAutofill entities.

func (*UsernameAutofillUpdate) Exec

Exec executes the query.

func (*UsernameAutofillUpdate) ExecX

func (uau *UsernameAutofillUpdate) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UsernameAutofillUpdate) Mutation

Mutation returns the UsernameAutofillMutation object of the builder.

func (*UsernameAutofillUpdate) Save

func (uau *UsernameAutofillUpdate) Save(ctx context.Context) (int, error)

Save executes the query and returns the number of nodes affected by the update operation.

func (*UsernameAutofillUpdate) SaveX

func (uau *UsernameAutofillUpdate) SaveX(ctx context.Context) int

SaveX is like Save, but panics if an error occurs.

func (*UsernameAutofillUpdate) SetUsername

SetUsername sets the "username" field.

func (*UsernameAutofillUpdate) Where

Where appends a list predicates to the UsernameAutofillUpdate builder.

type UsernameAutofillUpdateOne

type UsernameAutofillUpdateOne struct {
	// contains filtered or unexported fields
}

UsernameAutofillUpdateOne is the builder for updating a single UsernameAutofill entity.

func (*UsernameAutofillUpdateOne) Exec

Exec executes the query on the entity.

func (*UsernameAutofillUpdateOne) ExecX

func (uauo *UsernameAutofillUpdateOne) ExecX(ctx context.Context)

ExecX is like Exec, but panics if an error occurs.

func (*UsernameAutofillUpdateOne) Mutation

Mutation returns the UsernameAutofillMutation object of the builder.

func (*UsernameAutofillUpdateOne) Save

Save executes the query and returns the updated UsernameAutofill entity.

func (*UsernameAutofillUpdateOne) SaveX

SaveX is like Save, but panics if an error occurs.

func (*UsernameAutofillUpdateOne) Select

func (uauo *UsernameAutofillUpdateOne) Select(field string, fields ...string) *UsernameAutofillUpdateOne

Select allows selecting one or more fields (columns) of the returned entity. The default is selecting all fields defined in the entity schema.

func (*UsernameAutofillUpdateOne) SetUsername

SetUsername sets the "username" field.

type UsernameAutofills

type UsernameAutofills []*UsernameAutofill

UsernameAutofills is a parsable slice of UsernameAutofill.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

ent aliases to avoid import conflicts in user's code.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL