ent

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 21 Imported by: 0

README

来自facebook,官方简介: https://github.com/ent/ent/blob/master/README_zh.md 文档: https://entgo.io/zh/docs/tutorial-setup/

Supported platforms and architectures https://pkg.go.dev/modernc.org/sqlite#hdr-Supported_platforms_and_architectures https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fsqlite 主要平台里面,也就windows 386不支持。

Adds support for Go fs.FS based SQLite virtual filesystems, see function New in modernc.org/sqlite/vfs and/or TestVFS in all_test.go 添加对 Go fs 的支持。基于 FS 的 SQLite 虚拟文件系统,请参阅函数 modernc.org/sqlite/vfs 中的新功能和/或 all_test.go 中的 TestVFS

https://gitlab.com/cznic/sqlite/-/blob/master/all_test.go 大约在2487行,搜索TestVFS,有示例代码。似乎可以内嵌数据库文件?可以存储默认配置,但无法保存的话,实际也没太大用处?

ent是一个简单而又功能强大的Go语言实体框架,ent易于构建和维护应用程序与大数据模型。 图就是代码 - 将任何数据库表建模为Go对象。 轻松地遍历任何图形 - 可以轻松地运行查询、聚合和遍历任何图形结构。 静态类型和显式API - 使用代码生成静态类型和显式API,查询数据更加便捷。 多存储驱动程序 - 支持MySQL, PostgreSQL, SQLite 和 Gremlin。 可扩展 - 简单地扩展和使用Go模板自定义。

100%型安全なgolangORM「ent」を使ってみた https://future-architect.github.io/articles/20210728a/

# 在项目根目录执行,生成设计图(Schema)模板。
# 会生成 与对应的 schema/ent/book.go 与 schema/ent/user.go,编辑这些文件来定义实体的属性。
go run entgo.io/ent/cmd/ent init User Book

# 新建User与Book实体
go run -mod=mod entgo.io/ent/cmd/ent User Book

# 应该编辑 ent/schema/book.go 与 ent/schema/user.go。
# 不应编辑生成的文件(ent/book.go 与 ent/user.go等等)。重新生成时,修改将消失。
# 生成CRUD相关代码。每次添加或修改 fields 和 edges后, 都需要生成新的实体. 
# 在项目的根目录执行 ent generate或直接执行:
go generate ./ent

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.
	TypeBook           = "Book"
	TypeSinglePageInfo = "SinglePageInfo"
	TypeUser           = "User"
)

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 Book

type Book struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// 书名
	Title string `json:"Title,omitempty"`
	// 书籍ID
	BookID string `json:"BookID,omitempty"`
	// 拥有者
	Owner string `json:"Owner,omitempty"`
	// 文件路径
	FilePath string `json:"FilePath,omitempty"`
	// 书库路径
	BookStorePath string `json:"BookStorePath,omitempty"`
	// 书籍类型
	Type string `json:"Type,omitempty"`
	// ChildBookNum holds the value of the "ChildBookNum" field.
	ChildBookNum int `json:"ChildBookNum,omitempty"`
	// Depth holds the value of the "Depth" field.
	Depth int `json:"Depth,omitempty"`
	// ParentFolder holds the value of the "ParentFolder" field.
	ParentFolder string `json:"ParentFolder,omitempty"`
	// 总页数
	PageCount int `json:"PageCount,omitempty"`
	// FileSize holds the value of the "FileSize" field.
	FileSize int64 `json:"FileSize,omitempty"`
	// Authors holds the value of the "Authors" field.
	Authors string `json:"Authors,omitempty"`
	// ISBN holds the value of the "ISBN" field.
	ISBN string `json:"ISBN,omitempty"`
	// Press holds the value of the "Press" field.
	Press string `json:"Press,omitempty"`
	// PublishedAt holds the value of the "PublishedAt" field.
	PublishedAt string `json:"PublishedAt,omitempty"`
	// ExtractPath holds the value of the "ExtractPath" field.
	ExtractPath string `json:"ExtractPath,omitempty"`
	// 创建时间
	Modified time.Time `json:"Modified,omitempty"`
	// ExtractNum holds the value of the "ExtractNum" field.
	ExtractNum int `json:"ExtractNum,omitempty"`
	// InitComplete holds the value of the "InitComplete" field.
	InitComplete bool `json:"InitComplete,omitempty"`
	// ReadPercent holds the value of the "ReadPercent" field.
	ReadPercent float64 `json:"ReadPercent,omitempty"`
	// NonUTF8Zip holds the value of the "NonUTF8Zip" field.
	NonUTF8Zip bool `json:"NonUTF8Zip,omitempty"`
	// ZipTextEncoding holds the value of the "ZipTextEncoding" field.
	ZipTextEncoding string `json:"ZipTextEncoding,omitempty"`
	// Edges holds the relations/edges for other nodes in the graph.
	// The values are being populated by the BookQuery when eager-loading is set.
	Edges BookEdges `json:"edges"`
	// contains filtered or unexported fields
}

Book is the model entity for the Book schema.

func (*Book) QueryPageInfos

func (b *Book) QueryPageInfos() *SinglePageInfoQuery

QueryPageInfos queries the "PageInfos" edge of the Book entity.

func (*Book) String

func (b *Book) String() string

String implements the fmt.Stringer.

func (*Book) Unwrap

func (b *Book) Unwrap() *Book

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

func (b *Book) Update() *BookUpdateOne

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

func (*Book) Value added in v0.9.5

func (b *Book) Value(name string) (ent.Value, error)

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

type BookClient

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

BookClient is a client for the Book schema.

func NewBookClient

func NewBookClient(c config) *BookClient

NewBookClient returns a client for the Book from the given config.

func (*BookClient) Create

func (c *BookClient) Create() *BookCreate

Create returns a builder for creating a Book entity.

func (*BookClient) CreateBulk

func (c *BookClient) CreateBulk(builders ...*BookCreate) *BookCreateBulk

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

func (*BookClient) Delete

func (c *BookClient) Delete() *BookDelete

Delete returns a delete builder for Book.

func (*BookClient) DeleteOne

func (c *BookClient) DeleteOne(b *Book) *BookDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*BookClient) DeleteOneID

func (c *BookClient) DeleteOneID(id int) *BookDeleteOne

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

func (*BookClient) Get

func (c *BookClient) Get(ctx context.Context, id int) (*Book, error)

Get returns a Book entity by its id.

func (*BookClient) GetX

func (c *BookClient) GetX(ctx context.Context, id int) *Book

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

func (*BookClient) Hooks

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

Hooks returns the client hooks.

func (*BookClient) Intercept added in v0.9.1

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

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

func (*BookClient) Interceptors added in v0.9.1

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

Interceptors returns the client interceptors.

func (*BookClient) MapCreateBulk added in v0.9.7

func (c *BookClient) MapCreateBulk(slice any, setFunc func(*BookCreate, int)) *BookCreateBulk

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

func (c *BookClient) Query() *BookQuery

Query returns a query builder for Book.

func (*BookClient) QueryPageInfos

func (c *BookClient) QueryPageInfos(b *Book) *SinglePageInfoQuery

QueryPageInfos queries the PageInfos edge of a Book.

func (*BookClient) Update

func (c *BookClient) Update() *BookUpdate

Update returns an update builder for Book.

func (*BookClient) UpdateOne

func (c *BookClient) UpdateOne(b *Book) *BookUpdateOne

UpdateOne returns an update builder for the given entity.

func (*BookClient) UpdateOneID

func (c *BookClient) UpdateOneID(id int) *BookUpdateOne

UpdateOneID returns an update builder for the given id.

func (*BookClient) Use

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

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

type BookCreate

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

BookCreate is the builder for creating a Book entity.

func (*BookCreate) AddPageInfoIDs

func (bc *BookCreate) AddPageInfoIDs(ids ...int) *BookCreate

AddPageInfoIDs adds the "PageInfos" edge to the SinglePageInfo entity by IDs.

func (*BookCreate) AddPageInfos

func (bc *BookCreate) AddPageInfos(s ...*SinglePageInfo) *BookCreate

AddPageInfos adds the "PageInfos" edges to the SinglePageInfo entity.

func (*BookCreate) Exec

func (bc *BookCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*BookCreate) ExecX

func (bc *BookCreate) ExecX(ctx context.Context)

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

func (*BookCreate) Mutation

func (bc *BookCreate) Mutation() *BookMutation

Mutation returns the BookMutation object of the builder.

func (*BookCreate) Save

func (bc *BookCreate) Save(ctx context.Context) (*Book, error)

Save creates the Book in the database.

func (*BookCreate) SaveX

func (bc *BookCreate) SaveX(ctx context.Context) *Book

SaveX calls Save and panics if Save returns an error.

func (*BookCreate) SetAuthors

func (bc *BookCreate) SetAuthors(s string) *BookCreate

SetAuthors sets the "Authors" field.

func (*BookCreate) SetBookID

func (bc *BookCreate) SetBookID(s string) *BookCreate

SetBookID sets the "BookID" field.

func (*BookCreate) SetBookStorePath

func (bc *BookCreate) SetBookStorePath(s string) *BookCreate

SetBookStorePath sets the "BookStorePath" field.

func (*BookCreate) SetChildBookNum

func (bc *BookCreate) SetChildBookNum(i int) *BookCreate

SetChildBookNum sets the "ChildBookNum" field.

func (*BookCreate) SetDepth

func (bc *BookCreate) SetDepth(i int) *BookCreate

SetDepth sets the "Depth" field.

func (*BookCreate) SetExtractNum

func (bc *BookCreate) SetExtractNum(i int) *BookCreate

SetExtractNum sets the "ExtractNum" field.

func (*BookCreate) SetExtractPath

func (bc *BookCreate) SetExtractPath(s string) *BookCreate

SetExtractPath sets the "ExtractPath" field.

func (*BookCreate) SetFilePath

func (bc *BookCreate) SetFilePath(s string) *BookCreate

SetFilePath sets the "FilePath" field.

func (*BookCreate) SetFileSize

func (bc *BookCreate) SetFileSize(i int64) *BookCreate

SetFileSize sets the "FileSize" field.

func (*BookCreate) SetISBN

func (bc *BookCreate) SetISBN(s string) *BookCreate

SetISBN sets the "ISBN" field.

func (*BookCreate) SetInitComplete

func (bc *BookCreate) SetInitComplete(b bool) *BookCreate

SetInitComplete sets the "InitComplete" field.

func (*BookCreate) SetModified

func (bc *BookCreate) SetModified(t time.Time) *BookCreate

SetModified sets the "Modified" field.

func (*BookCreate) SetNillableModified

func (bc *BookCreate) SetNillableModified(t *time.Time) *BookCreate

SetNillableModified sets the "Modified" field if the given value is not nil.

func (*BookCreate) SetNillableOwner added in v0.9.7

func (bc *BookCreate) SetNillableOwner(s *string) *BookCreate

SetNillableOwner sets the "Owner" field if the given value is not nil.

func (*BookCreate) SetNonUTF8Zip

func (bc *BookCreate) SetNonUTF8Zip(b bool) *BookCreate

SetNonUTF8Zip sets the "NonUTF8Zip" field.

func (*BookCreate) SetOwner added in v0.9.1

func (bc *BookCreate) SetOwner(s string) *BookCreate

SetOwner sets the "Owner" field.

func (*BookCreate) SetPageCount added in v0.9.7

func (bc *BookCreate) SetPageCount(i int) *BookCreate

SetPageCount sets the "PageCount" field.

func (*BookCreate) SetParentFolder

func (bc *BookCreate) SetParentFolder(s string) *BookCreate

SetParentFolder sets the "ParentFolder" field.

func (*BookCreate) SetPress

func (bc *BookCreate) SetPress(s string) *BookCreate

SetPress sets the "Press" field.

func (*BookCreate) SetPublishedAt

func (bc *BookCreate) SetPublishedAt(s string) *BookCreate

SetPublishedAt sets the "PublishedAt" field.

func (*BookCreate) SetReadPercent

func (bc *BookCreate) SetReadPercent(f float64) *BookCreate

SetReadPercent sets the "ReadPercent" field.

func (*BookCreate) SetTitle added in v0.9.7

func (bc *BookCreate) SetTitle(s string) *BookCreate

SetTitle sets the "Title" field.

func (*BookCreate) SetType

func (bc *BookCreate) SetType(s string) *BookCreate

SetType sets the "Type" field.

func (*BookCreate) SetZipTextEncoding

func (bc *BookCreate) SetZipTextEncoding(s string) *BookCreate

SetZipTextEncoding sets the "ZipTextEncoding" field.

type BookCreateBulk

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

BookCreateBulk is the builder for creating many Book entities in bulk.

func (*BookCreateBulk) Exec

func (bcb *BookCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*BookCreateBulk) ExecX

func (bcb *BookCreateBulk) ExecX(ctx context.Context)

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

func (*BookCreateBulk) Save

func (bcb *BookCreateBulk) Save(ctx context.Context) ([]*Book, error)

Save creates the Book entities in the database.

func (*BookCreateBulk) SaveX

func (bcb *BookCreateBulk) SaveX(ctx context.Context) []*Book

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

type BookDelete

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

BookDelete is the builder for deleting a Book entity.

func (*BookDelete) Exec

func (bd *BookDelete) Exec(ctx context.Context) (int, error)

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

func (*BookDelete) ExecX

func (bd *BookDelete) ExecX(ctx context.Context) int

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

func (*BookDelete) Where

func (bd *BookDelete) Where(ps ...predicate.Book) *BookDelete

Where appends a list predicates to the BookDelete builder.

type BookDeleteOne

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

BookDeleteOne is the builder for deleting a single Book entity.

func (*BookDeleteOne) Exec

func (bdo *BookDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*BookDeleteOne) ExecX

func (bdo *BookDeleteOne) ExecX(ctx context.Context)

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

func (*BookDeleteOne) Where added in v0.9.1

func (bdo *BookDeleteOne) Where(ps ...predicate.Book) *BookDeleteOne

Where appends a list predicates to the BookDelete builder.

type BookEdges

type BookEdges struct {
	// PageInfos holds the value of the PageInfos edge.
	PageInfos []*SinglePageInfo `json:"PageInfos,omitempty"`
	// contains filtered or unexported fields
}

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

func (BookEdges) PageInfosOrErr

func (e BookEdges) PageInfosOrErr() ([]*SinglePageInfo, error)

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

type BookGroupBy

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

BookGroupBy is the group-by builder for Book entities.

func (*BookGroupBy) Aggregate

func (bgb *BookGroupBy) Aggregate(fns ...AggregateFunc) *BookGroupBy

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

func (*BookGroupBy) Bool

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

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

func (*BookGroupBy) BoolX

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

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

func (*BookGroupBy) Bools

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

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

func (*BookGroupBy) BoolsX

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

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

func (*BookGroupBy) Float64

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

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

func (*BookGroupBy) Float64X

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

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

func (*BookGroupBy) Float64s

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

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

func (*BookGroupBy) Float64sX

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

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

func (*BookGroupBy) Int

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

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

func (*BookGroupBy) IntX

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

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

func (*BookGroupBy) Ints

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

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

func (*BookGroupBy) IntsX

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

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

func (*BookGroupBy) Scan

func (bgb *BookGroupBy) Scan(ctx context.Context, v any) error

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

func (*BookGroupBy) ScanX

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

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

func (*BookGroupBy) String

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

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

func (*BookGroupBy) StringX

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

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

func (*BookGroupBy) Strings

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

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

func (*BookGroupBy) StringsX

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

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

type BookMutation

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

BookMutation represents an operation that mutates the Book nodes in the graph.

func (*BookMutation) AddChildBookNum

func (m *BookMutation) AddChildBookNum(i int)

AddChildBookNum adds i to the "ChildBookNum" field.

func (*BookMutation) AddDepth

func (m *BookMutation) AddDepth(i int)

AddDepth adds i to the "Depth" field.

func (*BookMutation) AddExtractNum

func (m *BookMutation) AddExtractNum(i int)

AddExtractNum adds i to the "ExtractNum" field.

func (*BookMutation) AddField

func (m *BookMutation) 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 (*BookMutation) AddFileSize

func (m *BookMutation) AddFileSize(i int64)

AddFileSize adds i to the "FileSize" field.

func (*BookMutation) AddPageCount added in v0.9.7

func (m *BookMutation) AddPageCount(i int)

AddPageCount adds i to the "PageCount" field.

func (*BookMutation) AddPageInfoIDs

func (m *BookMutation) AddPageInfoIDs(ids ...int)

AddPageInfoIDs adds the "PageInfos" edge to the SinglePageInfo entity by ids.

func (*BookMutation) AddReadPercent

func (m *BookMutation) AddReadPercent(f float64)

AddReadPercent adds f to the "ReadPercent" field.

func (*BookMutation) AddedChildBookNum

func (m *BookMutation) AddedChildBookNum() (r int, exists bool)

AddedChildBookNum returns the value that was added to the "ChildBookNum" field in this mutation.

func (*BookMutation) AddedDepth

func (m *BookMutation) AddedDepth() (r int, exists bool)

AddedDepth returns the value that was added to the "Depth" field in this mutation.

func (*BookMutation) AddedEdges

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

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

func (*BookMutation) AddedExtractNum

func (m *BookMutation) AddedExtractNum() (r int, exists bool)

AddedExtractNum returns the value that was added to the "ExtractNum" field in this mutation.

func (*BookMutation) AddedField

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

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

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

func (*BookMutation) AddedFileSize

func (m *BookMutation) AddedFileSize() (r int64, exists bool)

AddedFileSize returns the value that was added to the "FileSize" field in this mutation.

func (*BookMutation) AddedIDs

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

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

func (*BookMutation) AddedPageCount added in v0.9.7

func (m *BookMutation) AddedPageCount() (r int, exists bool)

AddedPageCount returns the value that was added to the "PageCount" field in this mutation.

func (*BookMutation) AddedReadPercent

func (m *BookMutation) AddedReadPercent() (r float64, exists bool)

AddedReadPercent returns the value that was added to the "ReadPercent" field in this mutation.

func (*BookMutation) Authors

func (m *BookMutation) Authors() (r string, exists bool)

Authors returns the value of the "Authors" field in the mutation.

func (*BookMutation) BookID

func (m *BookMutation) BookID() (r string, exists bool)

BookID returns the value of the "BookID" field in the mutation.

func (*BookMutation) BookStorePath

func (m *BookMutation) BookStorePath() (r string, exists bool)

BookStorePath returns the value of the "BookStorePath" field in the mutation.

func (*BookMutation) ChildBookNum

func (m *BookMutation) ChildBookNum() (r int, exists bool)

ChildBookNum returns the value of the "ChildBookNum" field in the mutation.

func (*BookMutation) ClearEdge

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

func (m *BookMutation) 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 (*BookMutation) ClearPageInfos

func (m *BookMutation) ClearPageInfos()

ClearPageInfos clears the "PageInfos" edge to the SinglePageInfo entity.

func (*BookMutation) ClearedEdges

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

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

func (*BookMutation) ClearedFields

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

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

func (BookMutation) Client

func (m BookMutation) 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 (*BookMutation) Depth

func (m *BookMutation) Depth() (r int, exists bool)

Depth returns the value of the "Depth" field in the mutation.

func (*BookMutation) EdgeCleared

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

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

func (*BookMutation) ExtractNum

func (m *BookMutation) ExtractNum() (r int, exists bool)

ExtractNum returns the value of the "ExtractNum" field in the mutation.

func (*BookMutation) ExtractPath

func (m *BookMutation) ExtractPath() (r string, exists bool)

ExtractPath returns the value of the "ExtractPath" field in the mutation.

func (*BookMutation) Field

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

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

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

func (*BookMutation) Fields

func (m *BookMutation) 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 (*BookMutation) FilePath

func (m *BookMutation) FilePath() (r string, exists bool)

FilePath returns the value of the "FilePath" field in the mutation.

func (*BookMutation) FileSize

func (m *BookMutation) FileSize() (r int64, exists bool)

FileSize returns the value of the "FileSize" field in the mutation.

func (*BookMutation) GetType

func (m *BookMutation) GetType() (r string, exists bool)

GetType returns the value of the "Type" field in the mutation.

func (*BookMutation) ID

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

func (m *BookMutation) 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 (*BookMutation) ISBN

func (m *BookMutation) ISBN() (r string, exists bool)

ISBN returns the value of the "ISBN" field in the mutation.

func (*BookMutation) InitComplete

func (m *BookMutation) InitComplete() (r bool, exists bool)

InitComplete returns the value of the "InitComplete" field in the mutation.

func (*BookMutation) Modified

func (m *BookMutation) Modified() (r time.Time, exists bool)

Modified returns the value of the "Modified" field in the mutation.

func (*BookMutation) NonUTF8Zip

func (m *BookMutation) NonUTF8Zip() (r bool, exists bool)

NonUTF8Zip returns the value of the "NonUTF8Zip" field in the mutation.

func (*BookMutation) OldAuthors

func (m *BookMutation) OldAuthors(ctx context.Context) (v string, err error)

OldAuthors returns the old "Authors" field's value of the Book entity. If the Book 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 (*BookMutation) OldBookID

func (m *BookMutation) OldBookID(ctx context.Context) (v string, err error)

OldBookID returns the old "BookID" field's value of the Book entity. If the Book 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 (*BookMutation) OldBookStorePath

func (m *BookMutation) OldBookStorePath(ctx context.Context) (v string, err error)

OldBookStorePath returns the old "BookStorePath" field's value of the Book entity. If the Book 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 (*BookMutation) OldChildBookNum

func (m *BookMutation) OldChildBookNum(ctx context.Context) (v int, err error)

OldChildBookNum returns the old "ChildBookNum" field's value of the Book entity. If the Book 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 (*BookMutation) OldDepth

func (m *BookMutation) OldDepth(ctx context.Context) (v int, err error)

OldDepth returns the old "Depth" field's value of the Book entity. If the Book 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 (*BookMutation) OldExtractNum

func (m *BookMutation) OldExtractNum(ctx context.Context) (v int, err error)

OldExtractNum returns the old "ExtractNum" field's value of the Book entity. If the Book 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 (*BookMutation) OldExtractPath

func (m *BookMutation) OldExtractPath(ctx context.Context) (v string, err error)

OldExtractPath returns the old "ExtractPath" field's value of the Book entity. If the Book 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 (*BookMutation) OldField

func (m *BookMutation) 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 (*BookMutation) OldFilePath

func (m *BookMutation) OldFilePath(ctx context.Context) (v string, err error)

OldFilePath returns the old "FilePath" field's value of the Book entity. If the Book 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 (*BookMutation) OldFileSize

func (m *BookMutation) OldFileSize(ctx context.Context) (v int64, err error)

OldFileSize returns the old "FileSize" field's value of the Book entity. If the Book 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 (*BookMutation) OldISBN

func (m *BookMutation) OldISBN(ctx context.Context) (v string, err error)

OldISBN returns the old "ISBN" field's value of the Book entity. If the Book 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 (*BookMutation) OldInitComplete

func (m *BookMutation) OldInitComplete(ctx context.Context) (v bool, err error)

OldInitComplete returns the old "InitComplete" field's value of the Book entity. If the Book 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 (*BookMutation) OldModified

func (m *BookMutation) OldModified(ctx context.Context) (v time.Time, err error)

OldModified returns the old "Modified" field's value of the Book entity. If the Book 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 (*BookMutation) OldNonUTF8Zip

func (m *BookMutation) OldNonUTF8Zip(ctx context.Context) (v bool, err error)

OldNonUTF8Zip returns the old "NonUTF8Zip" field's value of the Book entity. If the Book 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 (*BookMutation) OldOwner added in v0.9.1

func (m *BookMutation) OldOwner(ctx context.Context) (v string, err error)

OldOwner returns the old "Owner" field's value of the Book entity. If the Book 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 (*BookMutation) OldPageCount added in v0.9.7

func (m *BookMutation) OldPageCount(ctx context.Context) (v int, err error)

OldPageCount returns the old "PageCount" field's value of the Book entity. If the Book 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 (*BookMutation) OldParentFolder

func (m *BookMutation) OldParentFolder(ctx context.Context) (v string, err error)

OldParentFolder returns the old "ParentFolder" field's value of the Book entity. If the Book 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 (*BookMutation) OldPress

func (m *BookMutation) OldPress(ctx context.Context) (v string, err error)

OldPress returns the old "Press" field's value of the Book entity. If the Book 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 (*BookMutation) OldPublishedAt

func (m *BookMutation) OldPublishedAt(ctx context.Context) (v string, err error)

OldPublishedAt returns the old "PublishedAt" field's value of the Book entity. If the Book 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 (*BookMutation) OldReadPercent

func (m *BookMutation) OldReadPercent(ctx context.Context) (v float64, err error)

OldReadPercent returns the old "ReadPercent" field's value of the Book entity. If the Book 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 (*BookMutation) OldTitle added in v0.9.7

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

OldTitle returns the old "Title" field's value of the Book entity. If the Book 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 (*BookMutation) OldType

func (m *BookMutation) OldType(ctx context.Context) (v string, err error)

OldType returns the old "Type" field's value of the Book entity. If the Book 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 (*BookMutation) OldZipTextEncoding

func (m *BookMutation) OldZipTextEncoding(ctx context.Context) (v string, err error)

OldZipTextEncoding returns the old "ZipTextEncoding" field's value of the Book entity. If the Book 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 (*BookMutation) Op

func (m *BookMutation) Op() Op

Op returns the operation name.

func (*BookMutation) Owner added in v0.9.1

func (m *BookMutation) Owner() (r string, exists bool)

Owner returns the value of the "Owner" field in the mutation.

func (*BookMutation) PageCount added in v0.9.7

func (m *BookMutation) PageCount() (r int, exists bool)

PageCount returns the value of the "PageCount" field in the mutation.

func (*BookMutation) PageInfosCleared

func (m *BookMutation) PageInfosCleared() bool

PageInfosCleared reports if the "PageInfos" edge to the SinglePageInfo entity was cleared.

func (*BookMutation) PageInfosIDs

func (m *BookMutation) PageInfosIDs() (ids []int)

PageInfosIDs returns the "PageInfos" edge IDs in the mutation.

func (*BookMutation) ParentFolder

func (m *BookMutation) ParentFolder() (r string, exists bool)

ParentFolder returns the value of the "ParentFolder" field in the mutation.

func (*BookMutation) Press

func (m *BookMutation) Press() (r string, exists bool)

Press returns the value of the "Press" field in the mutation.

func (*BookMutation) PublishedAt

func (m *BookMutation) PublishedAt() (r string, exists bool)

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

func (*BookMutation) ReadPercent

func (m *BookMutation) ReadPercent() (r float64, exists bool)

ReadPercent returns the value of the "ReadPercent" field in the mutation.

func (*BookMutation) RemovePageInfoIDs

func (m *BookMutation) RemovePageInfoIDs(ids ...int)

RemovePageInfoIDs removes the "PageInfos" edge to the SinglePageInfo entity by IDs.

func (*BookMutation) RemovedEdges

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

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

func (*BookMutation) RemovedIDs

func (m *BookMutation) 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 (*BookMutation) RemovedPageInfosIDs

func (m *BookMutation) RemovedPageInfosIDs() (ids []int)

RemovedPageInfos returns the removed IDs of the "PageInfos" edge to the SinglePageInfo entity.

func (*BookMutation) ResetAuthors

func (m *BookMutation) ResetAuthors()

ResetAuthors resets all changes to the "Authors" field.

func (*BookMutation) ResetBookID

func (m *BookMutation) ResetBookID()

ResetBookID resets all changes to the "BookID" field.

func (*BookMutation) ResetBookStorePath

func (m *BookMutation) ResetBookStorePath()

ResetBookStorePath resets all changes to the "BookStorePath" field.

func (*BookMutation) ResetChildBookNum

func (m *BookMutation) ResetChildBookNum()

ResetChildBookNum resets all changes to the "ChildBookNum" field.

func (*BookMutation) ResetDepth

func (m *BookMutation) ResetDepth()

ResetDepth resets all changes to the "Depth" field.

func (*BookMutation) ResetEdge

func (m *BookMutation) 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 (*BookMutation) ResetExtractNum

func (m *BookMutation) ResetExtractNum()

ResetExtractNum resets all changes to the "ExtractNum" field.

func (*BookMutation) ResetExtractPath

func (m *BookMutation) ResetExtractPath()

ResetExtractPath resets all changes to the "ExtractPath" field.

func (*BookMutation) ResetField

func (m *BookMutation) 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 (*BookMutation) ResetFilePath

func (m *BookMutation) ResetFilePath()

ResetFilePath resets all changes to the "FilePath" field.

func (*BookMutation) ResetFileSize

func (m *BookMutation) ResetFileSize()

ResetFileSize resets all changes to the "FileSize" field.

func (*BookMutation) ResetISBN

func (m *BookMutation) ResetISBN()

ResetISBN resets all changes to the "ISBN" field.

func (*BookMutation) ResetInitComplete

func (m *BookMutation) ResetInitComplete()

ResetInitComplete resets all changes to the "InitComplete" field.

func (*BookMutation) ResetModified

func (m *BookMutation) ResetModified()

ResetModified resets all changes to the "Modified" field.

func (*BookMutation) ResetNonUTF8Zip

func (m *BookMutation) ResetNonUTF8Zip()

ResetNonUTF8Zip resets all changes to the "NonUTF8Zip" field.

func (*BookMutation) ResetOwner added in v0.9.1

func (m *BookMutation) ResetOwner()

ResetOwner resets all changes to the "Owner" field.

func (*BookMutation) ResetPageCount added in v0.9.7

func (m *BookMutation) ResetPageCount()

ResetPageCount resets all changes to the "PageCount" field.

func (*BookMutation) ResetPageInfos

func (m *BookMutation) ResetPageInfos()

ResetPageInfos resets all changes to the "PageInfos" edge.

func (*BookMutation) ResetParentFolder

func (m *BookMutation) ResetParentFolder()

ResetParentFolder resets all changes to the "ParentFolder" field.

func (*BookMutation) ResetPress

func (m *BookMutation) ResetPress()

ResetPress resets all changes to the "Press" field.

func (*BookMutation) ResetPublishedAt

func (m *BookMutation) ResetPublishedAt()

ResetPublishedAt resets all changes to the "PublishedAt" field.

func (*BookMutation) ResetReadPercent

func (m *BookMutation) ResetReadPercent()

ResetReadPercent resets all changes to the "ReadPercent" field.

func (*BookMutation) ResetTitle added in v0.9.7

func (m *BookMutation) ResetTitle()

ResetTitle resets all changes to the "Title" field.

func (*BookMutation) ResetType

func (m *BookMutation) ResetType()

ResetType resets all changes to the "Type" field.

func (*BookMutation) ResetZipTextEncoding

func (m *BookMutation) ResetZipTextEncoding()

ResetZipTextEncoding resets all changes to the "ZipTextEncoding" field.

func (*BookMutation) SetAuthors

func (m *BookMutation) SetAuthors(s string)

SetAuthors sets the "Authors" field.

func (*BookMutation) SetBookID

func (m *BookMutation) SetBookID(s string)

SetBookID sets the "BookID" field.

func (*BookMutation) SetBookStorePath

func (m *BookMutation) SetBookStorePath(s string)

SetBookStorePath sets the "BookStorePath" field.

func (*BookMutation) SetChildBookNum

func (m *BookMutation) SetChildBookNum(i int)

SetChildBookNum sets the "ChildBookNum" field.

func (*BookMutation) SetDepth

func (m *BookMutation) SetDepth(i int)

SetDepth sets the "Depth" field.

func (*BookMutation) SetExtractNum

func (m *BookMutation) SetExtractNum(i int)

SetExtractNum sets the "ExtractNum" field.

func (*BookMutation) SetExtractPath

func (m *BookMutation) SetExtractPath(s string)

SetExtractPath sets the "ExtractPath" field.

func (*BookMutation) SetField

func (m *BookMutation) 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 (*BookMutation) SetFilePath

func (m *BookMutation) SetFilePath(s string)

SetFilePath sets the "FilePath" field.

func (*BookMutation) SetFileSize

func (m *BookMutation) SetFileSize(i int64)

SetFileSize sets the "FileSize" field.

func (*BookMutation) SetISBN

func (m *BookMutation) SetISBN(s string)

SetISBN sets the "ISBN" field.

func (*BookMutation) SetInitComplete

func (m *BookMutation) SetInitComplete(b bool)

SetInitComplete sets the "InitComplete" field.

func (*BookMutation) SetModified

func (m *BookMutation) SetModified(t time.Time)

SetModified sets the "Modified" field.

func (*BookMutation) SetNonUTF8Zip

func (m *BookMutation) SetNonUTF8Zip(b bool)

SetNonUTF8Zip sets the "NonUTF8Zip" field.

func (*BookMutation) SetOp added in v0.9.1

func (m *BookMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*BookMutation) SetOwner added in v0.9.1

func (m *BookMutation) SetOwner(s string)

SetOwner sets the "Owner" field.

func (*BookMutation) SetPageCount added in v0.9.7

func (m *BookMutation) SetPageCount(i int)

SetPageCount sets the "PageCount" field.

func (*BookMutation) SetParentFolder

func (m *BookMutation) SetParentFolder(s string)

SetParentFolder sets the "ParentFolder" field.

func (*BookMutation) SetPress

func (m *BookMutation) SetPress(s string)

SetPress sets the "Press" field.

func (*BookMutation) SetPublishedAt

func (m *BookMutation) SetPublishedAt(s string)

SetPublishedAt sets the "PublishedAt" field.

func (*BookMutation) SetReadPercent

func (m *BookMutation) SetReadPercent(f float64)

SetReadPercent sets the "ReadPercent" field.

func (*BookMutation) SetTitle added in v0.9.7

func (m *BookMutation) SetTitle(s string)

SetTitle sets the "Title" field.

func (*BookMutation) SetType

func (m *BookMutation) SetType(s string)

SetType sets the "Type" field.

func (*BookMutation) SetZipTextEncoding

func (m *BookMutation) SetZipTextEncoding(s string)

SetZipTextEncoding sets the "ZipTextEncoding" field.

func (*BookMutation) Title added in v0.9.7

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

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

func (BookMutation) Tx

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

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

func (*BookMutation) Type

func (m *BookMutation) Type() string

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

func (*BookMutation) Where

func (m *BookMutation) Where(ps ...predicate.Book)

Where appends a list predicates to the BookMutation builder.

func (*BookMutation) WhereP added in v0.9.1

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

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

func (*BookMutation) ZipTextEncoding

func (m *BookMutation) ZipTextEncoding() (r string, exists bool)

ZipTextEncoding returns the value of the "ZipTextEncoding" field in the mutation.

type BookQuery

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

BookQuery is the builder for querying Book entities.

func (*BookQuery) Aggregate added in v0.9.0

func (bq *BookQuery) Aggregate(fns ...AggregateFunc) *BookSelect

Aggregate returns a BookSelect configured with the given aggregations.

func (*BookQuery) All

func (bq *BookQuery) All(ctx context.Context) ([]*Book, error)

All executes the query and returns a list of Books.

func (*BookQuery) AllX

func (bq *BookQuery) AllX(ctx context.Context) []*Book

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

func (*BookQuery) Clone

func (bq *BookQuery) Clone() *BookQuery

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

func (*BookQuery) Count

func (bq *BookQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*BookQuery) CountX

func (bq *BookQuery) CountX(ctx context.Context) int

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

func (*BookQuery) Exist

func (bq *BookQuery) Exist(ctx context.Context) (bool, error)

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

func (*BookQuery) ExistX

func (bq *BookQuery) ExistX(ctx context.Context) bool

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

func (*BookQuery) First

func (bq *BookQuery) First(ctx context.Context) (*Book, error)

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

func (*BookQuery) FirstID

func (bq *BookQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*BookQuery) FirstIDX

func (bq *BookQuery) FirstIDX(ctx context.Context) int

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

func (*BookQuery) FirstX

func (bq *BookQuery) FirstX(ctx context.Context) *Book

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

func (*BookQuery) GroupBy

func (bq *BookQuery) GroupBy(field string, fields ...string) *BookGroupBy

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

client.Book.Query().
	GroupBy(book.FieldTitle).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*BookQuery) IDs

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

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

func (*BookQuery) IDsX

func (bq *BookQuery) IDsX(ctx context.Context) []int

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

func (*BookQuery) Limit

func (bq *BookQuery) Limit(limit int) *BookQuery

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

func (*BookQuery) Offset

func (bq *BookQuery) Offset(offset int) *BookQuery

Offset to start from.

func (*BookQuery) Only

func (bq *BookQuery) Only(ctx context.Context) (*Book, error)

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

func (*BookQuery) OnlyID

func (bq *BookQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*BookQuery) OnlyIDX

func (bq *BookQuery) OnlyIDX(ctx context.Context) int

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

func (*BookQuery) OnlyX

func (bq *BookQuery) OnlyX(ctx context.Context) *Book

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

func (*BookQuery) Order

func (bq *BookQuery) Order(o ...book.OrderOption) *BookQuery

Order specifies how the records should be ordered.

func (*BookQuery) QueryPageInfos

func (bq *BookQuery) QueryPageInfos() *SinglePageInfoQuery

QueryPageInfos chains the current query on the "PageInfos" edge.

func (*BookQuery) Select

func (bq *BookQuery) Select(fields ...string) *BookSelect

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

client.Book.Query().
	Select(book.FieldTitle).
	Scan(ctx, &v)

func (*BookQuery) Unique

func (bq *BookQuery) Unique(unique bool) *BookQuery

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

func (bq *BookQuery) Where(ps ...predicate.Book) *BookQuery

Where adds a new predicate for the BookQuery builder.

func (*BookQuery) WithPageInfos

func (bq *BookQuery) WithPageInfos(opts ...func(*SinglePageInfoQuery)) *BookQuery

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

type BookSelect

type BookSelect struct {
	*BookQuery
	// contains filtered or unexported fields
}

BookSelect is the builder for selecting fields of Book entities.

func (*BookSelect) Aggregate added in v0.9.0

func (bs *BookSelect) Aggregate(fns ...AggregateFunc) *BookSelect

Aggregate adds the given aggregation functions to the selector query.

func (*BookSelect) Bool

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

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

func (*BookSelect) BoolX

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

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

func (*BookSelect) Bools

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

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

func (*BookSelect) BoolsX

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

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

func (*BookSelect) Float64

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

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

func (*BookSelect) Float64X

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

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

func (*BookSelect) Float64s

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

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

func (*BookSelect) Float64sX

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

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

func (*BookSelect) Int

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

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

func (*BookSelect) IntX

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

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

func (*BookSelect) Ints

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

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

func (*BookSelect) IntsX

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

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

func (*BookSelect) Scan

func (bs *BookSelect) Scan(ctx context.Context, v any) error

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

func (*BookSelect) ScanX

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

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

func (*BookSelect) String

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

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

func (*BookSelect) StringX

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

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

func (*BookSelect) Strings

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

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

func (*BookSelect) StringsX

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

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

type BookUpdate

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

BookUpdate is the builder for updating Book entities.

func (*BookUpdate) AddChildBookNum

func (bu *BookUpdate) AddChildBookNum(i int) *BookUpdate

AddChildBookNum adds i to the "ChildBookNum" field.

func (*BookUpdate) AddDepth

func (bu *BookUpdate) AddDepth(i int) *BookUpdate

AddDepth adds i to the "Depth" field.

func (*BookUpdate) AddExtractNum

func (bu *BookUpdate) AddExtractNum(i int) *BookUpdate

AddExtractNum adds i to the "ExtractNum" field.

func (*BookUpdate) AddFileSize

func (bu *BookUpdate) AddFileSize(i int64) *BookUpdate

AddFileSize adds i to the "FileSize" field.

func (*BookUpdate) AddPageCount added in v0.9.7

func (bu *BookUpdate) AddPageCount(i int) *BookUpdate

AddPageCount adds i to the "PageCount" field.

func (*BookUpdate) AddPageInfoIDs

func (bu *BookUpdate) AddPageInfoIDs(ids ...int) *BookUpdate

AddPageInfoIDs adds the "PageInfos" edge to the SinglePageInfo entity by IDs.

func (*BookUpdate) AddPageInfos

func (bu *BookUpdate) AddPageInfos(s ...*SinglePageInfo) *BookUpdate

AddPageInfos adds the "PageInfos" edges to the SinglePageInfo entity.

func (*BookUpdate) AddReadPercent

func (bu *BookUpdate) AddReadPercent(f float64) *BookUpdate

AddReadPercent adds f to the "ReadPercent" field.

func (*BookUpdate) ClearPageInfos

func (bu *BookUpdate) ClearPageInfos() *BookUpdate

ClearPageInfos clears all "PageInfos" edges to the SinglePageInfo entity.

func (*BookUpdate) Exec

func (bu *BookUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*BookUpdate) ExecX

func (bu *BookUpdate) ExecX(ctx context.Context)

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

func (*BookUpdate) Mutation

func (bu *BookUpdate) Mutation() *BookMutation

Mutation returns the BookMutation object of the builder.

func (*BookUpdate) RemovePageInfoIDs

func (bu *BookUpdate) RemovePageInfoIDs(ids ...int) *BookUpdate

RemovePageInfoIDs removes the "PageInfos" edge to SinglePageInfo entities by IDs.

func (*BookUpdate) RemovePageInfos

func (bu *BookUpdate) RemovePageInfos(s ...*SinglePageInfo) *BookUpdate

RemovePageInfos removes "PageInfos" edges to SinglePageInfo entities.

func (*BookUpdate) Save

func (bu *BookUpdate) Save(ctx context.Context) (int, error)

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

func (*BookUpdate) SaveX

func (bu *BookUpdate) SaveX(ctx context.Context) int

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

func (*BookUpdate) SetAuthors

func (bu *BookUpdate) SetAuthors(s string) *BookUpdate

SetAuthors sets the "Authors" field.

func (*BookUpdate) SetBookID

func (bu *BookUpdate) SetBookID(s string) *BookUpdate

SetBookID sets the "BookID" field.

func (*BookUpdate) SetBookStorePath

func (bu *BookUpdate) SetBookStorePath(s string) *BookUpdate

SetBookStorePath sets the "BookStorePath" field.

func (*BookUpdate) SetChildBookNum

func (bu *BookUpdate) SetChildBookNum(i int) *BookUpdate

SetChildBookNum sets the "ChildBookNum" field.

func (*BookUpdate) SetDepth

func (bu *BookUpdate) SetDepth(i int) *BookUpdate

SetDepth sets the "Depth" field.

func (*BookUpdate) SetExtractNum

func (bu *BookUpdate) SetExtractNum(i int) *BookUpdate

SetExtractNum sets the "ExtractNum" field.

func (*BookUpdate) SetExtractPath

func (bu *BookUpdate) SetExtractPath(s string) *BookUpdate

SetExtractPath sets the "ExtractPath" field.

func (*BookUpdate) SetFilePath

func (bu *BookUpdate) SetFilePath(s string) *BookUpdate

SetFilePath sets the "FilePath" field.

func (*BookUpdate) SetFileSize

func (bu *BookUpdate) SetFileSize(i int64) *BookUpdate

SetFileSize sets the "FileSize" field.

func (*BookUpdate) SetISBN

func (bu *BookUpdate) SetISBN(s string) *BookUpdate

SetISBN sets the "ISBN" field.

func (*BookUpdate) SetInitComplete

func (bu *BookUpdate) SetInitComplete(b bool) *BookUpdate

SetInitComplete sets the "InitComplete" field.

func (*BookUpdate) SetModified

func (bu *BookUpdate) SetModified(t time.Time) *BookUpdate

SetModified sets the "Modified" field.

func (*BookUpdate) SetNillableAuthors added in v0.9.7

func (bu *BookUpdate) SetNillableAuthors(s *string) *BookUpdate

SetNillableAuthors sets the "Authors" field if the given value is not nil.

func (*BookUpdate) SetNillableBookID added in v0.9.7

func (bu *BookUpdate) SetNillableBookID(s *string) *BookUpdate

SetNillableBookID sets the "BookID" field if the given value is not nil.

func (*BookUpdate) SetNillableBookStorePath added in v0.9.7

func (bu *BookUpdate) SetNillableBookStorePath(s *string) *BookUpdate

SetNillableBookStorePath sets the "BookStorePath" field if the given value is not nil.

func (*BookUpdate) SetNillableChildBookNum added in v0.9.7

func (bu *BookUpdate) SetNillableChildBookNum(i *int) *BookUpdate

SetNillableChildBookNum sets the "ChildBookNum" field if the given value is not nil.

func (*BookUpdate) SetNillableDepth added in v0.9.7

func (bu *BookUpdate) SetNillableDepth(i *int) *BookUpdate

SetNillableDepth sets the "Depth" field if the given value is not nil.

func (*BookUpdate) SetNillableExtractNum added in v0.9.7

func (bu *BookUpdate) SetNillableExtractNum(i *int) *BookUpdate

SetNillableExtractNum sets the "ExtractNum" field if the given value is not nil.

func (*BookUpdate) SetNillableExtractPath added in v0.9.7

func (bu *BookUpdate) SetNillableExtractPath(s *string) *BookUpdate

SetNillableExtractPath sets the "ExtractPath" field if the given value is not nil.

func (*BookUpdate) SetNillableFilePath added in v0.9.7

func (bu *BookUpdate) SetNillableFilePath(s *string) *BookUpdate

SetNillableFilePath sets the "FilePath" field if the given value is not nil.

func (*BookUpdate) SetNillableFileSize added in v0.9.7

func (bu *BookUpdate) SetNillableFileSize(i *int64) *BookUpdate

SetNillableFileSize sets the "FileSize" field if the given value is not nil.

func (*BookUpdate) SetNillableISBN added in v0.9.7

func (bu *BookUpdate) SetNillableISBN(s *string) *BookUpdate

SetNillableISBN sets the "ISBN" field if the given value is not nil.

func (*BookUpdate) SetNillableInitComplete added in v0.9.7

func (bu *BookUpdate) SetNillableInitComplete(b *bool) *BookUpdate

SetNillableInitComplete sets the "InitComplete" field if the given value is not nil.

func (*BookUpdate) SetNillableModified

func (bu *BookUpdate) SetNillableModified(t *time.Time) *BookUpdate

SetNillableModified sets the "Modified" field if the given value is not nil.

func (*BookUpdate) SetNillableNonUTF8Zip added in v0.9.7

func (bu *BookUpdate) SetNillableNonUTF8Zip(b *bool) *BookUpdate

SetNillableNonUTF8Zip sets the "NonUTF8Zip" field if the given value is not nil.

func (*BookUpdate) SetNillableOwner added in v0.9.7

func (bu *BookUpdate) SetNillableOwner(s *string) *BookUpdate

SetNillableOwner sets the "Owner" field if the given value is not nil.

func (*BookUpdate) SetNillablePageCount added in v0.9.7

func (bu *BookUpdate) SetNillablePageCount(i *int) *BookUpdate

SetNillablePageCount sets the "PageCount" field if the given value is not nil.

func (*BookUpdate) SetNillableParentFolder added in v0.9.7

func (bu *BookUpdate) SetNillableParentFolder(s *string) *BookUpdate

SetNillableParentFolder sets the "ParentFolder" field if the given value is not nil.

func (*BookUpdate) SetNillablePress added in v0.9.7

func (bu *BookUpdate) SetNillablePress(s *string) *BookUpdate

SetNillablePress sets the "Press" field if the given value is not nil.

func (*BookUpdate) SetNillablePublishedAt added in v0.9.7

func (bu *BookUpdate) SetNillablePublishedAt(s *string) *BookUpdate

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

func (*BookUpdate) SetNillableReadPercent added in v0.9.7

func (bu *BookUpdate) SetNillableReadPercent(f *float64) *BookUpdate

SetNillableReadPercent sets the "ReadPercent" field if the given value is not nil.

func (*BookUpdate) SetNillableTitle added in v0.9.7

func (bu *BookUpdate) SetNillableTitle(s *string) *BookUpdate

SetNillableTitle sets the "Title" field if the given value is not nil.

func (*BookUpdate) SetNillableType added in v0.9.7

func (bu *BookUpdate) SetNillableType(s *string) *BookUpdate

SetNillableType sets the "Type" field if the given value is not nil.

func (*BookUpdate) SetNillableZipTextEncoding added in v0.9.7

func (bu *BookUpdate) SetNillableZipTextEncoding(s *string) *BookUpdate

SetNillableZipTextEncoding sets the "ZipTextEncoding" field if the given value is not nil.

func (*BookUpdate) SetNonUTF8Zip

func (bu *BookUpdate) SetNonUTF8Zip(b bool) *BookUpdate

SetNonUTF8Zip sets the "NonUTF8Zip" field.

func (*BookUpdate) SetOwner added in v0.9.1

func (bu *BookUpdate) SetOwner(s string) *BookUpdate

SetOwner sets the "Owner" field.

func (*BookUpdate) SetPageCount added in v0.9.7

func (bu *BookUpdate) SetPageCount(i int) *BookUpdate

SetPageCount sets the "PageCount" field.

func (*BookUpdate) SetParentFolder

func (bu *BookUpdate) SetParentFolder(s string) *BookUpdate

SetParentFolder sets the "ParentFolder" field.

func (*BookUpdate) SetPress

func (bu *BookUpdate) SetPress(s string) *BookUpdate

SetPress sets the "Press" field.

func (*BookUpdate) SetPublishedAt

func (bu *BookUpdate) SetPublishedAt(s string) *BookUpdate

SetPublishedAt sets the "PublishedAt" field.

func (*BookUpdate) SetReadPercent

func (bu *BookUpdate) SetReadPercent(f float64) *BookUpdate

SetReadPercent sets the "ReadPercent" field.

func (*BookUpdate) SetTitle added in v0.9.7

func (bu *BookUpdate) SetTitle(s string) *BookUpdate

SetTitle sets the "Title" field.

func (*BookUpdate) SetType

func (bu *BookUpdate) SetType(s string) *BookUpdate

SetType sets the "Type" field.

func (*BookUpdate) SetZipTextEncoding

func (bu *BookUpdate) SetZipTextEncoding(s string) *BookUpdate

SetZipTextEncoding sets the "ZipTextEncoding" field.

func (*BookUpdate) Where

func (bu *BookUpdate) Where(ps ...predicate.Book) *BookUpdate

Where appends a list predicates to the BookUpdate builder.

type BookUpdateOne

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

BookUpdateOne is the builder for updating a single Book entity.

func (*BookUpdateOne) AddChildBookNum

func (buo *BookUpdateOne) AddChildBookNum(i int) *BookUpdateOne

AddChildBookNum adds i to the "ChildBookNum" field.

func (*BookUpdateOne) AddDepth

func (buo *BookUpdateOne) AddDepth(i int) *BookUpdateOne

AddDepth adds i to the "Depth" field.

func (*BookUpdateOne) AddExtractNum

func (buo *BookUpdateOne) AddExtractNum(i int) *BookUpdateOne

AddExtractNum adds i to the "ExtractNum" field.

func (*BookUpdateOne) AddFileSize

func (buo *BookUpdateOne) AddFileSize(i int64) *BookUpdateOne

AddFileSize adds i to the "FileSize" field.

func (*BookUpdateOne) AddPageCount added in v0.9.7

func (buo *BookUpdateOne) AddPageCount(i int) *BookUpdateOne

AddPageCount adds i to the "PageCount" field.

func (*BookUpdateOne) AddPageInfoIDs

func (buo *BookUpdateOne) AddPageInfoIDs(ids ...int) *BookUpdateOne

AddPageInfoIDs adds the "PageInfos" edge to the SinglePageInfo entity by IDs.

func (*BookUpdateOne) AddPageInfos

func (buo *BookUpdateOne) AddPageInfos(s ...*SinglePageInfo) *BookUpdateOne

AddPageInfos adds the "PageInfos" edges to the SinglePageInfo entity.

func (*BookUpdateOne) AddReadPercent

func (buo *BookUpdateOne) AddReadPercent(f float64) *BookUpdateOne

AddReadPercent adds f to the "ReadPercent" field.

func (*BookUpdateOne) ClearPageInfos

func (buo *BookUpdateOne) ClearPageInfos() *BookUpdateOne

ClearPageInfos clears all "PageInfos" edges to the SinglePageInfo entity.

func (*BookUpdateOne) Exec

func (buo *BookUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*BookUpdateOne) ExecX

func (buo *BookUpdateOne) ExecX(ctx context.Context)

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

func (*BookUpdateOne) Mutation

func (buo *BookUpdateOne) Mutation() *BookMutation

Mutation returns the BookMutation object of the builder.

func (*BookUpdateOne) RemovePageInfoIDs

func (buo *BookUpdateOne) RemovePageInfoIDs(ids ...int) *BookUpdateOne

RemovePageInfoIDs removes the "PageInfos" edge to SinglePageInfo entities by IDs.

func (*BookUpdateOne) RemovePageInfos

func (buo *BookUpdateOne) RemovePageInfos(s ...*SinglePageInfo) *BookUpdateOne

RemovePageInfos removes "PageInfos" edges to SinglePageInfo entities.

func (*BookUpdateOne) Save

func (buo *BookUpdateOne) Save(ctx context.Context) (*Book, error)

Save executes the query and returns the updated Book entity.

func (*BookUpdateOne) SaveX

func (buo *BookUpdateOne) SaveX(ctx context.Context) *Book

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

func (*BookUpdateOne) Select

func (buo *BookUpdateOne) Select(field string, fields ...string) *BookUpdateOne

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

func (*BookUpdateOne) SetAuthors

func (buo *BookUpdateOne) SetAuthors(s string) *BookUpdateOne

SetAuthors sets the "Authors" field.

func (*BookUpdateOne) SetBookID

func (buo *BookUpdateOne) SetBookID(s string) *BookUpdateOne

SetBookID sets the "BookID" field.

func (*BookUpdateOne) SetBookStorePath

func (buo *BookUpdateOne) SetBookStorePath(s string) *BookUpdateOne

SetBookStorePath sets the "BookStorePath" field.

func (*BookUpdateOne) SetChildBookNum

func (buo *BookUpdateOne) SetChildBookNum(i int) *BookUpdateOne

SetChildBookNum sets the "ChildBookNum" field.

func (*BookUpdateOne) SetDepth

func (buo *BookUpdateOne) SetDepth(i int) *BookUpdateOne

SetDepth sets the "Depth" field.

func (*BookUpdateOne) SetExtractNum

func (buo *BookUpdateOne) SetExtractNum(i int) *BookUpdateOne

SetExtractNum sets the "ExtractNum" field.

func (*BookUpdateOne) SetExtractPath

func (buo *BookUpdateOne) SetExtractPath(s string) *BookUpdateOne

SetExtractPath sets the "ExtractPath" field.

func (*BookUpdateOne) SetFilePath

func (buo *BookUpdateOne) SetFilePath(s string) *BookUpdateOne

SetFilePath sets the "FilePath" field.

func (*BookUpdateOne) SetFileSize

func (buo *BookUpdateOne) SetFileSize(i int64) *BookUpdateOne

SetFileSize sets the "FileSize" field.

func (*BookUpdateOne) SetISBN

func (buo *BookUpdateOne) SetISBN(s string) *BookUpdateOne

SetISBN sets the "ISBN" field.

func (*BookUpdateOne) SetInitComplete

func (buo *BookUpdateOne) SetInitComplete(b bool) *BookUpdateOne

SetInitComplete sets the "InitComplete" field.

func (*BookUpdateOne) SetModified

func (buo *BookUpdateOne) SetModified(t time.Time) *BookUpdateOne

SetModified sets the "Modified" field.

func (*BookUpdateOne) SetNillableAuthors added in v0.9.7

func (buo *BookUpdateOne) SetNillableAuthors(s *string) *BookUpdateOne

SetNillableAuthors sets the "Authors" field if the given value is not nil.

func (*BookUpdateOne) SetNillableBookID added in v0.9.7

func (buo *BookUpdateOne) SetNillableBookID(s *string) *BookUpdateOne

SetNillableBookID sets the "BookID" field if the given value is not nil.

func (*BookUpdateOne) SetNillableBookStorePath added in v0.9.7

func (buo *BookUpdateOne) SetNillableBookStorePath(s *string) *BookUpdateOne

SetNillableBookStorePath sets the "BookStorePath" field if the given value is not nil.

func (*BookUpdateOne) SetNillableChildBookNum added in v0.9.7

func (buo *BookUpdateOne) SetNillableChildBookNum(i *int) *BookUpdateOne

SetNillableChildBookNum sets the "ChildBookNum" field if the given value is not nil.

func (*BookUpdateOne) SetNillableDepth added in v0.9.7

func (buo *BookUpdateOne) SetNillableDepth(i *int) *BookUpdateOne

SetNillableDepth sets the "Depth" field if the given value is not nil.

func (*BookUpdateOne) SetNillableExtractNum added in v0.9.7

func (buo *BookUpdateOne) SetNillableExtractNum(i *int) *BookUpdateOne

SetNillableExtractNum sets the "ExtractNum" field if the given value is not nil.

func (*BookUpdateOne) SetNillableExtractPath added in v0.9.7

func (buo *BookUpdateOne) SetNillableExtractPath(s *string) *BookUpdateOne

SetNillableExtractPath sets the "ExtractPath" field if the given value is not nil.

func (*BookUpdateOne) SetNillableFilePath added in v0.9.7

func (buo *BookUpdateOne) SetNillableFilePath(s *string) *BookUpdateOne

SetNillableFilePath sets the "FilePath" field if the given value is not nil.

func (*BookUpdateOne) SetNillableFileSize added in v0.9.7

func (buo *BookUpdateOne) SetNillableFileSize(i *int64) *BookUpdateOne

SetNillableFileSize sets the "FileSize" field if the given value is not nil.

func (*BookUpdateOne) SetNillableISBN added in v0.9.7

func (buo *BookUpdateOne) SetNillableISBN(s *string) *BookUpdateOne

SetNillableISBN sets the "ISBN" field if the given value is not nil.

func (*BookUpdateOne) SetNillableInitComplete added in v0.9.7

func (buo *BookUpdateOne) SetNillableInitComplete(b *bool) *BookUpdateOne

SetNillableInitComplete sets the "InitComplete" field if the given value is not nil.

func (*BookUpdateOne) SetNillableModified

func (buo *BookUpdateOne) SetNillableModified(t *time.Time) *BookUpdateOne

SetNillableModified sets the "Modified" field if the given value is not nil.

func (*BookUpdateOne) SetNillableNonUTF8Zip added in v0.9.7

func (buo *BookUpdateOne) SetNillableNonUTF8Zip(b *bool) *BookUpdateOne

SetNillableNonUTF8Zip sets the "NonUTF8Zip" field if the given value is not nil.

func (*BookUpdateOne) SetNillableOwner added in v0.9.7

func (buo *BookUpdateOne) SetNillableOwner(s *string) *BookUpdateOne

SetNillableOwner sets the "Owner" field if the given value is not nil.

func (*BookUpdateOne) SetNillablePageCount added in v0.9.7

func (buo *BookUpdateOne) SetNillablePageCount(i *int) *BookUpdateOne

SetNillablePageCount sets the "PageCount" field if the given value is not nil.

func (*BookUpdateOne) SetNillableParentFolder added in v0.9.7

func (buo *BookUpdateOne) SetNillableParentFolder(s *string) *BookUpdateOne

SetNillableParentFolder sets the "ParentFolder" field if the given value is not nil.

func (*BookUpdateOne) SetNillablePress added in v0.9.7

func (buo *BookUpdateOne) SetNillablePress(s *string) *BookUpdateOne

SetNillablePress sets the "Press" field if the given value is not nil.

func (*BookUpdateOne) SetNillablePublishedAt added in v0.9.7

func (buo *BookUpdateOne) SetNillablePublishedAt(s *string) *BookUpdateOne

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

func (*BookUpdateOne) SetNillableReadPercent added in v0.9.7

func (buo *BookUpdateOne) SetNillableReadPercent(f *float64) *BookUpdateOne

SetNillableReadPercent sets the "ReadPercent" field if the given value is not nil.

func (*BookUpdateOne) SetNillableTitle added in v0.9.7

func (buo *BookUpdateOne) SetNillableTitle(s *string) *BookUpdateOne

SetNillableTitle sets the "Title" field if the given value is not nil.

func (*BookUpdateOne) SetNillableType added in v0.9.7

func (buo *BookUpdateOne) SetNillableType(s *string) *BookUpdateOne

SetNillableType sets the "Type" field if the given value is not nil.

func (*BookUpdateOne) SetNillableZipTextEncoding added in v0.9.7

func (buo *BookUpdateOne) SetNillableZipTextEncoding(s *string) *BookUpdateOne

SetNillableZipTextEncoding sets the "ZipTextEncoding" field if the given value is not nil.

func (*BookUpdateOne) SetNonUTF8Zip

func (buo *BookUpdateOne) SetNonUTF8Zip(b bool) *BookUpdateOne

SetNonUTF8Zip sets the "NonUTF8Zip" field.

func (*BookUpdateOne) SetOwner added in v0.9.1

func (buo *BookUpdateOne) SetOwner(s string) *BookUpdateOne

SetOwner sets the "Owner" field.

func (*BookUpdateOne) SetPageCount added in v0.9.7

func (buo *BookUpdateOne) SetPageCount(i int) *BookUpdateOne

SetPageCount sets the "PageCount" field.

func (*BookUpdateOne) SetParentFolder

func (buo *BookUpdateOne) SetParentFolder(s string) *BookUpdateOne

SetParentFolder sets the "ParentFolder" field.

func (*BookUpdateOne) SetPress

func (buo *BookUpdateOne) SetPress(s string) *BookUpdateOne

SetPress sets the "Press" field.

func (*BookUpdateOne) SetPublishedAt

func (buo *BookUpdateOne) SetPublishedAt(s string) *BookUpdateOne

SetPublishedAt sets the "PublishedAt" field.

func (*BookUpdateOne) SetReadPercent

func (buo *BookUpdateOne) SetReadPercent(f float64) *BookUpdateOne

SetReadPercent sets the "ReadPercent" field.

func (*BookUpdateOne) SetTitle added in v0.9.7

func (buo *BookUpdateOne) SetTitle(s string) *BookUpdateOne

SetTitle sets the "Title" field.

func (*BookUpdateOne) SetType

func (buo *BookUpdateOne) SetType(s string) *BookUpdateOne

SetType sets the "Type" field.

func (*BookUpdateOne) SetZipTextEncoding

func (buo *BookUpdateOne) SetZipTextEncoding(s string) *BookUpdateOne

SetZipTextEncoding sets the "ZipTextEncoding" field.

func (*BookUpdateOne) Where added in v0.9.1

func (buo *BookUpdateOne) Where(ps ...predicate.Book) *BookUpdateOne

Where appends a list predicates to the BookUpdate builder.

type Books

type Books []*Book

Books is a parsable slice of Book.

type Client

type Client struct {

	// Schema is the client for creating, migrating and dropping schema.
	Schema *migrate.Schema
	// Book is the client for interacting with the Book builders.
	Book *BookClient
	// SinglePageInfo is the client for interacting with the SinglePageInfo builders.
	SinglePageInfo *SinglePageInfoClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Client is the client that holds all ent builders.

func FromContext

func FromContext(ctx context.Context) *Client

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

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client configured with the given options.

func Open

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

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

func (*Client) BeginTx

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

BeginTx returns a transactional client with specified options.

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Debug

func (c *Client) Debug() *Client

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

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

func (*Client) Intercept added in v0.9.1

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 added in v0.9.1

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

Mutate implements the ent.Mutator interface.

func (*Client) Tx

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

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

func (*Client) Use

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

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

type CommitFunc

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

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

func (CommitFunc) Commit

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

Commit calls f(ctx, m).

type CommitHook

type CommitHook func(Committer) Committer

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

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

type Committer

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

Committer is the interface that wraps the Commit method.

type ConstraintError

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

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

func (ConstraintError) Error

func (e ConstraintError) Error() string

Error implements the error interface.

func (*ConstraintError) Unwrap

func (e *ConstraintError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Hook

type Hook = ent.Hook

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

type InterceptFunc added in v0.9.1

type InterceptFunc = ent.InterceptFunc

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

type Interceptor added in v0.9.1

type Interceptor = ent.Interceptor

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

type MutateFunc

type MutateFunc = ent.MutateFunc

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

type Mutation

type Mutation = ent.Mutation

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

type Mutator

type Mutator = ent.Mutator

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

type NotFoundError

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

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

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Error implements the error interface.

type NotLoadedError

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

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

func (*NotLoadedError) Error

func (e *NotLoadedError) Error() string

Error implements the error interface.

type NotSingularError

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

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

func (*NotSingularError) Error

func (e *NotSingularError) Error() string

Error implements the error interface.

type Op

type Op = ent.Op

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

type Option

type Option func(*config)

Option function to configure the client.

func Debug

func Debug() Option

Debug enables debug logging on the ent.Driver.

func Driver

func Driver(driver dialect.Driver) Option

Driver configures the client driver.

func Log

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

Log sets the logging function for debug mode.

type OrderFunc

type OrderFunc func(*sql.Selector)

OrderFunc applies an ordering on the sql selector. Deprecated: Use Asc/Desc functions or the package builders instead.

type Policy

type Policy = ent.Policy

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

type Querier added in v0.9.1

type Querier = ent.Querier

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

type QuerierFunc added in v0.9.1

type QuerierFunc = ent.QuerierFunc

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

type Query

type Query = ent.Query

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

type QueryContext added in v0.9.1

type QueryContext = ent.QueryContext

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

type RollbackFunc

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

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

func (RollbackFunc) Rollback

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

Rollback calls f(ctx, m).

type RollbackHook

type RollbackHook func(Rollbacker) Rollbacker

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

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

type Rollbacker

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

Rollbacker is the interface that wraps the Rollback method.

type SinglePageInfo

type SinglePageInfo struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// BookID holds the value of the "BookID" field.
	BookID string `json:"BookID,omitempty"`
	// PageNum holds the value of the "PageNum" field.
	PageNum int `json:"PageNum,omitempty"`
	// NameInArchive holds the value of the "NameInArchive" field.
	NameInArchive string `json:"NameInArchive,omitempty"`
	// URL holds the value of the "Url" field.
	URL string `json:"Url,omitempty"`
	// BlurHash holds the value of the "BlurHash" field.
	BlurHash string `json:"BlurHash,omitempty"`
	// Height holds the value of the "Height" field.
	Height int `json:"Height,omitempty"`
	// Width holds the value of the "Width" field.
	Width int `json:"Width,omitempty"`
	// ModeTime holds the value of the "ModeTime" field.
	ModeTime time.Time `json:"ModeTime,omitempty"`
	// FileSize holds the value of the "FileSize" field.
	FileSize int64 `json:"FileSize,omitempty"`
	// RealImageFilePATH holds the value of the "RealImageFilePATH" field.
	RealImageFilePATH string `json:"RealImageFilePATH,omitempty"`
	// ImgType holds the value of the "ImgType" field.
	ImgType string `json:"ImgType,omitempty"`
	// contains filtered or unexported fields
}

SinglePageInfo is the model entity for the SinglePageInfo schema.

func (*SinglePageInfo) String

func (spi *SinglePageInfo) String() string

String implements the fmt.Stringer.

func (*SinglePageInfo) Unwrap

func (spi *SinglePageInfo) Unwrap() *SinglePageInfo

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

func (spi *SinglePageInfo) Update() *SinglePageInfoUpdateOne

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

func (*SinglePageInfo) Value added in v0.9.5

func (spi *SinglePageInfo) Value(name string) (ent.Value, error)

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

type SinglePageInfoClient

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

SinglePageInfoClient is a client for the SinglePageInfo schema.

func NewSinglePageInfoClient

func NewSinglePageInfoClient(c config) *SinglePageInfoClient

NewSinglePageInfoClient returns a client for the SinglePageInfo from the given config.

func (*SinglePageInfoClient) Create

Create returns a builder for creating a SinglePageInfo entity.

func (*SinglePageInfoClient) CreateBulk

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

func (*SinglePageInfoClient) Delete

Delete returns a delete builder for SinglePageInfo.

func (*SinglePageInfoClient) DeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*SinglePageInfoClient) DeleteOneID

func (c *SinglePageInfoClient) DeleteOneID(id int) *SinglePageInfoDeleteOne

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

func (*SinglePageInfoClient) Get

Get returns a SinglePageInfo entity by its id.

func (*SinglePageInfoClient) GetX

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

func (*SinglePageInfoClient) Hooks

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

Hooks returns the client hooks.

func (*SinglePageInfoClient) Intercept added in v0.9.1

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

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

func (*SinglePageInfoClient) Interceptors added in v0.9.1

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

Interceptors returns the client interceptors.

func (*SinglePageInfoClient) MapCreateBulk added in v0.9.7

func (c *SinglePageInfoClient) MapCreateBulk(slice any, setFunc func(*SinglePageInfoCreate, int)) *SinglePageInfoCreateBulk

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

Query returns a query builder for SinglePageInfo.

func (*SinglePageInfoClient) Update

Update returns an update builder for SinglePageInfo.

func (*SinglePageInfoClient) UpdateOne

UpdateOne returns an update builder for the given entity.

func (*SinglePageInfoClient) UpdateOneID

func (c *SinglePageInfoClient) UpdateOneID(id int) *SinglePageInfoUpdateOne

UpdateOneID returns an update builder for the given id.

func (*SinglePageInfoClient) Use

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

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

type SinglePageInfoCreate

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

SinglePageInfoCreate is the builder for creating a SinglePageInfo entity.

func (*SinglePageInfoCreate) Exec

func (spic *SinglePageInfoCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*SinglePageInfoCreate) ExecX

func (spic *SinglePageInfoCreate) ExecX(ctx context.Context)

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

func (*SinglePageInfoCreate) Mutation

func (spic *SinglePageInfoCreate) Mutation() *SinglePageInfoMutation

Mutation returns the SinglePageInfoMutation object of the builder.

func (*SinglePageInfoCreate) Save

Save creates the SinglePageInfo in the database.

func (*SinglePageInfoCreate) SaveX

SaveX calls Save and panics if Save returns an error.

func (*SinglePageInfoCreate) SetBlurHash

func (spic *SinglePageInfoCreate) SetBlurHash(s string) *SinglePageInfoCreate

SetBlurHash sets the "BlurHash" field.

func (*SinglePageInfoCreate) SetBookID

func (spic *SinglePageInfoCreate) SetBookID(s string) *SinglePageInfoCreate

SetBookID sets the "BookID" field.

func (*SinglePageInfoCreate) SetFileSize

func (spic *SinglePageInfoCreate) SetFileSize(i int64) *SinglePageInfoCreate

SetFileSize sets the "FileSize" field.

func (*SinglePageInfoCreate) SetHeight

func (spic *SinglePageInfoCreate) SetHeight(i int) *SinglePageInfoCreate

SetHeight sets the "Height" field.

func (*SinglePageInfoCreate) SetImgType

func (spic *SinglePageInfoCreate) SetImgType(s string) *SinglePageInfoCreate

SetImgType sets the "ImgType" field.

func (*SinglePageInfoCreate) SetModeTime

func (spic *SinglePageInfoCreate) SetModeTime(t time.Time) *SinglePageInfoCreate

SetModeTime sets the "ModeTime" field.

func (*SinglePageInfoCreate) SetNameInArchive

func (spic *SinglePageInfoCreate) SetNameInArchive(s string) *SinglePageInfoCreate

SetNameInArchive sets the "NameInArchive" field.

func (*SinglePageInfoCreate) SetNillableModeTime

func (spic *SinglePageInfoCreate) SetNillableModeTime(t *time.Time) *SinglePageInfoCreate

SetNillableModeTime sets the "ModeTime" field if the given value is not nil.

func (*SinglePageInfoCreate) SetPageNum

func (spic *SinglePageInfoCreate) SetPageNum(i int) *SinglePageInfoCreate

SetPageNum sets the "PageNum" field.

func (*SinglePageInfoCreate) SetRealImageFilePATH

func (spic *SinglePageInfoCreate) SetRealImageFilePATH(s string) *SinglePageInfoCreate

SetRealImageFilePATH sets the "RealImageFilePATH" field.

func (*SinglePageInfoCreate) SetURL

SetURL sets the "Url" field.

func (*SinglePageInfoCreate) SetWidth

func (spic *SinglePageInfoCreate) SetWidth(i int) *SinglePageInfoCreate

SetWidth sets the "Width" field.

type SinglePageInfoCreateBulk

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

SinglePageInfoCreateBulk is the builder for creating many SinglePageInfo entities in bulk.

func (*SinglePageInfoCreateBulk) Exec

func (spicb *SinglePageInfoCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*SinglePageInfoCreateBulk) ExecX

func (spicb *SinglePageInfoCreateBulk) ExecX(ctx context.Context)

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

func (*SinglePageInfoCreateBulk) Save

Save creates the SinglePageInfo entities in the database.

func (*SinglePageInfoCreateBulk) SaveX

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

type SinglePageInfoDelete

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

SinglePageInfoDelete is the builder for deleting a SinglePageInfo entity.

func (*SinglePageInfoDelete) Exec

func (spid *SinglePageInfoDelete) Exec(ctx context.Context) (int, error)

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

func (*SinglePageInfoDelete) ExecX

func (spid *SinglePageInfoDelete) ExecX(ctx context.Context) int

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

func (*SinglePageInfoDelete) Where

Where appends a list predicates to the SinglePageInfoDelete builder.

type SinglePageInfoDeleteOne

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

SinglePageInfoDeleteOne is the builder for deleting a single SinglePageInfo entity.

func (*SinglePageInfoDeleteOne) Exec

func (spido *SinglePageInfoDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*SinglePageInfoDeleteOne) ExecX

func (spido *SinglePageInfoDeleteOne) ExecX(ctx context.Context)

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

func (*SinglePageInfoDeleteOne) Where added in v0.9.1

Where appends a list predicates to the SinglePageInfoDelete builder.

type SinglePageInfoGroupBy

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

SinglePageInfoGroupBy is the group-by builder for SinglePageInfo entities.

func (*SinglePageInfoGroupBy) Aggregate

func (spigb *SinglePageInfoGroupBy) Aggregate(fns ...AggregateFunc) *SinglePageInfoGroupBy

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

func (*SinglePageInfoGroupBy) Bool

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

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

func (*SinglePageInfoGroupBy) BoolX

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

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

func (*SinglePageInfoGroupBy) Bools

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

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

func (*SinglePageInfoGroupBy) BoolsX

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

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

func (*SinglePageInfoGroupBy) Float64

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

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

func (*SinglePageInfoGroupBy) Float64X

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

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

func (*SinglePageInfoGroupBy) Float64s

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

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

func (*SinglePageInfoGroupBy) Float64sX

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

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

func (*SinglePageInfoGroupBy) Int

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

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

func (*SinglePageInfoGroupBy) IntX

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

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

func (*SinglePageInfoGroupBy) Ints

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

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

func (*SinglePageInfoGroupBy) IntsX

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

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

func (*SinglePageInfoGroupBy) Scan

func (spigb *SinglePageInfoGroupBy) Scan(ctx context.Context, v any) error

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

func (*SinglePageInfoGroupBy) ScanX

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

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

func (*SinglePageInfoGroupBy) String

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

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

func (*SinglePageInfoGroupBy) StringX

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

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

func (*SinglePageInfoGroupBy) Strings

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

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

func (*SinglePageInfoGroupBy) StringsX

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

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

type SinglePageInfoMutation

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

SinglePageInfoMutation represents an operation that mutates the SinglePageInfo nodes in the graph.

func (*SinglePageInfoMutation) AddField

func (m *SinglePageInfoMutation) 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 (*SinglePageInfoMutation) AddFileSize

func (m *SinglePageInfoMutation) AddFileSize(i int64)

AddFileSize adds i to the "FileSize" field.

func (*SinglePageInfoMutation) AddHeight

func (m *SinglePageInfoMutation) AddHeight(i int)

AddHeight adds i to the "Height" field.

func (*SinglePageInfoMutation) AddPageNum

func (m *SinglePageInfoMutation) AddPageNum(i int)

AddPageNum adds i to the "PageNum" field.

func (*SinglePageInfoMutation) AddWidth

func (m *SinglePageInfoMutation) AddWidth(i int)

AddWidth adds i to the "Width" field.

func (*SinglePageInfoMutation) AddedEdges

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

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

func (*SinglePageInfoMutation) AddedField

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

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

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

func (*SinglePageInfoMutation) AddedFileSize

func (m *SinglePageInfoMutation) AddedFileSize() (r int64, exists bool)

AddedFileSize returns the value that was added to the "FileSize" field in this mutation.

func (*SinglePageInfoMutation) AddedHeight

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

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

func (*SinglePageInfoMutation) AddedIDs

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

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

func (*SinglePageInfoMutation) AddedPageNum

func (m *SinglePageInfoMutation) AddedPageNum() (r int, exists bool)

AddedPageNum returns the value that was added to the "PageNum" field in this mutation.

func (*SinglePageInfoMutation) AddedWidth

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

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

func (*SinglePageInfoMutation) BlurHash

func (m *SinglePageInfoMutation) BlurHash() (r string, exists bool)

BlurHash returns the value of the "BlurHash" field in the mutation.

func (*SinglePageInfoMutation) BookID

func (m *SinglePageInfoMutation) BookID() (r string, exists bool)

BookID returns the value of the "BookID" field in the mutation.

func (*SinglePageInfoMutation) ClearEdge

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

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

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

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

func (*SinglePageInfoMutation) ClearedFields

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

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

func (SinglePageInfoMutation) Client

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

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

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

func (*SinglePageInfoMutation) Field

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

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

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

func (*SinglePageInfoMutation) Fields

func (m *SinglePageInfoMutation) 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 (*SinglePageInfoMutation) FileSize

func (m *SinglePageInfoMutation) FileSize() (r int64, exists bool)

FileSize returns the value of the "FileSize" field in the mutation.

func (*SinglePageInfoMutation) Height

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

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

func (*SinglePageInfoMutation) ID

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

func (m *SinglePageInfoMutation) 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 (*SinglePageInfoMutation) ImgType

func (m *SinglePageInfoMutation) ImgType() (r string, exists bool)

ImgType returns the value of the "ImgType" field in the mutation.

func (*SinglePageInfoMutation) ModeTime

func (m *SinglePageInfoMutation) ModeTime() (r time.Time, exists bool)

ModeTime returns the value of the "ModeTime" field in the mutation.

func (*SinglePageInfoMutation) NameInArchive

func (m *SinglePageInfoMutation) NameInArchive() (r string, exists bool)

NameInArchive returns the value of the "NameInArchive" field in the mutation.

func (*SinglePageInfoMutation) OldBlurHash

func (m *SinglePageInfoMutation) OldBlurHash(ctx context.Context) (v string, err error)

OldBlurHash returns the old "BlurHash" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldBookID

func (m *SinglePageInfoMutation) OldBookID(ctx context.Context) (v string, err error)

OldBookID returns the old "BookID" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldField

func (m *SinglePageInfoMutation) 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 (*SinglePageInfoMutation) OldFileSize

func (m *SinglePageInfoMutation) OldFileSize(ctx context.Context) (v int64, err error)

OldFileSize returns the old "FileSize" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldHeight

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

OldHeight returns the old "Height" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldImgType

func (m *SinglePageInfoMutation) OldImgType(ctx context.Context) (v string, err error)

OldImgType returns the old "ImgType" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldModeTime

func (m *SinglePageInfoMutation) OldModeTime(ctx context.Context) (v time.Time, err error)

OldModeTime returns the old "ModeTime" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldNameInArchive

func (m *SinglePageInfoMutation) OldNameInArchive(ctx context.Context) (v string, err error)

OldNameInArchive returns the old "NameInArchive" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldPageNum

func (m *SinglePageInfoMutation) OldPageNum(ctx context.Context) (v int, err error)

OldPageNum returns the old "PageNum" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldRealImageFilePATH

func (m *SinglePageInfoMutation) OldRealImageFilePATH(ctx context.Context) (v string, err error)

OldRealImageFilePATH returns the old "RealImageFilePATH" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldURL

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

OldURL returns the old "Url" field's value of the SinglePageInfo entity. If the SinglePageInfo 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 (*SinglePageInfoMutation) OldWidth

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

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

func (m *SinglePageInfoMutation) Op() Op

Op returns the operation name.

func (*SinglePageInfoMutation) PageNum

func (m *SinglePageInfoMutation) PageNum() (r int, exists bool)

PageNum returns the value of the "PageNum" field in the mutation.

func (*SinglePageInfoMutation) RealImageFilePATH

func (m *SinglePageInfoMutation) RealImageFilePATH() (r string, exists bool)

RealImageFilePATH returns the value of the "RealImageFilePATH" field in the mutation.

func (*SinglePageInfoMutation) RemovedEdges

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

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

func (*SinglePageInfoMutation) RemovedIDs

func (m *SinglePageInfoMutation) 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 (*SinglePageInfoMutation) ResetBlurHash

func (m *SinglePageInfoMutation) ResetBlurHash()

ResetBlurHash resets all changes to the "BlurHash" field.

func (*SinglePageInfoMutation) ResetBookID

func (m *SinglePageInfoMutation) ResetBookID()

ResetBookID resets all changes to the "BookID" field.

func (*SinglePageInfoMutation) ResetEdge

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

func (m *SinglePageInfoMutation) 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 (*SinglePageInfoMutation) ResetFileSize

func (m *SinglePageInfoMutation) ResetFileSize()

ResetFileSize resets all changes to the "FileSize" field.

func (*SinglePageInfoMutation) ResetHeight

func (m *SinglePageInfoMutation) ResetHeight()

ResetHeight resets all changes to the "Height" field.

func (*SinglePageInfoMutation) ResetImgType

func (m *SinglePageInfoMutation) ResetImgType()

ResetImgType resets all changes to the "ImgType" field.

func (*SinglePageInfoMutation) ResetModeTime

func (m *SinglePageInfoMutation) ResetModeTime()

ResetModeTime resets all changes to the "ModeTime" field.

func (*SinglePageInfoMutation) ResetNameInArchive

func (m *SinglePageInfoMutation) ResetNameInArchive()

ResetNameInArchive resets all changes to the "NameInArchive" field.

func (*SinglePageInfoMutation) ResetPageNum

func (m *SinglePageInfoMutation) ResetPageNum()

ResetPageNum resets all changes to the "PageNum" field.

func (*SinglePageInfoMutation) ResetRealImageFilePATH

func (m *SinglePageInfoMutation) ResetRealImageFilePATH()

ResetRealImageFilePATH resets all changes to the "RealImageFilePATH" field.

func (*SinglePageInfoMutation) ResetURL

func (m *SinglePageInfoMutation) ResetURL()

ResetURL resets all changes to the "Url" field.

func (*SinglePageInfoMutation) ResetWidth

func (m *SinglePageInfoMutation) ResetWidth()

ResetWidth resets all changes to the "Width" field.

func (*SinglePageInfoMutation) SetBlurHash

func (m *SinglePageInfoMutation) SetBlurHash(s string)

SetBlurHash sets the "BlurHash" field.

func (*SinglePageInfoMutation) SetBookID

func (m *SinglePageInfoMutation) SetBookID(s string)

SetBookID sets the "BookID" field.

func (*SinglePageInfoMutation) SetField

func (m *SinglePageInfoMutation) 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 (*SinglePageInfoMutation) SetFileSize

func (m *SinglePageInfoMutation) SetFileSize(i int64)

SetFileSize sets the "FileSize" field.

func (*SinglePageInfoMutation) SetHeight

func (m *SinglePageInfoMutation) SetHeight(i int)

SetHeight sets the "Height" field.

func (*SinglePageInfoMutation) SetImgType

func (m *SinglePageInfoMutation) SetImgType(s string)

SetImgType sets the "ImgType" field.

func (*SinglePageInfoMutation) SetModeTime

func (m *SinglePageInfoMutation) SetModeTime(t time.Time)

SetModeTime sets the "ModeTime" field.

func (*SinglePageInfoMutation) SetNameInArchive

func (m *SinglePageInfoMutation) SetNameInArchive(s string)

SetNameInArchive sets the "NameInArchive" field.

func (*SinglePageInfoMutation) SetOp added in v0.9.1

func (m *SinglePageInfoMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*SinglePageInfoMutation) SetPageNum

func (m *SinglePageInfoMutation) SetPageNum(i int)

SetPageNum sets the "PageNum" field.

func (*SinglePageInfoMutation) SetRealImageFilePATH

func (m *SinglePageInfoMutation) SetRealImageFilePATH(s string)

SetRealImageFilePATH sets the "RealImageFilePATH" field.

func (*SinglePageInfoMutation) SetURL

func (m *SinglePageInfoMutation) SetURL(s string)

SetURL sets the "Url" field.

func (*SinglePageInfoMutation) SetWidth

func (m *SinglePageInfoMutation) SetWidth(i int)

SetWidth sets the "Width" field.

func (SinglePageInfoMutation) Tx

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

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

func (*SinglePageInfoMutation) Type

func (m *SinglePageInfoMutation) Type() string

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

func (*SinglePageInfoMutation) URL

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

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

func (*SinglePageInfoMutation) Where

Where appends a list predicates to the SinglePageInfoMutation builder.

func (*SinglePageInfoMutation) WhereP added in v0.9.1

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

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

func (*SinglePageInfoMutation) Width

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

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

type SinglePageInfoQuery

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

SinglePageInfoQuery is the builder for querying SinglePageInfo entities.

func (*SinglePageInfoQuery) Aggregate added in v0.9.0

func (spiq *SinglePageInfoQuery) Aggregate(fns ...AggregateFunc) *SinglePageInfoSelect

Aggregate returns a SinglePageInfoSelect configured with the given aggregations.

func (*SinglePageInfoQuery) All

All executes the query and returns a list of SinglePageInfos.

func (*SinglePageInfoQuery) AllX

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

func (*SinglePageInfoQuery) Clone

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

func (*SinglePageInfoQuery) Count

func (spiq *SinglePageInfoQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*SinglePageInfoQuery) CountX

func (spiq *SinglePageInfoQuery) CountX(ctx context.Context) int

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

func (*SinglePageInfoQuery) Exist

func (spiq *SinglePageInfoQuery) Exist(ctx context.Context) (bool, error)

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

func (*SinglePageInfoQuery) ExistX

func (spiq *SinglePageInfoQuery) ExistX(ctx context.Context) bool

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

func (*SinglePageInfoQuery) First

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

func (*SinglePageInfoQuery) FirstID

func (spiq *SinglePageInfoQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*SinglePageInfoQuery) FirstIDX

func (spiq *SinglePageInfoQuery) FirstIDX(ctx context.Context) int

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

func (*SinglePageInfoQuery) FirstX

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

func (*SinglePageInfoQuery) GroupBy

func (spiq *SinglePageInfoQuery) GroupBy(field string, fields ...string) *SinglePageInfoGroupBy

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

client.SinglePageInfo.Query().
	GroupBy(singlepageinfo.FieldBookID).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*SinglePageInfoQuery) IDs

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

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

func (*SinglePageInfoQuery) IDsX

func (spiq *SinglePageInfoQuery) IDsX(ctx context.Context) []int

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

func (*SinglePageInfoQuery) Limit

func (spiq *SinglePageInfoQuery) Limit(limit int) *SinglePageInfoQuery

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

func (*SinglePageInfoQuery) Offset

func (spiq *SinglePageInfoQuery) Offset(offset int) *SinglePageInfoQuery

Offset to start from.

func (*SinglePageInfoQuery) Only

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

func (*SinglePageInfoQuery) OnlyID

func (spiq *SinglePageInfoQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*SinglePageInfoQuery) OnlyIDX

func (spiq *SinglePageInfoQuery) OnlyIDX(ctx context.Context) int

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

func (*SinglePageInfoQuery) OnlyX

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

func (*SinglePageInfoQuery) Order

Order specifies how the records should be ordered.

func (*SinglePageInfoQuery) Select

func (spiq *SinglePageInfoQuery) Select(fields ...string) *SinglePageInfoSelect

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

client.SinglePageInfo.Query().
	Select(singlepageinfo.FieldBookID).
	Scan(ctx, &v)

func (*SinglePageInfoQuery) Unique

func (spiq *SinglePageInfoQuery) Unique(unique bool) *SinglePageInfoQuery

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

Where adds a new predicate for the SinglePageInfoQuery builder.

type SinglePageInfoSelect

type SinglePageInfoSelect struct {
	*SinglePageInfoQuery
	// contains filtered or unexported fields
}

SinglePageInfoSelect is the builder for selecting fields of SinglePageInfo entities.

func (*SinglePageInfoSelect) Aggregate added in v0.9.0

func (spis *SinglePageInfoSelect) Aggregate(fns ...AggregateFunc) *SinglePageInfoSelect

Aggregate adds the given aggregation functions to the selector query.

func (*SinglePageInfoSelect) Bool

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

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

func (*SinglePageInfoSelect) BoolX

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

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

func (*SinglePageInfoSelect) Bools

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

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

func (*SinglePageInfoSelect) BoolsX

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

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

func (*SinglePageInfoSelect) Float64

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

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

func (*SinglePageInfoSelect) Float64X

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

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

func (*SinglePageInfoSelect) Float64s

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

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

func (*SinglePageInfoSelect) Float64sX

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

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

func (*SinglePageInfoSelect) Int

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

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

func (*SinglePageInfoSelect) IntX

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

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

func (*SinglePageInfoSelect) Ints

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

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

func (*SinglePageInfoSelect) IntsX

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

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

func (*SinglePageInfoSelect) Scan

func (spis *SinglePageInfoSelect) Scan(ctx context.Context, v any) error

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

func (*SinglePageInfoSelect) ScanX

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

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

func (*SinglePageInfoSelect) String

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

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

func (*SinglePageInfoSelect) StringX

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

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

func (*SinglePageInfoSelect) Strings

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

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

func (*SinglePageInfoSelect) StringsX

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

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

type SinglePageInfoUpdate

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

SinglePageInfoUpdate is the builder for updating SinglePageInfo entities.

func (*SinglePageInfoUpdate) AddFileSize

func (spiu *SinglePageInfoUpdate) AddFileSize(i int64) *SinglePageInfoUpdate

AddFileSize adds i to the "FileSize" field.

func (*SinglePageInfoUpdate) AddHeight

func (spiu *SinglePageInfoUpdate) AddHeight(i int) *SinglePageInfoUpdate

AddHeight adds i to the "Height" field.

func (*SinglePageInfoUpdate) AddPageNum

func (spiu *SinglePageInfoUpdate) AddPageNum(i int) *SinglePageInfoUpdate

AddPageNum adds i to the "PageNum" field.

func (*SinglePageInfoUpdate) AddWidth

func (spiu *SinglePageInfoUpdate) AddWidth(i int) *SinglePageInfoUpdate

AddWidth adds i to the "Width" field.

func (*SinglePageInfoUpdate) Exec

func (spiu *SinglePageInfoUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*SinglePageInfoUpdate) ExecX

func (spiu *SinglePageInfoUpdate) ExecX(ctx context.Context)

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

func (*SinglePageInfoUpdate) Mutation

func (spiu *SinglePageInfoUpdate) Mutation() *SinglePageInfoMutation

Mutation returns the SinglePageInfoMutation object of the builder.

func (*SinglePageInfoUpdate) Save

func (spiu *SinglePageInfoUpdate) Save(ctx context.Context) (int, error)

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

func (*SinglePageInfoUpdate) SaveX

func (spiu *SinglePageInfoUpdate) SaveX(ctx context.Context) int

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

func (*SinglePageInfoUpdate) SetBlurHash

func (spiu *SinglePageInfoUpdate) SetBlurHash(s string) *SinglePageInfoUpdate

SetBlurHash sets the "BlurHash" field.

func (*SinglePageInfoUpdate) SetBookID

func (spiu *SinglePageInfoUpdate) SetBookID(s string) *SinglePageInfoUpdate

SetBookID sets the "BookID" field.

func (*SinglePageInfoUpdate) SetFileSize

func (spiu *SinglePageInfoUpdate) SetFileSize(i int64) *SinglePageInfoUpdate

SetFileSize sets the "FileSize" field.

func (*SinglePageInfoUpdate) SetHeight

func (spiu *SinglePageInfoUpdate) SetHeight(i int) *SinglePageInfoUpdate

SetHeight sets the "Height" field.

func (*SinglePageInfoUpdate) SetImgType

func (spiu *SinglePageInfoUpdate) SetImgType(s string) *SinglePageInfoUpdate

SetImgType sets the "ImgType" field.

func (*SinglePageInfoUpdate) SetModeTime

func (spiu *SinglePageInfoUpdate) SetModeTime(t time.Time) *SinglePageInfoUpdate

SetModeTime sets the "ModeTime" field.

func (*SinglePageInfoUpdate) SetNameInArchive

func (spiu *SinglePageInfoUpdate) SetNameInArchive(s string) *SinglePageInfoUpdate

SetNameInArchive sets the "NameInArchive" field.

func (*SinglePageInfoUpdate) SetNillableBlurHash added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableBlurHash(s *string) *SinglePageInfoUpdate

SetNillableBlurHash sets the "BlurHash" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableBookID added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableBookID(s *string) *SinglePageInfoUpdate

SetNillableBookID sets the "BookID" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableFileSize added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableFileSize(i *int64) *SinglePageInfoUpdate

SetNillableFileSize sets the "FileSize" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableHeight added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableHeight(i *int) *SinglePageInfoUpdate

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

func (*SinglePageInfoUpdate) SetNillableImgType added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableImgType(s *string) *SinglePageInfoUpdate

SetNillableImgType sets the "ImgType" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableModeTime

func (spiu *SinglePageInfoUpdate) SetNillableModeTime(t *time.Time) *SinglePageInfoUpdate

SetNillableModeTime sets the "ModeTime" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableNameInArchive added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableNameInArchive(s *string) *SinglePageInfoUpdate

SetNillableNameInArchive sets the "NameInArchive" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillablePageNum added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillablePageNum(i *int) *SinglePageInfoUpdate

SetNillablePageNum sets the "PageNum" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableRealImageFilePATH added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableRealImageFilePATH(s *string) *SinglePageInfoUpdate

SetNillableRealImageFilePATH sets the "RealImageFilePATH" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableURL added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableURL(s *string) *SinglePageInfoUpdate

SetNillableURL sets the "Url" field if the given value is not nil.

func (*SinglePageInfoUpdate) SetNillableWidth added in v0.9.7

func (spiu *SinglePageInfoUpdate) SetNillableWidth(i *int) *SinglePageInfoUpdate

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

func (*SinglePageInfoUpdate) SetPageNum

func (spiu *SinglePageInfoUpdate) SetPageNum(i int) *SinglePageInfoUpdate

SetPageNum sets the "PageNum" field.

func (*SinglePageInfoUpdate) SetRealImageFilePATH

func (spiu *SinglePageInfoUpdate) SetRealImageFilePATH(s string) *SinglePageInfoUpdate

SetRealImageFilePATH sets the "RealImageFilePATH" field.

func (*SinglePageInfoUpdate) SetURL

SetURL sets the "Url" field.

func (*SinglePageInfoUpdate) SetWidth

func (spiu *SinglePageInfoUpdate) SetWidth(i int) *SinglePageInfoUpdate

SetWidth sets the "Width" field.

func (*SinglePageInfoUpdate) Where

Where appends a list predicates to the SinglePageInfoUpdate builder.

type SinglePageInfoUpdateOne

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

SinglePageInfoUpdateOne is the builder for updating a single SinglePageInfo entity.

func (*SinglePageInfoUpdateOne) AddFileSize

func (spiuo *SinglePageInfoUpdateOne) AddFileSize(i int64) *SinglePageInfoUpdateOne

AddFileSize adds i to the "FileSize" field.

func (*SinglePageInfoUpdateOne) AddHeight

AddHeight adds i to the "Height" field.

func (*SinglePageInfoUpdateOne) AddPageNum

func (spiuo *SinglePageInfoUpdateOne) AddPageNum(i int) *SinglePageInfoUpdateOne

AddPageNum adds i to the "PageNum" field.

func (*SinglePageInfoUpdateOne) AddWidth

AddWidth adds i to the "Width" field.

func (*SinglePageInfoUpdateOne) Exec

func (spiuo *SinglePageInfoUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*SinglePageInfoUpdateOne) ExecX

func (spiuo *SinglePageInfoUpdateOne) ExecX(ctx context.Context)

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

func (*SinglePageInfoUpdateOne) Mutation

Mutation returns the SinglePageInfoMutation object of the builder.

func (*SinglePageInfoUpdateOne) Save

Save executes the query and returns the updated SinglePageInfo entity.

func (*SinglePageInfoUpdateOne) SaveX

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

func (*SinglePageInfoUpdateOne) Select

func (spiuo *SinglePageInfoUpdateOne) Select(field string, fields ...string) *SinglePageInfoUpdateOne

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

func (*SinglePageInfoUpdateOne) SetBlurHash

SetBlurHash sets the "BlurHash" field.

func (*SinglePageInfoUpdateOne) SetBookID

SetBookID sets the "BookID" field.

func (*SinglePageInfoUpdateOne) SetFileSize

func (spiuo *SinglePageInfoUpdateOne) SetFileSize(i int64) *SinglePageInfoUpdateOne

SetFileSize sets the "FileSize" field.

func (*SinglePageInfoUpdateOne) SetHeight

SetHeight sets the "Height" field.

func (*SinglePageInfoUpdateOne) SetImgType

SetImgType sets the "ImgType" field.

func (*SinglePageInfoUpdateOne) SetModeTime

SetModeTime sets the "ModeTime" field.

func (*SinglePageInfoUpdateOne) SetNameInArchive

func (spiuo *SinglePageInfoUpdateOne) SetNameInArchive(s string) *SinglePageInfoUpdateOne

SetNameInArchive sets the "NameInArchive" field.

func (*SinglePageInfoUpdateOne) SetNillableBlurHash added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableBlurHash(s *string) *SinglePageInfoUpdateOne

SetNillableBlurHash sets the "BlurHash" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableBookID added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableBookID(s *string) *SinglePageInfoUpdateOne

SetNillableBookID sets the "BookID" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableFileSize added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableFileSize(i *int64) *SinglePageInfoUpdateOne

SetNillableFileSize sets the "FileSize" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableHeight added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableHeight(i *int) *SinglePageInfoUpdateOne

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

func (*SinglePageInfoUpdateOne) SetNillableImgType added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableImgType(s *string) *SinglePageInfoUpdateOne

SetNillableImgType sets the "ImgType" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableModeTime

func (spiuo *SinglePageInfoUpdateOne) SetNillableModeTime(t *time.Time) *SinglePageInfoUpdateOne

SetNillableModeTime sets the "ModeTime" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableNameInArchive added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableNameInArchive(s *string) *SinglePageInfoUpdateOne

SetNillableNameInArchive sets the "NameInArchive" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillablePageNum added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillablePageNum(i *int) *SinglePageInfoUpdateOne

SetNillablePageNum sets the "PageNum" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableRealImageFilePATH added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableRealImageFilePATH(s *string) *SinglePageInfoUpdateOne

SetNillableRealImageFilePATH sets the "RealImageFilePATH" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableURL added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableURL(s *string) *SinglePageInfoUpdateOne

SetNillableURL sets the "Url" field if the given value is not nil.

func (*SinglePageInfoUpdateOne) SetNillableWidth added in v0.9.7

func (spiuo *SinglePageInfoUpdateOne) SetNillableWidth(i *int) *SinglePageInfoUpdateOne

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

func (*SinglePageInfoUpdateOne) SetPageNum

func (spiuo *SinglePageInfoUpdateOne) SetPageNum(i int) *SinglePageInfoUpdateOne

SetPageNum sets the "PageNum" field.

func (*SinglePageInfoUpdateOne) SetRealImageFilePATH

func (spiuo *SinglePageInfoUpdateOne) SetRealImageFilePATH(s string) *SinglePageInfoUpdateOne

SetRealImageFilePATH sets the "RealImageFilePATH" field.

func (*SinglePageInfoUpdateOne) SetURL

SetURL sets the "Url" field.

func (*SinglePageInfoUpdateOne) SetWidth

SetWidth sets the "Width" field.

func (*SinglePageInfoUpdateOne) Where added in v0.9.1

Where appends a list predicates to the SinglePageInfoUpdate builder.

type SinglePageInfos

type SinglePageInfos []*SinglePageInfo

SinglePageInfos is a parsable slice of SinglePageInfo.

type TraverseFunc added in v0.9.1

type TraverseFunc = ent.TraverseFunc

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

type Traverser added in v0.9.1

type Traverser = ent.Traverser

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

type Tx

type Tx struct {

	// Book is the client for interacting with the Book builders.
	Book *BookClient
	// SinglePageInfo is the client for interacting with the SinglePageInfo builders.
	SinglePageInfo *SinglePageInfoClient
	// User is the client for interacting with the User builders.
	User *UserClient
	// contains filtered or unexported fields
}

Tx is a transactional client that is created by calling Client.Tx().

func TxFromContext

func TxFromContext(ctx context.Context) *Tx

TxFromContext returns a Tx stored inside a context, or nil if there isn't one.

func (*Tx) Client

func (tx *Tx) Client() *Client

Client returns a Client that binds to current transaction.

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit commits the transaction.

func (*Tx) OnCommit

func (tx *Tx) OnCommit(f CommitHook)

OnCommit adds a hook to call on commit.

func (*Tx) OnRollback

func (tx *Tx) OnRollback(f RollbackHook)

OnRollback adds a hook to call on rollback.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback rollbacks the transaction.

type User

type User struct {

	// ID of the ent.
	ID int `json:"id,omitempty"`
	// 用户称呼
	Name string `json:"name,omitempty"`
	// 创建时间
	CreatedAt time.Time `json:"created_at,omitempty"`
	// 用户名
	Username string `json:"username,omitempty"`
	// 登录密码
	Password string `json:"password,omitempty"`
	// 最后登录时间
	LastLogin time.Time `json:"last_login,omitempty"`
	// Age holds the value of the "age" field.
	Age int `json:"age,omitempty"`
	// contains filtered or unexported fields
}

User is the model entity for the User schema.

func (*User) String

func (u *User) String() string

String implements the fmt.Stringer.

func (*User) Unwrap

func (u *User) Unwrap() *User

Unwrap unwraps the User entity that was returned from a transaction after it was closed, so that all future queries will be executed through the driver which created the transaction.

func (*User) Update

func (u *User) Update() *UserUpdateOne

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

func (*User) Value added in v0.9.5

func (u *User) Value(name string) (ent.Value, error)

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

type UserClient

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

UserClient is a client for the User schema.

func NewUserClient

func NewUserClient(c config) *UserClient

NewUserClient returns a client for the User from the given config.

func (*UserClient) Create

func (c *UserClient) Create() *UserCreate

Create returns a builder for creating a User entity.

func (*UserClient) CreateBulk

func (c *UserClient) CreateBulk(builders ...*UserCreate) *UserCreateBulk

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

func (*UserClient) Delete

func (c *UserClient) Delete() *UserDelete

Delete returns a delete builder for User.

func (*UserClient) DeleteOne

func (c *UserClient) DeleteOne(u *User) *UserDeleteOne

DeleteOne returns a builder for deleting the given entity.

func (*UserClient) DeleteOneID

func (c *UserClient) DeleteOneID(id int) *UserDeleteOne

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

func (*UserClient) Get

func (c *UserClient) Get(ctx context.Context, id int) (*User, error)

Get returns a User entity by its id.

func (*UserClient) GetX

func (c *UserClient) GetX(ctx context.Context, id int) *User

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

func (*UserClient) Hooks

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

Hooks returns the client hooks.

func (*UserClient) Intercept added in v0.9.1

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

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

func (*UserClient) Interceptors added in v0.9.1

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

Interceptors returns the client interceptors.

func (*UserClient) MapCreateBulk added in v0.9.7

func (c *UserClient) MapCreateBulk(slice any, setFunc func(*UserCreate, int)) *UserCreateBulk

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

func (*UserClient) Query

func (c *UserClient) Query() *UserQuery

Query returns a query builder for User.

func (*UserClient) Update

func (c *UserClient) Update() *UserUpdate

Update returns an update builder for User.

func (*UserClient) UpdateOne

func (c *UserClient) UpdateOne(u *User) *UserUpdateOne

UpdateOne returns an update builder for the given entity.

func (*UserClient) UpdateOneID

func (c *UserClient) UpdateOneID(id int) *UserUpdateOne

UpdateOneID returns an update builder for the given id.

func (*UserClient) Use

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

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

type UserCreate

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

UserCreate is the builder for creating a User entity.

func (*UserCreate) Exec

func (uc *UserCreate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreate) ExecX

func (uc *UserCreate) ExecX(ctx context.Context)

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

func (*UserCreate) Mutation

func (uc *UserCreate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserCreate) Save

func (uc *UserCreate) Save(ctx context.Context) (*User, error)

Save creates the User in the database.

func (*UserCreate) SaveX

func (uc *UserCreate) SaveX(ctx context.Context) *User

SaveX calls Save and panics if Save returns an error.

func (*UserCreate) SetAge

func (uc *UserCreate) SetAge(i int) *UserCreate

SetAge sets the "age" field.

func (*UserCreate) SetCreatedAt

func (uc *UserCreate) SetCreatedAt(t time.Time) *UserCreate

SetCreatedAt sets the "created_at" field.

func (*UserCreate) SetLastLogin added in v0.9.1

func (uc *UserCreate) SetLastLogin(t time.Time) *UserCreate

SetLastLogin sets the "last_login" field.

func (*UserCreate) SetName

func (uc *UserCreate) SetName(s string) *UserCreate

SetName sets the "name" field.

func (*UserCreate) SetNillableCreatedAt

func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate

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

func (*UserCreate) SetNillableLastLogin added in v0.9.1

func (uc *UserCreate) SetNillableLastLogin(t *time.Time) *UserCreate

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UserCreate) SetPassword

func (uc *UserCreate) SetPassword(s string) *UserCreate

SetPassword sets the "password" field.

func (*UserCreate) SetUsername

func (uc *UserCreate) SetUsername(s string) *UserCreate

SetUsername sets the "username" field.

type UserCreateBulk

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

UserCreateBulk is the builder for creating many User entities in bulk.

func (*UserCreateBulk) Exec

func (ucb *UserCreateBulk) Exec(ctx context.Context) error

Exec executes the query.

func (*UserCreateBulk) ExecX

func (ucb *UserCreateBulk) ExecX(ctx context.Context)

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

func (*UserCreateBulk) Save

func (ucb *UserCreateBulk) Save(ctx context.Context) ([]*User, error)

Save creates the User entities in the database.

func (*UserCreateBulk) SaveX

func (ucb *UserCreateBulk) SaveX(ctx context.Context) []*User

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

type UserDelete

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

UserDelete is the builder for deleting a User entity.

func (*UserDelete) Exec

func (ud *UserDelete) Exec(ctx context.Context) (int, error)

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

func (*UserDelete) ExecX

func (ud *UserDelete) ExecX(ctx context.Context) int

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

func (*UserDelete) Where

func (ud *UserDelete) Where(ps ...predicate.User) *UserDelete

Where appends a list predicates to the UserDelete builder.

type UserDeleteOne

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

UserDeleteOne is the builder for deleting a single User entity.

func (*UserDeleteOne) Exec

func (udo *UserDeleteOne) Exec(ctx context.Context) error

Exec executes the deletion query.

func (*UserDeleteOne) ExecX

func (udo *UserDeleteOne) ExecX(ctx context.Context)

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

func (*UserDeleteOne) Where added in v0.9.1

func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne

Where appends a list predicates to the UserDelete builder.

type UserGroupBy

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

UserGroupBy is the group-by builder for User entities.

func (*UserGroupBy) Aggregate

func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy

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

func (*UserGroupBy) Bool

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

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

func (*UserGroupBy) BoolX

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

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

func (*UserGroupBy) Bools

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

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

func (*UserGroupBy) BoolsX

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

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

func (*UserGroupBy) Float64

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

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

func (*UserGroupBy) Float64X

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

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

func (*UserGroupBy) Float64s

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

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

func (*UserGroupBy) Float64sX

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

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

func (*UserGroupBy) Int

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

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

func (*UserGroupBy) IntX

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

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

func (*UserGroupBy) Ints

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

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

func (*UserGroupBy) IntsX

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

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

func (*UserGroupBy) Scan

func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error

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

func (*UserGroupBy) ScanX

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

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

func (*UserGroupBy) String

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

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

func (*UserGroupBy) StringX

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

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

func (*UserGroupBy) Strings

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

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

func (*UserGroupBy) StringsX

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

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

type UserMutation

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

UserMutation represents an operation that mutates the User nodes in the graph.

func (*UserMutation) AddAge

func (m *UserMutation) AddAge(i int)

AddAge adds i to the "age" field.

func (*UserMutation) AddField

func (m *UserMutation) AddField(name string, value ent.Value) error

AddField adds the value to the field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) AddedAge

func (m *UserMutation) AddedAge() (r int, exists bool)

AddedAge returns the value that was added to the "age" field in this mutation.

func (*UserMutation) AddedEdges

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

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

func (*UserMutation) AddedField

func (m *UserMutation) AddedField(name string) (ent.Value, bool)

AddedField returns the numeric value that was incremented/decremented on a field with the given name. The second boolean return value indicates that this field was not set, or was not defined in the schema.

func (*UserMutation) AddedFields

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

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

func (*UserMutation) AddedIDs

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

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

func (*UserMutation) Age

func (m *UserMutation) Age() (r int, exists bool)

Age returns the value of the "age" field in the mutation.

func (*UserMutation) ClearEdge

func (m *UserMutation) ClearEdge(name string) error

ClearEdge clears the value of the edge with the given name. It returns an error if that edge is not defined in the schema.

func (*UserMutation) ClearField

func (m *UserMutation) ClearField(name string) error

ClearField clears the value of the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ClearedEdges

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

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

func (*UserMutation) ClearedFields

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

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

func (UserMutation) Client

func (m UserMutation) Client() *Client

Client returns a new `ent.Client` from the mutation. If the mutation was executed in a transaction (ent.Tx), a transactional client is returned.

func (*UserMutation) CreatedAt

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

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

func (*UserMutation) EdgeCleared

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

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

func (*UserMutation) Field

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

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

func (*UserMutation) FieldCleared

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

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

func (*UserMutation) Fields

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

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

func (*UserMutation) ID

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

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

func (*UserMutation) IDs

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

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

func (*UserMutation) LastLogin added in v0.9.1

func (m *UserMutation) LastLogin() (r time.Time, exists bool)

LastLogin returns the value of the "last_login" field in the mutation.

func (*UserMutation) Name

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

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

func (*UserMutation) OldAge

func (m *UserMutation) OldAge(ctx context.Context) (v int, err error)

OldAge returns the old "age" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldCreatedAt

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

OldCreatedAt returns the old "created_at" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldField

func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error)

OldField returns the old value of the field from the database. An error is returned if the mutation operation is not UpdateOne, or the query to the database failed.

func (*UserMutation) OldLastLogin added in v0.9.1

func (m *UserMutation) OldLastLogin(ctx context.Context) (v time.Time, err error)

OldLastLogin returns the old "last_login" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldName

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

OldName returns the old "name" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldPassword

func (m *UserMutation) OldPassword(ctx context.Context) (v string, err error)

OldPassword returns the old "password" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) OldUsername

func (m *UserMutation) OldUsername(ctx context.Context) (v string, err error)

OldUsername returns the old "username" field's value of the User entity. If the User object wasn't provided to the builder, the object is fetched from the database. An error is returned if the mutation operation is not UpdateOne, or the database query fails.

func (*UserMutation) Op

func (m *UserMutation) Op() Op

Op returns the operation name.

func (*UserMutation) Password

func (m *UserMutation) Password() (r string, exists bool)

Password returns the value of the "password" field in the mutation.

func (*UserMutation) RemovedEdges

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

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

func (*UserMutation) RemovedIDs

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

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

func (*UserMutation) ResetAge

func (m *UserMutation) ResetAge()

ResetAge resets all changes to the "age" field.

func (*UserMutation) ResetCreatedAt

func (m *UserMutation) ResetCreatedAt()

ResetCreatedAt resets all changes to the "created_at" field.

func (*UserMutation) ResetEdge

func (m *UserMutation) ResetEdge(name string) error

ResetEdge resets all changes to the edge with the given name in this mutation. It returns an error if the edge is not defined in the schema.

func (*UserMutation) ResetField

func (m *UserMutation) ResetField(name string) error

ResetField resets all changes in the mutation for the field with the given name. It returns an error if the field is not defined in the schema.

func (*UserMutation) ResetLastLogin added in v0.9.1

func (m *UserMutation) ResetLastLogin()

ResetLastLogin resets all changes to the "last_login" field.

func (*UserMutation) ResetName

func (m *UserMutation) ResetName()

ResetName resets all changes to the "name" field.

func (*UserMutation) ResetPassword

func (m *UserMutation) ResetPassword()

ResetPassword resets all changes to the "password" field.

func (*UserMutation) ResetUsername

func (m *UserMutation) ResetUsername()

ResetUsername resets all changes to the "username" field.

func (*UserMutation) SetAge

func (m *UserMutation) SetAge(i int)

SetAge sets the "age" field.

func (*UserMutation) SetCreatedAt

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

SetCreatedAt sets the "created_at" field.

func (*UserMutation) SetField

func (m *UserMutation) SetField(name string, value ent.Value) error

SetField sets the value of a field with the given name. It returns an error if the field is not defined in the schema, or if the type mismatched the field type.

func (*UserMutation) SetLastLogin added in v0.9.1

func (m *UserMutation) SetLastLogin(t time.Time)

SetLastLogin sets the "last_login" field.

func (*UserMutation) SetName

func (m *UserMutation) SetName(s string)

SetName sets the "name" field.

func (*UserMutation) SetOp added in v0.9.1

func (m *UserMutation) SetOp(op Op)

SetOp allows setting the mutation operation.

func (*UserMutation) SetPassword

func (m *UserMutation) SetPassword(s string)

SetPassword sets the "password" field.

func (*UserMutation) SetUsername

func (m *UserMutation) SetUsername(s string)

SetUsername sets the "username" field.

func (UserMutation) Tx

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

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

func (*UserMutation) Type

func (m *UserMutation) Type() string

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

func (*UserMutation) Username

func (m *UserMutation) Username() (r string, exists bool)

Username returns the value of the "username" field in the mutation.

func (*UserMutation) Where

func (m *UserMutation) Where(ps ...predicate.User)

Where appends a list predicates to the UserMutation builder.

func (*UserMutation) WhereP added in v0.9.1

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

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

type UserQuery

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

UserQuery is the builder for querying User entities.

func (*UserQuery) Aggregate added in v0.9.0

func (uq *UserQuery) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate returns a UserSelect configured with the given aggregations.

func (*UserQuery) All

func (uq *UserQuery) All(ctx context.Context) ([]*User, error)

All executes the query and returns a list of Users.

func (*UserQuery) AllX

func (uq *UserQuery) AllX(ctx context.Context) []*User

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

func (*UserQuery) Clone

func (uq *UserQuery) Clone() *UserQuery

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

func (*UserQuery) Count

func (uq *UserQuery) Count(ctx context.Context) (int, error)

Count returns the count of the given query.

func (*UserQuery) CountX

func (uq *UserQuery) CountX(ctx context.Context) int

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

func (*UserQuery) Exist

func (uq *UserQuery) Exist(ctx context.Context) (bool, error)

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

func (*UserQuery) ExistX

func (uq *UserQuery) ExistX(ctx context.Context) bool

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

func (*UserQuery) First

func (uq *UserQuery) First(ctx context.Context) (*User, error)

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

func (*UserQuery) FirstID

func (uq *UserQuery) FirstID(ctx context.Context) (id int, err error)

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

func (*UserQuery) FirstIDX

func (uq *UserQuery) FirstIDX(ctx context.Context) int

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

func (*UserQuery) FirstX

func (uq *UserQuery) FirstX(ctx context.Context) *User

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

func (*UserQuery) GroupBy

func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy

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

Example:

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

client.User.Query().
	GroupBy(user.FieldName).
	Aggregate(ent.Count()).
	Scan(ctx, &v)

func (*UserQuery) IDs

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

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

func (*UserQuery) IDsX

func (uq *UserQuery) IDsX(ctx context.Context) []int

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

func (*UserQuery) Limit

func (uq *UserQuery) Limit(limit int) *UserQuery

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

func (*UserQuery) Offset

func (uq *UserQuery) Offset(offset int) *UserQuery

Offset to start from.

func (*UserQuery) Only

func (uq *UserQuery) Only(ctx context.Context) (*User, error)

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

func (*UserQuery) OnlyID

func (uq *UserQuery) OnlyID(ctx context.Context) (id int, err error)

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

func (*UserQuery) OnlyIDX

func (uq *UserQuery) OnlyIDX(ctx context.Context) int

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

func (*UserQuery) OnlyX

func (uq *UserQuery) OnlyX(ctx context.Context) *User

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

func (*UserQuery) Order

func (uq *UserQuery) Order(o ...user.OrderOption) *UserQuery

Order specifies how the records should be ordered.

func (*UserQuery) Select

func (uq *UserQuery) Select(fields ...string) *UserSelect

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

Example:

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

client.User.Query().
	Select(user.FieldName).
	Scan(ctx, &v)

func (*UserQuery) Unique

func (uq *UserQuery) Unique(unique bool) *UserQuery

Unique configures the query builder to filter duplicate records on query. By default, unique is set to true, and can be disabled using this method.

func (*UserQuery) Where

func (uq *UserQuery) Where(ps ...predicate.User) *UserQuery

Where adds a new predicate for the UserQuery builder.

type UserSelect

type UserSelect struct {
	*UserQuery
	// contains filtered or unexported fields
}

UserSelect is the builder for selecting fields of User entities.

func (*UserSelect) Aggregate added in v0.9.0

func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect

Aggregate adds the given aggregation functions to the selector query.

func (*UserSelect) Bool

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

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

func (*UserSelect) BoolX

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

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

func (*UserSelect) Bools

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

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

func (*UserSelect) BoolsX

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

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

func (*UserSelect) Float64

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

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

func (*UserSelect) Float64X

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

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

func (*UserSelect) Float64s

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

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

func (*UserSelect) Float64sX

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

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

func (*UserSelect) Int

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

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

func (*UserSelect) IntX

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

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

func (*UserSelect) Ints

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

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

func (*UserSelect) IntsX

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

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

func (*UserSelect) Scan

func (us *UserSelect) Scan(ctx context.Context, v any) error

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

func (*UserSelect) ScanX

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

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

func (*UserSelect) String

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

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

func (*UserSelect) StringX

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

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

func (*UserSelect) Strings

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

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

func (*UserSelect) StringsX

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

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

type UserUpdate

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

UserUpdate is the builder for updating User entities.

func (*UserUpdate) AddAge

func (uu *UserUpdate) AddAge(i int) *UserUpdate

AddAge adds i to the "age" field.

func (*UserUpdate) Exec

func (uu *UserUpdate) Exec(ctx context.Context) error

Exec executes the query.

func (*UserUpdate) ExecX

func (uu *UserUpdate) ExecX(ctx context.Context)

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

func (*UserUpdate) Mutation

func (uu *UserUpdate) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdate) Save

func (uu *UserUpdate) Save(ctx context.Context) (int, error)

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

func (*UserUpdate) SaveX

func (uu *UserUpdate) SaveX(ctx context.Context) int

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

func (*UserUpdate) SetAge

func (uu *UserUpdate) SetAge(i int) *UserUpdate

SetAge sets the "age" field.

func (*UserUpdate) SetCreatedAt

func (uu *UserUpdate) SetCreatedAt(t time.Time) *UserUpdate

SetCreatedAt sets the "created_at" field.

func (*UserUpdate) SetLastLogin added in v0.9.1

func (uu *UserUpdate) SetLastLogin(t time.Time) *UserUpdate

SetLastLogin sets the "last_login" field.

func (*UserUpdate) SetName

func (uu *UserUpdate) SetName(s string) *UserUpdate

SetName sets the "name" field.

func (*UserUpdate) SetNillableAge added in v0.9.7

func (uu *UserUpdate) SetNillableAge(i *int) *UserUpdate

SetNillableAge sets the "age" field if the given value is not nil.

func (*UserUpdate) SetNillableCreatedAt

func (uu *UserUpdate) SetNillableCreatedAt(t *time.Time) *UserUpdate

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

func (*UserUpdate) SetNillableLastLogin added in v0.9.1

func (uu *UserUpdate) SetNillableLastLogin(t *time.Time) *UserUpdate

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UserUpdate) SetNillableName added in v0.9.7

func (uu *UserUpdate) SetNillableName(s *string) *UserUpdate

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

func (*UserUpdate) SetNillablePassword added in v0.9.7

func (uu *UserUpdate) SetNillablePassword(s *string) *UserUpdate

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdate) SetNillableUsername added in v0.9.7

func (uu *UserUpdate) SetNillableUsername(s *string) *UserUpdate

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdate) SetPassword

func (uu *UserUpdate) SetPassword(s string) *UserUpdate

SetPassword sets the "password" field.

func (*UserUpdate) SetUsername

func (uu *UserUpdate) SetUsername(s string) *UserUpdate

SetUsername sets the "username" field.

func (*UserUpdate) Where

func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate

Where appends a list predicates to the UserUpdate builder.

type UserUpdateOne

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

UserUpdateOne is the builder for updating a single User entity.

func (*UserUpdateOne) AddAge

func (uuo *UserUpdateOne) AddAge(i int) *UserUpdateOne

AddAge adds i to the "age" field.

func (*UserUpdateOne) Exec

func (uuo *UserUpdateOne) Exec(ctx context.Context) error

Exec executes the query on the entity.

func (*UserUpdateOne) ExecX

func (uuo *UserUpdateOne) ExecX(ctx context.Context)

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

func (*UserUpdateOne) Mutation

func (uuo *UserUpdateOne) Mutation() *UserMutation

Mutation returns the UserMutation object of the builder.

func (*UserUpdateOne) Save

func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error)

Save executes the query and returns the updated User entity.

func (*UserUpdateOne) SaveX

func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User

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

func (*UserUpdateOne) Select

func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne

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

func (*UserUpdateOne) SetAge

func (uuo *UserUpdateOne) SetAge(i int) *UserUpdateOne

SetAge sets the "age" field.

func (*UserUpdateOne) SetCreatedAt

func (uuo *UserUpdateOne) SetCreatedAt(t time.Time) *UserUpdateOne

SetCreatedAt sets the "created_at" field.

func (*UserUpdateOne) SetLastLogin added in v0.9.1

func (uuo *UserUpdateOne) SetLastLogin(t time.Time) *UserUpdateOne

SetLastLogin sets the "last_login" field.

func (*UserUpdateOne) SetName

func (uuo *UserUpdateOne) SetName(s string) *UserUpdateOne

SetName sets the "name" field.

func (*UserUpdateOne) SetNillableAge added in v0.9.7

func (uuo *UserUpdateOne) SetNillableAge(i *int) *UserUpdateOne

SetNillableAge sets the "age" field if the given value is not nil.

func (*UserUpdateOne) SetNillableCreatedAt

func (uuo *UserUpdateOne) SetNillableCreatedAt(t *time.Time) *UserUpdateOne

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

func (*UserUpdateOne) SetNillableLastLogin added in v0.9.1

func (uuo *UserUpdateOne) SetNillableLastLogin(t *time.Time) *UserUpdateOne

SetNillableLastLogin sets the "last_login" field if the given value is not nil.

func (*UserUpdateOne) SetNillableName added in v0.9.7

func (uuo *UserUpdateOne) SetNillableName(s *string) *UserUpdateOne

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

func (*UserUpdateOne) SetNillablePassword added in v0.9.7

func (uuo *UserUpdateOne) SetNillablePassword(s *string) *UserUpdateOne

SetNillablePassword sets the "password" field if the given value is not nil.

func (*UserUpdateOne) SetNillableUsername added in v0.9.7

func (uuo *UserUpdateOne) SetNillableUsername(s *string) *UserUpdateOne

SetNillableUsername sets the "username" field if the given value is not nil.

func (*UserUpdateOne) SetPassword

func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne

SetPassword sets the "password" field.

func (*UserUpdateOne) SetUsername

func (uuo *UserUpdateOne) SetUsername(s string) *UserUpdateOne

SetUsername sets the "username" field.

func (*UserUpdateOne) Where added in v0.9.1

func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne

Where appends a list predicates to the UserUpdate builder.

type Users

type Users []*User

Users is a parsable slice of User.

type ValidationError

type ValidationError struct {
	Name string // Field or edge name.
	// contains filtered or unexported fields
}

ValidationError returns when validating a field or edge fails.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errors.Wrapper interface.

type Value

type Value = ent.Value

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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