generate

package
v0.0.0-...-d6725e5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 23 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.
	TypeDevice  = "Device"
	TypeMessage = "Message"
	TypeUser    = "User"
)

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(generate.As(generate.Sum(field1), "sum_field1"), (generate.As(generate.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
	// Device is the client for interacting with the Device builders.
	Device *DeviceClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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().
	Device.
	Query().
	Count(ctx)

func (*Client) Intercept

func (c *Client) Intercept(interceptors ...Interceptor)

Intercept adds the query interceptors to all the entity clients. In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.

func (*Client) Mutate

func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error)

Mutate implements the ent.Mutator interface.

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 Device

type Device struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Identifier holds the value of the "identifier" field.
	Identifier string `json:"identifier,omitempty"`
	// Channel holds the value of the "channel" field.
	Channel enum.Sender `json:"channel,omitempty"`
	// ChannelMeta holds the value of the "channelMeta" field.
	ChannelMeta string `json:"channelMeta,omitempty"`
	// ChannelToken holds the value of the "channelToken" field.
	ChannelToken string `json:"channelToken,omitempty"`
	// DeviceName holds the value of the "deviceName" field.
	DeviceName string `json:"deviceName,omitempty"`
	// DeviceMeta holds the value of the "deviceMeta" field.
	DeviceMeta string `json:"deviceMeta,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the DeviceQuery when eager-loading is set.
	Edges DeviceEdges `json:"edges"`
	// contains filtered or unexported fields
}

Device is the model entity for the Device schema.

func (*Device) QueryUser

func (d *Device) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Device entity.

func (*Device) String

func (d *Device) String() string

String implements the fmt.Stringer.

func (*Device) Unwrap

func (d *Device) Unwrap() *Device

Unwrap unwraps the Device 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 (*Device) Update

func (d *Device) Update() *DeviceUpdateOne

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

type DeviceClient

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

DeviceClient is a client for the Device schema.

func NewDeviceClient

func NewDeviceClient(c config) *DeviceClient

NewDeviceClient returns a client for the Device from the given config.

func (*DeviceClient) Create

func (c *DeviceClient) Create() *DeviceCreate

Create returns a builder for creating a Device entity.

func (*DeviceClient) CreateBulk

func (c *DeviceClient) CreateBulk(builders ...*DeviceCreate) *DeviceCreateBulk

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

func (*DeviceClient) Delete

func (c *DeviceClient) Delete() *DeviceDelete

Delete returns a delete builder for Device.

func (*DeviceClient) DeleteOne

func (c *DeviceClient) DeleteOne(d *Device) *DeviceDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*DeviceClient) DeleteOneID

func (c *DeviceClient) DeleteOneID(id int) *DeviceDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*DeviceClient) Get

func (c *DeviceClient) Get(ctx context.Context, id int) (*Device, error)

Get returns a Device entity by its id.

func (*DeviceClient) GetX

func (c *DeviceClient) GetX(ctx context.Context, id int) *Device

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

func (*DeviceClient) Hooks

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

Hooks returns the client hooks.

func (*DeviceClient) Intercept

func (c *DeviceClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `device.Intercept(f(g(h())))`.

func (*DeviceClient) Interceptors

func (c *DeviceClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*DeviceClient) Query

func (c *DeviceClient) Query() *DeviceQuery

Query returns a query builder for Device.

func (*DeviceClient) QueryUser

func (c *DeviceClient) QueryUser(d *Device) *UserQuery

QueryUser queries the user edge of a Device.

func (*DeviceClient) Update

func (c *DeviceClient) Update() *DeviceUpdate

Update returns an update builder for Device.

func (*DeviceClient) UpdateOne

func (c *DeviceClient) UpdateOne(d *Device) *DeviceUpdateOne

UpdateOne returns an update builder for the given entity.

func (*DeviceClient) UpdateOneID

func (c *DeviceClient) UpdateOneID(id int) *DeviceUpdateOne

UpdateOneID returns an update builder for the given id.

func (*DeviceClient) Use

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

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

type DeviceCreate

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

DeviceCreate is the builder for creating a Device entity.

func (*DeviceCreate) Exec

func (dc *DeviceCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*DeviceCreate) ExecX

func (dc *DeviceCreate) ExecX(ctx context.Context)

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

func (*DeviceCreate) Mutation

func (dc *DeviceCreate) Mutation() *DeviceMutation

Mutation returns the DeviceMutation object of the builder.

func (*DeviceCreate) OnConflict

func (dc *DeviceCreate) OnConflict(opts ...sql.ConflictOption) *DeviceUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Device.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DeviceUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*DeviceCreate) OnConflictColumns

func (dc *DeviceCreate) OnConflictColumns(columns ...string) *DeviceUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Device.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DeviceCreate) Save

func (dc *DeviceCreate) Save(ctx context.Context) (*Device, error)

Save creates the Device in the database.

func (*DeviceCreate) SaveX

func (dc *DeviceCreate) SaveX(ctx context.Context) *Device

SaveX calls Save and panics if Save returns an error.

func (*DeviceCreate) SetChannel

func (dc *DeviceCreate) SetChannel(e enum.Sender) *DeviceCreate

SetChannel sets the "channel" field.

func (*DeviceCreate) SetChannelMeta

func (dc *DeviceCreate) SetChannelMeta(s string) *DeviceCreate

SetChannelMeta sets the "channelMeta" field.

func (*DeviceCreate) SetChannelToken

func (dc *DeviceCreate) SetChannelToken(s string) *DeviceCreate

SetChannelToken sets the "channelToken" field.

func (*DeviceCreate) SetCreatedAt

func (dc *DeviceCreate) SetCreatedAt(t time.Time) *DeviceCreate

SetCreatedAt sets the "created_at" field.

func (*DeviceCreate) SetDeviceMeta

func (dc *DeviceCreate) SetDeviceMeta(s string) *DeviceCreate

SetDeviceMeta sets the "deviceMeta" field.

func (*DeviceCreate) SetDeviceName

func (dc *DeviceCreate) SetDeviceName(s string) *DeviceCreate

SetDeviceName sets the "deviceName" field.

func (*DeviceCreate) SetIdentifier

func (dc *DeviceCreate) SetIdentifier(s string) *DeviceCreate

SetIdentifier sets the "identifier" field.

func (*DeviceCreate) SetNillableCreatedAt

func (dc *DeviceCreate) SetNillableCreatedAt(t *time.Time) *DeviceCreate

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

func (*DeviceCreate) SetNillableUpdatedAt

func (dc *DeviceCreate) SetNillableUpdatedAt(t *time.Time) *DeviceCreate

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*DeviceCreate) SetUpdatedAt

func (dc *DeviceCreate) SetUpdatedAt(t time.Time) *DeviceCreate

SetUpdatedAt sets the "updated_at" field.

func (*DeviceCreate) SetUser

func (dc *DeviceCreate) SetUser(u *User) *DeviceCreate

SetUser sets the "user" edge to the User entity.

func (*DeviceCreate) SetUserID

func (dc *DeviceCreate) SetUserID(id int) *DeviceCreate

SetUserID sets the "user" edge to the User entity by ID.

type DeviceCreateBulk

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

DeviceCreateBulk is the builder for creating many Device entities in bulk.

func (*DeviceCreateBulk) Exec

func (dcb *DeviceCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DeviceCreateBulk) ExecX

func (dcb *DeviceCreateBulk) ExecX(ctx context.Context)

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

func (*DeviceCreateBulk) OnConflict

func (dcb *DeviceCreateBulk) OnConflict(opts ...sql.ConflictOption) *DeviceUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Device.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.DeviceUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*DeviceCreateBulk) OnConflictColumns

func (dcb *DeviceCreateBulk) OnConflictColumns(columns ...string) *DeviceUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Device.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*DeviceCreateBulk) Save

func (dcb *DeviceCreateBulk) Save(ctx context.Context) ([]*Device, error)

Save creates the Device entities in the database.

func (*DeviceCreateBulk) SaveX

func (dcb *DeviceCreateBulk) SaveX(ctx context.Context) []*Device

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

type DeviceDelete

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

DeviceDelete is the builder for deleting a Device entity.

func (*DeviceDelete) Exec

func (dd *DeviceDelete) Exec(ctx context.Context) (int, error)

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

func (*DeviceDelete) ExecX

func (dd *DeviceDelete) ExecX(ctx context.Context) int

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

func (*DeviceDelete) Where

func (dd *DeviceDelete) Where(ps ...predicate.Device) *DeviceDelete

Where appends a list predicates to the DeviceDelete builder.

type DeviceDeleteOne

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

DeviceDeleteOne is the builder for deleting a single Device entity.

func (*DeviceDeleteOne) Exec

func (ddo *DeviceDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*DeviceDeleteOne) ExecX

func (ddo *DeviceDeleteOne) ExecX(ctx context.Context)

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

func (*DeviceDeleteOne) Where

func (ddo *DeviceDeleteOne) Where(ps ...predicate.Device) *DeviceDeleteOne

Where appends a list predicates to the DeviceDelete builder.

type DeviceEdges

type DeviceEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

DeviceEdges holds the relations/edges for other nodes in the graph.

func (DeviceEdges) UserOrErr

func (e DeviceEdges) UserOrErr() (*User, error)

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type DeviceGroupBy

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

DeviceGroupBy is the group-by builder for Device entities.

func (*DeviceGroupBy) Aggregate

func (dgb *DeviceGroupBy) Aggregate(fns ...AggregateFunc) *DeviceGroupBy

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

func (*DeviceGroupBy) Bool

func (s *DeviceGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*DeviceGroupBy) BoolX

func (s *DeviceGroupBy) BoolX(ctx context.Context) bool

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

func (*DeviceGroupBy) Bools

func (s *DeviceGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*DeviceGroupBy) BoolsX

func (s *DeviceGroupBy) BoolsX(ctx context.Context) []bool

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

func (*DeviceGroupBy) Float64

func (s *DeviceGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*DeviceGroupBy) Float64X

func (s *DeviceGroupBy) Float64X(ctx context.Context) float64

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

func (*DeviceGroupBy) Float64s

func (s *DeviceGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*DeviceGroupBy) Float64sX

func (s *DeviceGroupBy) Float64sX(ctx context.Context) []float64

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

func (*DeviceGroupBy) Int

func (s *DeviceGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*DeviceGroupBy) IntX

func (s *DeviceGroupBy) IntX(ctx context.Context) int

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

func (*DeviceGroupBy) Ints

func (s *DeviceGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*DeviceGroupBy) IntsX

func (s *DeviceGroupBy) IntsX(ctx context.Context) []int

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

func (*DeviceGroupBy) Scan

func (dgb *DeviceGroupBy) Scan(ctx context.Context, v any) error

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

func (*DeviceGroupBy) ScanX

func (s *DeviceGroupBy) ScanX(ctx context.Context, v any)

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

func (*DeviceGroupBy) String

func (s *DeviceGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*DeviceGroupBy) StringX

func (s *DeviceGroupBy) StringX(ctx context.Context) string

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

func (*DeviceGroupBy) Strings

func (s *DeviceGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*DeviceGroupBy) StringsX

func (s *DeviceGroupBy) StringsX(ctx context.Context) []string

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

type DeviceMutation

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

DeviceMutation represents an operation that mutates the Device nodes in the graph.

func (*DeviceMutation) AddField

func (m *DeviceMutation) 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 (*DeviceMutation) AddedEdges

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

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

func (*DeviceMutation) AddedField

func (m *DeviceMutation) 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 (*DeviceMutation) AddedFields

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

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

func (*DeviceMutation) AddedIDs

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

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

func (*DeviceMutation) Channel

func (m *DeviceMutation) Channel() (r enum.Sender, exists bool)

Channel returns the value of the "channel" field in the mutation.

func (*DeviceMutation) ChannelMeta

func (m *DeviceMutation) ChannelMeta() (r string, exists bool)

ChannelMeta returns the value of the "channelMeta" field in the mutation.

func (*DeviceMutation) ChannelToken

func (m *DeviceMutation) ChannelToken() (r string, exists bool)

ChannelToken returns the value of the "channelToken" field in the mutation.

func (*DeviceMutation) ClearEdge

func (m *DeviceMutation) 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 (*DeviceMutation) ClearField

func (m *DeviceMutation) 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 (*DeviceMutation) ClearUser

func (m *DeviceMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*DeviceMutation) ClearedEdges

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

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

func (*DeviceMutation) ClearedFields

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

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

func (DeviceMutation) Client

func (m DeviceMutation) 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 (*DeviceMutation) CreatedAt

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

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

func (*DeviceMutation) DeviceMeta

func (m *DeviceMutation) DeviceMeta() (r string, exists bool)

DeviceMeta returns the value of the "deviceMeta" field in the mutation.

func (*DeviceMutation) DeviceName

func (m *DeviceMutation) DeviceName() (r string, exists bool)

DeviceName returns the value of the "deviceName" field in the mutation.

func (*DeviceMutation) EdgeCleared

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

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

func (*DeviceMutation) Field

func (m *DeviceMutation) 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 (*DeviceMutation) FieldCleared

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

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

func (*DeviceMutation) Fields

func (m *DeviceMutation) 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 (*DeviceMutation) ID

func (m *DeviceMutation) 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 (*DeviceMutation) IDs

func (m *DeviceMutation) IDs(ctx context.Context) ([]int, 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 (*DeviceMutation) Identifier

func (m *DeviceMutation) Identifier() (r string, exists bool)

Identifier returns the value of the "identifier" field in the mutation.

func (*DeviceMutation) OldChannel

func (m *DeviceMutation) OldChannel(ctx context.Context) (v enum.Sender, err error)

OldChannel returns the old "channel" field's value of the Device entity. If the Device 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 (*DeviceMutation) OldChannelMeta

func (m *DeviceMutation) OldChannelMeta(ctx context.Context) (v string, err error)

OldChannelMeta returns the old "channelMeta" field's value of the Device entity. If the Device 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 (*DeviceMutation) OldChannelToken

func (m *DeviceMutation) OldChannelToken(ctx context.Context) (v string, err error)

OldChannelToken returns the old "channelToken" field's value of the Device entity. If the Device 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 (*DeviceMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the Device entity. If the Device 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 (*DeviceMutation) OldDeviceMeta

func (m *DeviceMutation) OldDeviceMeta(ctx context.Context) (v string, err error)

OldDeviceMeta returns the old "deviceMeta" field's value of the Device entity. If the Device 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 (*DeviceMutation) OldDeviceName

func (m *DeviceMutation) OldDeviceName(ctx context.Context) (v string, err error)

OldDeviceName returns the old "deviceName" field's value of the Device entity. If the Device 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 (*DeviceMutation) OldField

func (m *DeviceMutation) 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 (*DeviceMutation) OldIdentifier

func (m *DeviceMutation) OldIdentifier(ctx context.Context) (v string, err error)

OldIdentifier returns the old "identifier" field's value of the Device entity. If the Device 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 (*DeviceMutation) OldUpdatedAt

func (m *DeviceMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error)

OldUpdatedAt returns the old "updated_at" field's value of the Device entity. If the Device 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 (*DeviceMutation) Op

func (m *DeviceMutation) Op() Op

Op returns the operation name.

func (*DeviceMutation) RemovedEdges

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

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

func (*DeviceMutation) RemovedIDs

func (m *DeviceMutation) 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 (*DeviceMutation) ResetChannel

func (m *DeviceMutation) ResetChannel()

ResetChannel resets all changes to the "channel" field.

func (*DeviceMutation) ResetChannelMeta

func (m *DeviceMutation) ResetChannelMeta()

ResetChannelMeta resets all changes to the "channelMeta" field.

func (*DeviceMutation) ResetChannelToken

func (m *DeviceMutation) ResetChannelToken()

ResetChannelToken resets all changes to the "channelToken" field.

func (*DeviceMutation) ResetCreatedAt

func (m *DeviceMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DeviceMutation) ResetDeviceMeta

func (m *DeviceMutation) ResetDeviceMeta()

ResetDeviceMeta resets all changes to the "deviceMeta" field.

func (*DeviceMutation) ResetDeviceName

func (m *DeviceMutation) ResetDeviceName()

ResetDeviceName resets all changes to the "deviceName" field.

func (*DeviceMutation) ResetEdge

func (m *DeviceMutation) 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 (*DeviceMutation) ResetField

func (m *DeviceMutation) 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 (*DeviceMutation) ResetIdentifier

func (m *DeviceMutation) ResetIdentifier()

ResetIdentifier resets all changes to the "identifier" field.

func (*DeviceMutation) ResetUpdatedAt

func (m *DeviceMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DeviceMutation) ResetUser

func (m *DeviceMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*DeviceMutation) SetChannel

func (m *DeviceMutation) SetChannel(e enum.Sender)

SetChannel sets the "channel" field.

func (*DeviceMutation) SetChannelMeta

func (m *DeviceMutation) SetChannelMeta(s string)

SetChannelMeta sets the "channelMeta" field.

func (*DeviceMutation) SetChannelToken

func (m *DeviceMutation) SetChannelToken(s string)

SetChannelToken sets the "channelToken" field.

func (*DeviceMutation) SetCreatedAt

func (m *DeviceMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*DeviceMutation) SetDeviceMeta

func (m *DeviceMutation) SetDeviceMeta(s string)

SetDeviceMeta sets the "deviceMeta" field.

func (*DeviceMutation) SetDeviceName

func (m *DeviceMutation) SetDeviceName(s string)

SetDeviceName sets the "deviceName" field.

func (*DeviceMutation) SetField

func (m *DeviceMutation) 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 (*DeviceMutation) SetIdentifier

func (m *DeviceMutation) SetIdentifier(s string)

SetIdentifier sets the "identifier" field.

func (*DeviceMutation) SetOp

func (m *DeviceMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*DeviceMutation) SetUpdatedAt

func (m *DeviceMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

func (*DeviceMutation) SetUserID

func (m *DeviceMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (DeviceMutation) Tx

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

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

func (*DeviceMutation) Type

func (m *DeviceMutation) Type() string

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

func (*DeviceMutation) UpdatedAt

func (m *DeviceMutation) UpdatedAt() (r time.Time, exists bool)

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*DeviceMutation) UserCleared

func (m *DeviceMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*DeviceMutation) UserID

func (m *DeviceMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*DeviceMutation) UserIDs

func (m *DeviceMutation) UserIDs() (ids []int)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*DeviceMutation) Where

func (m *DeviceMutation) Where(ps ...predicate.Device)

Where appends a list predicates to the DeviceMutation builder.

func (*DeviceMutation) WhereP

func (m *DeviceMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the DeviceMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type DeviceQuery

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

DeviceQuery is the builder for querying Device entities.

func (*DeviceQuery) Aggregate

func (dq *DeviceQuery) Aggregate(fns ...AggregateFunc) *DeviceSelect

Aggregate returns a DeviceSelect configured with the given aggregations.

func (*DeviceQuery) All

func (dq *DeviceQuery) All(ctx context.Context) ([]*Device, error)

All executes the query and returns a list of Devices.

func (*DeviceQuery) AllX

func (dq *DeviceQuery) AllX(ctx context.Context) []*Device

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

func (*DeviceQuery) Clone

func (dq *DeviceQuery) Clone() *DeviceQuery

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

func (*DeviceQuery) Count

func (dq *DeviceQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*DeviceQuery) CountX

func (dq *DeviceQuery) CountX(ctx context.Context) int

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

func (*DeviceQuery) Exist

func (dq *DeviceQuery) Exist(ctx context.Context) (bool, error)

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

func (*DeviceQuery) ExistX

func (dq *DeviceQuery) ExistX(ctx context.Context) bool

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

func (*DeviceQuery) First

func (dq *DeviceQuery) First(ctx context.Context) (*Device, error)

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

func (*DeviceQuery) FirstID

func (dq *DeviceQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*DeviceQuery) FirstIDX

func (dq *DeviceQuery) FirstIDX(ctx context.Context) int

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

func (*DeviceQuery) FirstX

func (dq *DeviceQuery) FirstX(ctx context.Context) *Device

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

func (*DeviceQuery) GroupBy

func (dq *DeviceQuery) GroupBy(field string, fields ...string) *DeviceGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Device.Query().
	GroupBy(device.FieldCreatedAt).
	Aggregate(generate.Count()).
	Scan(ctx, &v)

func (*DeviceQuery) IDs

func (dq *DeviceQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*DeviceQuery) IDsX

func (dq *DeviceQuery) IDsX(ctx context.Context) []int

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

func (*DeviceQuery) Limit

func (dq *DeviceQuery) Limit(limit int) *DeviceQuery

Limit the number of records to be returned by this query.

func (*DeviceQuery) Offset

func (dq *DeviceQuery) Offset(offset int) *DeviceQuery

Offset to start from.

func (*DeviceQuery) Only

func (dq *DeviceQuery) Only(ctx context.Context) (*Device, error)

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

func (*DeviceQuery) OnlyID

func (dq *DeviceQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*DeviceQuery) OnlyIDX

func (dq *DeviceQuery) OnlyIDX(ctx context.Context) int

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

func (*DeviceQuery) OnlyX

func (dq *DeviceQuery) OnlyX(ctx context.Context) *Device

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

func (*DeviceQuery) Order

func (dq *DeviceQuery) Order(o ...OrderFunc) *DeviceQuery

Order specifies how the records should be ordered.

func (*DeviceQuery) QueryUser

func (dq *DeviceQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*DeviceQuery) Select

func (dq *DeviceQuery) Select(fields ...string) *DeviceSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Device.Query().
	Select(device.FieldCreatedAt).
	Scan(ctx, &v)

func (*DeviceQuery) Unique

func (dq *DeviceQuery) Unique(unique bool) *DeviceQuery

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 (*DeviceQuery) Where

func (dq *DeviceQuery) Where(ps ...predicate.Device) *DeviceQuery

Where adds a new predicate for the DeviceQuery builder.

func (*DeviceQuery) WithUser

func (dq *DeviceQuery) WithUser(opts ...func(*UserQuery)) *DeviceQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type DeviceSelect

type DeviceSelect struct {
	*DeviceQuery
	// contains filtered or unexported fields
}

DeviceSelect is the builder for selecting fields of Device entities.

func (*DeviceSelect) Aggregate

func (ds *DeviceSelect) Aggregate(fns ...AggregateFunc) *DeviceSelect

Aggregate adds the given aggregation functions to the selector query.

func (*DeviceSelect) Bool

func (s *DeviceSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*DeviceSelect) BoolX

func (s *DeviceSelect) BoolX(ctx context.Context) bool

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

func (*DeviceSelect) Bools

func (s *DeviceSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*DeviceSelect) BoolsX

func (s *DeviceSelect) BoolsX(ctx context.Context) []bool

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

func (*DeviceSelect) Float64

func (s *DeviceSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*DeviceSelect) Float64X

func (s *DeviceSelect) Float64X(ctx context.Context) float64

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

func (*DeviceSelect) Float64s

func (s *DeviceSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*DeviceSelect) Float64sX

func (s *DeviceSelect) Float64sX(ctx context.Context) []float64

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

func (*DeviceSelect) Int

func (s *DeviceSelect) Int(ctx context.Context) (_ int, err error)

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

func (*DeviceSelect) IntX

func (s *DeviceSelect) IntX(ctx context.Context) int

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

func (*DeviceSelect) Ints

func (s *DeviceSelect) Ints(ctx context.Context) ([]int, error)

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

func (*DeviceSelect) IntsX

func (s *DeviceSelect) IntsX(ctx context.Context) []int

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

func (*DeviceSelect) Scan

func (ds *DeviceSelect) Scan(ctx context.Context, v any) error

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

func (*DeviceSelect) ScanX

func (s *DeviceSelect) ScanX(ctx context.Context, v any)

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

func (*DeviceSelect) String

func (s *DeviceSelect) String(ctx context.Context) (_ string, err error)

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

func (*DeviceSelect) StringX

func (s *DeviceSelect) StringX(ctx context.Context) string

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

func (*DeviceSelect) Strings

func (s *DeviceSelect) Strings(ctx context.Context) ([]string, error)

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

func (*DeviceSelect) StringsX

func (s *DeviceSelect) StringsX(ctx context.Context) []string

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

type DeviceUpdate

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

DeviceUpdate is the builder for updating Device entities.

func (*DeviceUpdate) ClearUser

func (du *DeviceUpdate) ClearUser() *DeviceUpdate

ClearUser clears the "user" edge to the User entity.

func (*DeviceUpdate) Exec

func (du *DeviceUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*DeviceUpdate) ExecX

func (du *DeviceUpdate) ExecX(ctx context.Context)

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

func (*DeviceUpdate) Mutation

func (du *DeviceUpdate) Mutation() *DeviceMutation

Mutation returns the DeviceMutation object of the builder.

func (*DeviceUpdate) Save

func (du *DeviceUpdate) Save(ctx context.Context) (int, error)

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

func (*DeviceUpdate) SaveX

func (du *DeviceUpdate) SaveX(ctx context.Context) int

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

func (*DeviceUpdate) SetChannel

func (du *DeviceUpdate) SetChannel(e enum.Sender) *DeviceUpdate

SetChannel sets the "channel" field.

func (*DeviceUpdate) SetChannelMeta

func (du *DeviceUpdate) SetChannelMeta(s string) *DeviceUpdate

SetChannelMeta sets the "channelMeta" field.

func (*DeviceUpdate) SetChannelToken

func (du *DeviceUpdate) SetChannelToken(s string) *DeviceUpdate

SetChannelToken sets the "channelToken" field.

func (*DeviceUpdate) SetDeviceMeta

func (du *DeviceUpdate) SetDeviceMeta(s string) *DeviceUpdate

SetDeviceMeta sets the "deviceMeta" field.

func (*DeviceUpdate) SetDeviceName

func (du *DeviceUpdate) SetDeviceName(s string) *DeviceUpdate

SetDeviceName sets the "deviceName" field.

func (*DeviceUpdate) SetIdentifier

func (du *DeviceUpdate) SetIdentifier(s string) *DeviceUpdate

SetIdentifier sets the "identifier" field.

func (*DeviceUpdate) SetUpdatedAt

func (du *DeviceUpdate) SetUpdatedAt(t time.Time) *DeviceUpdate

SetUpdatedAt sets the "updated_at" field.

func (*DeviceUpdate) SetUser

func (du *DeviceUpdate) SetUser(u *User) *DeviceUpdate

SetUser sets the "user" edge to the User entity.

func (*DeviceUpdate) SetUserID

func (du *DeviceUpdate) SetUserID(id int) *DeviceUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*DeviceUpdate) Where

func (du *DeviceUpdate) Where(ps ...predicate.Device) *DeviceUpdate

Where appends a list predicates to the DeviceUpdate builder.

type DeviceUpdateOne

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

DeviceUpdateOne is the builder for updating a single Device entity.

func (*DeviceUpdateOne) ClearUser

func (duo *DeviceUpdateOne) ClearUser() *DeviceUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*DeviceUpdateOne) Exec

func (duo *DeviceUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*DeviceUpdateOne) ExecX

func (duo *DeviceUpdateOne) ExecX(ctx context.Context)

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

func (*DeviceUpdateOne) Mutation

func (duo *DeviceUpdateOne) Mutation() *DeviceMutation

Mutation returns the DeviceMutation object of the builder.

func (*DeviceUpdateOne) Save

func (duo *DeviceUpdateOne) Save(ctx context.Context) (*Device, error)

Save executes the query and returns the updated Device entity.

func (*DeviceUpdateOne) SaveX

func (duo *DeviceUpdateOne) SaveX(ctx context.Context) *Device

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

func (*DeviceUpdateOne) Select

func (duo *DeviceUpdateOne) Select(field string, fields ...string) *DeviceUpdateOne

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

func (*DeviceUpdateOne) SetChannel

func (duo *DeviceUpdateOne) SetChannel(e enum.Sender) *DeviceUpdateOne

SetChannel sets the "channel" field.

func (*DeviceUpdateOne) SetChannelMeta

func (duo *DeviceUpdateOne) SetChannelMeta(s string) *DeviceUpdateOne

SetChannelMeta sets the "channelMeta" field.

func (*DeviceUpdateOne) SetChannelToken

func (duo *DeviceUpdateOne) SetChannelToken(s string) *DeviceUpdateOne

SetChannelToken sets the "channelToken" field.

func (*DeviceUpdateOne) SetDeviceMeta

func (duo *DeviceUpdateOne) SetDeviceMeta(s string) *DeviceUpdateOne

SetDeviceMeta sets the "deviceMeta" field.

func (*DeviceUpdateOne) SetDeviceName

func (duo *DeviceUpdateOne) SetDeviceName(s string) *DeviceUpdateOne

SetDeviceName sets the "deviceName" field.

func (*DeviceUpdateOne) SetIdentifier

func (duo *DeviceUpdateOne) SetIdentifier(s string) *DeviceUpdateOne

SetIdentifier sets the "identifier" field.

func (*DeviceUpdateOne) SetUpdatedAt

func (duo *DeviceUpdateOne) SetUpdatedAt(t time.Time) *DeviceUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*DeviceUpdateOne) SetUser

func (duo *DeviceUpdateOne) SetUser(u *User) *DeviceUpdateOne

SetUser sets the "user" edge to the User entity.

func (*DeviceUpdateOne) SetUserID

func (duo *DeviceUpdateOne) SetUserID(id int) *DeviceUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*DeviceUpdateOne) Where

func (duo *DeviceUpdateOne) Where(ps ...predicate.Device) *DeviceUpdateOne

Where appends a list predicates to the DeviceUpdate builder.

type DeviceUpsert

type DeviceUpsert struct {
	*sql.UpdateSet
}

DeviceUpsert is the "OnConflict" setter.

func (*DeviceUpsert) SetChannel

func (u *DeviceUpsert) SetChannel(v enum.Sender) *DeviceUpsert

SetChannel sets the "channel" field.

func (*DeviceUpsert) SetChannelMeta

func (u *DeviceUpsert) SetChannelMeta(v string) *DeviceUpsert

SetChannelMeta sets the "channelMeta" field.

func (*DeviceUpsert) SetChannelToken

func (u *DeviceUpsert) SetChannelToken(v string) *DeviceUpsert

SetChannelToken sets the "channelToken" field.

func (*DeviceUpsert) SetDeviceMeta

func (u *DeviceUpsert) SetDeviceMeta(v string) *DeviceUpsert

SetDeviceMeta sets the "deviceMeta" field.

func (*DeviceUpsert) SetDeviceName

func (u *DeviceUpsert) SetDeviceName(v string) *DeviceUpsert

SetDeviceName sets the "deviceName" field.

func (*DeviceUpsert) SetIdentifier

func (u *DeviceUpsert) SetIdentifier(v string) *DeviceUpsert

SetIdentifier sets the "identifier" field.

func (*DeviceUpsert) SetUpdatedAt

func (u *DeviceUpsert) SetUpdatedAt(v time.Time) *DeviceUpsert

SetUpdatedAt sets the "updated_at" field.

func (*DeviceUpsert) UpdateChannel

func (u *DeviceUpsert) UpdateChannel() *DeviceUpsert

UpdateChannel sets the "channel" field to the value that was provided on create.

func (*DeviceUpsert) UpdateChannelMeta

func (u *DeviceUpsert) UpdateChannelMeta() *DeviceUpsert

UpdateChannelMeta sets the "channelMeta" field to the value that was provided on create.

func (*DeviceUpsert) UpdateChannelToken

func (u *DeviceUpsert) UpdateChannelToken() *DeviceUpsert

UpdateChannelToken sets the "channelToken" field to the value that was provided on create.

func (*DeviceUpsert) UpdateDeviceMeta

func (u *DeviceUpsert) UpdateDeviceMeta() *DeviceUpsert

UpdateDeviceMeta sets the "deviceMeta" field to the value that was provided on create.

func (*DeviceUpsert) UpdateDeviceName

func (u *DeviceUpsert) UpdateDeviceName() *DeviceUpsert

UpdateDeviceName sets the "deviceName" field to the value that was provided on create.

func (*DeviceUpsert) UpdateIdentifier

func (u *DeviceUpsert) UpdateIdentifier() *DeviceUpsert

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*DeviceUpsert) UpdateUpdatedAt

func (u *DeviceUpsert) UpdateUpdatedAt() *DeviceUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type DeviceUpsertBulk

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

DeviceUpsertBulk is the builder for "upsert"-ing a bulk of Device nodes.

func (*DeviceUpsertBulk) DoNothing

func (u *DeviceUpsertBulk) DoNothing() *DeviceUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DeviceUpsertBulk) Exec

func (u *DeviceUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*DeviceUpsertBulk) ExecX

func (u *DeviceUpsertBulk) ExecX(ctx context.Context)

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

func (*DeviceUpsertBulk) Ignore

func (u *DeviceUpsertBulk) Ignore() *DeviceUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Device.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*DeviceUpsertBulk) SetChannel

func (u *DeviceUpsertBulk) SetChannel(v enum.Sender) *DeviceUpsertBulk

SetChannel sets the "channel" field.

func (*DeviceUpsertBulk) SetChannelMeta

func (u *DeviceUpsertBulk) SetChannelMeta(v string) *DeviceUpsertBulk

SetChannelMeta sets the "channelMeta" field.

func (*DeviceUpsertBulk) SetChannelToken

func (u *DeviceUpsertBulk) SetChannelToken(v string) *DeviceUpsertBulk

SetChannelToken sets the "channelToken" field.

func (*DeviceUpsertBulk) SetDeviceMeta

func (u *DeviceUpsertBulk) SetDeviceMeta(v string) *DeviceUpsertBulk

SetDeviceMeta sets the "deviceMeta" field.

func (*DeviceUpsertBulk) SetDeviceName

func (u *DeviceUpsertBulk) SetDeviceName(v string) *DeviceUpsertBulk

SetDeviceName sets the "deviceName" field.

func (*DeviceUpsertBulk) SetIdentifier

func (u *DeviceUpsertBulk) SetIdentifier(v string) *DeviceUpsertBulk

SetIdentifier sets the "identifier" field.

func (*DeviceUpsertBulk) SetUpdatedAt

func (u *DeviceUpsertBulk) SetUpdatedAt(v time.Time) *DeviceUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*DeviceUpsertBulk) Update

func (u *DeviceUpsertBulk) Update(set func(*DeviceUpsert)) *DeviceUpsertBulk

Update allows overriding fields `UPDATE` values. See the DeviceCreateBulk.OnConflict documentation for more info.

func (*DeviceUpsertBulk) UpdateChannel

func (u *DeviceUpsertBulk) UpdateChannel() *DeviceUpsertBulk

UpdateChannel sets the "channel" field to the value that was provided on create.

func (*DeviceUpsertBulk) UpdateChannelMeta

func (u *DeviceUpsertBulk) UpdateChannelMeta() *DeviceUpsertBulk

UpdateChannelMeta sets the "channelMeta" field to the value that was provided on create.

func (*DeviceUpsertBulk) UpdateChannelToken

func (u *DeviceUpsertBulk) UpdateChannelToken() *DeviceUpsertBulk

UpdateChannelToken sets the "channelToken" field to the value that was provided on create.

func (*DeviceUpsertBulk) UpdateDeviceMeta

func (u *DeviceUpsertBulk) UpdateDeviceMeta() *DeviceUpsertBulk

UpdateDeviceMeta sets the "deviceMeta" field to the value that was provided on create.

func (*DeviceUpsertBulk) UpdateDeviceName

func (u *DeviceUpsertBulk) UpdateDeviceName() *DeviceUpsertBulk

UpdateDeviceName sets the "deviceName" field to the value that was provided on create.

func (*DeviceUpsertBulk) UpdateIdentifier

func (u *DeviceUpsertBulk) UpdateIdentifier() *DeviceUpsertBulk

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*DeviceUpsertBulk) UpdateNewValues

func (u *DeviceUpsertBulk) UpdateNewValues() *DeviceUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Device.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*DeviceUpsertBulk) UpdateUpdatedAt

func (u *DeviceUpsertBulk) UpdateUpdatedAt() *DeviceUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type DeviceUpsertOne

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

DeviceUpsertOne is the builder for "upsert"-ing

one Device node.

func (*DeviceUpsertOne) DoNothing

func (u *DeviceUpsertOne) DoNothing() *DeviceUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*DeviceUpsertOne) Exec

func (u *DeviceUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*DeviceUpsertOne) ExecX

func (u *DeviceUpsertOne) ExecX(ctx context.Context)

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

func (*DeviceUpsertOne) ID

func (u *DeviceUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*DeviceUpsertOne) IDX

func (u *DeviceUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*DeviceUpsertOne) Ignore

func (u *DeviceUpsertOne) Ignore() *DeviceUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Device.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*DeviceUpsertOne) SetChannel

func (u *DeviceUpsertOne) SetChannel(v enum.Sender) *DeviceUpsertOne

SetChannel sets the "channel" field.

func (*DeviceUpsertOne) SetChannelMeta

func (u *DeviceUpsertOne) SetChannelMeta(v string) *DeviceUpsertOne

SetChannelMeta sets the "channelMeta" field.

func (*DeviceUpsertOne) SetChannelToken

func (u *DeviceUpsertOne) SetChannelToken(v string) *DeviceUpsertOne

SetChannelToken sets the "channelToken" field.

func (*DeviceUpsertOne) SetDeviceMeta

func (u *DeviceUpsertOne) SetDeviceMeta(v string) *DeviceUpsertOne

SetDeviceMeta sets the "deviceMeta" field.

func (*DeviceUpsertOne) SetDeviceName

func (u *DeviceUpsertOne) SetDeviceName(v string) *DeviceUpsertOne

SetDeviceName sets the "deviceName" field.

func (*DeviceUpsertOne) SetIdentifier

func (u *DeviceUpsertOne) SetIdentifier(v string) *DeviceUpsertOne

SetIdentifier sets the "identifier" field.

func (*DeviceUpsertOne) SetUpdatedAt

func (u *DeviceUpsertOne) SetUpdatedAt(v time.Time) *DeviceUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*DeviceUpsertOne) Update

func (u *DeviceUpsertOne) Update(set func(*DeviceUpsert)) *DeviceUpsertOne

Update allows overriding fields `UPDATE` values. See the DeviceCreate.OnConflict documentation for more info.

func (*DeviceUpsertOne) UpdateChannel

func (u *DeviceUpsertOne) UpdateChannel() *DeviceUpsertOne

UpdateChannel sets the "channel" field to the value that was provided on create.

func (*DeviceUpsertOne) UpdateChannelMeta

func (u *DeviceUpsertOne) UpdateChannelMeta() *DeviceUpsertOne

UpdateChannelMeta sets the "channelMeta" field to the value that was provided on create.

func (*DeviceUpsertOne) UpdateChannelToken

func (u *DeviceUpsertOne) UpdateChannelToken() *DeviceUpsertOne

UpdateChannelToken sets the "channelToken" field to the value that was provided on create.

func (*DeviceUpsertOne) UpdateDeviceMeta

func (u *DeviceUpsertOne) UpdateDeviceMeta() *DeviceUpsertOne

UpdateDeviceMeta sets the "deviceMeta" field to the value that was provided on create.

func (*DeviceUpsertOne) UpdateDeviceName

func (u *DeviceUpsertOne) UpdateDeviceName() *DeviceUpsertOne

UpdateDeviceName sets the "deviceName" field to the value that was provided on create.

func (*DeviceUpsertOne) UpdateIdentifier

func (u *DeviceUpsertOne) UpdateIdentifier() *DeviceUpsertOne

UpdateIdentifier sets the "identifier" field to the value that was provided on create.

func (*DeviceUpsertOne) UpdateNewValues

func (u *DeviceUpsertOne) UpdateNewValues() *DeviceUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Device.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*DeviceUpsertOne) UpdateUpdatedAt

func (u *DeviceUpsertOne) UpdateUpdatedAt() *DeviceUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type Devices

type Devices []*Device

Devices is a parsable slice of Device.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type Message

type Message struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Content holds the value of the "content" field.
	Content string `json:"content,omitempty"`
	// Long holds the value of the "long" field.
	Long string `json:"long,omitempty"`
	// Priority holds the value of the "priority" field.
	Priority enum.Priority `json:"priority,omitempty"`
	// SequenceID holds the value of the "sequenceID" field.
	SequenceID int `json:"sequenceID,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MessageQuery when eager-loading is set.
	Edges MessageEdges `json:"edges"`
	// contains filtered or unexported fields
}

Message is the model entity for the Message schema.

func (*Message) QueryUser

func (m *Message) QueryUser() *UserQuery

QueryUser queries the "user" edge of the Message entity.

func (*Message) String

func (m *Message) String() string

String implements the fmt.Stringer.

func (*Message) Unwrap

func (m *Message) Unwrap() *Message

Unwrap unwraps the Message 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 (*Message) Update

func (m *Message) Update() *MessageUpdateOne

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

type MessageClient

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

MessageClient is a client for the Message schema.

func NewMessageClient

func NewMessageClient(c config) *MessageClient

NewMessageClient returns a client for the Message from the given config.

func (*MessageClient) Create

func (c *MessageClient) Create() *MessageCreate

Create returns a builder for creating a Message entity.

func (*MessageClient) CreateBulk

func (c *MessageClient) CreateBulk(builders ...*MessageCreate) *MessageCreateBulk

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

func (*MessageClient) Delete

func (c *MessageClient) Delete() *MessageDelete

Delete returns a delete builder for Message.

func (*MessageClient) DeleteOne

func (c *MessageClient) DeleteOne(m *Message) *MessageDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*MessageClient) DeleteOneID

