ent

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: MIT Imports: 20 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.
	TypeIssue   = "Issue"
	TypeProject = "Project"
)

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
	// Issue is the client for interacting with the Issue builders.
	Issue *IssueClient
	// Project is the client for interacting with the Project builders.
	Project *ProjectClient
	// 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().
	Issue.
	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 Issue

type Issue struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the IssueQuery when eager-loading is set.
	Edges IssueEdges `json:"edges"`
	// contains filtered or unexported fields
}

Issue is the model entity for the Issue schema.

func (*Issue) QueryOwner

func (i *Issue) QueryOwner() *ProjectQuery

QueryOwner queries the "owner" edge of the Issue entity.

func (*Issue) String

func (i *Issue) String() string

String implements the fmt.Stringer.

func (*Issue) Unwrap

func (i *Issue) Unwrap() *Issue

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

func (i *Issue) Update() *IssueUpdateOne

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

type IssueClient

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

IssueClient is a client for the Issue schema.

func NewIssueClient

func NewIssueClient(c config) *IssueClient

NewIssueClient returns a client for the Issue from the given config.

func (*IssueClient) Create

func (c *IssueClient) Create() *IssueCreate

Create returns a builder for creating a Issue entity.

func (*IssueClient) CreateBulk

func (c *IssueClient) CreateBulk(builders ...*IssueCreate) *IssueCreateBulk

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

func (*IssueClient) Delete

func (c *IssueClient) Delete() *IssueDelete

Delete returns a delete builder for Issue.

func (*IssueClient) DeleteOne

func (c *IssueClient) DeleteOne(i *Issue) *IssueDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*IssueClient) DeleteOneID

func (c *IssueClient) DeleteOneID(id uuid.UUID) *IssueDeleteOne

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

func (*IssueClient) Get

func (c *IssueClient) Get(ctx context.Context, id uuid.UUID) (*Issue, error)

Get returns a Issue entity by its id.

func (*IssueClient) GetX

func (c *IssueClient) GetX(ctx context.Context, id uuid.UUID) *Issue

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

func (*IssueClient) Hooks

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

Hooks returns the client hooks.

func (*IssueClient) Query

func (c *IssueClient) Query() *IssueQuery

Query returns a query builder for Issue.

func (*IssueClient) QueryOwner

func (c *IssueClient) QueryOwner(i *Issue) *ProjectQuery

QueryOwner queries the owner edge of a Issue.

func (*IssueClient) Update

func (c *IssueClient) Update() *IssueUpdate

Update returns an update builder for Issue.

func (*IssueClient) UpdateOne

func (c *IssueClient) UpdateOne(i *Issue) *IssueUpdateOne

UpdateOne returns an update builder for the given entity.

func (*IssueClient) UpdateOneID

func (c *IssueClient) UpdateOneID(id uuid.UUID) *IssueUpdateOne

UpdateOneID returns an update builder for the given id.

func (*IssueClient) Use

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

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

type IssueCreate

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

IssueCreate is the builder for creating a Issue entity.

func (*IssueCreate) Exec

func (ic *IssueCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*IssueCreate) ExecX

func (ic *IssueCreate) ExecX(ctx context.Context)

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

func (*IssueCreate) Mutation

func (ic *IssueCreate) Mutation() *IssueMutation

Mutation returns the IssueMutation object of the builder.

func (*IssueCreate) Save

func (ic *IssueCreate) Save(ctx context.Context) (*Issue, error)

Save creates the Issue in the database.

func (*IssueCreate) SaveX

func (ic *IssueCreate) SaveX(ctx context.Context) *Issue

SaveX calls Save and panics if Save returns an error.

func (*IssueCreate) SetCreateTime

func (ic *IssueCreate) SetCreateTime(t time.Time) *IssueCreate

SetCreateTime sets the "create_time" field.

func (*IssueCreate) SetDescription

func (ic *IssueCreate) SetDescription(s string) *IssueCreate

SetDescription sets the "description" field.

func (*IssueCreate) SetID

func (ic *IssueCreate) SetID(u uuid.UUID) *IssueCreate

SetID sets the "id" field.

func (*IssueCreate) SetNillableCreateTime

func (ic *IssueCreate) SetNillableCreateTime(t *time.Time) *IssueCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*IssueCreate) SetNillableID

func (ic *IssueCreate) SetNillableID(u *uuid.UUID) *IssueCreate

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

func (*IssueCreate) SetNillableOwnerID

func (ic *IssueCreate) SetNillableOwnerID(id *uuid.UUID) *IssueCreate

SetNillableOwnerID sets the "owner" edge to the Project entity by ID if the given value is not nil.

func (*IssueCreate) SetNillableUpdateTime

func (ic *IssueCreate) SetNillableUpdateTime(t *time.Time) *IssueCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*IssueCreate) SetOwner

func (ic *IssueCreate) SetOwner(p *Project) *IssueCreate

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

func (*IssueCreate) SetOwnerID

func (ic *IssueCreate) SetOwnerID(id uuid.UUID) *IssueCreate

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

func (*IssueCreate) SetTitle

func (ic *IssueCreate) SetTitle(s string) *IssueCreate

SetTitle sets the "title" field.

func (*IssueCreate) SetUpdateTime

func (ic *IssueCreate) SetUpdateTime(t time.Time) *IssueCreate

SetUpdateTime sets the "update_time" field.

type IssueCreateBulk

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

IssueCreateBulk is the builder for creating many Issue entities in bulk.

func (*IssueCreateBulk) Exec

func (icb *IssueCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*IssueCreateBulk) ExecX

func (icb *IssueCreateBulk) ExecX(ctx context.Context)

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

func (*IssueCreateBulk) Save

func (icb *IssueCreateBulk) Save(ctx context.Context) ([]*Issue, error)

Save creates the Issue entities in the database.

func (*IssueCreateBulk) SaveX

func (icb *IssueCreateBulk) SaveX(ctx context.Context) []*Issue

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

type IssueDelete

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

IssueDelete is the builder for deleting a Issue entity.

func (*IssueDelete) Exec

func (id *IssueDelete) Exec(ctx context.Context) (int, error)

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

func (*IssueDelete) ExecX

func (id *IssueDelete) ExecX(ctx context.Context) int

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

func (*IssueDelete) Where

func (id *IssueDelete) Where(ps ...predicate.Issue) *IssueDelete

Where appends a list predicates to the IssueDelete builder.

type IssueDeleteOne

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

IssueDeleteOne is the builder for deleting a single Issue entity.

func (*IssueDeleteOne) Exec

func (ido *IssueDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*IssueDeleteOne) ExecX

func (ido *IssueDeleteOne) ExecX(ctx context.Context)

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

type IssueEdges

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

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

func (IssueEdges) OwnerOrErr

func (e IssueEdges) OwnerOrErr() (*Project, error)

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

type IssueGroupBy

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

IssueGroupBy is the group-by builder for Issue entities.

func (*IssueGroupBy) Aggregate

func (igb *IssueGroupBy) Aggregate(fns ...AggregateFunc) *IssueGroupBy

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

func (*IssueGroupBy) Bool

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

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

func (*IssueGroupBy) BoolX

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

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

func (*IssueGroupBy) Bools

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

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

func (*IssueGroupBy) BoolsX

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

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

func (*IssueGroupBy) Float64

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

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

func (*IssueGroupBy) Float64X

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

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

func (*IssueGroupBy) Float64s

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

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

func (*IssueGroupBy) Float64sX

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

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

func (*IssueGroupBy) Int

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

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

func (*IssueGroupBy) IntX

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

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

func (*IssueGroupBy) Ints

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

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

func (*IssueGroupBy) IntsX

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

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

func (*IssueGroupBy) Scan

func (igb *IssueGroupBy) Scan(ctx context.Context, v any) error

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

func (*IssueGroupBy) ScanX

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

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

func (*IssueGroupBy) String

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

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

func (*IssueGroupBy) StringX

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

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

func (*IssueGroupBy) Strings

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

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

func (*IssueGroupBy) StringsX

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

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

type IssueMutation

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

IssueMutation represents an operation that mutates the Issue nodes in the graph.

func (*IssueMutation) AddField

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

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

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

func (*IssueMutation) AddedField

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

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

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

func (*IssueMutation) AddedIDs

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

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

func (*IssueMutation) ClearEdge

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

func (m *IssueMutation) 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 (*IssueMutation) ClearOwner

func (m *IssueMutation) ClearOwner()

ClearOwner clears the "owner" edge to the Project entity.

func (*IssueMutation) ClearedEdges

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

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

func (*IssueMutation) ClearedFields

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

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

func (IssueMutation) Client

func (m IssueMutation) 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 (*IssueMutation) CreateTime

func (m *IssueMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*IssueMutation) Description

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

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

func (*IssueMutation) EdgeCleared

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

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

func (*IssueMutation) Field

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

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

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

func (*IssueMutation) Fields

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

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

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

func (*IssueMutation) IDs

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

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

func (*IssueMutation) OldCreateTime

func (m *IssueMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Issue entity. If the Issue 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 (*IssueMutation) OldDescription

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

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

func (m *IssueMutation) 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 (*IssueMutation) OldTitle

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

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

func (m *IssueMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Issue entity. If the Issue 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 (*IssueMutation) Op

func (m *IssueMutation) Op() Op

Op returns the operation name.

func (*IssueMutation) OwnerCleared

func (m *IssueMutation) OwnerCleared() bool

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

func (*IssueMutation) OwnerID

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

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

func (*IssueMutation) OwnerIDs

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

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

func (*IssueMutation) RemovedEdges

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

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

func (*IssueMutation) RemovedIDs

func (m *IssueMutation) 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 (*IssueMutation) ResetCreateTime

func (m *IssueMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*IssueMutation) ResetDescription

func (m *IssueMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*IssueMutation) ResetEdge

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

func (m *IssueMutation) 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 (*IssueMutation) ResetOwner

func (m *IssueMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*IssueMutation) ResetTitle

func (m *IssueMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*IssueMutation) ResetUpdateTime

func (m *IssueMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*IssueMutation) SetCreateTime

func (m *IssueMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*IssueMutation) SetDescription

func (m *IssueMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*IssueMutation) SetField

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

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

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

func (*IssueMutation) SetOwnerID

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

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

func (*IssueMutation) SetTitle

func (m *IssueMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*IssueMutation) SetUpdateTime

func (m *IssueMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*IssueMutation) Title

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

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

func (IssueMutation) Tx

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

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

func (*IssueMutation) Type

func (m *IssueMutation) Type() string

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

func (*IssueMutation) UpdateTime

func (m *IssueMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*IssueMutation) Where

func (m *IssueMutation) Where(ps ...predicate.Issue)

Where appends a list predicates to the IssueMutation builder.

type IssueQuery

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

IssueQuery is the builder for querying Issue entities.

func (*IssueQuery) Aggregate

func (iq *IssueQuery) Aggregate(fns ...AggregateFunc) *IssueSelect

Aggregate returns a IssueSelect configured with the given aggregations.

func (*IssueQuery) All

func (iq *IssueQuery) All(ctx context.Context) ([]*Issue, error)

All executes the query and returns a list of Issues.

func (*IssueQuery) AllX

func (iq *IssueQuery) AllX(ctx context.Context) []*Issue

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

func (*IssueQuery) Clone

func (iq *IssueQuery) Clone() *IssueQuery

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

func (*IssueQuery) Count

func (iq *IssueQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*IssueQuery) CountX

func (iq *IssueQuery) CountX(ctx context.Context) int

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

func (*IssueQuery) Exist

func (iq *IssueQuery) Exist(ctx context.Context) (bool, error)

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

func (*IssueQuery) ExistX

func (iq *IssueQuery) ExistX(ctx context.Context) bool

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

func (*IssueQuery) First

func (iq *IssueQuery) First(ctx context.Context) (*Issue, error)

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

func (*IssueQuery) FirstID

func (iq *IssueQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*IssueQuery) FirstIDX

func (iq *IssueQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*IssueQuery) FirstX

func (iq *IssueQuery) FirstX(ctx context.Context) *Issue

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

func (*IssueQuery) GroupBy

func (iq *IssueQuery) GroupBy(field string, fields ...string) *IssueGroupBy

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

client.Issue.Query().
	GroupBy(issue.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*IssueQuery) IDs

func (iq *IssueQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*IssueQuery) IDsX

func (iq *IssueQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*IssueQuery) Limit

func (iq *IssueQuery) Limit(limit int) *IssueQuery

Limit adds a limit step to the query.

func (*IssueQuery) Offset

func (iq *IssueQuery) Offset(offset int) *IssueQuery

Offset adds an offset step to the query.

func (*IssueQuery) Only

func (iq *IssueQuery) Only(ctx context.Context) (*Issue, error)

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

func (*IssueQuery) OnlyID

func (iq *IssueQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*IssueQuery) OnlyIDX

func (iq *IssueQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*IssueQuery) OnlyX

func (iq *IssueQuery) OnlyX(ctx context.Context) *Issue

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

func (*IssueQuery) Order

func (iq *IssueQuery) Order(o ...OrderFunc) *IssueQuery

Order adds an order step to the query.

func (*IssueQuery) QueryOwner

func (iq *IssueQuery) QueryOwner() *ProjectQuery

QueryOwner chains the current query on the "owner" edge.

func (*IssueQuery) Select

func (iq *IssueQuery) Select(fields ...string) *IssueSelect

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

client.Issue.Query().
	Select(issue.FieldCreateTime).
	Scan(ctx, &v)

func (*IssueQuery) Unique

func (iq *IssueQuery) Unique(unique bool) *IssueQuery

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

func (iq *IssueQuery) Where(ps ...predicate.Issue) *IssueQuery

Where adds a new predicate for the IssueQuery builder.

func (*IssueQuery) WithOwner

func (iq *IssueQuery) WithOwner(opts ...func(*ProjectQuery)) *IssueQuery

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

type IssueSelect

type IssueSelect struct {
	*IssueQuery
	// contains filtered or unexported fields
}

IssueSelect is the builder for selecting fields of Issue entities.

func (*IssueSelect) Aggregate

func (is *IssueSelect) Aggregate(fns ...AggregateFunc) *IssueSelect

Aggregate adds the given aggregation functions to the selector query.

func (*IssueSelect) Bool

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

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

func (*IssueSelect) BoolX

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

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

func (*IssueSelect) Bools

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

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

func (*IssueSelect) BoolsX

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

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

func (*IssueSelect) Float64

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

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

func (*IssueSelect) Float64X

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

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

func (*IssueSelect) Float64s

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

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

func (*IssueSelect) Float64sX

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

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

func (*IssueSelect) Int

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

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

func (*IssueSelect) IntX

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

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

func (*IssueSelect) Ints

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

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

func (*IssueSelect) IntsX

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

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

func (*IssueSelect) Scan

func (is *IssueSelect) Scan(ctx context.Context, v any) error

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

func (*IssueSelect) ScanX

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

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

func (*IssueSelect) String

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

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

func (*IssueSelect) StringX

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

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

func (*IssueSelect) Strings

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

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

func (*IssueSelect) StringsX

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

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

type IssueUpdate

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

IssueUpdate is the builder for updating Issue entities.

func (*IssueUpdate) ClearOwner

func (iu *IssueUpdate) ClearOwner() *IssueUpdate

ClearOwner clears the "owner" edge to the Project entity.

func (*IssueUpdate) Exec

func (iu *IssueUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*IssueUpdate) ExecX

func (iu *IssueUpdate) ExecX(ctx context.Context)

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

func (*IssueUpdate) Mutation

func (iu *IssueUpdate) Mutation() *IssueMutation

Mutation returns the IssueMutation object of the builder.

func (*IssueUpdate) Save

func (iu *IssueUpdate) Save(ctx context.Context) (int, error)

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

func (*IssueUpdate) SaveX

func (iu *IssueUpdate) SaveX(ctx context.Context) int

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

func (*IssueUpdate) SetDescription

func (iu *IssueUpdate) SetDescription(s string) *IssueUpdate

SetDescription sets the "description" field.

func (*IssueUpdate) SetNillableOwnerID

func (iu *IssueUpdate) SetNillableOwnerID(id *uuid.UUID) *IssueUpdate

SetNillableOwnerID sets the "owner" edge to the Project entity by ID if the given value is not nil.

func (*IssueUpdate) SetOwner

func (iu *IssueUpdate) SetOwner(p *Project) *IssueUpdate

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

func (*IssueUpdate) SetOwnerID

func (iu *IssueUpdate) SetOwnerID(id uuid.UUID) *IssueUpdate

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

func (*IssueUpdate) SetTitle

func (iu *IssueUpdate) SetTitle(s string) *IssueUpdate

SetTitle sets the "title" field.

func (*IssueUpdate) SetUpdateTime

func (iu *IssueUpdate) SetUpdateTime(t time.Time) *IssueUpdate

SetUpdateTime sets the "update_time" field.

func (*IssueUpdate) Where

func (iu *IssueUpdate) Where(ps ...predicate.Issue) *IssueUpdate

Where appends a list predicates to the IssueUpdate builder.

type IssueUpdateOne

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

IssueUpdateOne is the builder for updating a single Issue entity.

func (*IssueUpdateOne) ClearOwner

func (iuo *IssueUpdateOne) ClearOwner() *IssueUpdateOne

ClearOwner clears the "owner" edge to the Project entity.

func (*IssueUpdateOne) Exec

func (iuo *IssueUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*IssueUpdateOne) ExecX

func (iuo *IssueUpdateOne) ExecX(ctx context.Context)

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

func (*IssueUpdateOne) Mutation

func (iuo *IssueUpdateOne) Mutation() *IssueMutation

Mutation returns the IssueMutation object of the builder.

func (*IssueUpdateOne) Save

func (iuo *IssueUpdateOne) Save(ctx context.Context) (*Issue, error)

Save executes the query and returns the updated Issue entity.

func (*IssueUpdateOne) SaveX

func (iuo *IssueUpdateOne) SaveX(ctx context.Context) *Issue

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

func (*IssueUpdateOne) Select

func (iuo *IssueUpdateOne) Select(field string, fields ...string) *IssueUpdateOne

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

func (*IssueUpdateOne) SetDescription

func (iuo *IssueUpdateOne) SetDescription(s string) *IssueUpdateOne

SetDescription sets the "description" field.

func (*IssueUpdateOne) SetNillableOwnerID

func (iuo *IssueUpdateOne) SetNillableOwnerID(id *uuid.UUID) *IssueUpdateOne

SetNillableOwnerID sets the "owner" edge to the Project entity by ID if the given value is not nil.

func (*IssueUpdateOne) SetOwner

func (iuo *IssueUpdateOne) SetOwner(p *Project) *IssueUpdateOne

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

func (*IssueUpdateOne) SetOwnerID

func (iuo *IssueUpdateOne) SetOwnerID(id uuid.UUID) *IssueUpdateOne

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

func (*IssueUpdateOne) SetTitle

func (iuo *IssueUpdateOne) SetTitle(s string) *IssueUpdateOne

SetTitle sets the "title" field.

func (*IssueUpdateOne) SetUpdateTime

func (iuo *IssueUpdateOne) SetUpdateTime(t time.Time) *IssueUpdateOne

SetUpdateTime sets the "update_time" field.

type Issues

type Issues []*Issue

Issues is a parsable slice of Issue.

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

func Log(fn func(...any)) Option

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector.

func Asc

func Asc(fields ...string) OrderFunc

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) OrderFunc

Desc applies the given fields in DESC order.

type Policy

type Policy = ent.Policy

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

type Project

type Project struct {

	// ID of the ent.
	ID uuid.UUID `json:"id,omitempty"`
	// CreateTime holds the value of the "create_time" field.
	CreateTime time.Time `json:"create_time,omitempty"`
	// UpdateTime holds the value of the "update_time" field.
	UpdateTime time.Time `json:"update_time,omitempty"`
	// Title holds the value of the "title" field.
	Title string `json:"title,omitempty"`
	// Description holds the value of the "description" field.
	Description string `json:"description,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the ProjectQuery when eager-loading is set.
	Edges ProjectEdges `json:"edges"`
	// contains filtered or unexported fields
}

Project is the model entity for the Project schema.

func (*Project) QueryIssues

func (pr *Project) QueryIssues() *IssueQuery

QueryIssues queries the "issues" edge of the Project entity.

func (*Project) String

func (pr *Project) String() string

String implements the fmt.Stringer.

func (*Project) Unwrap

func (pr *Project) Unwrap() *Project

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

func (pr *Project) Update() *ProjectUpdateOne

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

type ProjectClient

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

ProjectClient is a client for the Project schema.

func NewProjectClient

func NewProjectClient(c config) *ProjectClient

NewProjectClient returns a client for the Project from the given config.

func (*ProjectClient) Create

func (c *ProjectClient) Create() *ProjectCreate

Create returns a builder for creating a Project entity.

func (*ProjectClient) CreateBulk

func (c *ProjectClient) CreateBulk(builders ...*ProjectCreate) *ProjectCreateBulk

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

func (*ProjectClient) Delete

func (c *ProjectClient) Delete() *ProjectDelete

Delete returns a delete builder for Project.

func (*ProjectClient) DeleteOne

func (c *ProjectClient) DeleteOne(pr *Project) *ProjectDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ProjectClient) DeleteOneID

func (c *ProjectClient) DeleteOneID(id uuid.UUID) *ProjectDeleteOne

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

func (*ProjectClient) Get

func (c *ProjectClient) Get(ctx context.Context, id uuid.UUID) (*Project, error)

Get returns a Project entity by its id.

func (*ProjectClient) GetX

func (c *ProjectClient) GetX(ctx context.Context, id uuid.UUID) *Project

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

func (*ProjectClient) Hooks

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

Hooks returns the client hooks.

func (*ProjectClient) Query

func (c *ProjectClient) Query() *ProjectQuery

Query returns a query builder for Project.

func (*ProjectClient) QueryIssues

func (c *ProjectClient) QueryIssues(pr *Project) *IssueQuery

QueryIssues queries the issues edge of a Project.

func (*ProjectClient) Update

func (c *ProjectClient) Update() *ProjectUpdate

Update returns an update builder for Project.

func (*ProjectClient) UpdateOne

func (c *ProjectClient) UpdateOne(pr *Project) *ProjectUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProjectClient) UpdateOneID

func (c *ProjectClient) UpdateOneID(id uuid.UUID) *ProjectUpdateOne

UpdateOneID returns an update builder for the given id.

func (*ProjectClient) Use

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

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

type ProjectCreate

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

ProjectCreate is the builder for creating a Project entity.

func (*ProjectCreate) AddIssueIDs

func (pc *ProjectCreate) AddIssueIDs(ids ...uuid.UUID) *ProjectCreate

AddIssueIDs adds the "issues" edge to the Issue entity by IDs.

func (*ProjectCreate) AddIssues

func (pc *ProjectCreate) AddIssues(i ...*Issue) *ProjectCreate

AddIssues adds the "issues" edges to the Issue entity.

func (*ProjectCreate) Exec

func (pc *ProjectCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProjectCreate) ExecX

func (pc *ProjectCreate) ExecX(ctx context.Context)

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

func (*ProjectCreate) Mutation

func (pc *ProjectCreate) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectCreate) Save

func (pc *ProjectCreate) Save(ctx context.Context) (*Project, error)

Save creates the Project in the database.

func (*ProjectCreate) SaveX

func (pc *ProjectCreate) SaveX(ctx context.Context) *Project

SaveX calls Save and panics if Save returns an error.

func (*ProjectCreate) SetCreateTime

func (pc *ProjectCreate) SetCreateTime(t time.Time) *ProjectCreate

SetCreateTime sets the "create_time" field.

func (*ProjectCreate) SetDescription

func (pc *ProjectCreate) SetDescription(s string) *ProjectCreate

SetDescription sets the "description" field.

func (*ProjectCreate) SetID

func (pc *ProjectCreate) SetID(u uuid.UUID) *ProjectCreate

SetID sets the "id" field.

func (*ProjectCreate) SetNillableCreateTime

func (pc *ProjectCreate) SetNillableCreateTime(t *time.Time) *ProjectCreate

SetNillableCreateTime sets the "create_time" field if the given value is not nil.

func (*ProjectCreate) SetNillableID

func (pc *ProjectCreate) SetNillableID(u *uuid.UUID) *ProjectCreate

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

func (*ProjectCreate) SetNillableUpdateTime

func (pc *ProjectCreate) SetNillableUpdateTime(t *time.Time) *ProjectCreate

SetNillableUpdateTime sets the "update_time" field if the given value is not nil.

func (*ProjectCreate) SetTitle

func (pc *ProjectCreate) SetTitle(s string) *ProjectCreate

SetTitle sets the "title" field.

func (*ProjectCreate) SetUpdateTime

func (pc *ProjectCreate) SetUpdateTime(t time.Time) *ProjectCreate

SetUpdateTime sets the "update_time" field.

type ProjectCreateBulk

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

ProjectCreateBulk is the builder for creating many Project entities in bulk.

func (*ProjectCreateBulk) Exec

func (pcb *ProjectCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ProjectCreateBulk) ExecX

func (pcb *ProjectCreateBulk) ExecX(ctx context.Context)

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

func (*ProjectCreateBulk) Save

func (pcb *ProjectCreateBulk) Save(ctx context.Context) ([]*Project, error)

Save creates the Project entities in the database.

func (*ProjectCreateBulk) SaveX

func (pcb *ProjectCreateBulk) SaveX(ctx context.Context) []*Project

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

type ProjectDelete

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

ProjectDelete is the builder for deleting a Project entity.

func (*ProjectDelete) Exec

func (pd *ProjectDelete) Exec(ctx context.Context) (int, error)

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

func (*ProjectDelete) ExecX

func (pd *ProjectDelete) ExecX(ctx context.Context) int

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

func (*ProjectDelete) Where

func (pd *ProjectDelete) Where(ps ...predicate.Project) *ProjectDelete

Where appends a list predicates to the ProjectDelete builder.

type ProjectDeleteOne

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

ProjectDeleteOne is the builder for deleting a single Project entity.

func (*ProjectDeleteOne) Exec

func (pdo *ProjectDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ProjectDeleteOne) ExecX

func (pdo *ProjectDeleteOne) ExecX(ctx context.Context)

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

type ProjectEdges

type ProjectEdges struct {
	// Issues holds the value of the issues edge.
	Issues []*Issue `json:"issues,omitempty"`
	// contains filtered or unexported fields
}

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

func (ProjectEdges) IssuesOrErr

func (e ProjectEdges) IssuesOrErr() ([]*Issue, error)

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

type ProjectGroupBy

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

ProjectGroupBy is the group-by builder for Project entities.

func (*ProjectGroupBy) Aggregate

func (pgb *ProjectGroupBy) Aggregate(fns ...AggregateFunc) *ProjectGroupBy

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

func (*ProjectGroupBy) Bool

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

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

func (*ProjectGroupBy) BoolX

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

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

func (*ProjectGroupBy) Bools

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

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

func (*ProjectGroupBy) BoolsX

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

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

func (*ProjectGroupBy) Float64

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

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

func (*ProjectGroupBy) Float64X

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

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

func (*ProjectGroupBy) Float64s

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

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

func (*ProjectGroupBy) Float64sX

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

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

func (*ProjectGroupBy) Int

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

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

func (*ProjectGroupBy) IntX

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

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

func (*ProjectGroupBy) Ints

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

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

func (*ProjectGroupBy) IntsX

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

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

func (*ProjectGroupBy) Scan

func (pgb *ProjectGroupBy) Scan(ctx context.Context, v any) error

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

func (*ProjectGroupBy) ScanX

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

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

func (*ProjectGroupBy) String

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

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

func (*ProjectGroupBy) StringX

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

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

func (*ProjectGroupBy) Strings

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

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

func (*ProjectGroupBy) StringsX

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

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

type ProjectMutation

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

ProjectMutation represents an operation that mutates the Project nodes in the graph.

func (*ProjectMutation) AddField

func (m *ProjectMutation) 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 (*ProjectMutation) AddIssueIDs

func (m *ProjectMutation) AddIssueIDs(ids ...uuid.UUID)

AddIssueIDs adds the "issues" edge to the Issue entity by ids.

func (*ProjectMutation) AddedEdges

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

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

func (*ProjectMutation) AddedField

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

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

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

func (*ProjectMutation) AddedIDs

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

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

func (*ProjectMutation) ClearEdge

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

func (m *ProjectMutation) 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 (*ProjectMutation) ClearIssues

func (m *ProjectMutation) ClearIssues()

ClearIssues clears the "issues" edge to the Issue entity.

func (*ProjectMutation) ClearedEdges

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

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

func (*ProjectMutation) ClearedFields

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

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

func (ProjectMutation) Client

func (m ProjectMutation) 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 (*ProjectMutation) CreateTime

func (m *ProjectMutation) CreateTime() (r time.Time, exists bool)

CreateTime returns the value of the "create_time" field in the mutation.

func (*ProjectMutation) Description

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

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

func (*ProjectMutation) EdgeCleared

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

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

func (*ProjectMutation) Field

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

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

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

func (*ProjectMutation) Fields

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

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

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

func (*ProjectMutation) IDs

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

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

func (*ProjectMutation) IssuesCleared

func (m *ProjectMutation) IssuesCleared() bool

IssuesCleared reports if the "issues" edge to the Issue entity was cleared.

func (*ProjectMutation) IssuesIDs

func (m *ProjectMutation) IssuesIDs() (ids []uuid.UUID)

IssuesIDs returns the "issues" edge IDs in the mutation.

func (*ProjectMutation) OldCreateTime

func (m *ProjectMutation) OldCreateTime(ctx context.Context) (v time.Time, err error)

OldCreateTime returns the old "create_time" field's value of the Project entity. If the Project 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 (*ProjectMutation) OldDescription

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

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

func (m *ProjectMutation) 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 (*ProjectMutation) OldTitle

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

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

func (m *ProjectMutation) OldUpdateTime(ctx context.Context) (v time.Time, err error)

OldUpdateTime returns the old "update_time" field's value of the Project entity. If the Project 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 (*ProjectMutation) Op

func (m *ProjectMutation) Op() Op

Op returns the operation name.

func (*ProjectMutation) RemoveIssueIDs

func (m *ProjectMutation) RemoveIssueIDs(ids ...uuid.UUID)

RemoveIssueIDs removes the "issues" edge to the Issue entity by IDs.

func (*ProjectMutation) RemovedEdges

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

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

func (*ProjectMutation) RemovedIDs

func (m *ProjectMutation) 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 (*ProjectMutation) RemovedIssuesIDs

func (m *ProjectMutation) RemovedIssuesIDs() (ids []uuid.UUID)

RemovedIssues returns the removed IDs of the "issues" edge to the Issue entity.

func (*ProjectMutation) ResetCreateTime

func (m *ProjectMutation) ResetCreateTime()

ResetCreateTime resets all changes to the "create_time" field.

func (*ProjectMutation) ResetDescription

func (m *ProjectMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ProjectMutation) ResetEdge

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

func (m *ProjectMutation) 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 (*ProjectMutation) ResetIssues

func (m *ProjectMutation) ResetIssues()

ResetIssues resets all changes to the "issues" edge.

func (*ProjectMutation) ResetTitle

func (m *ProjectMutation) ResetTitle()

ResetTitle resets all changes to the "title" field.

func (*ProjectMutation) ResetUpdateTime

func (m *ProjectMutation) ResetUpdateTime()

ResetUpdateTime resets all changes to the "update_time" field.

func (*ProjectMutation) SetCreateTime

func (m *ProjectMutation) SetCreateTime(t time.Time)

SetCreateTime sets the "create_time" field.

func (*ProjectMutation) SetDescription

func (m *ProjectMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ProjectMutation) SetField

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

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

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

func (*ProjectMutation) SetTitle

func (m *ProjectMutation) SetTitle(s string)

SetTitle sets the "title" field.

func (*ProjectMutation) SetUpdateTime

func (m *ProjectMutation) SetUpdateTime(t time.Time)

SetUpdateTime sets the "update_time" field.

func (*ProjectMutation) Title

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

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

func (ProjectMutation) Tx

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

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

func (*ProjectMutation) Type

func (m *ProjectMutation) Type() string

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

func (*ProjectMutation) UpdateTime

func (m *ProjectMutation) UpdateTime() (r time.Time, exists bool)

UpdateTime returns the value of the "update_time" field in the mutation.

func (*ProjectMutation) Where

func (m *ProjectMutation) Where(ps ...predicate.Project)

Where appends a list predicates to the ProjectMutation builder.

type ProjectQuery

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

ProjectQuery is the builder for querying Project entities.

func (*ProjectQuery) Aggregate

func (pq *ProjectQuery) Aggregate(fns ...AggregateFunc) *ProjectSelect

Aggregate returns a ProjectSelect configured with the given aggregations.

func (*ProjectQuery) All

func (pq *ProjectQuery) All(ctx context.Context) ([]*Project, error)

All executes the query and returns a list of Projects.

func (*ProjectQuery) AllX

func (pq *ProjectQuery) AllX(ctx context.Context) []*Project

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

func (*ProjectQuery) Clone

func (pq *ProjectQuery) Clone() *ProjectQuery

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

func (*ProjectQuery) Count

func (pq *ProjectQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ProjectQuery) CountX

func (pq *ProjectQuery) CountX(ctx context.Context) int

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

func (*ProjectQuery) Exist

func (pq *ProjectQuery) Exist(ctx context.Context) (bool, error)

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

func (*ProjectQuery) ExistX

func (pq *ProjectQuery) ExistX(ctx context.Context) bool

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

func (*ProjectQuery) First

func (pq *ProjectQuery) First(ctx context.Context) (*Project, error)

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

func (*ProjectQuery) FirstID

func (pq *ProjectQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ProjectQuery) FirstIDX

func (pq *ProjectQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*ProjectQuery) FirstX

func (pq *ProjectQuery) FirstX(ctx context.Context) *Project

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

func (*ProjectQuery) GroupBy

func (pq *ProjectQuery) GroupBy(field string, fields ...string) *ProjectGroupBy

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

client.Project.Query().
	GroupBy(project.FieldCreateTime).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*ProjectQuery) IDs

func (pq *ProjectQuery) IDs(ctx context.Context) ([]uuid.UUID, error)

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

func (*ProjectQuery) IDsX

func (pq *ProjectQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*ProjectQuery) Limit

func (pq *ProjectQuery) Limit(limit int) *ProjectQuery

Limit adds a limit step to the query.

func (*ProjectQuery) Offset

func (pq *ProjectQuery) Offset(offset int) *ProjectQuery

Offset adds an offset step to the query.

func (*ProjectQuery) Only

func (pq *ProjectQuery) Only(ctx context.Context) (*Project, error)

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

func (*ProjectQuery) OnlyID

func (pq *ProjectQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*ProjectQuery) OnlyIDX

func (pq *ProjectQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*ProjectQuery) OnlyX

func (pq *ProjectQuery) OnlyX(ctx context.Context) *Project

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

func (*ProjectQuery) Order

func (pq *ProjectQuery) Order(o ...OrderFunc) *ProjectQuery

Order adds an order step to the query.

func (*ProjectQuery) QueryIssues

func (pq *ProjectQuery) QueryIssues() *IssueQuery

QueryIssues chains the current query on the "issues" edge.

func (*ProjectQuery) Select

func (pq *ProjectQuery) Select(fields ...string) *ProjectSelect

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

client.Project.Query().
	Select(project.FieldCreateTime).
	Scan(ctx, &v)

func (*ProjectQuery) Unique

func (pq *ProjectQuery) Unique(unique bool) *ProjectQuery

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

func (pq *ProjectQuery) Where(ps ...predicate.Project) *ProjectQuery

Where adds a new predicate for the ProjectQuery builder.

func (*ProjectQuery) WithIssues

func (pq *ProjectQuery) WithIssues(opts ...func(*IssueQuery)) *ProjectQuery

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

type ProjectSelect

type ProjectSelect struct {
	*ProjectQuery
	// contains filtered or unexported fields
}

ProjectSelect is the builder for selecting fields of Project entities.

func (*ProjectSelect) Aggregate

func (ps *ProjectSelect) Aggregate(fns ...AggregateFunc) *ProjectSelect

Aggregate adds the given aggregation functions to the selector query.

func (*ProjectSelect) Bool

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

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

func (*ProjectSelect) BoolX

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

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

func (*ProjectSelect) Bools

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

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

func (*ProjectSelect) BoolsX

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

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

func (*ProjectSelect) Float64

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

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

func (*ProjectSelect) Float64X

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

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

func (*ProjectSelect) Float64s

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

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

func (*ProjectSelect) Float64sX

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

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

func (*ProjectSelect) Int

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

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

func (*ProjectSelect) IntX

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

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

func (*ProjectSelect) Ints

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

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

func (*ProjectSelect) IntsX

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

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

func (*ProjectSelect) Scan

func (ps *ProjectSelect) Scan(ctx context.Context, v any) error

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

func (*ProjectSelect) ScanX

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

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

func (*ProjectSelect) String

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

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

func (*ProjectSelect) StringX

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

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

func (*ProjectSelect) Strings

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

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

func (*ProjectSelect) StringsX

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

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

type ProjectUpdate

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

ProjectUpdate is the builder for updating Project entities.

func (*ProjectUpdate) AddIssueIDs

func (pu *ProjectUpdate) AddIssueIDs(ids ...uuid.UUID) *ProjectUpdate

AddIssueIDs adds the "issues" edge to the Issue entity by IDs.

func (*ProjectUpdate) AddIssues

func (pu *ProjectUpdate) AddIssues(i ...*Issue) *ProjectUpdate

AddIssues adds the "issues" edges to the Issue entity.

func (*ProjectUpdate) ClearIssues

func (pu *ProjectUpdate) ClearIssues() *ProjectUpdate

ClearIssues clears all "issues" edges to the Issue entity.

func (*ProjectUpdate) Exec

func (pu *ProjectUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*ProjectUpdate) ExecX

func (pu *ProjectUpdate) ExecX(ctx context.Context)

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

func (*ProjectUpdate) Mutation

func (pu *ProjectUpdate) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectUpdate) RemoveIssueIDs

func (pu *ProjectUpdate) RemoveIssueIDs(ids ...uuid.UUID) *ProjectUpdate

RemoveIssueIDs removes the "issues" edge to Issue entities by IDs.

func (*ProjectUpdate) RemoveIssues

func (pu *ProjectUpdate) RemoveIssues(i ...*Issue) *ProjectUpdate

RemoveIssues removes "issues" edges to Issue entities.

func (*ProjectUpdate) Save

func (pu *ProjectUpdate) Save(ctx context.Context) (int, error)

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

func (*ProjectUpdate) SaveX

func (pu *ProjectUpdate) SaveX(ctx context.Context) int

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

func (*ProjectUpdate) SetDescription

func (pu *ProjectUpdate) SetDescription(s string) *ProjectUpdate

SetDescription sets the "description" field.

func (*ProjectUpdate) SetTitle

func (pu *ProjectUpdate) SetTitle(s string) *ProjectUpdate

SetTitle sets the "title" field.

func (*ProjectUpdate) SetUpdateTime

func (pu *ProjectUpdate) SetUpdateTime(t time.Time) *ProjectUpdate

SetUpdateTime sets the "update_time" field.

func (*ProjectUpdate) Where

func (pu *ProjectUpdate) Where(ps ...predicate.Project) *ProjectUpdate

Where appends a list predicates to the ProjectUpdate builder.

type ProjectUpdateOne

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

ProjectUpdateOne is the builder for updating a single Project entity.

func (*ProjectUpdateOne) AddIssueIDs

func (puo *ProjectUpdateOne) AddIssueIDs(ids ...uuid.UUID) *ProjectUpdateOne

AddIssueIDs adds the "issues" edge to the Issue entity by IDs.

func (*ProjectUpdateOne) AddIssues

func (puo *ProjectUpdateOne) AddIssues(i ...*Issue) *ProjectUpdateOne

AddIssues adds the "issues" edges to the Issue entity.

func (*ProjectUpdateOne) ClearIssues

func (puo *ProjectUpdateOne) ClearIssues() *ProjectUpdateOne

ClearIssues clears all "issues" edges to the Issue entity.

func (*ProjectUpdateOne) Exec

func (puo *ProjectUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*ProjectUpdateOne) ExecX

func (puo *ProjectUpdateOne) ExecX(ctx context.Context)

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

func (*ProjectUpdateOne) Mutation

func (puo *ProjectUpdateOne) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectUpdateOne) RemoveIssueIDs

func (puo *ProjectUpdateOne) RemoveIssueIDs(ids ...uuid.UUID) *ProjectUpdateOne

RemoveIssueIDs removes the "issues" edge to Issue entities by IDs.

func (*ProjectUpdateOne) RemoveIssues

func (puo *ProjectUpdateOne) RemoveIssues(i ...*Issue) *ProjectUpdateOne

RemoveIssues removes "issues" edges to Issue entities.

func (*ProjectUpdateOne) Save

func (puo *ProjectUpdateOne) Save(ctx context.Context) (*Project, error)

Save executes the query and returns the updated Project entity.

func (*ProjectUpdateOne) SaveX

func (puo *ProjectUpdateOne) SaveX(ctx context.Context) *Project

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

func (*ProjectUpdateOne) Select

func (puo *ProjectUpdateOne) Select(field string, fields ...string) *ProjectUpdateOne

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

func (*ProjectUpdateOne) SetDescription

func (puo *ProjectUpdateOne) SetDescription(s string) *ProjectUpdateOne

SetDescription sets the "description" field.

func (*ProjectUpdateOne) SetTitle

func (puo *ProjectUpdateOne) SetTitle(s string) *ProjectUpdateOne

SetTitle sets the "title" field.

func (*ProjectUpdateOne) SetUpdateTime

func (puo *ProjectUpdateOne) SetUpdateTime(t time.Time) *ProjectUpdateOne

SetUpdateTime sets the "update_time" field.

type Projects

type Projects []*Project

Projects is a parsable slice of Project.

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 {

	// Issue is the client for interacting with the Issue builders.
	Issue *IssueClient
	// Project is the client for interacting with the Project builders.
	Project *ProjectClient
	// 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