data

package
v0.0.0-...-d1a2abc Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 22 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.
	TypeAPIKey          = "APIKey"
	TypeProject         = "Project"
	TypeRetentionPolicy = "RetentionPolicy"
	TypeUser            = "User"
)

Variables

View Source
var ErrTxStarted = errors.New("data: cannot start a transaction within a transaction")

ErrTxStarted is returned when trying to start a new transaction from a transactional client.

Functions

func Asc

func Asc(fields ...string) func(*sql.Selector)

Asc applies the given fields in ASC order.

func Desc

func Desc(fields ...string) func(*sql.Selector)

Desc applies the given fields in DESC order.

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 APIKey

type APIKey struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// API key name for identification
	Name string `json:"name,omitempty"`
	// Hashed API key for authentication
	HashedKey string `json:"-"`
	// API key permissions: read, write, admin
	Permissions string `json:"permissions,omitempty"`
	// Whether the API key is active
	IsActive bool `json:"is_active,omitempty"`
	// When the API key was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// When the API key was last updated
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// When the API key was last used
	LastUsedAt time.Time `json:"last_used_at,omitempty"`
	// When the API key expires
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the APIKeyQuery when eager-loading is set.
	Edges APIKeyEdges `json:"edges"`
	// contains filtered or unexported fields
}

APIKey is the model entity for the APIKey schema.

func (*APIKey) QueryCreatedBy

func (_m *APIKey) QueryCreatedBy() *UserQuery

QueryCreatedBy queries the "created_by" edge of the APIKey entity.

func (*APIKey) QueryProject

func (_m *APIKey) QueryProject() *ProjectQuery

QueryProject queries the "project" edge of the APIKey entity.

func (*APIKey) String

func (_m *APIKey) String() string

String implements the fmt.Stringer.

func (*APIKey) Unwrap

func (_m *APIKey) Unwrap() *APIKey

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

func (_m *APIKey) Update() *APIKeyUpdateOne

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

func (*APIKey) Value

func (_m *APIKey) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the APIKey. This includes values selected through modifiers, order, etc.

type APIKeyClient

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

APIKeyClient is a client for the APIKey schema.

func NewAPIKeyClient

func NewAPIKeyClient(c config) *APIKeyClient

NewAPIKeyClient returns a client for the APIKey from the given config.

func (*APIKeyClient) Create

func (c *APIKeyClient) Create() *APIKeyCreate

Create returns a builder for creating a APIKey entity.

func (*APIKeyClient) CreateBulk

func (c *APIKeyClient) CreateBulk(builders ...*APIKeyCreate) *APIKeyCreateBulk

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

func (*APIKeyClient) Delete

func (c *APIKeyClient) Delete() *APIKeyDelete

Delete returns a delete builder for APIKey.

func (*APIKeyClient) DeleteOne

func (c *APIKeyClient) DeleteOne(_m *APIKey) *APIKeyDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*APIKeyClient) DeleteOneID

func (c *APIKeyClient) DeleteOneID(id int) *APIKeyDeleteOne

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

func (*APIKeyClient) Get

func (c *APIKeyClient) Get(ctx context.Context, id int) (*APIKey, error)

Get returns a APIKey entity by its id.

func (*APIKeyClient) GetX

func (c *APIKeyClient) GetX(ctx context.Context, id int) *APIKey

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

func (*APIKeyClient) Hooks

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

Hooks returns the client hooks.

func (*APIKeyClient) Intercept

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

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

func (*APIKeyClient) Interceptors

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

Interceptors returns the client interceptors.

func (*APIKeyClient) MapCreateBulk

func (c *APIKeyClient) MapCreateBulk(slice any, setFunc func(*APIKeyCreate, int)) *APIKeyCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*APIKeyClient) Query

func (c *APIKeyClient) Query() *APIKeyQuery

Query returns a query builder for APIKey.

func (*APIKeyClient) QueryCreatedBy

func (c *APIKeyClient) QueryCreatedBy(_m *APIKey) *UserQuery

QueryCreatedBy queries the created_by edge of a APIKey.

func (*APIKeyClient) QueryProject

func (c *APIKeyClient) QueryProject(_m *APIKey) *ProjectQuery

QueryProject queries the project edge of a APIKey.

func (*APIKeyClient) Update

func (c *APIKeyClient) Update() *APIKeyUpdate

Update returns an update builder for APIKey.

func (*APIKeyClient) UpdateOne

func (c *APIKeyClient) UpdateOne(_m *APIKey) *APIKeyUpdateOne

UpdateOne returns an update builder for the given entity.

func (*APIKeyClient) UpdateOneID

func (c *APIKeyClient) UpdateOneID(id int) *APIKeyUpdateOne

UpdateOneID returns an update builder for the given id.

func (*APIKeyClient) Use

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

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

type APIKeyCreate

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

APIKeyCreate is the builder for creating a APIKey entity.

func (*APIKeyCreate) Exec

func (_c *APIKeyCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*APIKeyCreate) ExecX

func (_c *APIKeyCreate) ExecX(ctx context.Context)

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

func (*APIKeyCreate) Mutation

func (_c *APIKeyCreate) Mutation() *APIKeyMutation

Mutation returns the APIKeyMutation object of the builder.

func (*APIKeyCreate) Save

func (_c *APIKeyCreate) Save(ctx context.Context) (*APIKey, error)

Save creates the APIKey in the database.

func (*APIKeyCreate) SaveX

func (_c *APIKeyCreate) SaveX(ctx context.Context) *APIKey

SaveX calls Save and panics if Save returns an error.

func (*APIKeyCreate) SetCreatedAt

func (_c *APIKeyCreate) SetCreatedAt(v time.Time) *APIKeyCreate

SetCreatedAt sets the "created_at" field.

func (*APIKeyCreate) SetCreatedBy

func (_c *APIKeyCreate) SetCreatedBy(v *User) *APIKeyCreate

SetCreatedBy sets the "created_by" edge to the User entity.

func (*APIKeyCreate) SetCreatedByID

func (_c *APIKeyCreate) SetCreatedByID(id int) *APIKeyCreate

SetCreatedByID sets the "created_by" edge to the User entity by ID.

func (*APIKeyCreate) SetExpiresAt

func (_c *APIKeyCreate) SetExpiresAt(v time.Time) *APIKeyCreate

SetExpiresAt sets the "expires_at" field.

func (*APIKeyCreate) SetHashedKey

func (_c *APIKeyCreate) SetHashedKey(v string) *APIKeyCreate

SetHashedKey sets the "hashed_key" field.

func (*APIKeyCreate) SetIsActive

func (_c *APIKeyCreate) SetIsActive(v bool) *APIKeyCreate

SetIsActive sets the "is_active" field.

func (*APIKeyCreate) SetLastUsedAt

func (_c *APIKeyCreate) SetLastUsedAt(v time.Time) *APIKeyCreate

SetLastUsedAt sets the "last_used_at" field.

func (*APIKeyCreate) SetName

func (_c *APIKeyCreate) SetName(v string) *APIKeyCreate

SetName sets the "name" field.

func (*APIKeyCreate) SetNillableCreatedAt

func (_c *APIKeyCreate) SetNillableCreatedAt(v *time.Time) *APIKeyCreate

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

func (*APIKeyCreate) SetNillableExpiresAt

func (_c *APIKeyCreate) SetNillableExpiresAt(v *time.Time) *APIKeyCreate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*APIKeyCreate) SetNillableIsActive

func (_c *APIKeyCreate) SetNillableIsActive(v *bool) *APIKeyCreate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*APIKeyCreate) SetNillableLastUsedAt

func (_c *APIKeyCreate) SetNillableLastUsedAt(v *time.Time) *APIKeyCreate

SetNillableLastUsedAt sets the "last_used_at" field if the given value is not nil.

func (*APIKeyCreate) SetNillablePermissions

func (_c *APIKeyCreate) SetNillablePermissions(v *string) *APIKeyCreate

SetNillablePermissions sets the "permissions" field if the given value is not nil.

func (*APIKeyCreate) SetNillableUpdatedAt

func (_c *APIKeyCreate) SetNillableUpdatedAt(v *time.Time) *APIKeyCreate

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

func (*APIKeyCreate) SetPermissions

func (_c *APIKeyCreate) SetPermissions(v string) *APIKeyCreate

SetPermissions sets the "permissions" field.

func (*APIKeyCreate) SetProject

func (_c *APIKeyCreate) SetProject(v *Project) *APIKeyCreate

SetProject sets the "project" edge to the Project entity.

func (*APIKeyCreate) SetProjectID

func (_c *APIKeyCreate) SetProjectID(id int) *APIKeyCreate

SetProjectID sets the "project" edge to the Project entity by ID.

func (*APIKeyCreate) SetUpdatedAt

func (_c *APIKeyCreate) SetUpdatedAt(v time.Time) *APIKeyCreate

SetUpdatedAt sets the "updated_at" field.

type APIKeyCreateBulk

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

APIKeyCreateBulk is the builder for creating many APIKey entities in bulk.

func (*APIKeyCreateBulk) Exec

func (_c *APIKeyCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*APIKeyCreateBulk) ExecX

func (_c *APIKeyCreateBulk) ExecX(ctx context.Context)

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

func (*APIKeyCreateBulk) Save

func (_c *APIKeyCreateBulk) Save(ctx context.Context) ([]*APIKey, error)

Save creates the APIKey entities in the database.

func (*APIKeyCreateBulk) SaveX

func (_c *APIKeyCreateBulk) SaveX(ctx context.Context) []*APIKey

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

type APIKeyDelete

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

APIKeyDelete is the builder for deleting a APIKey entity.

func (*APIKeyDelete) Exec

func (_d *APIKeyDelete) Exec(ctx context.Context) (int, error)

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

func (*APIKeyDelete) ExecX

func (_d *APIKeyDelete) ExecX(ctx context.Context) int

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

func (*APIKeyDelete) Where

func (_d *APIKeyDelete) Where(ps ...predicate.APIKey) *APIKeyDelete

Where appends a list predicates to the APIKeyDelete builder.

type APIKeyDeleteOne

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

APIKeyDeleteOne is the builder for deleting a single APIKey entity.

func (*APIKeyDeleteOne) Exec

func (_d *APIKeyDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*APIKeyDeleteOne) ExecX

func (_d *APIKeyDeleteOne) ExecX(ctx context.Context)

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

func (*APIKeyDeleteOne) Where

func (_d *APIKeyDeleteOne) Where(ps ...predicate.APIKey) *APIKeyDeleteOne

Where appends a list predicates to the APIKeyDelete builder.

type APIKeyEdges

type APIKeyEdges struct {
	// Project this API key belongs to
	Project *Project `json:"project,omitempty"`
	// User who created this API key
	CreatedBy *User `json:"created_by,omitempty"`
	// contains filtered or unexported fields
}

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

func (APIKeyEdges) CreatedByOrErr

func (e APIKeyEdges) CreatedByOrErr() (*User, error)

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

func (APIKeyEdges) ProjectOrErr

func (e APIKeyEdges) ProjectOrErr() (*Project, error)

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

type APIKeyGroupBy

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

APIKeyGroupBy is the group-by builder for APIKey entities.

func (*APIKeyGroupBy) Aggregate

func (_g *APIKeyGroupBy) Aggregate(fns ...AggregateFunc) *APIKeyGroupBy

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

func (*APIKeyGroupBy) Bool

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

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

func (*APIKeyGroupBy) BoolX

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

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

func (*APIKeyGroupBy) Bools

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

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

func (*APIKeyGroupBy) BoolsX

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

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

func (*APIKeyGroupBy) Float64

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

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

func (*APIKeyGroupBy) Float64X

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

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

func (*APIKeyGroupBy) Float64s

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

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

func (*APIKeyGroupBy) Float64sX

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

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

func (*APIKeyGroupBy) Int

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

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

func (*APIKeyGroupBy) IntX

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

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

func (*APIKeyGroupBy) Ints

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

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

func (*APIKeyGroupBy) IntsX

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

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

func (*APIKeyGroupBy) Scan

func (_g *APIKeyGroupBy) Scan(ctx context.Context, v any) error

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

func (*APIKeyGroupBy) ScanX

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

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

func (*APIKeyGroupBy) String

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

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

func (*APIKeyGroupBy) StringX

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

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

func (*APIKeyGroupBy) Strings

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

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

func (*APIKeyGroupBy) StringsX

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

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

type APIKeyMutation

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

APIKeyMutation represents an operation that mutates the APIKey nodes in the graph.

func (*APIKeyMutation) AddField

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

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

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

func (*APIKeyMutation) AddedField

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

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

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

func (*APIKeyMutation) AddedIDs

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

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

func (*APIKeyMutation) ClearCreatedBy

func (m *APIKeyMutation) ClearCreatedBy()

ClearCreatedBy clears the "created_by" edge to the User entity.

func (*APIKeyMutation) ClearEdge

func (m *APIKeyMutation) 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 (*APIKeyMutation) ClearExpiresAt

func (m *APIKeyMutation) ClearExpiresAt()

ClearExpiresAt clears the value of the "expires_at" field.

func (*APIKeyMutation) ClearField

func (m *APIKeyMutation) 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 (*APIKeyMutation) ClearLastUsedAt

func (m *APIKeyMutation) ClearLastUsedAt()

ClearLastUsedAt clears the value of the "last_used_at" field.

func (*APIKeyMutation) ClearProject

func (m *APIKeyMutation) ClearProject()

ClearProject clears the "project" edge to the Project entity.

func (*APIKeyMutation) ClearedEdges

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

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

func (*APIKeyMutation) ClearedFields

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

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

func (APIKeyMutation) Client

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

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

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

func (*APIKeyMutation) CreatedByCleared

func (m *APIKeyMutation) CreatedByCleared() bool

CreatedByCleared reports if the "created_by" edge to the User entity was cleared.

func (*APIKeyMutation) CreatedByID

func (m *APIKeyMutation) CreatedByID() (id int, exists bool)

CreatedByID returns the "created_by" edge ID in the mutation.

func (*APIKeyMutation) CreatedByIDs

func (m *APIKeyMutation) CreatedByIDs() (ids []int)

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

func (*APIKeyMutation) EdgeCleared

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

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

func (*APIKeyMutation) ExpiresAt

func (m *APIKeyMutation) ExpiresAt() (r time.Time, exists bool)

ExpiresAt returns the value of the "expires_at" field in the mutation.

func (*APIKeyMutation) ExpiresAtCleared

func (m *APIKeyMutation) ExpiresAtCleared() bool

ExpiresAtCleared returns if the "expires_at" field was cleared in this mutation.

func (*APIKeyMutation) Field

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

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

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

func (*APIKeyMutation) Fields

func (m *APIKeyMutation) 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 (*APIKeyMutation) HashedKey

func (m *APIKeyMutation) HashedKey() (r string, exists bool)

HashedKey returns the value of the "hashed_key" field in the mutation.

func (*APIKeyMutation) ID

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

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

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

func (*APIKeyMutation) IsActive

func (m *APIKeyMutation) IsActive() (r bool, exists bool)

IsActive returns the value of the "is_active" field in the mutation.

func (*APIKeyMutation) LastUsedAt

func (m *APIKeyMutation) LastUsedAt() (r time.Time, exists bool)

LastUsedAt returns the value of the "last_used_at" field in the mutation.

func (*APIKeyMutation) LastUsedAtCleared

func (m *APIKeyMutation) LastUsedAtCleared() bool

LastUsedAtCleared returns if the "last_used_at" field was cleared in this mutation.

func (*APIKeyMutation) Name

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

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

func (*APIKeyMutation) OldCreatedAt

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

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

func (m *APIKeyMutation) OldExpiresAt(ctx context.Context) (v time.Time, err error)

OldExpiresAt returns the old "expires_at" field's value of the APIKey entity. If the APIKey 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 (*APIKeyMutation) OldField

func (m *APIKeyMutation) 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 (*APIKeyMutation) OldHashedKey

func (m *APIKeyMutation) OldHashedKey(ctx context.Context) (v string, err error)

OldHashedKey returns the old "hashed_key" field's value of the APIKey entity. If the APIKey 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 (*APIKeyMutation) OldIsActive

func (m *APIKeyMutation) OldIsActive(ctx context.Context) (v bool, err error)

OldIsActive returns the old "is_active" field's value of the APIKey entity. If the APIKey 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 (*APIKeyMutation) OldLastUsedAt

func (m *APIKeyMutation) OldLastUsedAt(ctx context.Context) (v time.Time, err error)

OldLastUsedAt returns the old "last_used_at" field's value of the APIKey entity. If the APIKey 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 (*APIKeyMutation) OldName

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

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

func (m *APIKeyMutation) OldPermissions(ctx context.Context) (v string, err error)

OldPermissions returns the old "permissions" field's value of the APIKey entity. If the APIKey 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 (*APIKeyMutation) OldUpdatedAt

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

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

func (m *APIKeyMutation) Op() Op

Op returns the operation name.

func (*APIKeyMutation) Permissions

func (m *APIKeyMutation) Permissions() (r string, exists bool)

Permissions returns the value of the "permissions" field in the mutation.

func (*APIKeyMutation) ProjectCleared

func (m *APIKeyMutation) ProjectCleared() bool

ProjectCleared reports if the "project" edge to the Project entity was cleared.

func (*APIKeyMutation) ProjectID

func (m *APIKeyMutation) ProjectID() (id int, exists bool)

ProjectID returns the "project" edge ID in the mutation.

func (*APIKeyMutation) ProjectIDs

func (m *APIKeyMutation) ProjectIDs() (ids []int)

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

func (*APIKeyMutation) RemovedEdges

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

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

func (*APIKeyMutation) RemovedIDs

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

func (m *APIKeyMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*APIKeyMutation) ResetCreatedBy

func (m *APIKeyMutation) ResetCreatedBy()

ResetCreatedBy resets all changes to the "created_by" edge.

func (*APIKeyMutation) ResetEdge

func (m *APIKeyMutation) 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 (*APIKeyMutation) ResetExpiresAt

func (m *APIKeyMutation) ResetExpiresAt()

ResetExpiresAt resets all changes to the "expires_at" field.

func (*APIKeyMutation) ResetField

func (m *APIKeyMutation) 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 (*APIKeyMutation) ResetHashedKey

func (m *APIKeyMutation) ResetHashedKey()

ResetHashedKey resets all changes to the "hashed_key" field.

func (*APIKeyMutation) ResetIsActive

func (m *APIKeyMutation) ResetIsActive()

ResetIsActive resets all changes to the "is_active" field.

func (*APIKeyMutation) ResetLastUsedAt

func (m *APIKeyMutation) ResetLastUsedAt()

ResetLastUsedAt resets all changes to the "last_used_at" field.

func (*APIKeyMutation) ResetName

func (m *APIKeyMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*APIKeyMutation) ResetPermissions

func (m *APIKeyMutation) ResetPermissions()

ResetPermissions resets all changes to the "permissions" field.

func (*APIKeyMutation) ResetProject

func (m *APIKeyMutation) ResetProject()

ResetProject resets all changes to the "project" edge.

func (*APIKeyMutation) ResetUpdatedAt

func (m *APIKeyMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*APIKeyMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*APIKeyMutation) SetCreatedByID

func (m *APIKeyMutation) SetCreatedByID(id int)

SetCreatedByID sets the "created_by" edge to the User entity by id.

func (*APIKeyMutation) SetExpiresAt

func (m *APIKeyMutation) SetExpiresAt(t time.Time)

SetExpiresAt sets the "expires_at" field.

func (*APIKeyMutation) SetField

func (m *APIKeyMutation) 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 (*APIKeyMutation) SetHashedKey

func (m *APIKeyMutation) SetHashedKey(s string)

SetHashedKey sets the "hashed_key" field.

func (*APIKeyMutation) SetIsActive

func (m *APIKeyMutation) SetIsActive(b bool)

SetIsActive sets the "is_active" field.

func (*APIKeyMutation) SetLastUsedAt

func (m *APIKeyMutation) SetLastUsedAt(t time.Time)

SetLastUsedAt sets the "last_used_at" field.

func (*APIKeyMutation) SetName

func (m *APIKeyMutation) SetName(s string)

SetName sets the "name" field.

func (*APIKeyMutation) SetOp

func (m *APIKeyMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*APIKeyMutation) SetPermissions

func (m *APIKeyMutation) SetPermissions(s string)

SetPermissions sets the "permissions" field.

func (*APIKeyMutation) SetProjectID

func (m *APIKeyMutation) SetProjectID(id int)

SetProjectID sets the "project" edge to the Project entity by id.

func (*APIKeyMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (APIKeyMutation) Tx

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

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

func (*APIKeyMutation) Type

func (m *APIKeyMutation) Type() string

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

func (*APIKeyMutation) UpdatedAt

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

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

func (*APIKeyMutation) Where

func (m *APIKeyMutation) Where(ps ...predicate.APIKey)

Where appends a list predicates to the APIKeyMutation builder.

func (*APIKeyMutation) WhereP

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

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

type APIKeyQuery

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

APIKeyQuery is the builder for querying APIKey entities.

func (*APIKeyQuery) Aggregate

func (_q *APIKeyQuery) Aggregate(fns ...AggregateFunc) *APIKeySelect

Aggregate returns a APIKeySelect configured with the given aggregations.

func (*APIKeyQuery) All

func (_q *APIKeyQuery) All(ctx context.Context) ([]*APIKey, error)

All executes the query and returns a list of APIKeys.

func (*APIKeyQuery) AllX

func (_q *APIKeyQuery) AllX(ctx context.Context) []*APIKey

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

func (*APIKeyQuery) Clone

func (_q *APIKeyQuery) Clone() *APIKeyQuery

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

func (*APIKeyQuery) Count

func (_q *APIKeyQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*APIKeyQuery) CountX

func (_q *APIKeyQuery) CountX(ctx context.Context) int

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

func (*APIKeyQuery) Exist

func (_q *APIKeyQuery) Exist(ctx context.Context) (bool, error)

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

func (*APIKeyQuery) ExistX

func (_q *APIKeyQuery) ExistX(ctx context.Context) bool

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

func (*APIKeyQuery) First

func (_q *APIKeyQuery) First(ctx context.Context) (*APIKey, error)

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

func (*APIKeyQuery) FirstID

func (_q *APIKeyQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*APIKeyQuery) FirstIDX

func (_q *APIKeyQuery) FirstIDX(ctx context.Context) int

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

func (*APIKeyQuery) FirstX

func (_q *APIKeyQuery) FirstX(ctx context.Context) *APIKey

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

func (*APIKeyQuery) GroupBy

func (_q *APIKeyQuery) GroupBy(field string, fields ...string) *APIKeyGroupBy

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.APIKey.Query().
	GroupBy(apikey.FieldName).
	Aggregate(data.Count()).
	Scan(ctx, &v)

func (*APIKeyQuery) IDs

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

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

func (*APIKeyQuery) IDsX

func (_q *APIKeyQuery) IDsX(ctx context.Context) []int

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

func (*APIKeyQuery) Limit

func (_q *APIKeyQuery) Limit(limit int) *APIKeyQuery

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

func (*APIKeyQuery) Offset

func (_q *APIKeyQuery) Offset(offset int) *APIKeyQuery

Offset to start from.

func (*APIKeyQuery) Only

func (_q *APIKeyQuery) Only(ctx context.Context) (*APIKey, error)

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

func (*APIKeyQuery) OnlyID

func (_q *APIKeyQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*APIKeyQuery) OnlyIDX

func (_q *APIKeyQuery) OnlyIDX(ctx context.Context) int

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

func (*APIKeyQuery) OnlyX

func (_q *APIKeyQuery) OnlyX(ctx context.Context) *APIKey

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

func (*APIKeyQuery) Order

func (_q *APIKeyQuery) Order(o ...apikey.OrderOption) *APIKeyQuery

Order specifies how the records should be ordered.

func (*APIKeyQuery) QueryCreatedBy

func (_q *APIKeyQuery) QueryCreatedBy() *UserQuery

QueryCreatedBy chains the current query on the "created_by" edge.

func (*APIKeyQuery) QueryProject

func (_q *APIKeyQuery) QueryProject() *ProjectQuery

QueryProject chains the current query on the "project" edge.

func (*APIKeyQuery) Select

func (_q *APIKeyQuery) Select(fields ...string) *APIKeySelect

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.APIKey.Query().
	Select(apikey.FieldName).
	Scan(ctx, &v)

func (*APIKeyQuery) Unique

func (_q *APIKeyQuery) Unique(unique bool) *APIKeyQuery

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

func (_q *APIKeyQuery) Where(ps ...predicate.APIKey) *APIKeyQuery

Where adds a new predicate for the APIKeyQuery builder.

func (*APIKeyQuery) WithCreatedBy

func (_q *APIKeyQuery) WithCreatedBy(opts ...func(*UserQuery)) *APIKeyQuery

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

func (*APIKeyQuery) WithProject

func (_q *APIKeyQuery) WithProject(opts ...func(*ProjectQuery)) *APIKeyQuery

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

type APIKeySelect

type APIKeySelect struct {
	*APIKeyQuery
	// contains filtered or unexported fields
}

APIKeySelect is the builder for selecting fields of APIKey entities.

func (*APIKeySelect) Aggregate

func (_s *APIKeySelect) Aggregate(fns ...AggregateFunc) *APIKeySelect

Aggregate adds the given aggregation functions to the selector query.

func (*APIKeySelect) Bool

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

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

func (*APIKeySelect) BoolX

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

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

func (*APIKeySelect) Bools

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

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

func (*APIKeySelect) BoolsX

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

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

func (*APIKeySelect) Float64

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

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

func (*APIKeySelect) Float64X

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

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

func (*APIKeySelect) Float64s

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

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

func (*APIKeySelect) Float64sX

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

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

func (*APIKeySelect) Int

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

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

func (*APIKeySelect) IntX

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

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

func (*APIKeySelect) Ints

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

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

func (*APIKeySelect) IntsX

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

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

func (*APIKeySelect) Scan

func (_s *APIKeySelect) Scan(ctx context.Context, v any) error

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

func (*APIKeySelect) ScanX

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

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

func (*APIKeySelect) String

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

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

func (*APIKeySelect) StringX

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

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

func (*APIKeySelect) Strings

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

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

func (*APIKeySelect) StringsX

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

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

type APIKeyUpdate

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

APIKeyUpdate is the builder for updating APIKey entities.

func (*APIKeyUpdate) ClearCreatedBy

func (_u *APIKeyUpdate) ClearCreatedBy() *APIKeyUpdate

ClearCreatedBy clears the "created_by" edge to the User entity.

func (*APIKeyUpdate) ClearExpiresAt

func (_u *APIKeyUpdate) ClearExpiresAt() *APIKeyUpdate

ClearExpiresAt clears the value of the "expires_at" field.

func (*APIKeyUpdate) ClearLastUsedAt

func (_u *APIKeyUpdate) ClearLastUsedAt() *APIKeyUpdate

ClearLastUsedAt clears the value of the "last_used_at" field.

func (*APIKeyUpdate) ClearProject

func (_u *APIKeyUpdate) ClearProject() *APIKeyUpdate

ClearProject clears the "project" edge to the Project entity.

func (*APIKeyUpdate) Exec

func (_u *APIKeyUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*APIKeyUpdate) ExecX

func (_u *APIKeyUpdate) ExecX(ctx context.Context)

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

func (*APIKeyUpdate) Mutation

func (_u *APIKeyUpdate) Mutation() *APIKeyMutation

Mutation returns the APIKeyMutation object of the builder.

func (*APIKeyUpdate) Save

func (_u *APIKeyUpdate) Save(ctx context.Context) (int, error)

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

func (*APIKeyUpdate) SaveX

func (_u *APIKeyUpdate) SaveX(ctx context.Context) int

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

func (*APIKeyUpdate) SetCreatedBy

func (_u *APIKeyUpdate) SetCreatedBy(v *User) *APIKeyUpdate

SetCreatedBy sets the "created_by" edge to the User entity.

func (*APIKeyUpdate) SetCreatedByID

func (_u *APIKeyUpdate) SetCreatedByID(id int) *APIKeyUpdate

SetCreatedByID sets the "created_by" edge to the User entity by ID.

func (*APIKeyUpdate) SetExpiresAt

func (_u *APIKeyUpdate) SetExpiresAt(v time.Time) *APIKeyUpdate

SetExpiresAt sets the "expires_at" field.

func (*APIKeyUpdate) SetHashedKey

func (_u *APIKeyUpdate) SetHashedKey(v string) *APIKeyUpdate

SetHashedKey sets the "hashed_key" field.

func (*APIKeyUpdate) SetIsActive

func (_u *APIKeyUpdate) SetIsActive(v bool) *APIKeyUpdate

SetIsActive sets the "is_active" field.

func (*APIKeyUpdate) SetLastUsedAt

func (_u *APIKeyUpdate) SetLastUsedAt(v time.Time) *APIKeyUpdate

SetLastUsedAt sets the "last_used_at" field.

func (*APIKeyUpdate) SetName

func (_u *APIKeyUpdate) SetName(v string) *APIKeyUpdate

SetName sets the "name" field.

func (*APIKeyUpdate) SetNillableExpiresAt

func (_u *APIKeyUpdate) SetNillableExpiresAt(v *time.Time) *APIKeyUpdate

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*APIKeyUpdate) SetNillableHashedKey

func (_u *APIKeyUpdate) SetNillableHashedKey(v *string) *APIKeyUpdate

SetNillableHashedKey sets the "hashed_key" field if the given value is not nil.

func (*APIKeyUpdate) SetNillableIsActive

func (_u *APIKeyUpdate) SetNillableIsActive(v *bool) *APIKeyUpdate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*APIKeyUpdate) SetNillableLastUsedAt

func (_u *APIKeyUpdate) SetNillableLastUsedAt(v *time.Time) *APIKeyUpdate

SetNillableLastUsedAt sets the "last_used_at" field if the given value is not nil.

func (*APIKeyUpdate) SetNillableName

func (_u *APIKeyUpdate) SetNillableName(v *string) *APIKeyUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*APIKeyUpdate) SetNillablePermissions

func (_u *APIKeyUpdate) SetNillablePermissions(v *string) *APIKeyUpdate

SetNillablePermissions sets the "permissions" field if the given value is not nil.

func (*APIKeyUpdate) SetPermissions

func (_u *APIKeyUpdate) SetPermissions(v string) *APIKeyUpdate

SetPermissions sets the "permissions" field.

func (*APIKeyUpdate) SetProject

func (_u *APIKeyUpdate) SetProject(v *Project) *APIKeyUpdate

SetProject sets the "project" edge to the Project entity.

func (*APIKeyUpdate) SetProjectID

func (_u *APIKeyUpdate) SetProjectID(id int) *APIKeyUpdate

SetProjectID sets the "project" edge to the Project entity by ID.

func (*APIKeyUpdate) SetUpdatedAt

func (_u *APIKeyUpdate) SetUpdatedAt(v time.Time) *APIKeyUpdate

SetUpdatedAt sets the "updated_at" field.

func (*APIKeyUpdate) Where

func (_u *APIKeyUpdate) Where(ps ...predicate.APIKey) *APIKeyUpdate

Where appends a list predicates to the APIKeyUpdate builder.

type APIKeyUpdateOne

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

APIKeyUpdateOne is the builder for updating a single APIKey entity.

func (*APIKeyUpdateOne) ClearCreatedBy

func (_u *APIKeyUpdateOne) ClearCreatedBy() *APIKeyUpdateOne

ClearCreatedBy clears the "created_by" edge to the User entity.

func (*APIKeyUpdateOne) ClearExpiresAt

func (_u *APIKeyUpdateOne) ClearExpiresAt() *APIKeyUpdateOne

ClearExpiresAt clears the value of the "expires_at" field.

func (*APIKeyUpdateOne) ClearLastUsedAt

func (_u *APIKeyUpdateOne) ClearLastUsedAt() *APIKeyUpdateOne

ClearLastUsedAt clears the value of the "last_used_at" field.

func (*APIKeyUpdateOne) ClearProject

func (_u *APIKeyUpdateOne) ClearProject() *APIKeyUpdateOne

ClearProject clears the "project" edge to the Project entity.

func (*APIKeyUpdateOne) Exec

func (_u *APIKeyUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*APIKeyUpdateOne) ExecX

func (_u *APIKeyUpdateOne) ExecX(ctx context.Context)

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

func (*APIKeyUpdateOne) Mutation

func (_u *APIKeyUpdateOne) Mutation() *APIKeyMutation

Mutation returns the APIKeyMutation object of the builder.

func (*APIKeyUpdateOne) Save

func (_u *APIKeyUpdateOne) Save(ctx context.Context) (*APIKey, error)

Save executes the query and returns the updated APIKey entity.

func (*APIKeyUpdateOne) SaveX

func (_u *APIKeyUpdateOne) SaveX(ctx context.Context) *APIKey

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

func (*APIKeyUpdateOne) Select

func (_u *APIKeyUpdateOne) Select(field string, fields ...string) *APIKeyUpdateOne

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

func (*APIKeyUpdateOne) SetCreatedBy

func (_u *APIKeyUpdateOne) SetCreatedBy(v *User) *APIKeyUpdateOne

SetCreatedBy sets the "created_by" edge to the User entity.

func (*APIKeyUpdateOne) SetCreatedByID

func (_u *APIKeyUpdateOne) SetCreatedByID(id int) *APIKeyUpdateOne

SetCreatedByID sets the "created_by" edge to the User entity by ID.

func (*APIKeyUpdateOne) SetExpiresAt

func (_u *APIKeyUpdateOne) SetExpiresAt(v time.Time) *APIKeyUpdateOne

SetExpiresAt sets the "expires_at" field.

func (*APIKeyUpdateOne) SetHashedKey

func (_u *APIKeyUpdateOne) SetHashedKey(v string) *APIKeyUpdateOne

SetHashedKey sets the "hashed_key" field.

func (*APIKeyUpdateOne) SetIsActive

func (_u *APIKeyUpdateOne) SetIsActive(v bool) *APIKeyUpdateOne

SetIsActive sets the "is_active" field.

func (*APIKeyUpdateOne) SetLastUsedAt

func (_u *APIKeyUpdateOne) SetLastUsedAt(v time.Time) *APIKeyUpdateOne

SetLastUsedAt sets the "last_used_at" field.

func (*APIKeyUpdateOne) SetName

func (_u *APIKeyUpdateOne) SetName(v string) *APIKeyUpdateOne

SetName sets the "name" field.

func (*APIKeyUpdateOne) SetNillableExpiresAt

func (_u *APIKeyUpdateOne) SetNillableExpiresAt(v *time.Time) *APIKeyUpdateOne

SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.

func (*APIKeyUpdateOne) SetNillableHashedKey

func (_u *APIKeyUpdateOne) SetNillableHashedKey(v *string) *APIKeyUpdateOne

SetNillableHashedKey sets the "hashed_key" field if the given value is not nil.

func (*APIKeyUpdateOne) SetNillableIsActive

func (_u *APIKeyUpdateOne) SetNillableIsActive(v *bool) *APIKeyUpdateOne

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*APIKeyUpdateOne) SetNillableLastUsedAt

func (_u *APIKeyUpdateOne) SetNillableLastUsedAt(v *time.Time) *APIKeyUpdateOne

SetNillableLastUsedAt sets the "last_used_at" field if the given value is not nil.

func (*APIKeyUpdateOne) SetNillableName

func (_u *APIKeyUpdateOne) SetNillableName(v *string) *APIKeyUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*APIKeyUpdateOne) SetNillablePermissions

func (_u *APIKeyUpdateOne) SetNillablePermissions(v *string) *APIKeyUpdateOne

SetNillablePermissions sets the "permissions" field if the given value is not nil.

func (*APIKeyUpdateOne) SetPermissions

func (_u *APIKeyUpdateOne) SetPermissions(v string) *APIKeyUpdateOne

SetPermissions sets the "permissions" field.

func (*APIKeyUpdateOne) SetProject

func (_u *APIKeyUpdateOne) SetProject(v *Project) *APIKeyUpdateOne

SetProject sets the "project" edge to the Project entity.

func (*APIKeyUpdateOne) SetProjectID

func (_u *APIKeyUpdateOne) SetProjectID(id int) *APIKeyUpdateOne

SetProjectID sets the "project" edge to the Project entity by ID.

func (*APIKeyUpdateOne) SetUpdatedAt

func (_u *APIKeyUpdateOne) SetUpdatedAt(v time.Time) *APIKeyUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*APIKeyUpdateOne) Where

func (_u *APIKeyUpdateOne) Where(ps ...predicate.APIKey) *APIKeyUpdateOne

Where appends a list predicates to the APIKeyUpdate builder.

type APIKeys

type APIKeys []*APIKey

APIKeys is a parsable slice of APIKey.

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(data.As(data.Sum(field1), "sum_field1"), (data.As(data.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
	// APIKey is the client for interacting with the APIKey builders.
	APIKey *APIKeyClient
	// Project is the client for interacting with the Project builders.
	Project *ProjectClient
	// RetentionPolicy is the client for interacting with the RetentionPolicy builders.
	RetentionPolicy *RetentionPolicyClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

FromContext returns a Client stored inside a context, or nil if there isn't one.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

func Open(driverName, dataSourceName string, options ...Option) (*Client, error)

Open opens a database/sql.DB specified by the driver name and the data source name, and returns a new client attached to it. Optional parameters can be added for configuring the client.

func (*Client) BeginTx

func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection and prevents new queries from starting.

func (*Client) Debug

func (c *Client) Debug() *Client

Debug returns a new debug-client. It's used to get verbose logging on specific operations.

client.Debug().
	APIKey.
	Query().
	Count(ctx)

func (*Client) Intercept

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

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

func (*Client) Mutate

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc

type InterceptFunc = ent.InterceptFunc

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

type Interceptor

type Interceptor = ent.Interceptor

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

type 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. Deprecated: Use Asc/Desc functions or the package builders instead.

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 int `json:"id,omitempty"`
	// Project name
	Name string `json:"name,omitempty"`
	// Project description
	Description string `json:"description,omitempty"`
	// Data Source Name for the project
	Dsn string `json:"dsn,omitempty"`
	// Project status: active, inactive, archived
	Status string `json:"status,omitempty"`
	// When the project was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// When the project was last updated
	UpdatedAt time.Time `json:"updated_at,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) QueryAPIKeys

func (_m *Project) QueryAPIKeys() *APIKeyQuery

QueryAPIKeys queries the "api_keys" edge of the Project entity.

func (*Project) QueryOwner

func (_m *Project) QueryOwner() *UserQuery

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

func (*Project) QueryRetentionPolicies

func (_m *Project) QueryRetentionPolicies() *RetentionPolicyQuery

QueryRetentionPolicies queries the "retention_policies" edge of the Project entity.

func (*Project) String

func (_m *Project) String() string

String implements the fmt.Stringer.

func (*Project) Unwrap

func (_m *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 (_m *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.

func (*Project) Value

func (_m *Project) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the Project. This includes values selected through modifiers, order, etc.

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(_m *Project) *ProjectDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*ProjectClient) DeleteOneID

func (c *ProjectClient) DeleteOneID(id int) *ProjectDeleteOne

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

func (*ProjectClient) Get

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

Get returns a Project entity by its id.

func (*ProjectClient) GetX

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

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

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

func (*ProjectClient) Interceptors

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

Interceptors returns the client interceptors.

func (*ProjectClient) MapCreateBulk

func (c *ProjectClient) MapCreateBulk(slice any, setFunc func(*ProjectCreate, int)) *ProjectCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*ProjectClient) Query

func (c *ProjectClient) Query() *ProjectQuery

Query returns a query builder for Project.

func (*ProjectClient) QueryAPIKeys

func (c *ProjectClient) QueryAPIKeys(_m *Project) *APIKeyQuery

QueryAPIKeys queries the api_keys edge of a Project.

func (*ProjectClient) QueryOwner

func (c *ProjectClient) QueryOwner(_m *Project) *UserQuery

QueryOwner queries the owner edge of a Project.

func (*ProjectClient) QueryRetentionPolicies

func (c *ProjectClient) QueryRetentionPolicies(_m *Project) *RetentionPolicyQuery

QueryRetentionPolicies queries the retention_policies 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(_m *Project) *ProjectUpdateOne

UpdateOne returns an update builder for the given entity.

func (*ProjectClient) UpdateOneID

func (c *ProjectClient) UpdateOneID(id int) *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) AddAPIKeyIDs

func (_c *ProjectCreate) AddAPIKeyIDs(ids ...int) *ProjectCreate

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.

func (*ProjectCreate) AddAPIKeys

func (_c *ProjectCreate) AddAPIKeys(v ...*APIKey) *ProjectCreate

AddAPIKeys adds the "api_keys" edges to the APIKey entity.

func (*ProjectCreate) AddRetentionPolicies

func (_c *ProjectCreate) AddRetentionPolicies(v ...*RetentionPolicy) *ProjectCreate

AddRetentionPolicies adds the "retention_policies" edges to the RetentionPolicy entity.

func (*ProjectCreate) AddRetentionPolicyIDs

func (_c *ProjectCreate) AddRetentionPolicyIDs(ids ...int) *ProjectCreate

AddRetentionPolicyIDs adds the "retention_policies" edge to the RetentionPolicy entity by IDs.

func (*ProjectCreate) Exec

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

Exec executes the query.

func (*ProjectCreate) ExecX

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

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

func (*ProjectCreate) Mutation

func (_c *ProjectCreate) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectCreate) Save

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

Save creates the Project in the database.

func (*ProjectCreate) SaveX

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

SaveX calls Save and panics if Save returns an error.

func (*ProjectCreate) SetCreatedAt

func (_c *ProjectCreate) SetCreatedAt(v time.Time) *ProjectCreate

SetCreatedAt sets the "created_at" field.

func (*ProjectCreate) SetDescription

func (_c *ProjectCreate) SetDescription(v string) *ProjectCreate

SetDescription sets the "description" field.

func (*ProjectCreate) SetDsn

func (_c *ProjectCreate) SetDsn(v string) *ProjectCreate

SetDsn sets the "dsn" field.

func (*ProjectCreate) SetName

func (_c *ProjectCreate) SetName(v string) *ProjectCreate

SetName sets the "name" field.

func (*ProjectCreate) SetNillableCreatedAt

func (_c *ProjectCreate) SetNillableCreatedAt(v *time.Time) *ProjectCreate

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

func (*ProjectCreate) SetNillableDescription

func (_c *ProjectCreate) SetNillableDescription(v *string) *ProjectCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ProjectCreate) SetNillableStatus

func (_c *ProjectCreate) SetNillableStatus(v *string) *ProjectCreate

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

func (*ProjectCreate) SetNillableUpdatedAt

func (_c *ProjectCreate) SetNillableUpdatedAt(v *time.Time) *ProjectCreate

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

func (*ProjectCreate) SetOwner

func (_c *ProjectCreate) SetOwner(v *User) *ProjectCreate

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

func (*ProjectCreate) SetOwnerID

func (_c *ProjectCreate) SetOwnerID(id int) *ProjectCreate

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

func (*ProjectCreate) SetStatus

func (_c *ProjectCreate) SetStatus(v string) *ProjectCreate

SetStatus sets the "status" field.

func (*ProjectCreate) SetUpdatedAt

func (_c *ProjectCreate) SetUpdatedAt(v time.Time) *ProjectCreate

SetUpdatedAt sets the "updated_at" 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 (_c *ProjectCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*ProjectCreateBulk) ExecX

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

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

func (*ProjectCreateBulk) Save

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

Save creates the Project entities in the database.

func (*ProjectCreateBulk) SaveX

func (_c *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 (_d *ProjectDelete) Exec(ctx context.Context) (int, error)

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

func (*ProjectDelete) ExecX

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

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

func (*ProjectDelete) Where

func (_d *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 (_d *ProjectDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*ProjectDeleteOne) ExecX

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

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

func (*ProjectDeleteOne) Where

Where appends a list predicates to the ProjectDelete builder.

type ProjectEdges

type ProjectEdges struct {
	// User who owns this project
	Owner *User `json:"owner,omitempty"`
	// API keys associated with this project
	APIKeys []*APIKey `json:"api_keys,omitempty"`
	// Retention policies for this project
	RetentionPolicies []*RetentionPolicy `json:"retention_policies,omitempty"`
	// contains filtered or unexported fields
}

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

func (ProjectEdges) APIKeysOrErr

func (e ProjectEdges) APIKeysOrErr() ([]*APIKey, error)

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

func (ProjectEdges) OwnerOrErr

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

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

func (ProjectEdges) RetentionPoliciesOrErr

func (e ProjectEdges) RetentionPoliciesOrErr() ([]*RetentionPolicy, error)

RetentionPoliciesOrErr returns the RetentionPolicies 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 (_g *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 (_g *ProjectGroupBy) Scan(ctx context.Context, v any) error

Scan applies the selector 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) APIKeysCleared

func (m *ProjectMutation) APIKeysCleared() bool

APIKeysCleared reports if the "api_keys" edge to the APIKey entity was cleared.

func (*ProjectMutation) APIKeysIDs

func (m *ProjectMutation) APIKeysIDs() (ids []int)

APIKeysIDs returns the "api_keys" edge IDs in the mutation.

func (*ProjectMutation) AddAPIKeyIDs

func (m *ProjectMutation) AddAPIKeyIDs(ids ...int)

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by ids.

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

func (m *ProjectMutation) AddRetentionPolicyIDs(ids ...int)

AddRetentionPolicyIDs adds the "retention_policies" edge to the RetentionPolicy 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) ClearAPIKeys

func (m *ProjectMutation) ClearAPIKeys()

ClearAPIKeys clears the "api_keys" edge to the APIKey entity.

func (*ProjectMutation) ClearDescription

func (m *ProjectMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

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

func (m *ProjectMutation) ClearOwner()

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

func (*ProjectMutation) ClearRetentionPolicies

func (m *ProjectMutation) ClearRetentionPolicies()

ClearRetentionPolicies clears the "retention_policies" edge to the RetentionPolicy 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) CreatedAt

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

CreatedAt returns the value of the "created_at" 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) DescriptionCleared

func (m *ProjectMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*ProjectMutation) Dsn

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

Dsn returns the value of the "dsn" 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 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 (*ProjectMutation) IDs

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

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

func (*ProjectMutation) Name

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

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

func (*ProjectMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" 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) OldDsn

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

OldDsn returns the old "dsn" 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) OldName

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

OldName returns the old "name" 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) OldStatus

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

OldStatus returns the old "status" 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) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_at" 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) OwnerCleared

func (m *ProjectMutation) OwnerCleared() bool

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

func (*ProjectMutation) OwnerID

func (m *ProjectMutation) OwnerID() (id int, exists bool)

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

func (*ProjectMutation) OwnerIDs

func (m *ProjectMutation) OwnerIDs() (ids []int)

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 (*ProjectMutation) RemoveAPIKeyIDs

func (m *ProjectMutation) RemoveAPIKeyIDs(ids ...int)

RemoveAPIKeyIDs removes the "api_keys" edge to the APIKey entity by IDs.

func (*ProjectMutation) RemoveRetentionPolicyIDs

func (m *ProjectMutation) RemoveRetentionPolicyIDs(ids ...int)

RemoveRetentionPolicyIDs removes the "retention_policies" edge to the RetentionPolicy entity by IDs.

func (*ProjectMutation) RemovedAPIKeysIDs

func (m *ProjectMutation) RemovedAPIKeysIDs() (ids []int)

RemovedAPIKeys returns the removed IDs of the "api_keys" edge to the APIKey entity.

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

func (m *ProjectMutation) RemovedRetentionPoliciesIDs() (ids []int)

RemovedRetentionPolicies returns the removed IDs of the "retention_policies" edge to the RetentionPolicy entity.

func (*ProjectMutation) ResetAPIKeys

func (m *ProjectMutation) ResetAPIKeys()

ResetAPIKeys resets all changes to the "api_keys" edge.

func (*ProjectMutation) ResetCreatedAt

func (m *ProjectMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*ProjectMutation) ResetDescription

func (m *ProjectMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*ProjectMutation) ResetDsn

func (m *ProjectMutation) ResetDsn()

ResetDsn resets all changes to the "dsn" 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) ResetName

func (m *ProjectMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*ProjectMutation) ResetOwner

func (m *ProjectMutation) ResetOwner()

ResetOwner resets all changes to the "owner" edge.

func (*ProjectMutation) ResetRetentionPolicies

func (m *ProjectMutation) ResetRetentionPolicies()

ResetRetentionPolicies resets all changes to the "retention_policies" edge.

func (*ProjectMutation) ResetStatus

func (m *ProjectMutation) ResetStatus()

ResetStatus resets all changes to the "status" field.

func (*ProjectMutation) ResetUpdatedAt

func (m *ProjectMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*ProjectMutation) RetentionPoliciesCleared

func (m *ProjectMutation) RetentionPoliciesCleared() bool

RetentionPoliciesCleared reports if the "retention_policies" edge to the RetentionPolicy entity was cleared.

func (*ProjectMutation) RetentionPoliciesIDs

func (m *ProjectMutation) RetentionPoliciesIDs() (ids []int)

RetentionPoliciesIDs returns the "retention_policies" edge IDs in the mutation.

func (*ProjectMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*ProjectMutation) SetDescription

func (m *ProjectMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*ProjectMutation) SetDsn

func (m *ProjectMutation) SetDsn(s string)

SetDsn sets the "dsn" 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) SetName

func (m *ProjectMutation) SetName(s string)

SetName sets the "name" field.

func (*ProjectMutation) SetOp

func (m *ProjectMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*ProjectMutation) SetOwnerID

func (m *ProjectMutation) SetOwnerID(id int)

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

func (*ProjectMutation) SetStatus

func (m *ProjectMutation) SetStatus(s string)

SetStatus sets the "status" field.

func (*ProjectMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*ProjectMutation) Status

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

Status returns the value of the "status" 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) UpdatedAt

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

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

func (*ProjectMutation) Where

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

Where appends a list predicates to the ProjectMutation builder.

func (*ProjectMutation) WhereP

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

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

type ProjectQuery

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

ProjectQuery is the builder for querying Project entities.

func (*ProjectQuery) Aggregate

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

Aggregate returns a ProjectSelect configured with the given aggregations.

func (*ProjectQuery) All

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

All executes the query and returns a list of Projects.

func (*ProjectQuery) AllX

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

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

func (*ProjectQuery) Clone

func (_q *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 (_q *ProjectQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*ProjectQuery) CountX

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

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

func (*ProjectQuery) Exist

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

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

func (*ProjectQuery) ExistX

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

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

func (*ProjectQuery) First

func (_q *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 (_q *ProjectQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*ProjectQuery) FirstIDX

func (_q *ProjectQuery) FirstIDX(ctx context.Context) int

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

func (*ProjectQuery) FirstX

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

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

func (*ProjectQuery) GroupBy

func (_q *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 {
	Name string `json:"name,omitempty"`
	Count int `json:"count,omitempty"`
}

client.Project.Query().
	GroupBy(project.FieldName).
	Aggregate(data.Count()).
	Scan(ctx, &v)

func (*ProjectQuery) IDs

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

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

func (*ProjectQuery) IDsX

func (_q *ProjectQuery) IDsX(ctx context.Context) []int

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

func (*ProjectQuery) Limit

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

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

func (*ProjectQuery) Offset

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

Offset to start from.

func (*ProjectQuery) Only

func (_q *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 (_q *ProjectQuery) OnlyID(ctx context.Context) (id int, 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 (_q *ProjectQuery) OnlyIDX(ctx context.Context) int

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

func (*ProjectQuery) OnlyX

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

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

func (*ProjectQuery) Order

func (_q *ProjectQuery) Order(o ...project.OrderOption) *ProjectQuery

Order specifies how the records should be ordered.

func (*ProjectQuery) QueryAPIKeys

func (_q *ProjectQuery) QueryAPIKeys() *APIKeyQuery

QueryAPIKeys chains the current query on the "api_keys" edge.

func (*ProjectQuery) QueryOwner

func (_q *ProjectQuery) QueryOwner() *UserQuery

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

func (*ProjectQuery) QueryRetentionPolicies

func (_q *ProjectQuery) QueryRetentionPolicies() *RetentionPolicyQuery

QueryRetentionPolicies chains the current query on the "retention_policies" edge.

func (*ProjectQuery) Select

func (_q *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 {
	Name string `json:"name,omitempty"`
}

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

func (*ProjectQuery) Unique

func (_q *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 (_q *ProjectQuery) Where(ps ...predicate.Project) *ProjectQuery

Where adds a new predicate for the ProjectQuery builder.

func (*ProjectQuery) WithAPIKeys

func (_q *ProjectQuery) WithAPIKeys(opts ...func(*APIKeyQuery)) *ProjectQuery

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

func (*ProjectQuery) WithOwner

func (_q *ProjectQuery) WithOwner(opts ...func(*UserQuery)) *ProjectQuery

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.

func (*ProjectQuery) WithRetentionPolicies

func (_q *ProjectQuery) WithRetentionPolicies(opts ...func(*RetentionPolicyQuery)) *ProjectQuery

WithRetentionPolicies tells the query-builder to eager-load the nodes that are connected to the "retention_policies" 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 (_s *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 (_s *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) AddAPIKeyIDs

func (_u *ProjectUpdate) AddAPIKeyIDs(ids ...int) *ProjectUpdate

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.

func (*ProjectUpdate) AddAPIKeys

func (_u *ProjectUpdate) AddAPIKeys(v ...*APIKey) *ProjectUpdate

AddAPIKeys adds the "api_keys" edges to the APIKey entity.

func (*ProjectUpdate) AddRetentionPolicies

func (_u *ProjectUpdate) AddRetentionPolicies(v ...*RetentionPolicy) *ProjectUpdate

AddRetentionPolicies adds the "retention_policies" edges to the RetentionPolicy entity.

func (*ProjectUpdate) AddRetentionPolicyIDs

func (_u *ProjectUpdate) AddRetentionPolicyIDs(ids ...int) *ProjectUpdate

AddRetentionPolicyIDs adds the "retention_policies" edge to the RetentionPolicy entity by IDs.

func (*ProjectUpdate) ClearAPIKeys

func (_u *ProjectUpdate) ClearAPIKeys() *ProjectUpdate

ClearAPIKeys clears all "api_keys" edges to the APIKey entity.

func (*ProjectUpdate) ClearDescription

func (_u *ProjectUpdate) ClearDescription() *ProjectUpdate

ClearDescription clears the value of the "description" field.

func (*ProjectUpdate) ClearOwner

func (_u *ProjectUpdate) ClearOwner() *ProjectUpdate

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

func (*ProjectUpdate) ClearRetentionPolicies

func (_u *ProjectUpdate) ClearRetentionPolicies() *ProjectUpdate

ClearRetentionPolicies clears all "retention_policies" edges to the RetentionPolicy entity.

func (*ProjectUpdate) Exec

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

Exec executes the query.

func (*ProjectUpdate) ExecX

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

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

func (*ProjectUpdate) Mutation

func (_u *ProjectUpdate) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectUpdate) RemoveAPIKeyIDs

func (_u *ProjectUpdate) RemoveAPIKeyIDs(ids ...int) *ProjectUpdate

RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs.

func (*ProjectUpdate) RemoveAPIKeys

func (_u *ProjectUpdate) RemoveAPIKeys(v ...*APIKey) *ProjectUpdate

RemoveAPIKeys removes "api_keys" edges to APIKey entities.

func (*ProjectUpdate) RemoveRetentionPolicies

func (_u *ProjectUpdate) RemoveRetentionPolicies(v ...*RetentionPolicy) *ProjectUpdate

RemoveRetentionPolicies removes "retention_policies" edges to RetentionPolicy entities.

func (*ProjectUpdate) RemoveRetentionPolicyIDs

func (_u *ProjectUpdate) RemoveRetentionPolicyIDs(ids ...int) *ProjectUpdate

RemoveRetentionPolicyIDs removes the "retention_policies" edge to RetentionPolicy entities by IDs.

func (*ProjectUpdate) Save

func (_u *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 (_u *ProjectUpdate) SaveX(ctx context.Context) int

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

func (*ProjectUpdate) SetDescription

func (_u *ProjectUpdate) SetDescription(v string) *ProjectUpdate

SetDescription sets the "description" field.

func (*ProjectUpdate) SetDsn

func (_u *ProjectUpdate) SetDsn(v string) *ProjectUpdate

SetDsn sets the "dsn" field.

func (*ProjectUpdate) SetName

func (_u *ProjectUpdate) SetName(v string) *ProjectUpdate

SetName sets the "name" field.

func (*ProjectUpdate) SetNillableDescription

func (_u *ProjectUpdate) SetNillableDescription(v *string) *ProjectUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ProjectUpdate) SetNillableDsn

func (_u *ProjectUpdate) SetNillableDsn(v *string) *ProjectUpdate

SetNillableDsn sets the "dsn" field if the given value is not nil.

func (*ProjectUpdate) SetNillableName

func (_u *ProjectUpdate) SetNillableName(v *string) *ProjectUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*ProjectUpdate) SetNillableStatus

func (_u *ProjectUpdate) SetNillableStatus(v *string) *ProjectUpdate

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

func (*ProjectUpdate) SetOwner

func (_u *ProjectUpdate) SetOwner(v *User) *ProjectUpdate

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

func (*ProjectUpdate) SetOwnerID

func (_u *ProjectUpdate) SetOwnerID(id int) *ProjectUpdate

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

func (*ProjectUpdate) SetStatus

func (_u *ProjectUpdate) SetStatus(v string) *ProjectUpdate

SetStatus sets the "status" field.

func (*ProjectUpdate) SetUpdatedAt

func (_u *ProjectUpdate) SetUpdatedAt(v time.Time) *ProjectUpdate

SetUpdatedAt sets the "updated_at" field.

func (*ProjectUpdate) Where

func (_u *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) AddAPIKeyIDs

func (_u *ProjectUpdateOne) AddAPIKeyIDs(ids ...int) *ProjectUpdateOne

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.

func (*ProjectUpdateOne) AddAPIKeys

func (_u *ProjectUpdateOne) AddAPIKeys(v ...*APIKey) *ProjectUpdateOne

AddAPIKeys adds the "api_keys" edges to the APIKey entity.

func (*ProjectUpdateOne) AddRetentionPolicies

func (_u *ProjectUpdateOne) AddRetentionPolicies(v ...*RetentionPolicy) *ProjectUpdateOne

AddRetentionPolicies adds the "retention_policies" edges to the RetentionPolicy entity.

func (*ProjectUpdateOne) AddRetentionPolicyIDs

func (_u *ProjectUpdateOne) AddRetentionPolicyIDs(ids ...int) *ProjectUpdateOne

AddRetentionPolicyIDs adds the "retention_policies" edge to the RetentionPolicy entity by IDs.

func (*ProjectUpdateOne) ClearAPIKeys

func (_u *ProjectUpdateOne) ClearAPIKeys() *ProjectUpdateOne

ClearAPIKeys clears all "api_keys" edges to the APIKey entity.

func (*ProjectUpdateOne) ClearDescription

func (_u *ProjectUpdateOne) ClearDescription() *ProjectUpdateOne

ClearDescription clears the value of the "description" field.

func (*ProjectUpdateOne) ClearOwner

func (_u *ProjectUpdateOne) ClearOwner() *ProjectUpdateOne

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

func (*ProjectUpdateOne) ClearRetentionPolicies

func (_u *ProjectUpdateOne) ClearRetentionPolicies() *ProjectUpdateOne

ClearRetentionPolicies clears all "retention_policies" edges to the RetentionPolicy entity.

func (*ProjectUpdateOne) Exec

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

Exec executes the query on the entity.

func (*ProjectUpdateOne) ExecX

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

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

func (*ProjectUpdateOne) Mutation

func (_u *ProjectUpdateOne) Mutation() *ProjectMutation

Mutation returns the ProjectMutation object of the builder.

func (*ProjectUpdateOne) RemoveAPIKeyIDs

func (_u *ProjectUpdateOne) RemoveAPIKeyIDs(ids ...int) *ProjectUpdateOne

RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs.

func (*ProjectUpdateOne) RemoveAPIKeys

func (_u *ProjectUpdateOne) RemoveAPIKeys(v ...*APIKey) *ProjectUpdateOne

RemoveAPIKeys removes "api_keys" edges to APIKey entities.

func (*ProjectUpdateOne) RemoveRetentionPolicies

func (_u *ProjectUpdateOne) RemoveRetentionPolicies(v ...*RetentionPolicy) *ProjectUpdateOne

RemoveRetentionPolicies removes "retention_policies" edges to RetentionPolicy entities.

func (*ProjectUpdateOne) RemoveRetentionPolicyIDs

func (_u *ProjectUpdateOne) RemoveRetentionPolicyIDs(ids ...int) *ProjectUpdateOne

RemoveRetentionPolicyIDs removes the "retention_policies" edge to RetentionPolicy entities by IDs.

func (*ProjectUpdateOne) Save

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

Save executes the query and returns the updated Project entity.

func (*ProjectUpdateOne) SaveX

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

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

func (*ProjectUpdateOne) Select

func (_u *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 (_u *ProjectUpdateOne) SetDescription(v string) *ProjectUpdateOne

SetDescription sets the "description" field.

func (*ProjectUpdateOne) SetDsn

func (_u *ProjectUpdateOne) SetDsn(v string) *ProjectUpdateOne

SetDsn sets the "dsn" field.

func (*ProjectUpdateOne) SetName

func (_u *ProjectUpdateOne) SetName(v string) *ProjectUpdateOne

SetName sets the "name" field.

func (*ProjectUpdateOne) SetNillableDescription

func (_u *ProjectUpdateOne) SetNillableDescription(v *string) *ProjectUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*ProjectUpdateOne) SetNillableDsn

func (_u *ProjectUpdateOne) SetNillableDsn(v *string) *ProjectUpdateOne

SetNillableDsn sets the "dsn" field if the given value is not nil.

func (*ProjectUpdateOne) SetNillableName

func (_u *ProjectUpdateOne) SetNillableName(v *string) *ProjectUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*ProjectUpdateOne) SetNillableStatus

func (_u *ProjectUpdateOne) SetNillableStatus(v *string) *ProjectUpdateOne

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

func (*ProjectUpdateOne) SetOwner

func (_u *ProjectUpdateOne) SetOwner(v *User) *ProjectUpdateOne

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

func (*ProjectUpdateOne) SetOwnerID

func (_u *ProjectUpdateOne) SetOwnerID(id int) *ProjectUpdateOne

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

func (*ProjectUpdateOne) SetStatus

func (_u *ProjectUpdateOne) SetStatus(v string) *ProjectUpdateOne

SetStatus sets the "status" field.

func (*ProjectUpdateOne) SetUpdatedAt

func (_u *ProjectUpdateOne) SetUpdatedAt(v time.Time) *ProjectUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*ProjectUpdateOne) Where

Where appends a list predicates to the ProjectUpdate builder.

type Projects

type Projects []*Project

Projects is a parsable slice of Project.

type Querier

type Querier = ent.Querier

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

type QuerierFunc

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext

type QueryContext = ent.QueryContext

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

type RetentionPolicies

type RetentionPolicies []*RetentionPolicy

RetentionPolicies is a parsable slice of RetentionPolicy.

type RetentionPolicy

type RetentionPolicy struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Retention policy name
	Name string `json:"name,omitempty"`
	// Number of days to retain logs
	DurationDays int `json:"duration_days,omitempty"`
	// Description of the retention policy
	Description string `json:"description,omitempty"`
	// Whether the retention policy is active
	IsActive bool `json:"is_active,omitempty"`
	// When the retention policy was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// When the retention policy was last updated
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the RetentionPolicyQuery when eager-loading is set.
	Edges RetentionPolicyEdges `json:"edges"`
	// contains filtered or unexported fields
}

RetentionPolicy is the model entity for the RetentionPolicy schema.

func (*RetentionPolicy) QueryProject

func (_m *RetentionPolicy) QueryProject() *ProjectQuery

QueryProject queries the "project" edge of the RetentionPolicy entity.

func (*RetentionPolicy) String

func (_m *RetentionPolicy) String() string

String implements the fmt.Stringer.

func (*RetentionPolicy) Unwrap

func (_m *RetentionPolicy) Unwrap() *RetentionPolicy

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

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

func (*RetentionPolicy) Value

func (_m *RetentionPolicy) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the RetentionPolicy. This includes values selected through modifiers, order, etc.

type RetentionPolicyClient

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

RetentionPolicyClient is a client for the RetentionPolicy schema.

func NewRetentionPolicyClient

func NewRetentionPolicyClient(c config) *RetentionPolicyClient

NewRetentionPolicyClient returns a client for the RetentionPolicy from the given config.

func (*RetentionPolicyClient) Create

Create returns a builder for creating a RetentionPolicy entity.

func (*RetentionPolicyClient) CreateBulk

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

func (*RetentionPolicyClient) Delete

Delete returns a delete builder for RetentionPolicy.

func (*RetentionPolicyClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*RetentionPolicyClient) DeleteOneID

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

func (*RetentionPolicyClient) Get

Get returns a RetentionPolicy entity by its id.

func (*RetentionPolicyClient) GetX

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

func (*RetentionPolicyClient) Hooks

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

Hooks returns the client hooks.

func (*RetentionPolicyClient) Intercept

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

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

func (*RetentionPolicyClient) Interceptors

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

Interceptors returns the client interceptors.

func (*RetentionPolicyClient) MapCreateBulk

func (c *RetentionPolicyClient) MapCreateBulk(slice any, setFunc func(*RetentionPolicyCreate, int)) *RetentionPolicyCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*RetentionPolicyClient) Query

Query returns a query builder for RetentionPolicy.

func (*RetentionPolicyClient) QueryProject

func (c *RetentionPolicyClient) QueryProject(_m *RetentionPolicy) *ProjectQuery

QueryProject queries the project edge of a RetentionPolicy.

func (*RetentionPolicyClient) Update

Update returns an update builder for RetentionPolicy.

func (*RetentionPolicyClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*RetentionPolicyClient) UpdateOneID

UpdateOneID returns an update builder for the given id.

func (*RetentionPolicyClient) Use

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

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

type RetentionPolicyCreate

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

RetentionPolicyCreate is the builder for creating a RetentionPolicy entity.

func (*RetentionPolicyCreate) Exec

Exec executes the query.

func (*RetentionPolicyCreate) ExecX

func (_c *RetentionPolicyCreate) ExecX(ctx context.Context)

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

func (*RetentionPolicyCreate) Mutation

Mutation returns the RetentionPolicyMutation object of the builder.

func (*RetentionPolicyCreate) Save

Save creates the RetentionPolicy in the database.

func (*RetentionPolicyCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*RetentionPolicyCreate) SetCreatedAt

SetCreatedAt sets the "created_at" field.

func (*RetentionPolicyCreate) SetDescription

func (_c *RetentionPolicyCreate) SetDescription(v string) *RetentionPolicyCreate

SetDescription sets the "description" field.

func (*RetentionPolicyCreate) SetDurationDays

func (_c *RetentionPolicyCreate) SetDurationDays(v int) *RetentionPolicyCreate

SetDurationDays sets the "duration_days" field.

func (*RetentionPolicyCreate) SetIsActive

func (_c *RetentionPolicyCreate) SetIsActive(v bool) *RetentionPolicyCreate

SetIsActive sets the "is_active" field.

func (*RetentionPolicyCreate) SetName

SetName sets the "name" field.

func (*RetentionPolicyCreate) SetNillableCreatedAt

func (_c *RetentionPolicyCreate) SetNillableCreatedAt(v *time.Time) *RetentionPolicyCreate

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

func (*RetentionPolicyCreate) SetNillableDescription

func (_c *RetentionPolicyCreate) SetNillableDescription(v *string) *RetentionPolicyCreate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RetentionPolicyCreate) SetNillableDurationDays

func (_c *RetentionPolicyCreate) SetNillableDurationDays(v *int) *RetentionPolicyCreate

SetNillableDurationDays sets the "duration_days" field if the given value is not nil.

func (*RetentionPolicyCreate) SetNillableIsActive

func (_c *RetentionPolicyCreate) SetNillableIsActive(v *bool) *RetentionPolicyCreate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*RetentionPolicyCreate) SetNillableUpdatedAt

func (_c *RetentionPolicyCreate) SetNillableUpdatedAt(v *time.Time) *RetentionPolicyCreate

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

func (*RetentionPolicyCreate) SetProject

SetProject sets the "project" edge to the Project entity.

func (*RetentionPolicyCreate) SetProjectID

func (_c *RetentionPolicyCreate) SetProjectID(id int) *RetentionPolicyCreate

SetProjectID sets the "project" edge to the Project entity by ID.

func (*RetentionPolicyCreate) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

type RetentionPolicyCreateBulk

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

RetentionPolicyCreateBulk is the builder for creating many RetentionPolicy entities in bulk.

func (*RetentionPolicyCreateBulk) Exec

Exec executes the query.

func (*RetentionPolicyCreateBulk) ExecX

func (_c *RetentionPolicyCreateBulk) ExecX(ctx context.Context)

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

func (*RetentionPolicyCreateBulk) Save

Save creates the RetentionPolicy entities in the database.

func (*RetentionPolicyCreateBulk) SaveX

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

type RetentionPolicyDelete

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

RetentionPolicyDelete is the builder for deleting a RetentionPolicy entity.

func (*RetentionPolicyDelete) Exec

func (_d *RetentionPolicyDelete) Exec(ctx context.Context) (int, error)

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

func (*RetentionPolicyDelete) ExecX

func (_d *RetentionPolicyDelete) ExecX(ctx context.Context) int

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

func (*RetentionPolicyDelete) Where

Where appends a list predicates to the RetentionPolicyDelete builder.

type RetentionPolicyDeleteOne

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

RetentionPolicyDeleteOne is the builder for deleting a single RetentionPolicy entity.

func (*RetentionPolicyDeleteOne) Exec

Exec executes the deletion query.

func (*RetentionPolicyDeleteOne) ExecX

func (_d *RetentionPolicyDeleteOne) ExecX(ctx context.Context)

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

func (*RetentionPolicyDeleteOne) Where

Where appends a list predicates to the RetentionPolicyDelete builder.

type RetentionPolicyEdges

type RetentionPolicyEdges struct {
	// Project this retention policy belongs to
	Project *Project `json:"project,omitempty"`
	// contains filtered or unexported fields
}

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

func (RetentionPolicyEdges) ProjectOrErr

func (e RetentionPolicyEdges) ProjectOrErr() (*Project, error)

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

type RetentionPolicyGroupBy

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

RetentionPolicyGroupBy is the group-by builder for RetentionPolicy entities.

func (*RetentionPolicyGroupBy) Aggregate

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

func (*RetentionPolicyGroupBy) Bool

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

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

func (*RetentionPolicyGroupBy) BoolX

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

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

func (*RetentionPolicyGroupBy) Bools

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

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

func (*RetentionPolicyGroupBy) BoolsX

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

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

func (*RetentionPolicyGroupBy) Float64

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

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

func (*RetentionPolicyGroupBy) Float64X

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

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

func (*RetentionPolicyGroupBy) Float64s

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

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

func (*RetentionPolicyGroupBy) Float64sX

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

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

func (*RetentionPolicyGroupBy) Int

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

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

func (*RetentionPolicyGroupBy) IntX

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

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

func (*RetentionPolicyGroupBy) Ints

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

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

func (*RetentionPolicyGroupBy) IntsX

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

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

func (*RetentionPolicyGroupBy) Scan

func (_g *RetentionPolicyGroupBy) Scan(ctx context.Context, v any) error

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

func (*RetentionPolicyGroupBy) ScanX

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

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

func (*RetentionPolicyGroupBy) String

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

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

func (*RetentionPolicyGroupBy) StringX

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

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

func (*RetentionPolicyGroupBy) Strings

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

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

func (*RetentionPolicyGroupBy) StringsX

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

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

type RetentionPolicyMutation

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

RetentionPolicyMutation represents an operation that mutates the RetentionPolicy nodes in the graph.

func (*RetentionPolicyMutation) AddDurationDays

func (m *RetentionPolicyMutation) AddDurationDays(i int)

AddDurationDays adds i to the "duration_days" field.

func (*RetentionPolicyMutation) AddField

func (m *RetentionPolicyMutation) 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 (*RetentionPolicyMutation) AddedDurationDays

func (m *RetentionPolicyMutation) AddedDurationDays() (r int, exists bool)

AddedDurationDays returns the value that was added to the "duration_days" field in this mutation.

func (*RetentionPolicyMutation) AddedEdges

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

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

func (*RetentionPolicyMutation) AddedField

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

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

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

func (*RetentionPolicyMutation) AddedIDs

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

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

func (*RetentionPolicyMutation) ClearDescription

func (m *RetentionPolicyMutation) ClearDescription()

ClearDescription clears the value of the "description" field.

func (*RetentionPolicyMutation) ClearEdge

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

func (m *RetentionPolicyMutation) 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 (*RetentionPolicyMutation) ClearProject

func (m *RetentionPolicyMutation) ClearProject()

ClearProject clears the "project" edge to the Project entity.

func (*RetentionPolicyMutation) ClearedEdges

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

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

func (*RetentionPolicyMutation) ClearedFields

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

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

func (RetentionPolicyMutation) Client

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

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

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

func (*RetentionPolicyMutation) Description

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

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

func (*RetentionPolicyMutation) DescriptionCleared

func (m *RetentionPolicyMutation) DescriptionCleared() bool

DescriptionCleared returns if the "description" field was cleared in this mutation.

func (*RetentionPolicyMutation) DurationDays

func (m *RetentionPolicyMutation) DurationDays() (r int, exists bool)

DurationDays returns the value of the "duration_days" field in the mutation.

func (*RetentionPolicyMutation) EdgeCleared

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

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

func (*RetentionPolicyMutation) Field

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

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

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

func (*RetentionPolicyMutation) Fields

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

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

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

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

func (*RetentionPolicyMutation) IsActive

func (m *RetentionPolicyMutation) IsActive() (r bool, exists bool)

IsActive returns the value of the "is_active" field in the mutation.

func (*RetentionPolicyMutation) Name

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

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

func (*RetentionPolicyMutation) OldCreatedAt

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

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

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

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

func (m *RetentionPolicyMutation) OldDurationDays(ctx context.Context) (v int, err error)

OldDurationDays returns the old "duration_days" field's value of the RetentionPolicy entity. If the RetentionPolicy 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 (*RetentionPolicyMutation) OldField

func (m *RetentionPolicyMutation) 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 (*RetentionPolicyMutation) OldIsActive

func (m *RetentionPolicyMutation) OldIsActive(ctx context.Context) (v bool, err error)

OldIsActive returns the old "is_active" field's value of the RetentionPolicy entity. If the RetentionPolicy 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 (*RetentionPolicyMutation) OldName

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

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

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

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

func (m *RetentionPolicyMutation) Op() Op

Op returns the operation name.

func (*RetentionPolicyMutation) ProjectCleared

func (m *RetentionPolicyMutation) ProjectCleared() bool

ProjectCleared reports if the "project" edge to the Project entity was cleared.

func (*RetentionPolicyMutation) ProjectID

func (m *RetentionPolicyMutation) ProjectID() (id int, exists bool)

ProjectID returns the "project" edge ID in the mutation.

func (*RetentionPolicyMutation) ProjectIDs

func (m *RetentionPolicyMutation) ProjectIDs() (ids []int)

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

func (*RetentionPolicyMutation) RemovedEdges

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

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

func (*RetentionPolicyMutation) RemovedIDs

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

func (m *RetentionPolicyMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*RetentionPolicyMutation) ResetDescription

func (m *RetentionPolicyMutation) ResetDescription()

ResetDescription resets all changes to the "description" field.

func (*RetentionPolicyMutation) ResetDurationDays

func (m *RetentionPolicyMutation) ResetDurationDays()

ResetDurationDays resets all changes to the "duration_days" field.

func (*RetentionPolicyMutation) ResetEdge

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

func (m *RetentionPolicyMutation) 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 (*RetentionPolicyMutation) ResetIsActive

func (m *RetentionPolicyMutation) ResetIsActive()

ResetIsActive resets all changes to the "is_active" field.

func (*RetentionPolicyMutation) ResetName

func (m *RetentionPolicyMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*RetentionPolicyMutation) ResetProject

func (m *RetentionPolicyMutation) ResetProject()

ResetProject resets all changes to the "project" edge.

func (*RetentionPolicyMutation) ResetUpdatedAt

func (m *RetentionPolicyMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*RetentionPolicyMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*RetentionPolicyMutation) SetDescription

func (m *RetentionPolicyMutation) SetDescription(s string)

SetDescription sets the "description" field.

func (*RetentionPolicyMutation) SetDurationDays

func (m *RetentionPolicyMutation) SetDurationDays(i int)

SetDurationDays sets the "duration_days" field.

func (*RetentionPolicyMutation) SetField

func (m *RetentionPolicyMutation) 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 (*RetentionPolicyMutation) SetIsActive

func (m *RetentionPolicyMutation) SetIsActive(b bool)

SetIsActive sets the "is_active" field.

func (*RetentionPolicyMutation) SetName

func (m *RetentionPolicyMutation) SetName(s string)

SetName sets the "name" field.

func (*RetentionPolicyMutation) SetOp

func (m *RetentionPolicyMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*RetentionPolicyMutation) SetProjectID

func (m *RetentionPolicyMutation) SetProjectID(id int)

SetProjectID sets the "project" edge to the Project entity by id.

func (*RetentionPolicyMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (RetentionPolicyMutation) Tx

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

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

func (*RetentionPolicyMutation) Type

func (m *RetentionPolicyMutation) Type() string

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

func (*RetentionPolicyMutation) UpdatedAt

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

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

func (*RetentionPolicyMutation) Where

Where appends a list predicates to the RetentionPolicyMutation builder.

func (*RetentionPolicyMutation) WhereP

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

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

type RetentionPolicyQuery

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

RetentionPolicyQuery is the builder for querying RetentionPolicy entities.

func (*RetentionPolicyQuery) Aggregate

Aggregate returns a RetentionPolicySelect configured with the given aggregations.

func (*RetentionPolicyQuery) All

All executes the query and returns a list of RetentionPolicies.

func (*RetentionPolicyQuery) AllX

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

func (*RetentionPolicyQuery) Clone

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

func (*RetentionPolicyQuery) Count

func (_q *RetentionPolicyQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*RetentionPolicyQuery) CountX

func (_q *RetentionPolicyQuery) CountX(ctx context.Context) int

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

func (*RetentionPolicyQuery) Exist

func (_q *RetentionPolicyQuery) Exist(ctx context.Context) (bool, error)

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

func (*RetentionPolicyQuery) ExistX

func (_q *RetentionPolicyQuery) ExistX(ctx context.Context) bool

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

func (*RetentionPolicyQuery) First

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

func (*RetentionPolicyQuery) FirstID

func (_q *RetentionPolicyQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*RetentionPolicyQuery) FirstIDX

func (_q *RetentionPolicyQuery) FirstIDX(ctx context.Context) int

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

func (*RetentionPolicyQuery) FirstX

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

func (*RetentionPolicyQuery) GroupBy

func (_q *RetentionPolicyQuery) GroupBy(field string, fields ...string) *RetentionPolicyGroupBy

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.RetentionPolicy.Query().
	GroupBy(retentionpolicy.FieldName).
	Aggregate(data.Count()).
	Scan(ctx, &v)

func (*RetentionPolicyQuery) IDs

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

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

func (*RetentionPolicyQuery) IDsX

func (_q *RetentionPolicyQuery) IDsX(ctx context.Context) []int

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

func (*RetentionPolicyQuery) Limit

func (_q *RetentionPolicyQuery) Limit(limit int) *RetentionPolicyQuery

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

func (*RetentionPolicyQuery) Offset

func (_q *RetentionPolicyQuery) Offset(offset int) *RetentionPolicyQuery

Offset to start from.

func (*RetentionPolicyQuery) Only

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

func (*RetentionPolicyQuery) OnlyID

func (_q *RetentionPolicyQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*RetentionPolicyQuery) OnlyIDX

func (_q *RetentionPolicyQuery) OnlyIDX(ctx context.Context) int

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

func (*RetentionPolicyQuery) OnlyX

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

func (*RetentionPolicyQuery) Order

Order specifies how the records should be ordered.

func (*RetentionPolicyQuery) QueryProject

func (_q *RetentionPolicyQuery) QueryProject() *ProjectQuery

QueryProject chains the current query on the "project" edge.

func (*RetentionPolicyQuery) Select

func (_q *RetentionPolicyQuery) Select(fields ...string) *RetentionPolicySelect

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.RetentionPolicy.Query().
	Select(retentionpolicy.FieldName).
	Scan(ctx, &v)

func (*RetentionPolicyQuery) Unique

func (_q *RetentionPolicyQuery) Unique(unique bool) *RetentionPolicyQuery

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

Where adds a new predicate for the RetentionPolicyQuery builder.

func (*RetentionPolicyQuery) WithProject

func (_q *RetentionPolicyQuery) WithProject(opts ...func(*ProjectQuery)) *RetentionPolicyQuery

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

type RetentionPolicySelect

type RetentionPolicySelect struct {
	*RetentionPolicyQuery
	// contains filtered or unexported fields
}

RetentionPolicySelect is the builder for selecting fields of RetentionPolicy entities.

func (*RetentionPolicySelect) Aggregate

Aggregate adds the given aggregation functions to the selector query.

func (*RetentionPolicySelect) Bool

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

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

func (*RetentionPolicySelect) BoolX

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

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

func (*RetentionPolicySelect) Bools

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

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

func (*RetentionPolicySelect) BoolsX

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

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

func (*RetentionPolicySelect) Float64

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

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

func (*RetentionPolicySelect) Float64X

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

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

func (*RetentionPolicySelect) Float64s

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

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

func (*RetentionPolicySelect) Float64sX

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

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

func (*RetentionPolicySelect) Int

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

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

func (*RetentionPolicySelect) IntX

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

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

func (*RetentionPolicySelect) Ints

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

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

func (*RetentionPolicySelect) IntsX

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

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

func (*RetentionPolicySelect) Scan

func (_s *RetentionPolicySelect) Scan(ctx context.Context, v any) error

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

func (*RetentionPolicySelect) ScanX

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

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

func (*RetentionPolicySelect) String

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

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

func (*RetentionPolicySelect) StringX

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

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

func (*RetentionPolicySelect) Strings

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

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

func (*RetentionPolicySelect) StringsX

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

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

type RetentionPolicyUpdate

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

RetentionPolicyUpdate is the builder for updating RetentionPolicy entities.

func (*RetentionPolicyUpdate) AddDurationDays

func (_u *RetentionPolicyUpdate) AddDurationDays(v int) *RetentionPolicyUpdate

AddDurationDays adds value to the "duration_days" field.

func (*RetentionPolicyUpdate) ClearDescription

func (_u *RetentionPolicyUpdate) ClearDescription() *RetentionPolicyUpdate

ClearDescription clears the value of the "description" field.

func (*RetentionPolicyUpdate) ClearProject

func (_u *RetentionPolicyUpdate) ClearProject() *RetentionPolicyUpdate

ClearProject clears the "project" edge to the Project entity.

func (*RetentionPolicyUpdate) Exec

Exec executes the query.

func (*RetentionPolicyUpdate) ExecX

func (_u *RetentionPolicyUpdate) ExecX(ctx context.Context)

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

func (*RetentionPolicyUpdate) Mutation

Mutation returns the RetentionPolicyMutation object of the builder.

func (*RetentionPolicyUpdate) Save

func (_u *RetentionPolicyUpdate) Save(ctx context.Context) (int, error)

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

func (*RetentionPolicyUpdate) SaveX

func (_u *RetentionPolicyUpdate) SaveX(ctx context.Context) int

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

func (*RetentionPolicyUpdate) SetDescription

func (_u *RetentionPolicyUpdate) SetDescription(v string) *RetentionPolicyUpdate

SetDescription sets the "description" field.

func (*RetentionPolicyUpdate) SetDurationDays

func (_u *RetentionPolicyUpdate) SetDurationDays(v int) *RetentionPolicyUpdate

SetDurationDays sets the "duration_days" field.

func (*RetentionPolicyUpdate) SetIsActive

func (_u *RetentionPolicyUpdate) SetIsActive(v bool) *RetentionPolicyUpdate

SetIsActive sets the "is_active" field.

func (*RetentionPolicyUpdate) SetName

SetName sets the "name" field.

func (*RetentionPolicyUpdate) SetNillableDescription

func (_u *RetentionPolicyUpdate) SetNillableDescription(v *string) *RetentionPolicyUpdate

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RetentionPolicyUpdate) SetNillableDurationDays

func (_u *RetentionPolicyUpdate) SetNillableDurationDays(v *int) *RetentionPolicyUpdate

SetNillableDurationDays sets the "duration_days" field if the given value is not nil.

func (*RetentionPolicyUpdate) SetNillableIsActive

func (_u *RetentionPolicyUpdate) SetNillableIsActive(v *bool) *RetentionPolicyUpdate

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*RetentionPolicyUpdate) SetNillableName

func (_u *RetentionPolicyUpdate) SetNillableName(v *string) *RetentionPolicyUpdate

SetNillableName sets the "name" field if the given value is not nil.

func (*RetentionPolicyUpdate) SetProject

SetProject sets the "project" edge to the Project entity.

func (*RetentionPolicyUpdate) SetProjectID

func (_u *RetentionPolicyUpdate) SetProjectID(id int) *RetentionPolicyUpdate

SetProjectID sets the "project" edge to the Project entity by ID.

func (*RetentionPolicyUpdate) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*RetentionPolicyUpdate) Where

Where appends a list predicates to the RetentionPolicyUpdate builder.

type RetentionPolicyUpdateOne

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

RetentionPolicyUpdateOne is the builder for updating a single RetentionPolicy entity.

func (*RetentionPolicyUpdateOne) AddDurationDays

func (_u *RetentionPolicyUpdateOne) AddDurationDays(v int) *RetentionPolicyUpdateOne

AddDurationDays adds value to the "duration_days" field.

func (*RetentionPolicyUpdateOne) ClearDescription

func (_u *RetentionPolicyUpdateOne) ClearDescription() *RetentionPolicyUpdateOne

ClearDescription clears the value of the "description" field.

func (*RetentionPolicyUpdateOne) ClearProject

ClearProject clears the "project" edge to the Project entity.

func (*RetentionPolicyUpdateOne) Exec

Exec executes the query on the entity.

func (*RetentionPolicyUpdateOne) ExecX

func (_u *RetentionPolicyUpdateOne) ExecX(ctx context.Context)

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

func (*RetentionPolicyUpdateOne) Mutation

Mutation returns the RetentionPolicyMutation object of the builder.

func (*RetentionPolicyUpdateOne) Save

Save executes the query and returns the updated RetentionPolicy entity.

func (*RetentionPolicyUpdateOne) SaveX

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

func (*RetentionPolicyUpdateOne) Select

func (_u *RetentionPolicyUpdateOne) Select(field string, fields ...string) *RetentionPolicyUpdateOne

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

func (*RetentionPolicyUpdateOne) SetDescription

SetDescription sets the "description" field.

func (*RetentionPolicyUpdateOne) SetDurationDays

func (_u *RetentionPolicyUpdateOne) SetDurationDays(v int) *RetentionPolicyUpdateOne

SetDurationDays sets the "duration_days" field.

func (*RetentionPolicyUpdateOne) SetIsActive

SetIsActive sets the "is_active" field.

func (*RetentionPolicyUpdateOne) SetName

SetName sets the "name" field.

func (*RetentionPolicyUpdateOne) SetNillableDescription

func (_u *RetentionPolicyUpdateOne) SetNillableDescription(v *string) *RetentionPolicyUpdateOne

SetNillableDescription sets the "description" field if the given value is not nil.

func (*RetentionPolicyUpdateOne) SetNillableDurationDays

func (_u *RetentionPolicyUpdateOne) SetNillableDurationDays(v *int) *RetentionPolicyUpdateOne

SetNillableDurationDays sets the "duration_days" field if the given value is not nil.

func (*RetentionPolicyUpdateOne) SetNillableIsActive

func (_u *RetentionPolicyUpdateOne) SetNillableIsActive(v *bool) *RetentionPolicyUpdateOne

SetNillableIsActive sets the "is_active" field if the given value is not nil.

func (*RetentionPolicyUpdateOne) SetNillableName

func (_u *RetentionPolicyUpdateOne) SetNillableName(v *string) *RetentionPolicyUpdateOne

SetNillableName sets the "name" field if the given value is not nil.

func (*RetentionPolicyUpdateOne) SetProject

SetProject sets the "project" edge to the Project entity.

func (*RetentionPolicyUpdateOne) SetProjectID

SetProjectID sets the "project" edge to the Project entity by ID.

func (*RetentionPolicyUpdateOne) SetUpdatedAt

SetUpdatedAt sets the "updated_at" field.

func (*RetentionPolicyUpdateOne) Where

Where appends a list predicates to the RetentionPolicyUpdate builder.

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type TraverseFunc

type TraverseFunc = ent.TraverseFunc

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

type Traverser

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// APIKey is the client for interacting with the APIKey builders.
	APIKey *APIKeyClient
	// Project is the client for interacting with the Project builders.
	Project *ProjectClient
	// RetentionPolicy is the client for interacting with the RetentionPolicy builders.
	RetentionPolicy *RetentionPolicyClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Unique username for the user
	Username string `json:"username,omitempty"`
	// Email address of the user
	Email string `json:"email,omitempty"`
	// Hashed password for authentication
	PasswordHash string `json:"-"`
	// User role: admin, user, etc.
	Role string `json:"role,omitempty"`
	// When the user was created
	CreatedAt time.Time `json:"created_at,omitempty"`
	// When the user was last updated
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the UserQuery when eager-loading is set.
	Edges UserEdges `json:"edges"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) QueryAPIKeys

func (_m *User) QueryAPIKeys() *APIKeyQuery

QueryAPIKeys queries the "api_keys" edge of the User entity.

func (*User) QueryProjects

func (_m *User) QueryProjects() *ProjectQuery

QueryProjects queries the "projects" edge of the User entity.

func (*User) String

func (_m *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (_m *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (_m *User) Update() *UserUpdateOne

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

func (*User) Value

func (_m *User) Value(name string) (ent.Value, error)

Value returns the ent.Value that was dynamically selected and assigned to the User. This includes values selected through modifiers, order, etc.

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(_m *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

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

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

func (*UserClient) Get

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

Get returns a User entity by its id.

func (*UserClient) GetX

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

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept

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

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

func (*UserClient) Interceptors

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

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates a builder and applies setFunc on it.

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) QueryAPIKeys

func (c *UserClient) QueryAPIKeys(_m *User) *APIKeyQuery

QueryAPIKeys queries the api_keys edge of a User.

func (*UserClient) QueryProjects

func (c *UserClient) QueryProjects(_m *User) *ProjectQuery

QueryProjects queries the projects edge of a User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(_m *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) AddAPIKeyIDs

func (_c *UserCreate) AddAPIKeyIDs(ids ...int) *UserCreate

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.

func (*UserCreate) AddAPIKeys

func (_c *UserCreate) AddAPIKeys(v ...*APIKey) *UserCreate

AddAPIKeys adds the "api_keys" edges to the APIKey entity.

func (*UserCreate) AddProjectIDs

func (_c *UserCreate) AddProjectIDs(ids ...int) *UserCreate

AddProjectIDs adds the "projects" edge to the Project entity by IDs.

func (*UserCreate) AddProjects

func (_c *UserCreate) AddProjects(v ...*Project) *UserCreate

AddProjects adds the "projects" edges to the Project entity.

func (*UserCreate) Exec

func (_c *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (_c *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (_c *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (_c *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (_c *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetCreatedAt

func (_c *UserCreate) SetCreatedAt(v time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetEmail

func (_c *UserCreate) SetEmail(v string) *UserCreate

SetEmail sets the "email" field.

func (*UserCreate) SetNillableCreatedAt

func (_c *UserCreate) SetNillableCreatedAt(v *time.Time) *UserCreate

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

func (*UserCreate) SetNillableRole

func (_c *UserCreate) SetNillableRole(v *string) *UserCreate

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserCreate) SetNillableUpdatedAt

func (_c *UserCreate) SetNillableUpdatedAt(v *time.Time) *UserCreate

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

func (*UserCreate) SetPasswordHash

func (_c *UserCreate) SetPasswordHash(v string) *UserCreate

SetPasswordHash sets the "password_hash" field.

func (*UserCreate) SetRole

func (_c *UserCreate) SetRole(v string) *UserCreate

SetRole sets the "role" field.

func (*UserCreate) SetUpdatedAt

func (_c *UserCreate) SetUpdatedAt(v time.Time) *UserCreate

SetUpdatedAt sets the "updated_at" field.

func (*UserCreate) SetUsername

func (_c *UserCreate) SetUsername(v string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (_c *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (_c *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (_c *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (_c *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (_d *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (_d *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (_d *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (_d *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (_d *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where

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

Where appends a list predicates to the UserDelete builder.

type UserEdges

type UserEdges struct {
	// Projects owned by this user
	Projects []*Project `json:"projects,omitempty"`
	// API keys created by this user
	APIKeys []*APIKey `json:"api_keys,omitempty"`
	// contains filtered or unexported fields
}

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

func (UserEdges) APIKeysOrErr

func (e UserEdges) APIKeysOrErr() ([]*APIKey, error)

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

func (UserEdges) ProjectsOrErr

func (e UserEdges) ProjectsOrErr() ([]*Project, error)

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

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

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

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

func (*UserGroupBy) Scan

func (_g *UserGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserGroupBy) ScanX

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

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

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

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) APIKeysCleared

func (m *UserMutation) APIKeysCleared() bool

APIKeysCleared reports if the "api_keys" edge to the APIKey entity was cleared.

func (*UserMutation) APIKeysIDs

func (m *UserMutation) APIKeysIDs() (ids []int)

APIKeysIDs returns the "api_keys" edge IDs in the mutation.

func (*UserMutation) AddAPIKeyIDs

func (m *UserMutation) AddAPIKeyIDs(ids ...int)

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by ids.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddProjectIDs

func (m *UserMutation) AddProjectIDs(ids ...int)

AddProjectIDs adds the "projects" edge to the Project entity by ids.

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) ClearAPIKeys

func (m *UserMutation) ClearAPIKeys()

ClearAPIKeys clears the "api_keys" edge to the APIKey entity.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearProjects

func (m *UserMutation) ClearProjects()

ClearProjects clears the "projects" edge to the Project entity.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

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

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

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Email

func (m *UserMutation) Email() (r string, exists bool)

Email returns the value of the "email" field in the mutation.

func (*UserMutation) Field

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

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

func (*UserMutation) FieldCleared

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

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

func (*UserMutation) Fields

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

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

func (*UserMutation) ID

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

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

func (*UserMutation) IDs

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

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

func (*UserMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldEmail

func (m *UserMutation) OldEmail(ctx context.Context) (v string, err error)

OldEmail returns the old "email" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldPasswordHash

func (m *UserMutation) OldPasswordHash(ctx context.Context) (v string, err error)

OldPasswordHash returns the old "password_hash" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldRole

func (m *UserMutation) OldRole(ctx context.Context) (v string, err error)

OldRole returns the old "role" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUpdatedAt

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

OldUpdatedAt returns the old "updated_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUsername

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) PasswordHash

func (m *UserMutation) PasswordHash() (r string, exists bool)

PasswordHash returns the value of the "password_hash" field in the mutation.

func (*UserMutation) ProjectsCleared

func (m *UserMutation) ProjectsCleared() bool

ProjectsCleared reports if the "projects" edge to the Project entity was cleared.

func (*UserMutation) ProjectsIDs

func (m *UserMutation) ProjectsIDs() (ids []int)

ProjectsIDs returns the "projects" edge IDs in the mutation.

func (*UserMutation) RemoveAPIKeyIDs

func (m *UserMutation) RemoveAPIKeyIDs(ids ...int)

RemoveAPIKeyIDs removes the "api_keys" edge to the APIKey entity by IDs.

func (*UserMutation) RemoveProjectIDs

func (m *UserMutation) RemoveProjectIDs(ids ...int)

RemoveProjectIDs removes the "projects" edge to the Project entity by IDs.

func (*UserMutation) RemovedAPIKeysIDs

func (m *UserMutation) RemovedAPIKeysIDs() (ids []int)

RemovedAPIKeys returns the removed IDs of the "api_keys" edge to the APIKey entity.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

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

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

func (*UserMutation) RemovedProjectsIDs

func (m *UserMutation) RemovedProjectsIDs() (ids []int)

RemovedProjects returns the removed IDs of the "projects" edge to the Project entity.

func (*UserMutation) ResetAPIKeys

func (m *UserMutation) ResetAPIKeys()

ResetAPIKeys resets all changes to the "api_keys" edge.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetEmail

func (m *UserMutation) ResetEmail()

ResetEmail resets all changes to the "email" field.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetPasswordHash

func (m *UserMutation) ResetPasswordHash()

ResetPasswordHash resets all changes to the "password_hash" field.

func (*UserMutation) ResetProjects

func (m *UserMutation) ResetProjects()

ResetProjects resets all changes to the "projects" edge.

func (*UserMutation) ResetRole

func (m *UserMutation) ResetRole()

ResetRole resets all changes to the "role" field.

func (*UserMutation) ResetUpdatedAt

func (m *UserMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) Role

func (m *UserMutation) Role() (r string, exists bool)

Role returns the value of the "role" field in the mutation.

func (*UserMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetEmail

func (m *UserMutation) SetEmail(s string)

SetEmail sets the "email" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetOp

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPasswordHash

func (m *UserMutation) SetPasswordHash(s string)

SetPasswordHash sets the "password_hash" field.

func (*UserMutation) SetRole

func (m *UserMutation) SetRole(s string)

SetRole sets the "role" field.

func (*UserMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) UpdatedAt

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

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

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP

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

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

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate

func (_q *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (_q *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (_q *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (_q *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (_q *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (_q *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (_q *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (_q *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (_q *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (_q *UserQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserQuery) FirstIDX

func (_q *UserQuery) FirstIDX(ctx context.Context) int

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

func (*UserQuery) FirstX

func (_q *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (_q *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

Example:

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

client.User.Query().
	GroupBy(user.FieldUsername).
	Aggregate(data.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

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

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

func (*UserQuery) IDsX

func (_q *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (_q *UserQuery) Limit(limit int) *UserQuery

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

func (*UserQuery) Offset

func (_q *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (_q *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (_q *UserQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserQuery) OnlyIDX

func (_q *UserQuery) OnlyIDX(ctx context.Context) int

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

func (*UserQuery) OnlyX

func (_q *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (_q *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) QueryAPIKeys

func (_q *UserQuery) QueryAPIKeys() *APIKeyQuery

QueryAPIKeys chains the current query on the "api_keys" edge.

func (*UserQuery) QueryProjects

func (_q *UserQuery) QueryProjects() *ProjectQuery

QueryProjects chains the current query on the "projects" edge.

func (*UserQuery) Select

func (_q *UserQuery) Select(fields ...string) *UserSelect

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

Example:

var v []struct {
	Username string `json:"username,omitempty"`
}

client.User.Query().
	Select(user.FieldUsername).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (_q *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (_q *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

func (*UserQuery) WithAPIKeys

func (_q *UserQuery) WithAPIKeys(opts ...func(*APIKeyQuery)) *UserQuery

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

func (*UserQuery) WithProjects

func (_q *UserQuery) WithProjects(opts ...func(*ProjectQuery)) *UserQuery

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

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate

func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

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

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

func (*UserSelect) BoolX

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

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

func (*UserSelect) Bools

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

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

func (*UserSelect) BoolsX

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

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

func (*UserSelect) Float64

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

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

func (*UserSelect) Float64X

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

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

func (*UserSelect) Float64s

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

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

func (*UserSelect) Float64sX

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

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

func (*UserSelect) Int

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

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

func (*UserSelect) IntX

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

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

func (*UserSelect) Ints

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

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

func (*UserSelect) IntsX

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

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

func (*UserSelect) Scan

func (_s *UserSelect) Scan(ctx context.Context, v any) error

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

func (*UserSelect) ScanX

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

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

func (*UserSelect) String

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

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

func (*UserSelect) StringX

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

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

func (*UserSelect) Strings

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

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

func (*UserSelect) StringsX

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

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAPIKeyIDs

func (_u *UserUpdate) AddAPIKeyIDs(ids ...int) *UserUpdate

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.

func (*UserUpdate) AddAPIKeys

func (_u *UserUpdate) AddAPIKeys(v ...*APIKey) *UserUpdate

AddAPIKeys adds the "api_keys" edges to the APIKey entity.

func (*UserUpdate) AddProjectIDs

func (_u *UserUpdate) AddProjectIDs(ids ...int) *UserUpdate

AddProjectIDs adds the "projects" edge to the Project entity by IDs.

func (*UserUpdate) AddProjects

func (_u *UserUpdate) AddProjects(v ...*Project) *UserUpdate

AddProjects adds the "projects" edges to the Project entity.

func (*UserUpdate) ClearAPIKeys

func (_u *UserUpdate) ClearAPIKeys() *UserUpdate

ClearAPIKeys clears all "api_keys" edges to the APIKey entity.

func (*UserUpdate) ClearProjects

func (_u *UserUpdate) ClearProjects() *UserUpdate

ClearProjects clears all "projects" edges to the Project entity.

func (*UserUpdate) Exec

func (_u *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (_u *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (_u *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) RemoveAPIKeyIDs

func (_u *UserUpdate) RemoveAPIKeyIDs(ids ...int) *UserUpdate

RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs.

func (*UserUpdate) RemoveAPIKeys

func (_u *UserUpdate) RemoveAPIKeys(v ...*APIKey) *UserUpdate

RemoveAPIKeys removes "api_keys" edges to APIKey entities.

func (*UserUpdate) RemoveProjectIDs

func (_u *UserUpdate) RemoveProjectIDs(ids ...int) *UserUpdate

RemoveProjectIDs removes the "projects" edge to Project entities by IDs.

func (*UserUpdate) RemoveProjects

func (_u *UserUpdate) RemoveProjects(v ...*Project) *UserUpdate

RemoveProjects removes "projects" edges to Project entities.

func (*UserUpdate) Save

func (_u *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (_u *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetEmail

func (_u *UserUpdate) SetEmail(v string) *UserUpdate

SetEmail sets the "email" field.

func (*UserUpdate) SetNillableEmail

func (_u *UserUpdate) SetNillableEmail(v *string) *UserUpdate

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdate) SetNillablePasswordHash

func (_u *UserUpdate) SetNillablePasswordHash(v *string) *UserUpdate

SetNillablePasswordHash sets the "password_hash" field if the given value is not nil.

func (*UserUpdate) SetNillableRole

func (_u *UserUpdate) SetNillableRole(v *string) *UserUpdate

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserUpdate) SetNillableUsername

func (_u *UserUpdate) SetNillableUsername(v *string) *UserUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdate) SetPasswordHash

func (_u *UserUpdate) SetPasswordHash(v string) *UserUpdate

SetPasswordHash sets the "password_hash" field.

func (*UserUpdate) SetRole

func (_u *UserUpdate) SetRole(v string) *UserUpdate

SetRole sets the "role" field.

func (*UserUpdate) SetUpdatedAt

func (_u *UserUpdate) SetUpdatedAt(v time.Time) *UserUpdate

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdate) SetUsername

func (_u *UserUpdate) SetUsername(v string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where

func (_u *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAPIKeyIDs

func (_u *UserUpdateOne) AddAPIKeyIDs(ids ...int) *UserUpdateOne

AddAPIKeyIDs adds the "api_keys" edge to the APIKey entity by IDs.

func (*UserUpdateOne) AddAPIKeys

func (_u *UserUpdateOne) AddAPIKeys(v ...*APIKey) *UserUpdateOne

AddAPIKeys adds the "api_keys" edges to the APIKey entity.

func (*UserUpdateOne) AddProjectIDs

func (_u *UserUpdateOne) AddProjectIDs(ids ...int) *UserUpdateOne

AddProjectIDs adds the "projects" edge to the Project entity by IDs.

func (*UserUpdateOne) AddProjects

func (_u *UserUpdateOne) AddProjects(v ...*Project) *UserUpdateOne

AddProjects adds the "projects" edges to the Project entity.

func (*UserUpdateOne) ClearAPIKeys

func (_u *UserUpdateOne) ClearAPIKeys() *UserUpdateOne

ClearAPIKeys clears all "api_keys" edges to the APIKey entity.

func (*UserUpdateOne) ClearProjects

func (_u *UserUpdateOne) ClearProjects() *UserUpdateOne

ClearProjects clears all "projects" edges to the Project entity.

func (*UserUpdateOne) Exec

func (_u *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (_u *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (_u *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) RemoveAPIKeyIDs

func (_u *UserUpdateOne) RemoveAPIKeyIDs(ids ...int) *UserUpdateOne

RemoveAPIKeyIDs removes the "api_keys" edge to APIKey entities by IDs.

func (*UserUpdateOne) RemoveAPIKeys

func (_u *UserUpdateOne) RemoveAPIKeys(v ...*APIKey) *UserUpdateOne

RemoveAPIKeys removes "api_keys" edges to APIKey entities.

func (*UserUpdateOne) RemoveProjectIDs

func (_u *UserUpdateOne) RemoveProjectIDs(ids ...int) *UserUpdateOne

RemoveProjectIDs removes the "projects" edge to Project entities by IDs.

func (*UserUpdateOne) RemoveProjects

func (_u *UserUpdateOne) RemoveProjects(v ...*Project) *UserUpdateOne

RemoveProjects removes "projects" edges to Project entities.

func (*UserUpdateOne) Save

func (_u *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (_u *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (_u *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

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

func (*UserUpdateOne) SetEmail

func (_u *UserUpdateOne) SetEmail(v string) *UserUpdateOne

SetEmail sets the "email" field.

func (*UserUpdateOne) SetNillableEmail

func (_u *UserUpdateOne) SetNillableEmail(v *string) *UserUpdateOne

SetNillableEmail sets the "email" field if the given value is not nil.

func (*UserUpdateOne) SetNillablePasswordHash

func (_u *UserUpdateOne) SetNillablePasswordHash(v *string) *UserUpdateOne

SetNillablePasswordHash sets the "password_hash" field if the given value is not nil.

func (*UserUpdateOne) SetNillableRole

func (_u *UserUpdateOne) SetNillableRole(v *string) *UserUpdateOne

SetNillableRole sets the "role" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUsername

func (_u *UserUpdateOne) SetNillableUsername(v *string) *UserUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdateOne) SetPasswordHash

func (_u *UserUpdateOne) SetPasswordHash(v string) *UserUpdateOne

SetPasswordHash sets the "password_hash" field.

func (*UserUpdateOne) SetRole

func (_u *UserUpdateOne) SetRole(v string) *UserUpdateOne

SetRole sets the "role" field.

func (*UserUpdateOne) SetUpdatedAt

func (_u *UserUpdateOne) SetUpdatedAt(v time.Time) *UserUpdateOne

SetUpdatedAt sets the "updated_at" field.

func (*UserUpdateOne) SetUsername

func (_u *UserUpdateOne) SetUsername(v string) *UserUpdateOne

SetUsername sets the "username" field.

func (*UserUpdateOne) Where

func (_u *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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