mirror of
https://github.com/hay-kot/homebox.git
synced 2025-08-04 00:30:27 +00:00
update edges
This commit is contained in:
parent
c547678e36
commit
f6ed3646bf
13 changed files with 476 additions and 482 deletions
|
@ -930,6 +930,22 @@ func (c *ItemClient) QueryGroup(i *Item) *GroupQuery {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryLabel queries the label edge of a Item.
|
||||||
|
func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
|
||||||
|
query := &LabelQuery{config: c.config}
|
||||||
|
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
||||||
|
id := i.ID
|
||||||
|
step := sqlgraph.NewStep(
|
||||||
|
sqlgraph.From(item.Table, item.FieldID, id),
|
||||||
|
sqlgraph.To(label.Table, label.FieldID),
|
||||||
|
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
|
||||||
|
)
|
||||||
|
fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
|
||||||
|
return fromV, nil
|
||||||
|
}
|
||||||
|
return query
|
||||||
|
}
|
||||||
|
|
||||||
// QueryLocation queries the location edge of a Item.
|
// QueryLocation queries the location edge of a Item.
|
||||||
func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
|
func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
|
||||||
query := &LocationQuery{config: c.config}
|
query := &LocationQuery{config: c.config}
|
||||||
|
@ -962,22 +978,6 @@ func (c *ItemClient) QueryFields(i *Item) *ItemFieldQuery {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryLabel queries the label edge of a Item.
|
|
||||||
func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
|
|
||||||
query := &LabelQuery{config: c.config}
|
|
||||||
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
|
|
||||||
id := i.ID
|
|
||||||
step := sqlgraph.NewStep(
|
|
||||||
sqlgraph.From(item.Table, item.FieldID, id),
|
|
||||||
sqlgraph.To(label.Table, label.FieldID),
|
|
||||||
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
|
|
||||||
)
|
|
||||||
fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
|
|
||||||
return fromV, nil
|
|
||||||
}
|
|
||||||
return query
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryAttachments queries the attachments edge of a Item.
|
// QueryAttachments queries the attachments edge of a Item.
|
||||||
func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery {
|
func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery {
|
||||||
query := &AttachmentQuery{config: c.config}
|
query := &AttachmentQuery{config: c.config}
|
||||||
|
|
|
@ -72,12 +72,12 @@ type Item struct {
|
||||||
type ItemEdges struct {
|
type ItemEdges struct {
|
||||||
// Group holds the value of the group edge.
|
// Group holds the value of the group edge.
|
||||||
Group *Group `json:"group,omitempty"`
|
Group *Group `json:"group,omitempty"`
|
||||||
|
// Label holds the value of the label edge.
|
||||||
|
Label []*Label `json:"label,omitempty"`
|
||||||
// Location holds the value of the location edge.
|
// Location holds the value of the location edge.
|
||||||
Location *Location `json:"location,omitempty"`
|
Location *Location `json:"location,omitempty"`
|
||||||
// Fields holds the value of the fields edge.
|
// Fields holds the value of the fields edge.
|
||||||
Fields []*ItemField `json:"fields,omitempty"`
|
Fields []*ItemField `json:"fields,omitempty"`
|
||||||
// Label holds the value of the label edge.
|
|
||||||
Label []*Label `json:"label,omitempty"`
|
|
||||||
// Attachments holds the value of the attachments edge.
|
// Attachments holds the value of the attachments edge.
|
||||||
Attachments []*Attachment `json:"attachments,omitempty"`
|
Attachments []*Attachment `json:"attachments,omitempty"`
|
||||||
// loadedTypes holds the information for reporting if a
|
// loadedTypes holds the information for reporting if a
|
||||||
|
@ -98,10 +98,19 @@ func (e ItemEdges) GroupOrErr() (*Group, error) {
|
||||||
return nil, &NotLoadedError{edge: "group"}
|
return nil, &NotLoadedError{edge: "group"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LabelOrErr returns the Label value or an error if the edge
|
||||||
|
// was not loaded in eager-loading.
|
||||||
|
func (e ItemEdges) LabelOrErr() ([]*Label, error) {
|
||||||
|
if e.loadedTypes[1] {
|
||||||
|
return e.Label, nil
|
||||||
|
}
|
||||||
|
return nil, &NotLoadedError{edge: "label"}
|
||||||
|
}
|
||||||
|
|
||||||
// LocationOrErr returns the Location value or an error if the edge
|
// LocationOrErr returns the Location value or an error if the edge
|
||||||
// was not loaded in eager-loading, or loaded but was not found.
|
// was not loaded in eager-loading, or loaded but was not found.
|
||||||
func (e ItemEdges) LocationOrErr() (*Location, error) {
|
func (e ItemEdges) LocationOrErr() (*Location, error) {
|
||||||
if e.loadedTypes[1] {
|
if e.loadedTypes[2] {
|
||||||
if e.Location == nil {
|
if e.Location == nil {
|
||||||
// Edge was loaded but was not found.
|
// Edge was loaded but was not found.
|
||||||
return nil, &NotFoundError{label: location.Label}
|
return nil, &NotFoundError{label: location.Label}
|
||||||
|
@ -114,21 +123,12 @@ func (e ItemEdges) LocationOrErr() (*Location, error) {
|
||||||
// FieldsOrErr returns the Fields value or an error if the edge
|
// FieldsOrErr returns the Fields value or an error if the edge
|
||||||
// was not loaded in eager-loading.
|
// was not loaded in eager-loading.
|
||||||
func (e ItemEdges) FieldsOrErr() ([]*ItemField, error) {
|
func (e ItemEdges) FieldsOrErr() ([]*ItemField, error) {
|
||||||
if e.loadedTypes[2] {
|
if e.loadedTypes[3] {
|
||||||
return e.Fields, nil
|
return e.Fields, nil
|
||||||
}
|
}
|
||||||
return nil, &NotLoadedError{edge: "fields"}
|
return nil, &NotLoadedError{edge: "fields"}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LabelOrErr returns the Label value or an error if the edge
|
|
||||||
// was not loaded in eager-loading.
|
|
||||||
func (e ItemEdges) LabelOrErr() ([]*Label, error) {
|
|
||||||
if e.loadedTypes[3] {
|
|
||||||
return e.Label, nil
|
|
||||||
}
|
|
||||||
return nil, &NotLoadedError{edge: "label"}
|
|
||||||
}
|
|
||||||
|
|
||||||
// AttachmentsOrErr returns the Attachments value or an error if the edge
|
// AttachmentsOrErr returns the Attachments value or an error if the edge
|
||||||
// was not loaded in eager-loading.
|
// was not loaded in eager-loading.
|
||||||
func (e ItemEdges) AttachmentsOrErr() ([]*Attachment, error) {
|
func (e ItemEdges) AttachmentsOrErr() ([]*Attachment, error) {
|
||||||
|
@ -330,6 +330,11 @@ func (i *Item) QueryGroup() *GroupQuery {
|
||||||
return (&ItemClient{config: i.config}).QueryGroup(i)
|
return (&ItemClient{config: i.config}).QueryGroup(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryLabel queries the "label" edge of the Item entity.
|
||||||
|
func (i *Item) QueryLabel() *LabelQuery {
|
||||||
|
return (&ItemClient{config: i.config}).QueryLabel(i)
|
||||||
|
}
|
||||||
|
|
||||||
// QueryLocation queries the "location" edge of the Item entity.
|
// QueryLocation queries the "location" edge of the Item entity.
|
||||||
func (i *Item) QueryLocation() *LocationQuery {
|
func (i *Item) QueryLocation() *LocationQuery {
|
||||||
return (&ItemClient{config: i.config}).QueryLocation(i)
|
return (&ItemClient{config: i.config}).QueryLocation(i)
|
||||||
|
@ -340,11 +345,6 @@ func (i *Item) QueryFields() *ItemFieldQuery {
|
||||||
return (&ItemClient{config: i.config}).QueryFields(i)
|
return (&ItemClient{config: i.config}).QueryFields(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryLabel queries the "label" edge of the Item entity.
|
|
||||||
func (i *Item) QueryLabel() *LabelQuery {
|
|
||||||
return (&ItemClient{config: i.config}).QueryLabel(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryAttachments queries the "attachments" edge of the Item entity.
|
// QueryAttachments queries the "attachments" edge of the Item entity.
|
||||||
func (i *Item) QueryAttachments() *AttachmentQuery {
|
func (i *Item) QueryAttachments() *AttachmentQuery {
|
||||||
return (&ItemClient{config: i.config}).QueryAttachments(i)
|
return (&ItemClient{config: i.config}).QueryAttachments(i)
|
||||||
|
|
|
@ -57,12 +57,12 @@ const (
|
||||||
FieldSoldNotes = "sold_notes"
|
FieldSoldNotes = "sold_notes"
|
||||||
// EdgeGroup holds the string denoting the group edge name in mutations.
|
// EdgeGroup holds the string denoting the group edge name in mutations.
|
||||||
EdgeGroup = "group"
|
EdgeGroup = "group"
|
||||||
|
// EdgeLabel holds the string denoting the label edge name in mutations.
|
||||||
|
EdgeLabel = "label"
|
||||||
// EdgeLocation holds the string denoting the location edge name in mutations.
|
// EdgeLocation holds the string denoting the location edge name in mutations.
|
||||||
EdgeLocation = "location"
|
EdgeLocation = "location"
|
||||||
// EdgeFields holds the string denoting the fields edge name in mutations.
|
// EdgeFields holds the string denoting the fields edge name in mutations.
|
||||||
EdgeFields = "fields"
|
EdgeFields = "fields"
|
||||||
// EdgeLabel holds the string denoting the label edge name in mutations.
|
|
||||||
EdgeLabel = "label"
|
|
||||||
// EdgeAttachments holds the string denoting the attachments edge name in mutations.
|
// EdgeAttachments holds the string denoting the attachments edge name in mutations.
|
||||||
EdgeAttachments = "attachments"
|
EdgeAttachments = "attachments"
|
||||||
// Table holds the table name of the item in the database.
|
// Table holds the table name of the item in the database.
|
||||||
|
@ -74,6 +74,11 @@ const (
|
||||||
GroupInverseTable = "groups"
|
GroupInverseTable = "groups"
|
||||||
// GroupColumn is the table column denoting the group relation/edge.
|
// GroupColumn is the table column denoting the group relation/edge.
|
||||||
GroupColumn = "group_items"
|
GroupColumn = "group_items"
|
||||||
|
// LabelTable is the table that holds the label relation/edge. The primary key declared below.
|
||||||
|
LabelTable = "label_items"
|
||||||
|
// LabelInverseTable is the table name for the Label entity.
|
||||||
|
// It exists in this package in order to avoid circular dependency with the "label" package.
|
||||||
|
LabelInverseTable = "labels"
|
||||||
// LocationTable is the table that holds the location relation/edge.
|
// LocationTable is the table that holds the location relation/edge.
|
||||||
LocationTable = "items"
|
LocationTable = "items"
|
||||||
// LocationInverseTable is the table name for the Location entity.
|
// LocationInverseTable is the table name for the Location entity.
|
||||||
|
@ -88,11 +93,6 @@ const (
|
||||||
FieldsInverseTable = "item_fields"
|
FieldsInverseTable = "item_fields"
|
||||||
// FieldsColumn is the table column denoting the fields relation/edge.
|
// FieldsColumn is the table column denoting the fields relation/edge.
|
||||||
FieldsColumn = "item_fields"
|
FieldsColumn = "item_fields"
|
||||||
// LabelTable is the table that holds the label relation/edge. The primary key declared below.
|
|
||||||
LabelTable = "label_items"
|
|
||||||
// LabelInverseTable is the table name for the Label entity.
|
|
||||||
// It exists in this package in order to avoid circular dependency with the "label" package.
|
|
||||||
LabelInverseTable = "labels"
|
|
||||||
// AttachmentsTable is the table that holds the attachments relation/edge.
|
// AttachmentsTable is the table that holds the attachments relation/edge.
|
||||||
AttachmentsTable = "attachments"
|
AttachmentsTable = "attachments"
|
||||||
// AttachmentsInverseTable is the table name for the Attachment entity.
|
// AttachmentsInverseTable is the table name for the Attachment entity.
|
||||||
|
|
|
@ -2068,6 +2068,34 @@ func HasGroupWith(preds ...predicate.Group) predicate.Item {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HasLabel applies the HasEdge predicate on the "label" edge.
|
||||||
|
func HasLabel() predicate.Item {
|
||||||
|
return predicate.Item(func(s *sql.Selector) {
|
||||||
|
step := sqlgraph.NewStep(
|
||||||
|
sqlgraph.From(Table, FieldID),
|
||||||
|
sqlgraph.To(LabelTable, FieldID),
|
||||||
|
sqlgraph.Edge(sqlgraph.M2M, true, LabelTable, LabelPrimaryKey...),
|
||||||
|
)
|
||||||
|
sqlgraph.HasNeighbors(s, step)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasLabelWith applies the HasEdge predicate on the "label" edge with a given conditions (other predicates).
|
||||||
|
func HasLabelWith(preds ...predicate.Label) predicate.Item {
|
||||||
|
return predicate.Item(func(s *sql.Selector) {
|
||||||
|
step := sqlgraph.NewStep(
|
||||||
|
sqlgraph.From(Table, FieldID),
|
||||||
|
sqlgraph.To(LabelInverseTable, FieldID),
|
||||||
|
sqlgraph.Edge(sqlgraph.M2M, true, LabelTable, LabelPrimaryKey...),
|
||||||
|
)
|
||||||
|
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||||
|
for _, p := range preds {
|
||||||
|
p(s)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// HasLocation applies the HasEdge predicate on the "location" edge.
|
// HasLocation applies the HasEdge predicate on the "location" edge.
|
||||||
func HasLocation() predicate.Item {
|
func HasLocation() predicate.Item {
|
||||||
return predicate.Item(func(s *sql.Selector) {
|
return predicate.Item(func(s *sql.Selector) {
|
||||||
|
@ -2124,34 +2152,6 @@ func HasFieldsWith(preds ...predicate.ItemField) predicate.Item {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasLabel applies the HasEdge predicate on the "label" edge.
|
|
||||||
func HasLabel() predicate.Item {
|
|
||||||
return predicate.Item(func(s *sql.Selector) {
|
|
||||||
step := sqlgraph.NewStep(
|
|
||||||
sqlgraph.From(Table, FieldID),
|
|
||||||
sqlgraph.To(LabelTable, FieldID),
|
|
||||||
sqlgraph.Edge(sqlgraph.M2M, true, LabelTable, LabelPrimaryKey...),
|
|
||||||
)
|
|
||||||
sqlgraph.HasNeighbors(s, step)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// HasLabelWith applies the HasEdge predicate on the "label" edge with a given conditions (other predicates).
|
|
||||||
func HasLabelWith(preds ...predicate.Label) predicate.Item {
|
|
||||||
return predicate.Item(func(s *sql.Selector) {
|
|
||||||
step := sqlgraph.NewStep(
|
|
||||||
sqlgraph.From(Table, FieldID),
|
|
||||||
sqlgraph.To(LabelInverseTable, FieldID),
|
|
||||||
sqlgraph.Edge(sqlgraph.M2M, true, LabelTable, LabelPrimaryKey...),
|
|
||||||
)
|
|
||||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
|
||||||
for _, p := range preds {
|
|
||||||
p(s)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// HasAttachments applies the HasEdge predicate on the "attachments" edge.
|
// HasAttachments applies the HasEdge predicate on the "attachments" edge.
|
||||||
func HasAttachments() predicate.Item {
|
func HasAttachments() predicate.Item {
|
||||||
return predicate.Item(func(s *sql.Selector) {
|
return predicate.Item(func(s *sql.Selector) {
|
||||||
|
|
|
@ -337,6 +337,21 @@ func (ic *ItemCreate) SetGroup(g *Group) *ItemCreate {
|
||||||
return ic.SetGroupID(g.ID)
|
return ic.SetGroupID(g.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
|
||||||
|
func (ic *ItemCreate) AddLabelIDs(ids ...uuid.UUID) *ItemCreate {
|
||||||
|
ic.mutation.AddLabelIDs(ids...)
|
||||||
|
return ic
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLabel adds the "label" edges to the Label entity.
|
||||||
|
func (ic *ItemCreate) AddLabel(l ...*Label) *ItemCreate {
|
||||||
|
ids := make([]uuid.UUID, len(l))
|
||||||
|
for i := range l {
|
||||||
|
ids[i] = l[i].ID
|
||||||
|
}
|
||||||
|
return ic.AddLabelIDs(ids...)
|
||||||
|
}
|
||||||
|
|
||||||
// SetLocationID sets the "location" edge to the Location entity by ID.
|
// SetLocationID sets the "location" edge to the Location entity by ID.
|
||||||
func (ic *ItemCreate) SetLocationID(id uuid.UUID) *ItemCreate {
|
func (ic *ItemCreate) SetLocationID(id uuid.UUID) *ItemCreate {
|
||||||
ic.mutation.SetLocationID(id)
|
ic.mutation.SetLocationID(id)
|
||||||
|
@ -371,21 +386,6 @@ func (ic *ItemCreate) AddFields(i ...*ItemField) *ItemCreate {
|
||||||
return ic.AddFieldIDs(ids...)
|
return ic.AddFieldIDs(ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
|
|
||||||
func (ic *ItemCreate) AddLabelIDs(ids ...uuid.UUID) *ItemCreate {
|
|
||||||
ic.mutation.AddLabelIDs(ids...)
|
|
||||||
return ic
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddLabel adds the "label" edges to the Label entity.
|
|
||||||
func (ic *ItemCreate) AddLabel(l ...*Label) *ItemCreate {
|
|
||||||
ids := make([]uuid.UUID, len(l))
|
|
||||||
for i := range l {
|
|
||||||
ids[i] = l[i].ID
|
|
||||||
}
|
|
||||||
return ic.AddLabelIDs(ids...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
|
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
|
||||||
func (ic *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate {
|
func (ic *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate {
|
||||||
ic.mutation.AddAttachmentIDs(ids...)
|
ic.mutation.AddAttachmentIDs(ids...)
|
||||||
|
@ -810,6 +810,25 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
|
||||||
_node.group_items = &nodes[0]
|
_node.group_items = &nodes[0]
|
||||||
_spec.Edges = append(_spec.Edges, edge)
|
_spec.Edges = append(_spec.Edges, edge)
|
||||||
}
|
}
|
||||||
|
if nodes := ic.mutation.LabelIDs(); len(nodes) > 0 {
|
||||||
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
Rel: sqlgraph.M2M,
|
||||||
|
Inverse: true,
|
||||||
|
Table: item.LabelTable,
|
||||||
|
Columns: item.LabelPrimaryKey,
|
||||||
|
Bidi: false,
|
||||||
|
Target: &sqlgraph.EdgeTarget{
|
||||||
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeUUID,
|
||||||
|
Column: label.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, k := range nodes {
|
||||||
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||||
|
}
|
||||||
|
_spec.Edges = append(_spec.Edges, edge)
|
||||||
|
}
|
||||||
if nodes := ic.mutation.LocationIDs(); len(nodes) > 0 {
|
if nodes := ic.mutation.LocationIDs(); len(nodes) > 0 {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.M2O,
|
Rel: sqlgraph.M2O,
|
||||||
|
@ -849,25 +868,6 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
|
||||||
}
|
}
|
||||||
_spec.Edges = append(_spec.Edges, edge)
|
_spec.Edges = append(_spec.Edges, edge)
|
||||||
}
|
}
|
||||||
if nodes := ic.mutation.LabelIDs(); len(nodes) > 0 {
|
|
||||||
edge := &sqlgraph.EdgeSpec{
|
|
||||||
Rel: sqlgraph.M2M,
|
|
||||||
Inverse: true,
|
|
||||||
Table: item.LabelTable,
|
|
||||||
Columns: item.LabelPrimaryKey,
|
|
||||||
Bidi: false,
|
|
||||||
Target: &sqlgraph.EdgeTarget{
|
|
||||||
IDSpec: &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUUID,
|
|
||||||
Column: label.FieldID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, k := range nodes {
|
|
||||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
||||||
}
|
|
||||||
_spec.Edges = append(_spec.Edges, edge)
|
|
||||||
}
|
|
||||||
if nodes := ic.mutation.AttachmentsIDs(); len(nodes) > 0 {
|
if nodes := ic.mutation.AttachmentsIDs(); len(nodes) > 0 {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
|
|
|
@ -31,9 +31,9 @@ type ItemQuery struct {
|
||||||
fields []string
|
fields []string
|
||||||
predicates []predicate.Item
|
predicates []predicate.Item
|
||||||
withGroup *GroupQuery
|
withGroup *GroupQuery
|
||||||
|
withLabel *LabelQuery
|
||||||
withLocation *LocationQuery
|
withLocation *LocationQuery
|
||||||
withFields *ItemFieldQuery
|
withFields *ItemFieldQuery
|
||||||
withLabel *LabelQuery
|
|
||||||
withAttachments *AttachmentQuery
|
withAttachments *AttachmentQuery
|
||||||
withFKs bool
|
withFKs bool
|
||||||
// intermediate query (i.e. traversal path).
|
// intermediate query (i.e. traversal path).
|
||||||
|
@ -94,6 +94,28 @@ func (iq *ItemQuery) QueryGroup() *GroupQuery {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryLabel chains the current query on the "label" edge.
|
||||||
|
func (iq *ItemQuery) QueryLabel() *LabelQuery {
|
||||||
|
query := &LabelQuery{config: iq.config}
|
||||||
|
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
|
||||||
|
if err := iq.prepareQuery(ctx); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
selector := iq.sqlQuery(ctx)
|
||||||
|
if err := selector.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
step := sqlgraph.NewStep(
|
||||||
|
sqlgraph.From(item.Table, item.FieldID, selector),
|
||||||
|
sqlgraph.To(label.Table, label.FieldID),
|
||||||
|
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
|
||||||
|
)
|
||||||
|
fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
|
||||||
|
return fromU, nil
|
||||||
|
}
|
||||||
|
return query
|
||||||
|
}
|
||||||
|
|
||||||
// QueryLocation chains the current query on the "location" edge.
|
// QueryLocation chains the current query on the "location" edge.
|
||||||
func (iq *ItemQuery) QueryLocation() *LocationQuery {
|
func (iq *ItemQuery) QueryLocation() *LocationQuery {
|
||||||
query := &LocationQuery{config: iq.config}
|
query := &LocationQuery{config: iq.config}
|
||||||
|
@ -138,28 +160,6 @@ func (iq *ItemQuery) QueryFields() *ItemFieldQuery {
|
||||||
return query
|
return query
|
||||||
}
|
}
|
||||||
|
|
||||||
// QueryLabel chains the current query on the "label" edge.
|
|
||||||
func (iq *ItemQuery) QueryLabel() *LabelQuery {
|
|
||||||
query := &LabelQuery{config: iq.config}
|
|
||||||
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
|
|
||||||
if err := iq.prepareQuery(ctx); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
selector := iq.sqlQuery(ctx)
|
|
||||||
if err := selector.Err(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
step := sqlgraph.NewStep(
|
|
||||||
sqlgraph.From(item.Table, item.FieldID, selector),
|
|
||||||
sqlgraph.To(label.Table, label.FieldID),
|
|
||||||
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
|
|
||||||
)
|
|
||||||
fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
|
|
||||||
return fromU, nil
|
|
||||||
}
|
|
||||||
return query
|
|
||||||
}
|
|
||||||
|
|
||||||
// QueryAttachments chains the current query on the "attachments" edge.
|
// QueryAttachments chains the current query on the "attachments" edge.
|
||||||
func (iq *ItemQuery) QueryAttachments() *AttachmentQuery {
|
func (iq *ItemQuery) QueryAttachments() *AttachmentQuery {
|
||||||
query := &AttachmentQuery{config: iq.config}
|
query := &AttachmentQuery{config: iq.config}
|
||||||
|
@ -364,9 +364,9 @@ func (iq *ItemQuery) Clone() *ItemQuery {
|
||||||
order: append([]OrderFunc{}, iq.order...),
|
order: append([]OrderFunc{}, iq.order...),
|
||||||
predicates: append([]predicate.Item{}, iq.predicates...),
|
predicates: append([]predicate.Item{}, iq.predicates...),
|
||||||
withGroup: iq.withGroup.Clone(),
|
withGroup: iq.withGroup.Clone(),
|
||||||
|
withLabel: iq.withLabel.Clone(),
|
||||||
withLocation: iq.withLocation.Clone(),
|
withLocation: iq.withLocation.Clone(),
|
||||||
withFields: iq.withFields.Clone(),
|
withFields: iq.withFields.Clone(),
|
||||||
withLabel: iq.withLabel.Clone(),
|
|
||||||
withAttachments: iq.withAttachments.Clone(),
|
withAttachments: iq.withAttachments.Clone(),
|
||||||
// clone intermediate query.
|
// clone intermediate query.
|
||||||
sql: iq.sql.Clone(),
|
sql: iq.sql.Clone(),
|
||||||
|
@ -386,6 +386,17 @@ func (iq *ItemQuery) WithGroup(opts ...func(*GroupQuery)) *ItemQuery {
|
||||||
return iq
|
return iq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithLabel tells the query-builder to eager-load the nodes that are connected to
|
||||||
|
// the "label" edge. The optional arguments are used to configure the query builder of the edge.
|
||||||
|
func (iq *ItemQuery) WithLabel(opts ...func(*LabelQuery)) *ItemQuery {
|
||||||
|
query := &LabelQuery{config: iq.config}
|
||||||
|
for _, opt := range opts {
|
||||||
|
opt(query)
|
||||||
|
}
|
||||||
|
iq.withLabel = query
|
||||||
|
return iq
|
||||||
|
}
|
||||||
|
|
||||||
// WithLocation tells the query-builder to eager-load the nodes that are connected to
|
// WithLocation tells the query-builder to eager-load the nodes that are connected to
|
||||||
// the "location" edge. The optional arguments are used to configure the query builder of the edge.
|
// the "location" edge. The optional arguments are used to configure the query builder of the edge.
|
||||||
func (iq *ItemQuery) WithLocation(opts ...func(*LocationQuery)) *ItemQuery {
|
func (iq *ItemQuery) WithLocation(opts ...func(*LocationQuery)) *ItemQuery {
|
||||||
|
@ -408,17 +419,6 @@ func (iq *ItemQuery) WithFields(opts ...func(*ItemFieldQuery)) *ItemQuery {
|
||||||
return iq
|
return iq
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithLabel tells the query-builder to eager-load the nodes that are connected to
|
|
||||||
// the "label" edge. The optional arguments are used to configure the query builder of the edge.
|
|
||||||
func (iq *ItemQuery) WithLabel(opts ...func(*LabelQuery)) *ItemQuery {
|
|
||||||
query := &LabelQuery{config: iq.config}
|
|
||||||
for _, opt := range opts {
|
|
||||||
opt(query)
|
|
||||||
}
|
|
||||||
iq.withLabel = query
|
|
||||||
return iq
|
|
||||||
}
|
|
||||||
|
|
||||||
// WithAttachments tells the query-builder to eager-load the nodes that are connected to
|
// WithAttachments tells the query-builder to eager-load the nodes that are connected to
|
||||||
// the "attachments" edge. The optional arguments are used to configure the query builder of the edge.
|
// the "attachments" edge. The optional arguments are used to configure the query builder of the edge.
|
||||||
func (iq *ItemQuery) WithAttachments(opts ...func(*AttachmentQuery)) *ItemQuery {
|
func (iq *ItemQuery) WithAttachments(opts ...func(*AttachmentQuery)) *ItemQuery {
|
||||||
|
@ -501,9 +501,9 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
|
||||||
_spec = iq.querySpec()
|
_spec = iq.querySpec()
|
||||||
loadedTypes = [5]bool{
|
loadedTypes = [5]bool{
|
||||||
iq.withGroup != nil,
|
iq.withGroup != nil,
|
||||||
|
iq.withLabel != nil,
|
||||||
iq.withLocation != nil,
|
iq.withLocation != nil,
|
||||||
iq.withFields != nil,
|
iq.withFields != nil,
|
||||||
iq.withLabel != nil,
|
|
||||||
iq.withAttachments != nil,
|
iq.withAttachments != nil,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -537,6 +537,13 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if query := iq.withLabel; query != nil {
|
||||||
|
if err := iq.loadLabel(ctx, query, nodes,
|
||||||
|
func(n *Item) { n.Edges.Label = []*Label{} },
|
||||||
|
func(n *Item, e *Label) { n.Edges.Label = append(n.Edges.Label, e) }); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
if query := iq.withLocation; query != nil {
|
if query := iq.withLocation; query != nil {
|
||||||
if err := iq.loadLocation(ctx, query, nodes, nil,
|
if err := iq.loadLocation(ctx, query, nodes, nil,
|
||||||
func(n *Item, e *Location) { n.Edges.Location = e }); err != nil {
|
func(n *Item, e *Location) { n.Edges.Location = e }); err != nil {
|
||||||
|
@ -550,13 +557,6 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if query := iq.withLabel; query != nil {
|
|
||||||
if err := iq.loadLabel(ctx, query, nodes,
|
|
||||||
func(n *Item) { n.Edges.Label = []*Label{} },
|
|
||||||
func(n *Item, e *Label) { n.Edges.Label = append(n.Edges.Label, e) }); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if query := iq.withAttachments; query != nil {
|
if query := iq.withAttachments; query != nil {
|
||||||
if err := iq.loadAttachments(ctx, query, nodes,
|
if err := iq.loadAttachments(ctx, query, nodes,
|
||||||
func(n *Item) { n.Edges.Attachments = []*Attachment{} },
|
func(n *Item) { n.Edges.Attachments = []*Attachment{} },
|
||||||
|
@ -596,6 +596,64 @@ func (iq *ItemQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*Item, init func(*Item), assign func(*Item, *Label)) error {
|
||||||
|
edgeIDs := make([]driver.Value, len(nodes))
|
||||||
|
byID := make(map[uuid.UUID]*Item)
|
||||||
|
nids := make(map[uuid.UUID]map[*Item]struct{})
|
||||||
|
for i, node := range nodes {
|
||||||
|
edgeIDs[i] = node.ID
|
||||||
|
byID[node.ID] = node
|
||||||
|
if init != nil {
|
||||||
|
init(node)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
query.Where(func(s *sql.Selector) {
|
||||||
|
joinT := sql.Table(item.LabelTable)
|
||||||
|
s.Join(joinT).On(s.C(label.FieldID), joinT.C(item.LabelPrimaryKey[0]))
|
||||||
|
s.Where(sql.InValues(joinT.C(item.LabelPrimaryKey[1]), edgeIDs...))
|
||||||
|
columns := s.SelectedColumns()
|
||||||
|
s.Select(joinT.C(item.LabelPrimaryKey[1]))
|
||||||
|
s.AppendSelect(columns...)
|
||||||
|
s.SetDistinct(false)
|
||||||
|
})
|
||||||
|
if err := query.prepareQuery(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
|
||||||
|
assign := spec.Assign
|
||||||
|
values := spec.ScanValues
|
||||||
|
spec.ScanValues = func(columns []string) ([]any, error) {
|
||||||
|
values, err := values(columns[1:])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return append([]any{new(uuid.UUID)}, values...), nil
|
||||||
|
}
|
||||||
|
spec.Assign = func(columns []string, values []any) error {
|
||||||
|
outValue := *values[0].(*uuid.UUID)
|
||||||
|
inValue := *values[1].(*uuid.UUID)
|
||||||
|
if nids[inValue] == nil {
|
||||||
|
nids[inValue] = map[*Item]struct{}{byID[outValue]: struct{}{}}
|
||||||
|
return assign(columns[1:], values[1:])
|
||||||
|
}
|
||||||
|
nids[inValue][byID[outValue]] = struct{}{}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, n := range neighbors {
|
||||||
|
nodes, ok := nids[n.ID]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf(`unexpected "label" node returned %v`, n.ID)
|
||||||
|
}
|
||||||
|
for kn := range nodes {
|
||||||
|
assign(kn, n)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func (iq *ItemQuery) loadLocation(ctx context.Context, query *LocationQuery, nodes []*Item, init func(*Item), assign func(*Item, *Location)) error {
|
func (iq *ItemQuery) loadLocation(ctx context.Context, query *LocationQuery, nodes []*Item, init func(*Item), assign func(*Item, *Location)) error {
|
||||||
ids := make([]uuid.UUID, 0, len(nodes))
|
ids := make([]uuid.UUID, 0, len(nodes))
|
||||||
nodeids := make(map[uuid.UUID][]*Item)
|
nodeids := make(map[uuid.UUID][]*Item)
|
||||||
|
@ -656,64 +714,6 @@ func (iq *ItemQuery) loadFields(ctx context.Context, query *ItemFieldQuery, node
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*Item, init func(*Item), assign func(*Item, *Label)) error {
|
|
||||||
edgeIDs := make([]driver.Value, len(nodes))
|
|
||||||
byID := make(map[uuid.UUID]*Item)
|
|
||||||
nids := make(map[uuid.UUID]map[*Item]struct{})
|
|
||||||
for i, node := range nodes {
|
|
||||||
edgeIDs[i] = node.ID
|
|
||||||
byID[node.ID] = node
|
|
||||||
if init != nil {
|
|
||||||
init(node)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
query.Where(func(s *sql.Selector) {
|
|
||||||
joinT := sql.Table(item.LabelTable)
|
|
||||||
s.Join(joinT).On(s.C(label.FieldID), joinT.C(item.LabelPrimaryKey[0]))
|
|
||||||
s.Where(sql.InValues(joinT.C(item.LabelPrimaryKey[1]), edgeIDs...))
|
|
||||||
columns := s.SelectedColumns()
|
|
||||||
s.Select(joinT.C(item.LabelPrimaryKey[1]))
|
|
||||||
s.AppendSelect(columns...)
|
|
||||||
s.SetDistinct(false)
|
|
||||||
})
|
|
||||||
if err := query.prepareQuery(ctx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
|
|
||||||
assign := spec.Assign
|
|
||||||
values := spec.ScanValues
|
|
||||||
spec.ScanValues = func(columns []string) ([]any, error) {
|
|
||||||
values, err := values(columns[1:])
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return append([]any{new(uuid.UUID)}, values...), nil
|
|
||||||
}
|
|
||||||
spec.Assign = func(columns []string, values []any) error {
|
|
||||||
outValue := *values[0].(*uuid.UUID)
|
|
||||||
inValue := *values[1].(*uuid.UUID)
|
|
||||||
if nids[inValue] == nil {
|
|
||||||
nids[inValue] = map[*Item]struct{}{byID[outValue]: struct{}{}}
|
|
||||||
return assign(columns[1:], values[1:])
|
|
||||||
}
|
|
||||||
nids[inValue][byID[outValue]] = struct{}{}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
for _, n := range neighbors {
|
|
||||||
nodes, ok := nids[n.ID]
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf(`unexpected "label" node returned %v`, n.ID)
|
|
||||||
}
|
|
||||||
for kn := range nodes {
|
|
||||||
assign(kn, n)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (iq *ItemQuery) loadAttachments(ctx context.Context, query *AttachmentQuery, nodes []*Item, init func(*Item), assign func(*Item, *Attachment)) error {
|
func (iq *ItemQuery) loadAttachments(ctx context.Context, query *AttachmentQuery, nodes []*Item, init func(*Item), assign func(*Item, *Attachment)) error {
|
||||||
fks := make([]driver.Value, 0, len(nodes))
|
fks := make([]driver.Value, 0, len(nodes))
|
||||||
nodeids := make(map[uuid.UUID]*Item)
|
nodeids := make(map[uuid.UUID]*Item)
|
||||||
|
|
|
@ -388,6 +388,21 @@ func (iu *ItemUpdate) SetGroup(g *Group) *ItemUpdate {
|
||||||
return iu.SetGroupID(g.ID)
|
return iu.SetGroupID(g.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
|
||||||
|
func (iu *ItemUpdate) AddLabelIDs(ids ...uuid.UUID) *ItemUpdate {
|
||||||
|
iu.mutation.AddLabelIDs(ids...)
|
||||||
|
return iu
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLabel adds the "label" edges to the Label entity.
|
||||||
|
func (iu *ItemUpdate) AddLabel(l ...*Label) *ItemUpdate {
|
||||||
|
ids := make([]uuid.UUID, len(l))
|
||||||
|
for i := range l {
|
||||||
|
ids[i] = l[i].ID
|
||||||
|
}
|
||||||
|
return iu.AddLabelIDs(ids...)
|
||||||
|
}
|
||||||
|
|
||||||
// SetLocationID sets the "location" edge to the Location entity by ID.
|
// SetLocationID sets the "location" edge to the Location entity by ID.
|
||||||
func (iu *ItemUpdate) SetLocationID(id uuid.UUID) *ItemUpdate {
|
func (iu *ItemUpdate) SetLocationID(id uuid.UUID) *ItemUpdate {
|
||||||
iu.mutation.SetLocationID(id)
|
iu.mutation.SetLocationID(id)
|
||||||
|
@ -422,21 +437,6 @@ func (iu *ItemUpdate) AddFields(i ...*ItemField) *ItemUpdate {
|
||||||
return iu.AddFieldIDs(ids...)
|
return iu.AddFieldIDs(ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
|
|
||||||
func (iu *ItemUpdate) AddLabelIDs(ids ...uuid.UUID) *ItemUpdate {
|
|
||||||
iu.mutation.AddLabelIDs(ids...)
|
|
||||||
return iu
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddLabel adds the "label" edges to the Label entity.
|
|
||||||
func (iu *ItemUpdate) AddLabel(l ...*Label) *ItemUpdate {
|
|
||||||
ids := make([]uuid.UUID, len(l))
|
|
||||||
for i := range l {
|
|
||||||
ids[i] = l[i].ID
|
|
||||||
}
|
|
||||||
return iu.AddLabelIDs(ids...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
|
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
|
||||||
func (iu *ItemUpdate) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
|
func (iu *ItemUpdate) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
|
||||||
iu.mutation.AddAttachmentIDs(ids...)
|
iu.mutation.AddAttachmentIDs(ids...)
|
||||||
|
@ -463,6 +463,27 @@ func (iu *ItemUpdate) ClearGroup() *ItemUpdate {
|
||||||
return iu
|
return iu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearLabel clears all "label" edges to the Label entity.
|
||||||
|
func (iu *ItemUpdate) ClearLabel() *ItemUpdate {
|
||||||
|
iu.mutation.ClearLabel()
|
||||||
|
return iu
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
|
||||||
|
func (iu *ItemUpdate) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdate {
|
||||||
|
iu.mutation.RemoveLabelIDs(ids...)
|
||||||
|
return iu
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveLabel removes "label" edges to Label entities.
|
||||||
|
func (iu *ItemUpdate) RemoveLabel(l ...*Label) *ItemUpdate {
|
||||||
|
ids := make([]uuid.UUID, len(l))
|
||||||
|
for i := range l {
|
||||||
|
ids[i] = l[i].ID
|
||||||
|
}
|
||||||
|
return iu.RemoveLabelIDs(ids...)
|
||||||
|
}
|
||||||
|
|
||||||
// ClearLocation clears the "location" edge to the Location entity.
|
// ClearLocation clears the "location" edge to the Location entity.
|
||||||
func (iu *ItemUpdate) ClearLocation() *ItemUpdate {
|
func (iu *ItemUpdate) ClearLocation() *ItemUpdate {
|
||||||
iu.mutation.ClearLocation()
|
iu.mutation.ClearLocation()
|
||||||
|
@ -490,27 +511,6 @@ func (iu *ItemUpdate) RemoveFields(i ...*ItemField) *ItemUpdate {
|
||||||
return iu.RemoveFieldIDs(ids...)
|
return iu.RemoveFieldIDs(ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearLabel clears all "label" edges to the Label entity.
|
|
||||||
func (iu *ItemUpdate) ClearLabel() *ItemUpdate {
|
|
||||||
iu.mutation.ClearLabel()
|
|
||||||
return iu
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
|
|
||||||
func (iu *ItemUpdate) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdate {
|
|
||||||
iu.mutation.RemoveLabelIDs(ids...)
|
|
||||||
return iu
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoveLabel removes "label" edges to Label entities.
|
|
||||||
func (iu *ItemUpdate) RemoveLabel(l ...*Label) *ItemUpdate {
|
|
||||||
ids := make([]uuid.UUID, len(l))
|
|
||||||
for i := range l {
|
|
||||||
ids[i] = l[i].ID
|
|
||||||
}
|
|
||||||
return iu.RemoveLabelIDs(ids...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearAttachments clears all "attachments" edges to the Attachment entity.
|
// ClearAttachments clears all "attachments" edges to the Attachment entity.
|
||||||
func (iu *ItemUpdate) ClearAttachments() *ItemUpdate {
|
func (iu *ItemUpdate) ClearAttachments() *ItemUpdate {
|
||||||
iu.mutation.ClearAttachments()
|
iu.mutation.ClearAttachments()
|
||||||
|
@ -934,6 +934,60 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||||
}
|
}
|
||||||
|
if iu.mutation.LabelCleared() {
|
||||||
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
Rel: sqlgraph.M2M,
|
||||||
|
Inverse: true,
|
||||||
|
Table: item.LabelTable,
|
||||||
|
Columns: item.LabelPrimaryKey,
|
||||||
|
Bidi: false,
|
||||||
|
Target: &sqlgraph.EdgeTarget{
|
||||||
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeUUID,
|
||||||
|
Column: label.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
|
}
|
||||||
|
if nodes := iu.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iu.mutation.LabelCleared() {
|
||||||
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
Rel: sqlgraph.M2M,
|
||||||
|
Inverse: true,
|
||||||
|
Table: item.LabelTable,
|
||||||
|
Columns: item.LabelPrimaryKey,
|
||||||
|
Bidi: false,
|
||||||
|
Target: &sqlgraph.EdgeTarget{
|
||||||
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeUUID,
|
||||||
|
Column: label.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, k := range nodes {
|
||||||
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||||
|
}
|
||||||
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
|
}
|
||||||
|
if nodes := iu.mutation.LabelIDs(); len(nodes) > 0 {
|
||||||
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
Rel: sqlgraph.M2M,
|
||||||
|
Inverse: true,
|
||||||
|
Table: item.LabelTable,
|
||||||
|
Columns: item.LabelPrimaryKey,
|
||||||
|
Bidi: false,
|
||||||
|
Target: &sqlgraph.EdgeTarget{
|
||||||
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeUUID,
|
||||||
|
Column: label.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, k := range nodes {
|
||||||
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||||
|
}
|
||||||
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||||
|
}
|
||||||
if iu.mutation.LocationCleared() {
|
if iu.mutation.LocationCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.M2O,
|
Rel: sqlgraph.M2O,
|
||||||
|
@ -1023,60 +1077,6 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||||
}
|
}
|
||||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||||
}
|
}
|
||||||
if iu.mutation.LabelCleared() {
|
|
||||||
edge := &sqlgraph.EdgeSpec{
|
|
||||||
Rel: sqlgraph.M2M,
|
|
||||||
Inverse: true,
|
|
||||||
Table: item.LabelTable,
|
|
||||||
Columns: item.LabelPrimaryKey,
|
|
||||||
Bidi: false,
|
|
||||||
Target: &sqlgraph.EdgeTarget{
|
|
||||||
IDSpec: &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUUID,
|
|
||||||
Column: label.FieldID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
||||||
}
|
|
||||||
if nodes := iu.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iu.mutation.LabelCleared() {
|
|
||||||
edge := &sqlgraph.EdgeSpec{
|
|
||||||
Rel: sqlgraph.M2M,
|
|
||||||
Inverse: true,
|
|
||||||
Table: item.LabelTable,
|
|
||||||
Columns: item.LabelPrimaryKey,
|
|
||||||
Bidi: false,
|
|
||||||
Target: &sqlgraph.EdgeTarget{
|
|
||||||
IDSpec: &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUUID,
|
|
||||||
Column: label.FieldID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, k := range nodes {
|
|
||||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
||||||
}
|
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
||||||
}
|
|
||||||
if nodes := iu.mutation.LabelIDs(); len(nodes) > 0 {
|
|
||||||
edge := &sqlgraph.EdgeSpec{
|
|
||||||
Rel: sqlgraph.M2M,
|
|
||||||
Inverse: true,
|
|
||||||
Table: item.LabelTable,
|
|
||||||
Columns: item.LabelPrimaryKey,
|
|
||||||
Bidi: false,
|
|
||||||
Target: &sqlgraph.EdgeTarget{
|
|
||||||
IDSpec: &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUUID,
|
|
||||||
Column: label.FieldID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, k := range nodes {
|
|
||||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
||||||
}
|
|
||||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
||||||
}
|
|
||||||
if iu.mutation.AttachmentsCleared() {
|
if iu.mutation.AttachmentsCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
|
@ -1504,6 +1504,21 @@ func (iuo *ItemUpdateOne) SetGroup(g *Group) *ItemUpdateOne {
|
||||||
return iuo.SetGroupID(g.ID)
|
return iuo.SetGroupID(g.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
|
||||||
|
func (iuo *ItemUpdateOne) AddLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
|
||||||
|
iuo.mutation.AddLabelIDs(ids...)
|
||||||
|
return iuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLabel adds the "label" edges to the Label entity.
|
||||||
|
func (iuo *ItemUpdateOne) AddLabel(l ...*Label) *ItemUpdateOne {
|
||||||
|
ids := make([]uuid.UUID, len(l))
|
||||||
|
for i := range l {
|
||||||
|
ids[i] = l[i].ID
|
||||||
|
}
|
||||||
|
return iuo.AddLabelIDs(ids...)
|
||||||
|
}
|
||||||
|
|
||||||
// SetLocationID sets the "location" edge to the Location entity by ID.
|
// SetLocationID sets the "location" edge to the Location entity by ID.
|
||||||
func (iuo *ItemUpdateOne) SetLocationID(id uuid.UUID) *ItemUpdateOne {
|
func (iuo *ItemUpdateOne) SetLocationID(id uuid.UUID) *ItemUpdateOne {
|
||||||
iuo.mutation.SetLocationID(id)
|
iuo.mutation.SetLocationID(id)
|
||||||
|
@ -1538,21 +1553,6 @@ func (iuo *ItemUpdateOne) AddFields(i ...*ItemField) *ItemUpdateOne {
|
||||||
return iuo.AddFieldIDs(ids...)
|
return iuo.AddFieldIDs(ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
|
|
||||||
func (iuo *ItemUpdateOne) AddLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
|
|
||||||
iuo.mutation.AddLabelIDs(ids...)
|
|
||||||
return iuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddLabel adds the "label" edges to the Label entity.
|
|
||||||
func (iuo *ItemUpdateOne) AddLabel(l ...*Label) *ItemUpdateOne {
|
|
||||||
ids := make([]uuid.UUID, len(l))
|
|
||||||
for i := range l {
|
|
||||||
ids[i] = l[i].ID
|
|
||||||
}
|
|
||||||
return iuo.AddLabelIDs(ids...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
|
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
|
||||||
func (iuo *ItemUpdateOne) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
|
func (iuo *ItemUpdateOne) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
|
||||||
iuo.mutation.AddAttachmentIDs(ids...)
|
iuo.mutation.AddAttachmentIDs(ids...)
|
||||||
|
@ -1579,6 +1579,27 @@ func (iuo *ItemUpdateOne) ClearGroup() *ItemUpdateOne {
|
||||||
return iuo
|
return iuo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearLabel clears all "label" edges to the Label entity.
|
||||||
|
func (iuo *ItemUpdateOne) ClearLabel() *ItemUpdateOne {
|
||||||
|
iuo.mutation.ClearLabel()
|
||||||
|
return iuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
|
||||||
|
func (iuo *ItemUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
|
||||||
|
iuo.mutation.RemoveLabelIDs(ids...)
|
||||||
|
return iuo
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveLabel removes "label" edges to Label entities.
|
||||||
|
func (iuo *ItemUpdateOne) RemoveLabel(l ...*Label) *ItemUpdateOne {
|
||||||
|
ids := make([]uuid.UUID, len(l))
|
||||||
|
for i := range l {
|
||||||
|
ids[i] = l[i].ID
|
||||||
|
}
|
||||||
|
return iuo.RemoveLabelIDs(ids...)
|
||||||
|
}
|
||||||
|
|
||||||
// ClearLocation clears the "location" edge to the Location entity.
|
// ClearLocation clears the "location" edge to the Location entity.
|
||||||
func (iuo *ItemUpdateOne) ClearLocation() *ItemUpdateOne {
|
func (iuo *ItemUpdateOne) ClearLocation() *ItemUpdateOne {
|
||||||
iuo.mutation.ClearLocation()
|
iuo.mutation.ClearLocation()
|
||||||
|
@ -1606,27 +1627,6 @@ func (iuo *ItemUpdateOne) RemoveFields(i ...*ItemField) *ItemUpdateOne {
|
||||||
return iuo.RemoveFieldIDs(ids...)
|
return iuo.RemoveFieldIDs(ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClearLabel clears all "label" edges to the Label entity.
|
|
||||||
func (iuo *ItemUpdateOne) ClearLabel() *ItemUpdateOne {
|
|
||||||
iuo.mutation.ClearLabel()
|
|
||||||
return iuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
|
|
||||||
func (iuo *ItemUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
|
|
||||||
iuo.mutation.RemoveLabelIDs(ids...)
|
|
||||||
return iuo
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoveLabel removes "label" edges to Label entities.
|
|
||||||
func (iuo *ItemUpdateOne) RemoveLabel(l ...*Label) *ItemUpdateOne {
|
|
||||||
ids := make([]uuid.UUID, len(l))
|
|
||||||
for i := range l {
|
|
||||||
ids[i] = l[i].ID
|
|
||||||
}
|
|
||||||
return iuo.RemoveLabelIDs(ids...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearAttachments clears all "attachments" edges to the Attachment entity.
|
// ClearAttachments clears all "attachments" edges to the Attachment entity.
|
||||||
func (iuo *ItemUpdateOne) ClearAttachments() *ItemUpdateOne {
|
func (iuo *ItemUpdateOne) ClearAttachments() *ItemUpdateOne {
|
||||||
iuo.mutation.ClearAttachments()
|
iuo.mutation.ClearAttachments()
|
||||||
|
@ -2080,6 +2080,60 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
|
||||||
}
|
}
|
||||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||||
}
|
}
|
||||||
|
if iuo.mutation.LabelCleared() {
|
||||||
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
Rel: sqlgraph.M2M,
|
||||||
|
Inverse: true,
|
||||||
|
Table: item.LabelTable,
|
||||||
|
Columns: item.LabelPrimaryKey,
|
||||||
|
Bidi: false,
|
||||||
|
Target: &sqlgraph.EdgeTarget{
|
||||||
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeUUID,
|
||||||
|
Column: label.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
|
}
|
||||||
|
if nodes := iuo.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iuo.mutation.LabelCleared() {
|
||||||
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
Rel: sqlgraph.M2M,
|
||||||
|
Inverse: true,
|
||||||
|
Table: item.LabelTable,
|
||||||
|
Columns: item.LabelPrimaryKey,
|
||||||
|
Bidi: false,
|
||||||
|
Target: &sqlgraph.EdgeTarget{
|
||||||
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeUUID,
|
||||||
|
Column: label.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, k := range nodes {
|
||||||
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||||
|
}
|
||||||
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
||||||
|
}
|
||||||
|
if nodes := iuo.mutation.LabelIDs(); len(nodes) > 0 {
|
||||||
|
edge := &sqlgraph.EdgeSpec{
|
||||||
|
Rel: sqlgraph.M2M,
|
||||||
|
Inverse: true,
|
||||||
|
Table: item.LabelTable,
|
||||||
|
Columns: item.LabelPrimaryKey,
|
||||||
|
Bidi: false,
|
||||||
|
Target: &sqlgraph.EdgeTarget{
|
||||||
|
IDSpec: &sqlgraph.FieldSpec{
|
||||||
|
Type: field.TypeUUID,
|
||||||
|
Column: label.FieldID,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, k := range nodes {
|
||||||
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||||
|
}
|
||||||
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||||
|
}
|
||||||
if iuo.mutation.LocationCleared() {
|
if iuo.mutation.LocationCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.M2O,
|
Rel: sqlgraph.M2O,
|
||||||
|
@ -2169,60 +2223,6 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
|
||||||
}
|
}
|
||||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
||||||
}
|
}
|
||||||
if iuo.mutation.LabelCleared() {
|
|
||||||
edge := &sqlgraph.EdgeSpec{
|
|
||||||
Rel: sqlgraph.M2M,
|
|
||||||
Inverse: true,
|
|
||||||
Table: item.LabelTable,
|
|
||||||
Columns: item.LabelPrimaryKey,
|
|
||||||
Bidi: false,
|
|
||||||
Target: &sqlgraph.EdgeTarget{
|
|
||||||
IDSpec: &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUUID,
|
|
||||||
Column: label.FieldID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
||||||
}
|
|
||||||
if nodes := iuo.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iuo.mutation.LabelCleared() {
|
|
||||||
edge := &sqlgraph.EdgeSpec{
|
|
||||||
Rel: sqlgraph.M2M,
|
|
||||||
Inverse: true,
|
|
||||||
Table: item.LabelTable,
|
|
||||||
Columns: item.LabelPrimaryKey,
|
|
||||||
Bidi: false,
|
|
||||||
Target: &sqlgraph.EdgeTarget{
|
|
||||||
IDSpec: &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUUID,
|
|
||||||
Column: label.FieldID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, k := range nodes {
|
|
||||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
||||||
}
|
|
||||||
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
||||||
}
|
|
||||||
if nodes := iuo.mutation.LabelIDs(); len(nodes) > 0 {
|
|
||||||
edge := &sqlgraph.EdgeSpec{
|
|
||||||
Rel: sqlgraph.M2M,
|
|
||||||
Inverse: true,
|
|
||||||
Table: item.LabelTable,
|
|
||||||
Columns: item.LabelPrimaryKey,
|
|
||||||
Bidi: false,
|
|
||||||
Target: &sqlgraph.EdgeTarget{
|
|
||||||
IDSpec: &sqlgraph.FieldSpec{
|
|
||||||
Type: field.TypeUUID,
|
|
||||||
Column: label.FieldID,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, k := range nodes {
|
|
||||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
||||||
}
|
|
||||||
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
||||||
}
|
|
||||||
if iuo.mutation.AttachmentsCleared() {
|
if iuo.mutation.AttachmentsCleared() {
|
||||||
edge := &sqlgraph.EdgeSpec{
|
edge := &sqlgraph.EdgeSpec{
|
||||||
Rel: sqlgraph.O2M,
|
Rel: sqlgraph.O2M,
|
||||||
|
|
|
@ -3430,14 +3430,14 @@ type ItemMutation struct {
|
||||||
clearedFields map[string]struct{}
|
clearedFields map[string]struct{}
|
||||||
group *uuid.UUID
|
group *uuid.UUID
|
||||||
clearedgroup bool
|
clearedgroup bool
|
||||||
|
label map[uuid.UUID]struct{}
|
||||||
|
removedlabel map[uuid.UUID]struct{}
|
||||||
|
clearedlabel bool
|
||||||
location *uuid.UUID
|
location *uuid.UUID
|
||||||
clearedlocation bool
|
clearedlocation bool
|
||||||
fields map[uuid.UUID]struct{}
|
fields map[uuid.UUID]struct{}
|
||||||
removedfields map[uuid.UUID]struct{}
|
removedfields map[uuid.UUID]struct{}
|
||||||
clearedfields bool
|
clearedfields bool
|
||||||
label map[uuid.UUID]struct{}
|
|
||||||
removedlabel map[uuid.UUID]struct{}
|
|
||||||
clearedlabel bool
|
|
||||||
attachments map[uuid.UUID]struct{}
|
attachments map[uuid.UUID]struct{}
|
||||||
removedattachments map[uuid.UUID]struct{}
|
removedattachments map[uuid.UUID]struct{}
|
||||||
clearedattachments bool
|
clearedattachments bool
|
||||||
|
@ -4574,6 +4574,60 @@ func (m *ItemMutation) ResetGroup() {
|
||||||
m.clearedgroup = false
|
m.clearedgroup = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddLabelIDs adds the "label" edge to the Label entity by ids.
|
||||||
|
func (m *ItemMutation) AddLabelIDs(ids ...uuid.UUID) {
|
||||||
|
if m.label == nil {
|
||||||
|
m.label = make(map[uuid.UUID]struct{})
|
||||||
|
}
|
||||||
|
for i := range ids {
|
||||||
|
m.label[ids[i]] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClearLabel clears the "label" edge to the Label entity.
|
||||||
|
func (m *ItemMutation) ClearLabel() {
|
||||||
|
m.clearedlabel = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// LabelCleared reports if the "label" edge to the Label entity was cleared.
|
||||||
|
func (m *ItemMutation) LabelCleared() bool {
|
||||||
|
return m.clearedlabel
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemoveLabelIDs removes the "label" edge to the Label entity by IDs.
|
||||||
|
func (m *ItemMutation) RemoveLabelIDs(ids ...uuid.UUID) {
|
||||||
|
if m.removedlabel == nil {
|
||||||
|
m.removedlabel = make(map[uuid.UUID]struct{})
|
||||||
|
}
|
||||||
|
for i := range ids {
|
||||||
|
delete(m.label, ids[i])
|
||||||
|
m.removedlabel[ids[i]] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RemovedLabel returns the removed IDs of the "label" edge to the Label entity.
|
||||||
|
func (m *ItemMutation) RemovedLabelIDs() (ids []uuid.UUID) {
|
||||||
|
for id := range m.removedlabel {
|
||||||
|
ids = append(ids, id)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// LabelIDs returns the "label" edge IDs in the mutation.
|
||||||
|
func (m *ItemMutation) LabelIDs() (ids []uuid.UUID) {
|
||||||
|
for id := range m.label {
|
||||||
|
ids = append(ids, id)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResetLabel resets all changes to the "label" edge.
|
||||||
|
func (m *ItemMutation) ResetLabel() {
|
||||||
|
m.label = nil
|
||||||
|
m.clearedlabel = false
|
||||||
|
m.removedlabel = nil
|
||||||
|
}
|
||||||
|
|
||||||
// SetLocationID sets the "location" edge to the Location entity by id.
|
// SetLocationID sets the "location" edge to the Location entity by id.
|
||||||
func (m *ItemMutation) SetLocationID(id uuid.UUID) {
|
func (m *ItemMutation) SetLocationID(id uuid.UUID) {
|
||||||
m.location = &id
|
m.location = &id
|
||||||
|
@ -4667,60 +4721,6 @@ func (m *ItemMutation) ResetFields() {
|
||||||
m.removedfields = nil
|
m.removedfields = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddLabelIDs adds the "label" edge to the Label entity by ids.
|
|
||||||
func (m *ItemMutation) AddLabelIDs(ids ...uuid.UUID) {
|
|
||||||
if m.label == nil {
|
|
||||||
m.label = make(map[uuid.UUID]struct{})
|
|
||||||
}
|
|
||||||
for i := range ids {
|
|
||||||
m.label[ids[i]] = struct{}{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClearLabel clears the "label" edge to the Label entity.
|
|
||||||
func (m *ItemMutation) ClearLabel() {
|
|
||||||
m.clearedlabel = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// LabelCleared reports if the "label" edge to the Label entity was cleared.
|
|
||||||
func (m *ItemMutation) LabelCleared() bool {
|
|
||||||
return m.clearedlabel
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoveLabelIDs removes the "label" edge to the Label entity by IDs.
|
|
||||||
func (m *ItemMutation) RemoveLabelIDs(ids ...uuid.UUID) {
|
|
||||||
if m.removedlabel == nil {
|
|
||||||
m.removedlabel = make(map[uuid.UUID]struct{})
|
|
||||||
}
|
|
||||||
for i := range ids {
|
|
||||||
delete(m.label, ids[i])
|
|
||||||
m.removedlabel[ids[i]] = struct{}{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemovedLabel returns the removed IDs of the "label" edge to the Label entity.
|
|
||||||
func (m *ItemMutation) RemovedLabelIDs() (ids []uuid.UUID) {
|
|
||||||
for id := range m.removedlabel {
|
|
||||||
ids = append(ids, id)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// LabelIDs returns the "label" edge IDs in the mutation.
|
|
||||||
func (m *ItemMutation) LabelIDs() (ids []uuid.UUID) {
|
|
||||||
for id := range m.label {
|
|
||||||
ids = append(ids, id)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResetLabel resets all changes to the "label" edge.
|
|
||||||
func (m *ItemMutation) ResetLabel() {
|
|
||||||
m.label = nil
|
|
||||||
m.clearedlabel = false
|
|
||||||
m.removedlabel = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by ids.
|
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by ids.
|
||||||
func (m *ItemMutation) AddAttachmentIDs(ids ...uuid.UUID) {
|
func (m *ItemMutation) AddAttachmentIDs(ids ...uuid.UUID) {
|
||||||
if m.attachments == nil {
|
if m.attachments == nil {
|
||||||
|
@ -5357,15 +5357,15 @@ func (m *ItemMutation) AddedEdges() []string {
|
||||||
if m.group != nil {
|
if m.group != nil {
|
||||||
edges = append(edges, item.EdgeGroup)
|
edges = append(edges, item.EdgeGroup)
|
||||||
}
|
}
|
||||||
|
if m.label != nil {
|
||||||
|
edges = append(edges, item.EdgeLabel)
|
||||||
|
}
|
||||||
if m.location != nil {
|
if m.location != nil {
|
||||||
edges = append(edges, item.EdgeLocation)
|
edges = append(edges, item.EdgeLocation)
|
||||||
}
|
}
|
||||||
if m.fields != nil {
|
if m.fields != nil {
|
||||||
edges = append(edges, item.EdgeFields)
|
edges = append(edges, item.EdgeFields)
|
||||||
}
|
}
|
||||||
if m.label != nil {
|
|
||||||
edges = append(edges, item.EdgeLabel)
|
|
||||||
}
|
|
||||||
if m.attachments != nil {
|
if m.attachments != nil {
|
||||||
edges = append(edges, item.EdgeAttachments)
|
edges = append(edges, item.EdgeAttachments)
|
||||||
}
|
}
|
||||||
|
@ -5380,6 +5380,12 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
|
||||||
if id := m.group; id != nil {
|
if id := m.group; id != nil {
|
||||||
return []ent.Value{*id}
|
return []ent.Value{*id}
|
||||||
}
|
}
|
||||||
|
case item.EdgeLabel:
|
||||||
|
ids := make([]ent.Value, 0, len(m.label))
|
||||||
|
for id := range m.label {
|
||||||
|
ids = append(ids, id)
|
||||||
|
}
|
||||||
|
return ids
|
||||||
case item.EdgeLocation:
|
case item.EdgeLocation:
|
||||||
if id := m.location; id != nil {
|
if id := m.location; id != nil {
|
||||||
return []ent.Value{*id}
|
return []ent.Value{*id}
|
||||||
|
@ -5390,12 +5396,6 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
|
||||||
ids = append(ids, id)
|
ids = append(ids, id)
|
||||||
}
|
}
|
||||||
return ids
|
return ids
|
||||||
case item.EdgeLabel:
|
|
||||||
ids := make([]ent.Value, 0, len(m.label))
|
|
||||||
for id := range m.label {
|
|
||||||
ids = append(ids, id)
|
|
||||||
}
|
|
||||||
return ids
|
|
||||||
case item.EdgeAttachments:
|
case item.EdgeAttachments:
|
||||||
ids := make([]ent.Value, 0, len(m.attachments))
|
ids := make([]ent.Value, 0, len(m.attachments))
|
||||||
for id := range m.attachments {
|
for id := range m.attachments {
|
||||||
|
@ -5409,12 +5409,12 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
|
||||||
// RemovedEdges returns all edge names that were removed in this mutation.
|
// RemovedEdges returns all edge names that were removed in this mutation.
|
||||||
func (m *ItemMutation) RemovedEdges() []string {
|
func (m *ItemMutation) RemovedEdges() []string {
|
||||||
edges := make([]string, 0, 5)
|
edges := make([]string, 0, 5)
|
||||||
if m.removedfields != nil {
|
|
||||||
edges = append(edges, item.EdgeFields)
|
|
||||||
}
|
|
||||||
if m.removedlabel != nil {
|
if m.removedlabel != nil {
|
||||||
edges = append(edges, item.EdgeLabel)
|
edges = append(edges, item.EdgeLabel)
|
||||||
}
|
}
|
||||||
|
if m.removedfields != nil {
|
||||||
|
edges = append(edges, item.EdgeFields)
|
||||||
|
}
|
||||||
if m.removedattachments != nil {
|
if m.removedattachments != nil {
|
||||||
edges = append(edges, item.EdgeAttachments)
|
edges = append(edges, item.EdgeAttachments)
|
||||||
}
|
}
|
||||||
|
@ -5425,18 +5425,18 @@ func (m *ItemMutation) RemovedEdges() []string {
|
||||||
// the given name in this mutation.
|
// the given name in this mutation.
|
||||||
func (m *ItemMutation) RemovedIDs(name string) []ent.Value {
|
func (m *ItemMutation) RemovedIDs(name string) []ent.Value {
|
||||||
switch name {
|
switch name {
|
||||||
case item.EdgeFields:
|
|
||||||
ids := make([]ent.Value, 0, len(m.removedfields))
|
|
||||||
for id := range m.removedfields {
|
|
||||||
ids = append(ids, id)
|
|
||||||
}
|
|
||||||
return ids
|
|
||||||
case item.EdgeLabel:
|
case item.EdgeLabel:
|
||||||
ids := make([]ent.Value, 0, len(m.removedlabel))
|
ids := make([]ent.Value, 0, len(m.removedlabel))
|
||||||
for id := range m.removedlabel {
|
for id := range m.removedlabel {
|
||||||
ids = append(ids, id)
|
ids = append(ids, id)
|
||||||
}
|
}
|
||||||
return ids
|
return ids
|
||||||
|
case item.EdgeFields:
|
||||||
|
ids := make([]ent.Value, 0, len(m.removedfields))
|
||||||
|
for id := range m.removedfields {
|
||||||
|
ids = append(ids, id)
|
||||||
|
}
|
||||||
|
return ids
|
||||||
case item.EdgeAttachments:
|
case item.EdgeAttachments:
|
||||||
ids := make([]ent.Value, 0, len(m.removedattachments))
|
ids := make([]ent.Value, 0, len(m.removedattachments))
|
||||||
for id := range m.removedattachments {
|
for id := range m.removedattachments {
|
||||||
|
@ -5453,15 +5453,15 @@ func (m *ItemMutation) ClearedEdges() []string {
|
||||||
if m.clearedgroup {
|
if m.clearedgroup {
|
||||||
edges = append(edges, item.EdgeGroup)
|
edges = append(edges, item.EdgeGroup)
|
||||||
}
|
}
|
||||||
|
if m.clearedlabel {
|
||||||
|
edges = append(edges, item.EdgeLabel)
|
||||||
|
}
|
||||||
if m.clearedlocation {
|
if m.clearedlocation {
|
||||||
edges = append(edges, item.EdgeLocation)
|
edges = append(edges, item.EdgeLocation)
|
||||||
}
|
}
|
||||||
if m.clearedfields {
|
if m.clearedfields {
|
||||||
edges = append(edges, item.EdgeFields)
|
edges = append(edges, item.EdgeFields)
|
||||||
}
|
}
|
||||||
if m.clearedlabel {
|
|
||||||
edges = append(edges, item.EdgeLabel)
|
|
||||||
}
|
|
||||||
if m.clearedattachments {
|
if m.clearedattachments {
|
||||||
edges = append(edges, item.EdgeAttachments)
|
edges = append(edges, item.EdgeAttachments)
|
||||||
}
|
}
|
||||||
|
@ -5474,12 +5474,12 @@ func (m *ItemMutation) EdgeCleared(name string) bool {
|
||||||
switch name {
|
switch name {
|
||||||
case item.EdgeGroup:
|
case item.EdgeGroup:
|
||||||
return m.clearedgroup
|
return m.clearedgroup
|
||||||
|
case item.EdgeLabel:
|
||||||
|
return m.clearedlabel
|
||||||
case item.EdgeLocation:
|
case item.EdgeLocation:
|
||||||
return m.clearedlocation
|
return m.clearedlocation
|
||||||
case item.EdgeFields:
|
case item.EdgeFields:
|
||||||
return m.clearedfields
|
return m.clearedfields
|
||||||
case item.EdgeLabel:
|
|
||||||
return m.clearedlabel
|
|
||||||
case item.EdgeAttachments:
|
case item.EdgeAttachments:
|
||||||
return m.clearedattachments
|
return m.clearedattachments
|
||||||
}
|
}
|
||||||
|
@ -5507,15 +5507,15 @@ func (m *ItemMutation) ResetEdge(name string) error {
|
||||||
case item.EdgeGroup:
|
case item.EdgeGroup:
|
||||||
m.ResetGroup()
|
m.ResetGroup()
|
||||||
return nil
|
return nil
|
||||||
|
case item.EdgeLabel:
|
||||||
|
m.ResetLabel()
|
||||||
|
return nil
|
||||||
case item.EdgeLocation:
|
case item.EdgeLocation:
|
||||||
m.ResetLocation()
|
m.ResetLocation()
|
||||||
return nil
|
return nil
|
||||||
case item.EdgeFields:
|
case item.EdgeFields:
|
||||||
m.ResetFields()
|
m.ResetFields()
|
||||||
return nil
|
return nil
|
||||||
case item.EdgeLabel:
|
|
||||||
m.ResetLabel()
|
|
||||||
return nil
|
|
||||||
case item.EdgeAttachments:
|
case item.EdgeAttachments:
|
||||||
m.ResetAttachments()
|
m.ResetAttachments()
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -98,6 +98,8 @@ func (Item) Edges() []ent.Edge {
|
||||||
Ref("items").
|
Ref("items").
|
||||||
Required().
|
Required().
|
||||||
Unique(),
|
Unique(),
|
||||||
|
edge.From("label", Label.Type).
|
||||||
|
Ref("items"),
|
||||||
edge.From("location", Location.Type).
|
edge.From("location", Location.Type).
|
||||||
Ref("items").
|
Ref("items").
|
||||||
Unique(),
|
Unique(),
|
||||||
|
@ -105,11 +107,6 @@ func (Item) Edges() []ent.Edge {
|
||||||
Annotations(entsql.Annotation{
|
Annotations(entsql.Annotation{
|
||||||
OnDelete: entsql.Cascade,
|
OnDelete: entsql.Cascade,
|
||||||
}),
|
}),
|
||||||
edge.From("label", Label.Type).
|
|
||||||
Ref("items").
|
|
||||||
Annotations(entsql.Annotation{
|
|
||||||
OnDelete: entsql.Cascade,
|
|
||||||
}),
|
|
||||||
edge.To("attachments", Attachment.Type).
|
edge.To("attachments", Attachment.Type).
|
||||||
Annotations(entsql.Annotation{
|
Annotations(entsql.Annotation{
|
||||||
OnDelete: entsql.Cascade,
|
OnDelete: entsql.Cascade,
|
||||||
|
|
|
@ -2,7 +2,6 @@ package schema
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"entgo.io/ent"
|
"entgo.io/ent"
|
||||||
"entgo.io/ent/dialect/entsql"
|
|
||||||
"entgo.io/ent/schema/edge"
|
"entgo.io/ent/schema/edge"
|
||||||
"entgo.io/ent/schema/field"
|
"entgo.io/ent/schema/field"
|
||||||
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||||
|
@ -36,9 +35,6 @@ func (Label) Edges() []ent.Edge {
|
||||||
Ref("labels").
|
Ref("labels").
|
||||||
Required().
|
Required().
|
||||||
Unique(),
|
Unique(),
|
||||||
edge.To("items", Item.Type).
|
edge.To("items", Item.Type),
|
||||||
Annotations(entsql.Annotation{
|
|
||||||
OnDelete: entsql.Cascade,
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ func (User) Edges() []ent.Edge {
|
||||||
Ref("users").
|
Ref("users").
|
||||||
Required().
|
Required().
|
||||||
Unique(),
|
Unique(),
|
||||||
edge.To("auth_tokens", AuthTokens.Type).Annotations(entsql.Annotation{
|
edge.To("auth_tokens", AuthTokens.Type).
|
||||||
|
Annotations(entsql.Annotation{
|
||||||
OnDelete: entsql.Cascade,
|
OnDelete: entsql.Cascade,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
h1:A58dgWs4yGTcWkHBZwIedtCwK1LIWHYxqB5uKQ40f6E=
|
h1:ihsTwGsfNb8b/1qt+jw0OPKM8I/Bcw1J3Ise0ZFu5co=
|
||||||
20220928001319_init.sql h1:KOJZuCHJ5dTHHwVDGgAWyUFahBXqGtmuv4d+rxwpuX0=
|
20220929052825_init.sql h1:ZlCqm1wzjDmofeAcSX3jE4h4VcdTNGpRg2eabztDy9Q=
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue