forked from mirrors/homebox
chore: developer cleanup (#300)
* new PR tasks * add homebox to know words * formatting * bump deps * generate db models * ts errors * drop id * fix accessor * drop unused time field * change CI * add expected error * add type check * resolve serveral type errors * hoise in CI
This commit is contained in:
parent
88f9ff90d4
commit
bd321af29f
142 changed files with 817 additions and 1200 deletions
|
@ -370,10 +370,12 @@ func (iq *ItemQuery) AllX(ctx context.Context) []*Item {
|
|||
}
|
||||
|
||||
// IDs executes the query and returns a list of Item IDs.
|
||||
func (iq *ItemQuery) IDs(ctx context.Context) ([]uuid.UUID, error) {
|
||||
var ids []uuid.UUID
|
||||
func (iq *ItemQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) {
|
||||
if iq.ctx.Unique == nil && iq.path != nil {
|
||||
iq.Unique(true)
|
||||
}
|
||||
ctx = setContextOp(ctx, iq.ctx, "IDs")
|
||||
if err := iq.Select(item.FieldID).Scan(ctx, &ids); err != nil {
|
||||
if err = iq.Select(item.FieldID).Scan(ctx, &ids); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ids, nil
|
||||
|
@ -1000,20 +1002,12 @@ func (iq *ItemQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (iq *ItemQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
_spec := &sqlgraph.QuerySpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: item.Table,
|
||||
Columns: item.Columns,
|
||||
ID: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeUUID,
|
||||
Column: item.FieldID,
|
||||
},
|
||||
},
|
||||
From: iq.sql,
|
||||
Unique: true,
|
||||
}
|
||||
_spec := sqlgraph.NewQuerySpec(item.Table, item.Columns, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID))
|
||||
_spec.From = iq.sql
|
||||
if unique := iq.ctx.Unique; unique != nil {
|
||||
_spec.Unique = *unique
|
||||
} else if iq.path != nil {
|
||||
_spec.Unique = true
|
||||
}
|
||||
if fields := iq.ctx.Fields; len(fields) > 0 {
|
||||
_spec.Node.Columns = make([]string, 0, len(fields))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue