Documentation
¶
Index ¶
- func ComputeTreePath(parentPath string, nodeID uint32) string
- func CreateDriver(driverName, dsn string, enableTrace, enableMetrics bool) (*entSql.Driver, error)
- func EscapeLiteral(s string) string
- func IsValidIdent(s string) bool
- func MakeTxCleanup(tx EntTx, errPtr *error) func()
- func QueryAllChildrenIds[T EntClientInterface](ctx context.Context, entClient *EntClient[T], tableName string, ...) ([]uint32, error)
- func QuoteIdent(d string, s string) string
- func Rollback[T EntTx](tx T, err error) error
- func SyncSequence[T EntClientInterface](ctx context.Context, entClient *EntClient[T], schema, table, column string) error
- func TravelChild[ID ~string | ~int32 | ~int64 | ~uint32 | ~uint64, T NodeConstraint[ID, T]](nodes *[]T, node T, appendChild func(parent T, node T)) bool
- func ValidateSchemaTableColumn(schema, table, column string) error
- type CreateBuilder
- type CreateBulkBuilder
- type DeleteBuilder
- type EntClient
- func (c *EntClient[T]) Client() T
- func (c *EntClient[T]) Close() error
- func (c *EntClient[T]) DB() *sql.DB
- func (c *EntClient[T]) Driver() *entSql.Driver
- func (c *EntClient[T]) Exec(ctx context.Context, query string, args, v any) error
- func (c *EntClient[T]) Query(ctx context.Context, query string, args, v any) error
- func (c *EntClient[T]) SetConnectionOption(maxIdleConnections, maxOpenConnections int, connMaxLifetime time.Duration)
- type EntClientInterface
- type EntTx
- type ListBuilder
- type NodeConstraint
- type PagingResult
- type QueryBuilder
- type Repository
- func (r ...) BatchCreate(ctx context.Context, builder CreateBulkBuilder[ENT_CREATE_BULK, ENTITY], ...) ([]*DTO, error)
- func (r ...) BuildListSelectorWithPagination(builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (whereSelectors []func(s *sql.Selector), querySelectors []func(s *sql.Selector), ...)
- func (r ...) BuildListSelectorWithPaging(builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (whereSelectors []func(s *sql.Selector), querySelectors []func(s *sql.Selector), ...)
- func (r ...) BuildSelector(fields []string) (func(s *sql.Selector), error)
- func (r ...) BuildSelectorWithTable(table string, fields []string) (func(s *sql.Selector), error)
- func (r ...) ConvertFilterByPaginationRequest(req *paginationV1.PaginationRequest) (*paginationV1.FilterExpr, error)
- func (r ...) ConvertFilterByPagingRequest(req *paginationV1.PagingRequest) (*paginationV1.FilterExpr, error)
- func (r ...) Count(ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (int, error)
- func (r ...) Create(ctx context.Context, builder CreateBuilder[ENTITY], dto *DTO, ...) (*DTO, error)
- func (r ...) CreateX(ctx context.Context, builder CreateBuilder[ENTITY], dto *DTO, ...) error
- func (r ...) Delete(ctx context.Context, builder DeleteBuilder[ENT_DELETE, PREDICATE], ...) (int, error)
- func (r ...) Exists(ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (bool, error)
- func (r ...) Get(ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (*DTO, error)
- func (r ...) ListTreeWithPagination(ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (*PagingResult[DTO], error)
- func (r ...) ListTreeWithPaging(ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (*PagingResult[DTO], error)
- func (r ...) ListWithPagination(ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (*PagingResult[DTO], error)
- func (r ...) ListWithPaging(ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (*PagingResult[DTO], error)
- func (r ...) Only(ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], ...) (*DTO, error)
- func (r ...) UpdateOne(ctx context.Context, ...) (*DTO, error)
- func (r ...) UpdateX(ctx context.Context, builder UpdateBuilder[ENT_UPDATE, PREDICATE], dto *DTO, ...) error
- type SelectBuilder
- type UpdateBuilder
- type UpdateOneBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeTreePath ¶
ComputeTreePath 计算树节点路径
func CreateDriver ¶
CreateDriver 创建数据库驱动
func EscapeLiteral ¶
EscapeLiteral 对作为 SQL 字面量传入的字符串做单引号转义(Postgres 用于 pg_get_serial_sequence 的第一个参数)
func QueryAllChildrenIds ¶
func QueryAllChildrenIds[T EntClientInterface](ctx context.Context, entClient *EntClient[T], tableName string, parentID uint32) ([]uint32, error)
QueryAllChildrenIds 使用CTE递归查询所有子节点ID
func QuoteIdent ¶
QuoteIdent 根据方言引用标识符,避免注入(并对内部的引用字符进行重复转义)
func SyncSequence ¶
func SyncSequence[T EntClientInterface](ctx context.Context, entClient *EntClient[T], schema, table, column string) error
SyncSequence 同步数据库序列
func TravelChild ¶
func TravelChild[ID ~string | ~int32 | ~int64 | ~uint32 | ~uint64, T NodeConstraint[ID, T]]( nodes *[]T, node T, appendChild func(parent T, node T), ) bool
TravelChild 泛型实现:递归查找父节点并添加子节点 ID: 节点ID类型(如string、int64) T: 节点类型(需实现NodeConstraint[ID, T]接口) nodes: 待遍历的节点切片指针 node: 待添加的节点 appendChild: 将子节点添加到父节点的函数 return: 是否成功添加节点
func ValidateSchemaTableColumn ¶
ValidateSchemaTableColumn 校验 schema、表名和列名是否合法
Types ¶
type CreateBuilder ¶
type CreateBulkBuilder ¶
type DeleteBuilder ¶
type EntClient ¶
type EntClient[T EntClientInterface] struct { // contains filtered or unexported fields }
func NewEntClient ¶
func NewEntClient[T EntClientInterface](db T, drv *entSql.Driver) *EntClient[T]
type EntClientInterface ¶
type EntClientInterface interface {
Close() error
}
type ListBuilder ¶
type NodeConstraint ¶
type NodeConstraint[ID ~string | ~int32 | ~int64 | ~uint32 | ~uint64, T any] interface { // GetId 返回当前节点的唯一ID GetId() ID // GetParentId 返回父节点ID GetParentId() ID // GetChildren 返回子节点切片的指针 GetChildren() []T }
NodeConstraint 泛型节点约束接口 ID: 节点ID的类型 T: 具体节点类型
type PagingResult ¶
PagingResult 是通用的分页返回结构,包含 items 和 total 字段
type QueryBuilder ¶
type QueryBuilder[ENT_QUERY any, ENT_SELECT any, ENTITY any] interface { Modify(modifiers ...func(s *sql.Selector)) *ENT_SELECT Clone() *ENT_QUERY All(ctx context.Context) ([]*ENTITY, error) Only(ctx context.Context) (*ENTITY, error) Count(ctx context.Context) (int, error) Select(fields ...string) *ENT_SELECT Exist(ctx context.Context) (bool, error) }
type Repository ¶
type Repository[ ENT_QUERY any, ENT_SELECT any, ENT_CREATE any, ENT_CREATE_BULK any, ENT_UPDATE any, ENT_UPDATE_ONE any, ENT_DELETE any, PREDICATE any, DTO any, ENTITY any, ] struct { // contains filtered or unexported fields }
Repository Ent查询器
func NewRepository ¶
func NewRepository[ ENT_QUERY any, ENT_SELECT any, ENT_CREATE any, ENT_CREATE_BULK any, ENT_UPDATE any, ENT_UPDATE_ONE any, ENT_DELETE any, PREDICATE any, DTO any, ENTITY any, ](mapper *mapper.CopierMapper[DTO, ENTITY]) *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) BatchCreate ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) BatchCreate( ctx context.Context, builder CreateBulkBuilder[ENT_CREATE_BULK, ENTITY], dtos []*DTO, createMask *fieldmaskpb.FieldMask, doCreateFieldFunc func(dto *DTO), ) ([]*DTO, error)
BatchCreate 批量创建记录,返回创建后的 DTO 列表
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) BuildListSelectorWithPagination ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) BuildListSelectorWithPagination( builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], req *paginationV1.PaginationRequest, ) (whereSelectors []func(s *sql.Selector), querySelectors []func(s *sql.Selector), err error)
BuildListSelectorWithPagination 使用分页请求查询列表
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) BuildListSelectorWithPaging ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) BuildListSelectorWithPaging( builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], req *paginationV1.PagingRequest, ) (whereSelectors []func(s *sql.Selector), querySelectors []func(s *sql.Selector), err error)
BuildListSelectorWithPaging 使用分页请求查询列表
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) BuildSelector ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) BuildSelector( fields []string, ) (func(s *sql.Selector), error)
BuildSelector 根据字段列表构建选择器
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) BuildSelectorWithTable ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) BuildSelectorWithTable( table string, fields []string, ) (func(s *sql.Selector), error)
BuildSelectorWithTable 构建带表名前缀的字段选择器,适用于多表查询场景
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) ConvertFilterByPaginationRequest ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) ConvertFilterByPaginationRequest( req *paginationV1.PaginationRequest, ) (*paginationV1.FilterExpr, error)
ConvertFilterByPaginationRequest 使用通用的分页请求参数转换过滤表达式
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) ConvertFilterByPagingRequest ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) ConvertFilterByPagingRequest( req *paginationV1.PagingRequest, ) (*paginationV1.FilterExpr, error)
ConvertFilterByPagingRequest 将通用分页请求中的过滤条件转换为结构化表达式
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) Count ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) Count( ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], predicates ...func(s *sql.Selector), ) (int, error)
Count 计算符合条件的记录数
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) Create ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) Create( ctx context.Context, builder CreateBuilder[ENTITY], dto *DTO, createMask *fieldmaskpb.FieldMask, doCreateFieldFunc func(dto *DTO), ) (*DTO, error)
Create 根据 DTO 创建一条记录,返回创建后的 DTO
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) CreateX ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) CreateX( ctx context.Context, builder CreateBuilder[ENTITY], dto *DTO, createMask *fieldmaskpb.FieldMask, doCreateFieldFunc func(dto *DTO), ) error
CreateX 仅执行创建操作,不返回创建后的数据
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) Delete ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) Delete( ctx context.Context, builder DeleteBuilder[ENT_DELETE, PREDICATE], predicates ...PREDICATE, ) (int, error)
Delete 根据查询条件删除记录
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) Exists ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) Exists( ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], predicates ...func(s *sql.Selector), ) (bool, error)
Exists 检查是否存在符合条件的记录,使用 builder.Exist 避免额外 Count 查询
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) Get ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) Get( ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], viewMask *fieldmaskpb.FieldMask, predicates ...func(s *sql.Selector), ) (*DTO, error)
Get 根据查询条件获取单条记录
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) ListTreeWithPagination ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) ListTreeWithPagination( ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], countBuilder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], req *paginationV1.PaginationRequest, ) (*PagingResult[DTO], error)
ListTreeWithPagination 使用通用的分页请求参数进行树形结构列表查询
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) ListTreeWithPaging ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) ListTreeWithPaging( ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], countBuilder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], req *paginationV1.PagingRequest, ) (*PagingResult[DTO], error)
ListTreeWithPaging 使用分页请求查询树形结构列表
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) ListWithPagination ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) ListWithPagination( ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], countBuilder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], req *paginationV1.PaginationRequest, ) (*PagingResult[DTO], error)
ListWithPagination 使用通用的分页请求参数进行列表查询
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) ListWithPaging ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) ListWithPaging( ctx context.Context, builder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], countBuilder ListBuilder[ENT_QUERY, ENT_SELECT, ENTITY], req *paginationV1.PagingRequest, ) (*PagingResult[DTO], error)
ListWithPaging 使用分页请求查询列表
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) Only ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) Only( ctx context.Context, builder QueryBuilder[ENT_QUERY, ENT_SELECT, ENTITY], viewMask *fieldmaskpb.FieldMask, predicates ...func(s *sql.Selector), ) (*DTO, error)
Only 根据查询条件获取单条记录
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) UpdateOne ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) UpdateOne( ctx context.Context, builder UpdateOneBuilder[ENT_UPDATE_ONE, PREDICATE, ENTITY], dto *DTO, updateMask *fieldmaskpb.FieldMask, doUpdateFieldFunc func(dto *DTO), predicates ...PREDICATE, ) (*DTO, error)
UpdateOne 根据查询条件更新单条记录,返回更新后的 DTO
func (*Repository[ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY]) UpdateX ¶
func (r *Repository[ ENT_QUERY, ENT_SELECT, ENT_CREATE, ENT_CREATE_BULK, ENT_UPDATE, ENT_UPDATE_ONE, ENT_DELETE, PREDICATE, DTO, ENTITY, ]) UpdateX( ctx context.Context, builder UpdateBuilder[ENT_UPDATE, PREDICATE], dto *DTO, updateMask *fieldmaskpb.FieldMask, doUpdateFieldFunc func(dto *DTO), predicates ...PREDICATE, ) error
UpdateX 仅执行更新操作,不返回更新后的数据
type SelectBuilder ¶
type SelectBuilder[ENT_SELECT any, ENTITY any] interface { Modify(modifiers ...func(s *sql.Selector)) *ENT_SELECT Clone() SelectBuilder[ENT_SELECT, ENTITY] All(ctx context.Context) ([]*ENTITY, error) Only(ctx context.Context) (*ENTITY, error) Count(ctx context.Context) (int, error) Select(fields ...string) *ENT_SELECT Exist(ctx context.Context) (bool, error) }
type UpdateBuilder ¶
type UpdateOneBuilder ¶
type UpdateOneBuilder[ENT_UPDATE_ONE any, PREDICATE any, ENTITY any] interface { Modify(modifiers ...func(u *sql.UpdateBuilder)) *ENT_UPDATE_ONE Save(ctx context.Context) (*ENTITY, error) SaveX(ctx context.Context) *ENTITY Exec(ctx context.Context) error ExecX(ctx context.Context) Where(ps ...PREDICATE) *ENT_UPDATE_ONE }