mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 04:56:30 +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
|
@ -70,8 +70,8 @@ func (e AttachmentEdges) DocumentOrErr() (*Document, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Attachment) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Attachment) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case attachment.FieldType:
|
||||
|
@ -93,7 +93,7 @@ func (*Attachment) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Attachment fields.
|
||||
func (a *Attachment) assignValues(columns []string, values []interface{}) error {
|
||||
func (a *Attachment) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Attachment {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Attachment {
|
||||
return predicate.Attachment(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Attachment {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Attachment {
|
||||
return predicate.Attachment(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ func CreatedAtNEQ(v time.Time) predicate.Attachment {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.Attachment {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ func CreatedAtIn(vs ...time.Time) predicate.Attachment {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.Attachment {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ func UpdatedAtNEQ(v time.Time) predicate.Attachment {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.Attachment {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.Attachment {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.Attachment {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ func TypeNEQ(v Type) predicate.Attachment {
|
|||
|
||||
// TypeIn applies the In predicate on the "type" field.
|
||||
func TypeIn(vs ...Type) predicate.Attachment {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ func TypeIn(vs ...Type) predicate.Attachment {
|
|||
|
||||
// TypeNotIn applies the NotIn predicate on the "type" field.
|
||||
func TypeNotIn(vs ...Type) predicate.Attachment {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -401,10 +401,10 @@ func (aq *AttachmentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, attachment.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Attachment).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Attachment{config: aq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -503,11 +503,14 @@ func (aq *AttachmentQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (aq *AttachmentQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := aq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := aq.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 (aq *AttachmentQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -608,7 +611,7 @@ func (agb *AttachmentGroupBy) Aggregate(fns ...AggregateFunc) *AttachmentGroupBy
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (agb *AttachmentGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (agb *AttachmentGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := agb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -617,7 +620,7 @@ func (agb *AttachmentGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return agb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (agb *AttachmentGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (agb *AttachmentGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range agb.fields {
|
||||
if !attachment.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -664,7 +667,7 @@ type AttachmentSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (as *AttachmentSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (as *AttachmentSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := as.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -672,7 +675,7 @@ func (as *AttachmentSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return as.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (as *AttachmentSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (as *AttachmentSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := as.sql.Query()
|
||||
if err := as.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -55,8 +55,8 @@ func (e AuthTokensEdges) UserOrErr() (*User, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*AuthTokens) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*AuthTokens) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case authtokens.FieldToken:
|
||||
|
@ -76,7 +76,7 @@ func (*AuthTokens) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the AuthTokens fields.
|
||||
func (at *AuthTokens) assignValues(columns []string, values []interface{}) error {
|
||||
func (at *AuthTokens) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.AuthTokens {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.AuthTokens {
|
||||
return predicate.AuthTokens(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.AuthTokens {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.AuthTokens {
|
||||
return predicate.AuthTokens(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func CreatedAtNEQ(v time.Time) predicate.AuthTokens {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ func CreatedAtIn(vs ...time.Time) predicate.AuthTokens {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func UpdatedAtNEQ(v time.Time) predicate.AuthTokens {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.AuthTokens {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ func TokenNEQ(v []byte) predicate.AuthTokens {
|
|||
|
||||
// TokenIn applies the In predicate on the "token" field.
|
||||
func TokenIn(vs ...[]byte) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ func TokenIn(vs ...[]byte) predicate.AuthTokens {
|
|||
|
||||
// TokenNotIn applies the NotIn predicate on the "token" field.
|
||||
func TokenNotIn(vs ...[]byte) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ func ExpiresAtNEQ(v time.Time) predicate.AuthTokens {
|
|||
|
||||
// ExpiresAtIn applies the In predicate on the "expires_at" field.
|
||||
func ExpiresAtIn(vs ...time.Time) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ func ExpiresAtIn(vs ...time.Time) predicate.AuthTokens {
|
|||
|
||||
// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
|
||||
func ExpiresAtNotIn(vs ...time.Time) predicate.AuthTokens {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -364,10 +364,10 @@ func (atq *AuthTokensQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, authtokens.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*AuthTokens).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &AuthTokens{config: atq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -431,11 +431,14 @@ func (atq *AuthTokensQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (atq *AuthTokensQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := atq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := atq.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 (atq *AuthTokensQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -536,7 +539,7 @@ func (atgb *AuthTokensGroupBy) Aggregate(fns ...AggregateFunc) *AuthTokensGroupB
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (atgb *AuthTokensGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (atgb *AuthTokensGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := atgb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -545,7 +548,7 @@ func (atgb *AuthTokensGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return atgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (atgb *AuthTokensGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (atgb *AuthTokensGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range atgb.fields {
|
||||
if !authtokens.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -592,7 +595,7 @@ type AuthTokensSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (ats *AuthTokensSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ats *AuthTokensSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := ats.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -600,7 +603,7 @@ func (ats *AuthTokensSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return ats.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ats *AuthTokensSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ats *AuthTokensSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := ats.sql.Query()
|
||||
if err := ats.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -930,6 +930,22 @@ func (c *ItemClient) QueryGroup(i *Item) *GroupQuery {
|
|||
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.
|
||||
func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
|
||||
query := &LocationQuery{config: c.config}
|
||||
|
@ -962,22 +978,6 @@ func (c *ItemClient) QueryFields(i *Item) *ItemFieldQuery {
|
|||
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.
|
||||
func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery {
|
||||
query := &AttachmentQuery{config: c.config}
|
||||
|
|
|
@ -17,7 +17,7 @@ type config struct {
|
|||
// debug enable a debug logging.
|
||||
debug bool
|
||||
// log used for logging on debug mode.
|
||||
log func(...interface{})
|
||||
log func(...any)
|
||||
// hooks to execute on mutations.
|
||||
hooks *hooks
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ func Debug() Option {
|
|||
}
|
||||
|
||||
// Log sets the logging function for debug mode.
|
||||
func Log(fn func(...interface{})) Option {
|
||||
func Log(fn func(...any)) Option {
|
||||
return func(c *config) {
|
||||
c.log = fn
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ func (e DocumentEdges) AttachmentsOrErr() ([]*Attachment, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Document) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Document) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case document.FieldTitle, document.FieldPath:
|
||||
|
@ -98,7 +98,7 @@ func (*Document) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Document fields.
|
||||
func (d *Document) assignValues(columns []string, values []interface{}) error {
|
||||
func (d *Document) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Document {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Document {
|
||||
return predicate.Document(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Document {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Document {
|
||||
return predicate.Document(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func CreatedAtNEQ(v time.Time) predicate.Document {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ func CreatedAtIn(vs ...time.Time) predicate.Document {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func UpdatedAtNEQ(v time.Time) predicate.Document {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.Document {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ func TitleNEQ(v string) predicate.Document {
|
|||
|
||||
// TitleIn applies the In predicate on the "title" field.
|
||||
func TitleIn(vs ...string) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ func TitleIn(vs ...string) predicate.Document {
|
|||
|
||||
// TitleNotIn applies the NotIn predicate on the "title" field.
|
||||
func TitleNotIn(vs ...string) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ func PathNEQ(v string) predicate.Document {
|
|||
|
||||
// PathIn applies the In predicate on the "path" field.
|
||||
func PathIn(vs ...string) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ func PathIn(vs ...string) predicate.Document {
|
|||
|
||||
// PathNotIn applies the NotIn predicate on the "path" field.
|
||||
func PathNotIn(vs ...string) predicate.Document {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -57,8 +57,8 @@ func (e DocumentTokenEdges) DocumentOrErr() (*Document, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*DocumentToken) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*DocumentToken) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case documenttoken.FieldToken:
|
||||
|
@ -80,7 +80,7 @@ func (*DocumentToken) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the DocumentToken fields.
|
||||
func (dt *DocumentToken) assignValues(columns []string, values []interface{}) error {
|
||||
func (dt *DocumentToken) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.DocumentToken {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.DocumentToken {
|
||||
return predicate.DocumentToken(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.DocumentToken {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.DocumentToken {
|
||||
return predicate.DocumentToken(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ func CreatedAtNEQ(v time.Time) predicate.DocumentToken {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ func CreatedAtIn(vs ...time.Time) predicate.DocumentToken {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ func UpdatedAtNEQ(v time.Time) predicate.DocumentToken {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.DocumentToken {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ func TokenNEQ(v []byte) predicate.DocumentToken {
|
|||
|
||||
// TokenIn applies the In predicate on the "token" field.
|
||||
func TokenIn(vs ...[]byte) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ func TokenIn(vs ...[]byte) predicate.DocumentToken {
|
|||
|
||||
// TokenNotIn applies the NotIn predicate on the "token" field.
|
||||
func TokenNotIn(vs ...[]byte) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ func UsesNEQ(v int) predicate.DocumentToken {
|
|||
|
||||
// UsesIn applies the In predicate on the "uses" field.
|
||||
func UsesIn(vs ...int) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ func UsesIn(vs ...int) predicate.DocumentToken {
|
|||
|
||||
// UsesNotIn applies the NotIn predicate on the "uses" field.
|
||||
func UsesNotIn(vs ...int) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ func ExpiresAtNEQ(v time.Time) predicate.DocumentToken {
|
|||
|
||||
// ExpiresAtIn applies the In predicate on the "expires_at" field.
|
||||
func ExpiresAtIn(vs ...time.Time) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ func ExpiresAtIn(vs ...time.Time) predicate.DocumentToken {
|
|||
|
||||
// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
|
||||
func ExpiresAtNotIn(vs ...time.Time) predicate.DocumentToken {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -364,10 +364,10 @@ func (dtq *DocumentTokenQuery) sqlAll(ctx context.Context, hooks ...queryHook) (
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, documenttoken.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*DocumentToken).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &DocumentToken{config: dtq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -431,11 +431,14 @@ func (dtq *DocumentTokenQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (dtq *DocumentTokenQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := dtq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := dtq.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 (dtq *DocumentTokenQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -536,7 +539,7 @@ func (dtgb *DocumentTokenGroupBy) Aggregate(fns ...AggregateFunc) *DocumentToken
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (dtgb *DocumentTokenGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (dtgb *DocumentTokenGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := dtgb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -545,7 +548,7 @@ func (dtgb *DocumentTokenGroupBy) Scan(ctx context.Context, v interface{}) error
|
|||
return dtgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (dtgb *DocumentTokenGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (dtgb *DocumentTokenGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range dtgb.fields {
|
||||
if !documenttoken.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -592,7 +595,7 @@ type DocumentTokenSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (dts *DocumentTokenSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (dts *DocumentTokenSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := dts.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -600,7 +603,7 @@ func (dts *DocumentTokenSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return dts.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (dts *DocumentTokenSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (dts *DocumentTokenSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := dts.sql.Query()
|
||||
if err := dts.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -281,11 +281,11 @@ func IsConstraintError(err error) bool {
|
|||
type selector struct {
|
||||
label string
|
||||
flds *[]string
|
||||
scan func(context.Context, interface{}) error
|
||||
scan func(context.Context, any) error
|
||||
}
|
||||
|
||||
// ScanX is like Scan, but panics if an error occurs.
|
||||
func (s *selector) ScanX(ctx context.Context, v interface{}) {
|
||||
func (s *selector) ScanX(ctx context.Context, v any) {
|
||||
if err := s.scan(ctx, v); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ type (
|
|||
// testing.T and testing.B and used by enttest.
|
||||
TestingT interface {
|
||||
FailNow()
|
||||
Error(...interface{})
|
||||
Error(...any)
|
||||
}
|
||||
|
||||
// Option configures client creation.
|
||||
|
|
|
@ -93,8 +93,8 @@ func (e GroupEdges) DocumentsOrErr() ([]*Document, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Group) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Group) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case group.FieldName, group.FieldCurrency:
|
||||
|
@ -112,7 +112,7 @@ func (*Group) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Group fields.
|
||||
func (gr *Group) assignValues(columns []string, values []interface{}) error {
|
||||
func (gr *Group) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Group {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Group {
|
||||
return predicate.Group(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Group {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Group {
|
||||
return predicate.Group(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ func CreatedAtNEQ(v time.Time) predicate.Group {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ func CreatedAtIn(vs ...time.Time) predicate.Group {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ func UpdatedAtNEQ(v time.Time) predicate.Group {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.Group {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ func NameNEQ(v string) predicate.Group {
|
|||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ func NameIn(vs ...string) predicate.Group {
|
|||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ func CurrencyNEQ(v Currency) predicate.Group {
|
|||
|
||||
// CurrencyIn applies the In predicate on the "currency" field.
|
||||
func CurrencyIn(vs ...Currency) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ func CurrencyIn(vs ...Currency) predicate.Group {
|
|||
|
||||
// CurrencyNotIn applies the NotIn predicate on the "currency" field.
|
||||
func CurrencyNotIn(vs ...Currency) predicate.Group {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -505,10 +505,10 @@ func (gq *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group,
|
|||
gq.withDocuments != nil,
|
||||
}
|
||||
)
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Group).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Group{config: gq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -727,11 +727,14 @@ func (gq *GroupQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (gq *GroupQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := gq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := gq.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 (gq *GroupQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -832,7 +835,7 @@ func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy {
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := ggb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -841,7 +844,7 @@ func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return ggb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ggb *GroupGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ggb *GroupGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range ggb.fields {
|
||||
if !group.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -888,7 +891,7 @@ type GroupSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (gs *GroupSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := gs.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -896,7 +899,7 @@ func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return gs.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (gs *GroupSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (gs *GroupSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := gs.sql.Query()
|
||||
if err := gs.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -72,12 +72,12 @@ type Item struct {
|
|||
type ItemEdges struct {
|
||||
// Group holds the value of the group edge.
|
||||
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 *Location `json:"location,omitempty"`
|
||||
// Fields holds the value of the fields edge.
|
||||
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 []*Attachment `json:"attachments,omitempty"`
|
||||
// loadedTypes holds the information for reporting if a
|
||||
|
@ -98,10 +98,19 @@ func (e ItemEdges) GroupOrErr() (*Group, error) {
|
|||
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
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e ItemEdges) LocationOrErr() (*Location, error) {
|
||||
if e.loadedTypes[1] {
|
||||
if e.loadedTypes[2] {
|
||||
if e.Location == nil {
|
||||
// Edge was loaded but was not found.
|
||||
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
|
||||
// was not loaded in eager-loading.
|
||||
func (e ItemEdges) FieldsOrErr() ([]*ItemField, error) {
|
||||
if e.loadedTypes[2] {
|
||||
if e.loadedTypes[3] {
|
||||
return e.Fields, nil
|
||||
}
|
||||
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
|
||||
// was not loaded in eager-loading.
|
||||
func (e ItemEdges) AttachmentsOrErr() ([]*Attachment, error) {
|
||||
|
@ -139,8 +139,8 @@ func (e ItemEdges) AttachmentsOrErr() ([]*Attachment, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Item) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Item) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case item.FieldInsured, item.FieldLifetimeWarranty:
|
||||
|
@ -168,7 +168,7 @@ func (*Item) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Item fields.
|
||||
func (i *Item) assignValues(columns []string, values []interface{}) error {
|
||||
func (i *Item) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
@ -330,6 +330,11 @@ func (i *Item) QueryGroup() *GroupQuery {
|
|||
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.
|
||||
func (i *Item) QueryLocation() *LocationQuery {
|
||||
return (&ItemClient{config: i.config}).QueryLocation(i)
|
||||
|
@ -340,11 +345,6 @@ func (i *Item) QueryFields() *ItemFieldQuery {
|
|||
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.
|
||||
func (i *Item) QueryAttachments() *AttachmentQuery {
|
||||
return (&ItemClient{config: i.config}).QueryAttachments(i)
|
||||
|
|
|
@ -57,12 +57,12 @@ const (
|
|||
FieldSoldNotes = "sold_notes"
|
||||
// EdgeGroup holds the string denoting the group edge name in mutations.
|
||||
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 = "location"
|
||||
// EdgeFields holds the string denoting the fields edge name in mutations.
|
||||
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 = "attachments"
|
||||
// Table holds the table name of the item in the database.
|
||||
|
@ -74,6 +74,11 @@ const (
|
|||
GroupInverseTable = "groups"
|
||||
// GroupColumn is the table column denoting the group relation/edge.
|
||||
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 = "items"
|
||||
// LocationInverseTable is the table name for the Location entity.
|
||||
|
@ -88,11 +93,6 @@ const (
|
|||
FieldsInverseTable = "item_fields"
|
||||
// FieldsColumn is the table column denoting the fields relation/edge.
|
||||
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 = "attachments"
|
||||
// AttachmentsInverseTable is the table name for the Attachment entity.
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Item {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Item {
|
||||
return predicate.Item(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Item {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Item {
|
||||
return predicate.Item(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ func CreatedAtNEQ(v time.Time) predicate.Item {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ func CreatedAtIn(vs ...time.Time) predicate.Item {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ func UpdatedAtNEQ(v time.Time) predicate.Item {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.Item {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ func NameNEQ(v string) predicate.Item {
|
|||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ func NameIn(vs ...string) predicate.Item {
|
|||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ func DescriptionNEQ(v string) predicate.Item {
|
|||
|
||||
// DescriptionIn applies the In predicate on the "description" field.
|
||||
func DescriptionIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ func DescriptionIn(vs ...string) predicate.Item {
|
|||
|
||||
// DescriptionNotIn applies the NotIn predicate on the "description" field.
|
||||
func DescriptionNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ func ImportRefNEQ(v string) predicate.Item {
|
|||
|
||||
// ImportRefIn applies the In predicate on the "import_ref" field.
|
||||
func ImportRefIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ func ImportRefIn(vs ...string) predicate.Item {
|
|||
|
||||
// ImportRefNotIn applies the NotIn predicate on the "import_ref" field.
|
||||
func ImportRefNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ func NotesNEQ(v string) predicate.Item {
|
|||
|
||||
// NotesIn applies the In predicate on the "notes" field.
|
||||
func NotesIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ func NotesIn(vs ...string) predicate.Item {
|
|||
|
||||
// NotesNotIn applies the NotIn predicate on the "notes" field.
|
||||
func NotesNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ func QuantityNEQ(v int) predicate.Item {
|
|||
|
||||
// QuantityIn applies the In predicate on the "quantity" field.
|
||||
func QuantityIn(vs ...int) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ func QuantityIn(vs ...int) predicate.Item {
|
|||
|
||||
// QuantityNotIn applies the NotIn predicate on the "quantity" field.
|
||||
func QuantityNotIn(vs ...int) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -889,7 +889,7 @@ func SerialNumberNEQ(v string) predicate.Item {
|
|||
|
||||
// SerialNumberIn applies the In predicate on the "serial_number" field.
|
||||
func SerialNumberIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -900,7 +900,7 @@ func SerialNumberIn(vs ...string) predicate.Item {
|
|||
|
||||
// SerialNumberNotIn applies the NotIn predicate on the "serial_number" field.
|
||||
func SerialNumberNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1002,7 +1002,7 @@ func ModelNumberNEQ(v string) predicate.Item {
|
|||
|
||||
// ModelNumberIn applies the In predicate on the "model_number" field.
|
||||
func ModelNumberIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1013,7 +1013,7 @@ func ModelNumberIn(vs ...string) predicate.Item {
|
|||
|
||||
// ModelNumberNotIn applies the NotIn predicate on the "model_number" field.
|
||||
func ModelNumberNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1115,7 +1115,7 @@ func ManufacturerNEQ(v string) predicate.Item {
|
|||
|
||||
// ManufacturerIn applies the In predicate on the "manufacturer" field.
|
||||
func ManufacturerIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1126,7 +1126,7 @@ func ManufacturerIn(vs ...string) predicate.Item {
|
|||
|
||||
// ManufacturerNotIn applies the NotIn predicate on the "manufacturer" field.
|
||||
func ManufacturerNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@ func WarrantyExpiresNEQ(v time.Time) predicate.Item {
|
|||
|
||||
// WarrantyExpiresIn applies the In predicate on the "warranty_expires" field.
|
||||
func WarrantyExpiresIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1253,7 +1253,7 @@ func WarrantyExpiresIn(vs ...time.Time) predicate.Item {
|
|||
|
||||
// WarrantyExpiresNotIn applies the NotIn predicate on the "warranty_expires" field.
|
||||
func WarrantyExpiresNotIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ func WarrantyDetailsNEQ(v string) predicate.Item {
|
|||
|
||||
// WarrantyDetailsIn applies the In predicate on the "warranty_details" field.
|
||||
func WarrantyDetailsIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1331,7 +1331,7 @@ func WarrantyDetailsIn(vs ...string) predicate.Item {
|
|||
|
||||
// WarrantyDetailsNotIn applies the NotIn predicate on the "warranty_details" field.
|
||||
func WarrantyDetailsNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1433,7 +1433,7 @@ func PurchaseTimeNEQ(v time.Time) predicate.Item {
|
|||
|
||||
// PurchaseTimeIn applies the In predicate on the "purchase_time" field.
|
||||
func PurchaseTimeIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1444,7 +1444,7 @@ func PurchaseTimeIn(vs ...time.Time) predicate.Item {
|
|||
|
||||
// PurchaseTimeNotIn applies the NotIn predicate on the "purchase_time" field.
|
||||
func PurchaseTimeNotIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1511,7 +1511,7 @@ func PurchaseFromNEQ(v string) predicate.Item {
|
|||
|
||||
// PurchaseFromIn applies the In predicate on the "purchase_from" field.
|
||||
func PurchaseFromIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1522,7 +1522,7 @@ func PurchaseFromIn(vs ...string) predicate.Item {
|
|||
|
||||
// PurchaseFromNotIn applies the NotIn predicate on the "purchase_from" field.
|
||||
func PurchaseFromNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1624,7 +1624,7 @@ func PurchasePriceNEQ(v float64) predicate.Item {
|
|||
|
||||
// PurchasePriceIn applies the In predicate on the "purchase_price" field.
|
||||
func PurchasePriceIn(vs ...float64) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1635,7 +1635,7 @@ func PurchasePriceIn(vs ...float64) predicate.Item {
|
|||
|
||||
// PurchasePriceNotIn applies the NotIn predicate on the "purchase_price" field.
|
||||
func PurchasePriceNotIn(vs ...float64) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1688,7 +1688,7 @@ func SoldTimeNEQ(v time.Time) predicate.Item {
|
|||
|
||||
// SoldTimeIn applies the In predicate on the "sold_time" field.
|
||||
func SoldTimeIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1699,7 +1699,7 @@ func SoldTimeIn(vs ...time.Time) predicate.Item {
|
|||
|
||||
// SoldTimeNotIn applies the NotIn predicate on the "sold_time" field.
|
||||
func SoldTimeNotIn(vs ...time.Time) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1766,7 +1766,7 @@ func SoldToNEQ(v string) predicate.Item {
|
|||
|
||||
// SoldToIn applies the In predicate on the "sold_to" field.
|
||||
func SoldToIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1777,7 +1777,7 @@ func SoldToIn(vs ...string) predicate.Item {
|
|||
|
||||
// SoldToNotIn applies the NotIn predicate on the "sold_to" field.
|
||||
func SoldToNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1879,7 +1879,7 @@ func SoldPriceNEQ(v float64) predicate.Item {
|
|||
|
||||
// SoldPriceIn applies the In predicate on the "sold_price" field.
|
||||
func SoldPriceIn(vs ...float64) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1890,7 +1890,7 @@ func SoldPriceIn(vs ...float64) predicate.Item {
|
|||
|
||||
// SoldPriceNotIn applies the NotIn predicate on the "sold_price" field.
|
||||
func SoldPriceNotIn(vs ...float64) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1943,7 +1943,7 @@ func SoldNotesNEQ(v string) predicate.Item {
|
|||
|
||||
// SoldNotesIn applies the In predicate on the "sold_notes" field.
|
||||
func SoldNotesIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -1954,7 +1954,7 @@ func SoldNotesIn(vs ...string) predicate.Item {
|
|||
|
||||
// SoldNotesNotIn applies the NotIn predicate on the "sold_notes" field.
|
||||
func SoldNotesNotIn(vs ...string) predicate.Item {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -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.
|
||||
func HasLocation() predicate.Item {
|
||||
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.
|
||||
func HasAttachments() predicate.Item {
|
||||
return predicate.Item(func(s *sql.Selector) {
|
||||
|
|
|
@ -337,6 +337,21 @@ func (ic *ItemCreate) SetGroup(g *Group) *ItemCreate {
|
|||
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.
|
||||
func (ic *ItemCreate) SetLocationID(id uuid.UUID) *ItemCreate {
|
||||
ic.mutation.SetLocationID(id)
|
||||
|
@ -371,21 +386,6 @@ func (ic *ItemCreate) AddFields(i ...*ItemField) *ItemCreate {
|
|||
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.
|
||||
func (ic *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate {
|
||||
ic.mutation.AddAttachmentIDs(ids...)
|
||||
|
@ -810,6 +810,25 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
|
|||
_node.group_items = &nodes[0]
|
||||
_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 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.M2O,
|
||||
|
@ -849,25 +868,6 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
|
|||
}
|
||||
_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 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
|
|
|
@ -31,9 +31,9 @@ type ItemQuery struct {
|
|||
fields []string
|
||||
predicates []predicate.Item
|
||||
withGroup *GroupQuery
|
||||
withLabel *LabelQuery
|
||||
withLocation *LocationQuery
|
||||
withFields *ItemFieldQuery
|
||||
withLabel *LabelQuery
|
||||
withAttachments *AttachmentQuery
|
||||
withFKs bool
|
||||
// intermediate query (i.e. traversal path).
|
||||
|
@ -94,6 +94,28 @@ func (iq *ItemQuery) QueryGroup() *GroupQuery {
|
|||
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.
|
||||
func (iq *ItemQuery) QueryLocation() *LocationQuery {
|
||||
query := &LocationQuery{config: iq.config}
|
||||
|
@ -138,28 +160,6 @@ func (iq *ItemQuery) QueryFields() *ItemFieldQuery {
|
|||
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.
|
||||
func (iq *ItemQuery) QueryAttachments() *AttachmentQuery {
|
||||
query := &AttachmentQuery{config: iq.config}
|
||||
|
@ -364,9 +364,9 @@ func (iq *ItemQuery) Clone() *ItemQuery {
|
|||
order: append([]OrderFunc{}, iq.order...),
|
||||
predicates: append([]predicate.Item{}, iq.predicates...),
|
||||
withGroup: iq.withGroup.Clone(),
|
||||
withLabel: iq.withLabel.Clone(),
|
||||
withLocation: iq.withLocation.Clone(),
|
||||
withFields: iq.withFields.Clone(),
|
||||
withLabel: iq.withLabel.Clone(),
|
||||
withAttachments: iq.withAttachments.Clone(),
|
||||
// clone intermediate query.
|
||||
sql: iq.sql.Clone(),
|
||||
|
@ -386,6 +386,17 @@ func (iq *ItemQuery) WithGroup(opts ...func(*GroupQuery)) *ItemQuery {
|
|||
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
|
||||
// the "location" edge. The optional arguments are used to configure the query builder of the edge.
|
||||
func (iq *ItemQuery) WithLocation(opts ...func(*LocationQuery)) *ItemQuery {
|
||||
|
@ -408,17 +419,6 @@ func (iq *ItemQuery) WithFields(opts ...func(*ItemFieldQuery)) *ItemQuery {
|
|||
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
|
||||
// the "attachments" edge. The optional arguments are used to configure the query builder of the edge.
|
||||
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()
|
||||
loadedTypes = [5]bool{
|
||||
iq.withGroup != nil,
|
||||
iq.withLabel != nil,
|
||||
iq.withLocation != nil,
|
||||
iq.withFields != nil,
|
||||
iq.withLabel != nil,
|
||||
iq.withAttachments != nil,
|
||||
}
|
||||
)
|
||||
|
@ -513,10 +513,10 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, item.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Item).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Item{config: iq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -537,6 +537,13 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
|
|||
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 err := iq.loadLocation(ctx, query, nodes, 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
|
||||
}
|
||||
}
|
||||
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 err := iq.loadAttachments(ctx, query, nodes,
|
||||
func(n *Item) { n.Edges.Attachments = []*Attachment{} },
|
||||
|
@ -596,6 +596,64 @@ func (iq *ItemQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*
|
|||
}
|
||||
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 {
|
||||
ids := make([]uuid.UUID, 0, len(nodes))
|
||||
nodeids := make(map[uuid.UUID][]*Item)
|
||||
|
@ -656,64 +714,6 @@ func (iq *ItemQuery) loadFields(ctx context.Context, query *ItemFieldQuery, node
|
|||
}
|
||||
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) ([]interface{}, error) {
|
||||
values, err := values(columns[1:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return append([]interface{}{new(uuid.UUID)}, values...), nil
|
||||
}
|
||||
spec.Assign = func(columns []string, values []interface{}) 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 {
|
||||
fks := make([]driver.Value, 0, len(nodes))
|
||||
nodeids := make(map[uuid.UUID]*Item)
|
||||
|
@ -756,11 +756,14 @@ func (iq *ItemQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (iq *ItemQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := iq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := iq.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 (iq *ItemQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -861,7 +864,7 @@ func (igb *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy {
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (igb *ItemGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (igb *ItemGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := igb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -870,7 +873,7 @@ func (igb *ItemGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return igb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (igb *ItemGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (igb *ItemGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range igb.fields {
|
||||
if !item.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -917,7 +920,7 @@ type ItemSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (is *ItemSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (is *ItemSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := is.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -925,7 +928,7 @@ func (is *ItemSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return is.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (is *ItemSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (is *ItemSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := is.sql.Query()
|
||||
if err := is.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -388,6 +388,21 @@ func (iu *ItemUpdate) SetGroup(g *Group) *ItemUpdate {
|
|||
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.
|
||||
func (iu *ItemUpdate) SetLocationID(id uuid.UUID) *ItemUpdate {
|
||||
iu.mutation.SetLocationID(id)
|
||||
|
@ -422,21 +437,6 @@ func (iu *ItemUpdate) AddFields(i ...*ItemField) *ItemUpdate {
|
|||
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.
|
||||
func (iu *ItemUpdate) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
|
||||
iu.mutation.AddAttachmentIDs(ids...)
|
||||
|
@ -463,6 +463,27 @@ func (iu *ItemUpdate) ClearGroup() *ItemUpdate {
|
|||
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.
|
||||
func (iu *ItemUpdate) ClearLocation() *ItemUpdate {
|
||||
iu.mutation.ClearLocation()
|
||||
|
@ -490,27 +511,6 @@ func (iu *ItemUpdate) RemoveFields(i ...*ItemField) *ItemUpdate {
|
|||
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.
|
||||
func (iu *ItemUpdate) ClearAttachments() *ItemUpdate {
|
||||
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)
|
||||
}
|
||||
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() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
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)
|
||||
}
|
||||
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() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
|
@ -1504,6 +1504,21 @@ func (iuo *ItemUpdateOne) SetGroup(g *Group) *ItemUpdateOne {
|
|||
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.
|
||||
func (iuo *ItemUpdateOne) SetLocationID(id uuid.UUID) *ItemUpdateOne {
|
||||
iuo.mutation.SetLocationID(id)
|
||||
|
@ -1538,21 +1553,6 @@ func (iuo *ItemUpdateOne) AddFields(i ...*ItemField) *ItemUpdateOne {
|
|||
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.
|
||||
func (iuo *ItemUpdateOne) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
|
||||
iuo.mutation.AddAttachmentIDs(ids...)
|
||||
|
@ -1579,6 +1579,27 @@ func (iuo *ItemUpdateOne) ClearGroup() *ItemUpdateOne {
|
|||
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.
|
||||
func (iuo *ItemUpdateOne) ClearLocation() *ItemUpdateOne {
|
||||
iuo.mutation.ClearLocation()
|
||||
|
@ -1606,27 +1627,6 @@ func (iuo *ItemUpdateOne) RemoveFields(i ...*ItemField) *ItemUpdateOne {
|
|||
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.
|
||||
func (iuo *ItemUpdateOne) ClearAttachments() *ItemUpdateOne {
|
||||
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)
|
||||
}
|
||||
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() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
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)
|
||||
}
|
||||
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() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
|
|
|
@ -65,8 +65,8 @@ func (e ItemFieldEdges) ItemOrErr() (*Item, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*ItemField) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*ItemField) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case itemfield.FieldBooleanValue:
|
||||
|
@ -90,7 +90,7 @@ func (*ItemField) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the ItemField fields.
|
||||
func (_if *ItemField) assignValues(columns []string, values []interface{}) error {
|
||||
func (_if *ItemField) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.ItemField {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.ItemField {
|
||||
return predicate.ItemField(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.ItemField {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.ItemField {
|
||||
return predicate.ItemField(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ func CreatedAtNEQ(v time.Time) predicate.ItemField {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ func CreatedAtIn(vs ...time.Time) predicate.ItemField {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ func UpdatedAtNEQ(v time.Time) predicate.ItemField {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.ItemField {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ func NameNEQ(v string) predicate.ItemField {
|
|||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ func NameIn(vs ...string) predicate.ItemField {
|
|||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ func DescriptionNEQ(v string) predicate.ItemField {
|
|||
|
||||
// DescriptionIn applies the In predicate on the "description" field.
|
||||
func DescriptionIn(vs ...string) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ func DescriptionIn(vs ...string) predicate.ItemField {
|
|||
|
||||
// DescriptionNotIn applies the NotIn predicate on the "description" field.
|
||||
func DescriptionNotIn(vs ...string) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ func TypeNEQ(v Type) predicate.ItemField {
|
|||
|
||||
// TypeIn applies the In predicate on the "type" field.
|
||||
func TypeIn(vs ...Type) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ func TypeIn(vs ...Type) predicate.ItemField {
|
|||
|
||||
// TypeNotIn applies the NotIn predicate on the "type" field.
|
||||
func TypeNotIn(vs ...Type) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ func TextValueNEQ(v string) predicate.ItemField {
|
|||
|
||||
// TextValueIn applies the In predicate on the "text_value" field.
|
||||
func TextValueIn(vs ...string) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ func TextValueIn(vs ...string) predicate.ItemField {
|
|||
|
||||
// TextValueNotIn applies the NotIn predicate on the "text_value" field.
|
||||
func TextValueNotIn(vs ...string) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ func NumberValueNEQ(v int) predicate.ItemField {
|
|||
|
||||
// NumberValueIn applies the In predicate on the "number_value" field.
|
||||
func NumberValueIn(vs ...int) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ func NumberValueIn(vs ...int) predicate.ItemField {
|
|||
|
||||
// NumberValueNotIn applies the NotIn predicate on the "number_value" field.
|
||||
func NumberValueNotIn(vs ...int) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ func TimeValueNEQ(v time.Time) predicate.ItemField {
|
|||
|
||||
// TimeValueIn applies the In predicate on the "time_value" field.
|
||||
func TimeValueIn(vs ...time.Time) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ func TimeValueIn(vs ...time.Time) predicate.ItemField {
|
|||
|
||||
// TimeValueNotIn applies the NotIn predicate on the "time_value" field.
|
||||
func TimeValueNotIn(vs ...time.Time) predicate.ItemField {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -364,10 +364,10 @@ func (ifq *ItemFieldQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*I
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, itemfield.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*ItemField).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &ItemField{config: ifq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -431,11 +431,14 @@ func (ifq *ItemFieldQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (ifq *ItemFieldQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := ifq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := ifq.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 (ifq *ItemFieldQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -536,7 +539,7 @@ func (ifgb *ItemFieldGroupBy) Aggregate(fns ...AggregateFunc) *ItemFieldGroupBy
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (ifgb *ItemFieldGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ifgb *ItemFieldGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := ifgb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -545,7 +548,7 @@ func (ifgb *ItemFieldGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return ifgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ifgb *ItemFieldGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ifgb *ItemFieldGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range ifgb.fields {
|
||||
if !itemfield.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -592,7 +595,7 @@ type ItemFieldSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (ifs *ItemFieldSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ifs *ItemFieldSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := ifs.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -600,7 +603,7 @@ func (ifs *ItemFieldSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return ifs.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ifs *ItemFieldSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ifs *ItemFieldSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := ifs.sql.Query()
|
||||
if err := ifs.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -68,8 +68,8 @@ func (e LabelEdges) ItemsOrErr() ([]*Item, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Label) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Label) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case label.FieldName, label.FieldDescription, label.FieldColor:
|
||||
|
@ -89,7 +89,7 @@ func (*Label) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Label fields.
|
||||
func (l *Label) assignValues(columns []string, values []interface{}) error {
|
||||
func (l *Label) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Label {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Label {
|
||||
return predicate.Label(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Label {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Label {
|
||||
return predicate.Label(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ func CreatedAtNEQ(v time.Time) predicate.Label {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ func CreatedAtIn(vs ...time.Time) predicate.Label {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ func UpdatedAtNEQ(v time.Time) predicate.Label {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.Label {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ func NameNEQ(v string) predicate.Label {
|
|||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ func NameIn(vs ...string) predicate.Label {
|
|||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ func DescriptionNEQ(v string) predicate.Label {
|
|||
|
||||
// DescriptionIn applies the In predicate on the "description" field.
|
||||
func DescriptionIn(vs ...string) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ func DescriptionIn(vs ...string) predicate.Label {
|
|||
|
||||
// DescriptionNotIn applies the NotIn predicate on the "description" field.
|
||||
func DescriptionNotIn(vs ...string) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ func ColorNEQ(v string) predicate.Label {
|
|||
|
||||
// ColorIn applies the In predicate on the "color" field.
|
||||
func ColorIn(vs ...string) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ func ColorIn(vs ...string) predicate.Label {
|
|||
|
||||
// ColorNotIn applies the NotIn predicate on the "color" field.
|
||||
func ColorNotIn(vs ...string) predicate.Label {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -402,10 +402,10 @@ func (lq *LabelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Label,
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, label.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Label).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Label{config: lq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -491,14 +491,14 @@ func (lq *LabelQuery) loadItems(ctx context.Context, query *ItemQuery, nodes []*
|
|||
neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
|
||||
assign := spec.Assign
|
||||
values := spec.ScanValues
|
||||
spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
values, err := values(columns[1:])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return append([]interface{}{new(uuid.UUID)}, values...), nil
|
||||
return append([]any{new(uuid.UUID)}, values...), nil
|
||||
}
|
||||
spec.Assign = func(columns []string, values []interface{}) error {
|
||||
spec.Assign = func(columns []string, values []any) error {
|
||||
outValue := *values[0].(*uuid.UUID)
|
||||
inValue := *values[1].(*uuid.UUID)
|
||||
if nids[inValue] == nil {
|
||||
|
@ -534,11 +534,14 @@ func (lq *LabelQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (lq *LabelQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := lq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := lq.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 (lq *LabelQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -639,7 +642,7 @@ func (lgb *LabelGroupBy) Aggregate(fns ...AggregateFunc) *LabelGroupBy {
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (lgb *LabelGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (lgb *LabelGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := lgb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -648,7 +651,7 @@ func (lgb *LabelGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return lgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (lgb *LabelGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (lgb *LabelGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range lgb.fields {
|
||||
if !label.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -695,7 +698,7 @@ type LabelSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (ls *LabelSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ls *LabelSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := ls.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -703,7 +706,7 @@ func (ls *LabelSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return ls.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ls *LabelSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ls *LabelSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := ls.sql.Query()
|
||||
if err := ls.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -66,8 +66,8 @@ func (e LocationEdges) ItemsOrErr() ([]*Item, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*Location) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*Location) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case location.FieldName, location.FieldDescription:
|
||||
|
@ -87,7 +87,7 @@ func (*Location) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the Location fields.
|
||||
func (l *Location) assignValues(columns []string, values []interface{}) error {
|
||||
func (l *Location) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Location {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.Location {
|
||||
return predicate.Location(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Location {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.Location {
|
||||
return predicate.Location(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ func CreatedAtNEQ(v time.Time) predicate.Location {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ func CreatedAtIn(vs ...time.Time) predicate.Location {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func UpdatedAtNEQ(v time.Time) predicate.Location {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.Location {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ func NameNEQ(v string) predicate.Location {
|
|||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ func NameIn(vs ...string) predicate.Location {
|
|||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ func DescriptionNEQ(v string) predicate.Location {
|
|||
|
||||
// DescriptionIn applies the In predicate on the "description" field.
|
||||
func DescriptionIn(vs ...string) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ func DescriptionIn(vs ...string) predicate.Location {
|
|||
|
||||
// DescriptionNotIn applies the NotIn predicate on the "description" field.
|
||||
func DescriptionNotIn(vs ...string) predicate.Location {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -402,10 +402,10 @@ func (lq *LocationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Loc
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, location.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*Location).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &Location{config: lq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -507,11 +507,14 @@ func (lq *LocationQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (lq *LocationQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := lq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := lq.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 (lq *LocationQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -612,7 +615,7 @@ func (lgb *LocationGroupBy) Aggregate(fns ...AggregateFunc) *LocationGroupBy {
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (lgb *LocationGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (lgb *LocationGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := lgb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -621,7 +624,7 @@ func (lgb *LocationGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return lgb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (lgb *LocationGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (lgb *LocationGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range lgb.fields {
|
||||
if !location.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -668,7 +671,7 @@ type LocationSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (ls *LocationSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ls *LocationSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := ls.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -676,7 +679,7 @@ func (ls *LocationSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return ls.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ls *LocationSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ls *LocationSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := ls.sql.Query()
|
||||
if err := ls.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -542,8 +542,6 @@ func (m *AttachmentMutation) RemovedEdges() []string {
|
|||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *AttachmentMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1101,8 +1099,6 @@ func (m *AuthTokensMutation) RemovedEdges() []string {
|
|||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *AuthTokensMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -2453,8 +2449,6 @@ func (m *DocumentTokenMutation) RemovedEdges() []string {
|
|||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *DocumentTokenMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -3436,14 +3430,14 @@ type ItemMutation struct {
|
|||
clearedFields map[string]struct{}
|
||||
group *uuid.UUID
|
||||
clearedgroup bool
|
||||
label map[uuid.UUID]struct{}
|
||||
removedlabel map[uuid.UUID]struct{}
|
||||
clearedlabel bool
|
||||
location *uuid.UUID
|
||||
clearedlocation bool
|
||||
fields map[uuid.UUID]struct{}
|
||||
removedfields map[uuid.UUID]struct{}
|
||||
clearedfields bool
|
||||
label map[uuid.UUID]struct{}
|
||||
removedlabel map[uuid.UUID]struct{}
|
||||
clearedlabel bool
|
||||
attachments map[uuid.UUID]struct{}
|
||||
removedattachments map[uuid.UUID]struct{}
|
||||
clearedattachments bool
|
||||
|
@ -4580,6 +4574,60 @@ func (m *ItemMutation) ResetGroup() {
|
|||
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.
|
||||
func (m *ItemMutation) SetLocationID(id uuid.UUID) {
|
||||
m.location = &id
|
||||
|
@ -4673,60 +4721,6 @@ func (m *ItemMutation) ResetFields() {
|
|||
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.
|
||||
func (m *ItemMutation) AddAttachmentIDs(ids ...uuid.UUID) {
|
||||
if m.attachments == nil {
|
||||
|
@ -5363,15 +5357,15 @@ func (m *ItemMutation) AddedEdges() []string {
|
|||
if m.group != nil {
|
||||
edges = append(edges, item.EdgeGroup)
|
||||
}
|
||||
if m.label != nil {
|
||||
edges = append(edges, item.EdgeLabel)
|
||||
}
|
||||
if m.location != nil {
|
||||
edges = append(edges, item.EdgeLocation)
|
||||
}
|
||||
if m.fields != nil {
|
||||
edges = append(edges, item.EdgeFields)
|
||||
}
|
||||
if m.label != nil {
|
||||
edges = append(edges, item.EdgeLabel)
|
||||
}
|
||||
if m.attachments != nil {
|
||||
edges = append(edges, item.EdgeAttachments)
|
||||
}
|
||||
|
@ -5386,6 +5380,12 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
|
|||
if id := m.group; id != nil {
|
||||
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:
|
||||
if id := m.location; id != nil {
|
||||
return []ent.Value{*id}
|
||||
|
@ -5396,12 +5396,6 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
|
|||
ids = append(ids, id)
|
||||
}
|
||||
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:
|
||||
ids := make([]ent.Value, 0, len(m.attachments))
|
||||
for id := range m.attachments {
|
||||
|
@ -5415,12 +5409,12 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
|
|||
// RemovedEdges returns all edge names that were removed in this mutation.
|
||||
func (m *ItemMutation) RemovedEdges() []string {
|
||||
edges := make([]string, 0, 5)
|
||||
if m.removedfields != nil {
|
||||
edges = append(edges, item.EdgeFields)
|
||||
}
|
||||
if m.removedlabel != nil {
|
||||
edges = append(edges, item.EdgeLabel)
|
||||
}
|
||||
if m.removedfields != nil {
|
||||
edges = append(edges, item.EdgeFields)
|
||||
}
|
||||
if m.removedattachments != nil {
|
||||
edges = append(edges, item.EdgeAttachments)
|
||||
}
|
||||
|
@ -5431,18 +5425,18 @@ func (m *ItemMutation) RemovedEdges() []string {
|
|||
// the given name in this mutation.
|
||||
func (m *ItemMutation) RemovedIDs(name string) []ent.Value {
|
||||
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:
|
||||
ids := make([]ent.Value, 0, len(m.removedlabel))
|
||||
for id := range m.removedlabel {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
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:
|
||||
ids := make([]ent.Value, 0, len(m.removedattachments))
|
||||
for id := range m.removedattachments {
|
||||
|
@ -5459,15 +5453,15 @@ func (m *ItemMutation) ClearedEdges() []string {
|
|||
if m.clearedgroup {
|
||||
edges = append(edges, item.EdgeGroup)
|
||||
}
|
||||
if m.clearedlabel {
|
||||
edges = append(edges, item.EdgeLabel)
|
||||
}
|
||||
if m.clearedlocation {
|
||||
edges = append(edges, item.EdgeLocation)
|
||||
}
|
||||
if m.clearedfields {
|
||||
edges = append(edges, item.EdgeFields)
|
||||
}
|
||||
if m.clearedlabel {
|
||||
edges = append(edges, item.EdgeLabel)
|
||||
}
|
||||
if m.clearedattachments {
|
||||
edges = append(edges, item.EdgeAttachments)
|
||||
}
|
||||
|
@ -5480,12 +5474,12 @@ func (m *ItemMutation) EdgeCleared(name string) bool {
|
|||
switch name {
|
||||
case item.EdgeGroup:
|
||||
return m.clearedgroup
|
||||
case item.EdgeLabel:
|
||||
return m.clearedlabel
|
||||
case item.EdgeLocation:
|
||||
return m.clearedlocation
|
||||
case item.EdgeFields:
|
||||
return m.clearedfields
|
||||
case item.EdgeLabel:
|
||||
return m.clearedlabel
|
||||
case item.EdgeAttachments:
|
||||
return m.clearedattachments
|
||||
}
|
||||
|
@ -5513,15 +5507,15 @@ func (m *ItemMutation) ResetEdge(name string) error {
|
|||
case item.EdgeGroup:
|
||||
m.ResetGroup()
|
||||
return nil
|
||||
case item.EdgeLabel:
|
||||
m.ResetLabel()
|
||||
return nil
|
||||
case item.EdgeLocation:
|
||||
m.ResetLocation()
|
||||
return nil
|
||||
case item.EdgeFields:
|
||||
m.ResetFields()
|
||||
return nil
|
||||
case item.EdgeLabel:
|
||||
m.ResetLabel()
|
||||
return nil
|
||||
case item.EdgeAttachments:
|
||||
m.ResetAttachments()
|
||||
return nil
|
||||
|
@ -6398,8 +6392,6 @@ func (m *ItemFieldMutation) RemovedEdges() []string {
|
|||
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
|
||||
// the given name in this mutation.
|
||||
func (m *ItemFieldMutation) RemovedIDs(name string) []ent.Value {
|
||||
switch name {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ package runtime
|
|||
// The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/ent/runtime.go
|
||||
|
||||
const (
|
||||
Version = "v0.11.2" // Version of ent codegen.
|
||||
Sum = "h1:UM2/BUhF2FfsxPHRxLjQbhqJNaDdVlOwNIAMLs2jyto=" // Sum of ent codegen.
|
||||
Version = "v0.11.3" // Version of ent codegen.
|
||||
Sum = "h1:F5FBGAWiDCGder7YT+lqMnyzXl6d0xU3xMBM/SO3CMc=" // Sum of ent codegen.
|
||||
)
|
||||
|
|
|
@ -98,6 +98,8 @@ func (Item) Edges() []ent.Edge {
|
|||
Ref("items").
|
||||
Required().
|
||||
Unique(),
|
||||
edge.From("label", Label.Type).
|
||||
Ref("items"),
|
||||
edge.From("location", Location.Type).
|
||||
Ref("items").
|
||||
Unique(),
|
||||
|
@ -105,11 +107,6 @@ func (Item) Edges() []ent.Edge {
|
|||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
edge.From("label", Label.Type).
|
||||
Ref("items").
|
||||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
edge.To("attachments", Attachment.Type).
|
||||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
|
|
|
@ -2,7 +2,6 @@ package schema
|
|||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
"github.com/hay-kot/homebox/backend/ent/schema/mixins"
|
||||
|
@ -36,9 +35,6 @@ func (Label) Edges() []ent.Edge {
|
|||
Ref("labels").
|
||||
Required().
|
||||
Unique(),
|
||||
edge.To("items", Item.Type).
|
||||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
edge.To("items", Item.Type),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,8 +45,9 @@ func (User) Edges() []ent.Edge {
|
|||
Ref("users").
|
||||
Required().
|
||||
Unique(),
|
||||
edge.To("auth_tokens", AuthTokens.Type).Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
edge.To("auth_tokens", AuthTokens.Type).
|
||||
Annotations(entsql.Annotation{
|
||||
OnDelete: entsql.Cascade,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,12 +225,12 @@ func (*txDriver) Commit() error { return nil }
|
|||
func (*txDriver) Rollback() error { return nil }
|
||||
|
||||
// Exec calls tx.Exec.
|
||||
func (tx *txDriver) Exec(ctx context.Context, query string, args, v interface{}) error {
|
||||
func (tx *txDriver) Exec(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Exec(ctx, query, args, v)
|
||||
}
|
||||
|
||||
// Query calls tx.Query.
|
||||
func (tx *txDriver) Query(ctx context.Context, query string, args, v interface{}) error {
|
||||
func (tx *txDriver) Query(ctx context.Context, query string, args, v any) error {
|
||||
return tx.tx.Query(ctx, query, args, v)
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ func (e UserEdges) AuthTokensOrErr() ([]*AuthTokens, error) {
|
|||
}
|
||||
|
||||
// scanValues returns the types for scanning values from sql.Rows.
|
||||
func (*User) scanValues(columns []string) ([]interface{}, error) {
|
||||
values := make([]interface{}, len(columns))
|
||||
func (*User) scanValues(columns []string) ([]any, error) {
|
||||
values := make([]any, len(columns))
|
||||
for i := range columns {
|
||||
switch columns[i] {
|
||||
case user.FieldIsSuperuser:
|
||||
|
@ -93,7 +93,7 @@ func (*User) scanValues(columns []string) ([]interface{}, error) {
|
|||
|
||||
// assignValues assigns the values that were returned from sql.Rows (after scanning)
|
||||
// to the User fields.
|
||||
func (u *User) assignValues(columns []string, values []interface{}) error {
|
||||
func (u *User) assignValues(columns []string, values []any) error {
|
||||
if m, n := len(values), len(columns); m < n {
|
||||
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.User {
|
|||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...uuid.UUID) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.User {
|
|||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...uuid.UUID) predicate.User {
|
||||
return predicate.User(func(s *sql.Selector) {
|
||||
v := make([]interface{}, len(ids))
|
||||
v := make([]any, len(ids))
|
||||
for i := range v {
|
||||
v[i] = ids[i]
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ func CreatedAtNEQ(v time.Time) predicate.User {
|
|||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ func CreatedAtIn(vs ...time.Time) predicate.User {
|
|||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ func UpdatedAtNEQ(v time.Time) predicate.User {
|
|||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ func UpdatedAtIn(vs ...time.Time) predicate.User {
|
|||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ func NameNEQ(v string) predicate.User {
|
|||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ func NameIn(vs ...string) predicate.User {
|
|||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ func EmailNEQ(v string) predicate.User {
|
|||
|
||||
// EmailIn applies the In predicate on the "email" field.
|
||||
func EmailIn(vs ...string) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ func EmailIn(vs ...string) predicate.User {
|
|||
|
||||
// EmailNotIn applies the NotIn predicate on the "email" field.
|
||||
func EmailNotIn(vs ...string) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ func PasswordNEQ(v string) predicate.User {
|
|||
|
||||
// PasswordIn applies the In predicate on the "password" field.
|
||||
func PasswordIn(vs ...string) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ func PasswordIn(vs ...string) predicate.User {
|
|||
|
||||
// PasswordNotIn applies the NotIn predicate on the "password" field.
|
||||
func PasswordNotIn(vs ...string) predicate.User {
|
||||
v := make([]interface{}, len(vs))
|
||||
v := make([]any, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
|
|
|
@ -402,10 +402,10 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e
|
|||
if withFKs {
|
||||
_spec.Node.Columns = append(_spec.Node.Columns, user.ForeignKeys...)
|
||||
}
|
||||
_spec.ScanValues = func(columns []string) ([]interface{}, error) {
|
||||
_spec.ScanValues = func(columns []string) ([]any, error) {
|
||||
return (*User).scanValues(nil, columns)
|
||||
}
|
||||
_spec.Assign = func(columns []string, values []interface{}) error {
|
||||
_spec.Assign = func(columns []string, values []any) error {
|
||||
node := &User{config: uq.config}
|
||||
nodes = append(nodes, node)
|
||||
node.Edges.loadedTypes = loadedTypes
|
||||
|
@ -507,11 +507,14 @@ func (uq *UserQuery) sqlCount(ctx context.Context) (int, error) {
|
|||
}
|
||||
|
||||
func (uq *UserQuery) sqlExist(ctx context.Context) (bool, error) {
|
||||
n, err := uq.sqlCount(ctx)
|
||||
if err != nil {
|
||||
switch _, err := uq.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 (uq *UserQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
|
@ -612,7 +615,7 @@ func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy {
|
|||
}
|
||||
|
||||
// Scan applies the group-by query and scans the result into the given value.
|
||||
func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error {
|
||||
func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error {
|
||||
query, err := ugb.path(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -621,7 +624,7 @@ func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error {
|
|||
return ugb.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (ugb *UserGroupBy) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (ugb *UserGroupBy) sqlScan(ctx context.Context, v any) error {
|
||||
for _, f := range ugb.fields {
|
||||
if !user.ValidColumn(f) {
|
||||
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)}
|
||||
|
@ -668,7 +671,7 @@ type UserSelect struct {
|
|||
}
|
||||
|
||||
// Scan applies the selector query and scans the result into the given value.
|
||||
func (us *UserSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
func (us *UserSelect) Scan(ctx context.Context, v any) error {
|
||||
if err := us.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -676,7 +679,7 @@ func (us *UserSelect) Scan(ctx context.Context, v interface{}) error {
|
|||
return us.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
func (us *UserSelect) sqlScan(ctx context.Context, v interface{}) error {
|
||||
func (us *UserSelect) sqlScan(ctx context.Context, v any) error {
|
||||
rows := &sql.Rows{}
|
||||
query, args := us.sql.Query()
|
||||
if err := us.driver.Query(ctx, query, args, rows); err != nil {
|
||||
|
|
|
@ -61,11 +61,13 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk
|
|||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-sqlite3 v1.14.15 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
|
||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
|
||||
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
|
@ -75,6 +77,8 @@ github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
|||
github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY=
|
||||
github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
|
||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
||||
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
h1:A58dgWs4yGTcWkHBZwIedtCwK1LIWHYxqB5uKQ40f6E=
|
||||
20220928001319_init.sql h1:KOJZuCHJ5dTHHwVDGgAWyUFahBXqGtmuv4d+rxwpuX0=
|
||||
h1:ihsTwGsfNb8b/1qt+jw0OPKM8I/Bcw1J3Ise0ZFu5co=
|
||||
20220929052825_init.sql h1:ZlCqm1wzjDmofeAcSX3jE4h4VcdTNGpRg2eabztDy9Q=
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
if (auth.self === null) {
|
||||
const { data, error } = await api.self();
|
||||
if (error) {
|
||||
navigateTo("/login");
|
||||
navigateTo("/");
|
||||
}
|
||||
|
||||
auth.$patch({ self: data.item });
|
||||
|
|
Loading…
Reference in a new issue