ent

package
v0.0.0-...-f92f37c Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: ISC Imports: 18 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.
	TypeWidget     = "Widget"
	TypeWidgetType = "WidgetType"
)

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
	// Widget is the client for interacting with the Widget builders.
	Widget *WidgetClient
	// WidgetType is the client for interacting with the WidgetType builders.
	WidgetType *WidgetTypeClient
	// 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().
	Widget.
	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(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 Committer 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 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(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 Rollbacker method.

type Tx

type Tx struct {

	// Widget is the client for interacting with the Widget builders.
	Widget *WidgetClient
	// WidgetType is the client for interacting with the WidgetType builders.
	WidgetType *WidgetTypeClient
	// 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 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.

type Widget

type Widget struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Note holds the value of the "note" field.
	Note string `json:"note,omitempty"`
	// CreatedAt holds the value of the "created_at" field.
	CreatedAt time.Time `json:"created_at,omitempty"`
	// Status holds the value of the "status" field.
	Status widget.Status `json:"status,omitempty"`
	// Priority holds the value of the "priority" field.
	Priority int `json:"priority,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the WidgetQuery when eager-loading is set.
	Edges WidgetEdges `json:"edges"`
	// contains filtered or unexported fields
}

Widget is the model entity for the Widget schema.

func (*Widget) QueryType

func (w *Widget) QueryType() *WidgetTypeQuery

QueryType queries the "type" edge of the Widget entity.

func (*Widget) String

func (w *Widget) String() string

String implements the fmt.Stringer.

func (*Widget) Unwrap

func (w *Widget) Unwrap() *Widget

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

func (w *Widget) Update() *WidgetUpdateOne

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

type WidgetClient

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

WidgetClient is a client for the Widget schema.

func NewWidgetClient

func NewWidgetClient(c config) *WidgetClient

NewWidgetClient returns a client for the Widget from the given config.

func (*WidgetClient) Create

func (c *WidgetClient) Create() *WidgetCreate

Create returns a create builder for Widget.

func (*WidgetClient) CreateBulk

func (c *WidgetClient) CreateBulk(builders ...*WidgetCreate) *WidgetCreateBulk

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

func (*WidgetClient) Delete

func (c *WidgetClient) Delete() *WidgetDelete

Delete returns a delete builder for Widget.

func (*WidgetClient) DeleteOne

func (c *WidgetClient) DeleteOne(w *Widget) *WidgetDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*WidgetClient) DeleteOneID

func (c *WidgetClient) DeleteOneID(id int) *WidgetDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*WidgetClient) Get

func (c *WidgetClient) Get(ctx context.Context, id int) (*Widget, error)

Get returns a Widget entity by its id.

func (*WidgetClient) GetX

func (c *WidgetClient) GetX(ctx context.Context, id int) *Widget

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

func (*WidgetClient) Hooks

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

Hooks returns the client hooks.

func (*WidgetClient) Query

func (c *WidgetClient) Query() *WidgetQuery

Query returns a query builder for Widget.

func (*WidgetClient) QueryType

func (c *WidgetClient) QueryType(w *Widget) *WidgetTypeQuery

QueryType queries the type edge of a Widget.

func (*WidgetClient) Update

func (c *WidgetClient) Update() *WidgetUpdate

Update returns an update builder for Widget.

func (*WidgetClient) UpdateOne

func (c *WidgetClient) UpdateOne(w *Widget) *WidgetUpdateOne

UpdateOne returns an update builder for the given entity.

func (*WidgetClient) UpdateOneID

func (c *WidgetClient) UpdateOneID(id int) *WidgetUpdateOne

UpdateOneID returns an update builder for the given id.

func (*WidgetClient) Use

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

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

type WidgetCreate

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

WidgetCreate is the builder for creating a Widget entity.

func (*WidgetCreate) Exec

func (wc *WidgetCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*WidgetCreate) ExecX

func (wc *WidgetCreate) ExecX(ctx context.Context)

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

func (*WidgetCreate) Mutation

func (wc *WidgetCreate) Mutation() *WidgetMutation

Mutation returns the WidgetMutation object of the builder.

func (*WidgetCreate) Save

func (wc *WidgetCreate) Save(ctx context.Context) (*Widget, error)

Save creates the Widget in the database.

func (*WidgetCreate) SaveX

func (wc *WidgetCreate) SaveX(ctx context.Context) *Widget

SaveX calls Save and panics if Save returns an error.

func (*WidgetCreate) SetCreatedAt

func (wc *WidgetCreate) SetCreatedAt(t time.Time) *WidgetCreate

SetCreatedAt sets the "created_at" field.

func (*WidgetCreate) SetNillableCreatedAt

func (wc *WidgetCreate) SetNillableCreatedAt(t *time.Time) *WidgetCreate

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

func (*WidgetCreate) SetNillablePriority

func (wc *WidgetCreate) SetNillablePriority(i *int) *WidgetCreate

SetNillablePriority sets the "priority" field if the given value is not nil.

func (*WidgetCreate) SetNillableStatus

func (wc *WidgetCreate) SetNillableStatus(w *widget.Status) *WidgetCreate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*WidgetCreate) SetNillableTypeID

func (wc *WidgetCreate) SetNillableTypeID(id *int) *WidgetCreate

SetNillableTypeID sets the "type" edge to the WidgetType entity by ID if the given value is not nil.

func (*WidgetCreate) SetNote

func (wc *WidgetCreate) SetNote(s string) *WidgetCreate

SetNote sets the "note" field.

func (*WidgetCreate) SetPriority

func (wc *WidgetCreate) SetPriority(i int) *WidgetCreate

SetPriority sets the "priority" field.

func (*WidgetCreate) SetStatus

func (wc *WidgetCreate) SetStatus(w widget.Status) *WidgetCreate

SetStatus sets the "status" field.

func (*WidgetCreate) SetType

func (wc *WidgetCreate) SetType(w *WidgetType) *WidgetCreate

SetType sets the "type" edge to the WidgetType entity.

func (*WidgetCreate) SetTypeID

func (wc *WidgetCreate) SetTypeID(id int) *WidgetCreate

SetTypeID sets the "type" edge to the WidgetType entity by ID.

type WidgetCreateBulk

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

WidgetCreateBulk is the builder for creating many Widget entities in bulk.

func (*WidgetCreateBulk) Exec

func (wcb *WidgetCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*WidgetCreateBulk) ExecX

func (wcb *WidgetCreateBulk) ExecX(ctx context.Context)

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

func (*WidgetCreateBulk) Save

func (wcb *WidgetCreateBulk) Save(ctx context.Context) ([]*Widget, error)

Save creates the Widget entities in the database.

func (*WidgetCreateBulk) SaveX

func (wcb *WidgetCreateBulk) SaveX(ctx context.Context) []*Widget

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

type WidgetDelete

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

WidgetDelete is the builder for deleting a Widget entity.

func (*WidgetDelete) Exec

func (wd *WidgetDelete) Exec(ctx context.Context) (int, error)

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

func (*WidgetDelete) ExecX

func (wd *WidgetDelete) ExecX(ctx context.Context) int

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

func (*WidgetDelete) Where

func (wd *WidgetDelete) Where(ps ...predicate.Widget) *WidgetDelete

Where appends a list predicates to the WidgetDelete builder.

type WidgetDeleteOne

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

WidgetDeleteOne is the builder for deleting a single Widget entity.

func (*WidgetDeleteOne) Exec

func (wdo *WidgetDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*WidgetDeleteOne) ExecX

func (wdo *WidgetDeleteOne) ExecX(ctx context.Context)

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

type WidgetEdges

type WidgetEdges struct {
	// Type holds the value of the type edge.
	Type *WidgetType `json:"type,omitempty"`
	// contains filtered or unexported fields
}

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

func (WidgetEdges) TypeOrErr

func (e WidgetEdges) TypeOrErr() (*WidgetType, error)

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

type WidgetGroupBy

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

WidgetGroupBy is the group-by builder for Widget entities.

func (*WidgetGroupBy) Aggregate

func (wgb *WidgetGroupBy) Aggregate(fns ...AggregateFunc) *WidgetGroupBy

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

func (*WidgetGroupBy) Bool

func (wgb *WidgetGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*WidgetGroupBy) BoolX

func (wgb *WidgetGroupBy) BoolX(ctx context.Context) bool

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

func (*WidgetGroupBy) Bools

func (wgb *WidgetGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*WidgetGroupBy) BoolsX

func (wgb *WidgetGroupBy) BoolsX(ctx context.Context) []bool

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

func (*WidgetGroupBy) Float64

func (wgb *WidgetGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*WidgetGroupBy) Float64X

func (wgb *WidgetGroupBy) Float64X(ctx context.Context) float64

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

func (*WidgetGroupBy) Float64s

func (wgb *WidgetGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*WidgetGroupBy) Float64sX

func (wgb *WidgetGroupBy) Float64sX(ctx context.Context) []float64

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

func (*WidgetGroupBy) Int

func (wgb *WidgetGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*WidgetGroupBy) IntX

func (wgb *WidgetGroupBy) IntX(ctx context.Context) int

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

func (*WidgetGroupBy) Ints

func (wgb *WidgetGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*WidgetGroupBy) IntsX

func (wgb *WidgetGroupBy) IntsX(ctx context.Context) []int

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

func (*WidgetGroupBy) Scan

func (wgb *WidgetGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*WidgetGroupBy) ScanX

func (wgb *WidgetGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*WidgetGroupBy) String

func (wgb *WidgetGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*WidgetGroupBy) StringX

func (wgb *WidgetGroupBy) StringX(ctx context.Context) string

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

func (*WidgetGroupBy) Strings

func (wgb *WidgetGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*WidgetGroupBy) StringsX

func (wgb *WidgetGroupBy) StringsX(ctx context.Context) []string

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

type WidgetMutation

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

WidgetMutation represents an operation that mutates the Widget nodes in the graph.

func (*WidgetMutation) AddField

func (m *WidgetMutation) 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 (*WidgetMutation) AddPriority

func (m *WidgetMutation) AddPriority(i int)

AddPriority adds i to the "priority" field.

func (*WidgetMutation) AddedEdges

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

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

func (*WidgetMutation) AddedField

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

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

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

func (*WidgetMutation) AddedIDs

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

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

func (*WidgetMutation) AddedPriority

func (m *WidgetMutation) AddedPriority() (r int, exists bool)

AddedPriority returns the value that was added to the "priority" field in this mutation.

func (*WidgetMutation) ClearEdge

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

func (m *WidgetMutation) 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 (*WidgetMutation) ClearType

func (m *WidgetMutation) ClearType()

ClearType clears the "type" edge to the WidgetType entity.

func (*WidgetMutation) ClearedEdges

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

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

func (*WidgetMutation) ClearedFields

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

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

func (WidgetMutation) Client

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

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

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

func (*WidgetMutation) EdgeCleared

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

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

func (*WidgetMutation) Field

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

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

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

func (*WidgetMutation) Fields

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

func (m *WidgetMutation) 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 (*WidgetMutation) Note

func (m *WidgetMutation) Note() (r string, exists bool)

Note returns the value of the "note" field in the mutation.

func (*WidgetMutation) OldCreatedAt

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

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

func (m *WidgetMutation) 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 (*WidgetMutation) OldNote

func (m *WidgetMutation) OldNote(ctx context.Context) (v string, err error)

OldNote returns the old "note" field's value of the Widget entity. If the Widget 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 (*WidgetMutation) OldPriority

func (m *WidgetMutation) OldPriority(ctx context.Context) (v int, err error)

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

func (m *WidgetMutation) OldStatus(ctx context.Context) (v widget.Status, err error)

OldStatus returns the old "status" field's value of the Widget entity. If the Widget 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 (*WidgetMutation) Op

func (m *WidgetMutation) Op() Op

Op returns the operation name.

func (*WidgetMutation) Priority

func (m *WidgetMutation) Priority() (r int, exists bool)

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

func (*WidgetMutation) RemovedEdges

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

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

func (*WidgetMutation) RemovedIDs

func (m *WidgetMutation) 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 (*WidgetMutation) ResetCreatedAt

func (m *WidgetMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*WidgetMutation) ResetEdge

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

func (m *WidgetMutation) 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 (*WidgetMutation) ResetNote

func (m *WidgetMutation) ResetNote()

ResetNote resets all changes to the "note" field.

func (*WidgetMutation) ResetPriority

func (m *WidgetMutation) ResetPriority()

ResetPriority resets all changes to the "priority" field.

func (*WidgetMutation) ResetStatus

func (m *WidgetMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*WidgetMutation) ResetType

func (m *WidgetMutation) ResetType()

ResetType resets all changes to the "type" edge.

func (*WidgetMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*WidgetMutation) SetField

func (m *WidgetMutation) 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 (*WidgetMutation) SetNote

func (m *WidgetMutation) SetNote(s string)

SetNote sets the "note" field.

func (*WidgetMutation) SetPriority

func (m *WidgetMutation) SetPriority(i int)

SetPriority sets the "priority" field.

func (*WidgetMutation) SetStatus

func (m *WidgetMutation) SetStatus(w widget.Status)

SetStatus sets the "status" field.

func (*WidgetMutation) SetTypeID

func (m *WidgetMutation) SetTypeID(id int)

SetTypeID sets the "type" edge to the WidgetType entity by id.

func (*WidgetMutation) Status

func (m *WidgetMutation) Status() (r widget.Status, exists bool)

Status returns the value of the "status" field in the mutation.

func (WidgetMutation) Tx

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

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

func (*WidgetMutation) Type

func (m *WidgetMutation) Type() string

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

func (*WidgetMutation) TypeCleared

func (m *WidgetMutation) TypeCleared() bool

TypeCleared reports if the "type" edge to the WidgetType entity was cleared.

func (*WidgetMutation) TypeID

func (m *WidgetMutation) TypeID() (id int, exists bool)

TypeID returns the "type" edge ID in the mutation.

func (*WidgetMutation) TypeIDs

func (m *WidgetMutation) TypeIDs() (ids []int)

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

func (*WidgetMutation) Where

func (m *WidgetMutation) Where(ps ...predicate.Widget)

Where appends a list predicates to the WidgetMutation builder.

type WidgetQuery

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

WidgetQuery is the builder for querying Widget entities.

func (*WidgetQuery) All

func (wq *WidgetQuery) All(ctx context.Context) ([]*Widget, error)

All executes the query and returns a list of Widgets.

func (*WidgetQuery) AllX

func (wq *WidgetQuery) AllX(ctx context.Context) []*Widget

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

func (*WidgetQuery) Clone

func (wq *WidgetQuery) Clone() *WidgetQuery

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

func (*WidgetQuery) Count

func (wq *WidgetQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*WidgetQuery) CountX

func (wq *WidgetQuery) CountX(ctx context.Context) int

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

func (*WidgetQuery) Exist

func (wq *WidgetQuery) Exist(ctx context.Context) (bool, error)

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

func (*WidgetQuery) ExistX

func (wq *WidgetQuery) ExistX(ctx context.Context) bool

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

func (*WidgetQuery) First

func (wq *WidgetQuery) First(ctx context.Context) (*Widget, error)

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

func (*WidgetQuery) FirstID

func (wq *WidgetQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*WidgetQuery) FirstIDX

func (wq *WidgetQuery) FirstIDX(ctx context.Context) int

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

func (*WidgetQuery) FirstX

func (wq *WidgetQuery) FirstX(ctx context.Context) *Widget

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

func (*WidgetQuery) GroupBy

func (wq *WidgetQuery) GroupBy(field string, fields ...string) *WidgetGroupBy

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 {
	Note string `json:"note,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Widget.Query().
	GroupBy(widget.FieldNote).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*WidgetQuery) IDs

func (wq *WidgetQuery) IDs(ctx context.Context) ([]int, error)

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

func (*WidgetQuery) IDsX

func (wq *WidgetQuery) IDsX(ctx context.Context) []int

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

func (*WidgetQuery) Limit

func (wq *WidgetQuery) Limit(limit int) *WidgetQuery

Limit adds a limit step to the query.

func (*WidgetQuery) Offset

func (wq *WidgetQuery) Offset(offset int) *WidgetQuery

Offset adds an offset step to the query.

func (*WidgetQuery) Only

func (wq *WidgetQuery) Only(ctx context.Context) (*Widget, error)

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

func (*WidgetQuery) OnlyID

func (wq *WidgetQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*WidgetQuery) OnlyIDX

func (wq *WidgetQuery) OnlyIDX(ctx context.Context) int

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

func (*WidgetQuery) OnlyX

func (wq *WidgetQuery) OnlyX(ctx context.Context) *Widget

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

func (*WidgetQuery) Order

func (wq *WidgetQuery) Order(o ...OrderFunc) *WidgetQuery

Order adds an order step to the query.

func (*WidgetQuery) QueryType

func (wq *WidgetQuery) QueryType() *WidgetTypeQuery

QueryType chains the current query on the "type" edge.

func (*WidgetQuery) Select

func (wq *WidgetQuery) Select(fields ...string) *WidgetSelect

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 {
	Note string `json:"note,omitempty"`
}

client.Widget.Query().
	Select(widget.FieldNote).
	Scan(ctx, &v)

func (*WidgetQuery) Unique

func (wq *WidgetQuery) Unique(unique bool) *WidgetQuery

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

func (wq *WidgetQuery) Where(ps ...predicate.Widget) *WidgetQuery

Where adds a new predicate for the WidgetQuery builder.

func (*WidgetQuery) WithType

func (wq *WidgetQuery) WithType(opts ...func(*WidgetTypeQuery)) *WidgetQuery

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

type WidgetSelect

type WidgetSelect struct {
	*WidgetQuery
	// contains filtered or unexported fields
}

WidgetSelect is the builder for selecting fields of Widget entities.

func (*WidgetSelect) Bool

func (ws *WidgetSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*WidgetSelect) BoolX

func (ws *WidgetSelect) BoolX(ctx context.Context) bool

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

func (*WidgetSelect) Bools

func (ws *WidgetSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*WidgetSelect) BoolsX

func (ws *WidgetSelect) BoolsX(ctx context.Context) []bool

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

func (*WidgetSelect) Float64

func (ws *WidgetSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*WidgetSelect) Float64X

func (ws *WidgetSelect) Float64X(ctx context.Context) float64

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

func (*WidgetSelect) Float64s

func (ws *WidgetSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*WidgetSelect) Float64sX

func (ws *WidgetSelect) Float64sX(ctx context.Context) []float64

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

func (*WidgetSelect) Int

func (ws *WidgetSelect) Int(ctx context.Context) (_ int, err error)

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

func (*WidgetSelect) IntX

func (ws *WidgetSelect) IntX(ctx context.Context) int

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

func (*WidgetSelect) Ints

func (ws *WidgetSelect) Ints(ctx context.Context) ([]int, error)

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

func (*WidgetSelect) IntsX

func (ws *WidgetSelect) IntsX(ctx context.Context) []int

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

func (*WidgetSelect) Scan

func (ws *WidgetSelect) Scan(ctx context.Context, v interface{}) error

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

func (*WidgetSelect) ScanX

func (ws *WidgetSelect) ScanX(ctx context.Context, v interface{})

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

func (*WidgetSelect) String

func (ws *WidgetSelect) String(ctx context.Context) (_ string, err error)

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

func (*WidgetSelect) StringX

func (ws *WidgetSelect) StringX(ctx context.Context) string

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

func (*WidgetSelect) Strings

func (ws *WidgetSelect) Strings(ctx context.Context) ([]string, error)

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

func (*WidgetSelect) StringsX

func (ws *WidgetSelect) StringsX(ctx context.Context) []string

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

type WidgetType

type WidgetType struct {

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

WidgetType is the model entity for the WidgetType schema.

func (*WidgetType) String

func (wt *WidgetType) String() string

String implements the fmt.Stringer.

func (*WidgetType) Unwrap

func (wt *WidgetType) Unwrap() *WidgetType

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

func (wt *WidgetType) Update() *WidgetTypeUpdateOne

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

type WidgetTypeClient

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

WidgetTypeClient is a client for the WidgetType schema.

func NewWidgetTypeClient

func NewWidgetTypeClient(c config) *WidgetTypeClient

NewWidgetTypeClient returns a client for the WidgetType from the given config.

func (*WidgetTypeClient) Create

func (c *WidgetTypeClient) Create() *WidgetTypeCreate

Create returns a create builder for WidgetType.

func (*WidgetTypeClient) CreateBulk

func (c *WidgetTypeClient) CreateBulk(builders ...*WidgetTypeCreate) *WidgetTypeCreateBulk

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

func (*WidgetTypeClient) Delete

func (c *WidgetTypeClient) Delete() *WidgetTypeDelete

Delete returns a delete builder for WidgetType.

func (*WidgetTypeClient) DeleteOne

func (c *WidgetTypeClient) DeleteOne(wt *WidgetType) *WidgetTypeDeleteOne

DeleteOne returns a delete builder for the given entity.

func (*WidgetTypeClient) DeleteOneID

func (c *WidgetTypeClient) DeleteOneID(id int) *WidgetTypeDeleteOne

DeleteOneID returns a delete builder for the given id.

func (*WidgetTypeClient) Get

func (c *WidgetTypeClient) Get(ctx context.Context, id int) (*WidgetType, error)

Get returns a WidgetType entity by its id.

func (*WidgetTypeClient) GetX

func (c *WidgetTypeClient) GetX(ctx context.Context, id int) *WidgetType

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

func (*WidgetTypeClient) Hooks

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

Hooks returns the client hooks.

func (*WidgetTypeClient) Query

func (c *WidgetTypeClient) Query() *WidgetTypeQuery

Query returns a query builder for WidgetType.

func (*WidgetTypeClient) Update

func (c *WidgetTypeClient) Update() *WidgetTypeUpdate

Update returns an update builder for WidgetType.

func (*WidgetTypeClient) UpdateOne

func (c *WidgetTypeClient) UpdateOne(wt *WidgetType) *WidgetTypeUpdateOne

UpdateOne returns an update builder for the given entity.

func (*WidgetTypeClient) UpdateOneID

func (c *WidgetTypeClient) UpdateOneID(id int) *WidgetTypeUpdateOne

UpdateOneID returns an update builder for the given id.

func (*WidgetTypeClient) Use

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

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

type WidgetTypeCreate

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

WidgetTypeCreate is the builder for creating a WidgetType entity.

func (*WidgetTypeCreate) Exec

func (wtc *WidgetTypeCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*WidgetTypeCreate) ExecX

func (wtc *WidgetTypeCreate) ExecX(ctx context.Context)

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

func (*WidgetTypeCreate) Mutation

func (wtc *WidgetTypeCreate) Mutation() *WidgetTypeMutation

Mutation returns the WidgetTypeMutation object of the builder.

func (*WidgetTypeCreate) Save

func (wtc *WidgetTypeCreate) Save(ctx context.Context) (*WidgetType, error)

Save creates the WidgetType in the database.

func (*WidgetTypeCreate) SaveX

func (wtc *WidgetTypeCreate) SaveX(ctx context.Context) *WidgetType

SaveX calls Save and panics if Save returns an error.

func (*WidgetTypeCreate) SetName

func (wtc *WidgetTypeCreate) SetName(s string) *WidgetTypeCreate

SetName sets the "name" field.

type WidgetTypeCreateBulk

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

WidgetTypeCreateBulk is the builder for creating many WidgetType entities in bulk.

func (*WidgetTypeCreateBulk) Exec

func (wtcb *WidgetTypeCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*WidgetTypeCreateBulk) ExecX

func (wtcb *WidgetTypeCreateBulk) ExecX(ctx context.Context)

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

func (*WidgetTypeCreateBulk) Save

func (wtcb *WidgetTypeCreateBulk) Save(ctx context.Context) ([]*WidgetType, error)

Save creates the WidgetType entities in the database.

func (*WidgetTypeCreateBulk) SaveX

func (wtcb *WidgetTypeCreateBulk) SaveX(ctx context.Context) []*WidgetType

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

type WidgetTypeDelete

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

WidgetTypeDelete is the builder for deleting a WidgetType entity.

func (*WidgetTypeDelete) Exec

func (wtd *WidgetTypeDelete) Exec(ctx context.Context) (int, error)

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

func (*WidgetTypeDelete) ExecX

func (wtd *WidgetTypeDelete) ExecX(ctx context.Context) int

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

func (*WidgetTypeDelete) Where

Where appends a list predicates to the WidgetTypeDelete builder.

type WidgetTypeDeleteOne

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

WidgetTypeDeleteOne is the builder for deleting a single WidgetType entity.

func (*WidgetTypeDeleteOne) Exec

func (wtdo *WidgetTypeDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*WidgetTypeDeleteOne) ExecX

func (wtdo *WidgetTypeDeleteOne) ExecX(ctx context.Context)

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

type WidgetTypeGroupBy

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

WidgetTypeGroupBy is the group-by builder for WidgetType entities.

func (*WidgetTypeGroupBy) Aggregate

func (wtgb *WidgetTypeGroupBy) Aggregate(fns ...AggregateFunc) *WidgetTypeGroupBy

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

func (*WidgetTypeGroupBy) Bool

func (wtgb *WidgetTypeGroupBy) Bool(ctx context.Context) (_ bool, err error)

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

func (*WidgetTypeGroupBy) BoolX

func (wtgb *WidgetTypeGroupBy) BoolX(ctx context.Context) bool

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

func (*WidgetTypeGroupBy) Bools

func (wtgb *WidgetTypeGroupBy) Bools(ctx context.Context) ([]bool, error)

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

func (*WidgetTypeGroupBy) BoolsX

func (wtgb *WidgetTypeGroupBy) BoolsX(ctx context.Context) []bool

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

func (*WidgetTypeGroupBy) Float64

func (wtgb *WidgetTypeGroupBy) Float64(ctx context.Context) (_ float64, err error)

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

func (*WidgetTypeGroupBy) Float64X

func (wtgb *WidgetTypeGroupBy) Float64X(ctx context.Context) float64

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

func (*WidgetTypeGroupBy) Float64s

func (wtgb *WidgetTypeGroupBy) Float64s(ctx context.Context) ([]float64, error)

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

func (*WidgetTypeGroupBy) Float64sX

func (wtgb *WidgetTypeGroupBy) Float64sX(ctx context.Context) []float64

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

func (*WidgetTypeGroupBy) Int

func (wtgb *WidgetTypeGroupBy) Int(ctx context.Context) (_ int, err error)

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

func (*WidgetTypeGroupBy) IntX

func (wtgb *WidgetTypeGroupBy) IntX(ctx context.Context) int

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

func (*WidgetTypeGroupBy) Ints

func (wtgb *WidgetTypeGroupBy) Ints(ctx context.Context) ([]int, error)

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

func (*WidgetTypeGroupBy) IntsX

func (wtgb *WidgetTypeGroupBy) IntsX(ctx context.Context) []int

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

func (*WidgetTypeGroupBy) Scan

func (wtgb *WidgetTypeGroupBy) Scan(ctx context.Context, v interface{}) error

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

func (*WidgetTypeGroupBy) ScanX

func (wtgb *WidgetTypeGroupBy) ScanX(ctx context.Context, v interface{})

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

func (*WidgetTypeGroupBy) String

func (wtgb *WidgetTypeGroupBy) String(ctx context.Context) (_ string, err error)

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

func (*WidgetTypeGroupBy) StringX

func (wtgb *WidgetTypeGroupBy) StringX(ctx context.Context) string

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

func (*WidgetTypeGroupBy) Strings

func (wtgb *WidgetTypeGroupBy) Strings(ctx context.Context) ([]string, error)

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

func (*WidgetTypeGroupBy) StringsX

func (wtgb *WidgetTypeGroupBy) StringsX(ctx context.Context) []string

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

type WidgetTypeMutation

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

WidgetTypeMutation represents an operation that mutates the WidgetType nodes in the graph.

func (*WidgetTypeMutation) AddField

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

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

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

func (*WidgetTypeMutation) AddedField

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

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

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

func (*WidgetTypeMutation) AddedIDs

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

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

func (*WidgetTypeMutation) ClearEdge

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

func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ClearedEdges

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

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

func (*WidgetTypeMutation) ClearedFields

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

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

func (WidgetTypeMutation) Client

func (m WidgetTypeMutation) 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 (*WidgetTypeMutation) EdgeCleared

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

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

func (*WidgetTypeMutation) Field

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

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

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

func (*WidgetTypeMutation) Fields

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

func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) Name

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

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

func (*WidgetTypeMutation) OldField

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

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

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

func (m *WidgetTypeMutation) Op() Op

Op returns the operation name.

func (*WidgetTypeMutation) RemovedEdges

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

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

func (*WidgetTypeMutation) RemovedIDs

func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ResetEdge

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

func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) ResetName

func (m *WidgetTypeMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*WidgetTypeMutation) SetField

func (m *WidgetTypeMutation) 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 (*WidgetTypeMutation) SetName

func (m *WidgetTypeMutation) SetName(s string)

SetName sets the "name" field.

func (WidgetTypeMutation) Tx

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

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

func (*WidgetTypeMutation) Type

func (m *WidgetTypeMutation) Type() string

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

func (*WidgetTypeMutation) Where

func (m *WidgetTypeMutation) Where(ps ...predicate.WidgetType)

Where appends a list predicates to the WidgetTypeMutation builder.

type WidgetTypeQuery

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

WidgetTypeQuery is the builder for querying WidgetType entities.

func (*WidgetTypeQuery) All

func (wtq *WidgetTypeQuery) All(ctx context.Context) ([]*WidgetType, error)

All executes the query and returns a list of WidgetTypes.

func (*WidgetTypeQuery) AllX

func (wtq *WidgetTypeQuery) AllX(ctx context.Context) []*WidgetType

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

func (*WidgetTypeQuery) Clone

func (wtq *WidgetTypeQuery) Clone() *WidgetTypeQuery

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

func (*WidgetTypeQuery) Count

func (wtq *WidgetTypeQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*WidgetTypeQuery) CountX

func (wtq *WidgetTypeQuery) CountX(ctx context.Context) int

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

func (*WidgetTypeQuery) Exist

func (wtq *WidgetTypeQuery) Exist(ctx context.Context) (bool, error)

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

func (*WidgetTypeQuery) ExistX

func (wtq *WidgetTypeQuery) ExistX(ctx context.Context) bool

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

func (*WidgetTypeQuery) First

func (wtq *WidgetTypeQuery) First(ctx context.Context) (*WidgetType, error)

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

func (*WidgetTypeQuery) FirstID

func (wtq *WidgetTypeQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*WidgetTypeQuery) FirstIDX

func (wtq *WidgetTypeQuery) FirstIDX(ctx context.Context) int

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

func (*WidgetTypeQuery) FirstX

func (wtq *WidgetTypeQuery) FirstX(ctx context.Context) *WidgetType

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

func (*WidgetTypeQuery) GroupBy

func (wtq *WidgetTypeQuery) GroupBy(field string, fields ...string) *WidgetTypeGroupBy

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

Example:

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

client.WidgetType.Query().
	GroupBy(widgettype.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*WidgetTypeQuery) IDs

func (wtq *WidgetTypeQuery) IDs(ctx context.Context) ([]int, error)

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

func (*WidgetTypeQuery) IDsX

func (wtq *WidgetTypeQuery) IDsX(ctx context.Context) []int

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

func (*WidgetTypeQuery) Limit

func (wtq *WidgetTypeQuery) Limit(limit int) *WidgetTypeQuery

Limit adds a limit step to the query.

func (*WidgetTypeQuery) Offset

func (wtq *WidgetTypeQuery) Offset(offset int) *WidgetTypeQuery

Offset adds an offset step to the query.

func (*WidgetTypeQuery) Only

func (wtq *WidgetTypeQuery) Only(ctx context.Context) (*WidgetType, error)

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

func (*WidgetTypeQuery) OnlyID

func (wtq *WidgetTypeQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*WidgetTypeQuery) OnlyIDX

func (wtq *WidgetTypeQuery) OnlyIDX(ctx context.Context) int

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

func (*WidgetTypeQuery) OnlyX

func (wtq *WidgetTypeQuery) OnlyX(ctx context.Context) *WidgetType

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

func (*WidgetTypeQuery) Order

func (wtq *WidgetTypeQuery) Order(o ...OrderFunc) *WidgetTypeQuery

Order adds an order step to the query.

func (*WidgetTypeQuery) Select

func (wtq *WidgetTypeQuery) Select(fields ...string) *WidgetTypeSelect

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

Example:

var v []struct {
	Name string `json:"name,omitempty"`
}

client.WidgetType.Query().
	Select(widgettype.FieldName).
	Scan(ctx, &v)

func (*WidgetTypeQuery) Unique

func (wtq *WidgetTypeQuery) Unique(unique bool) *WidgetTypeQuery

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

Where adds a new predicate for the WidgetTypeQuery builder.

type WidgetTypeSelect

type WidgetTypeSelect struct {
	*WidgetTypeQuery
	// contains filtered or unexported fields
}

WidgetTypeSelect is the builder for selecting fields of WidgetType entities.

func (*WidgetTypeSelect) Bool

func (wts *WidgetTypeSelect) Bool(ctx context.Context) (_ bool, err error)

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

func (*WidgetTypeSelect) BoolX

func (wts *WidgetTypeSelect) BoolX(ctx context.Context) bool

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

func (*WidgetTypeSelect) Bools

func (wts *WidgetTypeSelect) Bools(ctx context.Context) ([]bool, error)

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

func (*WidgetTypeSelect) BoolsX

func (wts *WidgetTypeSelect) BoolsX(ctx context.Context) []bool

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

func (*WidgetTypeSelect) Float64

func (wts *WidgetTypeSelect) Float64(ctx context.Context) (_ float64, err error)

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

func (*WidgetTypeSelect) Float64X

func (wts *WidgetTypeSelect) Float64X(ctx context.Context) float64

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

func (*WidgetTypeSelect) Float64s

func (wts *WidgetTypeSelect) Float64s(ctx context.Context) ([]float64, error)

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

func (*WidgetTypeSelect) Float64sX

func (wts *WidgetTypeSelect) Float64sX(ctx context.Context) []float64

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

func (*WidgetTypeSelect) Int

func (wts *WidgetTypeSelect) Int(ctx context.Context) (_ int, err error)

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

func (*WidgetTypeSelect) IntX

func (wts *WidgetTypeSelect) IntX(ctx context.Context) int

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

func (*WidgetTypeSelect) Ints

func (wts *WidgetTypeSelect) Ints(ctx context.Context) ([]int, error)

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

func (*WidgetTypeSelect) IntsX

func (wts *WidgetTypeSelect) IntsX(ctx context.Context) []int

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

func (*WidgetTypeSelect) Scan

func (wts *WidgetTypeSelect) Scan(ctx context.Context, v interface{}) error

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

func (*WidgetTypeSelect) ScanX

func (wts *WidgetTypeSelect) ScanX(ctx context.Context, v interface{})

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

func (*WidgetTypeSelect) String

func (wts *WidgetTypeSelect) String(ctx context.Context) (_ string, err error)

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

func (*WidgetTypeSelect) StringX

func (wts *WidgetTypeSelect) StringX(ctx context.Context) string

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

func (*WidgetTypeSelect) Strings

func (wts *WidgetTypeSelect) Strings(ctx context.Context) ([]string, error)

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

func (*WidgetTypeSelect) StringsX

func (wts *WidgetTypeSelect) StringsX(ctx context.Context) []string

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

type WidgetTypeUpdate

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

WidgetTypeUpdate is the builder for updating WidgetType entities.

func (*WidgetTypeUpdate) Exec

func (wtu *WidgetTypeUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*WidgetTypeUpdate) ExecX

func (wtu *WidgetTypeUpdate) ExecX(ctx context.Context)

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

func (*WidgetTypeUpdate) Mutation

func (wtu *WidgetTypeUpdate) Mutation() *WidgetTypeMutation

Mutation returns the WidgetTypeMutation object of the builder.

func (*WidgetTypeUpdate) Save

func (wtu *WidgetTypeUpdate) Save(ctx context.Context) (int, error)

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

func (*WidgetTypeUpdate) SaveX

func (wtu *WidgetTypeUpdate) SaveX(ctx context.Context) int

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

func (*WidgetTypeUpdate) SetName

func (wtu *WidgetTypeUpdate) SetName(s string) *WidgetTypeUpdate

SetName sets the "name" field.

func (*WidgetTypeUpdate) Where

Where appends a list predicates to the WidgetTypeUpdate builder.

type WidgetTypeUpdateOne

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

WidgetTypeUpdateOne is the builder for updating a single WidgetType entity.

func (*WidgetTypeUpdateOne) Exec

func (wtuo *WidgetTypeUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*WidgetTypeUpdateOne) ExecX

func (wtuo *WidgetTypeUpdateOne) ExecX(ctx context.Context)

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

func (*WidgetTypeUpdateOne) Mutation

func (wtuo *WidgetTypeUpdateOne) Mutation() *WidgetTypeMutation

Mutation returns the WidgetTypeMutation object of the builder.

func (*WidgetTypeUpdateOne) Save

func (wtuo *WidgetTypeUpdateOne) Save(ctx context.Context) (*WidgetType, error)

Save executes the query and returns the updated WidgetType entity.

func (*WidgetTypeUpdateOne) SaveX

func (wtuo *WidgetTypeUpdateOne) SaveX(ctx context.Context) *WidgetType

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

func (*WidgetTypeUpdateOne) Select

func (wtuo *WidgetTypeUpdateOne) Select(field string, fields ...string) *WidgetTypeUpdateOne

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

func (*WidgetTypeUpdateOne) SetName

SetName sets the "name" field.

type WidgetTypes

type WidgetTypes []*WidgetType

WidgetTypes is a parsable slice of WidgetType.

type WidgetUpdate

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

WidgetUpdate is the builder for updating Widget entities.

func (*WidgetUpdate) AddPriority

func (wu *WidgetUpdate) AddPriority(i int) *WidgetUpdate

AddPriority adds i to the "priority" field.

func (*WidgetUpdate) ClearType

func (wu *WidgetUpdate) ClearType() *WidgetUpdate

ClearType clears the "type" edge to the WidgetType entity.

func (*WidgetUpdate) Exec

func (wu *WidgetUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*WidgetUpdate) ExecX

func (wu *WidgetUpdate) ExecX(ctx context.Context)

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

func (*WidgetUpdate) Mutation

func (wu *WidgetUpdate) Mutation() *WidgetMutation

Mutation returns the WidgetMutation object of the builder.

func (*WidgetUpdate) Save

func (wu *WidgetUpdate) Save(ctx context.Context) (int, error)

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

func (*WidgetUpdate) SaveX

func (wu *WidgetUpdate) SaveX(ctx context.Context) int

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

func (*WidgetUpdate) SetNillablePriority

func (wu *WidgetUpdate) SetNillablePriority(i *int) *WidgetUpdate

SetNillablePriority sets the "priority" field if the given value is not nil.

func (*WidgetUpdate) SetNillableStatus

func (wu *WidgetUpdate) SetNillableStatus(w *widget.Status) *WidgetUpdate

SetNillableStatus sets the "status" field if the given value is not nil.

func (*WidgetUpdate) SetNillableTypeID

func (wu *WidgetUpdate) SetNillableTypeID(id *int) *WidgetUpdate

SetNillableTypeID sets the "type" edge to the WidgetType entity by ID if the given value is not nil.

func (*WidgetUpdate) SetNote

func (wu *WidgetUpdate) SetNote(s string) *WidgetUpdate

SetNote sets the "note" field.

func (*WidgetUpdate) SetPriority

func (wu *WidgetUpdate) SetPriority(i int) *WidgetUpdate

SetPriority sets the "priority" field.

func (*WidgetUpdate) SetStatus

func (wu *WidgetUpdate) SetStatus(w widget.Status) *WidgetUpdate

SetStatus sets the "status" field.

func (*WidgetUpdate) SetType

func (wu *WidgetUpdate) SetType(w *WidgetType) *WidgetUpdate

SetType sets the "type" edge to the WidgetType entity.

func (*WidgetUpdate) SetTypeID

func (wu *WidgetUpdate) SetTypeID(id int) *WidgetUpdate

SetTypeID sets the "type" edge to the WidgetType entity by ID.

func (*WidgetUpdate) Where

func (wu *WidgetUpdate) Where(ps ...predicate.Widget) *WidgetUpdate

Where appends a list predicates to the WidgetUpdate builder.

type WidgetUpdateOne

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

WidgetUpdateOne is the builder for updating a single Widget entity.

func (*WidgetUpdateOne) AddPriority

func (wuo *WidgetUpdateOne) AddPriority(i int) *WidgetUpdateOne

AddPriority adds i to the "priority" field.

func (*WidgetUpdateOne) ClearType

func (wuo *WidgetUpdateOne) ClearType() *WidgetUpdateOne

ClearType clears the "type" edge to the WidgetType entity.

func (*WidgetUpdateOne) Exec

func (wuo *WidgetUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*WidgetUpdateOne) ExecX

func (wuo *WidgetUpdateOne) ExecX(ctx context.Context)

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

func (*WidgetUpdateOne) Mutation

func (wuo *WidgetUpdateOne) Mutation() *WidgetMutation

Mutation returns the WidgetMutation object of the builder.

func (*WidgetUpdateOne) Save

func (wuo *WidgetUpdateOne) Save(ctx context.Context) (*Widget, error)

Save executes the query and returns the updated Widget entity.

func (*WidgetUpdateOne) SaveX

func (wuo *WidgetUpdateOne) SaveX(ctx context.Context) *Widget

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

func (*WidgetUpdateOne) Select

func (wuo *WidgetUpdateOne) Select(field string, fields ...string) *WidgetUpdateOne

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

func (*WidgetUpdateOne) SetNillablePriority

func (wuo *WidgetUpdateOne) SetNillablePriority(i *int) *WidgetUpdateOne

SetNillablePriority sets the "priority" field if the given value is not nil.

func (*WidgetUpdateOne) SetNillableStatus

func (wuo *WidgetUpdateOne) SetNillableStatus(w *widget.Status) *WidgetUpdateOne

SetNillableStatus sets the "status" field if the given value is not nil.

func (*WidgetUpdateOne) SetNillableTypeID

func (wuo *WidgetUpdateOne) SetNillableTypeID(id *int) *WidgetUpdateOne

SetNillableTypeID sets the "type" edge to the WidgetType entity by ID if the given value is not nil.

func (*WidgetUpdateOne) SetNote

func (wuo *WidgetUpdateOne) SetNote(s string) *WidgetUpdateOne

SetNote sets the "note" field.

func (*WidgetUpdateOne) SetPriority

func (wuo *WidgetUpdateOne) SetPriority(i int) *WidgetUpdateOne

SetPriority sets the "priority" field.

func (*WidgetUpdateOne) SetStatus

func (wuo *WidgetUpdateOne) SetStatus(w widget.Status) *WidgetUpdateOne

SetStatus sets the "status" field.

func (*WidgetUpdateOne) SetType

func (wuo *WidgetUpdateOne) SetType(w *WidgetType) *WidgetUpdateOne

SetType sets the "type" edge to the WidgetType entity.

func (*WidgetUpdateOne) SetTypeID

func (wuo *WidgetUpdateOne) SetTypeID(id int) *WidgetUpdateOne

SetTypeID sets the "type" edge to the WidgetType entity by ID.

type Widgets

type Widgets []*Widget

Widgets is a parsable slice of Widget.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL