ent

package
v0.0.0-...-d2e3589 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 25 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.
	TypeChannel      = "Channel"
	TypeDevice       = "Device"
	TypeMessage      = "Message"
	TypeRecipient    = "Recipient"
	TypeSubscription = "Subscription"
	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(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
Scan(ctx, &v)

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Channel

type Channel 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"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Type holds the value of the "type" field.
	Type string `json:"type,omitempty"`
	// State holds the value of the "state" field.
	State string `json:"state,omitempty"`
	// StateAt holds the value of the "state_at" field.
	StateAt time.Time `json:"state_at,omitempty"`
	// sequential number of the latest message sent through the Channel
	Sequence int `json:"sequence,omitempty"`
	// timestamp of the last message sent to the Channel
	Touched time.Time `json:"touched,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ChannelQuery when eager-loading is set.
	Edges ChannelEdges `json:"edges"`
	// contains filtered or unexported fields
}

Channel is the model entity for the Channel schema.

func (*Channel) QueryMembers

func (c *Channel) QueryMembers() *UserQuery

QueryMembers queries the "members" edge of the Channel entity.

func (*Channel) QueryMessages

func (c *Channel) QueryMessages() *MessageQuery

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

func (*Channel) QuerySubscriptions

func (c *Channel) QuerySubscriptions() *SubscriptionQuery

QuerySubscriptions queries the "subscriptions" edge of the Channel entity.

func (*Channel) String

func (c *Channel) String() string

String implements the fmt.Stringer.

func (*Channel) Unwrap

func (c *Channel) Unwrap() *Channel

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

func (c *Channel) Update() *ChannelUpdateOne

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

type ChannelClient

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

ChannelClient is a client for the Channel schema.

func NewChannelClient

func NewChannelClient(c config) *ChannelClient

NewChannelClient returns a client for the Channel from the given config.

func (*ChannelClient) Create

func (c *ChannelClient) Create() *ChannelCreate

Create returns a builder for creating a Channel entity.

func (*ChannelClient) CreateBulk

func (c *ChannelClient) CreateBulk(builders ...*ChannelCreate) *ChannelCreateBulk

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

func (*ChannelClient) Delete

func (c *ChannelClient) Delete() *ChannelDelete

Delete returns a delete builder for Channel.

func (*ChannelClient) DeleteOne

func (c *ChannelClient) DeleteOne(ch *Channel) *ChannelDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ChannelClient) DeleteOneID

func (c *ChannelClient) DeleteOneID(id uuid.UUID) *ChannelDeleteOne

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

func (*ChannelClient) Get

func (c *ChannelClient) Get(ctx context.Context, id uuid.UUID) (*Channel, error)

Get returns a Channel entity by its id.

func (*ChannelClient) GetX

func (c *ChannelClient) GetX(ctx context.Context, id uuid.UUID) *Channel

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

func (*ChannelClient) Hooks

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

Hooks returns the client hooks.

func (*ChannelClient) Query

func (c *ChannelClient) Query() *ChannelQuery

Query returns a query builder for Channel.

func (*ChannelClient) QueryMembers

func (c *ChannelClient) QueryMembers(ch *Channel) *UserQuery

QueryMembers queries the members edge of a Channel.

func (*ChannelClient) QueryMessages

func (c *ChannelClient) QueryMessages(ch *Channel) *MessageQuery

QueryMessages queries the messages edge of a Channel.

func (*ChannelClient) QuerySubscriptions

func (c *ChannelClient) QuerySubscriptions(ch *Channel) *SubscriptionQuery

QuerySubscriptions queries the subscriptions edge of a Channel.

func (*ChannelClient) Update

func (c *ChannelClient) Update() *ChannelUpdate

Update returns an update builder for Channel.

func (*ChannelClient) UpdateOne

func (c *ChannelClient) UpdateOne(ch *Channel) *ChannelUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ChannelClient) UpdateOneID

func (c *ChannelClient) UpdateOneID(id uuid.UUID) *ChannelUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ChannelClient) Use

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

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

type ChannelCreate

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

ChannelCreate is the builder for creating a Channel entity.

func (*ChannelCreate) AddMemberIDs

func (cc *ChannelCreate) AddMemberIDs(ids ...uuid.UUID) *ChannelCreate

AddMemberIDs adds the "members" edge to the User entity by IDs.

func (*ChannelCreate) AddMembers

func (cc *ChannelCreate) AddMembers(u ...*User) *ChannelCreate

AddMembers adds the "members" edges to the User entity.

func (*ChannelCreate) AddMessageIDs

func (cc *ChannelCreate) AddMessageIDs(ids ...uuid.UUID) *ChannelCreate

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

func (*ChannelCreate) AddMessages

func (cc *ChannelCreate) AddMessages(m ...*Message) *ChannelCreate

AddMessages adds the "messages" edges to the Message entity.

func (*ChannelCreate) AddSubscriptionIDs

func (cc *ChannelCreate) AddSubscriptionIDs(ids ...uuid.UUID) *ChannelCreate

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*ChannelCreate) AddSubscriptions

func (cc *ChannelCreate) AddSubscriptions(s ...*Subscription) *ChannelCreate

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*ChannelCreate) Exec

func (cc *ChannelCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChannelCreate) ExecX

func (cc *ChannelCreate) ExecX(ctx context.Context)

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

func (*ChannelCreate) Mutation

func (cc *ChannelCreate) Mutation() *ChannelMutation

Mutation returns the ChannelMutation object of the builder.

func (*ChannelCreate) Save

func (cc *ChannelCreate) Save(ctx context.Context) (*Channel, error)

Save creates the Channel in the database.

func (*ChannelCreate) SaveX

func (cc *ChannelCreate) SaveX(ctx context.Context) *Channel

SaveX calls Save and panics if Save returns an error.

func (*ChannelCreate) SetCreatedAt

func (cc *ChannelCreate) SetCreatedAt(t time.Time) *ChannelCreate

SetCreatedAt sets the "created_at" field.

func (*ChannelCreate) SetDescription

func (cc *ChannelCreate) SetDescription(s string) *ChannelCreate

SetDescription sets the "description" field.

func (*ChannelCreate) SetID

func (cc *ChannelCreate) SetID(u uuid.UUID) *ChannelCreate

SetID sets the "id" field.

func (*ChannelCreate) SetName

func (cc *ChannelCreate) SetName(s string) *ChannelCreate

SetName sets the "name" field.

func (*ChannelCreate) SetNillableCreatedAt

func (cc *ChannelCreate) SetNillableCreatedAt(t *time.Time) *ChannelCreate

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

func (*ChannelCreate) SetNillableSequence

func (cc *ChannelCreate) SetNillableSequence(i *int) *ChannelCreate

SetNillableSequence sets the "sequence" field if the given value is not nil.

func (*ChannelCreate) SetNillableTouched

func (cc *ChannelCreate) SetNillableTouched(t *time.Time) *ChannelCreate

SetNillableTouched sets the "touched" field if the given value is not nil.

func (*ChannelCreate) SetNillableUpdatedAt

func (cc *ChannelCreate) SetNillableUpdatedAt(t *time.Time) *ChannelCreate

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

func (*ChannelCreate) SetSequence

func (cc *ChannelCreate) SetSequence(i int) *ChannelCreate

SetSequence sets the "sequence" field.

func (*ChannelCreate) SetState

func (cc *ChannelCreate) SetState(s string) *ChannelCreate

SetState sets the "state" field.

func (*ChannelCreate) SetStateAt

func (cc *ChannelCreate) SetStateAt(t time.Time) *ChannelCreate

SetStateAt sets the "state_at" field.

func (*ChannelCreate) SetTouched

func (cc *ChannelCreate) SetTouched(t time.Time) *ChannelCreate

SetTouched sets the "touched" field.

func (*ChannelCreate) SetType

func (cc *ChannelCreate) SetType(s string) *ChannelCreate

SetType sets the "type" field.

func (*ChannelCreate) SetUpdatedAt

func (cc *ChannelCreate) SetUpdatedAt(t time.Time) *ChannelCreate

SetUpdatedAt sets the "updated_at" field.

type ChannelCreateBulk

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

ChannelCreateBulk is the builder for creating many Channel entities in bulk.

func (*ChannelCreateBulk) Exec

func (ccb *ChannelCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ChannelCreateBulk) ExecX

func (ccb *ChannelCreateBulk) ExecX(ctx context.Context)

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

func (*ChannelCreateBulk) Save

func (ccb *ChannelCreateBulk) Save(ctx context.Context) ([]*Channel, error)

Save creates the Channel entities in the database.

func (*ChannelCreateBulk) SaveX

func (ccb *ChannelCreateBulk) SaveX(ctx context.Context) []*Channel

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

type ChannelDelete

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

ChannelDelete is the builder for deleting a Channel entity.

func (*ChannelDelete) Exec

func (cd *ChannelDelete) Exec(ctx context.Context) (int, error)

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

func (*ChannelDelete) ExecX

func (cd *ChannelDelete) ExecX(ctx context.Context) int

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

func (*ChannelDelete) Where

func (cd *ChannelDelete) Where(ps ...predicate.Channel) *ChannelDelete

Where appends a list predicates to the ChannelDelete builder.

type ChannelDeleteOne

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

ChannelDeleteOne is the builder for deleting a single Channel entity.

func (*ChannelDeleteOne) Exec

func (cdo *ChannelDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ChannelDeleteOne) ExecX

func (cdo *ChannelDeleteOne) ExecX(ctx context.Context)

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

type ChannelEdges

type ChannelEdges struct {
	// Messages holds the value of the messages edge.
	Messages []*Message `json:"messages,omitempty"`
	// Members holds the value of the members edge.
	Members []*User `json:"members,omitempty"`
	// Subscriptions holds the value of the subscriptions edge.
	Subscriptions []*Subscription `json:"subscriptions,omitempty"`
	// contains filtered or unexported fields
}

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

func (ChannelEdges) MembersOrErr

func (e ChannelEdges) MembersOrErr() ([]*User, error)

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

func (ChannelEdges) MessagesOrErr

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

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

func (ChannelEdges) SubscriptionsOrErr

func (e ChannelEdges) SubscriptionsOrErr() ([]*Subscription, error)

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

type ChannelGroupBy

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

ChannelGroupBy is the group-by builder for Channel entities.

func (*ChannelGroupBy) Aggregate

func (cgb *ChannelGroupBy) Aggregate(fns ...AggregateFunc) *ChannelGroupBy

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

func (*ChannelGroupBy) Bool

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

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

func (*ChannelGroupBy) BoolX

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

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

func (*ChannelGroupBy) Bools

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

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

func (*ChannelGroupBy) BoolsX

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

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

func (*ChannelGroupBy) Float64

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

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

func (*ChannelGroupBy) Float64X

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

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

func (*ChannelGroupBy) Float64s

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

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

func (*ChannelGroupBy) Float64sX

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

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

func (*ChannelGroupBy) Int

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

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

func (*ChannelGroupBy) IntX

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

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

func (*ChannelGroupBy) Ints

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

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

func (*ChannelGroupBy) IntsX

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

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

func (*ChannelGroupBy) Scan

func (cgb *ChannelGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*ChannelGroupBy) ScanX

func (s *ChannelGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*ChannelGroupBy) String

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

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

func (*ChannelGroupBy) StringX

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

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

func (*ChannelGroupBy) Strings

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

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

func (*ChannelGroupBy) StringsX

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

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

type ChannelMutation

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

ChannelMutation represents an operation that mutates the Channel nodes in the graph.

func (*ChannelMutation) AddField

func (m *ChannelMutation) 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 (*ChannelMutation) AddMemberIDs

func (m *ChannelMutation) AddMemberIDs(ids ...uuid.UUID)

AddMemberIDs adds the "members" edge to the User entity by ids.

func (*ChannelMutation) AddMessageIDs

func (m *ChannelMutation) AddMessageIDs(ids ...uuid.UUID)

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

func (*ChannelMutation) AddSequence

func (m *ChannelMutation) AddSequence(i int)

AddSequence adds i to the "sequence" field.

func (*ChannelMutation) AddSubscriptionIDs

func (m *ChannelMutation) AddSubscriptionIDs(ids ...uuid.UUID)

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by ids.

func (*ChannelMutation) AddedEdges

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

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

func (*ChannelMutation) AddedField

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

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

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

func (*ChannelMutation) AddedIDs

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

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

func (*ChannelMutation) AddedSequence

func (m *ChannelMutation) AddedSequence() (r int, exists bool)

AddedSequence returns the value that was added to the "sequence" field in this mutation.

func (*ChannelMutation) ClearEdge

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

func (m *ChannelMutation) 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 (*ChannelMutation) ClearMembers

func (m *ChannelMutation) ClearMembers()

ClearMembers clears the "members" edge to the User entity.

func (*ChannelMutation) ClearMessages

func (m *ChannelMutation) ClearMessages()

ClearMessages clears the "messages" edge to the Message entity.

func (*ChannelMutation) ClearSubscriptions

func (m *ChannelMutation) ClearSubscriptions()

ClearSubscriptions clears the "subscriptions" edge to the Subscription entity.

func (*ChannelMutation) ClearedEdges

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

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

func (*ChannelMutation) ClearedFields

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

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

func (ChannelMutation) Client

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

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

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

func (*ChannelMutation) Description

func (m *ChannelMutation) Description() (r string, exists bool)

Description returns the value of the "description" field in the mutation.

func (*ChannelMutation) EdgeCleared

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

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

func (*ChannelMutation) Field

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

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

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

func (*ChannelMutation) Fields

func (m *ChannelMutation) 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 (*ChannelMutation) GetType

func (m *ChannelMutation) GetType() (r string, exists bool)

GetType returns the value of the "type" field in the mutation.

func (*ChannelMutation) ID

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

func (m *ChannelMutation) 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 (*ChannelMutation) MembersCleared

func (m *ChannelMutation) MembersCleared() bool

MembersCleared reports if the "members" edge to the User entity was cleared.

func (*ChannelMutation) MembersIDs

func (m *ChannelMutation) MembersIDs() (ids []uuid.UUID)

MembersIDs returns the "members" edge IDs in the mutation.

func (*ChannelMutation) MessagesCleared

func (m *ChannelMutation) MessagesCleared() bool

MessagesCleared reports if the "messages" edge to the Message entity was cleared.

func (*ChannelMutation) MessagesIDs

func (m *ChannelMutation) MessagesIDs() (ids []uuid.UUID)

MessagesIDs returns the "messages" edge IDs in the mutation.

func (*ChannelMutation) Name

func (m *ChannelMutation) Name() (r string, exists bool)

Name returns the value of the "name" field in the mutation.

func (*ChannelMutation) OldCreatedAt

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

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

func (m *ChannelMutation) OldDescription(ctx context.Context) (v string, err error)

OldDescription returns the old "description" field's value of the Channel entity. If the Channel 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 (*ChannelMutation) OldField

func (m *ChannelMutation) 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 (*ChannelMutation) OldName

func (m *ChannelMutation) OldName(ctx context.Context) (v string, err error)

OldName returns the old "name" field's value of the Channel entity. If the Channel 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 (*ChannelMutation) OldSequence

func (m *ChannelMutation) OldSequence(ctx context.Context) (v int, err error)

OldSequence returns the old "sequence" field's value of the Channel entity. If the Channel 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 (*ChannelMutation) OldState

func (m *ChannelMutation) OldState(ctx context.Context) (v string, err error)

OldState returns the old "state" field's value of the Channel entity. If the Channel 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 (*ChannelMutation) OldStateAt

func (m *ChannelMutation) OldStateAt(ctx context.Context) (v time.Time, err error)

OldStateAt returns the old "state_at" field's value of the Channel entity. If the Channel 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 (*ChannelMutation) OldTouched

func (m *ChannelMutation) OldTouched(ctx context.Context) (v time.Time, err error)

OldTouched returns the old "touched" field's value of the Channel entity. If the Channel 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 (*ChannelMutation) OldType

func (m *ChannelMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "type" field's value of the Channel entity. If the Channel 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 (*ChannelMutation) OldUpdatedAt

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

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

func (m *ChannelMutation) Op() Op

Op returns the operation name.

func (*ChannelMutation) RemoveMemberIDs

func (m *ChannelMutation) RemoveMemberIDs(ids ...uuid.UUID)

RemoveMemberIDs removes the "members" edge to the User entity by IDs.

func (*ChannelMutation) RemoveMessageIDs

func (m *ChannelMutation) RemoveMessageIDs(ids ...uuid.UUID)

RemoveMessageIDs removes the "messages" edge to the Message entity by IDs.

func (*ChannelMutation) RemoveSubscriptionIDs

func (m *ChannelMutation) RemoveSubscriptionIDs(ids ...uuid.UUID)

RemoveSubscriptionIDs removes the "subscriptions" edge to the Subscription entity by IDs.

func (*ChannelMutation) RemovedEdges

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

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

func (*ChannelMutation) RemovedIDs

func (m *ChannelMutation) 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 (*ChannelMutation) RemovedMembersIDs

func (m *ChannelMutation) RemovedMembersIDs() (ids []uuid.UUID)

RemovedMembers returns the removed IDs of the "members" edge to the User entity.

func (*ChannelMutation) RemovedMessagesIDs

func (m *ChannelMutation) RemovedMessagesIDs() (ids []uuid.UUID)

RemovedMessages returns the removed IDs of the "messages" edge to the Message entity.

func (*ChannelMutation) RemovedSubscriptionsIDs

func (m *ChannelMutation) RemovedSubscriptionsIDs() (ids []uuid.UUID)

RemovedSubscriptions returns the removed IDs of the "subscriptions" edge to the Subscription entity.

func (*ChannelMutation) ResetCreatedAt

func (m *ChannelMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ChannelMutation) ResetDescription

func (m *ChannelMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ChannelMutation) ResetEdge

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

func (m *ChannelMutation) 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 (*ChannelMutation) ResetMembers

func (m *ChannelMutation) ResetMembers()

ResetMembers resets all changes to the "members" edge.

func (*ChannelMutation) ResetMessages

func (m *ChannelMutation) ResetMessages()

ResetMessages resets all changes to the "messages" edge.

func (*ChannelMutation) ResetName

func (m *ChannelMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ChannelMutation) ResetSequence

func (m *ChannelMutation) ResetSequence()

ResetSequence resets all changes to the "sequence" field.

func (*ChannelMutation) ResetState

func (m *ChannelMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*ChannelMutation) ResetStateAt

func (m *ChannelMutation) ResetStateAt()

ResetStateAt resets all changes to the "state_at" field.

func (*ChannelMutation) ResetSubscriptions

func (m *ChannelMutation) ResetSubscriptions()

ResetSubscriptions resets all changes to the "subscriptions" edge.

func (*ChannelMutation) ResetTouched

func (m *ChannelMutation) ResetTouched()

ResetTouched resets all changes to the "touched" field.

func (*ChannelMutation) ResetType

func (m *ChannelMutation) ResetType()

ResetType resets all changes to the "type" field.

func (*ChannelMutation) ResetUpdatedAt

func (m *ChannelMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ChannelMutation) Sequence

func (m *ChannelMutation) Sequence() (r int, exists bool)

Sequence returns the value of the "sequence" field in the mutation.

func (*ChannelMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ChannelMutation) SetDescription

func (m *ChannelMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ChannelMutation) SetField

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

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

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

func (*ChannelMutation) SetName

func (m *ChannelMutation) SetName(s string)

SetName sets the "name" field.

func (*ChannelMutation) SetSequence

func (m *ChannelMutation) SetSequence(i int)

SetSequence sets the "sequence" field.

func (*ChannelMutation) SetState

func (m *ChannelMutation) SetState(s string)

SetState sets the "state" field.

func (*ChannelMutation) SetStateAt

func (m *ChannelMutation) SetStateAt(t time.Time)

SetStateAt sets the "state_at" field.

func (*ChannelMutation) SetTouched

func (m *ChannelMutation) SetTouched(t time.Time)

SetTouched sets the "touched" field.

func (*ChannelMutation) SetType

func (m *ChannelMutation) SetType(s string)

SetType sets the "type" field.

func (*ChannelMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ChannelMutation) State

func (m *ChannelMutation) State() (r string, exists bool)

State returns the value of the "state" field in the mutation.

func (*ChannelMutation) StateAt

func (m *ChannelMutation) StateAt() (r time.Time, exists bool)

StateAt returns the value of the "state_at" field in the mutation.

func (*ChannelMutation) SubscriptionsCleared

func (m *ChannelMutation) SubscriptionsCleared() bool

SubscriptionsCleared reports if the "subscriptions" edge to the Subscription entity was cleared.

func (*ChannelMutation) SubscriptionsIDs

func (m *ChannelMutation) SubscriptionsIDs() (ids []uuid.UUID)

SubscriptionsIDs returns the "subscriptions" edge IDs in the mutation.

func (*ChannelMutation) Touched

func (m *ChannelMutation) Touched() (r time.Time, exists bool)

Touched returns the value of the "touched" field in the mutation.

func (ChannelMutation) Tx

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

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

func (*ChannelMutation) Type

func (m *ChannelMutation) Type() string

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

func (*ChannelMutation) UpdatedAt

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

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

func (*ChannelMutation) Where

func (m *ChannelMutation) Where(ps ...predicate.Channel)

Where appends a list predicates to the ChannelMutation builder.

type ChannelQuery

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

ChannelQuery is the builder for querying Channel entities.

func (*ChannelQuery) All

func (cq *ChannelQuery) All(ctx context.Context) ([]*Channel, error)

All executes the query and returns a list of Channels.

func (*ChannelQuery) AllX

func (cq *ChannelQuery) AllX(ctx context.Context) []*Channel

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

func (*ChannelQuery) Clone

func (cq *ChannelQuery) Clone() *ChannelQuery

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

func (*ChannelQuery) Count

func (cq *ChannelQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ChannelQuery) CountX

func (cq *ChannelQuery) CountX(ctx context.Context) int

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

func (*ChannelQuery) Exist

func (cq *ChannelQuery) Exist(ctx context.Context) (bool, error)

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

func (*ChannelQuery) ExistX

func (cq *ChannelQuery) ExistX(ctx context.Context) bool

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

func (*ChannelQuery) First

func (cq *ChannelQuery) First(ctx context.Context) (*Channel, error)

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

func (*ChannelQuery) FirstID

func (cq *ChannelQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ChannelQuery) FirstIDX

func (cq *ChannelQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ChannelQuery) FirstX

func (cq *ChannelQuery) FirstX(ctx context.Context) *Channel

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

func (*ChannelQuery) GroupBy

func (cq *ChannelQuery) GroupBy(field string, fields ...string) *ChannelGroupBy

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.Channel.Query().
	GroupBy(channel.FieldCreatedAt).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ChannelQuery) IDs

func (cq *ChannelQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*ChannelQuery) IDsX

func (cq *ChannelQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ChannelQuery) Limit

func (cq *ChannelQuery) Limit(limit int) *ChannelQuery

Limit adds a limit step to the query.

func (*ChannelQuery) Offset

func (cq *ChannelQuery) Offset(offset int) *ChannelQuery

Offset adds an offset step to the query.

func (*ChannelQuery) Only

func (cq *ChannelQuery) Only(ctx context.Context) (*Channel, error)

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

func (*ChannelQuery) OnlyID

func (cq *ChannelQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ChannelQuery) OnlyIDX

func (cq *ChannelQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ChannelQuery) OnlyX

func (cq *ChannelQuery) OnlyX(ctx context.Context) *Channel

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

func (*ChannelQuery) Order

func (cq *ChannelQuery) Order(o ...OrderFunc) *ChannelQuery

Order adds an order step to the query.

func (*ChannelQuery) QueryMembers

func (cq *ChannelQuery) QueryMembers() *UserQuery

QueryMembers chains the current query on the "members" edge.

func (*ChannelQuery) QueryMessages

func (cq *ChannelQuery) QueryMessages() *MessageQuery

QueryMessages chains the current query on the "messages" edge.

func (*ChannelQuery) QuerySubscriptions

func (cq *ChannelQuery) QuerySubscriptions() *SubscriptionQuery

QuerySubscriptions chains the current query on the "subscriptions" edge.

func (*ChannelQuery) Select

func (cq *ChannelQuery) Select(fields ...string) *ChannelSelect

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.Channel.Query().
	Select(channel.FieldCreatedAt).
	Scan(ctx, &v)

func (*ChannelQuery) Unique

func (cq *ChannelQuery) Unique(unique bool) *ChannelQuery

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

func (cq *ChannelQuery) Where(ps ...predicate.Channel) *ChannelQuery

Where adds a new predicate for the ChannelQuery builder.

func (*ChannelQuery) WithMembers

func (cq *ChannelQuery) WithMembers(opts ...func(*UserQuery)) *ChannelQuery

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

func (*ChannelQuery) WithMessages

func (cq *ChannelQuery) WithMessages(opts ...func(*MessageQuery)) *ChannelQuery

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.

func (*ChannelQuery) WithSubscriptions

func (cq *ChannelQuery) WithSubscriptions(opts ...func(*SubscriptionQuery)) *ChannelQuery

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

type ChannelSelect

type ChannelSelect struct {
	*ChannelQuery
	// contains filtered or unexported fields
}

ChannelSelect is the builder for selecting fields of Channel entities.

func (*ChannelSelect) Bool

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

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

func (*ChannelSelect) BoolX

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

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

func (*ChannelSelect) Bools

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

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

func (*ChannelSelect) BoolsX

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

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

func (*ChannelSelect) Float64

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

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

func (*ChannelSelect) Float64X

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

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

func (*ChannelSelect) Float64s

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

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

func (*ChannelSelect) Float64sX

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

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

func (*ChannelSelect) Int

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

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

func (*ChannelSelect) IntX

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

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

func (*ChannelSelect) Ints

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

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

func (*ChannelSelect) IntsX

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

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

func (*ChannelSelect) Scan

func (cs *ChannelSelect) Scan(ctx context.Context, v interface{}) error

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

func (*ChannelSelect) ScanX

func (s *ChannelSelect) ScanX(ctx context.Context, v interface{})

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

func (*ChannelSelect) String

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

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

func (*ChannelSelect) StringX

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

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

func (*ChannelSelect) Strings

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

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

func (*ChannelSelect) StringsX

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

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

type ChannelUpdate

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

ChannelUpdate is the builder for updating Channel entities.

func (*ChannelUpdate) AddMemberIDs

func (cu *ChannelUpdate) AddMemberIDs(ids ...uuid.UUID) *ChannelUpdate

AddMemberIDs adds the "members" edge to the User entity by IDs.

func (*ChannelUpdate) AddMembers

func (cu *ChannelUpdate) AddMembers(u ...*User) *ChannelUpdate

AddMembers adds the "members" edges to the User entity.

func (*ChannelUpdate) AddMessageIDs

func (cu *ChannelUpdate) AddMessageIDs(ids ...uuid.UUID) *ChannelUpdate

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

func (*ChannelUpdate) AddMessages

func (cu *ChannelUpdate) AddMessages(m ...*Message) *ChannelUpdate

AddMessages adds the "messages" edges to the Message entity.

func (*ChannelUpdate) AddSequence

func (cu *ChannelUpdate) AddSequence(i int) *ChannelUpdate

AddSequence adds i to the "sequence" field.

func (*ChannelUpdate) AddSubscriptionIDs

func (cu *ChannelUpdate) AddSubscriptionIDs(ids ...uuid.UUID) *ChannelUpdate

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*ChannelUpdate) AddSubscriptions

func (cu *ChannelUpdate) AddSubscriptions(s ...*Subscription) *ChannelUpdate

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*ChannelUpdate) ClearMembers

func (cu *ChannelUpdate) ClearMembers() *ChannelUpdate

ClearMembers clears all "members" edges to the User entity.

func (*ChannelUpdate) ClearMessages

func (cu *ChannelUpdate) ClearMessages() *ChannelUpdate

ClearMessages clears all "messages" edges to the Message entity.

func (*ChannelUpdate) ClearSubscriptions

func (cu *ChannelUpdate) ClearSubscriptions() *ChannelUpdate

ClearSubscriptions clears all "subscriptions" edges to the Subscription entity.

func (*ChannelUpdate) Exec

func (cu *ChannelUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ChannelUpdate) ExecX

func (cu *ChannelUpdate) ExecX(ctx context.Context)

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

func (*ChannelUpdate) Mutation

func (cu *ChannelUpdate) Mutation() *ChannelMutation

Mutation returns the ChannelMutation object of the builder.

func (*ChannelUpdate) RemoveMemberIDs

func (cu *ChannelUpdate) RemoveMemberIDs(ids ...uuid.UUID) *ChannelUpdate

RemoveMemberIDs removes the "members" edge to User entities by IDs.

func (*ChannelUpdate) RemoveMembers

func (cu *ChannelUpdate) RemoveMembers(u ...*User) *ChannelUpdate

RemoveMembers removes "members" edges to User entities.

func (*ChannelUpdate) RemoveMessageIDs

func (cu *ChannelUpdate) RemoveMessageIDs(ids ...uuid.UUID) *ChannelUpdate

RemoveMessageIDs removes the "messages" edge to Message entities by IDs.

func (*ChannelUpdate) RemoveMessages

func (cu *ChannelUpdate) RemoveMessages(m ...*Message) *ChannelUpdate

RemoveMessages removes "messages" edges to Message entities.

func (*ChannelUpdate) RemoveSubscriptionIDs

func (cu *ChannelUpdate) RemoveSubscriptionIDs(ids ...uuid.UUID) *ChannelUpdate

RemoveSubscriptionIDs removes the "subscriptions" edge to Subscription entities by IDs.

func (*ChannelUpdate) RemoveSubscriptions

func (cu *ChannelUpdate) RemoveSubscriptions(s ...*Subscription) *ChannelUpdate

RemoveSubscriptions removes "subscriptions" edges to Subscription entities.

func (*ChannelUpdate) Save

func (cu *ChannelUpdate) Save(ctx context.Context) (int, error)

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

func (*ChannelUpdate) SaveX

func (cu *ChannelUpdate) SaveX(ctx context.Context) int

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

func (*ChannelUpdate) SetCreatedAt

func (cu *ChannelUpdate) SetCreatedAt(t time.Time) *ChannelUpdate

SetCreatedAt sets the "created_at" field.

func (*ChannelUpdate) SetDescription

func (cu *ChannelUpdate) SetDescription(s string) *ChannelUpdate

SetDescription sets the "description" field.

func (*ChannelUpdate) SetName

func (cu *ChannelUpdate) SetName(s string) *ChannelUpdate

SetName sets the "name" field.

func (*ChannelUpdate) SetNillableCreatedAt

func (cu *ChannelUpdate) SetNillableCreatedAt(t *time.Time) *ChannelUpdate

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

func (*ChannelUpdate) SetNillableSequence

func (cu *ChannelUpdate) SetNillableSequence(i *int) *ChannelUpdate

SetNillableSequence sets the "sequence" field if the given value is not nil.

func (*ChannelUpdate) SetNillableTouched

func (cu *ChannelUpdate) SetNillableTouched(t *time.Time) *ChannelUpdate

SetNillableTouched sets the "touched" field if the given value is not nil.

func (*ChannelUpdate) SetSequence

func (cu *ChannelUpdate) SetSequence(i int) *ChannelUpdate

SetSequence sets the "sequence" field.

func (*ChannelUpdate) SetState

func (cu *ChannelUpdate) SetState(s string) *ChannelUpdate

SetState sets the "state" field.

func (*ChannelUpdate) SetStateAt

func (cu *ChannelUpdate) SetStateAt(t time.Time) *ChannelUpdate

SetStateAt sets the "state_at" field.

func (*ChannelUpdate) SetTouched

func (cu *ChannelUpdate) SetTouched(t time.Time) *ChannelUpdate

SetTouched sets the "touched" field.

func (*ChannelUpdate) SetType

func (cu *ChannelUpdate) SetType(s string) *ChannelUpdate

SetType sets the "type" field.

func (*ChannelUpdate) SetUpdatedAt

func (cu *ChannelUpdate) SetUpdatedAt(t time.Time) *ChannelUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ChannelUpdate) Where

func (cu *ChannelUpdate) Where(ps ...predicate.Channel) *ChannelUpdate

Where appends a list predicates to the ChannelUpdate builder.

type ChannelUpdateOne

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

ChannelUpdateOne is the builder for updating a single Channel entity.

func (*ChannelUpdateOne) AddMemberIDs

func (cuo *ChannelUpdateOne) AddMemberIDs(ids ...uuid.UUID) *ChannelUpdateOne

AddMemberIDs adds the "members" edge to the User entity by IDs.

func (*ChannelUpdateOne) AddMembers

func (cuo *ChannelUpdateOne) AddMembers(u ...*User) *ChannelUpdateOne

AddMembers adds the "members" edges to the User entity.

func (*ChannelUpdateOne) AddMessageIDs

func (cuo *ChannelUpdateOne) AddMessageIDs(ids ...uuid.UUID) *ChannelUpdateOne

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

func (*ChannelUpdateOne) AddMessages

func (cuo *ChannelUpdateOne) AddMessages(m ...*Message) *ChannelUpdateOne

AddMessages adds the "messages" edges to the Message entity.

func (*ChannelUpdateOne) AddSequence

func (cuo *ChannelUpdateOne) AddSequence(i int) *ChannelUpdateOne

AddSequence adds i to the "sequence" field.

func (*ChannelUpdateOne) AddSubscriptionIDs

func (cuo *ChannelUpdateOne) AddSubscriptionIDs(ids ...uuid.UUID) *ChannelUpdateOne

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*ChannelUpdateOne) AddSubscriptions

func (cuo *ChannelUpdateOne) AddSubscriptions(s ...*Subscription) *ChannelUpdateOne

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*ChannelUpdateOne) ClearMembers

func (cuo *ChannelUpdateOne) ClearMembers() *ChannelUpdateOne

ClearMembers clears all "members" edges to the User entity.

func (*ChannelUpdateOne) ClearMessages

func (cuo *ChannelUpdateOne) ClearMessages() *ChannelUpdateOne

ClearMessages clears all "messages" edges to the Message entity.

func (*ChannelUpdateOne) ClearSubscriptions

func (cuo *ChannelUpdateOne) ClearSubscriptions() *ChannelUpdateOne

ClearSubscriptions clears all "subscriptions" edges to the Subscription entity.

func (*ChannelUpdateOne) Exec

func (cuo *ChannelUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ChannelUpdateOne) ExecX

func (cuo *ChannelUpdateOne) ExecX(ctx context.Context)

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

func (*ChannelUpdateOne) Mutation

func (cuo *ChannelUpdateOne) Mutation() *ChannelMutation

Mutation returns the ChannelMutation object of the builder.

func (*ChannelUpdateOne) RemoveMemberIDs

func (cuo *ChannelUpdateOne) RemoveMemberIDs(ids ...uuid.UUID) *ChannelUpdateOne

RemoveMemberIDs removes the "members" edge to User entities by IDs.

func (*ChannelUpdateOne) RemoveMembers

func (cuo *ChannelUpdateOne) RemoveMembers(u ...*User) *ChannelUpdateOne

RemoveMembers removes "members" edges to User entities.

func (*ChannelUpdateOne) RemoveMessageIDs

func (cuo *ChannelUpdateOne) RemoveMessageIDs(ids ...uuid.UUID) *ChannelUpdateOne

RemoveMessageIDs removes the "messages" edge to Message entities by IDs.

func (*ChannelUpdateOne) RemoveMessages

func (cuo *ChannelUpdateOne) RemoveMessages(m ...*Message) *ChannelUpdateOne

RemoveMessages removes "messages" edges to Message entities.

func (*ChannelUpdateOne) RemoveSubscriptionIDs

func (cuo *ChannelUpdateOne) RemoveSubscriptionIDs(ids ...uuid.UUID) *ChannelUpdateOne

RemoveSubscriptionIDs removes the "subscriptions" edge to Subscription entities by IDs.

func (*ChannelUpdateOne) RemoveSubscriptions

func (cuo *ChannelUpdateOne) RemoveSubscriptions(s ...*Subscription) *ChannelUpdateOne

RemoveSubscriptions removes "subscriptions" edges to Subscription entities.

func (*ChannelUpdateOne) Save

func (cuo *ChannelUpdateOne) Save(ctx context.Context) (*Channel, error)

Save executes the query and returns the updated Channel entity.

func (*ChannelUpdateOne) SaveX

func (cuo *ChannelUpdateOne) SaveX(ctx context.Context) *Channel

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

func (*ChannelUpdateOne) Select

func (cuo *ChannelUpdateOne) Select(field string, fields ...string) *ChannelUpdateOne

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

func (*ChannelUpdateOne) SetCreatedAt

func (cuo *ChannelUpdateOne) SetCreatedAt(t time.Time) *ChannelUpdateOne

SetCreatedAt sets the "created_at" field.

func (*ChannelUpdateOne) SetDescription

func (cuo *ChannelUpdateOne) SetDescription(s string) *ChannelUpdateOne

SetDescription sets the "description" field.

func (*ChannelUpdateOne) SetName

func (cuo *ChannelUpdateOne) SetName(s string) *ChannelUpdateOne

SetName sets the "name" field.

func (*ChannelUpdateOne) SetNillableCreatedAt

func (cuo *ChannelUpdateOne) SetNillableCreatedAt(t *time.Time) *ChannelUpdateOne

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

func (*ChannelUpdateOne) SetNillableSequence

func (cuo *ChannelUpdateOne) SetNillableSequence(i *int) *ChannelUpdateOne

SetNillableSequence sets the "sequence" field if the given value is not nil.

func (*ChannelUpdateOne) SetNillableTouched

func (cuo *ChannelUpdateOne) SetNillableTouched(t *time.Time) *ChannelUpdateOne

SetNillableTouched sets the "touched" field if the given value is not nil.

func (*ChannelUpdateOne) SetSequence

func (cuo *ChannelUpdateOne) SetSequence(i int) *ChannelUpdateOne

SetSequence sets the "sequence" field.

func (*ChannelUpdateOne) SetState

func (cuo *ChannelUpdateOne) SetState(s string) *ChannelUpdateOne

SetState sets the "state" field.

func (*ChannelUpdateOne) SetStateAt

func (cuo *ChannelUpdateOne) SetStateAt(t time.Time) *ChannelUpdateOne

SetStateAt sets the "state_at" field.

func (*ChannelUpdateOne) SetTouched

func (cuo *ChannelUpdateOne) SetTouched(t time.Time) *ChannelUpdateOne

SetTouched sets the "touched" field.

func (*ChannelUpdateOne) SetType

func (cuo *ChannelUpdateOne) SetType(s string) *ChannelUpdateOne

SetType sets the "type" field.

func (*ChannelUpdateOne) SetUpdatedAt

func (cuo *ChannelUpdateOne) SetUpdatedAt(t time.Time) *ChannelUpdateOne

SetUpdatedAt sets the "updated_at" field.

type Channels

type Channels []*Channel

Channels is a parsable slice of Channel.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Channel is the client for interacting with the Channel builders.
	Channel *ChannelClient
	// Device is the client for interacting with the Device builders.
	Device *DeviceClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Recipient is the client for interacting with the Recipient builders.
	Recipient *RecipientClient
	// Subscription is the client for interacting with the Subscription builders.
	Subscription *SubscriptionClient
	// 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().
	Channel.
	Query().
	Count(ctx)

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Device

type Device 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"`
	// UpdatedAt holds the value of the "updated_at" field.
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Hash holds the value of the "hash" field.
	Hash string `json:"hash,omitempty"`
	// DeviceID holds the value of the "device_id" field.
	DeviceID string `json:"device_id,omitempty"`
	// Platform holds the value of the "platform" field.
	Platform string `json:"platform,omitempty"`
	// LastSeen holds the value of the "last_seen" field.
	LastSeen time.Time `json:"last_seen,omitempty"`
	// Language holds the value of the "language" field.
	Language string `json:"language,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) QueryOwner

func (d *Device) QueryOwner() *UserQuery

QueryOwner queries the "owner" 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 uuid.UUID) *DeviceDeleteOne

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

func (*DeviceClient) Get

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

Get returns a Device entity by its id.

func (*DeviceClient) GetX

func (c *DeviceClient) GetX(ctx context.Context, id uuid.UUID) *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) Query

func (c *DeviceClient) Query() *DeviceQuery

Query returns a query builder for Device.

func (*DeviceClient) QueryOwner

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

QueryOwner queries the owner 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 uuid.UUID) *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) 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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DeviceCreate) SetDeviceID

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

SetDeviceID sets the "device_id" field.

func (*DeviceCreate) SetHash

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

SetHash sets the "hash" field.

func (*DeviceCreate) SetID

func (dc *DeviceCreate) SetID(u uuid.UUID) *DeviceCreate

SetID sets the "id" field.

func (*DeviceCreate) SetLanguage

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

SetLanguage sets the "language" field.

func (*DeviceCreate) SetLastSeen

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

SetLastSeen sets the "last_seen" 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) SetOwner

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

SetOwner sets the "owner" edge to the User entity.

func (*DeviceCreate) SetOwnerID

func (dc *DeviceCreate) SetOwnerID(id uuid.UUID) *DeviceCreate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*DeviceCreate) SetPlatform

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

SetPlatform sets the "platform" field.

func (*DeviceCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

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

type DeviceEdges

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

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

func (DeviceEdges) OwnerOrErr

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

OwnerOrErr returns the Owner 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 interface{}) error

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

func (*DeviceGroupBy) ScanX

func (s *DeviceGroupBy) ScanX(ctx context.Context, v interface{})

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

func (m *DeviceMutation) ClearOwner()

ClearOwner clears the "owner" 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) DeviceID

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

DeviceID returns the value of the "device_id" 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) Hash

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

Hash returns the value of the "hash" field in the mutation.

func (*DeviceMutation) ID

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

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

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

Language returns the value of the "language" field in the mutation.

func (*DeviceMutation) LastSeen

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

LastSeen returns the value of the "last_seen" field in the mutation.

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

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

OldDeviceID returns the old "device_id" 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) OldHash

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

OldHash returns the old "hash" 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) OldLanguage

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

OldLanguage returns the old "language" 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) OldLastSeen

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

OldLastSeen returns the old "last_seen" 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) OldPlatform

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

OldPlatform returns the old "platform" 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) OwnerCleared

func (m *DeviceMutation) OwnerCleared() bool

OwnerCleared reports if the "owner" edge to the User entity was cleared.

func (*DeviceMutation) OwnerID

func (m *DeviceMutation) OwnerID() (id uuid.UUID, exists bool)

OwnerID returns the "owner" edge ID in the mutation.

func (*DeviceMutation) OwnerIDs

func (m *DeviceMutation) OwnerIDs() (ids []uuid.UUID)

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

func (*DeviceMutation) Platform

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

Platform returns the value of the "platform" field in the mutation.

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

func (m *DeviceMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*DeviceMutation) ResetDeviceID

func (m *DeviceMutation) ResetDeviceID()

ResetDeviceID resets all changes to the "device_id" 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) ResetHash

func (m *DeviceMutation) ResetHash()

ResetHash resets all changes to the "hash" field.

func (*DeviceMutation) ResetLanguage

func (m *DeviceMutation) ResetLanguage()

ResetLanguage resets all changes to the "language" field.

func (*DeviceMutation) ResetLastSeen

func (m *DeviceMutation) ResetLastSeen()

ResetLastSeen resets all changes to the "last_seen" field.

func (*DeviceMutation) ResetOwner

func (m *DeviceMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*DeviceMutation) ResetPlatform

func (m *DeviceMutation) ResetPlatform()

ResetPlatform resets all changes to the "platform" field.

func (*DeviceMutation) ResetUpdatedAt

func (m *DeviceMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*DeviceMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DeviceMutation) SetDeviceID

func (m *DeviceMutation) SetDeviceID(s string)

SetDeviceID sets the "device_id" 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) SetHash

func (m *DeviceMutation) SetHash(s string)

SetHash sets the "hash" field.

func (*DeviceMutation) SetID

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

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

func (*DeviceMutation) SetLanguage

func (m *DeviceMutation) SetLanguage(s string)

SetLanguage sets the "language" field.

func (*DeviceMutation) SetLastSeen

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

SetLastSeen sets the "last_seen" field.

func (*DeviceMutation) SetOwnerID

func (m *DeviceMutation) SetOwnerID(id uuid.UUID)

SetOwnerID sets the "owner" edge to the User entity by id.

func (*DeviceMutation) SetPlatform

func (m *DeviceMutation) SetPlatform(s string)

SetPlatform sets the "platform" field.

func (*DeviceMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

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

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

Where appends a list predicates to the DeviceMutation builder.

type DeviceQuery

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

DeviceQuery is the builder for querying Device entities.

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 uuid.UUID, 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) uuid.UUID

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(ent.Count()).
	Scan(ctx, &v)

func (*DeviceQuery) IDs

func (dq *DeviceQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*DeviceQuery) IDsX

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

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

func (*DeviceQuery) Limit

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

Limit adds a limit step to the query.

func (*DeviceQuery) Offset

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

Offset adds an offset step to the query.

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 uuid.UUID, 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) uuid.UUID

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 adds an order step to the query.

func (*DeviceQuery) QueryOwner

func (dq *DeviceQuery) QueryOwner() *UserQuery

QueryOwner chains the current query on the "owner" 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) WithOwner

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

WithOwner tells the query-builder to eager-load the nodes that are connected to the "owner" 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) 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 interface{}) 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 interface{})

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

func (du *DeviceUpdate) ClearOwner() *DeviceUpdate

ClearOwner clears the "owner" 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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DeviceUpdate) SetDeviceID

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

SetDeviceID sets the "device_id" field.

func (*DeviceUpdate) SetHash

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

SetHash sets the "hash" field.

func (*DeviceUpdate) SetLanguage

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

SetLanguage sets the "language" field.

func (*DeviceUpdate) SetLastSeen

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

SetLastSeen sets the "last_seen" field.

func (*DeviceUpdate) SetNillableCreatedAt

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

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

func (*DeviceUpdate) SetOwner

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

SetOwner sets the "owner" edge to the User entity.

func (*DeviceUpdate) SetOwnerID

func (du *DeviceUpdate) SetOwnerID(id uuid.UUID) *DeviceUpdate

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*DeviceUpdate) SetPlatform

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

SetPlatform sets the "platform" field.

func (*DeviceUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

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

func (duo *DeviceUpdateOne) ClearOwner() *DeviceUpdateOne

ClearOwner clears the "owner" 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) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*DeviceUpdateOne) SetDeviceID

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

SetDeviceID sets the "device_id" field.

func (*DeviceUpdateOne) SetHash

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

SetHash sets the "hash" field.

func (*DeviceUpdateOne) SetLanguage

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

SetLanguage sets the "language" field.

func (*DeviceUpdateOne) SetLastSeen

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

SetLastSeen sets the "last_seen" field.

func (*DeviceUpdateOne) SetNillableCreatedAt

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

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

func (*DeviceUpdateOne) SetOwner

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

SetOwner sets the "owner" edge to the User entity.

func (*DeviceUpdateOne) SetOwnerID

func (duo *DeviceUpdateOne) SetOwnerID(id uuid.UUID) *DeviceUpdateOne

SetOwnerID sets the "owner" edge to the User entity by ID.

func (*DeviceUpdateOne) SetPlatform

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

SetPlatform sets the "platform" field.

func (*DeviceUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

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 Message

type Message struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// ChannelID holds the value of the "channel_id" field.
	ChannelID uuid.UUID `json:"channel_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"`
	// Sequence holds the value of the "sequence" field.
	Sequence int `json:"sequence,omitempty"`
	// The message header
	Header schema.MessageHeaders `json:"header,omitempty"`
	// The message data
	Content schema.MessageContent `json:"content,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) QueryAuthor

func (m *Message) QueryAuthor() *UserQuery

QueryAuthor queries the "author" edge of the Message entity.

func (*Message) QueryChannel

func (m *Message) QueryChannel() *ChannelQuery

QueryChannel queries the "channel" edge of the Message entity.

func (*Message) QueryMessageRecipients

func (m *Message) QueryMessageRecipients() *UserQuery

QueryMessageRecipients queries the "message_recipients" edge of the Message entity.

func (*Message) QueryRecipients

func (m *Message) QueryRecipients() *RecipientQuery

QueryRecipients queries the "recipients" 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

DeleteOne 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) Query

func (c *MessageClient) Query() *MessageQuery

Query returns a query builder for Message.

func (*MessageClient) QueryAuthor

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

QueryAuthor queries the author edge of a Message.

func (*MessageClient) QueryChannel

func (c *MessageClient) QueryChannel(m *Message) *ChannelQuery

QueryChannel queries the channel edge of a Message.

func (*MessageClient) QueryMessageRecipients

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

QueryMessageRecipients queries the message_recipients edge of a Message.

func (*MessageClient) QueryRecipients

func (c *MessageClient) QueryRecipients(m *Message) *RecipientQuery

QueryRecipients queries the recipients 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) AddMessageRecipientIDs

func (mc *MessageCreate) AddMessageRecipientIDs(ids ...uuid.UUID) *MessageCreate

AddMessageRecipientIDs adds the "message_recipients" edge to the User entity by IDs.

func (*MessageCreate) AddMessageRecipients

func (mc *MessageCreate) AddMessageRecipients(u ...*User) *MessageCreate

AddMessageRecipients adds the "message_recipients" edges to the User 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) 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) SetAuthor

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

SetAuthor sets the "author" edge to the User entity.

func (*MessageCreate) SetAuthorID

func (mc *MessageCreate) SetAuthorID(id uuid.UUID) *MessageCreate