func (c *MessageClient) DeleteOneID(id uuid.UUID) *MessageDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*MessageClient) Get

func (c *MessageClient) Get(ctx context.Context, id uuid.UUID) (*Message, error)

Get returns a Message entity by its id.

func (*MessageClient) GetX

func (c *MessageClient) GetX(ctx context.Context, id uuid.UUID) *Message

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

func (*MessageClient) Hooks

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

Hooks returns the client hooks.

func (*MessageClient) Intercept

func (c *MessageClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `message.Intercept(f(g(h())))`.

func (*MessageClient) Interceptors

func (c *MessageClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*MessageClient) Query

func (c *MessageClient) Query() *MessageQuery

Query returns a query builder for Message.

func (*MessageClient) QueryUser

func (c *MessageClient) QueryUser(m *Message) *UserQuery

QueryUser queries the user edge of a Message.

func (*MessageClient) Update

func (c *MessageClient) Update() *MessageUpdate

Update returns an update builder for Message.

func (*MessageClient) UpdateOne

func (c *MessageClient) UpdateOne(m *Message) *MessageUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MessageClient) UpdateOneID

func (c *MessageClient) UpdateOneID(id uuid.UUID) *MessageUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MessageClient) Use

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

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

type MessageCreate

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

MessageCreate is the builder for creating a Message entity.

func (*MessageCreate) Exec

func (mc *MessageCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageCreate) ExecX

func (mc *MessageCreate) ExecX(ctx context.Context)

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

func (*MessageCreate) Mutation

func (mc *MessageCreate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageCreate) OnConflict

func (mc *MessageCreate) OnConflict(opts ...sql.ConflictOption) *MessageUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Message.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.MessageUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*MessageCreate) OnConflictColumns

func (mc *MessageCreate) OnConflictColumns(columns ...string) *MessageUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*MessageCreate) Save

func (mc *MessageCreate) Save(ctx context.Context) (*Message, error)

Save creates the Message in the database.

func (*MessageCreate) SaveX

func (mc *MessageCreate) SaveX(ctx context.Context) *Message

SaveX calls Save and panics if Save returns an error.

func (*MessageCreate) SetContent

func (mc *MessageCreate) SetContent(s string) *MessageCreate

SetContent sets the "content" field.

func (*MessageCreate) SetCreatedAt

func (mc *MessageCreate) SetCreatedAt(t time.Time) *MessageCreate

SetCreatedAt sets the "created_at" field.

func (*MessageCreate) SetID

func (mc *MessageCreate) SetID(u uuid.UUID) *MessageCreate

SetID sets the "id" field.

func (*MessageCreate) SetLong

func (mc *MessageCreate) SetLong(s string) *MessageCreate

SetLong sets the "long" field.

func (*MessageCreate) SetNillableCreatedAt

func (mc *MessageCreate) SetNillableCreatedAt(t *time.Time) *MessageCreate

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

func (*MessageCreate) SetPriority

func (mc *MessageCreate) SetPriority(e enum.Priority) *MessageCreate

SetPriority sets the "priority" field.

func (*MessageCreate) SetSequenceID

func (mc *MessageCreate) SetSequenceID(i int) *MessageCreate

SetSequenceID sets the "sequenceID" field.

func (*MessageCreate) SetTitle

func (mc *MessageCreate) SetTitle(s string) *MessageCreate

SetTitle sets the "title" field.

func (*MessageCreate) SetUser

func (mc *MessageCreate) SetUser(u *User) *MessageCreate

SetUser sets the "user" edge to the User entity.

func (*MessageCreate) SetUserID

func (mc *MessageCreate) SetUserID(id int) *MessageCreate

SetUserID sets the "user" edge to the User entity by ID.

type MessageCreateBulk

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

MessageCreateBulk is the builder for creating many Message entities in bulk.

func (*MessageCreateBulk) Exec

func (mcb *MessageCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageCreateBulk) ExecX

func (mcb *MessageCreateBulk) ExecX(ctx context.Context)

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

func (*MessageCreateBulk) OnConflict

func (mcb *MessageCreateBulk) OnConflict(opts ...sql.ConflictOption) *MessageUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.Message.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.MessageUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*MessageCreateBulk) OnConflictColumns

func (mcb *MessageCreateBulk) OnConflictColumns(columns ...string) *MessageUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

func (*MessageCreateBulk) Save

func (mcb *MessageCreateBulk) Save(ctx context.Context) ([]*Message, error)

Save creates the Message entities in the database.

func (*MessageCreateBulk) SaveX

func (mcb *MessageCreateBulk) SaveX(ctx context.Context) []*Message

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

type MessageDelete

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

MessageDelete is the builder for deleting a Message entity.

func (*MessageDelete) Exec

func (md *MessageDelete) Exec(ctx context.Context) (int, error)

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

func (*MessageDelete) ExecX

func (md *MessageDelete) ExecX(ctx context.Context) int

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

func (*MessageDelete) Where

func (md *MessageDelete) Where(ps ...predicate.Message) *MessageDelete

Where appends a list predicates to the MessageDelete builder.

type MessageDeleteOne

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

MessageDeleteOne is the builder for deleting a single Message entity.

func (*MessageDeleteOne) Exec

func (mdo *MessageDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*MessageDeleteOne) ExecX

func (mdo *MessageDeleteOne) ExecX(ctx context.Context)

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

func (*MessageDeleteOne) Where

Where appends a list predicates to the MessageDelete builder.

type MessageEdges

type MessageEdges struct {
	// User holds the value of the user edge.
	User *User `json:"user,omitempty"`
	// contains filtered or unexported fields
}

MessageEdges holds the relations/edges for other nodes in the graph.

func (MessageEdges) UserOrErr

func (e MessageEdges) UserOrErr() (*User, error)

UserOrErr returns the User value or an error if the edge was not loaded in eager-loading, or loaded but was not found.

type MessageGroupBy

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

MessageGroupBy is the group-by builder for Message entities.

func (*MessageGroupBy) Aggregate

func (mgb *MessageGroupBy) Aggregate(fns ...AggregateFunc) *MessageGroupBy

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

func (*MessageGroupBy) Bool

func (s *MessageGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*MessageGroupBy) BoolX

func (s *MessageGroupBy) BoolX(ctx context.Context) bool

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

func (*MessageGroupBy) Bools

func (s *MessageGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*MessageGroupBy) BoolsX

func (s *MessageGroupBy) BoolsX(ctx context.Context) []bool

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

func (*MessageGroupBy) Float64

func (s *MessageGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*MessageGroupBy) Float64X

func (s *MessageGroupBy) Float64X(ctx context.Context) float64

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

func (*MessageGroupBy) Float64s

func (s *MessageGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*MessageGroupBy) Float64sX

func (s *MessageGroupBy) Float64sX(ctx context.Context) []float64

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

func (*MessageGroupBy) Int

func (s *MessageGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*MessageGroupBy) IntX

func (s *MessageGroupBy) IntX(ctx context.Context) int

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

func (*MessageGroupBy) Ints

func (s *MessageGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*MessageGroupBy) IntsX

func (s *MessageGroupBy) IntsX(ctx context.Context) []int

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

func (*MessageGroupBy) Scan

func (mgb *MessageGroupBy) Scan(ctx context.Context, v any) error

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

func (*MessageGroupBy) ScanX

func (s *MessageGroupBy) ScanX(ctx context.Context, v any)

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

func (*MessageGroupBy) String

func (s *MessageGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*MessageGroupBy) StringX

func (s *MessageGroupBy) StringX(ctx context.Context) string

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

func (*MessageGroupBy) Strings

func (s *MessageGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*MessageGroupBy) StringsX

func (s *MessageGroupBy) StringsX(ctx context.Context) []string

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

type MessageMutation

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

MessageMutation represents an operation that mutates the Message nodes in the graph.

func (*MessageMutation) AddField

func (m *MessageMutation) 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 (*MessageMutation) AddSequenceID

func (m *MessageMutation) AddSequenceID(i int)

AddSequenceID adds i to the "sequenceID" field.

func (*MessageMutation) AddedEdges

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

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

func (*MessageMutation) AddedField

func (m *MessageMutation) 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 (*MessageMutation) AddedFields

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

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

func (*MessageMutation) AddedIDs

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

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

func (*MessageMutation) AddedSequenceID

func (m *MessageMutation) AddedSequenceID() (r int, exists bool)

AddedSequenceID returns the value that was added to the "sequenceID" field in this mutation.

func (*MessageMutation) ClearEdge

func (m *MessageMutation) 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 (*MessageMutation) ClearField

func (m *MessageMutation) 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 (*MessageMutation) ClearUser

func (m *MessageMutation) ClearUser()

ClearUser clears the "user" edge to the User entity.

func (*MessageMutation) ClearedEdges

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

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

func (*MessageMutation) ClearedFields

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

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

func (MessageMutation) Client

func (m MessageMutation) 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 (*MessageMutation) Content

func (m *MessageMutation) Content() (r string, exists bool)

Content returns the value of the "content" field in the mutation.

func (*MessageMutation) CreatedAt

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

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

func (*MessageMutation) EdgeCleared

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

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

func (*MessageMutation) Field

func (m *MessageMutation) 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 (*MessageMutation) FieldCleared

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

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

func (*MessageMutation) Fields

func (m *MessageMutation) 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 (*MessageMutation) ID

func (m *MessageMutation) 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 (*MessageMutation) IDs

func (m *MessageMutation) 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 (*MessageMutation) Long

func (m *MessageMutation) Long() (r string, exists bool)

Long returns the value of the "long" field in the mutation.

func (*MessageMutation) OldContent

func (m *MessageMutation) OldContent(ctx context.Context) (v string, err error)

OldContent returns the old "content" field's value of the Message entity. If the Message 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 (*MessageMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the Message entity. If the Message 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 (*MessageMutation) OldField

func (m *MessageMutation) 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 (*MessageMutation) OldLong

func (m *MessageMutation) OldLong(ctx context.Context) (v string, err error)

OldLong returns the old "long" field's value of the Message entity. If the Message 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 (*MessageMutation) OldPriority

func (m *MessageMutation) OldPriority(ctx context.Context) (v enum.Priority, err error)

OldPriority returns the old "priority" field's value of the Message entity. If the Message 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 (*MessageMutation) OldSequenceID

func (m *MessageMutation) OldSequenceID(ctx context.Context) (v int, err error)

OldSequenceID returns the old "sequenceID" field's value of the Message entity. If the Message 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 (*MessageMutation) OldTitle

func (m *MessageMutation) OldTitle(ctx context.Context) (v string, err error)

OldTitle returns the old "title" field's value of the Message entity. If the Message 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 (*MessageMutation) Op

func (m *MessageMutation) Op() Op

Op returns the operation name.

func (*MessageMutation) Priority

func (m *MessageMutation) Priority() (r enum.Priority, exists bool)

Priority returns the value of the "priority" field in the mutation.

func (*MessageMutation) RemovedEdges

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

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

func (*MessageMutation) RemovedIDs

func (m *MessageMutation) 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 (*MessageMutation) ResetContent

func (m *MessageMutation) ResetContent()

ResetContent resets all changes to the "content" field.

func (*MessageMutation) ResetCreatedAt

func (m *MessageMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*MessageMutation) ResetEdge

func (m *MessageMutation) 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 (*MessageMutation) ResetField

func (m *MessageMutation) 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 (*MessageMutation) ResetLong

func (m *MessageMutation) ResetLong()

ResetLong resets all changes to the "long" field.

func (*MessageMutation) ResetPriority

func (m *MessageMutation) ResetPriority()

ResetPriority resets all changes to the "priority" field.

func (*MessageMutation) ResetSequenceID

func (m *MessageMutation) ResetSequenceID()

ResetSequenceID resets all changes to the "sequenceID" field.

func (*MessageMutation) ResetTitle

func (m *MessageMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*MessageMutation) ResetUser

func (m *MessageMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*MessageMutation) SequenceID

func (m *MessageMutation) SequenceID() (r int, exists bool)

SequenceID returns the value of the "sequenceID" field in the mutation.

func (*MessageMutation) SetContent

func (m *MessageMutation) SetContent(s string)

SetContent sets the "content" field.

func (*MessageMutation) SetCreatedAt

func (m *MessageMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" field.

func (*MessageMutation) SetField

func (m *MessageMutation) 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 (*MessageMutation) SetID

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

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

func (*MessageMutation) SetLong

func (m *MessageMutation) SetLong(s string)

SetLong sets the "long" field.

func (*MessageMutation) SetOp

func (m *MessageMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*MessageMutation) SetPriority

func (m *MessageMutation) SetPriority(e enum.Priority)

SetPriority sets the "priority" field.

func (*MessageMutation) SetSequenceID

func (m *MessageMutation) SetSequenceID(i int)

SetSequenceID sets the "sequenceID" field.

func (*MessageMutation) SetTitle

func (m *MessageMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*MessageMutation) SetUserID

func (m *MessageMutation) SetUserID(id int)

SetUserID sets the "user" edge to the User entity by id.

func (*MessageMutation) Title

func (m *MessageMutation) Title() (r string, exists bool)

Title returns the value of the "title" field in the mutation.

func (MessageMutation) Tx

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

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

func (*MessageMutation) Type

func (m *MessageMutation) Type() string

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

func (*MessageMutation) UserCleared

func (m *MessageMutation) UserCleared() bool

UserCleared reports if the "user" edge to the User entity was cleared.

func (*MessageMutation) UserID

func (m *MessageMutation) UserID() (id int, exists bool)

UserID returns the "user" edge ID in the mutation.

func (*MessageMutation) UserIDs

func (m *MessageMutation) UserIDs() (ids []int)

UserIDs returns the "user" edge IDs in the mutation. Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use UserID instead. It exists only for internal usage by the builders.

func (*MessageMutation) Where

func (m *MessageMutation) Where(ps ...predicate.Message)

Where appends a list predicates to the MessageMutation builder.

func (*MessageMutation) WhereP

func (m *MessageMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the MessageMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type MessageQuery

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

MessageQuery is the builder for querying Message entities.

func (*MessageQuery) Aggregate

func (mq *MessageQuery) Aggregate(fns ...AggregateFunc) *MessageSelect

Aggregate returns a MessageSelect configured with the given aggregations.

func (*MessageQuery) All

func (mq *MessageQuery) All(ctx context.Context) ([]*Message, error)

All executes the query and returns a list of Messages.

func (*MessageQuery) AllX

func (mq *MessageQuery) AllX(ctx context.Context) []*Message

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

func (*MessageQuery) Clone

func (mq *MessageQuery) Clone() *MessageQuery

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

func (*MessageQuery) Count

func (mq *MessageQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*MessageQuery) CountX

func (mq *MessageQuery) CountX(ctx context.Context) int

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

func (*MessageQuery) Exist

func (mq *MessageQuery) Exist(ctx context.Context) (bool, error)

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

func (*MessageQuery) ExistX

func (mq *MessageQuery) ExistX(ctx context.Context) bool

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

func (*MessageQuery) First

func (mq *MessageQuery) First(ctx context.Context) (*Message, error)

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

func (*MessageQuery) FirstID

func (mq *MessageQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*MessageQuery) FirstIDX

func (mq *MessageQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*MessageQuery) FirstX

func (mq *MessageQuery) FirstX(ctx context.Context) *Message

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

func (*MessageQuery) GroupBy

func (mq *MessageQuery) GroupBy(field string, fields ...string) *MessageGroupBy

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Message.Query().
	GroupBy(message.FieldCreatedAt).
	Aggregate(generate.Count()).
	Scan(ctx, &v)

func (*MessageQuery) IDs

func (mq *MessageQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*MessageQuery) IDsX

func (mq *MessageQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*MessageQuery) Limit

func (mq *MessageQuery) Limit(limit int) *MessageQuery

Limit the number of records to be returned by this query.

func (*MessageQuery) Offset

func (mq *MessageQuery) Offset(offset int) *MessageQuery

Offset to start from.

func (*MessageQuery) Only

func (mq *MessageQuery) Only(ctx context.Context) (*Message, error)

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

func (*MessageQuery) OnlyID

func (mq *MessageQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*MessageQuery) OnlyIDX

func (mq *MessageQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*MessageQuery) OnlyX

func (mq *MessageQuery) OnlyX(ctx context.Context) *Message

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

func (*MessageQuery) Order

func (mq *MessageQuery) Order(o ...OrderFunc) *MessageQuery

Order specifies how the records should be ordered.

func (*MessageQuery) QueryUser

func (mq *MessageQuery) QueryUser() *UserQuery

QueryUser chains the current query on the "user" edge.

func (*MessageQuery) Select

func (mq *MessageQuery) Select(fields ...string) *MessageSelect

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.Message.Query().
	Select(message.FieldCreatedAt).
	Scan(ctx, &v)

func (*MessageQuery) Unique

func (mq *MessageQuery) Unique(unique bool) *MessageQuery

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 (*MessageQuery) Where

func (mq *MessageQuery) Where(ps ...predicate.Message) *MessageQuery

Where adds a new predicate for the MessageQuery builder.

func (*MessageQuery) WithUser

func (mq *MessageQuery) WithUser(opts ...func(*UserQuery)) *MessageQuery

WithUser tells the query-builder to eager-load the nodes that are connected to the "user" edge. The optional arguments are used to configure the query builder of the edge.

type MessageSelect

type MessageSelect struct {
	*MessageQuery
	// contains filtered or unexported fields
}

MessageSelect is the builder for selecting fields of Message entities.

func (*MessageSelect) Aggregate

func (ms *MessageSelect) Aggregate(fns ...AggregateFunc) *MessageSelect

Aggregate adds the given aggregation functions to the selector query.

func (*MessageSelect) Bool

func (s *MessageSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*MessageSelect) BoolX

func (s *MessageSelect) BoolX(ctx context.Context) bool

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

func (*MessageSelect) Bools

func (s *MessageSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*MessageSelect) BoolsX

func (s *MessageSelect) BoolsX(ctx context.Context) []bool

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

func (*MessageSelect) Float64

func (s *MessageSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*MessageSelect) Float64X

func (s *MessageSelect) Float64X(ctx context.Context) float64

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

func (*MessageSelect) Float64s

func (s *MessageSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*MessageSelect) Float64sX

func (s *MessageSelect) Float64sX(ctx context.Context) []float64

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

func (*MessageSelect) Int

func (s *MessageSelect) Int(ctx context.Context) (_ int, err error)

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

func (*MessageSelect) IntX

func (s *MessageSelect) IntX(ctx context.Context) int

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

func (*MessageSelect) Ints

func (s *MessageSelect) Ints(ctx context.Context) ([]int, error)

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

func (*MessageSelect) IntsX

func (s *MessageSelect) IntsX(ctx context.Context) []int

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

func (*MessageSelect) Scan

func (ms *MessageSelect) Scan(ctx context.Context, v any) error

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

func (*MessageSelect) ScanX

func (s *MessageSelect) ScanX(ctx context.Context, v any)

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

func (*MessageSelect) String

func (s *MessageSelect) String(ctx context.Context) (_ string, err error)

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

func (*MessageSelect) StringX

func (s *MessageSelect) StringX(ctx context.Context) string

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

func (*MessageSelect) Strings

func (s *MessageSelect) Strings(ctx context.Context) ([]string, error)

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

func (*MessageSelect) StringsX

func (s *MessageSelect) StringsX(ctx context.Context) []string

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

type MessageUpdate

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

MessageUpdate is the builder for updating Message entities.

func (*MessageUpdate) ClearUser

func (mu *MessageUpdate) ClearUser() *MessageUpdate

ClearUser clears the "user" edge to the User entity.

func (*MessageUpdate) Exec

func (mu *MessageUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageUpdate) ExecX

func (mu *MessageUpdate) ExecX(ctx context.Context)

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

func (*MessageUpdate) Mutation

func (mu *MessageUpdate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdate) Save

func (mu *MessageUpdate) Save(ctx context.Context) (int, error)

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

func (*MessageUpdate) SaveX

func (mu *MessageUpdate) SaveX(ctx context.Context) int

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

func (*MessageUpdate) SetUser

func (mu *MessageUpdate) SetUser(u *User) *MessageUpdate

SetUser sets the "user" edge to the User entity.

func (*MessageUpdate) SetUserID

func (mu *MessageUpdate) SetUserID(id int) *MessageUpdate

SetUserID sets the "user" edge to the User entity by ID.

func (*MessageUpdate) Where

func (mu *MessageUpdate) Where(ps ...predicate.Message) *MessageUpdate

Where appends a list predicates to the MessageUpdate builder.

type MessageUpdateOne

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

MessageUpdateOne is the builder for updating a single Message entity.

func (*MessageUpdateOne) ClearUser

func (muo *MessageUpdateOne) ClearUser() *MessageUpdateOne

ClearUser clears the "user" edge to the User entity.

func (*MessageUpdateOne) Exec

func (muo *MessageUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*MessageUpdateOne) ExecX

func (muo *MessageUpdateOne) ExecX(ctx context.Context)

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

func (*MessageUpdateOne) Mutation

func (muo *MessageUpdateOne) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdateOne) Save

func (muo *MessageUpdateOne) Save(ctx context.Context) (*Message, error)

Save executes the query and returns the updated Message entity.

func (*MessageUpdateOne) SaveX

func (muo *MessageUpdateOne) SaveX(ctx context.Context) *Message

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

func (*MessageUpdateOne) Select

func (muo *MessageUpdateOne) Select(field string, fields ...string) *MessageUpdateOne

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

func (*MessageUpdateOne) SetUser

func (muo *MessageUpdateOne) SetUser(u *User) *MessageUpdateOne

SetUser sets the "user" edge to the User entity.

func (*MessageUpdateOne) SetUserID

func (muo *MessageUpdateOne) SetUserID(id int) *MessageUpdateOne

SetUserID sets the "user" edge to the User entity by ID.

func (*MessageUpdateOne) Where

Where appends a list predicates to the MessageUpdate builder.

type MessageUpsert

type MessageUpsert struct {
	*sql.UpdateSet
}

MessageUpsert is the "OnConflict" setter.

type MessageUpsertBulk

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

MessageUpsertBulk is the builder for "upsert"-ing a bulk of Message nodes.

func (*MessageUpsertBulk) DoNothing

func (u *MessageUpsertBulk) DoNothing() *MessageUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*MessageUpsertBulk) Exec

func (u *MessageUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageUpsertBulk) ExecX

func (u *MessageUpsertBulk) ExecX(ctx context.Context)

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

func (*MessageUpsertBulk) Ignore

func (u *MessageUpsertBulk) Ignore() *MessageUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*MessageUpsertBulk) Update

func (u *MessageUpsertBulk) Update(set func(*MessageUpsert)) *MessageUpsertBulk

Update allows overriding fields `UPDATE` values. See the MessageCreateBulk.OnConflict documentation for more info.

func (*MessageUpsertBulk) UpdateNewValues

func (u *MessageUpsertBulk) UpdateNewValues() *MessageUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(message.FieldID)
		}),
	).
	Exec(ctx)

type MessageUpsertOne

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

MessageUpsertOne is the builder for "upsert"-ing

one Message node.

func (*MessageUpsertOne) DoNothing

func (u *MessageUpsertOne) DoNothing() *MessageUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*MessageUpsertOne) Exec

func (u *MessageUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*MessageUpsertOne) ExecX

func (u *MessageUpsertOne) ExecX(ctx context.Context)

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

func (*MessageUpsertOne) ID

func (u *MessageUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*MessageUpsertOne) IDX

IDX is like ID, but panics if an error occurs.

func (*MessageUpsertOne) Ignore

func (u *MessageUpsertOne) Ignore() *MessageUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.Message.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*MessageUpsertOne) Update

func (u *MessageUpsertOne) Update(set func(*MessageUpsert)) *MessageUpsertOne

Update allows overriding fields `UPDATE` values. See the MessageCreate.OnConflict documentation for more info.

func (*MessageUpsertOne) UpdateNewValues

func (u *MessageUpsertOne) UpdateNewValues() *MessageUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. Using this option is equivalent to using:

client.Message.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
		sql.ResolveWith(func(u *sql.UpdateSet) {
			u.SetIgnore(message.FieldID)
		}),
	).
	Exec(ctx)

type Messages

type Messages []*Message

Messages is a parsable slice of Message.

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(...any)) 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 Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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 QueryContext

type QueryContext = ent.QueryContext

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 TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Device is the client for interacting with the Device builders.
	Device *DeviceClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// 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 int `json:"id,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Secret holds the value of the "secret" field.
	Secret string `json:"secret,omitempty"`
	// GithubID holds the value of the "githubID" field.
	GithubID int64 `json:"githubID,omitempty"`
	// GithubName holds the value of the "githubName" field.
	GithubName string `json:"githubName,omitempty"`
	// GithubLogin holds the value of the "githubLogin" field.
	GithubLogin string `json:"githubLogin,omitempty"`
	// GithubOauthToken holds the value of the "githubOauthToken" field.
	GithubOauthToken string `json:"githubOauthToken,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryDevices

func (u *User) QueryDevices() *DeviceQuery

QueryDevices queries the "devices" edge of the User entity.

func (*User) QueryMessages

func (u *User) QueryMessages() *MessageQuery

QueryMessages queries the "messages" edge of the User entity.

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 builder for creating a User entity.

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 builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

DeleteOneID returns a builder for deleting the given entity by its id.

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *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) Intercept

func (c *UserClient) Intercept(interceptors ...Interceptor)

Intercept adds a list of query interceptors to the interceptors stack. A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`.

func (*UserClient) Interceptors

func (c *UserClient) Interceptors() []Interceptor

Interceptors returns the client interceptors.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryDevices

func (c *UserClient) QueryDevices(u *User) *DeviceQuery

QueryDevices queries the devices edge of a User.

func (*UserClient) QueryMessages

func (c *UserClient) QueryMessages(u *User) *MessageQuery

QueryMessages queries the messages edge of a 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 int) *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) AddDeviceIDs

func (uc *UserCreate) AddDeviceIDs(ids ...int) *UserCreate

AddDeviceIDs adds the "devices" edge to the Device entity by IDs.

func (*UserCreate) AddDevices

func (uc *UserCreate) AddDevices(d ...*Device) *UserCreate

AddDevices adds the "devices" edges to the Device entity.

func (*UserCreate) AddMessageIDs

func (uc *UserCreate) AddMessageIDs(ids ...uuid.UUID) *UserCreate

AddMessageIDs adds the "messages" edge to the Message entity by IDs.

func (*UserCreate) AddMessages

func (uc *UserCreate) AddMessages(m ...*Message) *UserCreate

AddMessages adds the "messages" edges to the Message 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) OnConflict

func (uc *UserCreate) OnConflict(opts ...sql.ConflictOption) *UserUpsertOne

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.Create().
	SetCreatedAt(v).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*UserCreate) OnConflictColumns

func (uc *UserCreate) OnConflictColumns(columns ...string) *UserUpsertOne

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

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) SetGithubID

func (uc *UserCreate) SetGithubID(i int64) *UserCreate

SetGithubID sets the "githubID" field.

func (*UserCreate) SetGithubLogin

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

SetGithubLogin sets the "githubLogin" field.

func (*UserCreate) SetGithubName

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

SetGithubName sets the "githubName" field.

func (*UserCreate) SetGithubOauthToken

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

SetGithubOauthToken sets the "githubOauthToken" 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) SetNillableUpdatedAt

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

SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.

func (*UserCreate) SetSecret

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

SetSecret sets the "secret" field.

func (*UserCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" 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) OnConflict

func (ucb *UserCreateBulk) OnConflict(opts ...sql.ConflictOption) *UserUpsertBulk

OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause of the `INSERT` statement. For example:

client.User.CreateBulk(builders...).
	OnConflict(
		// Update the row with the new values
		// the was proposed for insertion.
		sql.ResolveWithNewValues(),
	).
	// Override some of the fields with custom
	// update values.
	Update(func(u *ent.UserUpsert) {
		SetCreatedAt(v+v).
	}).
	Exec(ctx)

func (*UserCreateBulk) OnConflictColumns

func (ucb *UserCreateBulk) OnConflictColumns(columns ...string) *UserUpsertBulk

OnConflictColumns calls `OnConflict` and configures the columns as conflict target. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ConflictColumns(columns...)).
	Exec(ctx)

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.

func (*UserDeleteOne) Where

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Devices holds the value of the devices edge.
	Devices []*Device `json:"devices,omitempty"`
	// Messages holds the value of the messages edge.
	Messages []*Message `json:"messages,omitempty"`
	// contains filtered or unexported fields
}

UserEdges holds the relations/edges for other nodes in the graph.

func (UserEdges) DevicesOrErr

func (e UserEdges) DevicesOrErr() ([]*Device, error)

DevicesOrErr returns the Devices value or an error if the edge was not loaded in eager-loading.

func (UserEdges) MessagesOrErr

func (e UserEdges) MessagesOrErr() ([]*Message, error)

