ent

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 24 Imported by: 0

README

ent — Ent ORM 生成代码

⚠️ 此目录为自动生成代码,禁止手动修改

修改方式:编辑 ent/schema/ 中的 Schema 定义,然后运行代码生成命令。

生成的实体

实体 说明
CasbinPolicy Casbin RBAC 策略规则存储(auth 模块使用)
Media 媒体文件记录(文件名、大小、MIME 类型、URL 等)
MediaFormat 媒体文件的各种格式/尺寸变体(缩略图、小图等)

代码生成

# 在 framework 目录下执行
go generate ./ent/...

# 或使用 Makefile
make generate

Schema 定义位置

ent/
├── schema/
│   ├── casbinpolicy.go   # CasbinPolicy Schema
│   ├── media.go          # Media Schema
│   └── mediaformat.go    # MediaFormat Schema
├── generate.go           # go:generate 指令
└── ...(生成代码)

基础 Mixin

所有 Schema 均继承自 entities 模块提供的 Mixin(参见 entities/README.md):

  • GlobalEntitySchema:全局实体,含标准审计字段与 UUID v7 主键
  • BaseEntitySchema:域隔离实体,额外包含 ownerDomainId

添加新实体

  1. ent/schema/ 目录创建新的 Schema 文件(如 my_entity.go
  2. 选择合适的 Mixin(GlobalEntitySchema / BaseEntitySchema / TenantEntitySchema
  3. 定义业务字段与 Edge
  4. 运行 go generate ./ent/... 生成代码
  5. 如涉及外键 Edge,必须显式声明 entities.IDField("id") 防止主键回退

注意事项

  • ent/generate.go 中配置了生成选项(Feature Flag、注解等),修改前请了解 Ent 文档
  • Schema 变更后需同步运行数据库迁移
  • 生成代码已通过 .gitignore 设置提交到仓库(方便 CI 直接使用),无需每次生成

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.
	TypeCasbinPolicy = "CasbinPolicy"
	TypeMedia        = "Media"
	TypeMediaFormat  = "MediaFormat"
)

Variables

View Source
var ErrTxStarted = errors.New("ent: 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 AggregateFunc

type AggregateFunc func(*sql.Selector) string

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

func As

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

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

func Count

func Count() AggregateFunc

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

func Max

func Max(field string) AggregateFunc

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

func Mean

func Mean(field string) AggregateFunc

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

func Min

func Min(field string) AggregateFunc

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

func Sum

func Sum(field string) AggregateFunc

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

type BatchProcessor

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

BatchProcessor 批量处理器

func NewBatchProcessor

func NewBatchProcessor() *BatchProcessor

NewBatchProcessor 创建批量处理器

func (*BatchProcessor) Process

func (p *BatchProcessor) Process(ctx context.Context, items []interface{}, handler func([]interface{}) error) error

Process 批量处理

func (*BatchProcessor) WithBatchSize

func (p *BatchProcessor) WithBatchSize(n int) *BatchProcessor

WithBatchSize 设置批量大小

func (*BatchProcessor) WithTimeout

func (p *BatchProcessor) WithTimeout(d time.Duration) *BatchProcessor

WithTimeout 设置超时

type CasbinPolicies

type CasbinPolicies []*CasbinPolicy

CasbinPolicies is a parsable slice of CasbinPolicy.

type CasbinPolicy

type CasbinPolicy struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// Policy type: p, g, p2, etc.
	Ptype string `json:"ptype,omitempty"`
	// Policy value 0
	V0 string `json:"v0,omitempty"`
	// Policy value 1
	V1 string `json:"v1,omitempty"`
	// Policy value 2
	V2 string `json:"v2,omitempty"`
	// Policy value 3
	V3 string `json:"v3,omitempty"`
	// Policy value 4
	V4 string `json:"v4,omitempty"`
	// Policy value 5
	V5 string `json:"v5,omitempty"`
	// contains filtered or unexported fields
}

CasbinPolicy is the model entity for the CasbinPolicy schema.

func (*CasbinPolicy) String

func (_m *CasbinPolicy) String() string

String implements the fmt.Stringer.

func (*CasbinPolicy) Unwrap

func (_m *CasbinPolicy) Unwrap() *CasbinPolicy

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

func (_m *CasbinPolicy) Update() *CasbinPolicyUpdateOne

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

func (*CasbinPolicy) Value

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

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

type CasbinPolicyClient

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

CasbinPolicyClient is a client for the CasbinPolicy schema.

func NewCasbinPolicyClient

func NewCasbinPolicyClient(c config) *CasbinPolicyClient

NewCasbinPolicyClient returns a client for the CasbinPolicy from the given config.

func (*CasbinPolicyClient) Create

Create returns a builder for creating a CasbinPolicy entity.

func (*CasbinPolicyClient) CreateBulk

func (c *CasbinPolicyClient) CreateBulk(builders ...*CasbinPolicyCreate) *CasbinPolicyCreateBulk

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

func (*CasbinPolicyClient) Delete

Delete returns a delete builder for CasbinPolicy.

func (*CasbinPolicyClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*CasbinPolicyClient) DeleteOneID

func (c *CasbinPolicyClient) DeleteOneID(id int) *CasbinPolicyDeleteOne

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

func (*CasbinPolicyClient) Get

Get returns a CasbinPolicy entity by its id.

func (*CasbinPolicyClient) GetX

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

func (*CasbinPolicyClient) Hooks

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

Hooks returns the client hooks.

func (*CasbinPolicyClient) Intercept

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

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

func (*CasbinPolicyClient) Interceptors

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

Interceptors returns the client interceptors.

func (*CasbinPolicyClient) MapCreateBulk

func (c *CasbinPolicyClient) MapCreateBulk(slice any, setFunc func(*CasbinPolicyCreate, int)) *CasbinPolicyCreateBulk

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 (*CasbinPolicyClient) Query

Query returns a query builder for CasbinPolicy.

func (*CasbinPolicyClient) Update

Update returns an update builder for CasbinPolicy.

func (*CasbinPolicyClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*CasbinPolicyClient) UpdateOneID

func (c *CasbinPolicyClient) UpdateOneID(id int) *CasbinPolicyUpdateOne

UpdateOneID returns an update builder for the given id.

func (*CasbinPolicyClient) Use

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

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

type CasbinPolicyCreate

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

CasbinPolicyCreate is the builder for creating a CasbinPolicy entity.

func (*CasbinPolicyCreate) Exec

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

Exec executes the query.

func (*CasbinPolicyCreate) ExecX

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

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

func (*CasbinPolicyCreate) Mutation

func (_c *CasbinPolicyCreate) Mutation() *CasbinPolicyMutation

Mutation returns the CasbinPolicyMutation object of the builder.

func (*CasbinPolicyCreate) Save

Save creates the CasbinPolicy in the database.

func (*CasbinPolicyCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*CasbinPolicyCreate) SetNillableV0

func (_c *CasbinPolicyCreate) SetNillableV0(v *string) *CasbinPolicyCreate

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*CasbinPolicyCreate) SetNillableV1

func (_c *CasbinPolicyCreate) SetNillableV1(v *string) *CasbinPolicyCreate

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*CasbinPolicyCreate) SetNillableV2

func (_c *CasbinPolicyCreate) SetNillableV2(v *string) *CasbinPolicyCreate

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*CasbinPolicyCreate) SetNillableV3

func (_c *CasbinPolicyCreate) SetNillableV3(v *string) *CasbinPolicyCreate

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*CasbinPolicyCreate) SetNillableV4

func (_c *CasbinPolicyCreate) SetNillableV4(v *string) *CasbinPolicyCreate

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*CasbinPolicyCreate) SetNillableV5

func (_c *CasbinPolicyCreate) SetNillableV5(v *string) *CasbinPolicyCreate

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*CasbinPolicyCreate) SetPtype

func (_c *CasbinPolicyCreate) SetPtype(v string) *CasbinPolicyCreate

SetPtype sets the "ptype" field.

func (*CasbinPolicyCreate) SetV0

SetV0 sets the "v0" field.

func (*CasbinPolicyCreate) SetV1

SetV1 sets the "v1" field.

func (*CasbinPolicyCreate) SetV2

SetV2 sets the "v2" field.

func (*CasbinPolicyCreate) SetV3

SetV3 sets the "v3" field.

func (*CasbinPolicyCreate) SetV4

SetV4 sets the "v4" field.

func (*CasbinPolicyCreate) SetV5

SetV5 sets the "v5" field.

type CasbinPolicyCreateBulk

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

CasbinPolicyCreateBulk is the builder for creating many CasbinPolicy entities in bulk.

func (*CasbinPolicyCreateBulk) Exec

Exec executes the query.

func (*CasbinPolicyCreateBulk) ExecX

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

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

func (*CasbinPolicyCreateBulk) Save

Save creates the CasbinPolicy entities in the database.

func (*CasbinPolicyCreateBulk) SaveX

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

type CasbinPolicyDelete

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

CasbinPolicyDelete is the builder for deleting a CasbinPolicy entity.

func (*CasbinPolicyDelete) Exec

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

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

func (*CasbinPolicyDelete) ExecX

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

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

func (*CasbinPolicyDelete) Where

Where appends a list predicates to the CasbinPolicyDelete builder.

type CasbinPolicyDeleteOne

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

CasbinPolicyDeleteOne is the builder for deleting a single CasbinPolicy entity.

func (*CasbinPolicyDeleteOne) Exec

Exec executes the deletion query.

func (*CasbinPolicyDeleteOne) ExecX

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

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

func (*CasbinPolicyDeleteOne) Where

Where appends a list predicates to the CasbinPolicyDelete builder.

type CasbinPolicyGroupBy

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

CasbinPolicyGroupBy is the group-by builder for CasbinPolicy entities.

func (*CasbinPolicyGroupBy) Aggregate

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

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

func (*CasbinPolicyGroupBy) Bool

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

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

func (*CasbinPolicyGroupBy) BoolX

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

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

func (*CasbinPolicyGroupBy) Bools

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

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

func (*CasbinPolicyGroupBy) BoolsX

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

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

func (*CasbinPolicyGroupBy) Float64

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

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

func (*CasbinPolicyGroupBy) Float64X

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

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

func (*CasbinPolicyGroupBy) Float64s

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

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

func (*CasbinPolicyGroupBy) Float64sX

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

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

func (*CasbinPolicyGroupBy) Int

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

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

func (*CasbinPolicyGroupBy) IntX

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

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

func (*CasbinPolicyGroupBy) Ints

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

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

func (*CasbinPolicyGroupBy) IntsX

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

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

func (*CasbinPolicyGroupBy) Scan

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

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

func (*CasbinPolicyGroupBy) ScanX

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

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

func (*CasbinPolicyGroupBy) String

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

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

func (*CasbinPolicyGroupBy) StringX

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

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

func (*CasbinPolicyGroupBy) Strings

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

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

func (*CasbinPolicyGroupBy) StringsX

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

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

type CasbinPolicyMutation

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

CasbinPolicyMutation represents an operation that mutates the CasbinPolicy nodes in the graph.

func (*CasbinPolicyMutation) AddField

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

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

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

func (*CasbinPolicyMutation) AddedField

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

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

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

func (*CasbinPolicyMutation) AddedIDs

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

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

func (*CasbinPolicyMutation) ClearEdge

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

func (m *CasbinPolicyMutation) 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 (*CasbinPolicyMutation) ClearV0

func (m *CasbinPolicyMutation) ClearV0()

ClearV0 clears the value of the "v0" field.

func (*CasbinPolicyMutation) ClearV1

func (m *CasbinPolicyMutation) ClearV1()

ClearV1 clears the value of the "v1" field.

func (*CasbinPolicyMutation) ClearV2

func (m *CasbinPolicyMutation) ClearV2()

ClearV2 clears the value of the "v2" field.

func (*CasbinPolicyMutation) ClearV3

func (m *CasbinPolicyMutation) ClearV3()

ClearV3 clears the value of the "v3" field.

func (*CasbinPolicyMutation) ClearV4

func (m *CasbinPolicyMutation) ClearV4()

ClearV4 clears the value of the "v4" field.

func (*CasbinPolicyMutation) ClearV5

func (m *CasbinPolicyMutation) ClearV5()

ClearV5 clears the value of the "v5" field.

func (*CasbinPolicyMutation) ClearedEdges

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

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

func (*CasbinPolicyMutation) ClearedFields

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

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

func (CasbinPolicyMutation) Client

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

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

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

func (*CasbinPolicyMutation) Field

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

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

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

func (*CasbinPolicyMutation) Fields

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

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

func (m *CasbinPolicyMutation) 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 (*CasbinPolicyMutation) OldField

func (m *CasbinPolicyMutation) 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 (*CasbinPolicyMutation) OldPtype

func (m *CasbinPolicyMutation) OldPtype(ctx context.Context) (v string, err error)

OldPtype returns the old "ptype" field's value of the CasbinPolicy entity. If the CasbinPolicy 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 (*CasbinPolicyMutation) OldV0

func (m *CasbinPolicyMutation) OldV0(ctx context.Context) (v string, err error)

OldV0 returns the old "v0" field's value of the CasbinPolicy entity. If the CasbinPolicy 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 (*CasbinPolicyMutation) OldV1

func (m *CasbinPolicyMutation) OldV1(ctx context.Context) (v string, err error)

OldV1 returns the old "v1" field's value of the CasbinPolicy entity. If the CasbinPolicy 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 (*CasbinPolicyMutation) OldV2

func (m *CasbinPolicyMutation) OldV2(ctx context.Context) (v string, err error)

OldV2 returns the old "v2" field's value of the CasbinPolicy entity. If the CasbinPolicy 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 (*CasbinPolicyMutation) OldV3

func (m *CasbinPolicyMutation) OldV3(ctx context.Context) (v string, err error)

OldV3 returns the old "v3" field's value of the CasbinPolicy entity. If the CasbinPolicy 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 (*CasbinPolicyMutation) OldV4

func (m *CasbinPolicyMutation) OldV4(ctx context.Context) (v string, err error)

OldV4 returns the old "v4" field's value of the CasbinPolicy entity. If the CasbinPolicy 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 (*CasbinPolicyMutation) OldV5

func (m *CasbinPolicyMutation) OldV5(ctx context.Context) (v string, err error)

OldV5 returns the old "v5" field's value of the CasbinPolicy entity. If the CasbinPolicy 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 (*CasbinPolicyMutation) Op

func (m *CasbinPolicyMutation) Op() Op

Op returns the operation name.

func (*CasbinPolicyMutation) Ptype

func (m *CasbinPolicyMutation) Ptype() (r string, exists bool)

Ptype returns the value of the "ptype" field in the mutation.

func (*CasbinPolicyMutation) RemovedEdges

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

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

func (*CasbinPolicyMutation) RemovedIDs

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

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

func (m *CasbinPolicyMutation) 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 (*CasbinPolicyMutation) ResetPtype

func (m *CasbinPolicyMutation) ResetPtype()

ResetPtype resets all changes to the "ptype" field.

func (*CasbinPolicyMutation) ResetV0

func (m *CasbinPolicyMutation) ResetV0()

ResetV0 resets all changes to the "v0" field.

func (*CasbinPolicyMutation) ResetV1

func (m *CasbinPolicyMutation) ResetV1()

ResetV1 resets all changes to the "v1" field.

func (*CasbinPolicyMutation) ResetV2

func (m *CasbinPolicyMutation) ResetV2()

ResetV2 resets all changes to the "v2" field.

func (*CasbinPolicyMutation) ResetV3

func (m *CasbinPolicyMutation) ResetV3()

ResetV3 resets all changes to the "v3" field.

func (*CasbinPolicyMutation) ResetV4

func (m *CasbinPolicyMutation) ResetV4()

ResetV4 resets all changes to the "v4" field.

func (*CasbinPolicyMutation) ResetV5

func (m *CasbinPolicyMutation) ResetV5()

ResetV5 resets all changes to the "v5" field.

func (*CasbinPolicyMutation) SetField

func (m *CasbinPolicyMutation) 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 (*CasbinPolicyMutation) SetOp

func (m *CasbinPolicyMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*CasbinPolicyMutation) SetPtype

func (m *CasbinPolicyMutation) SetPtype(s string)

SetPtype sets the "ptype" field.

func (*CasbinPolicyMutation) SetV0

func (m *CasbinPolicyMutation) SetV0(s string)

SetV0 sets the "v0" field.

func (*CasbinPolicyMutation) SetV1

func (m *CasbinPolicyMutation) SetV1(s string)

SetV1 sets the "v1" field.

func (*CasbinPolicyMutation) SetV2

func (m *CasbinPolicyMutation) SetV2(s string)

SetV2 sets the "v2" field.

func (*CasbinPolicyMutation) SetV3

func (m *CasbinPolicyMutation) SetV3(s string)

SetV3 sets the "v3" field.

func (*CasbinPolicyMutation) SetV4

func (m *CasbinPolicyMutation) SetV4(s string)

SetV4 sets the "v4" field.

func (*CasbinPolicyMutation) SetV5

func (m *CasbinPolicyMutation) SetV5(s string)

SetV5 sets the "v5" field.

func (CasbinPolicyMutation) Tx

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

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

func (*CasbinPolicyMutation) Type

func (m *CasbinPolicyMutation) Type() string

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

func (*CasbinPolicyMutation) V0

func (m *CasbinPolicyMutation) V0() (r string, exists bool)

V0 returns the value of the "v0" field in the mutation.

func (*CasbinPolicyMutation) V0Cleared

func (m *CasbinPolicyMutation) V0Cleared() bool

V0Cleared returns if the "v0" field was cleared in this mutation.

func (*CasbinPolicyMutation) V1

func (m *CasbinPolicyMutation) V1() (r string, exists bool)

V1 returns the value of the "v1" field in the mutation.

func (*CasbinPolicyMutation) V1Cleared

func (m *CasbinPolicyMutation) V1Cleared() bool

V1Cleared returns if the "v1" field was cleared in this mutation.

func (*CasbinPolicyMutation) V2

func (m *CasbinPolicyMutation) V2() (r string, exists bool)

V2 returns the value of the "v2" field in the mutation.

func (*CasbinPolicyMutation) V2Cleared

func (m *CasbinPolicyMutation) V2Cleared() bool

V2Cleared returns if the "v2" field was cleared in this mutation.

func (*CasbinPolicyMutation) V3

func (m *CasbinPolicyMutation) V3() (r string, exists bool)

V3 returns the value of the "v3" field in the mutation.

func (*CasbinPolicyMutation) V3Cleared

func (m *CasbinPolicyMutation) V3Cleared() bool

V3Cleared returns if the "v3" field was cleared in this mutation.

func (*CasbinPolicyMutation) V4

func (m *CasbinPolicyMutation) V4() (r string, exists bool)

V4 returns the value of the "v4" field in the mutation.

func (*CasbinPolicyMutation) V4Cleared

func (m *CasbinPolicyMutation) V4Cleared() bool

V4Cleared returns if the "v4" field was cleared in this mutation.

func (*CasbinPolicyMutation) V5

func (m *CasbinPolicyMutation) V5() (r string, exists bool)

V5 returns the value of the "v5" field in the mutation.

func (*CasbinPolicyMutation) V5Cleared

func (m *CasbinPolicyMutation) V5Cleared() bool

V5Cleared returns if the "v5" field was cleared in this mutation.

func (*CasbinPolicyMutation) Where

Where appends a list predicates to the CasbinPolicyMutation builder.

func (*CasbinPolicyMutation) WhereP

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

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

type CasbinPolicyQuery

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

CasbinPolicyQuery is the builder for querying CasbinPolicy entities.

func (*CasbinPolicyQuery) Aggregate

func (_q *CasbinPolicyQuery) Aggregate(fns ...AggregateFunc) *CasbinPolicySelect

Aggregate returns a CasbinPolicySelect configured with the given aggregations.

func (*CasbinPolicyQuery) All

func (_q *CasbinPolicyQuery) All(ctx context.Context) ([]*CasbinPolicy, error)

All executes the query and returns a list of CasbinPolicies.

func (*CasbinPolicyQuery) AllX

func (_q *CasbinPolicyQuery) AllX(ctx context.Context) []*CasbinPolicy

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

func (*CasbinPolicyQuery) Clone

func (_q *CasbinPolicyQuery) Clone() *CasbinPolicyQuery

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

func (*CasbinPolicyQuery) Count

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

Count returns the count of the given query.

func (*CasbinPolicyQuery) CountX

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

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

func (*CasbinPolicyQuery) Exist

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

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

func (*CasbinPolicyQuery) ExistX

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

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

func (*CasbinPolicyQuery) First

func (_q *CasbinPolicyQuery) First(ctx context.Context) (*CasbinPolicy, error)

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

func (*CasbinPolicyQuery) FirstID

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

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

func (*CasbinPolicyQuery) FirstIDX

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

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

func (*CasbinPolicyQuery) FirstX

func (_q *CasbinPolicyQuery) FirstX(ctx context.Context) *CasbinPolicy

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

func (*CasbinPolicyQuery) GroupBy

func (_q *CasbinPolicyQuery) GroupBy(field string, fields ...string) *CasbinPolicyGroupBy

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

client.CasbinPolicy.Query().
	GroupBy(casbinpolicy.FieldPtype).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*CasbinPolicyQuery) IDs

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

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

func (*CasbinPolicyQuery) IDsX

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

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

func (*CasbinPolicyQuery) Limit

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

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

func (*CasbinPolicyQuery) Offset

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

Offset to start from.

func (*CasbinPolicyQuery) Only

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

func (*CasbinPolicyQuery) OnlyID

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

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

func (*CasbinPolicyQuery) OnlyIDX

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

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

func (*CasbinPolicyQuery) OnlyX

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

func (*CasbinPolicyQuery) Order

Order specifies how the records should be ordered.

func (*CasbinPolicyQuery) Select

func (_q *CasbinPolicyQuery) Select(fields ...string) *CasbinPolicySelect

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

client.CasbinPolicy.Query().
	Select(casbinpolicy.FieldPtype).
	Scan(ctx, &v)

func (*CasbinPolicyQuery) Unique

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

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

Where adds a new predicate for the CasbinPolicyQuery builder.

type CasbinPolicySelect

type CasbinPolicySelect struct {
	*CasbinPolicyQuery
	// contains filtered or unexported fields
}

CasbinPolicySelect is the builder for selecting fields of CasbinPolicy entities.

func (*CasbinPolicySelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*CasbinPolicySelect) Bool

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

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

func (*CasbinPolicySelect) BoolX

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

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

func (*CasbinPolicySelect) Bools

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

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

func (*CasbinPolicySelect) BoolsX

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

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

func (*CasbinPolicySelect) Float64

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

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

func (*CasbinPolicySelect) Float64X

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

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

func (*CasbinPolicySelect) Float64s

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

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

func (*CasbinPolicySelect) Float64sX

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

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

func (*CasbinPolicySelect) Int

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

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

func (*CasbinPolicySelect) IntX

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

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

func (*CasbinPolicySelect) Ints

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

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

func (*CasbinPolicySelect) IntsX

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

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

func (*CasbinPolicySelect) Scan

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

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

func (*CasbinPolicySelect) ScanX

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

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

func (*CasbinPolicySelect) String

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

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

func (*CasbinPolicySelect) StringX

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

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

func (*CasbinPolicySelect) Strings

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

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

func (*CasbinPolicySelect) StringsX

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

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

type CasbinPolicyUpdate

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

CasbinPolicyUpdate is the builder for updating CasbinPolicy entities.

func (*CasbinPolicyUpdate) ClearV0

func (_u *CasbinPolicyUpdate) ClearV0() *CasbinPolicyUpdate

ClearV0 clears the value of the "v0" field.

func (*CasbinPolicyUpdate) ClearV1

func (_u *CasbinPolicyUpdate) ClearV1() *CasbinPolicyUpdate

ClearV1 clears the value of the "v1" field.

func (*CasbinPolicyUpdate) ClearV2

func (_u *CasbinPolicyUpdate) ClearV2() *CasbinPolicyUpdate

ClearV2 clears the value of the "v2" field.

func (*CasbinPolicyUpdate) ClearV3

func (_u *CasbinPolicyUpdate) ClearV3() *CasbinPolicyUpdate

ClearV3 clears the value of the "v3" field.

func (*CasbinPolicyUpdate) ClearV4

func (_u *CasbinPolicyUpdate) ClearV4() *CasbinPolicyUpdate

ClearV4 clears the value of the "v4" field.

func (*CasbinPolicyUpdate) ClearV5

func (_u *CasbinPolicyUpdate) ClearV5() *CasbinPolicyUpdate

ClearV5 clears the value of the "v5" field.

func (*CasbinPolicyUpdate) Exec

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

Exec executes the query.

func (*CasbinPolicyUpdate) ExecX

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

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

func (*CasbinPolicyUpdate) Mutation

func (_u *CasbinPolicyUpdate) Mutation() *CasbinPolicyMutation

Mutation returns the CasbinPolicyMutation object of the builder.

func (*CasbinPolicyUpdate) Save

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

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

func (*CasbinPolicyUpdate) SaveX

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

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

func (*CasbinPolicyUpdate) SetNillablePtype

func (_u *CasbinPolicyUpdate) SetNillablePtype(v *string) *CasbinPolicyUpdate

SetNillablePtype sets the "ptype" field if the given value is not nil.

func (*CasbinPolicyUpdate) SetNillableV0

func (_u *CasbinPolicyUpdate) SetNillableV0(v *string) *CasbinPolicyUpdate

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*CasbinPolicyUpdate) SetNillableV1

func (_u *CasbinPolicyUpdate) SetNillableV1(v *string) *CasbinPolicyUpdate

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*CasbinPolicyUpdate) SetNillableV2

func (_u *CasbinPolicyUpdate) SetNillableV2(v *string) *CasbinPolicyUpdate

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*CasbinPolicyUpdate) SetNillableV3

func (_u *CasbinPolicyUpdate) SetNillableV3(v *string) *CasbinPolicyUpdate

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*CasbinPolicyUpdate) SetNillableV4

func (_u *CasbinPolicyUpdate) SetNillableV4(v *string) *CasbinPolicyUpdate

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*CasbinPolicyUpdate) SetNillableV5

func (_u *CasbinPolicyUpdate) SetNillableV5(v *string) *CasbinPolicyUpdate

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*CasbinPolicyUpdate) SetPtype

func (_u *CasbinPolicyUpdate) SetPtype(v string) *CasbinPolicyUpdate

SetPtype sets the "ptype" field.

func (*CasbinPolicyUpdate) SetV0

SetV0 sets the "v0" field.

func (*CasbinPolicyUpdate) SetV1

SetV1 sets the "v1" field.

func (*CasbinPolicyUpdate) SetV2

SetV2 sets the "v2" field.

func (*CasbinPolicyUpdate) SetV3

SetV3 sets the "v3" field.

func (*CasbinPolicyUpdate) SetV4

SetV4 sets the "v4" field.

func (*CasbinPolicyUpdate) SetV5

SetV5 sets the "v5" field.

func (*CasbinPolicyUpdate) Where

Where appends a list predicates to the CasbinPolicyUpdate builder.

type CasbinPolicyUpdateOne

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

CasbinPolicyUpdateOne is the builder for updating a single CasbinPolicy entity.

func (*CasbinPolicyUpdateOne) ClearV0

ClearV0 clears the value of the "v0" field.

func (*CasbinPolicyUpdateOne) ClearV1

ClearV1 clears the value of the "v1" field.

func (*CasbinPolicyUpdateOne) ClearV2

ClearV2 clears the value of the "v2" field.

func (*CasbinPolicyUpdateOne) ClearV3

ClearV3 clears the value of the "v3" field.

func (*CasbinPolicyUpdateOne) ClearV4

ClearV4 clears the value of the "v4" field.

func (*CasbinPolicyUpdateOne) ClearV5

ClearV5 clears the value of the "v5" field.

func (*CasbinPolicyUpdateOne) Exec

Exec executes the query on the entity.

func (*CasbinPolicyUpdateOne) ExecX

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

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

func (*CasbinPolicyUpdateOne) Mutation

Mutation returns the CasbinPolicyMutation object of the builder.

func (*CasbinPolicyUpdateOne) Save

Save executes the query and returns the updated CasbinPolicy entity.

func (*CasbinPolicyUpdateOne) SaveX

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

func (*CasbinPolicyUpdateOne) Select

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

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

func (*CasbinPolicyUpdateOne) SetNillablePtype

func (_u *CasbinPolicyUpdateOne) SetNillablePtype(v *string) *CasbinPolicyUpdateOne

SetNillablePtype sets the "ptype" field if the given value is not nil.

func (*CasbinPolicyUpdateOne) SetNillableV0

func (_u *CasbinPolicyUpdateOne) SetNillableV0(v *string) *CasbinPolicyUpdateOne

SetNillableV0 sets the "v0" field if the given value is not nil.

func (*CasbinPolicyUpdateOne) SetNillableV1

func (_u *CasbinPolicyUpdateOne) SetNillableV1(v *string) *CasbinPolicyUpdateOne

SetNillableV1 sets the "v1" field if the given value is not nil.

func (*CasbinPolicyUpdateOne) SetNillableV2

func (_u *CasbinPolicyUpdateOne) SetNillableV2(v *string) *CasbinPolicyUpdateOne

SetNillableV2 sets the "v2" field if the given value is not nil.

func (*CasbinPolicyUpdateOne) SetNillableV3

func (_u *CasbinPolicyUpdateOne) SetNillableV3(v *string) *CasbinPolicyUpdateOne

SetNillableV3 sets the "v3" field if the given value is not nil.

func (*CasbinPolicyUpdateOne) SetNillableV4

func (_u *CasbinPolicyUpdateOne) SetNillableV4(v *string) *CasbinPolicyUpdateOne

SetNillableV4 sets the "v4" field if the given value is not nil.

func (*CasbinPolicyUpdateOne) SetNillableV5

func (_u *CasbinPolicyUpdateOne) SetNillableV5(v *string) *CasbinPolicyUpdateOne

SetNillableV5 sets the "v5" field if the given value is not nil.

func (*CasbinPolicyUpdateOne) SetPtype

SetPtype sets the "ptype" field.

func (*CasbinPolicyUpdateOne) SetV0

SetV0 sets the "v0" field.

func (*CasbinPolicyUpdateOne) SetV1

SetV1 sets the "v1" field.

func (*CasbinPolicyUpdateOne) SetV2

SetV2 sets the "v2" field.

func (*CasbinPolicyUpdateOne) SetV3

SetV3 sets the "v3" field.

func (*CasbinPolicyUpdateOne) SetV4

SetV4 sets the "v4" field.

func (*CasbinPolicyUpdateOne) SetV5

SetV5 sets the "v5" field.

func (*CasbinPolicyUpdateOne) Where

Where appends a list predicates to the CasbinPolicyUpdate builder.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// CasbinPolicy is the client for interacting with the CasbinPolicy builders.
	CasbinPolicy *CasbinPolicyClient
	// Media is the client for interacting with the Media builders.
	Media *MediaClient
	// MediaFormat is the client for interacting with the MediaFormat builders.
	MediaFormat *MediaFormatClient
	// 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().
	CasbinPolicy.
	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 ColumnInfo

type ColumnInfo struct {
	Name     string
	Type     string
	Nullable bool
	Default  string
}

ColumnInfo 列信息

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 ConnectionPool

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

ConnectionPool 连接池配置

func NewConnectionPool

func NewConnectionPool() *ConnectionPool

NewConnectionPool 创建连接池配置

func (*ConnectionPool) Apply

func (p *ConnectionPool) Apply(db *sql.DB)

Apply 应用到数据库连接

func (*ConnectionPool) WithConnMaxIdleTime

func (p *ConnectionPool) WithConnMaxIdleTime(d time.Duration) *ConnectionPool

WithConnMaxIdleTime 设置连接最大空闲时间

func (*ConnectionPool) WithConnMaxLifetime

func (p *ConnectionPool) WithConnMaxLifetime(d time.Duration) *ConnectionPool

WithConnMaxLifetime 设置连接最大生命周期

func (*ConnectionPool) WithMaxIdleConns

func (p *ConnectionPool) WithMaxIdleConns(n int) *ConnectionPool

WithMaxIdleConns 设置最大空闲连接数

func (*ConnectionPool) WithMaxOpenConns

func (p *ConnectionPool) WithMaxOpenConns(n int) *ConnectionPool

WithMaxOpenConns 设置最大打开连接数

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 IndexAnalyzer

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

IndexAnalyzer 索引分析器

func NewIndexAnalyzer

func NewIndexAnalyzer() *IndexAnalyzer

NewIndexAnalyzer 创建索引分析器

func (*IndexAnalyzer) AddTable

func (a *IndexAnalyzer) AddTable(table TableInfo)

AddTable 添加表

func (*IndexAnalyzer) Analyze

func (a *IndexAnalyzer) Analyze(query string) []string

Analyze 分析索引使用情况

func (*IndexAnalyzer) GetMissingIndexes

func (a *IndexAnalyzer) GetMissingIndexes() []string

GetMissingIndexes 获取缺失的索引

type IndexInfo

type IndexInfo struct {
	Name    string
	Columns []string
	Unique  bool
	Type    string
}

IndexInfo 索引信息

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 Media

type Media struct {

	// ID of the ent.
	// 唯一标识
	ID uuid.UUID `json:"id,omitempty"`
	// 租户ID
	TenantID string `json:"tenant_id,omitempty"`
	// 创建者ID
	CreatedByID uuid.UUID `json:"created_by_id,omitempty"`
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// 更新者ID
	UpdatedByID uuid.UUID `json:"updated_by_id,omitempty"`
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 删除者ID
	DeletedByID uuid.UUID `json:"deleted_by_id,omitempty"`
	// 删除时间
	DeletedAt time.Time `json:"deleted_at,omitempty"`
	// 发布时间
	PublishedAt time.Time `json:"published_at,omitempty"`
	// 归档时间
	ArchivedAt time.Time `json:"archived_at,omitempty"`
	// Original filename
	Name string `json:"name,omitempty"`
	// Alternative text for accessibility
	AlternativeText *string `json:"alternative_text,omitempty"`
	// User-provided caption
	Caption *string `json:"caption,omitempty"`
	// Pixel width
	Width *int `json:"width,omitempty"`
	// Pixel height
	Height *int `json:"height,omitempty"`
	// Content hash used in filenames
	Hash *string `json:"hash,omitempty"`
	// File extension including dot
	Ext *string `json:"ext,omitempty"`
	// MIME type
	Mime *string `json:"mime,omitempty"`
	// File size in MB
	Size *float64 `json:"size,omitempty"`
	// Accessible URL or path
	URL string `json:"url,omitempty"`
	// Preview URL generated by provider
	PreviewURL *string `json:"preview_url,omitempty"`
	// Storage provider key
	Provider *string `json:"provider,omitempty"`
	// Provider-specific metadata
	ProviderMetadata map[string]interface{} `json:"provider_metadata,omitempty"`
	// Folder path within provider
	FolderPath *string `json:"folder_path,omitempty"`
	// Locale if i18n is enabled
	Locale *string `json:"locale,omitempty"`
	// Whether generated URLs are signed
	IsURLSigned *bool `json:"is_url_signed,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MediaQuery when eager-loading is set.
	Edges MediaEdges `json:"edges"`
	// contains filtered or unexported fields
}

Media is the model entity for the Media schema.

func (*Media) QueryFormats

func (_m *Media) QueryFormats() *MediaFormatQuery

QueryFormats queries the "formats" edge of the Media entity.

func (*Media) String

func (_m *Media) String() string

String implements the fmt.Stringer.

func (*Media) Unwrap

func (_m *Media) Unwrap() *Media

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

func (_m *Media) Update() *MediaUpdateOne

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

func (*Media) Value

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

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

type MediaClient

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

MediaClient is a client for the Media schema.

func NewMediaClient

func NewMediaClient(c config) *MediaClient

NewMediaClient returns a client for the Media from the given config.

func (*MediaClient) Create

func (c *MediaClient) Create() *MediaCreate

Create returns a builder for creating a Media entity.

func (*MediaClient) CreateBulk

func (c *MediaClient) CreateBulk(builders ...*MediaCreate) *MediaCreateBulk

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

func (*MediaClient) Delete

func (c *MediaClient) Delete() *MediaDelete

Delete returns a delete builder for Media.

func (*MediaClient) DeleteOne

func (c *MediaClient) DeleteOne(_m *Media) *MediaDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*MediaClient) DeleteOneID

func (c *MediaClient) DeleteOneID(id uuid.UUID) *MediaDeleteOne

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

func (*MediaClient) Get

func (c *MediaClient) Get(ctx context.Context, id uuid.UUID) (*Media, error)

Get returns a Media entity by its id.

func (*MediaClient) GetX

func (c *MediaClient) GetX(ctx context.Context, id uuid.UUID) *Media

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

func (*MediaClient) Hooks

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

Hooks returns the client hooks.

func (*MediaClient) Intercept

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

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

func (*MediaClient) Interceptors

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

Interceptors returns the client interceptors.

func (*MediaClient) MapCreateBulk

func (c *MediaClient) MapCreateBulk(slice any, setFunc func(*MediaCreate, int)) *MediaCreateBulk

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 (*MediaClient) Query

func (c *MediaClient) Query() *MediaQuery

Query returns a query builder for Media.

func (*MediaClient) QueryFormats

func (c *MediaClient) QueryFormats(_m *Media) *MediaFormatQuery

QueryFormats queries the formats edge of a Media.

func (*MediaClient) Update

func (c *MediaClient) Update() *MediaUpdate

Update returns an update builder for Media.

func (*MediaClient) UpdateOne

func (c *MediaClient) UpdateOne(_m *Media) *MediaUpdateOne

UpdateOne returns an update builder for the given entity.

func (*MediaClient) UpdateOneID

func (c *MediaClient) UpdateOneID(id uuid.UUID) *MediaUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MediaClient) Use

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

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

type MediaCreate

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

MediaCreate is the builder for creating a Media entity.

func (*MediaCreate) AddFormatIDs

func (_c *MediaCreate) AddFormatIDs(ids ...uuid.UUID) *MediaCreate

AddFormatIDs adds the "formats" edge to the MediaFormat entity by IDs.

func (*MediaCreate) AddFormats

func (_c *MediaCreate) AddFormats(v ...*MediaFormat) *MediaCreate

AddFormats adds the "formats" edges to the MediaFormat entity.

func (*MediaCreate) Exec

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

Exec executes the query.

func (*MediaCreate) ExecX

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

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

func (*MediaCreate) Mutation

func (_c *MediaCreate) Mutation() *MediaMutation

Mutation returns the MediaMutation object of the builder.

func (*MediaCreate) Save

func (_c *MediaCreate) Save(ctx context.Context) (*Media, error)

Save creates the Media in the database.

func (*MediaCreate) SaveX

func (_c *MediaCreate) SaveX(ctx context.Context) *Media

SaveX calls Save and panics if Save returns an error.

func (*MediaCreate) SetAlternativeText

func (_c *MediaCreate) SetAlternativeText(v string) *MediaCreate

SetAlternativeText sets the "alternative_text" field.

func (*MediaCreate) SetArchivedAt

func (_c *MediaCreate) SetArchivedAt(v time.Time) *MediaCreate

SetArchivedAt sets the "archived_at" field.

func (*MediaCreate) SetCaption

func (_c *MediaCreate) SetCaption(v string) *MediaCreate

SetCaption sets the "caption" field.

func (*MediaCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*MediaCreate) SetCreatedByID

func (_c *MediaCreate) SetCreatedByID(v uuid.UUID) *MediaCreate

SetCreatedByID sets the "created_by_id" field.

func (*MediaCreate) SetDeletedAt

func (_c *MediaCreate) SetDeletedAt(v time.Time) *MediaCreate

SetDeletedAt sets the "deleted_at" field.

func (*MediaCreate) SetDeletedByID

func (_c *MediaCreate) SetDeletedByID(v uuid.UUID) *MediaCreate

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaCreate) SetExt

func (_c *MediaCreate) SetExt(v string) *MediaCreate

SetExt sets the "ext" field.

func (*MediaCreate) SetFolderPath

func (_c *MediaCreate) SetFolderPath(v string) *MediaCreate

SetFolderPath sets the "folder_path" field.

func (*MediaCreate) SetHash

func (_c *MediaCreate) SetHash(v string) *MediaCreate

SetHash sets the "hash" field.

func (*MediaCreate) SetHeight

func (_c *MediaCreate) SetHeight(v int) *MediaCreate

SetHeight sets the "height" field.

func (*MediaCreate) SetID

func (_c *MediaCreate) SetID(v uuid.UUID) *MediaCreate

SetID sets the "id" field.

func (*MediaCreate) SetIsURLSigned

func (_c *MediaCreate) SetIsURLSigned(v bool) *MediaCreate

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaCreate) SetLocale

func (_c *MediaCreate) SetLocale(v string) *MediaCreate

SetLocale sets the "locale" field.

func (*MediaCreate) SetMime

func (_c *MediaCreate) SetMime(v string) *MediaCreate

SetMime sets the "mime" field.

func (*MediaCreate) SetName

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

SetName sets the "name" field.

func (*MediaCreate) SetNillableAlternativeText

func (_c *MediaCreate) SetNillableAlternativeText(v *string) *MediaCreate

SetNillableAlternativeText sets the "alternative_text" field if the given value is not nil.

func (*MediaCreate) SetNillableArchivedAt

func (_c *MediaCreate) SetNillableArchivedAt(v *time.Time) *MediaCreate

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*MediaCreate) SetNillableCaption

func (_c *MediaCreate) SetNillableCaption(v *string) *MediaCreate

SetNillableCaption sets the "caption" field if the given value is not nil.

func (*MediaCreate) SetNillableCreatedAt

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

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

func (*MediaCreate) SetNillableCreatedByID

func (_c *MediaCreate) SetNillableCreatedByID(v *uuid.UUID) *MediaCreate

SetNillableCreatedByID sets the "created_by_id" field if the given value is not nil.

func (*MediaCreate) SetNillableDeletedAt

func (_c *MediaCreate) SetNillableDeletedAt(v *time.Time) *MediaCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*MediaCreate) SetNillableDeletedByID

func (_c *MediaCreate) SetNillableDeletedByID(v *uuid.UUID) *MediaCreate

SetNillableDeletedByID sets the "deleted_by_id" field if the given value is not nil.

func (*MediaCreate) SetNillableExt

func (_c *MediaCreate) SetNillableExt(v *string) *MediaCreate

SetNillableExt sets the "ext" field if the given value is not nil.

func (*MediaCreate) SetNillableFolderPath

func (_c *MediaCreate) SetNillableFolderPath(v *string) *MediaCreate

SetNillableFolderPath sets the "folder_path" field if the given value is not nil.

func (*MediaCreate) SetNillableHash

func (_c *MediaCreate) SetNillableHash(v *string) *MediaCreate

SetNillableHash sets the "hash" field if the given value is not nil.

func (*MediaCreate) SetNillableHeight

func (_c *MediaCreate) SetNillableHeight(v *int) *MediaCreate

SetNillableHeight sets the "height" field if the given value is not nil.

func (*MediaCreate) SetNillableID

func (_c *MediaCreate) SetNillableID(v *uuid.UUID) *MediaCreate

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

func (*MediaCreate) SetNillableIsURLSigned

func (_c *MediaCreate) SetNillableIsURLSigned(v *bool) *MediaCreate

SetNillableIsURLSigned sets the "is_url_signed" field if the given value is not nil.

func (*MediaCreate) SetNillableLocale

func (_c *MediaCreate) SetNillableLocale(v *string) *MediaCreate

SetNillableLocale sets the "locale" field if the given value is not nil.

func (*MediaCreate) SetNillableMime

func (_c *MediaCreate) SetNillableMime(v *string) *MediaCreate

SetNillableMime sets the "mime" field if the given value is not nil.

func (*MediaCreate) SetNillablePreviewURL

func (_c *MediaCreate) SetNillablePreviewURL(v *string) *MediaCreate

SetNillablePreviewURL sets the "preview_url" field if the given value is not nil.

func (*MediaCreate) SetNillableProvider

func (_c *MediaCreate) SetNillableProvider(v *string) *MediaCreate

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*MediaCreate) SetNillablePublishedAt

func (_c *MediaCreate) SetNillablePublishedAt(v *time.Time) *MediaCreate

SetNillablePublishedAt sets the "published_at" field if the given value is not nil.

func (*MediaCreate) SetNillableSize

func (_c *MediaCreate) SetNillableSize(v *float64) *MediaCreate

SetNillableSize sets the "size" field if the given value is not nil.

func (*MediaCreate) SetNillableTenantID

func (_c *MediaCreate) SetNillableTenantID(v *string) *MediaCreate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*MediaCreate) SetNillableUpdatedAt

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

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

func (*MediaCreate) SetNillableUpdatedByID

func (_c *MediaCreate) SetNillableUpdatedByID(v *uuid.UUID) *MediaCreate

SetNillableUpdatedByID sets the "updated_by_id" field if the given value is not nil.

func (*MediaCreate) SetNillableWidth

func (_c *MediaCreate) SetNillableWidth(v *int) *MediaCreate

SetNillableWidth sets the "width" field if the given value is not nil.

func (*MediaCreate) SetPreviewURL

func (_c *MediaCreate) SetPreviewURL(v string) *MediaCreate

SetPreviewURL sets the "preview_url" field.

func (*MediaCreate) SetProvider

func (_c *MediaCreate) SetProvider(v string) *MediaCreate

SetProvider sets the "provider" field.

func (*MediaCreate) SetProviderMetadata

func (_c *MediaCreate) SetProviderMetadata(v map[string]interface{}) *MediaCreate

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaCreate) SetPublishedAt

func (_c *MediaCreate) SetPublishedAt(v time.Time) *MediaCreate

SetPublishedAt sets the "published_at" field.

func (*MediaCreate) SetSize

func (_c *MediaCreate) SetSize(v float64) *MediaCreate

SetSize sets the "size" field.

func (*MediaCreate) SetTenantID

func (_c *MediaCreate) SetTenantID(v string) *MediaCreate

SetTenantID sets the "tenant_id" field.

func (*MediaCreate) SetURL

func (_c *MediaCreate) SetURL(v string) *MediaCreate

SetURL sets the "url" field.

func (*MediaCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaCreate) SetUpdatedByID

func (_c *MediaCreate) SetUpdatedByID(v uuid.UUID) *MediaCreate

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaCreate) SetWidth

func (_c *MediaCreate) SetWidth(v int) *MediaCreate

SetWidth sets the "width" field.

type MediaCreateBulk

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

MediaCreateBulk is the builder for creating many Media entities in bulk.

func (*MediaCreateBulk) Exec

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

Exec executes the query.

func (*MediaCreateBulk) ExecX

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

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

func (*MediaCreateBulk) Save

func (_c *MediaCreateBulk) Save(ctx context.Context) ([]*Media, error)

Save creates the Media entities in the database.

func (*MediaCreateBulk) SaveX

func (_c *MediaCreateBulk) SaveX(ctx context.Context) []*Media

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

type MediaDelete

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

MediaDelete is the builder for deleting a Media entity.

func (*MediaDelete) Exec

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

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

func (*MediaDelete) ExecX

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

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

func (*MediaDelete) Where

func (_d *MediaDelete) Where(ps ...predicate.Media) *MediaDelete

Where appends a list predicates to the MediaDelete builder.

type MediaDeleteOne

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

MediaDeleteOne is the builder for deleting a single Media entity.

func (*MediaDeleteOne) Exec

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

Exec executes the deletion query.

func (*MediaDeleteOne) ExecX

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

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

func (*MediaDeleteOne) Where

func (_d *MediaDeleteOne) Where(ps ...predicate.Media) *MediaDeleteOne

Where appends a list predicates to the MediaDelete builder.

type MediaEdges

type MediaEdges struct {
	// Formats holds the value of the formats edge.
	Formats []*MediaFormat `json:"formats,omitempty"`
	// contains filtered or unexported fields
}

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

func (MediaEdges) FormatsOrErr

func (e MediaEdges) FormatsOrErr() ([]*MediaFormat, error)

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

type MediaFormat

type MediaFormat struct {

	// ID of the ent.
	// 唯一标识
	ID uuid.UUID `json:"id,omitempty"`
	// 租户ID
	TenantID string `json:"tenant_id,omitempty"`
	// 创建者ID
	CreatedByID uuid.UUID `json:"created_by_id,omitempty"`
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// 更新者ID
	UpdatedByID uuid.UUID `json:"updated_by_id,omitempty"`
	// 更新时间
	UpdatedAt time.Time `json:"updated_at,omitempty"`
	// 删除者ID
	DeletedByID uuid.UUID `json:"deleted_by_id,omitempty"`
	// 删除时间
	DeletedAt time.Time `json:"deleted_at,omitempty"`
	// 发布时间
	PublishedAt time.Time `json:"published_at,omitempty"`
	// 归档时间
	ArchivedAt time.Time `json:"archived_at,omitempty"`
	// Format key such as thumbnail or small
	Name string `json:"name,omitempty"`
	// File extension including dot
	Ext *string `json:"ext,omitempty"`
	// Accessible URL or path
	URL string `json:"url,omitempty"`
	// Content hash used in filenames
	Hash *string `json:"hash,omitempty"`
	// MIME type
	Mime *string `json:"mime,omitempty"`
	// File size in MB
	Size *float64 `json:"size,omitempty"`
	// Exact file size in bytes
	SizeInBytes *int64 `json:"size_in_bytes,omitempty"`
	// Pixel width
	Width *int `json:"width,omitempty"`
	// Pixel height
	Height *int `json:"height,omitempty"`
	// Provider-specific metadata
	ProviderMetadata map[string]interface{} `json:"provider_metadata,omitempty"`
	// Provider-specific path
	Path *string `json:"path,omitempty"`
	// Whether generated URLs are signed
	IsURLSigned *bool `json:"is_url_signed,omitempty"`
	// Parent media ID
	MediaID uuid.UUID `json:"media_id,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the MediaFormatQuery when eager-loading is set.
	Edges MediaFormatEdges `json:"edges"`
	// contains filtered or unexported fields
}

MediaFormat is the model entity for the MediaFormat schema.

func (*MediaFormat) QueryMedia

func (_m *MediaFormat) QueryMedia() *MediaQuery

QueryMedia queries the "media" edge of the MediaFormat entity.

func (*MediaFormat) String

func (_m *MediaFormat) String() string

String implements the fmt.Stringer.

func (*MediaFormat) Unwrap

func (_m *MediaFormat) Unwrap() *MediaFormat

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

func (_m *MediaFormat) Update() *MediaFormatUpdateOne

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

func (*MediaFormat) Value

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

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

type MediaFormatClient

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

MediaFormatClient is a client for the MediaFormat schema.

func NewMediaFormatClient

func NewMediaFormatClient(c config) *MediaFormatClient

NewMediaFormatClient returns a client for the MediaFormat from the given config.

func (*MediaFormatClient) Create

func (c *MediaFormatClient) Create() *MediaFormatCreate

Create returns a builder for creating a MediaFormat entity.

func (*MediaFormatClient) CreateBulk

func (c *MediaFormatClient) CreateBulk(builders ...*MediaFormatCreate) *MediaFormatCreateBulk

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

func (*MediaFormatClient) Delete

func (c *MediaFormatClient) Delete() *MediaFormatDelete

Delete returns a delete builder for MediaFormat.

func (*MediaFormatClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*MediaFormatClient) DeleteOneID

func (c *MediaFormatClient) DeleteOneID(id uuid.UUID) *MediaFormatDeleteOne

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

func (*MediaFormatClient) Get

Get returns a MediaFormat entity by its id.

func (*MediaFormatClient) GetX

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

func (*MediaFormatClient) Hooks

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

Hooks returns the client hooks.

func (*MediaFormatClient) Intercept

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

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

func (*MediaFormatClient) Interceptors

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

Interceptors returns the client interceptors.

func (*MediaFormatClient) MapCreateBulk

func (c *MediaFormatClient) MapCreateBulk(slice any, setFunc func(*MediaFormatCreate, int)) *MediaFormatCreateBulk

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 (*MediaFormatClient) Query

func (c *MediaFormatClient) Query() *MediaFormatQuery

Query returns a query builder for MediaFormat.

func (*MediaFormatClient) QueryMedia

func (c *MediaFormatClient) QueryMedia(_m *MediaFormat) *MediaQuery

QueryMedia queries the media edge of a MediaFormat.

func (*MediaFormatClient) Update

func (c *MediaFormatClient) Update() *MediaFormatUpdate

Update returns an update builder for MediaFormat.

func (*MediaFormatClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*MediaFormatClient) UpdateOneID

func (c *MediaFormatClient) UpdateOneID(id uuid.UUID) *MediaFormatUpdateOne

UpdateOneID returns an update builder for the given id.

func (*MediaFormatClient) Use

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

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

type MediaFormatCreate

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

MediaFormatCreate is the builder for creating a MediaFormat entity.

func (*MediaFormatCreate) Exec

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

Exec executes the query.

func (*MediaFormatCreate) ExecX

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

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

func (*MediaFormatCreate) Mutation

func (_c *MediaFormatCreate) Mutation() *MediaFormatMutation

Mutation returns the MediaFormatMutation object of the builder.

func (*MediaFormatCreate) Save

Save creates the MediaFormat in the database.

func (*MediaFormatCreate) SaveX

func (_c *MediaFormatCreate) SaveX(ctx context.Context) *MediaFormat

SaveX calls Save and panics if Save returns an error.

func (*MediaFormatCreate) SetArchivedAt

func (_c *MediaFormatCreate) SetArchivedAt(v time.Time) *MediaFormatCreate

SetArchivedAt sets the "archived_at" field.

func (*MediaFormatCreate) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*MediaFormatCreate) SetCreatedByID

func (_c *MediaFormatCreate) SetCreatedByID(v uuid.UUID) *MediaFormatCreate

SetCreatedByID sets the "created_by_id" field.

func (*MediaFormatCreate) SetDeletedAt

func (_c *MediaFormatCreate) SetDeletedAt(v time.Time) *MediaFormatCreate

SetDeletedAt sets the "deleted_at" field.

func (*MediaFormatCreate) SetDeletedByID

func (_c *MediaFormatCreate) SetDeletedByID(v uuid.UUID) *MediaFormatCreate

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaFormatCreate) SetExt

SetExt sets the "ext" field.

func (*MediaFormatCreate) SetHash

func (_c *MediaFormatCreate) SetHash(v string) *MediaFormatCreate

SetHash sets the "hash" field.

func (*MediaFormatCreate) SetHeight

func (_c *MediaFormatCreate) SetHeight(v int) *MediaFormatCreate

SetHeight sets the "height" field.

func (*MediaFormatCreate) SetID

SetID sets the "id" field.

func (*MediaFormatCreate) SetIsURLSigned

func (_c *MediaFormatCreate) SetIsURLSigned(v bool) *MediaFormatCreate

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaFormatCreate) SetMedia

func (_c *MediaFormatCreate) SetMedia(v *Media) *MediaFormatCreate

SetMedia sets the "media" edge to the Media entity.

func (*MediaFormatCreate) SetMediaID

func (_c *MediaFormatCreate) SetMediaID(v uuid.UUID) *MediaFormatCreate

SetMediaID sets the "media_id" field.

func (*MediaFormatCreate) SetMime

func (_c *MediaFormatCreate) SetMime(v string) *MediaFormatCreate

SetMime sets the "mime" field.

func (*MediaFormatCreate) SetName

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

SetName sets the "name" field.

func (*MediaFormatCreate) SetNillableArchivedAt

func (_c *MediaFormatCreate) SetNillableArchivedAt(v *time.Time) *MediaFormatCreate

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableCreatedAt

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

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

func (*MediaFormatCreate) SetNillableCreatedByID

func (_c *MediaFormatCreate) SetNillableCreatedByID(v *uuid.UUID) *MediaFormatCreate

SetNillableCreatedByID sets the "created_by_id" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableDeletedAt

func (_c *MediaFormatCreate) SetNillableDeletedAt(v *time.Time) *MediaFormatCreate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableDeletedByID

func (_c *MediaFormatCreate) SetNillableDeletedByID(v *uuid.UUID) *MediaFormatCreate

SetNillableDeletedByID sets the "deleted_by_id" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableExt

func (_c *MediaFormatCreate) SetNillableExt(v *string) *MediaFormatCreate

SetNillableExt sets the "ext" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableHash

func (_c *MediaFormatCreate) SetNillableHash(v *string) *MediaFormatCreate

SetNillableHash sets the "hash" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableHeight

func (_c *MediaFormatCreate) SetNillableHeight(v *int) *MediaFormatCreate

SetNillableHeight sets the "height" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableID

func (_c *MediaFormatCreate) SetNillableID(v *uuid.UUID) *MediaFormatCreate

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

func (*MediaFormatCreate) SetNillableIsURLSigned

func (_c *MediaFormatCreate) SetNillableIsURLSigned(v *bool) *MediaFormatCreate

SetNillableIsURLSigned sets the "is_url_signed" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableMediaID

func (_c *MediaFormatCreate) SetNillableMediaID(v *uuid.UUID) *MediaFormatCreate

SetNillableMediaID sets the "media_id" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableMime

func (_c *MediaFormatCreate) SetNillableMime(v *string) *MediaFormatCreate

SetNillableMime sets the "mime" field if the given value is not nil.

func (*MediaFormatCreate) SetNillablePath

func (_c *MediaFormatCreate) SetNillablePath(v *string) *MediaFormatCreate

SetNillablePath sets the "path" field if the given value is not nil.

func (*MediaFormatCreate) SetNillablePublishedAt

func (_c *MediaFormatCreate) SetNillablePublishedAt(v *time.Time) *MediaFormatCreate

SetNillablePublishedAt sets the "published_at" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableSize

func (_c *MediaFormatCreate) SetNillableSize(v *float64) *MediaFormatCreate

SetNillableSize sets the "size" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableSizeInBytes

func (_c *MediaFormatCreate) SetNillableSizeInBytes(v *int64) *MediaFormatCreate

SetNillableSizeInBytes sets the "size_in_bytes" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableTenantID

func (_c *MediaFormatCreate) SetNillableTenantID(v *string) *MediaFormatCreate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableUpdatedAt

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

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

func (*MediaFormatCreate) SetNillableUpdatedByID

func (_c *MediaFormatCreate) SetNillableUpdatedByID(v *uuid.UUID) *MediaFormatCreate

SetNillableUpdatedByID sets the "updated_by_id" field if the given value is not nil.

func (*MediaFormatCreate) SetNillableWidth

func (_c *MediaFormatCreate) SetNillableWidth(v *int) *MediaFormatCreate

SetNillableWidth sets the "width" field if the given value is not nil.

func (*MediaFormatCreate) SetPath

func (_c *MediaFormatCreate) SetPath(v string) *MediaFormatCreate

SetPath sets the "path" field.

func (*MediaFormatCreate) SetProviderMetadata

func (_c *MediaFormatCreate) SetProviderMetadata(v map[string]interface{}) *MediaFormatCreate

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaFormatCreate) SetPublishedAt

func (_c *MediaFormatCreate) SetPublishedAt(v time.Time) *MediaFormatCreate

SetPublishedAt sets the "published_at" field.

func (*MediaFormatCreate) SetSize

SetSize sets the "size" field.

func (*MediaFormatCreate) SetSizeInBytes

func (_c *MediaFormatCreate) SetSizeInBytes(v int64) *MediaFormatCreate

SetSizeInBytes sets the "size_in_bytes" field.

func (*MediaFormatCreate) SetTenantID

func (_c *MediaFormatCreate) SetTenantID(v string) *MediaFormatCreate

SetTenantID sets the "tenant_id" field.

func (*MediaFormatCreate) SetURL

SetURL sets the "url" field.

func (*MediaFormatCreate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaFormatCreate) SetUpdatedByID

func (_c *MediaFormatCreate) SetUpdatedByID(v uuid.UUID) *MediaFormatCreate

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaFormatCreate) SetWidth

func (_c *MediaFormatCreate) SetWidth(v int) *MediaFormatCreate

SetWidth sets the "width" field.

type MediaFormatCreateBulk

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

MediaFormatCreateBulk is the builder for creating many MediaFormat entities in bulk.

func (*MediaFormatCreateBulk) Exec

Exec executes the query.

func (*MediaFormatCreateBulk) ExecX

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

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

func (*MediaFormatCreateBulk) Save

Save creates the MediaFormat entities in the database.

func (*MediaFormatCreateBulk) SaveX

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

type MediaFormatDelete

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

MediaFormatDelete is the builder for deleting a MediaFormat entity.

func (*MediaFormatDelete) Exec

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

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

func (*MediaFormatDelete) ExecX

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

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

func (*MediaFormatDelete) Where

Where appends a list predicates to the MediaFormatDelete builder.

type MediaFormatDeleteOne

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

MediaFormatDeleteOne is the builder for deleting a single MediaFormat entity.

func (*MediaFormatDeleteOne) Exec

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

Exec executes the deletion query.

func (*MediaFormatDeleteOne) ExecX

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

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

func (*MediaFormatDeleteOne) Where

Where appends a list predicates to the MediaFormatDelete builder.

type MediaFormatEdges

type MediaFormatEdges struct {
	// Media holds the value of the media edge.
	Media *Media `json:"media,omitempty"`
	// contains filtered or unexported fields
}

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

func (MediaFormatEdges) MediaOrErr

func (e MediaFormatEdges) MediaOrErr() (*Media, error)

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

type MediaFormatGroupBy

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

MediaFormatGroupBy is the group-by builder for MediaFormat entities.

func (*MediaFormatGroupBy) Aggregate

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

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

func (*MediaFormatGroupBy) Bool

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

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

func (*MediaFormatGroupBy) BoolX

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

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

func (*MediaFormatGroupBy) Bools

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

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

func (*MediaFormatGroupBy) BoolsX

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

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

func (*MediaFormatGroupBy) Float64

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

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

func (*MediaFormatGroupBy) Float64X

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

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

func (*MediaFormatGroupBy) Float64s

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

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

func (*MediaFormatGroupBy) Float64sX

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

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

func (*MediaFormatGroupBy) Int

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

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

func (*MediaFormatGroupBy) IntX

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

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

func (*MediaFormatGroupBy) Ints

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

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

func (*MediaFormatGroupBy) IntsX

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

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

func (*MediaFormatGroupBy) Scan

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

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

func (*MediaFormatGroupBy) ScanX

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

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

func (*MediaFormatGroupBy) String

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

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

func (*MediaFormatGroupBy) StringX

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

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

func (*MediaFormatGroupBy) Strings

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

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

func (*MediaFormatGroupBy) StringsX

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

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

type MediaFormatMutation

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

MediaFormatMutation represents an operation that mutates the MediaFormat nodes in the graph.

func (*MediaFormatMutation) AddField

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) AddHeight

func (m *MediaFormatMutation) AddHeight(i int)

AddHeight adds i to the "height" field.

func (*MediaFormatMutation) AddSize

func (m *MediaFormatMutation) AddSize(f float64)

AddSize adds f to the "size" field.

func (*MediaFormatMutation) AddSizeInBytes

func (m *MediaFormatMutation) AddSizeInBytes(i int64)

AddSizeInBytes adds i to the "size_in_bytes" field.

func (*MediaFormatMutation) AddWidth

func (m *MediaFormatMutation) AddWidth(i int)

AddWidth adds i to the "width" field.

func (*MediaFormatMutation) AddedEdges

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

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

func (*MediaFormatMutation) AddedField

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

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

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

func (*MediaFormatMutation) AddedHeight

func (m *MediaFormatMutation) AddedHeight() (r int, exists bool)

AddedHeight returns the value that was added to the "height" field in this mutation.

func (*MediaFormatMutation) AddedIDs

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

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

func (*MediaFormatMutation) AddedSize

func (m *MediaFormatMutation) AddedSize() (r float64, exists bool)

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

func (*MediaFormatMutation) AddedSizeInBytes

func (m *MediaFormatMutation) AddedSizeInBytes() (r int64, exists bool)

AddedSizeInBytes returns the value that was added to the "size_in_bytes" field in this mutation.

func (*MediaFormatMutation) AddedWidth

func (m *MediaFormatMutation) AddedWidth() (r int, exists bool)

AddedWidth returns the value that was added to the "width" field in this mutation.

func (*MediaFormatMutation) ArchivedAt

func (m *MediaFormatMutation) ArchivedAt() (r time.Time, exists bool)

ArchivedAt returns the value of the "archived_at" field in the mutation.

func (*MediaFormatMutation) ArchivedAtCleared

func (m *MediaFormatMutation) ArchivedAtCleared() bool

ArchivedAtCleared returns if the "archived_at" field was cleared in this mutation.

func (*MediaFormatMutation) ClearArchivedAt

func (m *MediaFormatMutation) ClearArchivedAt()

ClearArchivedAt clears the value of the "archived_at" field.

func (*MediaFormatMutation) ClearCreatedAt

func (m *MediaFormatMutation) ClearCreatedAt()

ClearCreatedAt clears the value of the "created_at" field.

func (*MediaFormatMutation) ClearCreatedByID

func (m *MediaFormatMutation) ClearCreatedByID()

ClearCreatedByID clears the value of the "created_by_id" field.

func (*MediaFormatMutation) ClearDeletedAt

func (m *MediaFormatMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*MediaFormatMutation) ClearDeletedByID

func (m *MediaFormatMutation) ClearDeletedByID()

ClearDeletedByID clears the value of the "deleted_by_id" field.

func (*MediaFormatMutation) ClearEdge

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) ClearExt

func (m *MediaFormatMutation) ClearExt()

ClearExt clears the value of the "ext" field.

func (*MediaFormatMutation) ClearField

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) ClearHash

func (m *MediaFormatMutation) ClearHash()

ClearHash clears the value of the "hash" field.

func (*MediaFormatMutation) ClearHeight

func (m *MediaFormatMutation) ClearHeight()

ClearHeight clears the value of the "height" field.

func (*MediaFormatMutation) ClearIsURLSigned

func (m *MediaFormatMutation) ClearIsURLSigned()

ClearIsURLSigned clears the value of the "is_url_signed" field.

func (*MediaFormatMutation) ClearMedia

func (m *MediaFormatMutation) ClearMedia()

ClearMedia clears the "media" edge to the Media entity.

func (*MediaFormatMutation) ClearMediaID

func (m *MediaFormatMutation) ClearMediaID()

ClearMediaID clears the value of the "media_id" field.

func (*MediaFormatMutation) ClearMime

func (m *MediaFormatMutation) ClearMime()

ClearMime clears the value of the "mime" field.

func (*MediaFormatMutation) ClearPath

func (m *MediaFormatMutation) ClearPath()

ClearPath clears the value of the "path" field.

func (*MediaFormatMutation) ClearProviderMetadata

func (m *MediaFormatMutation) ClearProviderMetadata()

ClearProviderMetadata clears the value of the "provider_metadata" field.

func (*MediaFormatMutation) ClearPublishedAt

func (m *MediaFormatMutation) ClearPublishedAt()

ClearPublishedAt clears the value of the "published_at" field.

func (*MediaFormatMutation) ClearSize

func (m *MediaFormatMutation) ClearSize()

ClearSize clears the value of the "size" field.

func (*MediaFormatMutation) ClearSizeInBytes

func (m *MediaFormatMutation) ClearSizeInBytes()

ClearSizeInBytes clears the value of the "size_in_bytes" field.

func (*MediaFormatMutation) ClearUpdatedAt

func (m *MediaFormatMutation) ClearUpdatedAt()

ClearUpdatedAt clears the value of the "updated_at" field.

func (*MediaFormatMutation) ClearUpdatedByID

func (m *MediaFormatMutation) ClearUpdatedByID()

ClearUpdatedByID clears the value of the "updated_by_id" field.

func (*MediaFormatMutation) ClearWidth

func (m *MediaFormatMutation) ClearWidth()

ClearWidth clears the value of the "width" field.

func (*MediaFormatMutation) ClearedEdges

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

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

func (*MediaFormatMutation) ClearedFields

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

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

func (MediaFormatMutation) Client

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

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

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

func (*MediaFormatMutation) CreatedAtCleared

func (m *MediaFormatMutation) CreatedAtCleared() bool

CreatedAtCleared returns if the "created_at" field was cleared in this mutation.

func (*MediaFormatMutation) CreatedByID

func (m *MediaFormatMutation) CreatedByID() (r uuid.UUID, exists bool)

CreatedByID returns the value of the "created_by_id" field in the mutation.

func (*MediaFormatMutation) CreatedByIDCleared

func (m *MediaFormatMutation) CreatedByIDCleared() bool

CreatedByIDCleared returns if the "created_by_id" field was cleared in this mutation.

func (*MediaFormatMutation) DeletedAt

func (m *MediaFormatMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*MediaFormatMutation) DeletedAtCleared

func (m *MediaFormatMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*MediaFormatMutation) DeletedByID

func (m *MediaFormatMutation) DeletedByID() (r uuid.UUID, exists bool)

DeletedByID returns the value of the "deleted_by_id" field in the mutation.

func (*MediaFormatMutation) DeletedByIDCleared

func (m *MediaFormatMutation) DeletedByIDCleared() bool

DeletedByIDCleared returns if the "deleted_by_id" field was cleared in this mutation.

func (*MediaFormatMutation) EdgeCleared

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

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

func (*MediaFormatMutation) Ext

func (m *MediaFormatMutation) Ext() (r string, exists bool)

Ext returns the value of the "ext" field in the mutation.

func (*MediaFormatMutation) ExtCleared

func (m *MediaFormatMutation) ExtCleared() bool

ExtCleared returns if the "ext" field was cleared in this mutation.

func (*MediaFormatMutation) Field

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

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

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

func (*MediaFormatMutation) Fields

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) Hash

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

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

func (*MediaFormatMutation) HashCleared

func (m *MediaFormatMutation) HashCleared() bool

HashCleared returns if the "hash" field was cleared in this mutation.

func (*MediaFormatMutation) Height

func (m *MediaFormatMutation) Height() (r int, exists bool)

Height returns the value of the "height" field in the mutation.

func (*MediaFormatMutation) HeightCleared

func (m *MediaFormatMutation) HeightCleared() bool

HeightCleared returns if the "height" field was cleared in this mutation.

func (*MediaFormatMutation) ID

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

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

func (*MediaFormatMutation) IDs

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

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

func (*MediaFormatMutation) IsURLSigned

func (m *MediaFormatMutation) IsURLSigned() (r bool, exists bool)

IsURLSigned returns the value of the "is_url_signed" field in the mutation.

func (*MediaFormatMutation) IsURLSignedCleared

func (m *MediaFormatMutation) IsURLSignedCleared() bool

IsURLSignedCleared returns if the "is_url_signed" field was cleared in this mutation.

func (*MediaFormatMutation) MediaCleared

func (m *MediaFormatMutation) MediaCleared() bool

MediaCleared reports if the "media" edge to the Media entity was cleared.

func (*MediaFormatMutation) MediaID

func (m *MediaFormatMutation) MediaID() (r uuid.UUID, exists bool)

MediaID returns the value of the "media_id" field in the mutation.

func (*MediaFormatMutation) MediaIDCleared

func (m *MediaFormatMutation) MediaIDCleared() bool

MediaIDCleared returns if the "media_id" field was cleared in this mutation.

func (*MediaFormatMutation) MediaIDs

func (m *MediaFormatMutation) MediaIDs() (ids []uuid.UUID)

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

func (*MediaFormatMutation) Mime

func (m *MediaFormatMutation) Mime() (r string, exists bool)

Mime returns the value of the "mime" field in the mutation.

func (*MediaFormatMutation) MimeCleared

func (m *MediaFormatMutation) MimeCleared() bool

MimeCleared returns if the "mime" field was cleared in this mutation.

func (*MediaFormatMutation) Name

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

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

func (*MediaFormatMutation) OldArchivedAt

func (m *MediaFormatMutation) OldArchivedAt(ctx context.Context) (v time.Time, err error)

OldArchivedAt returns the old "archived_at" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldCreatedAt

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

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

func (m *MediaFormatMutation) OldCreatedByID(ctx context.Context) (v uuid.UUID, err error)

OldCreatedByID returns the old "created_by_id" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldDeletedAt

func (m *MediaFormatMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldDeletedByID

func (m *MediaFormatMutation) OldDeletedByID(ctx context.Context) (v uuid.UUID, err error)

OldDeletedByID returns the old "deleted_by_id" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldExt

func (m *MediaFormatMutation) OldExt(ctx context.Context) (v *string, err error)

OldExt returns the old "ext" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldField

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) OldHash

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

OldHash returns the old "hash" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldHeight

func (m *MediaFormatMutation) OldHeight(ctx context.Context) (v *int, err error)

OldHeight returns the old "height" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldIsURLSigned

func (m *MediaFormatMutation) OldIsURLSigned(ctx context.Context) (v *bool, err error)

OldIsURLSigned returns the old "is_url_signed" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldMediaID

func (m *MediaFormatMutation) OldMediaID(ctx context.Context) (v uuid.UUID, err error)

OldMediaID returns the old "media_id" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldMime

func (m *MediaFormatMutation) OldMime(ctx context.Context) (v *string, err error)

OldMime returns the old "mime" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldName

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

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

func (m *MediaFormatMutation) OldPath(ctx context.Context) (v *string, err error)

OldPath returns the old "path" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldProviderMetadata

func (m *MediaFormatMutation) OldProviderMetadata(ctx context.Context) (v map[string]interface{}, err error)

OldProviderMetadata returns the old "provider_metadata" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldPublishedAt

func (m *MediaFormatMutation) OldPublishedAt(ctx context.Context) (v time.Time, err error)

OldPublishedAt returns the old "published_at" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldSize

func (m *MediaFormatMutation) OldSize(ctx context.Context) (v *float64, err error)

OldSize returns the old "size" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldSizeInBytes

func (m *MediaFormatMutation) OldSizeInBytes(ctx context.Context) (v *int64, err error)

OldSizeInBytes returns the old "size_in_bytes" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldTenantID

func (m *MediaFormatMutation) OldTenantID(ctx context.Context) (v string, err error)

OldTenantID returns the old "tenant_id" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldURL

func (m *MediaFormatMutation) OldURL(ctx context.Context) (v string, err error)

OldURL returns the old "url" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldUpdatedAt

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

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

func (m *MediaFormatMutation) OldUpdatedByID(ctx context.Context) (v uuid.UUID, err error)

OldUpdatedByID returns the old "updated_by_id" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) OldWidth

func (m *MediaFormatMutation) OldWidth(ctx context.Context) (v *int, err error)

OldWidth returns the old "width" field's value of the MediaFormat entity. If the MediaFormat 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 (*MediaFormatMutation) Op

func (m *MediaFormatMutation) Op() Op

Op returns the operation name.

func (*MediaFormatMutation) Path

func (m *MediaFormatMutation) Path() (r string, exists bool)

Path returns the value of the "path" field in the mutation.

func (*MediaFormatMutation) PathCleared

func (m *MediaFormatMutation) PathCleared() bool

PathCleared returns if the "path" field was cleared in this mutation.

func (*MediaFormatMutation) ProviderMetadata

func (m *MediaFormatMutation) ProviderMetadata() (r map[string]interface{}, exists bool)

ProviderMetadata returns the value of the "provider_metadata" field in the mutation.

func (*MediaFormatMutation) ProviderMetadataCleared

func (m *MediaFormatMutation) ProviderMetadataCleared() bool

ProviderMetadataCleared returns if the "provider_metadata" field was cleared in this mutation.

func (*MediaFormatMutation) PublishedAt

func (m *MediaFormatMutation) PublishedAt() (r time.Time, exists bool)

PublishedAt returns the value of the "published_at" field in the mutation.

func (*MediaFormatMutation) PublishedAtCleared

func (m *MediaFormatMutation) PublishedAtCleared() bool

PublishedAtCleared returns if the "published_at" field was cleared in this mutation.

func (*MediaFormatMutation) RemovedEdges

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

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

func (*MediaFormatMutation) RemovedIDs

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) ResetArchivedAt

func (m *MediaFormatMutation) ResetArchivedAt()

ResetArchivedAt resets all changes to the "archived_at" field.

func (*MediaFormatMutation) ResetCreatedAt

func (m *MediaFormatMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*MediaFormatMutation) ResetCreatedByID

func (m *MediaFormatMutation) ResetCreatedByID()

ResetCreatedByID resets all changes to the "created_by_id" field.

func (*MediaFormatMutation) ResetDeletedAt

func (m *MediaFormatMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*MediaFormatMutation) ResetDeletedByID

func (m *MediaFormatMutation) ResetDeletedByID()

ResetDeletedByID resets all changes to the "deleted_by_id" field.

func (*MediaFormatMutation) ResetEdge

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) ResetExt

func (m *MediaFormatMutation) ResetExt()

ResetExt resets all changes to the "ext" field.

func (*MediaFormatMutation) ResetField

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) ResetHash

func (m *MediaFormatMutation) ResetHash()

ResetHash resets all changes to the "hash" field.

func (*MediaFormatMutation) ResetHeight

func (m *MediaFormatMutation) ResetHeight()

ResetHeight resets all changes to the "height" field.

func (*MediaFormatMutation) ResetIsURLSigned

func (m *MediaFormatMutation) ResetIsURLSigned()

ResetIsURLSigned resets all changes to the "is_url_signed" field.

func (*MediaFormatMutation) ResetMedia

func (m *MediaFormatMutation) ResetMedia()

ResetMedia resets all changes to the "media" edge.

func (*MediaFormatMutation) ResetMediaID

func (m *MediaFormatMutation) ResetMediaID()

ResetMediaID resets all changes to the "media_id" field.

func (*MediaFormatMutation) ResetMime

func (m *MediaFormatMutation) ResetMime()

ResetMime resets all changes to the "mime" field.

func (*MediaFormatMutation) ResetName

func (m *MediaFormatMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*MediaFormatMutation) ResetPath

func (m *MediaFormatMutation) ResetPath()

ResetPath resets all changes to the "path" field.

func (*MediaFormatMutation) ResetProviderMetadata

func (m *MediaFormatMutation) ResetProviderMetadata()

ResetProviderMetadata resets all changes to the "provider_metadata" field.

func (*MediaFormatMutation) ResetPublishedAt

func (m *MediaFormatMutation) ResetPublishedAt()

ResetPublishedAt resets all changes to the "published_at" field.

func (*MediaFormatMutation) ResetSize

func (m *MediaFormatMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*MediaFormatMutation) ResetSizeInBytes

func (m *MediaFormatMutation) ResetSizeInBytes()

ResetSizeInBytes resets all changes to the "size_in_bytes" field.

func (*MediaFormatMutation) ResetTenantID

func (m *MediaFormatMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*MediaFormatMutation) ResetURL

func (m *MediaFormatMutation) ResetURL()

ResetURL resets all changes to the "url" field.

func (*MediaFormatMutation) ResetUpdatedAt

func (m *MediaFormatMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*MediaFormatMutation) ResetUpdatedByID

func (m *MediaFormatMutation) ResetUpdatedByID()

ResetUpdatedByID resets all changes to the "updated_by_id" field.

func (*MediaFormatMutation) ResetWidth

func (m *MediaFormatMutation) ResetWidth()

ResetWidth resets all changes to the "width" field.

func (*MediaFormatMutation) SetArchivedAt

func (m *MediaFormatMutation) SetArchivedAt(t time.Time)

SetArchivedAt sets the "archived_at" field.

func (*MediaFormatMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*MediaFormatMutation) SetCreatedByID

func (m *MediaFormatMutation) SetCreatedByID(u uuid.UUID)

SetCreatedByID sets the "created_by_id" field.

func (*MediaFormatMutation) SetDeletedAt

func (m *MediaFormatMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*MediaFormatMutation) SetDeletedByID

func (m *MediaFormatMutation) SetDeletedByID(u uuid.UUID)

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaFormatMutation) SetExt

func (m *MediaFormatMutation) SetExt(s string)

SetExt sets the "ext" field.

func (*MediaFormatMutation) SetField

func (m *MediaFormatMutation) 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 (*MediaFormatMutation) SetHash

func (m *MediaFormatMutation) SetHash(s string)

SetHash sets the "hash" field.

func (*MediaFormatMutation) SetHeight

func (m *MediaFormatMutation) SetHeight(i int)

SetHeight sets the "height" field.

func (*MediaFormatMutation) SetID

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

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

func (*MediaFormatMutation) SetIsURLSigned

func (m *MediaFormatMutation) SetIsURLSigned(b bool)

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaFormatMutation) SetMediaID

func (m *MediaFormatMutation) SetMediaID(u uuid.UUID)

SetMediaID sets the "media_id" field.

func (*MediaFormatMutation) SetMime

func (m *MediaFormatMutation) SetMime(s string)

SetMime sets the "mime" field.

func (*MediaFormatMutation) SetName

func (m *MediaFormatMutation) SetName(s string)

SetName sets the "name" field.

func (*MediaFormatMutation) SetOp

func (m *MediaFormatMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*MediaFormatMutation) SetPath

func (m *MediaFormatMutation) SetPath(s string)

SetPath sets the "path" field.

func (*MediaFormatMutation) SetProviderMetadata

func (m *MediaFormatMutation) SetProviderMetadata(value map[string]interface{})

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaFormatMutation) SetPublishedAt

func (m *MediaFormatMutation) SetPublishedAt(t time.Time)

SetPublishedAt sets the "published_at" field.

func (*MediaFormatMutation) SetSize

func (m *MediaFormatMutation) SetSize(f float64)

SetSize sets the "size" field.

func (*MediaFormatMutation) SetSizeInBytes

func (m *MediaFormatMutation) SetSizeInBytes(i int64)

SetSizeInBytes sets the "size_in_bytes" field.

func (*MediaFormatMutation) SetTenantID

func (m *MediaFormatMutation) SetTenantID(s string)

SetTenantID sets the "tenant_id" field.

func (*MediaFormatMutation) SetURL

func (m *MediaFormatMutation) SetURL(s string)

SetURL sets the "url" field.

func (*MediaFormatMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaFormatMutation) SetUpdatedByID

func (m *MediaFormatMutation) SetUpdatedByID(u uuid.UUID)

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaFormatMutation) SetWidth

func (m *MediaFormatMutation) SetWidth(i int)

SetWidth sets the "width" field.

func (*MediaFormatMutation) Size

func (m *MediaFormatMutation) Size() (r float64, exists bool)

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

func (*MediaFormatMutation) SizeCleared

func (m *MediaFormatMutation) SizeCleared() bool

SizeCleared returns if the "size" field was cleared in this mutation.

func (*MediaFormatMutation) SizeInBytes

func (m *MediaFormatMutation) SizeInBytes() (r int64, exists bool)

SizeInBytes returns the value of the "size_in_bytes" field in the mutation.

func (*MediaFormatMutation) SizeInBytesCleared

func (m *MediaFormatMutation) SizeInBytesCleared() bool

SizeInBytesCleared returns if the "size_in_bytes" field was cleared in this mutation.

func (*MediaFormatMutation) TenantID

func (m *MediaFormatMutation) TenantID() (r string, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (MediaFormatMutation) Tx

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

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

func (*MediaFormatMutation) Type

func (m *MediaFormatMutation) Type() string

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

func (*MediaFormatMutation) URL

func (m *MediaFormatMutation) URL() (r string, exists bool)

URL returns the value of the "url" field in the mutation.

func (*MediaFormatMutation) UpdatedAt

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

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

func (*MediaFormatMutation) UpdatedAtCleared

func (m *MediaFormatMutation) UpdatedAtCleared() bool

UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.

func (*MediaFormatMutation) UpdatedByID

func (m *MediaFormatMutation) UpdatedByID() (r uuid.UUID, exists bool)

UpdatedByID returns the value of the "updated_by_id" field in the mutation.

func (*MediaFormatMutation) UpdatedByIDCleared

func (m *MediaFormatMutation) UpdatedByIDCleared() bool

UpdatedByIDCleared returns if the "updated_by_id" field was cleared in this mutation.

func (*MediaFormatMutation) Where

func (m *MediaFormatMutation) Where(ps ...predicate.MediaFormat)

Where appends a list predicates to the MediaFormatMutation builder.

func (*MediaFormatMutation) WhereP

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

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

func (*MediaFormatMutation) Width

func (m *MediaFormatMutation) Width() (r int, exists bool)

Width returns the value of the "width" field in the mutation.

func (*MediaFormatMutation) WidthCleared

func (m *MediaFormatMutation) WidthCleared() bool

WidthCleared returns if the "width" field was cleared in this mutation.

type MediaFormatQuery

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

MediaFormatQuery is the builder for querying MediaFormat entities.

func (*MediaFormatQuery) Aggregate

func (_q *MediaFormatQuery) Aggregate(fns ...AggregateFunc) *MediaFormatSelect

Aggregate returns a MediaFormatSelect configured with the given aggregations.

func (*MediaFormatQuery) All

func (_q *MediaFormatQuery) All(ctx context.Context) ([]*MediaFormat, error)

All executes the query and returns a list of MediaFormats.

func (*MediaFormatQuery) AllX

func (_q *MediaFormatQuery) AllX(ctx context.Context) []*MediaFormat

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

func (*MediaFormatQuery) Clone

func (_q *MediaFormatQuery) Clone() *MediaFormatQuery

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

func (*MediaFormatQuery) Count

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

Count returns the count of the given query.

func (*MediaFormatQuery) CountX

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

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

func (*MediaFormatQuery) Exist

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

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

func (*MediaFormatQuery) ExistX

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

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

func (*MediaFormatQuery) First

func (_q *MediaFormatQuery) First(ctx context.Context) (*MediaFormat, error)

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

func (*MediaFormatQuery) FirstID

func (_q *MediaFormatQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*MediaFormatQuery) FirstIDX

func (_q *MediaFormatQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*MediaFormatQuery) FirstX

func (_q *MediaFormatQuery) FirstX(ctx context.Context) *MediaFormat

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

func (*MediaFormatQuery) GroupBy

func (_q *MediaFormatQuery) GroupBy(field string, fields ...string) *MediaFormatGroupBy

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

client.MediaFormat.Query().
	GroupBy(mediaformat.FieldTenantID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MediaFormatQuery) IDs

func (_q *MediaFormatQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*MediaFormatQuery) IDsX

func (_q *MediaFormatQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*MediaFormatQuery) Limit

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

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

func (*MediaFormatQuery) Offset

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

Offset to start from.

func (*MediaFormatQuery) Only

func (_q *MediaFormatQuery) Only(ctx context.Context) (*MediaFormat, error)

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

func (*MediaFormatQuery) OnlyID

func (_q *MediaFormatQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*MediaFormatQuery) OnlyIDX

func (_q *MediaFormatQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*MediaFormatQuery) OnlyX

func (_q *MediaFormatQuery) OnlyX(ctx context.Context) *MediaFormat

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

func (*MediaFormatQuery) Order

Order specifies how the records should be ordered.

func (*MediaFormatQuery) QueryMedia

func (_q *MediaFormatQuery) QueryMedia() *MediaQuery

QueryMedia chains the current query on the "media" edge.

func (*MediaFormatQuery) Select

func (_q *MediaFormatQuery) Select(fields ...string) *MediaFormatSelect

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

client.MediaFormat.Query().
	Select(mediaformat.FieldTenantID).
	Scan(ctx, &v)

func (*MediaFormatQuery) Unique

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

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

Where adds a new predicate for the MediaFormatQuery builder.

func (*MediaFormatQuery) WithMedia

func (_q *MediaFormatQuery) WithMedia(opts ...func(*MediaQuery)) *MediaFormatQuery

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

type MediaFormatSelect

type MediaFormatSelect struct {
	*MediaFormatQuery
	// contains filtered or unexported fields
}

MediaFormatSelect is the builder for selecting fields of MediaFormat entities.

func (*MediaFormatSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*MediaFormatSelect) Bool

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

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

func (*MediaFormatSelect) BoolX

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

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

func (*MediaFormatSelect) Bools

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

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

func (*MediaFormatSelect) BoolsX

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

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

func (*MediaFormatSelect) Float64

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

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

func (*MediaFormatSelect) Float64X

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

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

func (*MediaFormatSelect) Float64s

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

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

func (*MediaFormatSelect) Float64sX

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

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

func (*MediaFormatSelect) Int

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

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

func (*MediaFormatSelect) IntX

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

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

func (*MediaFormatSelect) Ints

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

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

func (*MediaFormatSelect) IntsX

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

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

func (*MediaFormatSelect) Scan

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

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

func (*MediaFormatSelect) ScanX

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

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

func (*MediaFormatSelect) String

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

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

func (*MediaFormatSelect) StringX

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

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

func (*MediaFormatSelect) Strings

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

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

func (*MediaFormatSelect) StringsX

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

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

type MediaFormatUpdate

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

MediaFormatUpdate is the builder for updating MediaFormat entities.

func (*MediaFormatUpdate) AddHeight

func (_u *MediaFormatUpdate) AddHeight(v int) *MediaFormatUpdate

AddHeight adds value to the "height" field.

func (*MediaFormatUpdate) AddSize

AddSize adds value to the "size" field.

func (*MediaFormatUpdate) AddSizeInBytes

func (_u *MediaFormatUpdate) AddSizeInBytes(v int64) *MediaFormatUpdate

AddSizeInBytes adds value to the "size_in_bytes" field.

func (*MediaFormatUpdate) AddWidth

func (_u *MediaFormatUpdate) AddWidth(v int) *MediaFormatUpdate

AddWidth adds value to the "width" field.

func (*MediaFormatUpdate) ClearArchivedAt

func (_u *MediaFormatUpdate) ClearArchivedAt() *MediaFormatUpdate

ClearArchivedAt clears the value of the "archived_at" field.

func (*MediaFormatUpdate) ClearDeletedAt

func (_u *MediaFormatUpdate) ClearDeletedAt() *MediaFormatUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*MediaFormatUpdate) ClearDeletedByID

func (_u *MediaFormatUpdate) ClearDeletedByID() *MediaFormatUpdate

ClearDeletedByID clears the value of the "deleted_by_id" field.

func (*MediaFormatUpdate) ClearExt

func (_u *MediaFormatUpdate) ClearExt() *MediaFormatUpdate

ClearExt clears the value of the "ext" field.

func (*MediaFormatUpdate) ClearHash

func (_u *MediaFormatUpdate) ClearHash() *MediaFormatUpdate

ClearHash clears the value of the "hash" field.

func (*MediaFormatUpdate) ClearHeight

func (_u *MediaFormatUpdate) ClearHeight() *MediaFormatUpdate

ClearHeight clears the value of the "height" field.

func (*MediaFormatUpdate) ClearIsURLSigned

func (_u *MediaFormatUpdate) ClearIsURLSigned() *MediaFormatUpdate

ClearIsURLSigned clears the value of the "is_url_signed" field.

func (*MediaFormatUpdate) ClearMedia

func (_u *MediaFormatUpdate) ClearMedia() *MediaFormatUpdate

ClearMedia clears the "media" edge to the Media entity.

func (*MediaFormatUpdate) ClearMediaID

func (_u *MediaFormatUpdate) ClearMediaID() *MediaFormatUpdate

ClearMediaID clears the value of the "media_id" field.

func (*MediaFormatUpdate) ClearMime

func (_u *MediaFormatUpdate) ClearMime() *MediaFormatUpdate

ClearMime clears the value of the "mime" field.

func (*MediaFormatUpdate) ClearPath

func (_u *MediaFormatUpdate) ClearPath() *MediaFormatUpdate

ClearPath clears the value of the "path" field.

func (*MediaFormatUpdate) ClearProviderMetadata

func (_u *MediaFormatUpdate) ClearProviderMetadata() *MediaFormatUpdate

ClearProviderMetadata clears the value of the "provider_metadata" field.

func (*MediaFormatUpdate) ClearPublishedAt

func (_u *MediaFormatUpdate) ClearPublishedAt() *MediaFormatUpdate

ClearPublishedAt clears the value of the "published_at" field.

func (*MediaFormatUpdate) ClearSize

func (_u *MediaFormatUpdate) ClearSize() *MediaFormatUpdate

ClearSize clears the value of the "size" field.

func (*MediaFormatUpdate) ClearSizeInBytes

func (_u *MediaFormatUpdate) ClearSizeInBytes() *MediaFormatUpdate

ClearSizeInBytes clears the value of the "size_in_bytes" field.

func (*MediaFormatUpdate) ClearUpdatedAt

func (_u *MediaFormatUpdate) ClearUpdatedAt() *MediaFormatUpdate

ClearUpdatedAt clears the value of the "updated_at" field.

func (*MediaFormatUpdate) ClearUpdatedByID

func (_u *MediaFormatUpdate) ClearUpdatedByID() *MediaFormatUpdate

ClearUpdatedByID clears the value of the "updated_by_id" field.

func (*MediaFormatUpdate) ClearWidth

func (_u *MediaFormatUpdate) ClearWidth() *MediaFormatUpdate

ClearWidth clears the value of the "width" field.

func (*MediaFormatUpdate) Exec

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

Exec executes the query.

func (*MediaFormatUpdate) ExecX

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

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

func (*MediaFormatUpdate) Mutation

func (_u *MediaFormatUpdate) Mutation() *MediaFormatMutation

Mutation returns the MediaFormatMutation object of the builder.

func (*MediaFormatUpdate) Save

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

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

func (*MediaFormatUpdate) SaveX

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

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

func (*MediaFormatUpdate) SetArchivedAt

func (_u *MediaFormatUpdate) SetArchivedAt(v time.Time) *MediaFormatUpdate

SetArchivedAt sets the "archived_at" field.

func (*MediaFormatUpdate) SetDeletedAt

func (_u *MediaFormatUpdate) SetDeletedAt(v time.Time) *MediaFormatUpdate

SetDeletedAt sets the "deleted_at" field.

func (*MediaFormatUpdate) SetDeletedByID

func (_u *MediaFormatUpdate) SetDeletedByID(v uuid.UUID) *MediaFormatUpdate

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaFormatUpdate) SetExt

SetExt sets the "ext" field.

func (*MediaFormatUpdate) SetHash

func (_u *MediaFormatUpdate) SetHash(v string) *MediaFormatUpdate

SetHash sets the "hash" field.

func (*MediaFormatUpdate) SetHeight

func (_u *MediaFormatUpdate) SetHeight(v int) *MediaFormatUpdate

SetHeight sets the "height" field.

func (*MediaFormatUpdate) SetIsURLSigned

func (_u *MediaFormatUpdate) SetIsURLSigned(v bool) *MediaFormatUpdate

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaFormatUpdate) SetMedia

func (_u *MediaFormatUpdate) SetMedia(v *Media) *MediaFormatUpdate

SetMedia sets the "media" edge to the Media entity.

func (*MediaFormatUpdate) SetMediaID

func (_u *MediaFormatUpdate) SetMediaID(v uuid.UUID) *MediaFormatUpdate

SetMediaID sets the "media_id" field.

func (*MediaFormatUpdate) SetMime

func (_u *MediaFormatUpdate) SetMime(v string) *MediaFormatUpdate

SetMime sets the "mime" field.

func (*MediaFormatUpdate) SetName

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

SetName sets the "name" field.

func (*MediaFormatUpdate) SetNillableArchivedAt

func (_u *MediaFormatUpdate) SetNillableArchivedAt(v *time.Time) *MediaFormatUpdate

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableDeletedAt

func (_u *MediaFormatUpdate) SetNillableDeletedAt(v *time.Time) *MediaFormatUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableDeletedByID

func (_u *MediaFormatUpdate) SetNillableDeletedByID(v *uuid.UUID) *MediaFormatUpdate

SetNillableDeletedByID sets the "deleted_by_id" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableExt

func (_u *MediaFormatUpdate) SetNillableExt(v *string) *MediaFormatUpdate

SetNillableExt sets the "ext" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableHash

func (_u *MediaFormatUpdate) SetNillableHash(v *string) *MediaFormatUpdate

SetNillableHash sets the "hash" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableHeight

func (_u *MediaFormatUpdate) SetNillableHeight(v *int) *MediaFormatUpdate

SetNillableHeight sets the "height" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableIsURLSigned

func (_u *MediaFormatUpdate) SetNillableIsURLSigned(v *bool) *MediaFormatUpdate

SetNillableIsURLSigned sets the "is_url_signed" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableMediaID

func (_u *MediaFormatUpdate) SetNillableMediaID(v *uuid.UUID) *MediaFormatUpdate

SetNillableMediaID sets the "media_id" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableMime

func (_u *MediaFormatUpdate) SetNillableMime(v *string) *MediaFormatUpdate

SetNillableMime sets the "mime" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableName

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

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

func (*MediaFormatUpdate) SetNillablePath

func (_u *MediaFormatUpdate) SetNillablePath(v *string) *MediaFormatUpdate

SetNillablePath sets the "path" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillablePublishedAt

func (_u *MediaFormatUpdate) SetNillablePublishedAt(v *time.Time) *MediaFormatUpdate

SetNillablePublishedAt sets the "published_at" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableSize

func (_u *MediaFormatUpdate) SetNillableSize(v *float64) *MediaFormatUpdate

SetNillableSize sets the "size" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableSizeInBytes

func (_u *MediaFormatUpdate) SetNillableSizeInBytes(v *int64) *MediaFormatUpdate

SetNillableSizeInBytes sets the "size_in_bytes" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableTenantID

func (_u *MediaFormatUpdate) SetNillableTenantID(v *string) *MediaFormatUpdate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableURL

func (_u *MediaFormatUpdate) SetNillableURL(v *string) *MediaFormatUpdate

SetNillableURL sets the "url" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableUpdatedByID

func (_u *MediaFormatUpdate) SetNillableUpdatedByID(v *uuid.UUID) *MediaFormatUpdate

SetNillableUpdatedByID sets the "updated_by_id" field if the given value is not nil.

func (*MediaFormatUpdate) SetNillableWidth

func (_u *MediaFormatUpdate) SetNillableWidth(v *int) *MediaFormatUpdate

SetNillableWidth sets the "width" field if the given value is not nil.

func (*MediaFormatUpdate) SetPath

func (_u *MediaFormatUpdate) SetPath(v string) *MediaFormatUpdate

SetPath sets the "path" field.

func (*MediaFormatUpdate) SetProviderMetadata

func (_u *MediaFormatUpdate) SetProviderMetadata(v map[string]interface{}) *MediaFormatUpdate

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaFormatUpdate) SetPublishedAt

func (_u *MediaFormatUpdate) SetPublishedAt(v time.Time) *MediaFormatUpdate

SetPublishedAt sets the "published_at" field.

func (*MediaFormatUpdate) SetSize

SetSize sets the "size" field.

func (*MediaFormatUpdate) SetSizeInBytes

func (_u *MediaFormatUpdate) SetSizeInBytes(v int64) *MediaFormatUpdate

SetSizeInBytes sets the "size_in_bytes" field.

func (*MediaFormatUpdate) SetTenantID

func (_u *MediaFormatUpdate) SetTenantID(v string) *MediaFormatUpdate

SetTenantID sets the "tenant_id" field.

func (*MediaFormatUpdate) SetURL

SetURL sets the "url" field.

func (*MediaFormatUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaFormatUpdate) SetUpdatedByID

func (_u *MediaFormatUpdate) SetUpdatedByID(v uuid.UUID) *MediaFormatUpdate

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaFormatUpdate) SetWidth

func (_u *MediaFormatUpdate) SetWidth(v int) *MediaFormatUpdate

SetWidth sets the "width" field.

func (*MediaFormatUpdate) Where

Where appends a list predicates to the MediaFormatUpdate builder.

type MediaFormatUpdateOne

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

MediaFormatUpdateOne is the builder for updating a single MediaFormat entity.

func (*MediaFormatUpdateOne) AddHeight

func (_u *MediaFormatUpdateOne) AddHeight(v int) *MediaFormatUpdateOne

AddHeight adds value to the "height" field.

func (*MediaFormatUpdateOne) AddSize

AddSize adds value to the "size" field.

func (*MediaFormatUpdateOne) AddSizeInBytes

func (_u *MediaFormatUpdateOne) AddSizeInBytes(v int64) *MediaFormatUpdateOne

AddSizeInBytes adds value to the "size_in_bytes" field.

func (*MediaFormatUpdateOne) AddWidth

AddWidth adds value to the "width" field.

func (*MediaFormatUpdateOne) ClearArchivedAt

func (_u *MediaFormatUpdateOne) ClearArchivedAt() *MediaFormatUpdateOne

ClearArchivedAt clears the value of the "archived_at" field.

func (*MediaFormatUpdateOne) ClearDeletedAt

func (_u *MediaFormatUpdateOne) ClearDeletedAt() *MediaFormatUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*MediaFormatUpdateOne) ClearDeletedByID

func (_u *MediaFormatUpdateOne) ClearDeletedByID() *MediaFormatUpdateOne

ClearDeletedByID clears the value of the "deleted_by_id" field.

func (*MediaFormatUpdateOne) ClearExt

ClearExt clears the value of the "ext" field.

func (*MediaFormatUpdateOne) ClearHash

func (_u *MediaFormatUpdateOne) ClearHash() *MediaFormatUpdateOne

ClearHash clears the value of the "hash" field.

func (*MediaFormatUpdateOne) ClearHeight

func (_u *MediaFormatUpdateOne) ClearHeight() *MediaFormatUpdateOne

ClearHeight clears the value of the "height" field.

func (*MediaFormatUpdateOne) ClearIsURLSigned

func (_u *MediaFormatUpdateOne) ClearIsURLSigned() *MediaFormatUpdateOne

ClearIsURLSigned clears the value of the "is_url_signed" field.

func (*MediaFormatUpdateOne) ClearMedia

func (_u *MediaFormatUpdateOne) ClearMedia() *MediaFormatUpdateOne

ClearMedia clears the "media" edge to the Media entity.

func (*MediaFormatUpdateOne) ClearMediaID

func (_u *MediaFormatUpdateOne) ClearMediaID() *MediaFormatUpdateOne

ClearMediaID clears the value of the "media_id" field.

func (*MediaFormatUpdateOne) ClearMime

func (_u *MediaFormatUpdateOne) ClearMime() *MediaFormatUpdateOne

ClearMime clears the value of the "mime" field.

func (*MediaFormatUpdateOne) ClearPath

func (_u *MediaFormatUpdateOne) ClearPath() *MediaFormatUpdateOne

ClearPath clears the value of the "path" field.

func (*MediaFormatUpdateOne) ClearProviderMetadata

func (_u *MediaFormatUpdateOne) ClearProviderMetadata() *MediaFormatUpdateOne

ClearProviderMetadata clears the value of the "provider_metadata" field.

func (*MediaFormatUpdateOne) ClearPublishedAt

func (_u *MediaFormatUpdateOne) ClearPublishedAt() *MediaFormatUpdateOne

ClearPublishedAt clears the value of the "published_at" field.

func (*MediaFormatUpdateOne) ClearSize

func (_u *MediaFormatUpdateOne) ClearSize() *MediaFormatUpdateOne

ClearSize clears the value of the "size" field.

func (*MediaFormatUpdateOne) ClearSizeInBytes

func (_u *MediaFormatUpdateOne) ClearSizeInBytes() *MediaFormatUpdateOne

ClearSizeInBytes clears the value of the "size_in_bytes" field.

func (*MediaFormatUpdateOne) ClearUpdatedAt

func (_u *MediaFormatUpdateOne) ClearUpdatedAt() *MediaFormatUpdateOne

ClearUpdatedAt clears the value of the "updated_at" field.

func (*MediaFormatUpdateOne) ClearUpdatedByID

func (_u *MediaFormatUpdateOne) ClearUpdatedByID() *MediaFormatUpdateOne

ClearUpdatedByID clears the value of the "updated_by_id" field.

func (*MediaFormatUpdateOne) ClearWidth

func (_u *MediaFormatUpdateOne) ClearWidth() *MediaFormatUpdateOne

ClearWidth clears the value of the "width" field.

func (*MediaFormatUpdateOne) Exec

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

Exec executes the query on the entity.

func (*MediaFormatUpdateOne) ExecX

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

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

func (*MediaFormatUpdateOne) Mutation

func (_u *MediaFormatUpdateOne) Mutation() *MediaFormatMutation

Mutation returns the MediaFormatMutation object of the builder.

func (*MediaFormatUpdateOne) Save

Save executes the query and returns the updated MediaFormat entity.

func (*MediaFormatUpdateOne) SaveX

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

func (*MediaFormatUpdateOne) Select

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

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

func (*MediaFormatUpdateOne) SetArchivedAt

func (_u *MediaFormatUpdateOne) SetArchivedAt(v time.Time) *MediaFormatUpdateOne

SetArchivedAt sets the "archived_at" field.

func (*MediaFormatUpdateOne) SetDeletedAt

func (_u *MediaFormatUpdateOne) SetDeletedAt(v time.Time) *MediaFormatUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*MediaFormatUpdateOne) SetDeletedByID

func (_u *MediaFormatUpdateOne) SetDeletedByID(v uuid.UUID) *MediaFormatUpdateOne

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaFormatUpdateOne) SetExt

SetExt sets the "ext" field.

func (*MediaFormatUpdateOne) SetHash

SetHash sets the "hash" field.

func (*MediaFormatUpdateOne) SetHeight

func (_u *MediaFormatUpdateOne) SetHeight(v int) *MediaFormatUpdateOne

SetHeight sets the "height" field.

func (*MediaFormatUpdateOne) SetIsURLSigned

func (_u *MediaFormatUpdateOne) SetIsURLSigned(v bool) *MediaFormatUpdateOne

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaFormatUpdateOne) SetMedia

SetMedia sets the "media" edge to the Media entity.

func (*MediaFormatUpdateOne) SetMediaID

SetMediaID sets the "media_id" field.

func (*MediaFormatUpdateOne) SetMime

SetMime sets the "mime" field.

func (*MediaFormatUpdateOne) SetName

SetName sets the "name" field.

func (*MediaFormatUpdateOne) SetNillableArchivedAt

func (_u *MediaFormatUpdateOne) SetNillableArchivedAt(v *time.Time) *MediaFormatUpdateOne

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableDeletedAt

func (_u *MediaFormatUpdateOne) SetNillableDeletedAt(v *time.Time) *MediaFormatUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableDeletedByID

func (_u *MediaFormatUpdateOne) SetNillableDeletedByID(v *uuid.UUID) *MediaFormatUpdateOne

SetNillableDeletedByID sets the "deleted_by_id" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableExt

func (_u *MediaFormatUpdateOne) SetNillableExt(v *string) *MediaFormatUpdateOne

SetNillableExt sets the "ext" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableHash

func (_u *MediaFormatUpdateOne) SetNillableHash(v *string) *MediaFormatUpdateOne

SetNillableHash sets the "hash" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableHeight

func (_u *MediaFormatUpdateOne) SetNillableHeight(v *int) *MediaFormatUpdateOne

SetNillableHeight sets the "height" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableIsURLSigned

func (_u *MediaFormatUpdateOne) SetNillableIsURLSigned(v *bool) *MediaFormatUpdateOne

SetNillableIsURLSigned sets the "is_url_signed" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableMediaID

func (_u *MediaFormatUpdateOne) SetNillableMediaID(v *uuid.UUID) *MediaFormatUpdateOne

SetNillableMediaID sets the "media_id" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableMime

func (_u *MediaFormatUpdateOne) SetNillableMime(v *string) *MediaFormatUpdateOne

SetNillableMime sets the "mime" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableName

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

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

func (*MediaFormatUpdateOne) SetNillablePath

func (_u *MediaFormatUpdateOne) SetNillablePath(v *string) *MediaFormatUpdateOne

SetNillablePath sets the "path" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillablePublishedAt

func (_u *MediaFormatUpdateOne) SetNillablePublishedAt(v *time.Time) *MediaFormatUpdateOne

SetNillablePublishedAt sets the "published_at" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableSize

func (_u *MediaFormatUpdateOne) SetNillableSize(v *float64) *MediaFormatUpdateOne

SetNillableSize sets the "size" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableSizeInBytes

func (_u *MediaFormatUpdateOne) SetNillableSizeInBytes(v *int64) *MediaFormatUpdateOne

SetNillableSizeInBytes sets the "size_in_bytes" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableTenantID

func (_u *MediaFormatUpdateOne) SetNillableTenantID(v *string) *MediaFormatUpdateOne

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableURL

func (_u *MediaFormatUpdateOne) SetNillableURL(v *string) *MediaFormatUpdateOne

SetNillableURL sets the "url" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableUpdatedByID

func (_u *MediaFormatUpdateOne) SetNillableUpdatedByID(v *uuid.UUID) *MediaFormatUpdateOne

SetNillableUpdatedByID sets the "updated_by_id" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetNillableWidth

func (_u *MediaFormatUpdateOne) SetNillableWidth(v *int) *MediaFormatUpdateOne

SetNillableWidth sets the "width" field if the given value is not nil.

func (*MediaFormatUpdateOne) SetPath

SetPath sets the "path" field.

func (*MediaFormatUpdateOne) SetProviderMetadata

func (_u *MediaFormatUpdateOne) SetProviderMetadata(v map[string]interface{}) *MediaFormatUpdateOne

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaFormatUpdateOne) SetPublishedAt

func (_u *MediaFormatUpdateOne) SetPublishedAt(v time.Time) *MediaFormatUpdateOne

SetPublishedAt sets the "published_at" field.

func (*MediaFormatUpdateOne) SetSize

SetSize sets the "size" field.

func (*MediaFormatUpdateOne) SetSizeInBytes

func (_u *MediaFormatUpdateOne) SetSizeInBytes(v int64) *MediaFormatUpdateOne

SetSizeInBytes sets the "size_in_bytes" field.

func (*MediaFormatUpdateOne) SetTenantID

func (_u *MediaFormatUpdateOne) SetTenantID(v string) *MediaFormatUpdateOne

SetTenantID sets the "tenant_id" field.

func (*MediaFormatUpdateOne) SetURL

SetURL sets the "url" field.

func (*MediaFormatUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaFormatUpdateOne) SetUpdatedByID

func (_u *MediaFormatUpdateOne) SetUpdatedByID(v uuid.UUID) *MediaFormatUpdateOne

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaFormatUpdateOne) SetWidth

SetWidth sets the "width" field.

func (*MediaFormatUpdateOne) Where

Where appends a list predicates to the MediaFormatUpdate builder.

type MediaFormats

type MediaFormats []*MediaFormat

MediaFormats is a parsable slice of MediaFormat.

type MediaGroupBy

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

MediaGroupBy is the group-by builder for Media entities.

func (*MediaGroupBy) Aggregate

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

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

func (*MediaGroupBy) Bool

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

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

func (*MediaGroupBy) BoolX

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

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

func (*MediaGroupBy) Bools

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

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

func (*MediaGroupBy) BoolsX

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

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

func (*MediaGroupBy) Float64

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

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

func (*MediaGroupBy) Float64X

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

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

func (*MediaGroupBy) Float64s

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

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

func (*MediaGroupBy) Float64sX

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

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

func (*MediaGroupBy) Int

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

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

func (*MediaGroupBy) IntX

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

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

func (*MediaGroupBy) Ints

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

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

func (*MediaGroupBy) IntsX

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

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

func (*MediaGroupBy) Scan

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

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

func (*MediaGroupBy) ScanX

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

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

func (*MediaGroupBy) String

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

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

func (*MediaGroupBy) StringX

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

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

func (*MediaGroupBy) Strings

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

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

func (*MediaGroupBy) StringsX

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

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

type MediaMutation

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

MediaMutation represents an operation that mutates the Media nodes in the graph.

func (*MediaMutation) AddField

func (m *MediaMutation) 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 (*MediaMutation) AddFormatIDs

func (m *MediaMutation) AddFormatIDs(ids ...uuid.UUID)

AddFormatIDs adds the "formats" edge to the MediaFormat entity by ids.

func (*MediaMutation) AddHeight

func (m *MediaMutation) AddHeight(i int)

AddHeight adds i to the "height" field.

func (*MediaMutation) AddSize

func (m *MediaMutation) AddSize(f float64)

AddSize adds f to the "size" field.

func (*MediaMutation) AddWidth

func (m *MediaMutation) AddWidth(i int)

AddWidth adds i to the "width" field.

func (*MediaMutation) AddedEdges

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

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

func (*MediaMutation) AddedField

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

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

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

func (*MediaMutation) AddedHeight

func (m *MediaMutation) AddedHeight() (r int, exists bool)

AddedHeight returns the value that was added to the "height" field in this mutation.

func (*MediaMutation) AddedIDs

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

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

func (*MediaMutation) AddedSize

func (m *MediaMutation) AddedSize() (r float64, exists bool)

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

func (*MediaMutation) AddedWidth

func (m *MediaMutation) AddedWidth() (r int, exists bool)

AddedWidth returns the value that was added to the "width" field in this mutation.

func (*MediaMutation) AlternativeText

func (m *MediaMutation) AlternativeText() (r string, exists bool)

AlternativeText returns the value of the "alternative_text" field in the mutation.

func (*MediaMutation) AlternativeTextCleared

func (m *MediaMutation) AlternativeTextCleared() bool

AlternativeTextCleared returns if the "alternative_text" field was cleared in this mutation.

func (*MediaMutation) ArchivedAt

func (m *MediaMutation) ArchivedAt() (r time.Time, exists bool)

ArchivedAt returns the value of the "archived_at" field in the mutation.

func (*MediaMutation) ArchivedAtCleared

func (m *MediaMutation) ArchivedAtCleared() bool

ArchivedAtCleared returns if the "archived_at" field was cleared in this mutation.

func (*MediaMutation) Caption

func (m *MediaMutation) Caption() (r string, exists bool)

Caption returns the value of the "caption" field in the mutation.

func (*MediaMutation) CaptionCleared

func (m *MediaMutation) CaptionCleared() bool

CaptionCleared returns if the "caption" field was cleared in this mutation.

func (*MediaMutation) ClearAlternativeText

func (m *MediaMutation) ClearAlternativeText()

ClearAlternativeText clears the value of the "alternative_text" field.

func (*MediaMutation) ClearArchivedAt

func (m *MediaMutation) ClearArchivedAt()

ClearArchivedAt clears the value of the "archived_at" field.

func (*MediaMutation) ClearCaption

func (m *MediaMutation) ClearCaption()

ClearCaption clears the value of the "caption" field.

func (*MediaMutation) ClearCreatedAt

func (m *MediaMutation) ClearCreatedAt()

ClearCreatedAt clears the value of the "created_at" field.

func (*MediaMutation) ClearCreatedByID

func (m *MediaMutation) ClearCreatedByID()

ClearCreatedByID clears the value of the "created_by_id" field.

func (*MediaMutation) ClearDeletedAt

func (m *MediaMutation) ClearDeletedAt()

ClearDeletedAt clears the value of the "deleted_at" field.

func (*MediaMutation) ClearDeletedByID

func (m *MediaMutation) ClearDeletedByID()

ClearDeletedByID clears the value of the "deleted_by_id" field.

func (*MediaMutation) ClearEdge

func (m *MediaMutation) 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 (*MediaMutation) ClearExt

func (m *MediaMutation) ClearExt()

ClearExt clears the value of the "ext" field.

func (*MediaMutation) ClearField

func (m *MediaMutation) 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 (*MediaMutation) ClearFolderPath

func (m *MediaMutation) ClearFolderPath()

ClearFolderPath clears the value of the "folder_path" field.

func (*MediaMutation) ClearFormats

func (m *MediaMutation) ClearFormats()

ClearFormats clears the "formats" edge to the MediaFormat entity.

func (*MediaMutation) ClearHash

func (m *MediaMutation) ClearHash()

ClearHash clears the value of the "hash" field.

func (*MediaMutation) ClearHeight

func (m *MediaMutation) ClearHeight()

ClearHeight clears the value of the "height" field.

func (*MediaMutation) ClearIsURLSigned

func (m *MediaMutation) ClearIsURLSigned()

ClearIsURLSigned clears the value of the "is_url_signed" field.

func (*MediaMutation) ClearLocale

func (m *MediaMutation) ClearLocale()

ClearLocale clears the value of the "locale" field.

func (*MediaMutation) ClearMime

func (m *MediaMutation) ClearMime()

ClearMime clears the value of the "mime" field.

func (*MediaMutation) ClearPreviewURL

func (m *MediaMutation) ClearPreviewURL()

ClearPreviewURL clears the value of the "preview_url" field.

func (*MediaMutation) ClearProvider

func (m *MediaMutation) ClearProvider()

ClearProvider clears the value of the "provider" field.

func (*MediaMutation) ClearProviderMetadata

func (m *MediaMutation) ClearProviderMetadata()

ClearProviderMetadata clears the value of the "provider_metadata" field.

func (*MediaMutation) ClearPublishedAt

func (m *MediaMutation) ClearPublishedAt()

ClearPublishedAt clears the value of the "published_at" field.

func (*MediaMutation) ClearSize

func (m *MediaMutation) ClearSize()

ClearSize clears the value of the "size" field.

func (*MediaMutation) ClearUpdatedAt

func (m *MediaMutation) ClearUpdatedAt()

ClearUpdatedAt clears the value of the "updated_at" field.

func (*MediaMutation) ClearUpdatedByID

func (m *MediaMutation) ClearUpdatedByID()

ClearUpdatedByID clears the value of the "updated_by_id" field.

func (*MediaMutation) ClearWidth

func (m *MediaMutation) ClearWidth()

ClearWidth clears the value of the "width" field.

func (*MediaMutation) ClearedEdges

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

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

func (*MediaMutation) ClearedFields

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

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

func (MediaMutation) Client

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

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

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

func (*MediaMutation) CreatedAtCleared

func (m *MediaMutation) CreatedAtCleared() bool

CreatedAtCleared returns if the "created_at" field was cleared in this mutation.

func (*MediaMutation) CreatedByID

func (m *MediaMutation) CreatedByID() (r uuid.UUID, exists bool)

CreatedByID returns the value of the "created_by_id" field in the mutation.

func (*MediaMutation) CreatedByIDCleared

func (m *MediaMutation) CreatedByIDCleared() bool

CreatedByIDCleared returns if the "created_by_id" field was cleared in this mutation.

func (*MediaMutation) DeletedAt

func (m *MediaMutation) DeletedAt() (r time.Time, exists bool)

DeletedAt returns the value of the "deleted_at" field in the mutation.

func (*MediaMutation) DeletedAtCleared

func (m *MediaMutation) DeletedAtCleared() bool

DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.

func (*MediaMutation) DeletedByID

func (m *MediaMutation) DeletedByID() (r uuid.UUID, exists bool)

DeletedByID returns the value of the "deleted_by_id" field in the mutation.

func (*MediaMutation) DeletedByIDCleared

func (m *MediaMutation) DeletedByIDCleared() bool

DeletedByIDCleared returns if the "deleted_by_id" field was cleared in this mutation.

func (*MediaMutation) EdgeCleared

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

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

func (*MediaMutation) Ext

func (m *MediaMutation) Ext() (r string, exists bool)

Ext returns the value of the "ext" field in the mutation.

func (*MediaMutation) ExtCleared

func (m *MediaMutation) ExtCleared() bool

ExtCleared returns if the "ext" field was cleared in this mutation.

func (*MediaMutation) Field

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

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

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

func (*MediaMutation) Fields

func (m *MediaMutation) 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 (*MediaMutation) FolderPath

func (m *MediaMutation) FolderPath() (r string, exists bool)

FolderPath returns the value of the "folder_path" field in the mutation.

func (*MediaMutation) FolderPathCleared

func (m *MediaMutation) FolderPathCleared() bool

FolderPathCleared returns if the "folder_path" field was cleared in this mutation.

func (*MediaMutation) FormatsCleared

func (m *MediaMutation) FormatsCleared() bool

FormatsCleared reports if the "formats" edge to the MediaFormat entity was cleared.

func (*MediaMutation) FormatsIDs

func (m *MediaMutation) FormatsIDs() (ids []uuid.UUID)

FormatsIDs returns the "formats" edge IDs in the mutation.

func (*MediaMutation) Hash

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

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

func (*MediaMutation) HashCleared

func (m *MediaMutation) HashCleared() bool

HashCleared returns if the "hash" field was cleared in this mutation.

func (*MediaMutation) Height

func (m *MediaMutation) Height() (r int, exists bool)

Height returns the value of the "height" field in the mutation.

func (*MediaMutation) HeightCleared

func (m *MediaMutation) HeightCleared() bool

HeightCleared returns if the "height" field was cleared in this mutation.

func (*MediaMutation) ID

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

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

func (*MediaMutation) IDs

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

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

func (*MediaMutation) IsURLSigned

func (m *MediaMutation) IsURLSigned() (r bool, exists bool)

IsURLSigned returns the value of the "is_url_signed" field in the mutation.

func (*MediaMutation) IsURLSignedCleared

func (m *MediaMutation) IsURLSignedCleared() bool

IsURLSignedCleared returns if the "is_url_signed" field was cleared in this mutation.

func (*MediaMutation) Locale

func (m *MediaMutation) Locale() (r string, exists bool)

Locale returns the value of the "locale" field in the mutation.

func (*MediaMutation) LocaleCleared

func (m *MediaMutation) LocaleCleared() bool

LocaleCleared returns if the "locale" field was cleared in this mutation.

func (*MediaMutation) Mime

func (m *MediaMutation) Mime() (r string, exists bool)

Mime returns the value of the "mime" field in the mutation.

func (*MediaMutation) MimeCleared

func (m *MediaMutation) MimeCleared() bool

MimeCleared returns if the "mime" field was cleared in this mutation.

func (*MediaMutation) Name

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

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

func (*MediaMutation) OldAlternativeText

func (m *MediaMutation) OldAlternativeText(ctx context.Context) (v *string, err error)

OldAlternativeText returns the old "alternative_text" field's value of the Media entity. If the Media 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 (*MediaMutation) OldArchivedAt

func (m *MediaMutation) OldArchivedAt(ctx context.Context) (v time.Time, err error)

OldArchivedAt returns the old "archived_at" field's value of the Media entity. If the Media 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 (*MediaMutation) OldCaption

func (m *MediaMutation) OldCaption(ctx context.Context) (v *string, err error)

OldCaption returns the old "caption" field's value of the Media entity. If the Media 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 (*MediaMutation) OldCreatedAt

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

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

func (m *MediaMutation) OldCreatedByID(ctx context.Context) (v uuid.UUID, err error)

OldCreatedByID returns the old "created_by_id" field's value of the Media entity. If the Media 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 (*MediaMutation) OldDeletedAt

func (m *MediaMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error)

OldDeletedAt returns the old "deleted_at" field's value of the Media entity. If the Media 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 (*MediaMutation) OldDeletedByID

func (m *MediaMutation) OldDeletedByID(ctx context.Context) (v uuid.UUID, err error)

OldDeletedByID returns the old "deleted_by_id" field's value of the Media entity. If the Media 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 (*MediaMutation) OldExt

func (m *MediaMutation) OldExt(ctx context.Context) (v *string, err error)

OldExt returns the old "ext" field's value of the Media entity. If the Media 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 (*MediaMutation) OldField

func (m *MediaMutation) 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 (*MediaMutation) OldFolderPath

func (m *MediaMutation) OldFolderPath(ctx context.Context) (v *string, err error)

OldFolderPath returns the old "folder_path" field's value of the Media entity. If the Media 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 (*MediaMutation) OldHash

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

OldHash returns the old "hash" field's value of the Media entity. If the Media 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 (*MediaMutation) OldHeight

func (m *MediaMutation) OldHeight(ctx context.Context) (v *int, err error)

OldHeight returns the old "height" field's value of the Media entity. If the Media 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 (*MediaMutation) OldIsURLSigned

func (m *MediaMutation) OldIsURLSigned(ctx context.Context) (v *bool, err error)

OldIsURLSigned returns the old "is_url_signed" field's value of the Media entity. If the Media 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 (*MediaMutation) OldLocale

func (m *MediaMutation) OldLocale(ctx context.Context) (v *string, err error)

OldLocale returns the old "locale" field's value of the Media entity. If the Media 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 (*MediaMutation) OldMime

func (m *MediaMutation) OldMime(ctx context.Context) (v *string, err error)

OldMime returns the old "mime" field's value of the Media entity. If the Media 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 (*MediaMutation) OldName

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

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

func (m *MediaMutation) OldPreviewURL(ctx context.Context) (v *string, err error)

OldPreviewURL returns the old "preview_url" field's value of the Media entity. If the Media 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 (*MediaMutation) OldProvider

func (m *MediaMutation) OldProvider(ctx context.Context) (v *string, err error)

OldProvider returns the old "provider" field's value of the Media entity. If the Media 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 (*MediaMutation) OldProviderMetadata

func (m *MediaMutation) OldProviderMetadata(ctx context.Context) (v map[string]interface{}, err error)

OldProviderMetadata returns the old "provider_metadata" field's value of the Media entity. If the Media 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 (*MediaMutation) OldPublishedAt

func (m *MediaMutation) OldPublishedAt(ctx context.Context) (v time.Time, err error)

OldPublishedAt returns the old "published_at" field's value of the Media entity. If the Media 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 (*MediaMutation) OldSize

func (m *MediaMutation) OldSize(ctx context.Context) (v *float64, err error)

OldSize returns the old "size" field's value of the Media entity. If the Media 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 (*MediaMutation) OldTenantID

func (m *MediaMutation) OldTenantID(ctx context.Context) (v string, err error)

OldTenantID returns the old "tenant_id" field's value of the Media entity. If the Media 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 (*MediaMutation) OldURL

func (m *MediaMutation) OldURL(ctx context.Context) (v string, err error)

OldURL returns the old "url" field's value of the Media entity. If the Media 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 (*MediaMutation) OldUpdatedAt

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

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

func (m *MediaMutation) OldUpdatedByID(ctx context.Context) (v uuid.UUID, err error)

OldUpdatedByID returns the old "updated_by_id" field's value of the Media entity. If the Media 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 (*MediaMutation) OldWidth

func (m *MediaMutation) OldWidth(ctx context.Context) (v *int, err error)

OldWidth returns the old "width" field's value of the Media entity. If the Media 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 (*MediaMutation) Op

func (m *MediaMutation) Op() Op

Op returns the operation name.

func (*MediaMutation) PreviewURL

func (m *MediaMutation) PreviewURL() (r string, exists bool)

PreviewURL returns the value of the "preview_url" field in the mutation.

func (*MediaMutation) PreviewURLCleared

func (m *MediaMutation) PreviewURLCleared() bool

PreviewURLCleared returns if the "preview_url" field was cleared in this mutation.

func (*MediaMutation) Provider

func (m *MediaMutation) Provider() (r string, exists bool)

Provider returns the value of the "provider" field in the mutation.

func (*MediaMutation) ProviderCleared

func (m *MediaMutation) ProviderCleared() bool

ProviderCleared returns if the "provider" field was cleared in this mutation.

func (*MediaMutation) ProviderMetadata

func (m *MediaMutation) ProviderMetadata() (r map[string]interface{}, exists bool)

ProviderMetadata returns the value of the "provider_metadata" field in the mutation.

func (*MediaMutation) ProviderMetadataCleared

func (m *MediaMutation) ProviderMetadataCleared() bool

ProviderMetadataCleared returns if the "provider_metadata" field was cleared in this mutation.

func (*MediaMutation) PublishedAt

func (m *MediaMutation) PublishedAt() (r time.Time, exists bool)

PublishedAt returns the value of the "published_at" field in the mutation.

func (*MediaMutation) PublishedAtCleared

func (m *MediaMutation) PublishedAtCleared() bool

PublishedAtCleared returns if the "published_at" field was cleared in this mutation.

func (*MediaMutation) RemoveFormatIDs

func (m *MediaMutation) RemoveFormatIDs(ids ...uuid.UUID)

RemoveFormatIDs removes the "formats" edge to the MediaFormat entity by IDs.

func (*MediaMutation) RemovedEdges

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

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

func (*MediaMutation) RemovedFormatsIDs

func (m *MediaMutation) RemovedFormatsIDs() (ids []uuid.UUID)

RemovedFormats returns the removed IDs of the "formats" edge to the MediaFormat entity.

func (*MediaMutation) RemovedIDs

func (m *MediaMutation) 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 (*MediaMutation) ResetAlternativeText

func (m *MediaMutation) ResetAlternativeText()

ResetAlternativeText resets all changes to the "alternative_text" field.

func (*MediaMutation) ResetArchivedAt

func (m *MediaMutation) ResetArchivedAt()

ResetArchivedAt resets all changes to the "archived_at" field.

func (*MediaMutation) ResetCaption

func (m *MediaMutation) ResetCaption()

ResetCaption resets all changes to the "caption" field.

func (*MediaMutation) ResetCreatedAt

func (m *MediaMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*MediaMutation) ResetCreatedByID

func (m *MediaMutation) ResetCreatedByID()

ResetCreatedByID resets all changes to the "created_by_id" field.

func (*MediaMutation) ResetDeletedAt

func (m *MediaMutation) ResetDeletedAt()

ResetDeletedAt resets all changes to the "deleted_at" field.

func (*MediaMutation) ResetDeletedByID

func (m *MediaMutation) ResetDeletedByID()

ResetDeletedByID resets all changes to the "deleted_by_id" field.

func (*MediaMutation) ResetEdge

func (m *MediaMutation) 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 (*MediaMutation) ResetExt

func (m *MediaMutation) ResetExt()

ResetExt resets all changes to the "ext" field.

func (*MediaMutation) ResetField

func (m *MediaMutation) 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 (*MediaMutation) ResetFolderPath

func (m *MediaMutation) ResetFolderPath()

ResetFolderPath resets all changes to the "folder_path" field.

func (*MediaMutation) ResetFormats

func (m *MediaMutation) ResetFormats()

ResetFormats resets all changes to the "formats" edge.

func (*MediaMutation) ResetHash

func (m *MediaMutation) ResetHash()

ResetHash resets all changes to the "hash" field.

func (*MediaMutation) ResetHeight

func (m *MediaMutation) ResetHeight()

ResetHeight resets all changes to the "height" field.

func (*MediaMutation) ResetIsURLSigned

func (m *MediaMutation) ResetIsURLSigned()

ResetIsURLSigned resets all changes to the "is_url_signed" field.

func (*MediaMutation) ResetLocale

func (m *MediaMutation) ResetLocale()

ResetLocale resets all changes to the "locale" field.

func (*MediaMutation) ResetMime

func (m *MediaMutation) ResetMime()

ResetMime resets all changes to the "mime" field.

func (*MediaMutation) ResetName

func (m *MediaMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*MediaMutation) ResetPreviewURL

func (m *MediaMutation) ResetPreviewURL()

ResetPreviewURL resets all changes to the "preview_url" field.

func (*MediaMutation) ResetProvider

func (m *MediaMutation) ResetProvider()

ResetProvider resets all changes to the "provider" field.

func (*MediaMutation) ResetProviderMetadata

func (m *MediaMutation) ResetProviderMetadata()

ResetProviderMetadata resets all changes to the "provider_metadata" field.

func (*MediaMutation) ResetPublishedAt

func (m *MediaMutation) ResetPublishedAt()

ResetPublishedAt resets all changes to the "published_at" field.

func (*MediaMutation) ResetSize

func (m *MediaMutation) ResetSize()

ResetSize resets all changes to the "size" field.

func (*MediaMutation) ResetTenantID

func (m *MediaMutation) ResetTenantID()

ResetTenantID resets all changes to the "tenant_id" field.

func (*MediaMutation) ResetURL

func (m *MediaMutation) ResetURL()

ResetURL resets all changes to the "url" field.

func (*MediaMutation) ResetUpdatedAt

func (m *MediaMutation) ResetUpdatedAt()

ResetUpdatedAt resets all changes to the "updated_at" field.

func (*MediaMutation) ResetUpdatedByID

func (m *MediaMutation) ResetUpdatedByID()

ResetUpdatedByID resets all changes to the "updated_by_id" field.

func (*MediaMutation) ResetWidth

func (m *MediaMutation) ResetWidth()

ResetWidth resets all changes to the "width" field.

func (*MediaMutation) SetAlternativeText

func (m *MediaMutation) SetAlternativeText(s string)

SetAlternativeText sets the "alternative_text" field.

func (*MediaMutation) SetArchivedAt

func (m *MediaMutation) SetArchivedAt(t time.Time)

SetArchivedAt sets the "archived_at" field.

func (*MediaMutation) SetCaption

func (m *MediaMutation) SetCaption(s string)

SetCaption sets the "caption" field.

func (*MediaMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*MediaMutation) SetCreatedByID

func (m *MediaMutation) SetCreatedByID(u uuid.UUID)

SetCreatedByID sets the "created_by_id" field.

func (*MediaMutation) SetDeletedAt

func (m *MediaMutation) SetDeletedAt(t time.Time)

SetDeletedAt sets the "deleted_at" field.

func (*MediaMutation) SetDeletedByID

func (m *MediaMutation) SetDeletedByID(u uuid.UUID)

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaMutation) SetExt

func (m *MediaMutation) SetExt(s string)

SetExt sets the "ext" field.

func (*MediaMutation) SetField

func (m *MediaMutation) 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 (*MediaMutation) SetFolderPath

func (m *MediaMutation) SetFolderPath(s string)

SetFolderPath sets the "folder_path" field.

func (*MediaMutation) SetHash

func (m *MediaMutation) SetHash(s string)

SetHash sets the "hash" field.

func (*MediaMutation) SetHeight

func (m *MediaMutation) SetHeight(i int)

SetHeight sets the "height" field.

func (*MediaMutation) SetID

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

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

func (*MediaMutation) SetIsURLSigned

func (m *MediaMutation) SetIsURLSigned(b bool)

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaMutation) SetLocale

func (m *MediaMutation) SetLocale(s string)

SetLocale sets the "locale" field.

func (*MediaMutation) SetMime

func (m *MediaMutation) SetMime(s string)

SetMime sets the "mime" field.

func (*MediaMutation) SetName

func (m *MediaMutation) SetName(s string)

SetName sets the "name" field.

func (*MediaMutation) SetOp

func (m *MediaMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*MediaMutation) SetPreviewURL

func (m *MediaMutation) SetPreviewURL(s string)

SetPreviewURL sets the "preview_url" field.

func (*MediaMutation) SetProvider

func (m *MediaMutation) SetProvider(s string)

SetProvider sets the "provider" field.

func (*MediaMutation) SetProviderMetadata

func (m *MediaMutation) SetProviderMetadata(value map[string]interface{})

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaMutation) SetPublishedAt

func (m *MediaMutation) SetPublishedAt(t time.Time)

SetPublishedAt sets the "published_at" field.

func (*MediaMutation) SetSize

func (m *MediaMutation) SetSize(f float64)

SetSize sets the "size" field.

func (*MediaMutation) SetTenantID

func (m *MediaMutation) SetTenantID(s string)

SetTenantID sets the "tenant_id" field.

func (*MediaMutation) SetURL

func (m *MediaMutation) SetURL(s string)

SetURL sets the "url" field.

func (*MediaMutation) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaMutation) SetUpdatedByID

func (m *MediaMutation) SetUpdatedByID(u uuid.UUID)

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaMutation) SetWidth

func (m *MediaMutation) SetWidth(i int)

SetWidth sets the "width" field.

func (*MediaMutation) Size

func (m *MediaMutation) Size() (r float64, exists bool)

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

func (*MediaMutation) SizeCleared

func (m *MediaMutation) SizeCleared() bool

SizeCleared returns if the "size" field was cleared in this mutation.

func (*MediaMutation) TenantID

func (m *MediaMutation) TenantID() (r string, exists bool)

TenantID returns the value of the "tenant_id" field in the mutation.

func (MediaMutation) Tx

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

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

func (*MediaMutation) Type

func (m *MediaMutation) Type() string

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

func (*MediaMutation) URL

func (m *MediaMutation) URL() (r string, exists bool)

URL returns the value of the "url" field in the mutation.

func (*MediaMutation) UpdatedAt

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

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

func (*MediaMutation) UpdatedAtCleared

func (m *MediaMutation) UpdatedAtCleared() bool

UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.

func (*MediaMutation) UpdatedByID

func (m *MediaMutation) UpdatedByID() (r uuid.UUID, exists bool)

UpdatedByID returns the value of the "updated_by_id" field in the mutation.

func (*MediaMutation) UpdatedByIDCleared

func (m *MediaMutation) UpdatedByIDCleared() bool

UpdatedByIDCleared returns if the "updated_by_id" field was cleared in this mutation.

func (*MediaMutation) Where

func (m *MediaMutation) Where(ps ...predicate.Media)

Where appends a list predicates to the MediaMutation builder.

func (*MediaMutation) WhereP

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

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

func (*MediaMutation) Width

func (m *MediaMutation) Width() (r int, exists bool)

Width returns the value of the "width" field in the mutation.

func (*MediaMutation) WidthCleared

func (m *MediaMutation) WidthCleared() bool

WidthCleared returns if the "width" field was cleared in this mutation.

type MediaQuery

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

MediaQuery is the builder for querying Media entities.

func (*MediaQuery) Aggregate

func (_q *MediaQuery) Aggregate(fns ...AggregateFunc) *MediaSelect

Aggregate returns a MediaSelect configured with the given aggregations.

func (*MediaQuery) All

func (_q *MediaQuery) All(ctx context.Context) ([]*Media, error)

All executes the query and returns a list of MediaSlice.

func (*MediaQuery) AllX

func (_q *MediaQuery) AllX(ctx context.Context) []*Media

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

func (*MediaQuery) Clone

func (_q *MediaQuery) Clone() *MediaQuery

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

func (*MediaQuery) Count

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

Count returns the count of the given query.

func (*MediaQuery) CountX

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

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

func (*MediaQuery) Exist

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

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

func (*MediaQuery) ExistX

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

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

func (*MediaQuery) First

func (_q *MediaQuery) First(ctx context.Context) (*Media, error)

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

func (*MediaQuery) FirstID

func (_q *MediaQuery) FirstID(ctx context.Context) (id uuid.UUID, err error)

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

func (*MediaQuery) FirstIDX

func (_q *MediaQuery) FirstIDX(ctx context.Context) uuid.UUID

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

func (*MediaQuery) FirstX

func (_q *MediaQuery) FirstX(ctx context.Context) *Media

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

func (*MediaQuery) GroupBy

func (_q *MediaQuery) GroupBy(field string, fields ...string) *MediaGroupBy

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

client.Media.Query().
	GroupBy(media.FieldTenantID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*MediaQuery) IDs

func (_q *MediaQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error)

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

func (*MediaQuery) IDsX

func (_q *MediaQuery) IDsX(ctx context.Context) []uuid.UUID

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

func (*MediaQuery) Limit

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

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

func (*MediaQuery) Offset

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

Offset to start from.

func (*MediaQuery) Only

func (_q *MediaQuery) Only(ctx context.Context) (*Media, error)

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

func (*MediaQuery) OnlyID

func (_q *MediaQuery) OnlyID(ctx context.Context) (id uuid.UUID, err error)

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

func (*MediaQuery) OnlyIDX

func (_q *MediaQuery) OnlyIDX(ctx context.Context) uuid.UUID

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

func (*MediaQuery) OnlyX

func (_q *MediaQuery) OnlyX(ctx context.Context) *Media

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

func (*MediaQuery) Order

func (_q *MediaQuery) Order(o ...media.OrderOption) *MediaQuery

Order specifies how the records should be ordered.

func (*MediaQuery) QueryFormats

func (_q *MediaQuery) QueryFormats() *MediaFormatQuery

QueryFormats chains the current query on the "formats" edge.

func (*MediaQuery) Select

func (_q *MediaQuery) Select(fields ...string) *MediaSelect

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

client.Media.Query().
	Select(media.FieldTenantID).
	Scan(ctx, &v)

func (*MediaQuery) Unique

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

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

func (_q *MediaQuery) Where(ps ...predicate.Media) *MediaQuery

Where adds a new predicate for the MediaQuery builder.

func (*MediaQuery) WithFormats

func (_q *MediaQuery) WithFormats(opts ...func(*MediaFormatQuery)) *MediaQuery

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

type MediaSelect

type MediaSelect struct {
	*MediaQuery
	// contains filtered or unexported fields
}

MediaSelect is the builder for selecting fields of Media entities.

func (*MediaSelect) Aggregate

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

Aggregate adds the given aggregation functions to the selector query.

func (*MediaSelect) Bool

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

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

func (*MediaSelect) BoolX

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

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

func (*MediaSelect) Bools

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

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

func (*MediaSelect) BoolsX

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

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

func (*MediaSelect) Float64

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

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

func (*MediaSelect) Float64X

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

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

func (*MediaSelect) Float64s

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

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

func (*MediaSelect) Float64sX

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

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

func (*MediaSelect) Int

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

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

func (*MediaSelect) IntX

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

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

func (*MediaSelect) Ints

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

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

func (*MediaSelect) IntsX

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

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

func (*MediaSelect) Scan

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

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

func (*MediaSelect) ScanX

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

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

func (*MediaSelect) String

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

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

func (*MediaSelect) StringX

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

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

func (*MediaSelect) Strings

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

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

func (*MediaSelect) StringsX

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

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

type MediaSlice

type MediaSlice []*Media

MediaSlice is a parsable slice of Media.

type MediaUpdate

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

MediaUpdate is the builder for updating Media entities.

func (*MediaUpdate) AddFormatIDs

func (_u *MediaUpdate) AddFormatIDs(ids ...uuid.UUID) *MediaUpdate

AddFormatIDs adds the "formats" edge to the MediaFormat entity by IDs.

func (*MediaUpdate) AddFormats

func (_u *MediaUpdate) AddFormats(v ...*MediaFormat) *MediaUpdate

AddFormats adds the "formats" edges to the MediaFormat entity.

func (*MediaUpdate) AddHeight

func (_u *MediaUpdate) AddHeight(v int) *MediaUpdate

AddHeight adds value to the "height" field.

func (*MediaUpdate) AddSize

func (_u *MediaUpdate) AddSize(v float64) *MediaUpdate

AddSize adds value to the "size" field.

func (*MediaUpdate) AddWidth

func (_u *MediaUpdate) AddWidth(v int) *MediaUpdate

AddWidth adds value to the "width" field.

func (*MediaUpdate) ClearAlternativeText

func (_u *MediaUpdate) ClearAlternativeText() *MediaUpdate

ClearAlternativeText clears the value of the "alternative_text" field.

func (*MediaUpdate) ClearArchivedAt

func (_u *MediaUpdate) ClearArchivedAt() *MediaUpdate

ClearArchivedAt clears the value of the "archived_at" field.

func (*MediaUpdate) ClearCaption

func (_u *MediaUpdate) ClearCaption() *MediaUpdate

ClearCaption clears the value of the "caption" field.

func (*MediaUpdate) ClearDeletedAt

func (_u *MediaUpdate) ClearDeletedAt() *MediaUpdate

ClearDeletedAt clears the value of the "deleted_at" field.

func (*MediaUpdate) ClearDeletedByID

func (_u *MediaUpdate) ClearDeletedByID() *MediaUpdate

ClearDeletedByID clears the value of the "deleted_by_id" field.

func (*MediaUpdate) ClearExt

func (_u *MediaUpdate) ClearExt() *MediaUpdate

ClearExt clears the value of the "ext" field.

func (*MediaUpdate) ClearFolderPath

func (_u *MediaUpdate) ClearFolderPath() *MediaUpdate

ClearFolderPath clears the value of the "folder_path" field.

func (*MediaUpdate) ClearFormats

func (_u *MediaUpdate) ClearFormats() *MediaUpdate

ClearFormats clears all "formats" edges to the MediaFormat entity.

func (*MediaUpdate) ClearHash

func (_u *MediaUpdate) ClearHash() *MediaUpdate

ClearHash clears the value of the "hash" field.

func (*MediaUpdate) ClearHeight

func (_u *MediaUpdate) ClearHeight() *MediaUpdate

ClearHeight clears the value of the "height" field.

func (*MediaUpdate) ClearIsURLSigned

func (_u *MediaUpdate) ClearIsURLSigned() *MediaUpdate

ClearIsURLSigned clears the value of the "is_url_signed" field.

func (*MediaUpdate) ClearLocale

func (_u *MediaUpdate) ClearLocale() *MediaUpdate

ClearLocale clears the value of the "locale" field.

func (*MediaUpdate) ClearMime

func (_u *MediaUpdate) ClearMime() *MediaUpdate

ClearMime clears the value of the "mime" field.

func (*MediaUpdate) ClearPreviewURL

func (_u *MediaUpdate) ClearPreviewURL() *MediaUpdate

ClearPreviewURL clears the value of the "preview_url" field.

func (*MediaUpdate) ClearProvider

func (_u *MediaUpdate) ClearProvider() *MediaUpdate

ClearProvider clears the value of the "provider" field.

func (*MediaUpdate) ClearProviderMetadata

func (_u *MediaUpdate) ClearProviderMetadata() *MediaUpdate

ClearProviderMetadata clears the value of the "provider_metadata" field.

func (*MediaUpdate) ClearPublishedAt

func (_u *MediaUpdate) ClearPublishedAt() *MediaUpdate

ClearPublishedAt clears the value of the "published_at" field.

func (*MediaUpdate) ClearSize

func (_u *MediaUpdate) ClearSize() *MediaUpdate

ClearSize clears the value of the "size" field.

func (*MediaUpdate) ClearUpdatedAt

func (_u *MediaUpdate) ClearUpdatedAt() *MediaUpdate

ClearUpdatedAt clears the value of the "updated_at" field.

func (*MediaUpdate) ClearUpdatedByID

func (_u *MediaUpdate) ClearUpdatedByID() *MediaUpdate

ClearUpdatedByID clears the value of the "updated_by_id" field.

func (*MediaUpdate) ClearWidth

func (_u *MediaUpdate) ClearWidth() *MediaUpdate

ClearWidth clears the value of the "width" field.

func (*MediaUpdate) Exec

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

Exec executes the query.

func (*MediaUpdate) ExecX

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

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

func (*MediaUpdate) Mutation

func (_u *MediaUpdate) Mutation() *MediaMutation

Mutation returns the MediaMutation object of the builder.

func (*MediaUpdate) RemoveFormatIDs

func (_u *MediaUpdate) RemoveFormatIDs(ids ...uuid.UUID) *MediaUpdate

RemoveFormatIDs removes the "formats" edge to MediaFormat entities by IDs.

func (*MediaUpdate) RemoveFormats

func (_u *MediaUpdate) RemoveFormats(v ...*MediaFormat) *MediaUpdate

RemoveFormats removes "formats" edges to MediaFormat entities.

func (*MediaUpdate) Save

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

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

func (*MediaUpdate) SaveX

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

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

func (*MediaUpdate) SetAlternativeText

func (_u *MediaUpdate) SetAlternativeText(v string) *MediaUpdate

SetAlternativeText sets the "alternative_text" field.

func (*MediaUpdate) SetArchivedAt

func (_u *MediaUpdate) SetArchivedAt(v time.Time) *MediaUpdate

SetArchivedAt sets the "archived_at" field.

func (*MediaUpdate) SetCaption

func (_u *MediaUpdate) SetCaption(v string) *MediaUpdate

SetCaption sets the "caption" field.

func (*MediaUpdate) SetDeletedAt

func (_u *MediaUpdate) SetDeletedAt(v time.Time) *MediaUpdate

SetDeletedAt sets the "deleted_at" field.

func (*MediaUpdate) SetDeletedByID

func (_u *MediaUpdate) SetDeletedByID(v uuid.UUID) *MediaUpdate

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaUpdate) SetExt

func (_u *MediaUpdate) SetExt(v string) *MediaUpdate

SetExt sets the "ext" field.

func (*MediaUpdate) SetFolderPath

func (_u *MediaUpdate) SetFolderPath(v string) *MediaUpdate

SetFolderPath sets the "folder_path" field.

func (*MediaUpdate) SetHash

func (_u *MediaUpdate) SetHash(v string) *MediaUpdate

SetHash sets the "hash" field.

func (*MediaUpdate) SetHeight

func (_u *MediaUpdate) SetHeight(v int) *MediaUpdate

SetHeight sets the "height" field.

func (*MediaUpdate) SetIsURLSigned

func (_u *MediaUpdate) SetIsURLSigned(v bool) *MediaUpdate

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaUpdate) SetLocale

func (_u *MediaUpdate) SetLocale(v string) *MediaUpdate

SetLocale sets the "locale" field.

func (*MediaUpdate) SetMime

func (_u *MediaUpdate) SetMime(v string) *MediaUpdate

SetMime sets the "mime" field.

func (*MediaUpdate) SetName

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

SetName sets the "name" field.

func (*MediaUpdate) SetNillableAlternativeText

func (_u *MediaUpdate) SetNillableAlternativeText(v *string) *MediaUpdate

SetNillableAlternativeText sets the "alternative_text" field if the given value is not nil.

func (*MediaUpdate) SetNillableArchivedAt

func (_u *MediaUpdate) SetNillableArchivedAt(v *time.Time) *MediaUpdate

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*MediaUpdate) SetNillableCaption

func (_u *MediaUpdate) SetNillableCaption(v *string) *MediaUpdate

SetNillableCaption sets the "caption" field if the given value is not nil.

func (*MediaUpdate) SetNillableDeletedAt

func (_u *MediaUpdate) SetNillableDeletedAt(v *time.Time) *MediaUpdate

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*MediaUpdate) SetNillableDeletedByID

func (_u *MediaUpdate) SetNillableDeletedByID(v *uuid.UUID) *MediaUpdate

SetNillableDeletedByID sets the "deleted_by_id" field if the given value is not nil.

func (*MediaUpdate) SetNillableExt

func (_u *MediaUpdate) SetNillableExt(v *string) *MediaUpdate

SetNillableExt sets the "ext" field if the given value is not nil.

func (*MediaUpdate) SetNillableFolderPath

func (_u *MediaUpdate) SetNillableFolderPath(v *string) *MediaUpdate

SetNillableFolderPath sets the "folder_path" field if the given value is not nil.

func (*MediaUpdate) SetNillableHash

func (_u *MediaUpdate) SetNillableHash(v *string) *MediaUpdate

SetNillableHash sets the "hash" field if the given value is not nil.

func (*MediaUpdate) SetNillableHeight

func (_u *MediaUpdate) SetNillableHeight(v *int) *MediaUpdate

SetNillableHeight sets the "height" field if the given value is not nil.

func (*MediaUpdate) SetNillableIsURLSigned

func (_u *MediaUpdate) SetNillableIsURLSigned(v *bool) *MediaUpdate

SetNillableIsURLSigned sets the "is_url_signed" field if the given value is not nil.

func (*MediaUpdate) SetNillableLocale

func (_u *MediaUpdate) SetNillableLocale(v *string) *MediaUpdate

SetNillableLocale sets the "locale" field if the given value is not nil.

func (*MediaUpdate) SetNillableMime

func (_u *MediaUpdate) SetNillableMime(v *string) *MediaUpdate

SetNillableMime sets the "mime" field if the given value is not nil.

func (*MediaUpdate) SetNillableName

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

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

func (*MediaUpdate) SetNillablePreviewURL

func (_u *MediaUpdate) SetNillablePreviewURL(v *string) *MediaUpdate

SetNillablePreviewURL sets the "preview_url" field if the given value is not nil.

func (*MediaUpdate) SetNillableProvider

func (_u *MediaUpdate) SetNillableProvider(v *string) *MediaUpdate

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*MediaUpdate) SetNillablePublishedAt

func (_u *MediaUpdate) SetNillablePublishedAt(v *time.Time) *MediaUpdate

SetNillablePublishedAt sets the "published_at" field if the given value is not nil.

func (*MediaUpdate) SetNillableSize

func (_u *MediaUpdate) SetNillableSize(v *float64) *MediaUpdate

SetNillableSize sets the "size" field if the given value is not nil.

func (*MediaUpdate) SetNillableTenantID

func (_u *MediaUpdate) SetNillableTenantID(v *string) *MediaUpdate

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*MediaUpdate) SetNillableURL

func (_u *MediaUpdate) SetNillableURL(v *string) *MediaUpdate

SetNillableURL sets the "url" field if the given value is not nil.

func (*MediaUpdate) SetNillableUpdatedByID

func (_u *MediaUpdate) SetNillableUpdatedByID(v *uuid.UUID) *MediaUpdate

SetNillableUpdatedByID sets the "updated_by_id" field if the given value is not nil.

func (*MediaUpdate) SetNillableWidth

func (_u *MediaUpdate) SetNillableWidth(v *int) *MediaUpdate

SetNillableWidth sets the "width" field if the given value is not nil.

func (*MediaUpdate) SetPreviewURL

func (_u *MediaUpdate) SetPreviewURL(v string) *MediaUpdate

SetPreviewURL sets the "preview_url" field.

func (*MediaUpdate) SetProvider

func (_u *MediaUpdate) SetProvider(v string) *MediaUpdate

SetProvider sets the "provider" field.

func (*MediaUpdate) SetProviderMetadata

func (_u *MediaUpdate) SetProviderMetadata(v map[string]interface{}) *MediaUpdate

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaUpdate) SetPublishedAt

func (_u *MediaUpdate) SetPublishedAt(v time.Time) *MediaUpdate

SetPublishedAt sets the "published_at" field.

func (*MediaUpdate) SetSize

func (_u *MediaUpdate) SetSize(v float64) *MediaUpdate

SetSize sets the "size" field.

func (*MediaUpdate) SetTenantID

func (_u *MediaUpdate) SetTenantID(v string) *MediaUpdate

SetTenantID sets the "tenant_id" field.

func (*MediaUpdate) SetURL

func (_u *MediaUpdate) SetURL(v string) *MediaUpdate

SetURL sets the "url" field.

func (*MediaUpdate) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaUpdate) SetUpdatedByID

func (_u *MediaUpdate) SetUpdatedByID(v uuid.UUID) *MediaUpdate

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaUpdate) SetWidth

func (_u *MediaUpdate) SetWidth(v int) *MediaUpdate

SetWidth sets the "width" field.

func (*MediaUpdate) Where

func (_u *MediaUpdate) Where(ps ...predicate.Media) *MediaUpdate

Where appends a list predicates to the MediaUpdate builder.

type MediaUpdateOne

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

MediaUpdateOne is the builder for updating a single Media entity.

func (*MediaUpdateOne) AddFormatIDs

func (_u *MediaUpdateOne) AddFormatIDs(ids ...uuid.UUID) *MediaUpdateOne

AddFormatIDs adds the "formats" edge to the MediaFormat entity by IDs.

func (*MediaUpdateOne) AddFormats

func (_u *MediaUpdateOne) AddFormats(v ...*MediaFormat) *MediaUpdateOne

AddFormats adds the "formats" edges to the MediaFormat entity.

func (*MediaUpdateOne) AddHeight

func (_u *MediaUpdateOne) AddHeight(v int) *MediaUpdateOne

AddHeight adds value to the "height" field.

func (*MediaUpdateOne) AddSize

func (_u *MediaUpdateOne) AddSize(v float64) *MediaUpdateOne

AddSize adds value to the "size" field.

func (*MediaUpdateOne) AddWidth

func (_u *MediaUpdateOne) AddWidth(v int) *MediaUpdateOne

AddWidth adds value to the "width" field.

func (*MediaUpdateOne) ClearAlternativeText

func (_u *MediaUpdateOne) ClearAlternativeText() *MediaUpdateOne

ClearAlternativeText clears the value of the "alternative_text" field.

func (*MediaUpdateOne) ClearArchivedAt

func (_u *MediaUpdateOne) ClearArchivedAt() *MediaUpdateOne

ClearArchivedAt clears the value of the "archived_at" field.

func (*MediaUpdateOne) ClearCaption

func (_u *MediaUpdateOne) ClearCaption() *MediaUpdateOne

ClearCaption clears the value of the "caption" field.

func (*MediaUpdateOne) ClearDeletedAt

func (_u *MediaUpdateOne) ClearDeletedAt() *MediaUpdateOne

ClearDeletedAt clears the value of the "deleted_at" field.

func (*MediaUpdateOne) ClearDeletedByID

func (_u *MediaUpdateOne) ClearDeletedByID() *MediaUpdateOne

ClearDeletedByID clears the value of the "deleted_by_id" field.

func (*MediaUpdateOne) ClearExt

func (_u *MediaUpdateOne) ClearExt() *MediaUpdateOne

ClearExt clears the value of the "ext" field.

func (*MediaUpdateOne) ClearFolderPath

func (_u *MediaUpdateOne) ClearFolderPath() *MediaUpdateOne

ClearFolderPath clears the value of the "folder_path" field.

func (*MediaUpdateOne) ClearFormats

func (_u *MediaUpdateOne) ClearFormats() *MediaUpdateOne

ClearFormats clears all "formats" edges to the MediaFormat entity.

func (*MediaUpdateOne) ClearHash

func (_u *MediaUpdateOne) ClearHash() *MediaUpdateOne

ClearHash clears the value of the "hash" field.

func (*MediaUpdateOne) ClearHeight

func (_u *MediaUpdateOne) ClearHeight() *MediaUpdateOne

ClearHeight clears the value of the "height" field.

func (*MediaUpdateOne) ClearIsURLSigned

func (_u *MediaUpdateOne) ClearIsURLSigned() *MediaUpdateOne

ClearIsURLSigned clears the value of the "is_url_signed" field.

func (*MediaUpdateOne) ClearLocale

func (_u *MediaUpdateOne) ClearLocale() *MediaUpdateOne

ClearLocale clears the value of the "locale" field.

func (*MediaUpdateOne) ClearMime

func (_u *MediaUpdateOne) ClearMime() *MediaUpdateOne

ClearMime clears the value of the "mime" field.

func (*MediaUpdateOne) ClearPreviewURL

func (_u *MediaUpdateOne) ClearPreviewURL() *MediaUpdateOne

ClearPreviewURL clears the value of the "preview_url" field.

func (*MediaUpdateOne) ClearProvider

func (_u *MediaUpdateOne) ClearProvider() *MediaUpdateOne

ClearProvider clears the value of the "provider" field.

func (*MediaUpdateOne) ClearProviderMetadata

func (_u *MediaUpdateOne) ClearProviderMetadata() *MediaUpdateOne

ClearProviderMetadata clears the value of the "provider_metadata" field.

func (*MediaUpdateOne) ClearPublishedAt

func (_u *MediaUpdateOne) ClearPublishedAt() *MediaUpdateOne

ClearPublishedAt clears the value of the "published_at" field.

func (*MediaUpdateOne) ClearSize

func (_u *MediaUpdateOne) ClearSize() *MediaUpdateOne

ClearSize clears the value of the "size" field.

func (*MediaUpdateOne) ClearUpdatedAt

func (_u *MediaUpdateOne) ClearUpdatedAt() *MediaUpdateOne

ClearUpdatedAt clears the value of the "updated_at" field.

func (*MediaUpdateOne) ClearUpdatedByID

func (_u *MediaUpdateOne) ClearUpdatedByID() *MediaUpdateOne

ClearUpdatedByID clears the value of the "updated_by_id" field.

func (*MediaUpdateOne) ClearWidth

func (_u *MediaUpdateOne) ClearWidth() *MediaUpdateOne

ClearWidth clears the value of the "width" field.

func (*MediaUpdateOne) Exec

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

Exec executes the query on the entity.

func (*MediaUpdateOne) ExecX

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

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

func (*MediaUpdateOne) Mutation

func (_u *MediaUpdateOne) Mutation() *MediaMutation

Mutation returns the MediaMutation object of the builder.

func (*MediaUpdateOne) RemoveFormatIDs

func (_u *MediaUpdateOne) RemoveFormatIDs(ids ...uuid.UUID) *MediaUpdateOne

RemoveFormatIDs removes the "formats" edge to MediaFormat entities by IDs.

func (*MediaUpdateOne) RemoveFormats

func (_u *MediaUpdateOne) RemoveFormats(v ...*MediaFormat) *MediaUpdateOne

RemoveFormats removes "formats" edges to MediaFormat entities.

func (*MediaUpdateOne) Save

func (_u *MediaUpdateOne) Save(ctx context.Context) (*Media, error)

Save executes the query and returns the updated Media entity.

func (*MediaUpdateOne) SaveX

func (_u *MediaUpdateOne) SaveX(ctx context.Context) *Media

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

func (*MediaUpdateOne) Select

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

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

func (*MediaUpdateOne) SetAlternativeText

func (_u *MediaUpdateOne) SetAlternativeText(v string) *MediaUpdateOne

SetAlternativeText sets the "alternative_text" field.

func (*MediaUpdateOne) SetArchivedAt

func (_u *MediaUpdateOne) SetArchivedAt(v time.Time) *MediaUpdateOne

SetArchivedAt sets the "archived_at" field.

func (*MediaUpdateOne) SetCaption

func (_u *MediaUpdateOne) SetCaption(v string) *MediaUpdateOne

SetCaption sets the "caption" field.

func (*MediaUpdateOne) SetDeletedAt

func (_u *MediaUpdateOne) SetDeletedAt(v time.Time) *MediaUpdateOne

SetDeletedAt sets the "deleted_at" field.

func (*MediaUpdateOne) SetDeletedByID

func (_u *MediaUpdateOne) SetDeletedByID(v uuid.UUID) *MediaUpdateOne

SetDeletedByID sets the "deleted_by_id" field.

func (*MediaUpdateOne) SetExt

func (_u *MediaUpdateOne) SetExt(v string) *MediaUpdateOne

SetExt sets the "ext" field.

func (*MediaUpdateOne) SetFolderPath

func (_u *MediaUpdateOne) SetFolderPath(v string) *MediaUpdateOne

SetFolderPath sets the "folder_path" field.

func (*MediaUpdateOne) SetHash

func (_u *MediaUpdateOne) SetHash(v string) *MediaUpdateOne

SetHash sets the "hash" field.

func (*MediaUpdateOne) SetHeight

func (_u *MediaUpdateOne) SetHeight(v int) *MediaUpdateOne

SetHeight sets the "height" field.

func (*MediaUpdateOne) SetIsURLSigned

func (_u *MediaUpdateOne) SetIsURLSigned(v bool) *MediaUpdateOne

SetIsURLSigned sets the "is_url_signed" field.

func (*MediaUpdateOne) SetLocale

func (_u *MediaUpdateOne) SetLocale(v string) *MediaUpdateOne

SetLocale sets the "locale" field.

func (*MediaUpdateOne) SetMime

func (_u *MediaUpdateOne) SetMime(v string) *MediaUpdateOne

SetMime sets the "mime" field.

func (*MediaUpdateOne) SetName

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

SetName sets the "name" field.

func (*MediaUpdateOne) SetNillableAlternativeText

func (_u *MediaUpdateOne) SetNillableAlternativeText(v *string) *MediaUpdateOne

SetNillableAlternativeText sets the "alternative_text" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableArchivedAt

func (_u *MediaUpdateOne) SetNillableArchivedAt(v *time.Time) *MediaUpdateOne

SetNillableArchivedAt sets the "archived_at" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableCaption

func (_u *MediaUpdateOne) SetNillableCaption(v *string) *MediaUpdateOne

SetNillableCaption sets the "caption" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableDeletedAt

func (_u *MediaUpdateOne) SetNillableDeletedAt(v *time.Time) *MediaUpdateOne

SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableDeletedByID

func (_u *MediaUpdateOne) SetNillableDeletedByID(v *uuid.UUID) *MediaUpdateOne

SetNillableDeletedByID sets the "deleted_by_id" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableExt

func (_u *MediaUpdateOne) SetNillableExt(v *string) *MediaUpdateOne

SetNillableExt sets the "ext" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableFolderPath

func (_u *MediaUpdateOne) SetNillableFolderPath(v *string) *MediaUpdateOne

SetNillableFolderPath sets the "folder_path" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableHash

func (_u *MediaUpdateOne) SetNillableHash(v *string) *MediaUpdateOne

SetNillableHash sets the "hash" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableHeight

func (_u *MediaUpdateOne) SetNillableHeight(v *int) *MediaUpdateOne

SetNillableHeight sets the "height" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableIsURLSigned

func (_u *MediaUpdateOne) SetNillableIsURLSigned(v *bool) *MediaUpdateOne

SetNillableIsURLSigned sets the "is_url_signed" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableLocale

func (_u *MediaUpdateOne) SetNillableLocale(v *string) *MediaUpdateOne

SetNillableLocale sets the "locale" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableMime

func (_u *MediaUpdateOne) SetNillableMime(v *string) *MediaUpdateOne

SetNillableMime sets the "mime" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableName

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

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

func (*MediaUpdateOne) SetNillablePreviewURL

func (_u *MediaUpdateOne) SetNillablePreviewURL(v *string) *MediaUpdateOne

SetNillablePreviewURL sets the "preview_url" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableProvider

func (_u *MediaUpdateOne) SetNillableProvider(v *string) *MediaUpdateOne

SetNillableProvider sets the "provider" field if the given value is not nil.

func (*MediaUpdateOne) SetNillablePublishedAt

func (_u *MediaUpdateOne) SetNillablePublishedAt(v *time.Time) *MediaUpdateOne

SetNillablePublishedAt sets the "published_at" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableSize

func (_u *MediaUpdateOne) SetNillableSize(v *float64) *MediaUpdateOne

SetNillableSize sets the "size" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableTenantID

func (_u *MediaUpdateOne) SetNillableTenantID(v *string) *MediaUpdateOne

SetNillableTenantID sets the "tenant_id" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableURL

func (_u *MediaUpdateOne) SetNillableURL(v *string) *MediaUpdateOne

SetNillableURL sets the "url" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableUpdatedByID

func (_u *MediaUpdateOne) SetNillableUpdatedByID(v *uuid.UUID) *MediaUpdateOne

SetNillableUpdatedByID sets the "updated_by_id" field if the given value is not nil.

func (*MediaUpdateOne) SetNillableWidth

func (_u *MediaUpdateOne) SetNillableWidth(v *int) *MediaUpdateOne

SetNillableWidth sets the "width" field if the given value is not nil.

func (*MediaUpdateOne) SetPreviewURL

func (_u *MediaUpdateOne) SetPreviewURL(v string) *MediaUpdateOne

SetPreviewURL sets the "preview_url" field.

func (*MediaUpdateOne) SetProvider

func (_u *MediaUpdateOne) SetProvider(v string) *MediaUpdateOne

SetProvider sets the "provider" field.

func (*MediaUpdateOne) SetProviderMetadata

func (_u *MediaUpdateOne) SetProviderMetadata(v map[string]interface{}) *MediaUpdateOne

SetProviderMetadata sets the "provider_metadata" field.

func (*MediaUpdateOne) SetPublishedAt

func (_u *MediaUpdateOne) SetPublishedAt(v time.Time) *MediaUpdateOne

SetPublishedAt sets the "published_at" field.

func (*MediaUpdateOne) SetSize

func (_u *MediaUpdateOne) SetSize(v float64) *MediaUpdateOne

SetSize sets the "size" field.

func (*MediaUpdateOne) SetTenantID

func (_u *MediaUpdateOne) SetTenantID(v string) *MediaUpdateOne

SetTenantID sets the "tenant_id" field.

func (*MediaUpdateOne) SetURL

func (_u *MediaUpdateOne) SetURL(v string) *MediaUpdateOne

SetURL sets the "url" field.

func (*MediaUpdateOne) SetUpdatedAt

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

SetUpdatedAt sets the "updated_at" field.

func (*MediaUpdateOne) SetUpdatedByID

func (_u *MediaUpdateOne) SetUpdatedByID(v uuid.UUID) *MediaUpdateOne

SetUpdatedByID sets the "updated_by_id" field.

func (*MediaUpdateOne) SetWidth

func (_u *MediaUpdateOne) SetWidth(v int) *MediaUpdateOne

SetWidth sets the "width" field.

func (*MediaUpdateOne) Where

func (_u *MediaUpdateOne) Where(ps ...predicate.Media) *MediaUpdateOne

Where appends a list predicates to the MediaUpdate builder.

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 OptimizedQuery

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

OptimizedQuery 查询优化

func NewOptimizedQuery

func NewOptimizedQuery() *OptimizedQuery

NewOptimizedQuery 创建优化查询

func (*OptimizedQuery) Build

func (q *OptimizedQuery) Build() string

Build 构建 SQL

func (*OptimizedQuery) Distinct

func (q *OptimizedQuery) Distinct() *OptimizedQuery

Distinct 去重

func (*OptimizedQuery) Execute

func (q *OptimizedQuery) Execute(ctx context.Context, db *sql.DB) (*sql.Rows, error)

Execute 执行查询

func (*OptimizedQuery) Join

func (q *OptimizedQuery) Join(table, on string) *OptimizedQuery

Join 关联查询

func (*OptimizedQuery) Limit

func (q *OptimizedQuery) Limit(n int) *OptimizedQuery

Limit 限制数量

func (*OptimizedQuery) Offset

func (q *OptimizedQuery) Offset(n int) *OptimizedQuery

Offset 偏移量

func (*OptimizedQuery) OrderBy

func (q *OptimizedQuery) OrderBy(field, direction string) *OptimizedQuery

OrderBy 排序

func (*OptimizedQuery) Select

func (q *OptimizedQuery) Select(fields ...string) *OptimizedQuery

Select 指定查询字段

func (*OptimizedQuery) Where

func (q *OptimizedQuery) Where(condition string) *OptimizedQuery

Where 条件过滤

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 Pagination

type Pagination struct {
	Page    int
	PerPage int
}

Pagination 分页查询

func NewPagination

func NewPagination(page, perPage int) *Pagination

NewPagination 创建分页

func (*Pagination) BuildLimit

func (p *Pagination) BuildLimit() string

BuildLimit 构建 LIMIT 语句

func (*Pagination) Limit

func (p *Pagination) Limit() int

Limit 获取限制

func (*Pagination) Offset

func (p *Pagination) Offset() int

Offset 计算偏移量

func (*Pagination) TotalPages

func (p *Pagination) TotalPages(total int) int

TotalPages 计算总页数

type Policy

type Policy = ent.Policy

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

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 QueryBuilder

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

QueryBuilder 查询构建器

func NewQueryBuilder

func NewQueryBuilder(table string) *QueryBuilder

NewQueryBuilder 创建查询构建器

func (*QueryBuilder) BuildIn

func (b *QueryBuilder) BuildIn(field string, values []interface{}) string

BuildIn 构建 IN 查询

func (*QueryBuilder) BuildOr

func (b *QueryBuilder) BuildOr(conditions []string) string

BuildOr 构建 OR 查询

func (*QueryBuilder) SelectWithAliases

func (b *QueryBuilder) SelectWithAliases(fields map[string]string) string

SelectWithAliases 带别名的字段选择

type QueryContext

type QueryContext = ent.QueryContext

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

type QueryExecutor

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

QueryExecutor 查询执行器

func NewQueryExecutor

func NewQueryExecutor(db *sql.DB, monitor *QueryMonitor) *QueryExecutor

NewQueryExecutor 创建查询执行器

func (*QueryExecutor) ExecuteWithRetry

func (e *QueryExecutor) ExecuteWithRetry(ctx context.Context, query string, maxRetries int, args ...interface{}) (*sql.Rows, error)

ExecuteWithRetry 带重试的查询执行

func (*QueryExecutor) ExecuteWithStats

func (e *QueryExecutor) ExecuteWithStats(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

ExecuteWithStats 带统计的查询执行

type QueryExtension

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

QueryExtension 查询扩展

func NewQueryExtension

func NewQueryExtension(db *sql.DB) *QueryExtension

NewQueryExtension 创建查询扩展

func (*QueryExtension) BulkCreate

func (e *QueryExtension) BulkCreate(ctx context.Context, items []interface{}, batchSize int) error

BulkCreate 批量创建优化

type QueryMonitor

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

QueryMonitor 查询监控

func NewQueryMonitor

func NewQueryMonitor() *QueryMonitor

NewQueryMonitor 创建查询监控

func (*QueryMonitor) GetSlowQueries

func (m *QueryMonitor) GetSlowQueries(threshold time.Duration) map[string]*QueryStats

GetSlowQueries 获取慢查询

func (*QueryMonitor) GetStats

func (m *QueryMonitor) GetStats(query string) *QueryStats

GetStats 获取统计

func (*QueryMonitor) Record

func (m *QueryMonitor) Record(query string, duration time.Duration, err error)

Record 记录查询

type QueryOptimizer

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

QueryOptimizer 查询优化器

func NewQueryOptimizer

func NewQueryOptimizer(monitor *QueryMonitor, analyzer *IndexAnalyzer) *QueryOptimizer

NewQueryOptimizer 创建查询优化器

func (*QueryOptimizer) GetSuggestions

func (o *QueryOptimizer) GetSuggestions() []string

GetSuggestions 获取优化建议

type QueryResult

type QueryResult struct {
	Data       interface{}
	Total      int
	Page       int
	PerPage    int
	TotalPages int
}

QueryResult 查询结果

type QueryStats

type QueryStats struct {
	Count   int64
	AvgTime time.Duration
	MaxTime time.Duration
	MinTime time.Duration
	Errors  int64
}

QueryStats 查询统计

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 TableInfo

type TableInfo struct {
	Name    string
	Indexes []IndexInfo
	Columns []ColumnInfo
}

TableInfo 表信息

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 {

	// CasbinPolicy is the client for interacting with the CasbinPolicy builders.
	CasbinPolicy *CasbinPolicyClient
	// Media is the client for interacting with the Media builders.
	Media *MediaClient
	// MediaFormat is the client for interacting with the MediaFormat builders.
	MediaFormat *MediaFormatClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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