SetAuthorID sets the "author" edge to the User entity by ID.

func (*MessageCreate) SetChannel

func (mc *MessageCreate) SetChannel(c *Channel) *MessageCreate

SetChannel sets the "channel" edge to the Channel entity.

func (*MessageCreate) SetChannelID

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

SetChannelID sets the "channel_id" field.

func (*MessageCreate) SetContent

func (mc *MessageCreate) SetContent(sc schema.MessageContent) *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) SetHeader

func (mc *MessageCreate) SetHeader(sh schema.MessageHeaders) *MessageCreate

SetHeader sets the "header" field.

func (*MessageCreate) SetID

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

SetID sets the "id" 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) SetNillableUpdatedAt

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

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

func (*MessageCreate) SetSequence

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

SetSequence sets the "sequence" field.

func (*MessageCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

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

type MessageEdges

type MessageEdges struct {
	// Author holds the value of the author edge.
	Author *User `json:"author,omitempty"`
	// Channel holds the value of the channel edge.
	Channel *Channel `json:"channel,omitempty"`
	// MessageRecipients holds the value of the message_recipients edge.
	MessageRecipients []*User `json:"message_recipients,omitempty"`
	// Recipients holds the value of the recipients edge.
	Recipients []*Recipient `json:"recipients,omitempty"`
	// contains filtered or unexported fields
}

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

func (MessageEdges) AuthorOrErr

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

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

func (MessageEdges) ChannelOrErr

func (e MessageEdges) ChannelOrErr() (*Channel, error)

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

func (MessageEdges) MessageRecipientsOrErr

func (e MessageEdges) MessageRecipientsOrErr() ([]*User, error)

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

func (MessageEdges) RecipientsOrErr

func (e MessageEdges) RecipientsOrErr() ([]*Recipient, error)

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

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 interface{}) error

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

func (*MessageGroupBy) ScanX

func (s *MessageGroupBy) ScanX(ctx context.Context, v interface{})

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

func (m *MessageMutation) AddMessageRecipientIDs(ids ...uuid.UUID)

AddMessageRecipientIDs adds the "message_recipients" edge to the User entity by ids.

func (*MessageMutation) AddSequence

func (m *MessageMutation) AddSequence(i int)

AddSequence adds i to the "sequence" 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) AddedSequence

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

AddedSequence returns the value that was added to the "sequence" field in this mutation.

func (*MessageMutation) AuthorCleared

func (m *MessageMutation) AuthorCleared() bool

AuthorCleared reports if the "author" edge to the User entity was cleared.

func (*MessageMutation) AuthorID

func (m *MessageMutation) AuthorID() (id uuid.UUID, exists bool)

AuthorID returns the "author" edge ID in the mutation.

func (*MessageMutation) AuthorIDs

func (m *MessageMutation) AuthorIDs() (ids []uuid.UUID)

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

func (*MessageMutation) ChannelCleared

func (m *MessageMutation) ChannelCleared() bool

ChannelCleared reports if the "channel" edge to the Channel entity was cleared.

func (*MessageMutation) ChannelID

func (m *MessageMutation) ChannelID() (r uuid.UUID, exists bool)

ChannelID returns the value of the "channel_id" field in the mutation.

func (*MessageMutation) ChannelIDs

func (m *MessageMutation) ChannelIDs() (ids []uuid.UUID)

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

func (*MessageMutation) ClearAuthor

func (m *MessageMutation) ClearAuthor()

ClearAuthor clears the "author" edge to the User entity.

func (*MessageMutation) ClearChannel

func (m *MessageMutation) ClearChannel()

ClearChannel clears the "channel" edge to the Channel entity.

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

func (m *MessageMutation) ClearMessageRecipients()

ClearMessageRecipients clears the "message_recipients" 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 schema.MessageContent, 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) Header

func (m *MessageMutation) Header() (r schema.MessageHeaders, exists bool)

Header returns the value of the "header" field in the mutation.

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

func (m *MessageMutation) MessageRecipientsCleared() bool

MessageRecipientsCleared reports if the "message_recipients" edge to the User entity was cleared.

func (*MessageMutation) MessageRecipientsIDs

func (m *MessageMutation) MessageRecipientsIDs() (ids []uuid.UUID)

MessageRecipientsIDs returns the "message_recipients" edge IDs in the mutation.

func (*MessageMutation) OldChannelID

func (m *MessageMutation) OldChannelID(ctx context.Context) (v uuid.UUID, err error)

OldChannelID returns the old "channel_id" 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) OldContent

func (m *MessageMutation) OldContent(ctx context.Context) (v schema.MessageContent, 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) OldHeader

func (m *MessageMutation) OldHeader(ctx context.Context) (v schema.MessageHeaders, err error)

OldHeader returns the old "header" 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) OldSequence

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

OldSequence returns the old "sequence" 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) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_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) Op

func (m *MessageMutation) Op() Op

Op returns the operation name.

func (*MessageMutation) RemoveMessageRecipientIDs

func (m *MessageMutation) RemoveMessageRecipientIDs(ids ...uuid.UUID)

RemoveMessageRecipientIDs removes the "message_recipients" edge to the User entity by IDs.

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

func (m *MessageMutation) RemovedMessageRecipientsIDs() (ids []uuid.UUID)

RemovedMessageRecipients returns the removed IDs of the "message_recipients" edge to the User entity.

func (*MessageMutation) ResetAuthor

func (m *MessageMutation) ResetAuthor()

ResetAuthor resets all changes to the "author" edge.

func (*MessageMutation) ResetChannel

func (m *MessageMutation) ResetChannel()

ResetChannel resets all changes to the "channel" edge.

func (*MessageMutation) ResetChannelID

func (m *MessageMutation) ResetChannelID()

ResetChannelID resets all changes to the "channel_id" field.

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

func (m *MessageMutation) ResetHeader()

ResetHeader resets all changes to the "header" field.

func (*MessageMutation) ResetMessageRecipients

func (m *MessageMutation) ResetMessageRecipients()

ResetMessageRecipients resets all changes to the "message_recipients" edge.

func (*MessageMutation) ResetSequence

func (m *MessageMutation) ResetSequence()

ResetSequence resets all changes to the "sequence" field.

func (*MessageMutation) ResetUpdatedAt

func (m *MessageMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*MessageMutation) Sequence

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

Sequence returns the value of the "sequence" field in the mutation.

func (*MessageMutation) SetAuthorID

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

SetAuthorID sets the "author" edge to the User entity by id.

func (*MessageMutation) SetChannelID

func (m *MessageMutation) SetChannelID(u uuid.UUID)

SetChannelID sets the "channel_id" field.

func (*MessageMutation) SetContent

func (m *MessageMutation) SetContent(sc schema.MessageContent)

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

func (m *MessageMutation) SetHeader(sh schema.MessageHeaders)

SetHeader sets the "header" field.

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

func (m *MessageMutation) SetSequence(i int)

SetSequence sets the "sequence" field.

func (*MessageMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

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

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

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

func (*MessageMutation) Where

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

Where appends a list predicates to the MessageMutation builder.

type MessageQuery

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

MessageQuery is the builder for querying Message entities.

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 {
	ChannelID uuid.UUID `json:"channel_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Message.Query().
	GroupBy(message.FieldChannelID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MessageQuery) IDs

func (mq *MessageQuery) IDs(ctx context.Context) ([]uuid.UUID, 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 adds a limit step to the query.

func (*MessageQuery) Offset

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

Offset adds an offset step to the query.

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 adds an order step to the query.

func (*MessageQuery) QueryAuthor

func (mq *MessageQuery) QueryAuthor() *UserQuery

QueryAuthor chains the current query on the "author" edge.

func (*MessageQuery) QueryChannel

func (mq *MessageQuery) QueryChannel() *ChannelQuery

QueryChannel chains the current query on the "channel" edge.

func (*MessageQuery) QueryMessageRecipients

func (mq *MessageQuery) QueryMessageRecipients() *UserQuery

QueryMessageRecipients chains the current query on the "message_recipients" edge.

func (*MessageQuery) QueryRecipients

func (mq *MessageQuery) QueryRecipients() *RecipientQuery

QueryRecipients chains the current query on the "recipients" 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 {
	ChannelID uuid.UUID `json:"channel_id,omitempty"`
}

client.Message.Query().
	Select(message.FieldChannelID).
	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) WithAuthor

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

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

func (*MessageQuery) WithChannel

func (mq *MessageQuery) WithChannel(opts ...func(*ChannelQuery)) *MessageQuery

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

func (*MessageQuery) WithMessageRecipients

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

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

func (*MessageQuery) WithRecipients

func (mq *MessageQuery) WithRecipients(opts ...func(*RecipientQuery)) *MessageQuery

WithRecipients tells the query-builder to eager-load the nodes that are connected to the "recipients" 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) 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 interface{}) 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 interface{})

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

func (mu *MessageUpdate) AddMessageRecipientIDs(ids ...uuid.UUID) *MessageUpdate

AddMessageRecipientIDs adds the "message_recipients" edge to the User entity by IDs.

func (*MessageUpdate) AddMessageRecipients

func (mu *MessageUpdate) AddMessageRecipients(u ...*User) *MessageUpdate

AddMessageRecipients adds the "message_recipients" edges to the User entity.

func (*MessageUpdate) AddSequence

func (mu *MessageUpdate) AddSequence(i int) *MessageUpdate

AddSequence adds i to the "sequence" field.

func (*MessageUpdate) ClearAuthor

func (mu *MessageUpdate) ClearAuthor() *MessageUpdate

ClearAuthor clears the "author" edge to the User entity.

func (*MessageUpdate) ClearChannel

func (mu *MessageUpdate) ClearChannel() *MessageUpdate

ClearChannel clears the "channel" edge to the Channel entity.

func (*MessageUpdate) ClearMessageRecipients

func (mu *MessageUpdate) ClearMessageRecipients() *MessageUpdate

ClearMessageRecipients clears all "message_recipients" edges 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) RemoveMessageRecipientIDs

func (mu *MessageUpdate) RemoveMessageRecipientIDs(ids ...uuid.UUID) *MessageUpdate

RemoveMessageRecipientIDs removes the "message_recipients" edge to User entities by IDs.

func (*MessageUpdate) RemoveMessageRecipients

func (mu *MessageUpdate) RemoveMessageRecipients(u ...*User) *MessageUpdate

RemoveMessageRecipients removes "message_recipients" edges to User entities.

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

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

SetAuthor sets the "author" edge to the User entity.

func (*MessageUpdate) SetAuthorID

func (mu *MessageUpdate) SetAuthorID(id uuid.UUID) *MessageUpdate

SetAuthorID sets the "author" edge to the User entity by ID.

func (*MessageUpdate) SetChannel

func (mu *MessageUpdate) SetChannel(c *Channel) *MessageUpdate

SetChannel sets the "channel" edge to the Channel entity.

func (*MessageUpdate) SetChannelID

func (mu *MessageUpdate) SetChannelID(u uuid.UUID) *MessageUpdate

SetChannelID sets the "channel_id" field.

func (*MessageUpdate) SetContent

func (mu *MessageUpdate) SetContent(sc schema.MessageContent) *MessageUpdate

SetContent sets the "content" field.

func (*MessageUpdate) SetCreatedAt

func (mu *MessageUpdate) SetCreatedAt(t time.Time) *MessageUpdate

SetCreatedAt sets the "created_at" field.

func (*MessageUpdate) SetHeader

func (mu *MessageUpdate) SetHeader(sh schema.MessageHeaders) *MessageUpdate

SetHeader sets the "header" field.

func (*MessageUpdate) SetNillableCreatedAt

func (mu *MessageUpdate) SetNillableCreatedAt(t *time.Time) *MessageUpdate

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

func (*MessageUpdate) SetSequence

func (mu *MessageUpdate) SetSequence(i int) *MessageUpdate

SetSequence sets the "sequence" field.

func (*MessageUpdate) SetUpdatedAt

func (mu *MessageUpdate) SetUpdatedAt(t time.Time) *MessageUpdate

SetUpdatedAt sets the "updated_at" field.

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

func (muo *MessageUpdateOne) AddMessageRecipientIDs(ids ...uuid.UUID) *MessageUpdateOne

AddMessageRecipientIDs adds the "message_recipients" edge to the User entity by IDs.

func (*MessageUpdateOne) AddMessageRecipients

func (muo *MessageUpdateOne) AddMessageRecipients(u ...*User) *MessageUpdateOne

AddMessageRecipients adds the "message_recipients" edges to the User entity.

func (*MessageUpdateOne) AddSequence

func (muo *MessageUpdateOne) AddSequence(i int) *MessageUpdateOne

AddSequence adds i to the "sequence" field.

func (*MessageUpdateOne) ClearAuthor

func (muo *MessageUpdateOne) ClearAuthor() *MessageUpdateOne

ClearAuthor clears the "author" edge to the User entity.

func (*MessageUpdateOne) ClearChannel

func (muo *MessageUpdateOne) ClearChannel() *MessageUpdateOne

ClearChannel clears the "channel" edge to the Channel entity.

func (*MessageUpdateOne) ClearMessageRecipients

func (muo *MessageUpdateOne) ClearMessageRecipients() *MessageUpdateOne

ClearMessageRecipients clears all "message_recipients" edges 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) RemoveMessageRecipientIDs

func (muo *MessageUpdateOne) RemoveMessageRecipientIDs(ids ...uuid.UUID) *MessageUpdateOne

RemoveMessageRecipientIDs removes the "message_recipients" edge to User entities by IDs.

func (*MessageUpdateOne) RemoveMessageRecipients

func (muo *MessageUpdateOne) RemoveMessageRecipients(u ...*User) *MessageUpdateOne

RemoveMessageRecipients removes "message_recipients" edges to User entities.

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

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

SetAuthor sets the "author" edge to the User entity.

func (*MessageUpdateOne) SetAuthorID

func (muo *MessageUpdateOne) SetAuthorID(id uuid.UUID) *MessageUpdateOne

SetAuthorID sets the "author" edge to the User entity by ID.

func (*MessageUpdateOne) SetChannel

func (muo *MessageUpdateOne) SetChannel(c *Channel) *MessageUpdateOne

SetChannel sets the "channel" edge to the Channel entity.

func (*MessageUpdateOne) SetChannelID

func (muo *MessageUpdateOne) SetChannelID(u uuid.UUID) *MessageUpdateOne

SetChannelID sets the "channel_id" field.

func (*MessageUpdateOne) SetContent

SetContent sets the "content" field.

func (*MessageUpdateOne) SetCreatedAt

func (muo *MessageUpdateOne) SetCreatedAt(t time.Time) *MessageUpdateOne

SetCreatedAt sets the "created_at" field.

func (*MessageUpdateOne) SetHeader

SetHeader sets the "header" field.

func (*MessageUpdateOne) SetNillableCreatedAt

func (muo *MessageUpdateOne) SetNillableCreatedAt(t *time.Time) *MessageUpdateOne

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

func (*MessageUpdateOne) SetSequence

func (muo *MessageUpdateOne) SetSequence(i int) *MessageUpdateOne

SetSequence sets the "sequence" field.

func (*MessageUpdateOne) SetUpdatedAt

func (muo *MessageUpdateOne) SetUpdatedAt(t time.Time) *MessageUpdateOne

SetUpdatedAt sets the "updated_at" field.

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(...interface{})) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Query

type Query = ent.Query

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

type Recipient

type Recipient struct {

	// MessageID holds the value of the "message_id" field.
	MessageID uuid.UUID `json:"message_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID uuid.UUID `json:"user_id,omitempty"`
	// Status holds the value of the "status" field.
	Status recipient.Status `json:"status,omitempty"`
	// StatusAt holds the value of the "status_at" field.
	StatusAt time.Time `json:"status_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RecipientQuery when eager-loading is set.
	Edges RecipientEdges `json:"edges"`
	// contains filtered or unexported fields
}

Recipient is the model entity for the Recipient schema.

func (*Recipient) QueryMessage

func (r *Recipient) QueryMessage() *MessageQuery

QueryMessage queries the "message" edge of the Recipient entity.

func (*Recipient) QueryUser

func (r *Recipient) QueryUser() *UserQuery

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

func (*Recipient) String

func (r *Recipient) String() string

String implements the fmt.Stringer.

func (*Recipient) Unwrap

func (r *Recipient) Unwrap() *Recipient

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

func (r *Recipient) Update() *RecipientUpdateOne

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

type RecipientClient

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

RecipientClient is a client for the Recipient schema.

func NewRecipientClient

func NewRecipientClient(c config) *RecipientClient

NewRecipientClient returns a client for the Recipient from the given config.

func (*RecipientClient) Create

func (c *RecipientClient) Create() *RecipientCreate

Create returns a builder for creating a Recipient entity.

func (*RecipientClient) CreateBulk

func (c *RecipientClient) CreateBulk(builders ...*RecipientCreate) *RecipientCreateBulk

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

func (*RecipientClient) Delete

func (c *RecipientClient) Delete() *RecipientDelete

Delete returns a delete builder for Recipient.

func (*RecipientClient) Hooks

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

Hooks returns the client hooks.

func (*RecipientClient) Query

func (c *RecipientClient) Query() *RecipientQuery

Query returns a query builder for Recipient.

func (*RecipientClient) QueryMessage

func (c *RecipientClient) QueryMessage(r *Recipient) *MessageQuery

QueryMessage queries the message edge of a Recipient.

func (*RecipientClient) QueryUser

func (c *RecipientClient) QueryUser(r *Recipient) *UserQuery

QueryUser queries the user edge of a Recipient.

func (*RecipientClient) Update

func (c *RecipientClient) Update() *RecipientUpdate

Update returns an update builder for Recipient.

func (*RecipientClient) UpdateOne

func (c *RecipientClient) UpdateOne(r *Recipient) *RecipientUpdateOne

UpdateOne returns an update builder for the given entity.

func (*RecipientClient) Use

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

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

type RecipientCreate

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

RecipientCreate is the builder for creating a Recipient entity.

func (*RecipientCreate) Exec

func (rc *RecipientCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*RecipientCreate) ExecX

func (rc *RecipientCreate) ExecX(ctx context.Context)

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

func (*RecipientCreate) Mutation

func (rc *RecipientCreate) Mutation() *RecipientMutation

Mutation returns the RecipientMutation object of the builder.

func (*RecipientCreate) Save

func (rc *RecipientCreate) Save(ctx context.Context) (*Recipient, error)

Save creates the Recipient in the database.

func (*RecipientCreate) SaveX

func (rc *RecipientCreate) SaveX(ctx context.Context) *Recipient

SaveX calls Save and panics if Save returns an error.

func (*RecipientCreate) SetMessage

func (rc *RecipientCreate) SetMessage(m *Message) *RecipientCreate

SetMessage sets the "message" edge to the Message entity.

func (*RecipientCreate) SetMessageID

func (rc *RecipientCreate) SetMessageID(u uuid.UUID) *RecipientCreate

SetMessageID sets the "message_id" field.

func (*RecipientCreate) SetStatus

func (rc *RecipientCreate) SetStatus(r recipient.Status) *RecipientCreate

SetStatus sets the "status" field.

func (*RecipientCreate) SetStatusAt

func (rc *RecipientCreate) SetStatusAt(t time.Time) *RecipientCreate

SetStatusAt sets the "status_at" field.

func (*RecipientCreate) SetUser

func (rc *RecipientCreate) SetUser(u *User) *RecipientCreate

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

func (*RecipientCreate) SetUserID

func (rc *RecipientCreate) SetUserID(u uuid.UUID) *RecipientCreate

SetUserID sets the "user_id" field.

type RecipientCreateBulk

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

RecipientCreateBulk is the builder for creating many Recipient entities in bulk.

func (*RecipientCreateBulk) Exec

func (rcb *RecipientCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*RecipientCreateBulk) ExecX

func (rcb *RecipientCreateBulk) ExecX(ctx context.Context)

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

func (*RecipientCreateBulk) Save

func (rcb *RecipientCreateBulk) Save(ctx context.Context) ([]*Recipient, error)

Save creates the Recipient entities in the database.

func (*RecipientCreateBulk) SaveX

func (rcb *RecipientCreateBulk) SaveX(ctx context.Context) []*Recipient

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

type RecipientDelete

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

RecipientDelete is the builder for deleting a Recipient entity.

func (*RecipientDelete) Exec

func (rd *RecipientDelete) Exec(ctx context.Context) (int, error)

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

func (*RecipientDelete) ExecX

func (rd *RecipientDelete) ExecX(ctx context.Context) int

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

func (*RecipientDelete) Where

Where appends a list predicates to the RecipientDelete builder.

type RecipientDeleteOne

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

RecipientDeleteOne is the builder for deleting a single Recipient entity.

func (*RecipientDeleteOne) Exec

func (rdo *RecipientDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*RecipientDeleteOne) ExecX

func (rdo *RecipientDeleteOne) ExecX(ctx context.Context)

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

type RecipientEdges

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

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

func (RecipientEdges) MessageOrErr

func (e RecipientEdges) MessageOrErr() (*Message, error)

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

func (RecipientEdges) UserOrErr

func (e RecipientEdges) 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 RecipientGroupBy

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

RecipientGroupBy is the group-by builder for Recipient entities.

func (*RecipientGroupBy) Aggregate

func (rgb *RecipientGroupBy) Aggregate(fns ...AggregateFunc) *RecipientGroupBy

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

func (*RecipientGroupBy) Bool

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

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

func (*RecipientGroupBy) BoolX

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

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

func (*RecipientGroupBy) Bools

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

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

func (*RecipientGroupBy) BoolsX

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

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

func (*RecipientGroupBy) Float64

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

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

func (*RecipientGroupBy) Float64X

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

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

func (*RecipientGroupBy) Float64s

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

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

func (*RecipientGroupBy) Float64sX

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

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

func (*RecipientGroupBy) Int

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

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

func (*RecipientGroupBy) IntX

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

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

func (*RecipientGroupBy) Ints

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

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

func (*RecipientGroupBy) IntsX

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

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

func (*RecipientGroupBy) Scan

func (rgb *RecipientGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*RecipientGroupBy) ScanX

func (s *RecipientGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*RecipientGroupBy) String

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

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

func (*RecipientGroupBy) StringX

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

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

func (*RecipientGroupBy) Strings

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

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

func (*RecipientGroupBy) StringsX

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

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

type RecipientMutation

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

RecipientMutation represents an operation that mutates the Recipient nodes in the graph.

func (*RecipientMutation) AddField

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

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

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

func (*RecipientMutation) AddedField

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

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

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

func (*RecipientMutation) AddedIDs

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

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

func (*RecipientMutation) ClearEdge

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

func (m *RecipientMutation) 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 (*RecipientMutation) ClearMessage

func (m *RecipientMutation) ClearMessage()

ClearMessage clears the "message" edge to the Message entity.

func (*RecipientMutation) ClearUser

func (m *RecipientMutation) ClearUser()

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

func (*RecipientMutation) ClearedEdges

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

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

func (*RecipientMutation) ClearedFields

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

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

func (RecipientMutation) Client

func (m RecipientMutation) 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 (*RecipientMutation) EdgeCleared

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

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

func (*RecipientMutation) Field

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

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

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

func (*RecipientMutation) Fields

func (m *RecipientMutation) 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 (*RecipientMutation) MessageCleared

func (m *RecipientMutation) MessageCleared() bool

MessageCleared reports if the "message" edge to the Message entity was cleared.

func (*RecipientMutation) MessageID

func (m *RecipientMutation) MessageID() (r uuid.UUID, exists bool)

MessageID returns the value of the "message_id" field in the mutation.

func (*RecipientMutation) MessageIDs

func (m *RecipientMutation) MessageIDs() (ids []uuid.UUID)

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

func (*RecipientMutation) OldField

func (m *RecipientMutation) 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 (*RecipientMutation) Op

func (m *RecipientMutation) Op() Op

Op returns the operation name.

func (*RecipientMutation) RemovedEdges

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

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

func (*RecipientMutation) RemovedIDs

func (m *RecipientMutation) 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 (*RecipientMutation) ResetEdge

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

func (m *RecipientMutation) 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 (*RecipientMutation) ResetMessage

func (m *RecipientMutation) ResetMessage()

ResetMessage resets all changes to the "message" edge.

func (*RecipientMutation) ResetMessageID

func (m *RecipientMutation) ResetMessageID()

ResetMessageID resets all changes to the "message_id" field.

func (*RecipientMutation) ResetStatus

func (m *RecipientMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*RecipientMutation) ResetStatusAt

func (m *RecipientMutation) ResetStatusAt()

ResetStatusAt resets all changes to the "status_at" field.

func (*RecipientMutation) ResetUser

func (m *RecipientMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*RecipientMutation) ResetUserID

func (m *RecipientMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*RecipientMutation) SetField

func (m *RecipientMutation) 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 (*RecipientMutation) SetMessageID

func (m *RecipientMutation) SetMessageID(u uuid.UUID)

SetMessageID sets the "message_id" field.

func (*RecipientMutation) SetStatus

func (m *RecipientMutation) SetStatus(r recipient.Status)

SetStatus sets the "status" field.

func (*RecipientMutation) SetStatusAt

func (m *RecipientMutation) SetStatusAt(t time.Time)

SetStatusAt sets the "status_at" field.

func (*RecipientMutation) SetUserID

func (m *RecipientMutation) SetUserID(u uuid.UUID)

SetUserID sets the "user_id" field.

func (*RecipientMutation) Status

func (m *RecipientMutation) Status() (r recipient.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (*RecipientMutation) StatusAt

func (m *RecipientMutation) StatusAt() (r time.Time, exists bool)

StatusAt returns the value of the "status_at" field in the mutation.

func (RecipientMutation) Tx

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

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

func (*RecipientMutation) Type

func (m *RecipientMutation) Type() string

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

func (*RecipientMutation) UserCleared

func (m *RecipientMutation) UserCleared() bool

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

func (*RecipientMutation) UserID

func (m *RecipientMutation) UserID() (r uuid.UUID, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*RecipientMutation) UserIDs

func (m *RecipientMutation) UserIDs() (ids []uuid.UUID)

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

func (m *RecipientMutation) Where(ps ...predicate.Recipient)

Where appends a list predicates to the RecipientMutation builder.

type RecipientQuery

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

RecipientQuery is the builder for querying Recipient entities.

func (*RecipientQuery) All

func (rq *RecipientQuery) All(ctx context.Context) ([]*Recipient, error)

All executes the query and returns a list of Recipients.

func (*RecipientQuery) AllX

func (rq *RecipientQuery) AllX(ctx context.Context) []*Recipient

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

func (*RecipientQuery) Clone

func (rq *RecipientQuery) Clone() *RecipientQuery

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

func (*RecipientQuery) Count

func (rq *RecipientQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RecipientQuery) CountX

func (rq *RecipientQuery) CountX(ctx context.Context) int

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

func (*RecipientQuery) Exist

func (rq *RecipientQuery) Exist(ctx context.Context) (bool, error)

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

func (*RecipientQuery) ExistX

func (rq *RecipientQuery) ExistX(ctx context.Context) bool

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

func (*RecipientQuery) First

func (rq *RecipientQuery) First(ctx context.Context) (*Recipient, error)

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

func (*RecipientQuery) FirstX

func (rq *RecipientQuery) FirstX(ctx context.Context) *Recipient

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

func (*RecipientQuery) GroupBy

func (rq *RecipientQuery) GroupBy(field string, fields ...string) *RecipientGroupBy

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 {
	MessageID uuid.UUID `json:"message_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Recipient.Query().
	GroupBy(recipient.FieldMessageID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*RecipientQuery) Limit

func (rq *RecipientQuery) Limit(limit int) *RecipientQuery

Limit adds a limit step to the query.

func (*RecipientQuery) Offset

func (rq *RecipientQuery) Offset(offset int) *RecipientQuery

Offset adds an offset step to the query.

func (*RecipientQuery) Only

func (rq *RecipientQuery) Only(ctx context.Context) (*Recipient, error)

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

func (*RecipientQuery) OnlyX

func (rq *RecipientQuery) OnlyX(ctx context.Context) *Recipient

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

func (*RecipientQuery) Order

func (rq *RecipientQuery) Order(o ...OrderFunc) *RecipientQuery

Order adds an order step to the query.

func (*RecipientQuery) QueryMessage

func (rq *RecipientQuery) QueryMessage() *MessageQuery

QueryMessage chains the current query on the "message" edge.

func (*RecipientQuery) QueryUser

func (rq *RecipientQuery) QueryUser() *UserQuery

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

func (*RecipientQuery) Select

func (rq *RecipientQuery) Select(fields ...string) *RecipientSelect

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 {
	MessageID uuid.UUID `json:"message_id,omitempty"`
}

client.Recipient.Query().
	Select(recipient.FieldMessageID).
	Scan(ctx, &v)

func (*RecipientQuery) Unique

func (rq *RecipientQuery) Unique(unique bool) *RecipientQuery

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

Where adds a new predicate for the RecipientQuery builder.

func (*RecipientQuery) WithMessage

func (rq *RecipientQuery) WithMessage(opts ...func(*MessageQuery)) *RecipientQuery

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

func (*RecipientQuery) WithUser

func (rq *RecipientQuery) WithUser(opts ...func(*UserQuery)) *RecipientQuery

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 RecipientSelect

type RecipientSelect struct {
	*RecipientQuery
	// contains filtered or unexported fields
}

RecipientSelect is the builder for selecting fields of Recipient entities.

func (*RecipientSelect) Bool

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

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

func (*RecipientSelect) BoolX

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

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

func (*RecipientSelect) Bools

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

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

func (*RecipientSelect) BoolsX

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

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

func (*RecipientSelect) Float64

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

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

func (*RecipientSelect) Float64X

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

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

func (*RecipientSelect) Float64s

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

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

func (*RecipientSelect) Float64sX

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

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

func (*RecipientSelect) Int

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

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

func (*RecipientSelect) IntX

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

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

func (*RecipientSelect) Ints

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

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

func (*RecipientSelect) IntsX

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

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

func (*RecipientSelect) Scan

func (rs *RecipientSelect) Scan(ctx context.Context, v interface{}) error

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

func (*RecipientSelect) ScanX

func (s *RecipientSelect) ScanX(ctx context.Context, v interface{})

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

func (*RecipientSelect) String

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

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

func (*RecipientSelect) StringX

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

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

func (*RecipientSelect) Strings

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

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

func (*RecipientSelect) StringsX

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

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

type RecipientUpdate

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

RecipientUpdate is the builder for updating Recipient entities.

func (*RecipientUpdate) ClearMessage

func (ru *RecipientUpdate) ClearMessage() *RecipientUpdate

ClearMessage clears the "message" edge to the Message entity.

func (*RecipientUpdate) ClearUser

func (ru *RecipientUpdate) ClearUser() *RecipientUpdate

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

func (*RecipientUpdate) Exec

func (ru *RecipientUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*RecipientUpdate) ExecX

func (ru *RecipientUpdate) ExecX(ctx context.Context)

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

func (*RecipientUpdate) Mutation

func (ru *RecipientUpdate) Mutation() *RecipientMutation

Mutation returns the RecipientMutation object of the builder.

func (*RecipientUpdate) Save

func (ru *RecipientUpdate) Save(ctx context.Context) (int, error)

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

func (*RecipientUpdate) SaveX

func (ru *RecipientUpdate) SaveX(ctx context.Context) int

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

func (*RecipientUpdate) SetMessage

func (ru *RecipientUpdate) SetMessage(m *Message) *RecipientUpdate

SetMessage sets the "message" edge to the Message entity.

func (*RecipientUpdate) SetMessageID

func (ru *RecipientUpdate) SetMessageID(u uuid.UUID) *RecipientUpdate

SetMessageID sets the "message_id" field.

func (*RecipientUpdate) SetStatus

func (ru *RecipientUpdate) SetStatus(r recipient.Status) *RecipientUpdate

SetStatus sets the "status" field.

func (*RecipientUpdate) SetStatusAt

func (ru *RecipientUpdate) SetStatusAt(t time.Time) *RecipientUpdate

SetStatusAt sets the "status_at" field.

func (*RecipientUpdate) SetUser

func (ru *RecipientUpdate) SetUser(u *User) *RecipientUpdate

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

func (*RecipientUpdate) SetUserID

func (ru *RecipientUpdate) SetUserID(u uuid.UUID) *RecipientUpdate

SetUserID sets the "user_id" field.

func (*RecipientUpdate) Where

Where appends a list predicates to the RecipientUpdate builder.

type RecipientUpdateOne

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

RecipientUpdateOne is the builder for updating a single Recipient entity.

func (*RecipientUpdateOne) ClearMessage

func (ruo *RecipientUpdateOne) ClearMessage() *RecipientUpdateOne

ClearMessage clears the "message" edge to the Message entity.

func (*RecipientUpdateOne) ClearUser

func (ruo *RecipientUpdateOne) ClearUser() *RecipientUpdateOne

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

func (*RecipientUpdateOne) Exec

func (ruo *RecipientUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*RecipientUpdateOne) ExecX

func (ruo *RecipientUpdateOne) ExecX(ctx context.Context)

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

func (*RecipientUpdateOne) Mutation

func (ruo *RecipientUpdateOne) Mutation() *RecipientMutation

Mutation returns the RecipientMutation object of the builder.

func (*RecipientUpdateOne) Save

func (ruo *RecipientUpdateOne) Save(ctx context.Context) (*Recipient, error)

Save executes the query and returns the updated Recipient entity.

func (*RecipientUpdateOne) SaveX

func (ruo *RecipientUpdateOne) SaveX(ctx context.Context) *Recipient

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

func (*RecipientUpdateOne) Select

func (ruo *RecipientUpdateOne) Select(field string, fields ...string) *RecipientUpdateOne

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

func (*RecipientUpdateOne) SetMessage

func (ruo *RecipientUpdateOne) SetMessage(m *Message) *RecipientUpdateOne

SetMessage sets the "message" edge to the Message entity.

func (*RecipientUpdateOne) SetMessageID

func (ruo *RecipientUpdateOne) SetMessageID(u uuid.UUID) *RecipientUpdateOne

SetMessageID sets the "message_id" field.

func (*RecipientUpdateOne) SetStatus

SetStatus sets the "status" field.

func (*RecipientUpdateOne) SetStatusAt

func (ruo *RecipientUpdateOne) SetStatusAt(t time.Time) *RecipientUpdateOne

SetStatusAt sets the "status_at" field.

func (*RecipientUpdateOne) SetUser

func (ruo *RecipientUpdateOne) SetUser(u *User) *RecipientUpdateOne

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

func (*RecipientUpdateOne) SetUserID

func (ruo *RecipientUpdateOne) SetUserID(u uuid.UUID) *RecipientUpdateOne

SetUserID sets the "user_id" field.

type Recipients

type Recipients []*Recipient

Recipients is a parsable slice of Recipient.

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 Subscription

type Subscription struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// ChannelID holds the value of the "channel_id" field.
	ChannelID uuid.UUID `json:"channel_id,omitempty"`
	// UserID holds the value of the "user_id" field.
	UserID uuid.UUID `json:"user_id,omitempty"`
	// Authorizations in channel i.e admin, moderator etc
	Role string `json:"role,omitempty"`
	// Access to channel i.e ok, banned
	Status string `json:"status,omitempty"`
	// Pinned holds the value of the "pinned" field.
	Pinned bool `json:"pinned,omitempty"`
	// PinnedAt holds the value of the "pinned_at" field.
	PinnedAt time.Time `json:"pinned_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the SubscriptionQuery when eager-loading is set.
	Edges SubscriptionEdges `json:"edges"`
	// contains filtered or unexported fields
}

Subscription is the model entity for the Subscription schema.

func (*Subscription) QueryChannel

func (s *Subscription) QueryChannel() *ChannelQuery

QueryChannel queries the "channel" edge of the Subscription entity.

func (*Subscription) QueryUser

func (s *Subscription) QueryUser() *UserQuery

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

func (*Subscription) String

func (s *Subscription) String() string

String implements the fmt.Stringer.

func (*Subscription) Unwrap

func (s *Subscription) Unwrap() *Subscription

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

func (s *Subscription) Update() *SubscriptionUpdateOne

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

type SubscriptionClient

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

SubscriptionClient is a client for the Subscription schema.

func NewSubscriptionClient

func NewSubscriptionClient(c config) *SubscriptionClient

NewSubscriptionClient returns a client for the Subscription from the given config.

func (*SubscriptionClient) Create

Create returns a builder for creating a Subscription entity.

func (*SubscriptionClient) CreateBulk

func (c *SubscriptionClient) CreateBulk(builders ...*SubscriptionCreate) *SubscriptionCreateBulk

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

func (*SubscriptionClient) Delete

Delete returns a delete builder for Subscription.

func (*SubscriptionClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SubscriptionClient) DeleteOneID

func (c *SubscriptionClient) DeleteOneID(id uuid.UUID) *SubscriptionDeleteOne

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

func (*SubscriptionClient) Get

Get returns a Subscription entity by its id.

func (*SubscriptionClient) GetX

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

func (*SubscriptionClient) Hooks

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

Hooks returns the client hooks.

func (*SubscriptionClient) Query

Query returns a query builder for Subscription.

func (*SubscriptionClient) QueryChannel

func (c *SubscriptionClient) QueryChannel(s *Subscription) *ChannelQuery

QueryChannel queries the channel edge of a Subscription.

func (*SubscriptionClient) QueryUser

func (c *SubscriptionClient) QueryUser(s *Subscription) *UserQuery

QueryUser queries the user edge of a Subscription.

func (*SubscriptionClient) Update

Update returns an update builder for Subscription.

func (*SubscriptionClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*SubscriptionClient) UpdateOneID

func (c *SubscriptionClient) UpdateOneID(id uuid.UUID) *SubscriptionUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SubscriptionClient) Use

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

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

type SubscriptionCreate

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

SubscriptionCreate is the builder for creating a Subscription entity.

func (*SubscriptionCreate) Exec

func (sc *SubscriptionCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SubscriptionCreate) ExecX

func (sc *SubscriptionCreate) ExecX(ctx context.Context)

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

func (*SubscriptionCreate) Mutation

func (sc *SubscriptionCreate) Mutation() *SubscriptionMutation

Mutation returns the SubscriptionMutation object of the builder.

func (*SubscriptionCreate) Save

Save creates the Subscription in the database.

func (*SubscriptionCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*SubscriptionCreate) SetChannel

func (sc *SubscriptionCreate) SetChannel(c *Channel) *SubscriptionCreate

SetChannel sets the "channel" edge to the Channel entity.

func (*SubscriptionCreate) SetChannelID

func (sc *SubscriptionCreate) SetChannelID(u uuid.UUID) *SubscriptionCreate

SetChannelID sets the "channel_id" field.

func (*SubscriptionCreate) SetID

SetID sets the "id" field.

func (*SubscriptionCreate) SetNillablePinned

func (sc *SubscriptionCreate) SetNillablePinned(b *bool) *SubscriptionCreate

SetNillablePinned sets the "pinned" field if the given value is not nil.

func (*SubscriptionCreate) SetNillablePinnedAt

func (sc *SubscriptionCreate) SetNillablePinnedAt(t *time.Time) *SubscriptionCreate

SetNillablePinnedAt sets the "pinned_at" field if the given value is not nil.

func (*SubscriptionCreate) SetPinned

func (sc *SubscriptionCreate) SetPinned(b bool) *SubscriptionCreate

SetPinned sets the "pinned" field.

func (*SubscriptionCreate) SetPinnedAt

func (sc *SubscriptionCreate) SetPinnedAt(t time.Time) *SubscriptionCreate

SetPinnedAt sets the "pinned_at" field.

func (*SubscriptionCreate) SetRole

SetRole sets the "role" field.

func (*SubscriptionCreate) SetStatus

func (sc *SubscriptionCreate) SetStatus(s string) *SubscriptionCreate

SetStatus sets the "status" field.

func (*SubscriptionCreate) SetUser

func (sc *SubscriptionCreate) SetUser(u *User) *SubscriptionCreate

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

func (*SubscriptionCreate) SetUserID

func (sc *SubscriptionCreate) SetUserID(u uuid.UUID) *SubscriptionCreate

SetUserID sets the "user_id" field.

type SubscriptionCreateBulk

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

SubscriptionCreateBulk is the builder for creating many Subscription entities in bulk.

func (*SubscriptionCreateBulk) Exec

Exec executes the query.

func (*SubscriptionCreateBulk) ExecX

func (scb *SubscriptionCreateBulk) ExecX(ctx context.Context)

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

func (*SubscriptionCreateBulk) Save

Save creates the Subscription entities in the database.

func (*SubscriptionCreateBulk) SaveX

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

type SubscriptionDelete

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

SubscriptionDelete is the builder for deleting a Subscription entity.

func (*SubscriptionDelete) Exec

func (sd *SubscriptionDelete) Exec(ctx context.Context) (int, error)

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

func (*SubscriptionDelete) ExecX

func (sd *SubscriptionDelete) ExecX(ctx context.Context) int

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

func (*SubscriptionDelete) Where

Where appends a list predicates to the SubscriptionDelete builder.

type SubscriptionDeleteOne

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

SubscriptionDeleteOne is the builder for deleting a single Subscription entity.

func (*SubscriptionDeleteOne) Exec

func (sdo *SubscriptionDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SubscriptionDeleteOne) ExecX

func (sdo *SubscriptionDeleteOne) ExecX(ctx context.Context)

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

type SubscriptionEdges

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

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

func (SubscriptionEdges) ChannelOrErr

func (e SubscriptionEdges) ChannelOrErr() (*Channel, error)

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

func (SubscriptionEdges) UserOrErr

func (e SubscriptionEdges) 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 SubscriptionGroupBy

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

SubscriptionGroupBy is the group-by builder for Subscription entities.

func (*SubscriptionGroupBy) Aggregate

func (sgb *SubscriptionGroupBy) Aggregate(fns ...AggregateFunc) *SubscriptionGroupBy

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

func (*SubscriptionGroupBy) Bool

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

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

func (*SubscriptionGroupBy) BoolX

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

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

func (*SubscriptionGroupBy) Bools

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

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

func (*SubscriptionGroupBy) BoolsX

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

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

func (*SubscriptionGroupBy) Float64

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

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

func (*SubscriptionGroupBy) Float64X

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

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

func (*SubscriptionGroupBy) Float64s

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

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

func (*SubscriptionGroupBy) Float64sX

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

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

func (*SubscriptionGroupBy) Int

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

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

func (*SubscriptionGroupBy) IntX

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

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

func (*SubscriptionGroupBy) Ints

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

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

func (*SubscriptionGroupBy) IntsX

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

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

func (*SubscriptionGroupBy) Scan

func (sgb *SubscriptionGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*SubscriptionGroupBy) ScanX

func (s *SubscriptionGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*SubscriptionGroupBy) String

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

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

func (*SubscriptionGroupBy) StringX

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

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

func (*SubscriptionGroupBy) Strings

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

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

func (*SubscriptionGroupBy) StringsX

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

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

type SubscriptionMutation

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

SubscriptionMutation represents an operation that mutates the Subscription nodes in the graph.

func (*SubscriptionMutation) AddField

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

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

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

func (*SubscriptionMutation) AddedField

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

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

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

func (*SubscriptionMutation) AddedIDs

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

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

func (*SubscriptionMutation) ChannelCleared

func (m *SubscriptionMutation) ChannelCleared() bool

ChannelCleared reports if the "channel" edge to the Channel entity was cleared.

func (*SubscriptionMutation) ChannelID

func (m *SubscriptionMutation) ChannelID() (r uuid.UUID, exists bool)

ChannelID returns the value of the "channel_id" field in the mutation.

func (*SubscriptionMutation) ChannelIDs

func (m *SubscriptionMutation) ChannelIDs() (ids []uuid.UUID)

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

func (*SubscriptionMutation) ClearChannel

func (m *SubscriptionMutation) ClearChannel()

ClearChannel clears the "channel" edge to the Channel entity.

func (*SubscriptionMutation) ClearEdge

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

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) ClearPinned

func (m *SubscriptionMutation) ClearPinned()

ClearPinned clears the value of the "pinned" field.

func (*SubscriptionMutation) ClearPinnedAt

func (m *SubscriptionMutation) ClearPinnedAt()

ClearPinnedAt clears the value of the "pinned_at" field.

func (*SubscriptionMutation) ClearUser

func (m *SubscriptionMutation) ClearUser()

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

func (*SubscriptionMutation) ClearedEdges

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

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

func (*SubscriptionMutation) ClearedFields

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

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

func (SubscriptionMutation) Client

func (m SubscriptionMutation) 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 (*SubscriptionMutation) EdgeCleared

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

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

func (*SubscriptionMutation) Field

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

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

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

func (*SubscriptionMutation) Fields

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

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

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

func (*SubscriptionMutation) OldChannelID

func (m *SubscriptionMutation) OldChannelID(ctx context.Context) (v uuid.UUID, err error)

OldChannelID returns the old "channel_id" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) OldField

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) OldPinned

func (m *SubscriptionMutation) OldPinned(ctx context.Context) (v bool, err error)

OldPinned returns the old "pinned" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) OldPinnedAt

func (m *SubscriptionMutation) OldPinnedAt(ctx context.Context) (v time.Time, err error)

OldPinnedAt returns the old "pinned_at" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) OldRole

func (m *SubscriptionMutation) OldRole(ctx context.Context) (v string, err error)

OldRole returns the old "role" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) OldStatus

func (m *SubscriptionMutation) OldStatus(ctx context.Context) (v string, err error)

OldStatus returns the old "status" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) OldUserID

func (m *SubscriptionMutation) OldUserID(ctx context.Context) (v uuid.UUID, err error)

OldUserID returns the old "user_id" field's value of the Subscription entity. If the Subscription 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 (*SubscriptionMutation) Op

func (m *SubscriptionMutation) Op() Op

Op returns the operation name.

func (*SubscriptionMutation) Pinned

func (m *SubscriptionMutation) Pinned() (r bool, exists bool)

Pinned returns the value of the "pinned" field in the mutation.

func (*SubscriptionMutation) PinnedAt

func (m *SubscriptionMutation) PinnedAt() (r time.Time, exists bool)

PinnedAt returns the value of the "pinned_at" field in the mutation.

func (*SubscriptionMutation) PinnedAtCleared

func (m *SubscriptionMutation) PinnedAtCleared() bool

PinnedAtCleared returns if the "pinned_at" field was cleared in this mutation.

func (*SubscriptionMutation) PinnedCleared

func (m *SubscriptionMutation) PinnedCleared() bool

PinnedCleared returns if the "pinned" field was cleared in this mutation.

func (*SubscriptionMutation) RemovedEdges

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

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

func (*SubscriptionMutation) RemovedIDs

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

func (m *SubscriptionMutation) ResetChannel()

ResetChannel resets all changes to the "channel" edge.

func (*SubscriptionMutation) ResetChannelID

func (m *SubscriptionMutation) ResetChannelID()

ResetChannelID resets all changes to the "channel_id" field.

func (*SubscriptionMutation) ResetEdge

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

func (m *SubscriptionMutation) 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 (*SubscriptionMutation) ResetPinned

func (m *SubscriptionMutation) ResetPinned()

ResetPinned resets all changes to the "pinned" field.

func (*SubscriptionMutation) ResetPinnedAt

func (m *SubscriptionMutation) ResetPinnedAt()

ResetPinnedAt resets all changes to the "pinned_at" field.

func (*SubscriptionMutation) ResetRole

func (m *SubscriptionMutation) ResetRole()

ResetRole resets all changes to the "role" field.

func (*SubscriptionMutation) ResetStatus

func (m *SubscriptionMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*SubscriptionMutation) ResetUser

func (m *SubscriptionMutation) ResetUser()

ResetUser resets all changes to the "user" edge.

func (*SubscriptionMutation) ResetUserID

func (m *SubscriptionMutation) ResetUserID()

ResetUserID resets all changes to the "user_id" field.

func (*SubscriptionMutation) Role

func (m *SubscriptionMutation) Role() (r string, exists bool)

Role returns the value of the "role" field in the mutation.

func (*SubscriptionMutation) SetChannelID

func (m *SubscriptionMutation) SetChannelID(u uuid.UUID)

SetChannelID sets the "channel_id" field.

func (*SubscriptionMutation) SetField

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

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

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

func (*SubscriptionMutation) SetPinned

func (m *SubscriptionMutation) SetPinned(b bool)

SetPinned sets the "pinned" field.

func (*SubscriptionMutation) SetPinnedAt

func (m *SubscriptionMutation) SetPinnedAt(t time.Time)

SetPinnedAt sets the "pinned_at" field.

func (*SubscriptionMutation) SetRole

func (m *SubscriptionMutation) SetRole(s string)

SetRole sets the "role" field.

func (*SubscriptionMutation) SetStatus

func (m *SubscriptionMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*SubscriptionMutation) SetUserID

func (m *SubscriptionMutation) SetUserID(u uuid.UUID)

SetUserID sets the "user_id" field.

func (*SubscriptionMutation) Status

func (m *SubscriptionMutation) Status() (r string, exists bool)

Status returns the value of the "status" field in the mutation.

func (SubscriptionMutation) Tx

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

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

func (*SubscriptionMutation) Type

func (m *SubscriptionMutation) Type() string

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

func (*SubscriptionMutation) UserCleared

func (m *SubscriptionMutation) UserCleared() bool

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

func (*SubscriptionMutation) UserID

func (m *SubscriptionMutation) UserID() (r uuid.UUID, exists bool)

UserID returns the value of the "user_id" field in the mutation.

func (*SubscriptionMutation) UserIDs

func (m *SubscriptionMutation) UserIDs() (ids []uuid.UUID)

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

Where appends a list predicates to the SubscriptionMutation builder.

type SubscriptionQuery

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

SubscriptionQuery is the builder for querying Subscription entities.

func (*SubscriptionQuery) All

func (sq *SubscriptionQuery) All(ctx context.Context) ([]*Subscription, error)

All executes the query and returns a list of Subscriptions.

func (*SubscriptionQuery) AllX

func (sq *SubscriptionQuery) AllX(ctx context.Context) []*Subscription

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

func (*SubscriptionQuery) Clone

func (sq *SubscriptionQuery) Clone() *SubscriptionQuery

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

func (*SubscriptionQuery) Count

func (sq *SubscriptionQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SubscriptionQuery) CountX

func (sq *SubscriptionQuery) CountX(ctx context.Context) int

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

func (*SubscriptionQuery) Exist

func (sq *SubscriptionQuery) Exist(ctx context.Context) (bool, error)

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

func (*SubscriptionQuery) ExistX

func (sq *SubscriptionQuery) ExistX(ctx context.Context) bool

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

func (*SubscriptionQuery) First

func (sq *SubscriptionQuery) First(ctx context.Context) (*Subscription, error)

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

func (*SubscriptionQuery) FirstID

func (sq *SubscriptionQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*SubscriptionQuery) FirstIDX

func (sq *SubscriptionQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*SubscriptionQuery) FirstX

func (sq *SubscriptionQuery) FirstX(ctx context.Context) *Subscription

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

func (*SubscriptionQuery) GroupBy

func (sq *SubscriptionQuery) GroupBy(field string, fields ...string) *SubscriptionGroupBy

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 {
	ChannelID uuid.UUID `json:"channel_id,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Subscription.Query().
	GroupBy(subscription.FieldChannelID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SubscriptionQuery) IDs

func (sq *SubscriptionQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*SubscriptionQuery) IDsX

func (sq *SubscriptionQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*SubscriptionQuery) Limit

func (sq *SubscriptionQuery) Limit(limit int) *SubscriptionQuery

Limit adds a limit step to the query.

func (*SubscriptionQuery) Offset

func (sq *SubscriptionQuery) Offset(offset int) *SubscriptionQuery

Offset adds an offset step to the query.

func (*SubscriptionQuery) Only

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

func (*SubscriptionQuery) OnlyID

func (sq *SubscriptionQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*SubscriptionQuery) OnlyIDX

func (sq *SubscriptionQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*SubscriptionQuery) OnlyX

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

func (*SubscriptionQuery) Order

Order adds an order step to the query.

func (*SubscriptionQuery) QueryChannel

func (sq *SubscriptionQuery) QueryChannel() *ChannelQuery

QueryChannel chains the current query on the "channel" edge.

func (*SubscriptionQuery) QueryUser

func (sq *SubscriptionQuery) QueryUser() *UserQuery

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

func (*SubscriptionQuery) Select

func (sq *SubscriptionQuery) Select(fields ...string) *SubscriptionSelect

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 {
	ChannelID uuid.UUID `json:"channel_id,omitempty"`
}

client.Subscription.Query().
	Select(subscription.FieldChannelID).
	Scan(ctx, &v)

func (*SubscriptionQuery) Unique

func (sq *SubscriptionQuery) Unique(unique bool) *SubscriptionQuery

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

Where adds a new predicate for the SubscriptionQuery builder.

func (*SubscriptionQuery) WithChannel

func (sq *SubscriptionQuery) WithChannel(opts ...func(*ChannelQuery)) *SubscriptionQuery

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

func (*SubscriptionQuery) WithUser

func (sq *SubscriptionQuery) WithUser(opts ...func(*UserQuery)) *SubscriptionQuery

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 SubscriptionSelect

type SubscriptionSelect struct {
	*SubscriptionQuery
	// contains filtered or unexported fields
}

SubscriptionSelect is the builder for selecting fields of Subscription entities.

func (*SubscriptionSelect) Bool

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

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

func (*SubscriptionSelect) BoolX

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

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

func (*SubscriptionSelect) Bools

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

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

func (*SubscriptionSelect) BoolsX

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

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

func (*SubscriptionSelect) Float64

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

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

func (*SubscriptionSelect) Float64X

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

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

func (*SubscriptionSelect) Float64s

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

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

func (*SubscriptionSelect) Float64sX

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

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

func (*SubscriptionSelect) Int

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

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

func (*SubscriptionSelect) IntX

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

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

func (*SubscriptionSelect) Ints

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

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

func (*SubscriptionSelect) IntsX

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

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

func (*SubscriptionSelect) Scan

func (ss *SubscriptionSelect) Scan(ctx context.Context, v interface{}) error

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

func (*SubscriptionSelect) ScanX

func (s *SubscriptionSelect) ScanX(ctx context.Context, v interface{})

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

func (*SubscriptionSelect) String

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

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

func (*SubscriptionSelect) StringX

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

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

func (*SubscriptionSelect) Strings

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

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

func (*SubscriptionSelect) StringsX

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

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

type SubscriptionUpdate

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

SubscriptionUpdate is the builder for updating Subscription entities.

func (*SubscriptionUpdate) ClearChannel

func (su *SubscriptionUpdate) ClearChannel() *SubscriptionUpdate

ClearChannel clears the "channel" edge to the Channel entity.

func (*SubscriptionUpdate) ClearPinned

func (su *SubscriptionUpdate) ClearPinned() *SubscriptionUpdate

ClearPinned clears the value of the "pinned" field.

func (*SubscriptionUpdate) ClearPinnedAt

func (su *SubscriptionUpdate) ClearPinnedAt() *SubscriptionUpdate

ClearPinnedAt clears the value of the "pinned_at" field.

func (*SubscriptionUpdate) ClearUser

func (su *SubscriptionUpdate) ClearUser() *SubscriptionUpdate

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

func (*SubscriptionUpdate) Exec

func (su *SubscriptionUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SubscriptionUpdate) ExecX

func (su *SubscriptionUpdate) ExecX(ctx context.Context)

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

func (*SubscriptionUpdate) Mutation

func (su *SubscriptionUpdate) Mutation() *SubscriptionMutation

Mutation returns the SubscriptionMutation object of the builder.

func (*SubscriptionUpdate) Save

func (su *SubscriptionUpdate) Save(ctx context.Context) (int, error)

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

func (*SubscriptionUpdate) SaveX

func (su *SubscriptionUpdate) SaveX(ctx context.Context) int

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

func (*SubscriptionUpdate) SetChannel

func (su *SubscriptionUpdate) SetChannel(c *Channel) *SubscriptionUpdate

SetChannel sets the "channel" edge to the Channel entity.

func (*SubscriptionUpdate) SetChannelID

func (su *SubscriptionUpdate) SetChannelID(u uuid.UUID) *SubscriptionUpdate

SetChannelID sets the "channel_id" field.

func (*SubscriptionUpdate) SetNillablePinned

func (su *SubscriptionUpdate) SetNillablePinned(b *bool) *SubscriptionUpdate

SetNillablePinned sets the "pinned" field if the given value is not nil.

func (*SubscriptionUpdate) SetNillablePinnedAt

func (su *SubscriptionUpdate) SetNillablePinnedAt(t *time.Time) *SubscriptionUpdate

SetNillablePinnedAt sets the "pinned_at" field if the given value is not nil.

func (*SubscriptionUpdate) SetPinned

func (su *SubscriptionUpdate) SetPinned(b bool) *SubscriptionUpdate

SetPinned sets the "pinned" field.

func (*SubscriptionUpdate) SetPinnedAt

func (su *SubscriptionUpdate) SetPinnedAt(t time.Time) *SubscriptionUpdate

SetPinnedAt sets the "pinned_at" field.

func (*SubscriptionUpdate) SetRole

SetRole sets the "role" field.

func (*SubscriptionUpdate) SetStatus

func (su *SubscriptionUpdate) SetStatus(s string) *SubscriptionUpdate

SetStatus sets the "status" field.

func (*SubscriptionUpdate) SetUser

func (su *SubscriptionUpdate) SetUser(u *User) *SubscriptionUpdate

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

func (*SubscriptionUpdate) SetUserID

func (su *SubscriptionUpdate) SetUserID(u uuid.UUID) *SubscriptionUpdate

SetUserID sets the "user_id" field.

func (*SubscriptionUpdate) Where

Where appends a list predicates to the SubscriptionUpdate builder.

type SubscriptionUpdateOne

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

SubscriptionUpdateOne is the builder for updating a single Subscription entity.

func (*SubscriptionUpdateOne) ClearChannel

func (suo *SubscriptionUpdateOne) ClearChannel() *SubscriptionUpdateOne

ClearChannel clears the "channel" edge to the Channel entity.

func (*SubscriptionUpdateOne) ClearPinned

func (suo *SubscriptionUpdateOne) ClearPinned() *SubscriptionUpdateOne

ClearPinned clears the value of the "pinned" field.

func (*SubscriptionUpdateOne) ClearPinnedAt

func (suo *SubscriptionUpdateOne) ClearPinnedAt() *SubscriptionUpdateOne

ClearPinnedAt clears the value of the "pinned_at" field.

func (*SubscriptionUpdateOne) ClearUser

func (suo *SubscriptionUpdateOne) ClearUser() *SubscriptionUpdateOne

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

func (*SubscriptionUpdateOne) Exec

func (suo *SubscriptionUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SubscriptionUpdateOne) ExecX

func (suo *SubscriptionUpdateOne) ExecX(ctx context.Context)

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

func (*SubscriptionUpdateOne) Mutation

Mutation returns the SubscriptionMutation object of the builder.

func (*SubscriptionUpdateOne) Save

Save executes the query and returns the updated Subscription entity.

func (*SubscriptionUpdateOne) SaveX

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

func (*SubscriptionUpdateOne) Select

func (suo *SubscriptionUpdateOne) Select(field string, fields ...string) *SubscriptionUpdateOne

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

func (*SubscriptionUpdateOne) SetChannel

SetChannel sets the "channel" edge to the Channel entity.

func (*SubscriptionUpdateOne) SetChannelID

func (suo *SubscriptionUpdateOne) SetChannelID(u uuid.UUID) *SubscriptionUpdateOne

SetChannelID sets the "channel_id" field.

func (*SubscriptionUpdateOne) SetNillablePinned

func (suo *SubscriptionUpdateOne) SetNillablePinned(b *bool) *SubscriptionUpdateOne

SetNillablePinned sets the "pinned" field if the given value is not nil.

func (*SubscriptionUpdateOne) SetNillablePinnedAt

func (suo *SubscriptionUpdateOne) SetNillablePinnedAt(t *time.Time) *SubscriptionUpdateOne

SetNillablePinnedAt sets the "pinned_at" field if the given value is not nil.

func (*SubscriptionUpdateOne) SetPinned

SetPinned sets the "pinned" field.

func (*SubscriptionUpdateOne) SetPinnedAt

SetPinnedAt sets the "pinned_at" field.

func (*SubscriptionUpdateOne) SetRole

SetRole sets the "role" field.

func (*SubscriptionUpdateOne) SetStatus

SetStatus sets the "status" field.

func (*SubscriptionUpdateOne) SetUser

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

func (*SubscriptionUpdateOne) SetUserID

SetUserID sets the "user_id" field.

type Subscriptions

type Subscriptions []*Subscription

Subscriptions is a parsable slice of Subscription.

type Tx

type Tx struct {

	// Channel is the client for interacting with the Channel builders.
	Channel *ChannelClient
	// Device is the client for interacting with the Device builders.
	Device *DeviceClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// Recipient is the client for interacting with the Recipient builders.
	Recipient *RecipientClient
	// Subscription is the client for interacting with the Subscription builders.
	Subscription *SubscriptionClient
	// 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 uuid.UUID `json:"id,omitempty"`
	// Name holds the value of the "name" field.
	Name string `json:"name,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"`
	// State holds the value of the "state" field.
	State string `json:"state,omitempty"`
	// StateAt holds the value of the "state_at" field.
	StateAt time.Time `json:"state_at,omitempty"`
	// LastSeen holds the value of the "last_seen" field.
	LastSeen time.Time `json:"last_seen,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) QueryChannels

func (u *User) QueryChannels() *ChannelQuery

QueryChannels queries the "channels" edge of the User entity.

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

func (u *User) QueryRecipientMessages() *MessageQuery

QueryRecipientMessages queries the "recipient_messages" edge of the User entity.

func (*User) QueryRecipients

func (u *User) QueryRecipients() *RecipientQuery

QueryRecipients queries the "recipients" edge of the User entity.

func (*User) QuerySubscriptions

func (u *User) QuerySubscriptions() *SubscriptionQuery

QuerySubscriptions queries the "subscriptions" 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 uuid.UUID) *UserDeleteOne

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

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

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

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryChannels

func (c *UserClient) QueryChannels(u *User) *ChannelQuery

QueryChannels queries the channels edge of a 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) QueryRecipientMessages

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

QueryRecipientMessages queries the recipient_messages edge of a User.

func (*UserClient) QueryRecipients

func (c *UserClient) QueryRecipients(u *User) *RecipientQuery

QueryRecipients queries the recipients edge of a User.

func (*UserClient) QuerySubscriptions

func (c *UserClient) QuerySubscriptions(u *User) *SubscriptionQuery

QuerySubscriptions queries the subscriptions 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 uuid.UUID) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddChannelIDs

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

AddChannelIDs adds the "channels" edge to the Channel entity by IDs.

func (*UserCreate) AddChannels

func (uc *UserCreate) AddChannels(c ...*Channel) *UserCreate

AddChannels adds the "channels" edges to the Channel entity.

func (*UserCreate) AddDeviceIDs

func (uc *UserCreate) AddDeviceIDs(ids ...uuid.UUID) *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) AddRecipientMessageIDs

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

AddRecipientMessageIDs adds the "recipient_messages" edge to the Message entity by IDs.

func (*UserCreate) AddRecipientMessages

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

AddRecipientMessages adds the "recipient_messages" edges to the Message entity.

func (*UserCreate) AddSubscriptionIDs

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

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*UserCreate) AddSubscriptions

func (uc *UserCreate) AddSubscriptions(s ...*Subscription) *UserCreate

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*UserCreate) Exec

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

Exec executes the query.

func (*UserCreate) ExecX

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

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

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

Save creates the User in the database.

func (*UserCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetID

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

SetID sets the "id" field.

func (*UserCreate) SetLastSeen

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

SetLastSeen sets the "last_seen" field.

func (*UserCreate) SetName

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

SetName sets the "name" 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) SetNillableLastSeen

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

SetNillableLastSeen sets the "last_seen" 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) SetState

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

SetState sets the "state" field.

func (*UserCreate) SetStateAt

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

SetStateAt sets the "state_at" 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) Save

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

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

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

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

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

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

func (*UserDelete) ExecX

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

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

func (*UserDelete) Where

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

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

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

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

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

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

type UserEdges

type UserEdges struct {
	// Messages holds the value of the messages edge.
	Messages []*Message `json:"messages,omitempty"`
	// RecipientMessages holds the value of the recipient_messages edge.
	RecipientMessages []*Message `json:"recipient_messages,omitempty"`
	// Devices holds the value of the devices edge.
	Devices []*Device `json:"devices,omitempty"`
	// Channels holds the value of the channels edge.
	Channels []*Channel `json:"channels,omitempty"`
	// Recipients holds the value of the recipients edge.
	Recipients []*Recipient `json:"recipients,omitempty"`
	// Subscriptions holds the value of the subscriptions edge.
	Subscriptions []*Subscription `json:"subscriptions,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) ChannelsOrErr

func (e UserEdges) ChannelsOrErr() ([]*Channel, error)

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

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.

func (UserEdges) RecipientMessagesOrErr

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

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

func (UserEdges) RecipientsOrErr

func (e UserEdges) RecipientsOrErr() ([]*Recipient, error)

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

func (UserEdges) SubscriptionsOrErr

func (e UserEdges) SubscriptionsOrErr() ([]*Subscription, error)

SubscriptionsOrErr returns the Subscriptions 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 interface{}) error

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

func (*UserGroupBy) ScanX

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

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

func (m *UserMutation) AddChannelIDs(ids ...uuid.UUID)

AddChannelIDs adds the "channels" edge to the Channel entity by ids.

func (*UserMutation) AddDeviceIDs

func (m *UserMutation) AddDeviceIDs(ids ...uuid.UUID)

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

func (m *UserMutation) AddMessageIDs(ids ...uuid.UUID)

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

func (*UserMutation) AddRecipientMessageIDs

func (m *UserMutation) AddRecipientMessageIDs(ids ...uuid.UUID)

AddRecipientMessageIDs adds the "recipient_messages" edge to the Message entity by ids.

func (*UserMutation) AddSubscriptionIDs

func (m *UserMutation) AddSubscriptionIDs(ids ...uuid.UUID)

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription 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) 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) ChannelsCleared

func (m *UserMutation) ChannelsCleared() bool

ChannelsCleared reports if the "channels" edge to the Channel entity was cleared.

func (*UserMutation) ChannelsIDs

func (m *UserMutation) ChannelsIDs() (ids []uuid.UUID)

ChannelsIDs returns the "channels" edge IDs in the mutation.

func (*UserMutation) ClearChannels

func (m *UserMutation) ClearChannels()

ClearChannels clears the "channels" edge to the Channel entity.

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

func (m *UserMutation) ClearLastSeen()

ClearLastSeen clears the value of the "last_seen" field.

func (*UserMutation) ClearMessages

func (m *UserMutation) ClearMessages()

ClearMessages clears the "messages" edge to the Message entity.

func (*UserMutation) ClearRecipientMessages

func (m *UserMutation) ClearRecipientMessages()

ClearRecipientMessages clears the "recipient_messages" edge to the Message entity.

func (*UserMutation) ClearSubscriptions

func (m *UserMutation) ClearSubscriptions()

ClearSubscriptions clears the "subscriptions" edge to the Subscription 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 []uuid.UUID)

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

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

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

func (*UserMutation) IDs

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

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

func (*UserMutation) LastSeen

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

LastSeen returns the value of the "last_seen" field in the mutation.

func (*UserMutation) LastSeenCleared

func (m *UserMutation) LastSeenCleared() bool

LastSeenCleared returns if the "last_seen" field was cleared in this 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) Name

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

Name returns the value of the "name" field in the mutation.

func (*UserMutation) OldCreatedAt

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

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

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

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

OldLastSeen returns the old "last_seen" 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) OldName

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

OldName returns the old "name" 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) OldState

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

OldState returns the old "state" 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) OldStateAt

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

OldStateAt returns the old "state_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) 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) RecipientMessagesCleared

func (m *UserMutation) RecipientMessagesCleared() bool

RecipientMessagesCleared reports if the "recipient_messages" edge to the Message entity was cleared.

func (*UserMutation) RecipientMessagesIDs

func (m *UserMutation) RecipientMessagesIDs() (ids []uuid.UUID)

RecipientMessagesIDs returns the "recipient_messages" edge IDs in the mutation.

func (*UserMutation) RemoveChannelIDs

func (m *UserMutation) RemoveChannelIDs(ids ...uuid.UUID)

RemoveChannelIDs removes the "channels" edge to the Channel entity by IDs.

func (*UserMutation) RemoveDeviceIDs

func (m *UserMutation) RemoveDeviceIDs(ids ...uuid.UUID)

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

func (m *UserMutation) RemoveRecipientMessageIDs(ids ...uuid.UUID)

RemoveRecipientMessageIDs removes the "recipient_messages" edge to the Message entity by IDs.

func (*UserMutation) RemoveSubscriptionIDs

func (m *UserMutation) RemoveSubscriptionIDs(ids ...uuid.UUID)

RemoveSubscriptionIDs removes the "subscriptions" edge to the Subscription entity by IDs.

func (*UserMutation) RemovedChannelsIDs

func (m *UserMutation) RemovedChannelsIDs() (ids []uuid.UUID)

RemovedChannels returns the removed IDs of the "channels" edge to the Channel entity.

func (*UserMutation) RemovedDevicesIDs

func (m *UserMutation) RemovedDevicesIDs() (ids []uuid.UUID)

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

func (m *UserMutation) RemovedRecipientMessagesIDs() (ids []uuid.UUID)

RemovedRecipientMessages returns the removed IDs of the "recipient_messages" edge to the Message entity.

func (*UserMutation) RemovedSubscriptionsIDs

func (m *UserMutation) RemovedSubscriptionsIDs() (ids []uuid.UUID)

RemovedSubscriptions returns the removed IDs of the "subscriptions" edge to the Subscription entity.

func (*UserMutation) ResetChannels

func (m *UserMutation) ResetChannels()

ResetChannels resets all changes to the "channels" edge.

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

func (m *UserMutation) ResetLastSeen()

ResetLastSeen resets all changes to the "last_seen" field.

func (*UserMutation) ResetMessages

func (m *UserMutation) ResetMessages()

ResetMessages resets all changes to the "messages" edge.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetRecipientMessages

func (m *UserMutation) ResetRecipientMessages()

ResetRecipientMessages resets all changes to the "recipient_messages" edge.

func (*UserMutation) ResetState

func (m *UserMutation) ResetState()

ResetState resets all changes to the "state" field.

func (*UserMutation) ResetStateAt

func (m *UserMutation) ResetStateAt()

ResetStateAt resets all changes to the "state_at" field.

func (*UserMutation) ResetSubscriptions

func (m *UserMutation) ResetSubscriptions()

ResetSubscriptions resets all changes to the "subscriptions" edge.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

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

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

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

func (*UserMutation) SetLastSeen

func (m *UserMutation) SetLastSeen(t time.Time)

SetLastSeen sets the "last_seen" field.

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetState

func (m *UserMutation) SetState(s string)

SetState sets the "state" field.

func (*UserMutation) SetStateAt

func (m *UserMutation) SetStateAt(t time.Time)

SetStateAt sets the "state_at" field.

func (*UserMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) State

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

State returns the value of the "state" field in the mutation.

func (*UserMutation) StateAt

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

StateAt returns the value of the "state_at" field in the mutation.

func (*UserMutation) SubscriptionsCleared

func (m *UserMutation) SubscriptionsCleared() bool

SubscriptionsCleared reports if the "subscriptions" edge to the Subscription entity was cleared.

func (*UserMutation) SubscriptionsIDs

func (m *UserMutation) SubscriptionsIDs() (ids []uuid.UUID)

SubscriptionsIDs returns the "subscriptions" edge IDs in the mutation.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

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

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

Example:

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

client.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

func (uq *UserQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

Limit adds a limit step to the query.

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset adds an offset step to the query.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery

Order adds an order step to the query.

func (*UserQuery) QueryChannels

func (uq *UserQuery) QueryChannels() *ChannelQuery

QueryChannels chains the current query on the "channels" edge.

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

func (uq *UserQuery) QueryRecipientMessages() *MessageQuery

QueryRecipientMessages chains the current query on the "recipient_messages" edge.

func (*UserQuery) QueryRecipients

func (uq *UserQuery) QueryRecipients() *RecipientQuery

QueryRecipients chains the current query on the "recipients" edge.

func (*UserQuery) QuerySubscriptions

func (uq *UserQuery) QuerySubscriptions() *SubscriptionQuery

QuerySubscriptions chains the current query on the "subscriptions" 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 {
	Name string `json:"name,omitempty"`
}

client.User.Query().
	Select(user.FieldName).
	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) WithChannels

func (uq *UserQuery) WithChannels(opts ...func(*ChannelQuery)) *UserQuery

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

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.

func (*UserQuery) WithRecipientMessages

func (uq *UserQuery) WithRecipientMessages(opts ...func(*MessageQuery)) *UserQuery

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

func (*UserQuery) WithRecipients

func (uq *UserQuery) WithRecipients(opts ...func(*RecipientQuery)) *UserQuery

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

func (*UserQuery) WithSubscriptions

func (uq *UserQuery) WithSubscriptions(opts ...func(*SubscriptionQuery)) *UserQuery

WithSubscriptions tells the query-builder to eager-load the nodes that are connected to the "subscriptions" 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) 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 interface{}) 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 interface{})

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

func (uu *UserUpdate) AddChannelIDs(ids ...uuid.UUID) *UserUpdate

AddChannelIDs adds the "channels" edge to the Channel entity by IDs.

func (*UserUpdate) AddChannels

func (uu *UserUpdate) AddChannels(c ...*Channel) *UserUpdate

AddChannels adds the "channels" edges to the Channel entity.

func (*UserUpdate) AddDeviceIDs

func (uu *UserUpdate) AddDeviceIDs(ids ...uuid.UUID) *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) 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) AddRecipientMessageIDs

func (uu *UserUpdate) AddRecipientMessageIDs(ids ...uuid.UUID) *UserUpdate

AddRecipientMessageIDs adds the "recipient_messages" edge to the Message entity by IDs.

func (*UserUpdate) AddRecipientMessages

func (uu *UserUpdate) AddRecipientMessages(m ...*Message) *UserUpdate

AddRecipientMessages adds the "recipient_messages" edges to the Message entity.

func (*UserUpdate) AddSubscriptionIDs

func (uu *UserUpdate) AddSubscriptionIDs(ids ...uuid.UUID) *UserUpdate

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*UserUpdate) AddSubscriptions

func (uu *UserUpdate) AddSubscriptions(s ...*Subscription) *UserUpdate

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*UserUpdate) ClearChannels

func (uu *UserUpdate) ClearChannels() *UserUpdate

ClearChannels clears all "channels" edges to the Channel entity.

func (*UserUpdate) ClearDevices

func (uu *UserUpdate) ClearDevices() *UserUpdate

ClearDevices clears all "devices" edges to the Device entity.

func (*UserUpdate) ClearLastSeen

func (uu *UserUpdate) ClearLastSeen() *UserUpdate

ClearLastSeen clears the value of the "last_seen" field.

func (*UserUpdate) ClearMessages

func (uu *UserUpdate) ClearMessages() *UserUpdate

ClearMessages clears all "messages" edges to the Message entity.

func (*UserUpdate) ClearRecipientMessages

func (uu *UserUpdate) ClearRecipientMessages() *UserUpdate

ClearRecipientMessages clears all "recipient_messages" edges to the Message entity.

func (*UserUpdate) ClearSubscriptions

func (uu *UserUpdate) ClearSubscriptions() *UserUpdate

ClearSubscriptions clears all "subscriptions" edges to the Subscription 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) RemoveChannelIDs

func (uu *UserUpdate) RemoveChannelIDs(ids ...uuid.UUID) *UserUpdate

RemoveChannelIDs removes the "channels" edge to Channel entities by IDs.

func (*UserUpdate) RemoveChannels

func (uu *UserUpdate) RemoveChannels(c ...*Channel) *UserUpdate

RemoveChannels removes "channels" edges to Channel entities.

func (*UserUpdate) RemoveDeviceIDs

func (uu *UserUpdate) RemoveDeviceIDs(ids ...uuid.UUID) *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) RemoveRecipientMessageIDs

func (uu *UserUpdate) RemoveRecipientMessageIDs(ids ...uuid.UUID) *UserUpdate

RemoveRecipientMessageIDs removes the "recipient_messages" edge to Message entities by IDs.

func (*UserUpdate) RemoveRecipientMessages

func (uu *UserUpdate) RemoveRecipientMessages(m ...*Message) *UserUpdate

RemoveRecipientMessages removes "recipient_messages" edges to Message entities.

func (*UserUpdate) RemoveSubscriptionIDs

func (uu *UserUpdate) RemoveSubscriptionIDs(ids ...uuid.UUID) *UserUpdate

RemoveSubscriptionIDs removes the "subscriptions" edge to Subscription entities by IDs.

func (*UserUpdate) RemoveSubscriptions

func (uu *UserUpdate) RemoveSubscriptions(s ...*Subscription) *UserUpdate

RemoveSubscriptions removes "subscriptions" edges to Subscription 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) SetCreatedAt

func (uu *UserUpdate) SetCreatedAt(t time.Time) *UserUpdate

SetCreatedAt sets the "created_at" field.

func (*UserUpdate) SetLastSeen

func (uu *UserUpdate) SetLastSeen(t time.Time) *UserUpdate

SetLastSeen sets the "last_seen" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableCreatedAt

func (uu *UserUpdate) SetNillableCreatedAt(t *time.Time) *UserUpdate

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

func (*UserUpdate) SetNillableLastSeen

func (uu *UserUpdate) SetNillableLastSeen(t *time.Time) *UserUpdate

SetNillableLastSeen sets the "last_seen" field if the given value is not nil.

func (*UserUpdate) SetState

func (uu *UserUpdate) SetState(s string) *UserUpdate

SetState sets the "state" field.

func (*UserUpdate) SetStateAt

func (uu *UserUpdate) SetStateAt(t time.Time) *UserUpdate

SetStateAt sets the "state_at" 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) AddChannelIDs

func (uuo *UserUpdateOne) AddChannelIDs(ids ...uuid.UUID) *UserUpdateOne

AddChannelIDs adds the "channels" edge to the Channel entity by IDs.

func (*UserUpdateOne) AddChannels

func (uuo *UserUpdateOne) AddChannels(c ...*Channel) *UserUpdateOne

AddChannels adds the "channels" edges to the Channel entity.

func (*UserUpdateOne) AddDeviceIDs

func (uuo *UserUpdateOne) AddDeviceIDs(ids ...uuid.UUID) *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) 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) AddRecipientMessageIDs

func (uuo *UserUpdateOne) AddRecipientMessageIDs(ids ...uuid.UUID) *UserUpdateOne

AddRecipientMessageIDs adds the "recipient_messages" edge to the Message entity by IDs.

func (*UserUpdateOne) AddRecipientMessages

func (uuo *UserUpdateOne) AddRecipientMessages(m ...*Message) *UserUpdateOne

AddRecipientMessages adds the "recipient_messages" edges to the Message entity.

func (*UserUpdateOne) AddSubscriptionIDs

func (uuo *UserUpdateOne) AddSubscriptionIDs(ids ...uuid.UUID) *UserUpdateOne

AddSubscriptionIDs adds the "subscriptions" edge to the Subscription entity by IDs.

func (*UserUpdateOne) AddSubscriptions

func (uuo *UserUpdateOne) AddSubscriptions(s ...*Subscription) *UserUpdateOne

AddSubscriptions adds the "subscriptions" edges to the Subscription entity.

func (*UserUpdateOne) ClearChannels

func (uuo *UserUpdateOne) ClearChannels() *UserUpdateOne

ClearChannels clears all "channels" edges to the Channel entity.

func (*UserUpdateOne) ClearDevices

func (uuo *UserUpdateOne) ClearDevices() *UserUpdateOne

ClearDevices clears all "devices" edges to the Device entity.

func (*UserUpdateOne) ClearLastSeen

func (uuo *UserUpdateOne) ClearLastSeen() *UserUpdateOne

ClearLastSeen clears the value of the "last_seen" field.

func (*UserUpdateOne) ClearMessages

func (uuo *UserUpdateOne) ClearMessages() *UserUpdateOne

ClearMessages clears all "messages" edges to the Message entity.

func (*UserUpdateOne) ClearRecipientMessages

func (uuo *UserUpdateOne) ClearRecipientMessages() *UserUpdateOne

ClearRecipientMessages clears all "recipient_messages" edges to the Message entity.

func (*UserUpdateOne) ClearSubscriptions

func (uuo *UserUpdateOne) ClearSubscriptions() *UserUpdateOne

ClearSubscriptions clears all "subscriptions" edges to the Subscription 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) RemoveChannelIDs

func (uuo *UserUpdateOne) RemoveChannelIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveChannelIDs removes the "channels" edge to Channel entities by IDs.

func (*UserUpdateOne) RemoveChannels

func (uuo *UserUpdateOne) RemoveChannels(c ...*Channel) *UserUpdateOne

RemoveChannels removes "channels" edges to Channel entities.

func (*UserUpdateOne) RemoveDeviceIDs

func (uuo *UserUpdateOne) RemoveDeviceIDs(ids ...uuid.UUID) *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) RemoveRecipientMessageIDs

func (uuo *UserUpdateOne) RemoveRecipientMessageIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveRecipientMessageIDs removes the "recipient_messages" edge to Message entities by IDs.

func (*UserUpdateOne) RemoveRecipientMessages

func (uuo *UserUpdateOne) RemoveRecipientMessages(m ...*Message) *UserUpdateOne

RemoveRecipientMessages removes "recipient_messages" edges to Message entities.

func (*UserUpdateOne) RemoveSubscriptionIDs

func (uuo *UserUpdateOne) RemoveSubscriptionIDs(ids ...uuid.UUID) *UserUpdateOne

RemoveSubscriptionIDs removes the "subscriptions" edge to Subscription entities by IDs.

func (*UserUpdateOne) RemoveSubscriptions

func (uuo *UserUpdateOne) RemoveSubscriptions(s ...*Subscription) *UserUpdateOne

RemoveSubscriptions removes "subscriptions" edges to Subscription 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) SetCreatedAt

func (uuo *UserUpdateOne) SetCreatedAt(t time.Time) *UserUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserUpdateOne) SetLastSeen

func (uuo *UserUpdateOne) SetLastSeen(t time.Time) *UserUpdateOne

SetLastSeen sets the "last_seen" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableCreatedAt

func (uuo *UserUpdateOne) SetNillableCreatedAt(t *time.Time) *UserUpdateOne

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

func (*UserUpdateOne) SetNillableLastSeen

func (uuo *UserUpdateOne) SetNillableLastSeen(t *time.Time) *UserUpdateOne

SetNillableLastSeen sets the "last_seen" field if the given value is not nil.

func (*UserUpdateOne) SetState

func (uuo *UserUpdateOne) SetState(s string) *UserUpdateOne

SetState sets the "state" field.

func (*UserUpdateOne) SetStateAt

func (uuo *UserUpdateOne) SetStateAt(t time.Time) *UserUpdateOne

SetStateAt sets the "state_at" field.

func (*UserUpdateOne) SetUpdatedAt

func (uuo *UserUpdateOne) SetUpdatedAt(t time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

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