MessagesOrErr returns the Messages value or an error if the edge was not loaded in eager-loading.

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 (s *UserGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

func (s *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 any) error

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

func (*UserGroupBy) ScanX

func (s *UserGroupBy) ScanX(ctx context.Context, v any)

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

func (s *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) AddDeviceIDs

func (m *UserMutation) AddDeviceIDs(ids ...int)

AddDeviceIDs adds the "devices" edge to the Device entity by ids.

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) AddGithubID

func (m *UserMutation) AddGithubID(i int64)

AddGithubID adds i to the "githubID" field.

func (*UserMutation) AddMessageIDs

func (m *UserMutation) AddMessageIDs(ids ...uuid.UUID)

AddMessageIDs adds the "messages" edge to the Message entity by ids.

func (*UserMutation) AddedEdges

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

AddedEdges returns all edge names that were set/added 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) AddedGithubID

func (m *UserMutation) AddedGithubID() (r int64, exists bool)

AddedGithubID returns the value that was added to the "githubID" field in 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) ClearDevices

func (m *UserMutation) ClearDevices()

ClearDevices clears the "devices" edge to the Device entity.

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) ClearMessages

func (m *UserMutation) ClearMessages()

ClearMessages clears the "messages" edge to the Message entity.

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) DevicesCleared

func (m *UserMutation) DevicesCleared() bool

DevicesCleared reports if the "devices" edge to the Device entity was cleared.

func (*UserMutation) DevicesIDs

func (m *UserMutation) DevicesIDs() (ids []int)

DevicesIDs returns the "devices" edge IDs 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) 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) GithubID

func (m *UserMutation) GithubID() (r int64, exists bool)

GithubID returns the value of the "githubID" field in the mutation.

func (*UserMutation) GithubLogin

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

GithubLogin returns the value of the "githubLogin" field in the mutation.

func (*UserMutation) GithubName

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

GithubName returns the value of the "githubName" field in the mutation.

func (*UserMutation) GithubOauthToken

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

GithubOauthToken returns the value of the "githubOauthToken" field in the mutation.

func (*UserMutation) ID

func (m *UserMutation) 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 (*UserMutation) IDs

func (m *UserMutation) IDs(ctx context.Context) ([]int, 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) MessagesCleared

func (m *UserMutation) MessagesCleared() bool

MessagesCleared reports if the "messages" edge to the Message entity was cleared.

func (*UserMutation) MessagesIDs

func (m *UserMutation) MessagesIDs() (ids []uuid.UUID)

MessagesIDs returns the "messages" edge IDs 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) 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) OldGithubID

func (m *UserMutation) OldGithubID(ctx context.Context) (v int64, err error)

OldGithubID returns the old "githubID" 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) OldGithubLogin

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

OldGithubLogin returns the old "githubLogin" 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) OldGithubName

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

OldGithubName returns the old "githubName" 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) OldGithubOauthToken

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

OldGithubOauthToken returns the old "githubOauthToken" 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) OldSecret

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

OldSecret returns the old "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) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_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) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) RemoveDeviceIDs

func (m *UserMutation) RemoveDeviceIDs(ids ...int)

RemoveDeviceIDs removes the "devices" edge to the Device entity by IDs.

func (*UserMutation) RemoveMessageIDs

func (m *UserMutation) RemoveMessageIDs(ids ...uuid.UUID)

RemoveMessageIDs removes the "messages" edge to the Message entity by IDs.

func (*UserMutation) RemovedDevicesIDs

func (m *UserMutation) RemovedDevicesIDs() (ids []int)

RemovedDevices returns the removed IDs of the "devices" edge to the Device entity.

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) RemovedMessagesIDs

func (m *UserMutation) RemovedMessagesIDs() (ids []uuid.UUID)

RemovedMessages returns the removed IDs of the "messages" edge to the Message entity.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetDevices

func (m *UserMutation) ResetDevices()

ResetDevices resets all changes to the "devices" edge.

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) 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) ResetGithubID

func (m *UserMutation) ResetGithubID()

ResetGithubID resets all changes to the "githubID" field.

func (*UserMutation) ResetGithubLogin

func (m *UserMutation) ResetGithubLogin()

ResetGithubLogin resets all changes to the "githubLogin" field.

func (*UserMutation) ResetGithubName

func (m *UserMutation) ResetGithubName()

ResetGithubName resets all changes to the "githubName" field.

func (*UserMutation) ResetGithubOauthToken

func (m *UserMutation) ResetGithubOauthToken()

ResetGithubOauthToken resets all changes to the "githubOauthToken" field.

func (*UserMutation) ResetMessages

func (m *UserMutation) ResetMessages()

ResetMessages resets all changes to the "messages" edge.

func (*UserMutation) ResetSecret

func (m *UserMutation) ResetSecret()

ResetSecret resets all changes to the "secret" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) Secret

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

Secret returns the value of the "secret" field in the mutation.

func (*UserMutation) SetCreatedAt

func (m *UserMutation) SetCreatedAt(t time.Time)

SetCreatedAt sets the "created_at" 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) SetGithubID

func (m *UserMutation) SetGithubID(i int64)

SetGithubID sets the "githubID" field.

func (*UserMutation) SetGithubLogin

func (m *UserMutation) SetGithubLogin(s string)

SetGithubLogin sets the "githubLogin" field.

func (*UserMutation) SetGithubName

func (m *UserMutation) SetGithubName(s string)

SetGithubName sets the "githubName" field.

func (*UserMutation) SetGithubOauthToken

func (m *UserMutation) SetGithubOauthToken(s string)

SetGithubOauthToken sets the "githubOauthToken" field.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetSecret

func (m *UserMutation) SetSecret(s string)

SetSecret sets the "secret" field.

func (*UserMutation) SetUpdatedAt

func (m *UserMutation) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the "updated_at" field.

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) UpdatedAt

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

UpdatedAt returns the value of the "updated_at" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

func (m *UserMutation) WhereP(ps ...func(*sql.Selector))

WhereP appends storage-level predicates to the UserMutation builder. Using this method, users can use type-assertion to append predicates that do not depend on any generated package.

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

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 int, 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) int

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
	Count int `json:"count,omitempty"`
}

client.User.Query().
	GroupBy(user.FieldCreatedAt).
	Aggregate(generate.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) (ids []int, err error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit the number of records to be returned by this query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

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 int, 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) int

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 specifies how the records should be ordered.

func (*UserQuery) QueryDevices

func (uq *UserQuery) QueryDevices() *DeviceQuery

QueryDevices chains the current query on the "devices" edge.

func (*UserQuery) QueryMessages

func (uq *UserQuery) QueryMessages() *MessageQuery

QueryMessages chains the current query on the "messages" edge.

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 {
	CreatedAt time.Time `json:"created_at,omitempty"`
}

client.User.Query().
	Select(user.FieldCreatedAt).
	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.

func (*UserQuery) WithDevices

func (uq *UserQuery) WithDevices(opts ...func(*DeviceQuery)) *UserQuery

WithDevices tells the query-builder to eager-load the nodes that are connected to the "devices" edge. The optional arguments are used to configure the query builder of the edge.

func (*UserQuery) WithMessages

func (uq *UserQuery) WithMessages(opts ...func(*MessageQuery)) *UserQuery

WithMessages tells the query-builder to eager-load the nodes that are connected to the "messages" edge. The optional arguments are used to configure the query builder of the edge.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

func (s *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 (s *UserSelect) BoolX(ctx context.Context) bool

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

func (*UserSelect) Bools

func (s *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 (s *UserSelect) BoolsX(ctx context.Context) []bool

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

func (*UserSelect) Float64

func (s *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 (s *UserSelect) Float64X(ctx context.Context) float64

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

func (*UserSelect) Float64s

func (s *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 (s *UserSelect) Float64sX(ctx context.Context) []float64

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

func (*UserSelect) Int

func (s *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 (s *UserSelect) IntX(ctx context.Context) int

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

func (*UserSelect) Ints

func (s *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 (s *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 any) error

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

func (*UserSelect) ScanX

func (s *UserSelect) ScanX(ctx context.Context, v any)

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

func (*UserSelect) String

func (s *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 (s *UserSelect) StringX(ctx context.Context) string

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

func (*UserSelect) Strings

func (s *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 (s *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) AddDeviceIDs

func (uu *UserUpdate) AddDeviceIDs(ids ...int) *UserUpdate

AddDeviceIDs adds the "devices" edge to the Device entity by IDs.

func (*UserUpdate) AddDevices

func (uu *UserUpdate) AddDevices(d ...*Device) *UserUpdate

AddDevices adds the "devices" edges to the Device entity.

func (*UserUpdate) AddGithubID

func (uu *UserUpdate) AddGithubID(i int64) *UserUpdate

AddGithubID adds i to the "githubID" field.

func (*UserUpdate) AddMessageIDs

func (uu *UserUpdate) AddMessageIDs(ids ...uuid.UUID) *UserUpdate

AddMessageIDs adds the "messages" edge to the Message entity by IDs.

func (*UserUpdate) AddMessages

func (uu *UserUpdate) AddMessages(m ...*Message) *UserUpdate

AddMessages adds the "messages" edges to the Message entity.

func (*UserUpdate) ClearDevices

func (uu *UserUpdate) ClearDevices() *UserUpdate

ClearDevices clears all "devices" edges to the Device entity.

func (*UserUpdate) ClearMessages

func (uu *UserUpdate) ClearMessages() *UserUpdate

ClearMessages clears all "messages" edges to the Message entity.

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) RemoveDeviceIDs

func (uu *UserUpdate) RemoveDeviceIDs(ids ...int) *UserUpdate

RemoveDeviceIDs removes the "devices" edge to Device entities by IDs.

func (*UserUpdate) RemoveDevices

func (uu *UserUpdate) RemoveDevices(d ...*Device) *UserUpdate

RemoveDevices removes "devices" edges to Device entities.

func (*UserUpdate) RemoveMessageIDs

func (uu *UserUpdate) RemoveMessageIDs(ids ...uuid.UUID) *UserUpdate

RemoveMessageIDs removes the "messages" edge to Message entities by IDs.

func (*UserUpdate) RemoveMessages

func (uu *UserUpdate) RemoveMessages(m ...*Message) *UserUpdate

RemoveMessages removes "messages" edges to Message entities.

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) SetGithubID

func (uu *UserUpdate) SetGithubID(i int64) *UserUpdate

SetGithubID sets the "githubID" field.

func (*UserUpdate) SetGithubLogin

func (uu *UserUpdate) SetGithubLogin(s string) *UserUpdate

SetGithubLogin sets the "githubLogin" field.

func (*UserUpdate) SetGithubName

func (uu *UserUpdate) SetGithubName(s string) *UserUpdate

SetGithubName sets the "githubName" field.

func (*UserUpdate) SetGithubOauthToken

func (uu *UserUpdate) SetGithubOauthToken(s string) *UserUpdate

SetGithubOauthToken sets the "githubOauthToken" field.

func (*UserUpdate) SetSecret

func (uu *UserUpdate) SetSecret(s string) *UserUpdate

SetSecret sets the "secret" field.

func (*UserUpdate) SetUpdatedAt

func (uu *UserUpdate) SetUpdatedAt(t time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" 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) AddDeviceIDs

func (uuo *UserUpdateOne) AddDeviceIDs(ids ...int) *UserUpdateOne

AddDeviceIDs adds the "devices" edge to the Device entity by IDs.

func (*UserUpdateOne) AddDevices

func (uuo *UserUpdateOne) AddDevices(d ...*Device) *UserUpdateOne

AddDevices adds the "devices" edges to the Device entity.

func (*UserUpdateOne) AddGithubID

func (uuo *UserUpdateOne) AddGithubID(i int64) *UserUpdateOne

AddGithubID adds i to the "githubID" field.

func (*UserUpdateOne) AddMessageIDs

func (uuo *UserUpdateOne) AddMessageIDs(ids ...uuid.UUID) *UserUpdateOne

AddMessageIDs adds the "messages" edge to the Message entity by IDs.

func (*UserUpdateOne) AddMessages

func (uuo *UserUpdateOne) AddMessages(m ...*Message) *UserUpdateOne

AddMessages adds the "messages" edges to the Message entity.

func (*UserUpdateOne) ClearDevices

func (uuo *UserUpdateOne) ClearDevices() *UserUpdateOne

ClearDevices clears all "devices" edges to the Device entity.

func (*UserUpdateOne) ClearMessages

func (uuo *UserUpdateOne) ClearMessages() *UserUpdateOne

ClearMessages clears all "messages" edges to the Message entity.

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) RemoveDeviceIDs

func (uuo *UserUpdateOne) RemoveDeviceIDs(ids ...int) *UserUpdateOne

RemoveDeviceIDs removes the "devices" edge to Device entities by IDs.

func (*UserUpdateOne) RemoveDevices

func (uuo *UserUpdateOne) RemoveDevices(d ...*Device) *UserUpdateOne

RemoveDevices removes "devices" edges to Device entities.

func (*UserUpdateOne) RemoveMessageIDs

func (uuo *UserUpdateOne) RemoveMessageIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveMessageIDs removes the "messages" edge to Message entities by IDs.

func (*UserUpdateOne) RemoveMessages

func (uuo *UserUpdateOne) RemoveMessages(m ...*Message) *UserUpdateOne

RemoveMessages removes "messages" edges to Message entities.

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) SetGithubID

func (uuo *UserUpdateOne) SetGithubID(i int64) *UserUpdateOne

SetGithubID sets the "githubID" field.

func (*UserUpdateOne) SetGithubLogin

func (uuo *UserUpdateOne) SetGithubLogin(s string) *UserUpdateOne

SetGithubLogin sets the "githubLogin" field.

func (*UserUpdateOne) SetGithubName

func (uuo *UserUpdateOne) SetGithubName(s string) *UserUpdateOne

SetGithubName sets the "githubName" field.

func (*UserUpdateOne) SetGithubOauthToken

func (uuo *UserUpdateOne) SetGithubOauthToken(s string) *UserUpdateOne

SetGithubOauthToken sets the "githubOauthToken" field.

func (*UserUpdateOne) SetSecret

func (uuo *UserUpdateOne) SetSecret(s string) *UserUpdateOne

SetSecret sets the "secret" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) Where

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type UserUpsert

type UserUpsert struct {
	*sql.UpdateSet
}

UserUpsert is the "OnConflict" setter.

func (*UserUpsert) AddGithubID

func (u *UserUpsert) AddGithubID(v int64) *UserUpsert

AddGithubID adds v to the "githubID" field.

func (*UserUpsert) SetGithubID

func (u *UserUpsert) SetGithubID(v int64) *UserUpsert

SetGithubID sets the "githubID" field.

func (*UserUpsert) SetGithubLogin

func (u *UserUpsert) SetGithubLogin(v string) *UserUpsert

SetGithubLogin sets the "githubLogin" field.

func (*UserUpsert) SetGithubName

func (u *UserUpsert) SetGithubName(v string) *UserUpsert

SetGithubName sets the "githubName" field.

func (*UserUpsert) SetGithubOauthToken

func (u *UserUpsert) SetGithubOauthToken(v string) *UserUpsert

SetGithubOauthToken sets the "githubOauthToken" field.

func (*UserUpsert) SetSecret

func (u *UserUpsert) SetSecret(v string) *UserUpsert

SetSecret sets the "secret" field.

func (*UserUpsert) SetUpdatedAt

func (u *UserUpsert) SetUpdatedAt(v time.Time) *UserUpsert

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsert) UpdateGithubID

func (u *UserUpsert) UpdateGithubID() *UserUpsert

UpdateGithubID sets the "githubID" field to the value that was provided on create.

func (*UserUpsert) UpdateGithubLogin

func (u *UserUpsert) UpdateGithubLogin() *UserUpsert

UpdateGithubLogin sets the "githubLogin" field to the value that was provided on create.

func (*UserUpsert) UpdateGithubName

func (u *UserUpsert) UpdateGithubName() *UserUpsert

UpdateGithubName sets the "githubName" field to the value that was provided on create.

func (*UserUpsert) UpdateGithubOauthToken

func (u *UserUpsert) UpdateGithubOauthToken() *UserUpsert

UpdateGithubOauthToken sets the "githubOauthToken" field to the value that was provided on create.

func (*UserUpsert) UpdateSecret

func (u *UserUpsert) UpdateSecret() *UserUpsert

UpdateSecret sets the "secret" field to the value that was provided on create.

func (*UserUpsert) UpdateUpdatedAt

func (u *UserUpsert) UpdateUpdatedAt() *UserUpsert

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type UserUpsertBulk

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

UserUpsertBulk is the builder for "upsert"-ing a bulk of User nodes.

func (*UserUpsertBulk) AddGithubID

func (u *UserUpsertBulk) AddGithubID(v int64) *UserUpsertBulk

AddGithubID adds v to the "githubID" field.

func (*UserUpsertBulk) DoNothing

func (u *UserUpsertBulk) DoNothing() *UserUpsertBulk

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertBulk) Exec

func (u *UserUpsertBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertBulk) ExecX

func (u *UserUpsertBulk) ExecX(ctx context.Context)

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

func (*UserUpsertBulk) Ignore

func (u *UserUpsertBulk) Ignore() *UserUpsertBulk

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
	OnConflict(sql.ResolveWithIgnore()).
	Exec(ctx)

func (*UserUpsertBulk) SetGithubID

func (u *UserUpsertBulk) SetGithubID(v int64) *UserUpsertBulk

SetGithubID sets the "githubID" field.

func (*UserUpsertBulk) SetGithubLogin

func (u *UserUpsertBulk) SetGithubLogin(v string) *UserUpsertBulk

SetGithubLogin sets the "githubLogin" field.

func (*UserUpsertBulk) SetGithubName

func (u *UserUpsertBulk) SetGithubName(v string) *UserUpsertBulk

SetGithubName sets the "githubName" field.

func (*UserUpsertBulk) SetGithubOauthToken

func (u *UserUpsertBulk) SetGithubOauthToken(v string) *UserUpsertBulk

SetGithubOauthToken sets the "githubOauthToken" field.

func (*UserUpsertBulk) SetSecret

func (u *UserUpsertBulk) SetSecret(v string) *UserUpsertBulk

SetSecret sets the "secret" field.

func (*UserUpsertBulk) SetUpdatedAt

func (u *UserUpsertBulk) SetUpdatedAt(v time.Time) *UserUpsertBulk

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertBulk) Update

func (u *UserUpsertBulk) Update(set func(*UserUpsert)) *UserUpsertBulk

Update allows overriding fields `UPDATE` values. See the UserCreateBulk.OnConflict documentation for more info.

func (*UserUpsertBulk) UpdateGithubID

func (u *UserUpsertBulk) UpdateGithubID() *UserUpsertBulk

UpdateGithubID sets the "githubID" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateGithubLogin

func (u *UserUpsertBulk) UpdateGithubLogin() *UserUpsertBulk

UpdateGithubLogin sets the "githubLogin" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateGithubName

func (u *UserUpsertBulk) UpdateGithubName() *UserUpsertBulk

UpdateGithubName sets the "githubName" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateGithubOauthToken

func (u *UserUpsertBulk) UpdateGithubOauthToken() *UserUpsertBulk

UpdateGithubOauthToken sets the "githubOauthToken" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateNewValues

func (u *UserUpsertBulk) UpdateNewValues() *UserUpsertBulk

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserUpsertBulk) UpdateSecret

func (u *UserUpsertBulk) UpdateSecret() *UserUpsertBulk

UpdateSecret sets the "secret" field to the value that was provided on create.

func (*UserUpsertBulk) UpdateUpdatedAt

func (u *UserUpsertBulk) UpdateUpdatedAt() *UserUpsertBulk

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

type UserUpsertOne

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

UserUpsertOne is the builder for "upsert"-ing

one User node.

func (*UserUpsertOne) AddGithubID

func (u *UserUpsertOne) AddGithubID(v int64) *UserUpsertOne

AddGithubID adds v to the "githubID" field.

func (*UserUpsertOne) DoNothing

func (u *UserUpsertOne) DoNothing() *UserUpsertOne

DoNothing configures the conflict_action to `DO NOTHING`. Supported only by SQLite and PostgreSQL.

func (*UserUpsertOne) Exec

func (u *UserUpsertOne) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpsertOne) ExecX

func (u *UserUpsertOne) ExecX(ctx context.Context)

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

func (*UserUpsertOne) ID

func (u *UserUpsertOne) ID(ctx context.Context) (id int, err error)

Exec executes the UPSERT query and returns the inserted/updated ID.

func (*UserUpsertOne) IDX

func (u *UserUpsertOne) IDX(ctx context.Context) int

IDX is like ID, but panics if an error occurs.

func (*UserUpsertOne) Ignore

func (u *UserUpsertOne) Ignore() *UserUpsertOne

Ignore sets each column to itself in case of conflict. Using this option is equivalent to using:

client.User.Create().
    OnConflict(sql.ResolveWithIgnore()).
    Exec(ctx)

func (*UserUpsertOne) SetGithubID

func (u *UserUpsertOne) SetGithubID(v int64) *UserUpsertOne

SetGithubID sets the "githubID" field.

func (*UserUpsertOne) SetGithubLogin

func (u *UserUpsertOne) SetGithubLogin(v string) *UserUpsertOne

SetGithubLogin sets the "githubLogin" field.

func (*UserUpsertOne) SetGithubName

func (u *UserUpsertOne) SetGithubName(v string) *UserUpsertOne

SetGithubName sets the "githubName" field.

func (*UserUpsertOne) SetGithubOauthToken

func (u *UserUpsertOne) SetGithubOauthToken(v string) *UserUpsertOne

SetGithubOauthToken sets the "githubOauthToken" field.

func (*UserUpsertOne) SetSecret

func (u *UserUpsertOne) SetSecret(v string) *UserUpsertOne

SetSecret sets the "secret" field.

func (*UserUpsertOne) SetUpdatedAt

func (u *UserUpsertOne) SetUpdatedAt(v time.Time) *UserUpsertOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpsertOne) Update

func (u *UserUpsertOne) Update(set func(*UserUpsert)) *UserUpsertOne

Update allows overriding fields `UPDATE` values. See the UserCreate.OnConflict documentation for more info.

func (*UserUpsertOne) UpdateGithubID

func (u *UserUpsertOne) UpdateGithubID() *UserUpsertOne

UpdateGithubID sets the "githubID" field to the value that was provided on create.

func (*UserUpsertOne) UpdateGithubLogin

func (u *UserUpsertOne) UpdateGithubLogin() *UserUpsertOne

UpdateGithubLogin sets the "githubLogin" field to the value that was provided on create.

func (*UserUpsertOne) UpdateGithubName

func (u *UserUpsertOne) UpdateGithubName() *UserUpsertOne

UpdateGithubName sets the "githubName" field to the value that was provided on create.

func (*UserUpsertOne) UpdateGithubOauthToken

func (u *UserUpsertOne) UpdateGithubOauthToken() *UserUpsertOne

UpdateGithubOauthToken sets the "githubOauthToken" field to the value that was provided on create.

func (*UserUpsertOne) UpdateNewValues

func (u *UserUpsertOne) UpdateNewValues() *UserUpsertOne

UpdateNewValues updates the mutable fields using the new values that were set on create. Using this option is equivalent to using:

client.User.Create().
	OnConflict(
		sql.ResolveWithNewValues(),
	).
	Exec(ctx)

func (*UserUpsertOne) UpdateSecret

func (u *UserUpsertOne) UpdateSecret() *UserUpsertOne

UpdateSecret sets the "secret" field to the value that was provided on create.

func (*UserUpsertOne) UpdateUpdatedAt

func (u *UserUpsertOne) UpdateUpdatedAt() *UserUpsertOne

UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.

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