mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-23 11:00:28 +00:00
chores/general-cleanup-release-prep (#31)
* do ent generation * update edges * fix redirect
This commit is contained in:
parent
8a43fc953d
commit
1ca430af21
47 changed files with 785 additions and 765 deletions
|
@ -439,10 +439,10 @@ func (dq *DocumentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Doc
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, document.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Document).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Document{config: dq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -582,11 +582,14 @@ func (dq *DocumentQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (dq *DocumentQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := dq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := dq.FirstID(ctx); {
|
||||
case IsNotFound(err):
|
||||
return false, nil
|
||||
case err != nil:
|
||||
return false, fmt.Errorf("ent: check existence: %w", err)
|
||||
default:
|
||||
return true, nil
|
||||
}
|
||||
return n > 0, nil
|
||||
}
|
||||
|
||||
func (dq *DocumentQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -687,7 +690,7 @@ func (dgb *DocumentGroupBy) Aggregate(fns ...AggregateFunc) *DocumentGroupBy {
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (dgb *DocumentGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (dgb *DocumentGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := dgb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -696,7 +699,7 @@ func (dgb *DocumentGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return dgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (dgb *DocumentGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (dgb *DocumentGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range dgb.fields {
|
||||
if !document.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -743,7 +746,7 @@ type DocumentSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (ds *DocumentSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ds *DocumentSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := ds.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -751,7 +754,7 @@ func (ds *DocumentSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return ds.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ds *DocumentSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ds *DocumentSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := ds.sql.Query()
|
||||
if err := ds.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue