ent

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: GPL-3.0 Imports: 17 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.
	TypeLogEvent = "LogEvent"
	TypeMessage  = "Message"
)

Variables

This section is empty.

Functions

func IsConstraintError

func IsConstraintError(err error) bool

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

func IsNotFound

func IsNotFound(err error) bool

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

func IsNotLoaded

func IsNotLoaded(err error) bool

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

func IsNotSingular

func IsNotSingular(err error) bool

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

func IsValidationError

func IsValidationError(err error) bool

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

func MaskNotFound

func MaskNotFound(err error) error

MaskNotFound masks not found error.

func NewContext

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

NewContext returns a new context with the given Client attached.

func NewTxContext

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

NewTxContext returns a new context with the given Tx attached.

Types

type AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// LogEvent is the client for interacting with the LogEvent builders.
	LogEvent *LogEventClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// 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().
	LogEvent.
	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 Hook

type Hook = ent.Hook

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

type LogEvent added in v0.2.0

type LogEvent struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// Level holds the value of the "level" field.
	Level int `json:"level,omitempty"`
	// Message holds the value of the "message" field.
	Message string `json:"message,omitempty"`
	// contains filtered or unexported fields
}

LogEvent is the model entity for the LogEvent schema.

func (*LogEvent) String added in v0.2.0

func (le *LogEvent) String() string

String implements the fmt.Stringer.

func (*LogEvent) Unwrap added in v0.2.0

func (le *LogEvent) Unwrap() *LogEvent

Unwrap unwraps the LogEvent 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 (*LogEvent) Update added in v0.2.0

func (le *LogEvent) Update() *LogEventUpdateOne

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

type LogEventClient added in v0.2.0

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

LogEventClient is a client for the LogEvent schema.

func NewLogEventClient added in v0.2.0

func NewLogEventClient(c config) *LogEventClient

NewLogEventClient returns a client for the LogEvent from the given config.

func (*LogEventClient) Create added in v0.2.0

func (c *LogEventClient) Create() *LogEventCreate

Create returns a builder for creating a LogEvent entity.

func (*LogEventClient) CreateBulk added in v0.2.0

func (c *LogEventClient) CreateBulk(builders ...*LogEventCreate) *LogEventCreateBulk

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

func (*LogEventClient) Delete added in v0.2.0

func (c *LogEventClient) Delete() *LogEventDelete

Delete returns a delete builder for LogEvent.

func (*LogEventClient) DeleteOne added in v0.2.0

func (c *LogEventClient) DeleteOne(le *LogEvent) *LogEventDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*LogEventClient) DeleteOneID added in v0.2.0

func (c *LogEventClient) DeleteOneID(id int) *LogEventDeleteOne

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

func (*LogEventClient) Get added in v0.2.0

func (c *LogEventClient) Get(ctx context.Context, id int) (*LogEvent, error)

Get returns a LogEvent entity by its id.

func (*LogEventClient) GetX added in v0.2.0

func (c *LogEventClient) GetX(ctx context.Context, id int) *LogEvent

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

func (*LogEventClient) Hooks added in v0.2.0

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

Hooks returns the client hooks.

func (*LogEventClient) Query added in v0.2.0

func (c *LogEventClient) Query() *LogEventQuery

Query returns a query builder for LogEvent.

func (*LogEventClient) Update added in v0.2.0

func (c *LogEventClient) Update() *LogEventUpdate

Update returns an update builder for LogEvent.

func (*LogEventClient) UpdateOne added in v0.2.0

func (c *LogEventClient) UpdateOne(le *LogEvent) *LogEventUpdateOne

UpdateOne returns an update builder for the given entity.

func (*LogEventClient) UpdateOneID added in v0.2.0

func (c *LogEventClient) UpdateOneID(id int) *LogEventUpdateOne

UpdateOneID returns an update builder for the given id.

func (*LogEventClient) Use added in v0.2.0

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

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

type LogEventCreate added in v0.2.0

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

LogEventCreate is the builder for creating a LogEvent entity.

func (*LogEventCreate) Exec added in v0.2.0

func (lec *LogEventCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*LogEventCreate) ExecX added in v0.2.0

func (lec *LogEventCreate) ExecX(ctx context.Context)

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

func (*LogEventCreate) Mutation added in v0.2.0

func (lec *LogEventCreate) Mutation() *LogEventMutation

Mutation returns the LogEventMutation object of the builder.

func (*LogEventCreate) Save added in v0.2.0

func (lec *LogEventCreate) Save(ctx context.Context) (*LogEvent, error)

Save creates the LogEvent in the database.

func (*LogEventCreate) SaveX added in v0.2.0

func (lec *LogEventCreate) SaveX(ctx context.Context) *LogEvent

SaveX calls Save and panics if Save returns an error.

func (*LogEventCreate) SetLevel added in v0.2.0

func (lec *LogEventCreate) SetLevel(i int) *LogEventCreate

SetLevel sets the "level" field.

func (*LogEventCreate) SetMessage added in v0.2.0

func (lec *LogEventCreate) SetMessage(s string) *LogEventCreate

SetMessage sets the "message" field.

func (*LogEventCreate) SetTimestamp added in v0.2.0

func (lec *LogEventCreate) SetTimestamp(t time.Time) *LogEventCreate

SetTimestamp sets the "timestamp" field.

type LogEventCreateBulk added in v0.2.0

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

LogEventCreateBulk is the builder for creating many LogEvent entities in bulk.

func (*LogEventCreateBulk) Exec added in v0.2.0

func (lecb *LogEventCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*LogEventCreateBulk) ExecX added in v0.2.0

func (lecb *LogEventCreateBulk) ExecX(ctx context.Context)

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

func (*LogEventCreateBulk) Save added in v0.2.0

func (lecb *LogEventCreateBulk) Save(ctx context.Context) ([]*LogEvent, error)

Save creates the LogEvent entities in the database.

func (*LogEventCreateBulk) SaveX added in v0.2.0

func (lecb *LogEventCreateBulk) SaveX(ctx context.Context) []*LogEvent

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

type LogEventDelete added in v0.2.0

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

LogEventDelete is the builder for deleting a LogEvent entity.

func (*LogEventDelete) Exec added in v0.2.0

func (led *LogEventDelete) Exec(ctx context.Context) (int, error)

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

func (*LogEventDelete) ExecX added in v0.2.0

func (led *LogEventDelete) ExecX(ctx context.Context) int

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

func (*LogEventDelete) Where added in v0.2.0

func (led *LogEventDelete) Where(ps ...predicate.LogEvent) *LogEventDelete

Where appends a list predicates to the LogEventDelete builder.

type LogEventDeleteOne added in v0.2.0

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

LogEventDeleteOne is the builder for deleting a single LogEvent entity.

func (*LogEventDeleteOne) Exec added in v0.2.0

func (ledo *LogEventDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*LogEventDeleteOne) ExecX added in v0.2.0

func (ledo *LogEventDeleteOne) ExecX(ctx context.Context)

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

type LogEventGroupBy added in v0.2.0

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

LogEventGroupBy is the group-by builder for LogEvent entities.

func (*LogEventGroupBy) Aggregate added in v0.2.0

func (legb *LogEventGroupBy) Aggregate(fns ...AggregateFunc) *LogEventGroupBy

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

func (*LogEventGroupBy) Bool added in v0.2.0

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

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

func (*LogEventGroupBy) BoolX added in v0.2.0

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

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

func (*LogEventGroupBy) Bools added in v0.2.0

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

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

func (*LogEventGroupBy) BoolsX added in v0.2.0

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

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

func (*LogEventGroupBy) Float64 added in v0.2.0

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

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

func (*LogEventGroupBy) Float64X added in v0.2.0

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

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

func (*LogEventGroupBy) Float64s added in v0.2.0

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

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

func (*LogEventGroupBy) Float64sX added in v0.2.0

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

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

func (*LogEventGroupBy) Int added in v0.2.0

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

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

func (*LogEventGroupBy) IntX added in v0.2.0

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

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

func (*LogEventGroupBy) Ints added in v0.2.0

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

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

func (*LogEventGroupBy) IntsX added in v0.2.0

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

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

func (*LogEventGroupBy) Scan added in v0.2.0

func (legb *LogEventGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*LogEventGroupBy) ScanX added in v0.2.0

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

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

func (*LogEventGroupBy) String added in v0.2.0

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

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

func (*LogEventGroupBy) StringX added in v0.2.0

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

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

func (*LogEventGroupBy) Strings added in v0.2.0

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

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

func (*LogEventGroupBy) StringsX added in v0.2.0

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

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

type LogEventMutation added in v0.2.0

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

LogEventMutation represents an operation that mutates the LogEvent nodes in the graph.

func (*LogEventMutation) AddField added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) AddLevel added in v0.2.0

func (m *LogEventMutation) AddLevel(i int)

AddLevel adds i to the "level" field.

func (*LogEventMutation) AddedEdges added in v0.2.0

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

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

func (*LogEventMutation) AddedField added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) AddedFields added in v0.2.0

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

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

func (*LogEventMutation) AddedIDs added in v0.2.0

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

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

func (*LogEventMutation) AddedLevel added in v0.2.0

func (m *LogEventMutation) AddedLevel() (r int, exists bool)

AddedLevel returns the value that was added to the "level" field in this mutation.

func (*LogEventMutation) ClearEdge added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) ClearField added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) ClearedEdges added in v0.2.0

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

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

func (*LogEventMutation) ClearedFields added in v0.2.0

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

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

func (LogEventMutation) Client added in v0.2.0

func (m LogEventMutation) 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 (*LogEventMutation) EdgeCleared added in v0.2.0

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

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

func (*LogEventMutation) Field added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) FieldCleared added in v0.2.0

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

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

func (*LogEventMutation) Fields added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) ID added in v0.2.0

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

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

func (*LogEventMutation) IDs added in v0.2.0

func (m *LogEventMutation) IDs(ctx context.Context) ([]int, error)

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

func (*LogEventMutation) Level added in v0.2.0

func (m *LogEventMutation) Level() (r int, exists bool)

Level returns the value of the "level" field in the mutation.

func (*LogEventMutation) Message added in v0.2.0

func (m *LogEventMutation) Message() (r string, exists bool)

Message returns the value of the "message" field in the mutation.

func (*LogEventMutation) OldField added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) OldLevel added in v0.2.0

func (m *LogEventMutation) OldLevel(ctx context.Context) (v int, err error)

OldLevel returns the old "level" field's value of the LogEvent entity. If the LogEvent 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 (*LogEventMutation) OldMessage added in v0.2.0

func (m *LogEventMutation) OldMessage(ctx context.Context) (v string, err error)

OldMessage returns the old "message" field's value of the LogEvent entity. If the LogEvent 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 (*LogEventMutation) OldTimestamp added in v0.2.0

func (m *LogEventMutation) OldTimestamp(ctx context.Context) (v time.Time, err error)

OldTimestamp returns the old "timestamp" field's value of the LogEvent entity. If the LogEvent 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 (*LogEventMutation) Op added in v0.2.0

func (m *LogEventMutation) Op() Op

Op returns the operation name.

func (*LogEventMutation) RemovedEdges added in v0.2.0

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

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

func (*LogEventMutation) RemovedIDs added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) ResetEdge added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) ResetField added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) ResetLevel added in v0.2.0

func (m *LogEventMutation) ResetLevel()

ResetLevel resets all changes to the "level" field.

func (*LogEventMutation) ResetMessage added in v0.2.0

func (m *LogEventMutation) ResetMessage()

ResetMessage resets all changes to the "message" field.

func (*LogEventMutation) ResetTimestamp added in v0.2.0

func (m *LogEventMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*LogEventMutation) SetField added in v0.2.0

func (m *LogEventMutation) 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 (*LogEventMutation) SetLevel added in v0.2.0

func (m *LogEventMutation) SetLevel(i int)

SetLevel sets the "level" field.

func (*LogEventMutation) SetMessage added in v0.2.0

func (m *LogEventMutation) SetMessage(s string)

SetMessage sets the "message" field.

func (*LogEventMutation) SetTimestamp added in v0.2.0

func (m *LogEventMutation) SetTimestamp(t time.Time)

SetTimestamp sets the "timestamp" field.

func (*LogEventMutation) Timestamp added in v0.2.0

func (m *LogEventMutation) Timestamp() (r time.Time, exists bool)

Timestamp returns the value of the "timestamp" field in the mutation.

func (LogEventMutation) Tx added in v0.2.0

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

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

func (*LogEventMutation) Type added in v0.2.0

func (m *LogEventMutation) Type() string

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

func (*LogEventMutation) Where added in v0.2.0

func (m *LogEventMutation) Where(ps ...predicate.LogEvent)

Where appends a list predicates to the LogEventMutation builder.

type LogEventQuery added in v0.2.0

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

LogEventQuery is the builder for querying LogEvent entities.

func (*LogEventQuery) All added in v0.2.0

func (leq *LogEventQuery) All(ctx context.Context) ([]*LogEvent, error)

All executes the query and returns a list of LogEvents.

func (*LogEventQuery) AllX added in v0.2.0

func (leq *LogEventQuery) AllX(ctx context.Context) []*LogEvent

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

func (*LogEventQuery) Clone added in v0.2.0

func (leq *LogEventQuery) Clone() *LogEventQuery

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

func (*LogEventQuery) Count added in v0.2.0

func (leq *LogEventQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*LogEventQuery) CountX added in v0.2.0

func (leq *LogEventQuery) CountX(ctx context.Context) int

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

func (*LogEventQuery) Exist added in v0.2.0

func (leq *LogEventQuery) Exist(ctx context.Context) (bool, error)

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

func (*LogEventQuery) ExistX added in v0.2.0

func (leq *LogEventQuery) ExistX(ctx context.Context) bool

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

func (*LogEventQuery) First added in v0.2.0

func (leq *LogEventQuery) First(ctx context.Context) (*LogEvent, error)

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

func (*LogEventQuery) FirstID added in v0.2.0

func (leq *LogEventQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*LogEventQuery) FirstIDX added in v0.2.0

func (leq *LogEventQuery) FirstIDX(ctx context.Context) int

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

func (*LogEventQuery) FirstX added in v0.2.0

func (leq *LogEventQuery) FirstX(ctx context.Context) *LogEvent

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

func (*LogEventQuery) GroupBy added in v0.2.0

func (leq *LogEventQuery) GroupBy(field string, fields ...string) *LogEventGroupBy

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

client.LogEvent.Query().
	GroupBy(logevent.FieldTimestamp).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*LogEventQuery) IDs added in v0.2.0

func (leq *LogEventQuery) IDs(ctx context.Context) ([]int, error)

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

func (*LogEventQuery) IDsX added in v0.2.0

func (leq *LogEventQuery) IDsX(ctx context.Context) []int

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

func (*LogEventQuery) Limit added in v0.2.0

func (leq *LogEventQuery) Limit(limit int) *LogEventQuery

Limit adds a limit step to the query.

func (*LogEventQuery) Offset added in v0.2.0

func (leq *LogEventQuery) Offset(offset int) *LogEventQuery

Offset adds an offset step to the query.

func (*LogEventQuery) Only added in v0.2.0

func (leq *LogEventQuery) Only(ctx context.Context) (*LogEvent, error)

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

func (*LogEventQuery) OnlyID added in v0.2.0

func (leq *LogEventQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*LogEventQuery) OnlyIDX added in v0.2.0

func (leq *LogEventQuery) OnlyIDX(ctx context.Context) int

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

func (*LogEventQuery) OnlyX added in v0.2.0

func (leq *LogEventQuery) OnlyX(ctx context.Context) *LogEvent

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

func (*LogEventQuery) Order added in v0.2.0

func (leq *LogEventQuery) Order(o ...OrderFunc) *LogEventQuery

Order adds an order step to the query.

func (*LogEventQuery) Select added in v0.2.0

func (leq *LogEventQuery) Select(fields ...string) *LogEventSelect

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

client.LogEvent.Query().
	Select(logevent.FieldTimestamp).
	Scan(ctx, &v)

func (*LogEventQuery) Unique added in v0.2.0

func (leq *LogEventQuery) Unique(unique bool) *LogEventQuery

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 (*LogEventQuery) Where added in v0.2.0

func (leq *LogEventQuery) Where(ps ...predicate.LogEvent) *LogEventQuery

Where adds a new predicate for the LogEventQuery builder.

type LogEventSelect added in v0.2.0

type LogEventSelect struct {
	*LogEventQuery
	// contains filtered or unexported fields
}

LogEventSelect is the builder for selecting fields of LogEvent entities.

func (*LogEventSelect) Bool added in v0.2.0

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

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

func (*LogEventSelect) BoolX added in v0.2.0

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

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

func (*LogEventSelect) Bools added in v0.2.0

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

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

func (*LogEventSelect) BoolsX added in v0.2.0

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

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

func (*LogEventSelect) Float64 added in v0.2.0

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

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

func (*LogEventSelect) Float64X added in v0.2.0

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

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

func (*LogEventSelect) Float64s added in v0.2.0

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

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

func (*LogEventSelect) Float64sX added in v0.2.0

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

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

func (*LogEventSelect) Int added in v0.2.0

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

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

func (*LogEventSelect) IntX added in v0.2.0

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

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

func (*LogEventSelect) Ints added in v0.2.0

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

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

func (*LogEventSelect) IntsX added in v0.2.0

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

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

func (*LogEventSelect) Scan added in v0.2.0

func (les *LogEventSelect) Scan(ctx context.Context, v interface{}) error

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

func (*LogEventSelect) ScanX added in v0.2.0

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

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

func (*LogEventSelect) String added in v0.2.0

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

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

func (*LogEventSelect) StringX added in v0.2.0

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

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

func (*LogEventSelect) Strings added in v0.2.0

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

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

func (*LogEventSelect) StringsX added in v0.2.0

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

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

type LogEventUpdate added in v0.2.0

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

LogEventUpdate is the builder for updating LogEvent entities.

func (*LogEventUpdate) AddLevel added in v0.2.0

func (leu *LogEventUpdate) AddLevel(i int) *LogEventUpdate

AddLevel adds i to the "level" field.

func (*LogEventUpdate) Exec added in v0.2.0

func (leu *LogEventUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*LogEventUpdate) ExecX added in v0.2.0

func (leu *LogEventUpdate) ExecX(ctx context.Context)

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

func (*LogEventUpdate) Mutation added in v0.2.0

func (leu *LogEventUpdate) Mutation() *LogEventMutation

Mutation returns the LogEventMutation object of the builder.

func (*LogEventUpdate) Save added in v0.2.0

func (leu *LogEventUpdate) Save(ctx context.Context) (int, error)

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

func (*LogEventUpdate) SaveX added in v0.2.0

func (leu *LogEventUpdate) SaveX(ctx context.Context) int

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

func (*LogEventUpdate) SetLevel added in v0.2.0

func (leu *LogEventUpdate) SetLevel(i int) *LogEventUpdate

SetLevel sets the "level" field.

func (*LogEventUpdate) SetMessage added in v0.2.0

func (leu *LogEventUpdate) SetMessage(s string) *LogEventUpdate

SetMessage sets the "message" field.

func (*LogEventUpdate) SetTimestamp added in v0.2.0

func (leu *LogEventUpdate) SetTimestamp(t time.Time) *LogEventUpdate

SetTimestamp sets the "timestamp" field.

func (*LogEventUpdate) Where added in v0.2.0

func (leu *LogEventUpdate) Where(ps ...predicate.LogEvent) *LogEventUpdate

Where appends a list predicates to the LogEventUpdate builder.

type LogEventUpdateOne added in v0.2.0

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

LogEventUpdateOne is the builder for updating a single LogEvent entity.

func (*LogEventUpdateOne) AddLevel added in v0.2.0

func (leuo *LogEventUpdateOne) AddLevel(i int) *LogEventUpdateOne

AddLevel adds i to the "level" field.

func (*LogEventUpdateOne) Exec added in v0.2.0

func (leuo *LogEventUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*LogEventUpdateOne) ExecX added in v0.2.0

func (leuo *LogEventUpdateOne) ExecX(ctx context.Context)

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

func (*LogEventUpdateOne) Mutation added in v0.2.0

func (leuo *LogEventUpdateOne) Mutation() *LogEventMutation

Mutation returns the LogEventMutation object of the builder.

func (*LogEventUpdateOne) Save added in v0.2.0

func (leuo *LogEventUpdateOne) Save(ctx context.Context) (*LogEvent, error)

Save executes the query and returns the updated LogEvent entity.

func (*LogEventUpdateOne) SaveX added in v0.2.0

func (leuo *LogEventUpdateOne) SaveX(ctx context.Context) *LogEvent

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

func (*LogEventUpdateOne) Select added in v0.2.0

func (leuo *LogEventUpdateOne) Select(field string, fields ...string) *LogEventUpdateOne

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

func (*LogEventUpdateOne) SetLevel added in v0.2.0

func (leuo *LogEventUpdateOne) SetLevel(i int) *LogEventUpdateOne

SetLevel sets the "level" field.

func (*LogEventUpdateOne) SetMessage added in v0.2.0

func (leuo *LogEventUpdateOne) SetMessage(s string) *LogEventUpdateOne

SetMessage sets the "message" field.

func (*LogEventUpdateOne) SetTimestamp added in v0.2.0

func (leuo *LogEventUpdateOne) SetTimestamp(t time.Time) *LogEventUpdateOne

SetTimestamp sets the "timestamp" field.

type LogEvents added in v0.2.0

type LogEvents []*LogEvent

LogEvents is a parsable slice of LogEvent.

type Message

type Message struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Timestamp holds the value of the "timestamp" field.
	Timestamp time.Time `json:"timestamp,omitempty"`
	// Version holds the value of the "version" field.
	Version int `json:"version,omitempty"`
	// SourceAddress holds the value of the "source_address" field.
	SourceAddress string `json:"source_address,omitempty"`
	// SourcePort holds the value of the "source_port" field.
	SourcePort int `json:"source_port,omitempty"`
	// DestinationAddress holds the value of the "destination_address" field.
	DestinationAddress string `json:"destination_address,omitempty"`
	// DestinationPort holds the value of the "destination_port" field.
	DestinationPort int `json:"destination_port,omitempty"`
	// Size holds the value of the "size" field.
	Size uint32 `json:"size,omitempty"`
	// SourceActor holds the value of the "source_actor" field.
	SourceActor uint32 `json:"source_actor,omitempty"`
	// TargetActor holds the value of the "target_actor" field.
	TargetActor uint32 `json:"target_actor,omitempty"`
	// SegmentType holds the value of the "segment_type" field.
	SegmentType int `json:"segment_type,omitempty"`
	// Opcode holds the value of the "opcode" field.
	Opcode *int `json:"opcode,omitempty"`
	// Server holds the value of the "server" field.
	Server *int `json:"server,omitempty"`
	// TimestampRaw holds the value of the "timestamp_raw" field.
	TimestampRaw *uint32 `json:"timestamp_raw,omitempty"`
	// Data holds the value of the "data" field.
	Data *[]byte `json:"data,omitempty"`
	// contains filtered or unexported fields
}

Message is the model entity for the Message schema.

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 int) *MessageDeleteOne

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

func (*MessageClient) Get

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

Get returns a Message entity by its id.

func (*MessageClient) GetX

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

UpdateOneID returns an update builder for the given id.

func (*MessageClient) Use

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

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

type MessageCreate

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

MessageCreate is the builder for creating a Message entity.

func (*MessageCreate) Exec

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

Exec executes the query.

func (*MessageCreate) ExecX

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

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

func (*MessageCreate) Mutation

func (mc *MessageCreate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageCreate) 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) SetData

func (mc *MessageCreate) SetData(b []byte) *MessageCreate

SetData sets the "data" field.

func (*MessageCreate) SetDestinationAddress

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

SetDestinationAddress sets the "destination_address" field.

func (*MessageCreate) SetDestinationPort

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

SetDestinationPort sets the "destination_port" field.

func (*MessageCreate) SetNillableOpcode added in v0.1.1

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

SetNillableOpcode sets the "opcode" field if the given value is not nil.

func (*MessageCreate) SetNillableServer added in v0.3.0

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

SetNillableServer sets the "server" field if the given value is not nil.

func (*MessageCreate) SetNillableTimestampRaw added in v0.3.0

func (mc *MessageCreate) SetNillableTimestampRaw(u *uint32) *MessageCreate

SetNillableTimestampRaw sets the "timestamp_raw" field if the given value is not nil.

func (*MessageCreate) SetOpcode added in v0.1.1

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

SetOpcode sets the "opcode" field.

func (*MessageCreate) SetSegmentType added in v0.3.0

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

SetSegmentType sets the "segment_type" field.

func (*MessageCreate) SetServer added in v0.3.0

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

SetServer sets the "server" field.

func (*MessageCreate) SetSize added in v0.3.0

func (mc *MessageCreate) SetSize(u uint32) *MessageCreate

SetSize sets the "size" field.

func (*MessageCreate) SetSourceActor added in v0.3.0

func (mc *MessageCreate) SetSourceActor(u uint32) *MessageCreate

SetSourceActor sets the "source_actor" field.

func (*MessageCreate) SetSourceAddress

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

SetSourceAddress sets the "source_address" field.

func (*MessageCreate) SetSourcePort

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

SetSourcePort sets the "source_port" field.

func (*MessageCreate) SetTargetActor added in v0.3.0

func (mc *MessageCreate) SetTargetActor(u uint32) *MessageCreate

SetTargetActor sets the "target_actor" field.

func (*MessageCreate) SetTimestamp

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

SetTimestamp sets the "timestamp" field.

func (*MessageCreate) SetTimestampRaw added in v0.3.0

func (mc *MessageCreate) SetTimestampRaw(u uint32) *MessageCreate

SetTimestampRaw sets the "timestamp_raw" field.

func (*MessageCreate) SetVersion

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

SetVersion sets the "version" 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 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) AddDestinationPort

func (m *MessageMutation) AddDestinationPort(i int)

AddDestinationPort adds i to the "destination_port" field.

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) AddOpcode added in v0.1.1

func (m *MessageMutation) AddOpcode(i int)

AddOpcode adds i to the "opcode" field.

func (*MessageMutation) AddSegmentType added in v0.3.0

func (m *MessageMutation) AddSegmentType(i int)

AddSegmentType adds i to the "segment_type" field.

func (*MessageMutation) AddServer added in v0.3.0

func (m *MessageMutation) AddServer(i int)

AddServer adds i to the "server" field.

func (*MessageMutation) AddSize added in v0.3.0

func (m *MessageMutation) AddSize(u int32)

AddSize adds u to the "size" field.

func (*MessageMutation) AddSourceActor added in v0.3.0

func (m *MessageMutation) AddSourceActor(u int32)

AddSourceActor adds u to the "source_actor" field.

func (*MessageMutation) AddSourcePort

func (m *MessageMutation) AddSourcePort(i int)

AddSourcePort adds i to the "source_port" field.

func (*MessageMutation) AddTargetActor added in v0.3.0

func (m *MessageMutation) AddTargetActor(u int32)

AddTargetActor adds u to the "target_actor" field.

func (*MessageMutation) AddTimestampRaw added in v0.3.0

func (m *MessageMutation) AddTimestampRaw(u int32)

AddTimestampRaw adds u to the "timestamp_raw" field.

func (*MessageMutation) AddVersion

func (m *MessageMutation) AddVersion(i int)

AddVersion adds i to the "version" field.

func (*MessageMutation) AddedDestinationPort

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

AddedDestinationPort returns the value that was added to the "destination_port" field in this mutation.

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) AddedOpcode added in v0.1.1

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

AddedOpcode returns the value that was added to the "opcode" field in this mutation.

func (*MessageMutation) AddedSegmentType added in v0.3.0

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

AddedSegmentType returns the value that was added to the "segment_type" field in this mutation.

func (*MessageMutation) AddedServer added in v0.3.0

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

AddedServer returns the value that was added to the "server" field in this mutation.

func (*MessageMutation) AddedSize added in v0.3.0

func (m *MessageMutation) AddedSize() (r int32, exists bool)

AddedSize returns the value that was added to the "size" field in this mutation.

func (*MessageMutation) AddedSourceActor added in v0.3.0

func (m *MessageMutation) AddedSourceActor() (r int32, exists bool)

AddedSourceActor returns the value that was added to the "source_actor" field in this mutation.

func (*MessageMutation) AddedSourcePort

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

AddedSourcePort returns the value that was added to the "source_port" field in this mutation.

func (*MessageMutation) AddedTargetActor added in v0.3.0

func (m *MessageMutation) AddedTargetActor() (r int32, exists bool)

AddedTargetActor returns the value that was added to the "target_actor" field in this mutation.

func (*MessageMutation) AddedTimestampRaw added in v0.3.0

func (m *MessageMutation) AddedTimestampRaw() (r int32, exists bool)

AddedTimestampRaw returns the value that was added to the "timestamp_raw" field in this mutation.

func (*MessageMutation) AddedVersion

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

AddedVersion returns the value that was added to the "version" field in this mutation.

func (*MessageMutation) ClearData added in v0.3.0

func (m *MessageMutation) ClearData()

ClearData clears the value of the "data" field.

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) ClearOpcode added in v0.1.1

func (m *MessageMutation) ClearOpcode()

ClearOpcode clears the value of the "opcode" field.

func (*MessageMutation) ClearServer added in v0.3.0

func (m *MessageMutation) ClearServer()

ClearServer clears the value of the "server" field.

func (*MessageMutation) ClearTimestampRaw added in v0.3.0

func (m *MessageMutation) ClearTimestampRaw()

ClearTimestampRaw clears the value of the "timestamp_raw" field.

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

func (m *MessageMutation) Data() (r []byte, exists bool)

Data returns the value of the "data" field in the mutation.

func (*MessageMutation) DataCleared added in v0.3.0

func (m *MessageMutation) DataCleared() bool

DataCleared returns if the "data" field was cleared in this mutation.

func (*MessageMutation) DestinationAddress

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

DestinationAddress returns the value of the "destination_address" field in the mutation.

func (*MessageMutation) DestinationPort

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

DestinationPort returns the value of the "destination_port" field in the mutation.

func (*MessageMutation) EdgeCleared

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

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

func (*MessageMutation) Field

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

Field returns the value of a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*MessageMutation) FieldCleared

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

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

func (*MessageMutation) Fields

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

Fields returns all fields that were changed during this mutation. Note that in order to get all numeric fields that were incremented/decremented, call AddedFields().

func (*MessageMutation) ID

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

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

func (*MessageMutation) IDs

func (m *MessageMutation) IDs(ctx context.Context) ([]int, error)

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

func (*MessageMutation) OldData

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

OldData returns the old "data" 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) OldDestinationAddress

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

OldDestinationAddress returns the old "destination_address" 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) OldDestinationPort

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

OldDestinationPort returns the old "destination_port" 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) OldOpcode added in v0.1.1

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

OldOpcode returns the old "opcode" 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) OldSegmentType added in v0.3.0

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

OldSegmentType returns the old "segment_type" 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) OldServer added in v0.3.0

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

OldServer returns the old "server" 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) OldSize added in v0.3.0

func (m *MessageMutation) OldSize(ctx context.Context) (v uint32, err error)

OldSize returns the old "size" 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) OldSourceActor added in v0.3.0

func (m *MessageMutation) OldSourceActor(ctx context.Context) (v uint32, err error)

OldSourceActor returns the old "source_actor" 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) OldSourceAddress

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

OldSourceAddress returns the old "source_address" 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) OldSourcePort

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

OldSourcePort returns the old "source_port" 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) OldTargetActor added in v0.3.0

func (m *MessageMutation) OldTargetActor(ctx context.Context) (v uint32, err error)

OldTargetActor returns the old "target_actor" 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) OldTimestamp

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

OldTimestamp returns the old "timestamp" 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) OldTimestampRaw added in v0.3.0

func (m *MessageMutation) OldTimestampRaw(ctx context.Context) (v *uint32, err error)

OldTimestampRaw returns the old "timestamp_raw" 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) OldVersion

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

OldVersion returns the old "version" 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) Opcode added in v0.1.1

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

Opcode returns the value of the "opcode" field in the mutation.

func (*MessageMutation) OpcodeCleared added in v0.1.1

func (m *MessageMutation) OpcodeCleared() bool

OpcodeCleared returns if the "opcode" field was cleared in this mutation.

func (*MessageMutation) RemovedEdges

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

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

func (*MessageMutation) RemovedIDs

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

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

func (*MessageMutation) ResetData

func (m *MessageMutation) ResetData()

ResetData resets all changes to the "data" field.

func (*MessageMutation) ResetDestinationAddress

func (m *MessageMutation) ResetDestinationAddress()

ResetDestinationAddress resets all changes to the "destination_address" field.

func (*MessageMutation) ResetDestinationPort

func (m *MessageMutation) ResetDestinationPort()

ResetDestinationPort resets all changes to the "destination_port" 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) ResetOpcode added in v0.1.1

func (m *MessageMutation) ResetOpcode()

ResetOpcode resets all changes to the "opcode" field.

func (*MessageMutation) ResetSegmentType added in v0.3.0

func (m *MessageMutation) ResetSegmentType()

ResetSegmentType resets all changes to the "segment_type" field.

func (*MessageMutation) ResetServer added in v0.3.0

func (m *MessageMutation) ResetServer()

ResetServer resets all changes to the "server" field.

func (*MessageMutation) ResetSize added in v0.3.0

func (m *MessageMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*MessageMutation) ResetSourceActor added in v0.3.0

func (m *MessageMutation) ResetSourceActor()

ResetSourceActor resets all changes to the "source_actor" field.

func (*MessageMutation) ResetSourceAddress

func (m *MessageMutation) ResetSourceAddress()

ResetSourceAddress resets all changes to the "source_address" field.

func (*MessageMutation) ResetSourcePort

func (m *MessageMutation) ResetSourcePort()

ResetSourcePort resets all changes to the "source_port" field.

func (*MessageMutation) ResetTargetActor added in v0.3.0

func (m *MessageMutation) ResetTargetActor()

ResetTargetActor resets all changes to the "target_actor" field.

func (*MessageMutation) ResetTimestamp

func (m *MessageMutation) ResetTimestamp()

ResetTimestamp resets all changes to the "timestamp" field.

func (*MessageMutation) ResetTimestampRaw added in v0.3.0

func (m *MessageMutation) ResetTimestampRaw()

ResetTimestampRaw resets all changes to the "timestamp_raw" field.

func (*MessageMutation) ResetVersion

func (m *MessageMutation) ResetVersion()

ResetVersion resets all changes to the "version" field.

func (*MessageMutation) SegmentType added in v0.3.0

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

SegmentType returns the value of the "segment_type" field in the mutation.

func (*MessageMutation) Server added in v0.3.0

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

Server returns the value of the "server" field in the mutation.

func (*MessageMutation) ServerCleared added in v0.3.0

func (m *MessageMutation) ServerCleared() bool

ServerCleared returns if the "server" field was cleared in this mutation.

func (*MessageMutation) SetData

func (m *MessageMutation) SetData(b []byte)

SetData sets the "data" field.

func (*MessageMutation) SetDestinationAddress

func (m *MessageMutation) SetDestinationAddress(s string)

SetDestinationAddress sets the "destination_address" field.

func (*MessageMutation) SetDestinationPort

func (m *MessageMutation) SetDestinationPort(i int)

SetDestinationPort sets the "destination_port" 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) SetOpcode added in v0.1.1

func (m *MessageMutation) SetOpcode(i int)

SetOpcode sets the "opcode" field.

func (*MessageMutation) SetSegmentType added in v0.3.0

func (m *MessageMutation) SetSegmentType(i int)

SetSegmentType sets the "segment_type" field.

func (*MessageMutation) SetServer added in v0.3.0

func (m *MessageMutation) SetServer(i int)

SetServer sets the "server" field.

func (*MessageMutation) SetSize added in v0.3.0

func (m *MessageMutation) SetSize(u uint32)

SetSize sets the "size" field.

func (*MessageMutation) SetSourceActor added in v0.3.0

func (m *MessageMutation) SetSourceActor(u uint32)

SetSourceActor sets the "source_actor" field.

func (*MessageMutation) SetSourceAddress

func (m *MessageMutation) SetSourceAddress(s string)

SetSourceAddress sets the "source_address" field.

func (*MessageMutation) SetSourcePort

func (m *MessageMutation) SetSourcePort(i int)

SetSourcePort sets the "source_port" field.

func (*MessageMutation) SetTargetActor added in v0.3.0

func (m *MessageMutation) SetTargetActor(u uint32)

SetTargetActor sets the "target_actor" field.

func (*MessageMutation) SetTimestamp

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

SetTimestamp sets the "timestamp" field.

func (*MessageMutation) SetTimestampRaw added in v0.3.0

func (m *MessageMutation) SetTimestampRaw(u uint32)

SetTimestampRaw sets the "timestamp_raw" field.

func (*MessageMutation) SetVersion

func (m *MessageMutation) SetVersion(i int)

SetVersion sets the "version" field.

func (*MessageMutation) Size added in v0.3.0

func (m *MessageMutation) Size() (r uint32, exists bool)

Size returns the value of the "size" field in the mutation.

func (*MessageMutation) SourceActor added in v0.3.0

func (m *MessageMutation) SourceActor() (r uint32, exists bool)

SourceActor returns the value of the "source_actor" field in the mutation.

func (*MessageMutation) SourceAddress

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

SourceAddress returns the value of the "source_address" field in the mutation.

func (*MessageMutation) SourcePort

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

SourcePort returns the value of the "source_port" field in the mutation.

func (*MessageMutation) TargetActor added in v0.3.0

func (m *MessageMutation) TargetActor() (r uint32, exists bool)

TargetActor returns the value of the "target_actor" field in the mutation.

func (*MessageMutation) Timestamp

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

Timestamp returns the value of the "timestamp" field in the mutation.

func (*MessageMutation) TimestampRaw added in v0.3.0

func (m *MessageMutation) TimestampRaw() (r uint32, exists bool)

TimestampRaw returns the value of the "timestamp_raw" field in the mutation.

func (*MessageMutation) TimestampRawCleared added in v0.3.0

func (m *MessageMutation) TimestampRawCleared() bool

TimestampRawCleared returns if the "timestamp_raw" field was cleared in this mutation.

func (MessageMutation) Tx

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

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

func (*MessageMutation) Type

func (m *MessageMutation) Type() string

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

func (*MessageMutation) Version

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

Version returns the value of the "version" 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 int, 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) int

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

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

func (*MessageQuery) IDs

func (mq *MessageQuery) IDs(ctx context.Context) ([]int, error)

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

func (*MessageQuery) IDsX

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

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 int, 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) int

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) 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 {
	Timestamp time.Time `json:"timestamp,omitempty"`
}

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

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

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

AddDestinationPort adds i to the "destination_port" field.

func (*MessageUpdate) AddOpcode added in v0.1.1

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

AddOpcode adds i to the "opcode" field.

func (*MessageUpdate) AddSegmentType added in v0.3.0

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

AddSegmentType adds i to the "segment_type" field.

func (*MessageUpdate) AddServer added in v0.3.0

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

AddServer adds i to the "server" field.

func (*MessageUpdate) AddSize added in v0.3.0

func (mu *MessageUpdate) AddSize(u int32) *MessageUpdate

AddSize adds u to the "size" field.

func (*MessageUpdate) AddSourceActor added in v0.3.0

func (mu *MessageUpdate) AddSourceActor(u int32) *MessageUpdate

AddSourceActor adds u to the "source_actor" field.

func (*MessageUpdate) AddSourcePort

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

AddSourcePort adds i to the "source_port" field.

func (*MessageUpdate) AddTargetActor added in v0.3.0

func (mu *MessageUpdate) AddTargetActor(u int32) *MessageUpdate

AddTargetActor adds u to the "target_actor" field.

func (*MessageUpdate) AddTimestampRaw added in v0.3.0

func (mu *MessageUpdate) AddTimestampRaw(u int32) *MessageUpdate

AddTimestampRaw adds u to the "timestamp_raw" field.

func (*MessageUpdate) AddVersion

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

AddVersion adds i to the "version" field.

func (*MessageUpdate) ClearData added in v0.3.0

func (mu *MessageUpdate) ClearData() *MessageUpdate

ClearData clears the value of the "data" field.

func (*MessageUpdate) ClearOpcode added in v0.1.1

func (mu *MessageUpdate) ClearOpcode() *MessageUpdate

ClearOpcode clears the value of the "opcode" field.

func (*MessageUpdate) ClearServer added in v0.3.0

func (mu *MessageUpdate) ClearServer() *MessageUpdate

ClearServer clears the value of the "server" field.

func (*MessageUpdate) ClearTimestampRaw added in v0.3.0

func (mu *MessageUpdate) ClearTimestampRaw() *MessageUpdate

ClearTimestampRaw clears the value of the "timestamp_raw" field.

func (*MessageUpdate) Exec

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

Exec executes the query.

func (*MessageUpdate) ExecX

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

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

func (*MessageUpdate) Mutation

func (mu *MessageUpdate) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdate) Save

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

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

func (*MessageUpdate) SaveX

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

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

func (*MessageUpdate) SetData

func (mu *MessageUpdate) SetData(b []byte) *MessageUpdate

SetData sets the "data" field.

func (*MessageUpdate) SetDestinationAddress

func (mu *MessageUpdate) SetDestinationAddress(s string) *MessageUpdate

SetDestinationAddress sets the "destination_address" field.

func (*MessageUpdate) SetDestinationPort

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

SetDestinationPort sets the "destination_port" field.

func (*MessageUpdate) SetNillableOpcode added in v0.1.1

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

SetNillableOpcode sets the "opcode" field if the given value is not nil.

func (*MessageUpdate) SetNillableServer added in v0.3.0

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

SetNillableServer sets the "server" field if the given value is not nil.

func (*MessageUpdate) SetNillableTimestampRaw added in v0.3.0

func (mu *MessageUpdate) SetNillableTimestampRaw(u *uint32) *MessageUpdate

SetNillableTimestampRaw sets the "timestamp_raw" field if the given value is not nil.

func (*MessageUpdate) SetOpcode added in v0.1.1

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

SetOpcode sets the "opcode" field.

func (*MessageUpdate) SetSegmentType added in v0.3.0

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

SetSegmentType sets the "segment_type" field.

func (*MessageUpdate) SetServer added in v0.3.0

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

SetServer sets the "server" field.

func (*MessageUpdate) SetSize added in v0.3.0

func (mu *MessageUpdate) SetSize(u uint32) *MessageUpdate

SetSize sets the "size" field.

func (*MessageUpdate) SetSourceActor added in v0.3.0

func (mu *MessageUpdate) SetSourceActor(u uint32) *MessageUpdate

SetSourceActor sets the "source_actor" field.

func (*MessageUpdate) SetSourceAddress

func (mu *MessageUpdate) SetSourceAddress(s string) *MessageUpdate

SetSourceAddress sets the "source_address" field.

func (*MessageUpdate) SetSourcePort

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

SetSourcePort sets the "source_port" field.

func (*MessageUpdate) SetTargetActor added in v0.3.0

func (mu *MessageUpdate) SetTargetActor(u uint32) *MessageUpdate

SetTargetActor sets the "target_actor" field.

func (*MessageUpdate) SetTimestamp

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

SetTimestamp sets the "timestamp" field.

func (*MessageUpdate) SetTimestampRaw added in v0.3.0

func (mu *MessageUpdate) SetTimestampRaw(u uint32) *MessageUpdate

SetTimestampRaw sets the "timestamp_raw" field.

func (*MessageUpdate) SetVersion

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

SetVersion sets the "version" 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) AddDestinationPort

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

AddDestinationPort adds i to the "destination_port" field.

func (*MessageUpdateOne) AddOpcode added in v0.1.1

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

AddOpcode adds i to the "opcode" field.

func (*MessageUpdateOne) AddSegmentType added in v0.3.0

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

AddSegmentType adds i to the "segment_type" field.

func (*MessageUpdateOne) AddServer added in v0.3.0

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

AddServer adds i to the "server" field.

func (*MessageUpdateOne) AddSize added in v0.3.0

func (muo *MessageUpdateOne) AddSize(u int32) *MessageUpdateOne

AddSize adds u to the "size" field.

func (*MessageUpdateOne) AddSourceActor added in v0.3.0

func (muo *MessageUpdateOne) AddSourceActor(u int32) *MessageUpdateOne

AddSourceActor adds u to the "source_actor" field.

func (*MessageUpdateOne) AddSourcePort

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

AddSourcePort adds i to the "source_port" field.

func (*MessageUpdateOne) AddTargetActor added in v0.3.0

func (muo *MessageUpdateOne) AddTargetActor(u int32) *MessageUpdateOne

AddTargetActor adds u to the "target_actor" field.

func (*MessageUpdateOne) AddTimestampRaw added in v0.3.0

func (muo *MessageUpdateOne) AddTimestampRaw(u int32) *MessageUpdateOne

AddTimestampRaw adds u to the "timestamp_raw" field.

func (*MessageUpdateOne) AddVersion

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

AddVersion adds i to the "version" field.

func (*MessageUpdateOne) ClearData added in v0.3.0

func (muo *MessageUpdateOne) ClearData() *MessageUpdateOne

ClearData clears the value of the "data" field.

func (*MessageUpdateOne) ClearOpcode added in v0.1.1

func (muo *MessageUpdateOne) ClearOpcode() *MessageUpdateOne

ClearOpcode clears the value of the "opcode" field.

func (*MessageUpdateOne) ClearServer added in v0.3.0

func (muo *MessageUpdateOne) ClearServer() *MessageUpdateOne

ClearServer clears the value of the "server" field.

func (*MessageUpdateOne) ClearTimestampRaw added in v0.3.0

func (muo *MessageUpdateOne) ClearTimestampRaw() *MessageUpdateOne

ClearTimestampRaw clears the value of the "timestamp_raw" field.

func (*MessageUpdateOne) Exec

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

Exec executes the query on the entity.

func (*MessageUpdateOne) ExecX

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

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

func (*MessageUpdateOne) Mutation

func (muo *MessageUpdateOne) Mutation() *MessageMutation

Mutation returns the MessageMutation object of the builder.

func (*MessageUpdateOne) Save

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

Save executes the query and returns the updated Message entity.

func (*MessageUpdateOne) SaveX

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

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

func (*MessageUpdateOne) Select

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

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

func (*MessageUpdateOne) SetData

func (muo *MessageUpdateOne) SetData(b []byte) *MessageUpdateOne

SetData sets the "data" field.

func (*MessageUpdateOne) SetDestinationAddress

func (muo *MessageUpdateOne) SetDestinationAddress(s string) *MessageUpdateOne

SetDestinationAddress sets the "destination_address" field.

func (*MessageUpdateOne) SetDestinationPort

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

SetDestinationPort sets the "destination_port" field.

func (*MessageUpdateOne) SetNillableOpcode added in v0.1.1

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

SetNillableOpcode sets the "opcode" field if the given value is not nil.

func (*MessageUpdateOne) SetNillableServer added in v0.3.0

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

SetNillableServer sets the "server" field if the given value is not nil.

func (*MessageUpdateOne) SetNillableTimestampRaw added in v0.3.0

func (muo *MessageUpdateOne) SetNillableTimestampRaw(u *uint32) *MessageUpdateOne

SetNillableTimestampRaw sets the "timestamp_raw" field if the given value is not nil.

func (*MessageUpdateOne) SetOpcode added in v0.1.1

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

SetOpcode sets the "opcode" field.

func (*MessageUpdateOne) SetSegmentType added in v0.3.0

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

SetSegmentType sets the "segment_type" field.

func (*MessageUpdateOne) SetServer added in v0.3.0

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

SetServer sets the "server" field.

func (*MessageUpdateOne) SetSize added in v0.3.0

func (muo *MessageUpdateOne) SetSize(u uint32) *MessageUpdateOne

SetSize sets the "size" field.

func (*MessageUpdateOne) SetSourceActor added in v0.3.0

func (muo *MessageUpdateOne) SetSourceActor(u uint32) *MessageUpdateOne

SetSourceActor sets the "source_actor" field.

func (*MessageUpdateOne) SetSourceAddress

func (muo *MessageUpdateOne) SetSourceAddress(s string) *MessageUpdateOne

SetSourceAddress sets the "source_address" field.

func (*MessageUpdateOne) SetSourcePort

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

SetSourcePort sets the "source_port" field.

func (*MessageUpdateOne) SetTargetActor added in v0.3.0

func (muo *MessageUpdateOne) SetTargetActor(u uint32) *MessageUpdateOne

SetTargetActor sets the "target_actor" field.

func (*MessageUpdateOne) SetTimestamp

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

SetTimestamp sets the "timestamp" field.

func (*MessageUpdateOne) SetTimestampRaw added in v0.3.0

func (muo *MessageUpdateOne) SetTimestampRaw(u uint32) *MessageUpdateOne

SetTimestampRaw sets the "timestamp_raw" field.

func (*MessageUpdateOne) SetVersion

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

SetVersion sets the "version" 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 RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type Tx

type Tx struct {

	// LogEvent is the client for interacting with the LogEvent builders.
	LogEvent *LogEventClient
	// Message is the client for interacting with the Message builders.
	Message *MessageClient
	// 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 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