chores/general-cleanup-release-prep (#31)

* do ent generation

* update edges

* fix redirect
This commit is contained in:
Hayden 2022-09-28 21:42:33 -08:00 committed by GitHub
parent 8a43fc953d
commit 1ca430af21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 785 additions and 765 deletions

View file

@ -70,8 +70,8 @@ func (e AttachmentEdges) DocumentOrErr() (*Document, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*Attachment) scanValues(columns []string) ([]interface{}, error) { func (*Attachment) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case attachment.FieldType: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Attachment fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Attachment {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Attachment { func IDIn(ids ...uuid.UUID) predicate.Attachment {
return predicate.Attachment(func(s *sql.Selector) { return predicate.Attachment(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Attachment {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Attachment { func IDNotIn(ids ...uuid.UUID) predicate.Attachment {
return predicate.Attachment(func(s *sql.Selector) { return predicate.Attachment(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Attachment { func CreatedAtIn(vs ...time.Time) predicate.Attachment {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Attachment { func CreatedAtNotIn(vs ...time.Time) predicate.Attachment {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Attachment { func UpdatedAtIn(vs ...time.Time) predicate.Attachment {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Attachment { func UpdatedAtNotIn(vs ...time.Time) predicate.Attachment {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -240,7 +240,7 @@ func TypeNEQ(v Type) predicate.Attachment {
// TypeIn applies the In predicate on the "type" field. // TypeIn applies the In predicate on the "type" field.
func TypeIn(vs ...Type) predicate.Attachment { func TypeIn(vs ...Type) predicate.Attachment {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -251,7 +251,7 @@ func TypeIn(vs ...Type) predicate.Attachment {
// TypeNotIn applies the NotIn predicate on the "type" field. // TypeNotIn applies the NotIn predicate on the "type" field.
func TypeNotIn(vs ...Type) predicate.Attachment { func TypeNotIn(vs ...Type) predicate.Attachment {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -401,10 +401,10 @@ func (aq *AttachmentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*A
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, attachment.ForeignKeys...) _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) 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} node := &Attachment{config: aq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (aq *AttachmentQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := aq.sqlCount(ctx) switch _, err := aq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (aq *AttachmentQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := agb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -617,7 +620,7 @@ func (agb *AttachmentGroupBy) Scan(ctx context.Context, v interface{}) error {
return agb.sqlScan(ctx, v) 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 { for _, f := range agb.fields {
if !attachment.ValidColumn(f) { if !attachment.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := as.prepareQuery(ctx); err != nil {
return err return err
} }
@ -672,7 +675,7 @@ func (as *AttachmentSelect) Scan(ctx context.Context, v interface{}) error {
return as.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := as.sql.Query() query, args := as.sql.Query()
if err := as.driver.Query(ctx, query, args, rows); err != nil { if err := as.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -55,8 +55,8 @@ func (e AuthTokensEdges) UserOrErr() (*User, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*AuthTokens) scanValues(columns []string) ([]interface{}, error) { func (*AuthTokens) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case authtokens.FieldToken: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the AuthTokens fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.AuthTokens {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.AuthTokens { func IDIn(ids ...uuid.UUID) predicate.AuthTokens {
return predicate.AuthTokens(func(s *sql.Selector) { return predicate.AuthTokens(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.AuthTokens {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.AuthTokens { func IDNotIn(ids ...uuid.UUID) predicate.AuthTokens {
return predicate.AuthTokens(func(s *sql.Selector) { return predicate.AuthTokens(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.AuthTokens { func CreatedAtIn(vs ...time.Time) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.AuthTokens { func CreatedAtNotIn(vs ...time.Time) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.AuthTokens { func UpdatedAtIn(vs ...time.Time) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.AuthTokens { func UpdatedAtNotIn(vs ...time.Time) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -254,7 +254,7 @@ func TokenNEQ(v []byte) predicate.AuthTokens {
// TokenIn applies the In predicate on the "token" field. // TokenIn applies the In predicate on the "token" field.
func TokenIn(vs ...[]byte) predicate.AuthTokens { func TokenIn(vs ...[]byte) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -265,7 +265,7 @@ func TokenIn(vs ...[]byte) predicate.AuthTokens {
// TokenNotIn applies the NotIn predicate on the "token" field. // TokenNotIn applies the NotIn predicate on the "token" field.
func TokenNotIn(vs ...[]byte) predicate.AuthTokens { func TokenNotIn(vs ...[]byte) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // ExpiresAtIn applies the In predicate on the "expires_at" field.
func ExpiresAtIn(vs ...time.Time) predicate.AuthTokens { func ExpiresAtIn(vs ...time.Time) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
func ExpiresAtNotIn(vs ...time.Time) predicate.AuthTokens { func ExpiresAtNotIn(vs ...time.Time) predicate.AuthTokens {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -364,10 +364,10 @@ func (atq *AuthTokensQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, authtokens.ForeignKeys...) _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) 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} node := &AuthTokens{config: atq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (atq *AuthTokensQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := atq.sqlCount(ctx) switch _, err := atq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (atq *AuthTokensQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := atgb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -545,7 +548,7 @@ func (atgb *AuthTokensGroupBy) Scan(ctx context.Context, v interface{}) error {
return atgb.sqlScan(ctx, v) 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 { for _, f := range atgb.fields {
if !authtokens.ValidColumn(f) { if !authtokens.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := ats.prepareQuery(ctx); err != nil {
return err return err
} }
@ -600,7 +603,7 @@ func (ats *AuthTokensSelect) Scan(ctx context.Context, v interface{}) error {
return ats.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := ats.sql.Query() query, args := ats.sql.Query()
if err := ats.driver.Query(ctx, query, args, rows); err != nil { if err := ats.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -930,6 +930,22 @@ func (c *ItemClient) QueryGroup(i *Item) *GroupQuery {
return query return query
} }
// QueryLabel queries the label edge of a Item.
func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
query := &LabelQuery{config: c.config}
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
id := i.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
)
fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryLocation queries the location edge of a Item. // QueryLocation queries the location edge of a Item.
func (c *ItemClient) QueryLocation(i *Item) *LocationQuery { func (c *ItemClient) QueryLocation(i *Item) *LocationQuery {
query := &LocationQuery{config: c.config} query := &LocationQuery{config: c.config}
@ -962,22 +978,6 @@ func (c *ItemClient) QueryFields(i *Item) *ItemFieldQuery {
return query return query
} }
// QueryLabel queries the label edge of a Item.
func (c *ItemClient) QueryLabel(i *Item) *LabelQuery {
query := &LabelQuery{config: c.config}
query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {
id := i.ID
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, id),
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
)
fromV = sqlgraph.Neighbors(i.driver.Dialect(), step)
return fromV, nil
}
return query
}
// QueryAttachments queries the attachments edge of a Item. // QueryAttachments queries the attachments edge of a Item.
func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery { func (c *ItemClient) QueryAttachments(i *Item) *AttachmentQuery {
query := &AttachmentQuery{config: c.config} query := &AttachmentQuery{config: c.config}

View file

@ -17,7 +17,7 @@ type config struct {
// debug enable a debug logging. // debug enable a debug logging.
debug bool debug bool
// log used for logging on debug mode. // log used for logging on debug mode.
log func(...interface{}) log func(...any)
// hooks to execute on mutations. // hooks to execute on mutations.
hooks *hooks hooks *hooks
} }
@ -54,7 +54,7 @@ func Debug() Option {
} }
// Log sets the logging function for debug mode. // Log sets the logging function for debug mode.
func Log(fn func(...interface{})) Option { func Log(fn func(...any)) Option {
return func(c *config) { return func(c *config) {
c.log = fn c.log = fn
} }

View file

@ -77,8 +77,8 @@ func (e DocumentEdges) AttachmentsOrErr() ([]*Attachment, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*Document) scanValues(columns []string) ([]interface{}, error) { func (*Document) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case document.FieldTitle, document.FieldPath: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Document fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Document {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Document { func IDIn(ids ...uuid.UUID) predicate.Document {
return predicate.Document(func(s *sql.Selector) { return predicate.Document(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Document {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Document { func IDNotIn(ids ...uuid.UUID) predicate.Document {
return predicate.Document(func(s *sql.Selector) { return predicate.Document(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Document { func CreatedAtIn(vs ...time.Time) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Document { func CreatedAtNotIn(vs ...time.Time) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Document { func UpdatedAtIn(vs ...time.Time) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Document { func UpdatedAtNotIn(vs ...time.Time) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -254,7 +254,7 @@ func TitleNEQ(v string) predicate.Document {
// TitleIn applies the In predicate on the "title" field. // TitleIn applies the In predicate on the "title" field.
func TitleIn(vs ...string) predicate.Document { func TitleIn(vs ...string) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -265,7 +265,7 @@ func TitleIn(vs ...string) predicate.Document {
// TitleNotIn applies the NotIn predicate on the "title" field. // TitleNotIn applies the NotIn predicate on the "title" field.
func TitleNotIn(vs ...string) predicate.Document { func TitleNotIn(vs ...string) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -353,7 +353,7 @@ func PathNEQ(v string) predicate.Document {
// PathIn applies the In predicate on the "path" field. // PathIn applies the In predicate on the "path" field.
func PathIn(vs ...string) predicate.Document { func PathIn(vs ...string) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -364,7 +364,7 @@ func PathIn(vs ...string) predicate.Document {
// PathNotIn applies the NotIn predicate on the "path" field. // PathNotIn applies the NotIn predicate on the "path" field.
func PathNotIn(vs ...string) predicate.Document { func PathNotIn(vs ...string) predicate.Document {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -439,10 +439,10 @@ func (dq *DocumentQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Doc
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, document.ForeignKeys...) _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) 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} node := &Document{config: dq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (dq *DocumentQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := dq.sqlCount(ctx) switch _, err := dq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (dq *DocumentQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := dgb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -696,7 +699,7 @@ func (dgb *DocumentGroupBy) Scan(ctx context.Context, v interface{}) error {
return dgb.sqlScan(ctx, v) 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 { for _, f := range dgb.fields {
if !document.ValidColumn(f) { if !document.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := ds.prepareQuery(ctx); err != nil {
return err return err
} }
@ -751,7 +754,7 @@ func (ds *DocumentSelect) Scan(ctx context.Context, v interface{}) error {
return ds.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := ds.sql.Query() query, args := ds.sql.Query()
if err := ds.driver.Query(ctx, query, args, rows); err != nil { if err := ds.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -57,8 +57,8 @@ func (e DocumentTokenEdges) DocumentOrErr() (*Document, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*DocumentToken) scanValues(columns []string) ([]interface{}, error) { func (*DocumentToken) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case documenttoken.FieldToken: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the DocumentToken fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.DocumentToken {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.DocumentToken { func IDIn(ids ...uuid.UUID) predicate.DocumentToken {
return predicate.DocumentToken(func(s *sql.Selector) { return predicate.DocumentToken(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.DocumentToken {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.DocumentToken { func IDNotIn(ids ...uuid.UUID) predicate.DocumentToken {
return predicate.DocumentToken(func(s *sql.Selector) { return predicate.DocumentToken(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.DocumentToken { func CreatedAtIn(vs ...time.Time) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.DocumentToken { func CreatedAtNotIn(vs ...time.Time) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.DocumentToken { func UpdatedAtIn(vs ...time.Time) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.DocumentToken { func UpdatedAtNotIn(vs ...time.Time) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -261,7 +261,7 @@ func TokenNEQ(v []byte) predicate.DocumentToken {
// TokenIn applies the In predicate on the "token" field. // TokenIn applies the In predicate on the "token" field.
func TokenIn(vs ...[]byte) predicate.DocumentToken { func TokenIn(vs ...[]byte) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -272,7 +272,7 @@ func TokenIn(vs ...[]byte) predicate.DocumentToken {
// TokenNotIn applies the NotIn predicate on the "token" field. // TokenNotIn applies the NotIn predicate on the "token" field.
func TokenNotIn(vs ...[]byte) predicate.DocumentToken { func TokenNotIn(vs ...[]byte) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -325,7 +325,7 @@ func UsesNEQ(v int) predicate.DocumentToken {
// UsesIn applies the In predicate on the "uses" field. // UsesIn applies the In predicate on the "uses" field.
func UsesIn(vs ...int) predicate.DocumentToken { func UsesIn(vs ...int) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -336,7 +336,7 @@ func UsesIn(vs ...int) predicate.DocumentToken {
// UsesNotIn applies the NotIn predicate on the "uses" field. // UsesNotIn applies the NotIn predicate on the "uses" field.
func UsesNotIn(vs ...int) predicate.DocumentToken { func UsesNotIn(vs ...int) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // ExpiresAtIn applies the In predicate on the "expires_at" field.
func ExpiresAtIn(vs ...time.Time) predicate.DocumentToken { func ExpiresAtIn(vs ...time.Time) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
func ExpiresAtNotIn(vs ...time.Time) predicate.DocumentToken { func ExpiresAtNotIn(vs ...time.Time) predicate.DocumentToken {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -364,10 +364,10 @@ func (dtq *DocumentTokenQuery) sqlAll(ctx context.Context, hooks ...queryHook) (
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, documenttoken.ForeignKeys...) _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) 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} node := &DocumentToken{config: dtq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (dtq *DocumentTokenQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := dtq.sqlCount(ctx) switch _, err := dtq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (dtq *DocumentTokenQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := dtgb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -545,7 +548,7 @@ func (dtgb *DocumentTokenGroupBy) Scan(ctx context.Context, v interface{}) error
return dtgb.sqlScan(ctx, v) 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 { for _, f := range dtgb.fields {
if !documenttoken.ValidColumn(f) { if !documenttoken.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := dts.prepareQuery(ctx); err != nil {
return err return err
} }
@ -600,7 +603,7 @@ func (dts *DocumentTokenSelect) Scan(ctx context.Context, v interface{}) error {
return dts.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := dts.sql.Query() query, args := dts.sql.Query()
if err := dts.driver.Query(ctx, query, args, rows); err != nil { if err := dts.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -281,11 +281,11 @@ func IsConstraintError(err error) bool {
type selector struct { type selector struct {
label string label string
flds *[]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. // 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 { if err := s.scan(ctx, v); err != nil {
panic(err) panic(err)
} }

View file

@ -18,7 +18,7 @@ type (
// testing.T and testing.B and used by enttest. // testing.T and testing.B and used by enttest.
TestingT interface { TestingT interface {
FailNow() FailNow()
Error(...interface{}) Error(...any)
} }
// Option configures client creation. // Option configures client creation.

View file

@ -93,8 +93,8 @@ func (e GroupEdges) DocumentsOrErr() ([]*Document, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*Group) scanValues(columns []string) ([]interface{}, error) { func (*Group) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case group.FieldName, group.FieldCurrency: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Group fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Group {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Group { func IDIn(ids ...uuid.UUID) predicate.Group {
return predicate.Group(func(s *sql.Selector) { return predicate.Group(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Group {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Group { func IDNotIn(ids ...uuid.UUID) predicate.Group {
return predicate.Group(func(s *sql.Selector) { return predicate.Group(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Group { func CreatedAtIn(vs ...time.Time) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Group { func CreatedAtNotIn(vs ...time.Time) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Group { func UpdatedAtIn(vs ...time.Time) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Group { func UpdatedAtNotIn(vs ...time.Time) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -247,7 +247,7 @@ func NameNEQ(v string) predicate.Group {
// NameIn applies the In predicate on the "name" field. // NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.Group { func NameIn(vs ...string) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -258,7 +258,7 @@ func NameIn(vs ...string) predicate.Group {
// NameNotIn applies the NotIn predicate on the "name" field. // NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.Group { func NameNotIn(vs ...string) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -346,7 +346,7 @@ func CurrencyNEQ(v Currency) predicate.Group {
// CurrencyIn applies the In predicate on the "currency" field. // CurrencyIn applies the In predicate on the "currency" field.
func CurrencyIn(vs ...Currency) predicate.Group { func CurrencyIn(vs ...Currency) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -357,7 +357,7 @@ func CurrencyIn(vs ...Currency) predicate.Group {
// CurrencyNotIn applies the NotIn predicate on the "currency" field. // CurrencyNotIn applies the NotIn predicate on the "currency" field.
func CurrencyNotIn(vs ...Currency) predicate.Group { func CurrencyNotIn(vs ...Currency) predicate.Group {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -505,10 +505,10 @@ func (gq *GroupQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Group,
gq.withDocuments != nil, gq.withDocuments != nil,
} }
) )
_spec.ScanValues = func(columns []string) ([]interface{}, error) { _spec.ScanValues = func(columns []string) ([]any, error) {
return (*Group).scanValues(nil, columns) 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} node := &Group{config: gq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (gq *GroupQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := gq.sqlCount(ctx) switch _, err := gq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (gq *GroupQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := ggb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -841,7 +844,7 @@ func (ggb *GroupGroupBy) Scan(ctx context.Context, v interface{}) error {
return ggb.sqlScan(ctx, v) 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 { for _, f := range ggb.fields {
if !group.ValidColumn(f) { if !group.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := gs.prepareQuery(ctx); err != nil {
return err return err
} }
@ -896,7 +899,7 @@ func (gs *GroupSelect) Scan(ctx context.Context, v interface{}) error {
return gs.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := gs.sql.Query() query, args := gs.sql.Query()
if err := gs.driver.Query(ctx, query, args, rows); err != nil { if err := gs.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -72,12 +72,12 @@ type Item struct {
type ItemEdges struct { type ItemEdges struct {
// Group holds the value of the group edge. // Group holds the value of the group edge.
Group *Group `json:"group,omitempty"` Group *Group `json:"group,omitempty"`
// Label holds the value of the label edge.
Label []*Label `json:"label,omitempty"`
// Location holds the value of the location edge. // Location holds the value of the location edge.
Location *Location `json:"location,omitempty"` Location *Location `json:"location,omitempty"`
// Fields holds the value of the fields edge. // Fields holds the value of the fields edge.
Fields []*ItemField `json:"fields,omitempty"` Fields []*ItemField `json:"fields,omitempty"`
// Label holds the value of the label edge.
Label []*Label `json:"label,omitempty"`
// Attachments holds the value of the attachments edge. // Attachments holds the value of the attachments edge.
Attachments []*Attachment `json:"attachments,omitempty"` Attachments []*Attachment `json:"attachments,omitempty"`
// loadedTypes holds the information for reporting if a // loadedTypes holds the information for reporting if a
@ -98,10 +98,19 @@ func (e ItemEdges) GroupOrErr() (*Group, error) {
return nil, &NotLoadedError{edge: "group"} return nil, &NotLoadedError{edge: "group"}
} }
// LabelOrErr returns the Label value or an error if the edge
// was not loaded in eager-loading.
func (e ItemEdges) LabelOrErr() ([]*Label, error) {
if e.loadedTypes[1] {
return e.Label, nil
}
return nil, &NotLoadedError{edge: "label"}
}
// LocationOrErr returns the Location value or an error if the edge // LocationOrErr returns the Location value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found. // was not loaded in eager-loading, or loaded but was not found.
func (e ItemEdges) LocationOrErr() (*Location, error) { func (e ItemEdges) LocationOrErr() (*Location, error) {
if e.loadedTypes[1] { if e.loadedTypes[2] {
if e.Location == nil { if e.Location == nil {
// Edge was loaded but was not found. // Edge was loaded but was not found.
return nil, &NotFoundError{label: location.Label} return nil, &NotFoundError{label: location.Label}
@ -114,21 +123,12 @@ func (e ItemEdges) LocationOrErr() (*Location, error) {
// FieldsOrErr returns the Fields value or an error if the edge // FieldsOrErr returns the Fields value or an error if the edge
// was not loaded in eager-loading. // was not loaded in eager-loading.
func (e ItemEdges) FieldsOrErr() ([]*ItemField, error) { func (e ItemEdges) FieldsOrErr() ([]*ItemField, error) {
if e.loadedTypes[2] { if e.loadedTypes[3] {
return e.Fields, nil return e.Fields, nil
} }
return nil, &NotLoadedError{edge: "fields"} return nil, &NotLoadedError{edge: "fields"}
} }
// LabelOrErr returns the Label value or an error if the edge
// was not loaded in eager-loading.
func (e ItemEdges) LabelOrErr() ([]*Label, error) {
if e.loadedTypes[3] {
return e.Label, nil
}
return nil, &NotLoadedError{edge: "label"}
}
// AttachmentsOrErr returns the Attachments value or an error if the edge // AttachmentsOrErr returns the Attachments value or an error if the edge
// was not loaded in eager-loading. // was not loaded in eager-loading.
func (e ItemEdges) AttachmentsOrErr() ([]*Attachment, error) { func (e ItemEdges) AttachmentsOrErr() ([]*Attachment, error) {
@ -139,8 +139,8 @@ func (e ItemEdges) AttachmentsOrErr() ([]*Attachment, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*Item) scanValues(columns []string) ([]interface{}, error) { func (*Item) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case item.FieldInsured, item.FieldLifetimeWarranty: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Item fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", 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) return (&ItemClient{config: i.config}).QueryGroup(i)
} }
// QueryLabel queries the "label" edge of the Item entity.
func (i *Item) QueryLabel() *LabelQuery {
return (&ItemClient{config: i.config}).QueryLabel(i)
}
// QueryLocation queries the "location" edge of the Item entity. // QueryLocation queries the "location" edge of the Item entity.
func (i *Item) QueryLocation() *LocationQuery { func (i *Item) QueryLocation() *LocationQuery {
return (&ItemClient{config: i.config}).QueryLocation(i) return (&ItemClient{config: i.config}).QueryLocation(i)
@ -340,11 +345,6 @@ func (i *Item) QueryFields() *ItemFieldQuery {
return (&ItemClient{config: i.config}).QueryFields(i) return (&ItemClient{config: i.config}).QueryFields(i)
} }
// QueryLabel queries the "label" edge of the Item entity.
func (i *Item) QueryLabel() *LabelQuery {
return (&ItemClient{config: i.config}).QueryLabel(i)
}
// QueryAttachments queries the "attachments" edge of the Item entity. // QueryAttachments queries the "attachments" edge of the Item entity.
func (i *Item) QueryAttachments() *AttachmentQuery { func (i *Item) QueryAttachments() *AttachmentQuery {
return (&ItemClient{config: i.config}).QueryAttachments(i) return (&ItemClient{config: i.config}).QueryAttachments(i)

View file

@ -57,12 +57,12 @@ const (
FieldSoldNotes = "sold_notes" FieldSoldNotes = "sold_notes"
// EdgeGroup holds the string denoting the group edge name in mutations. // EdgeGroup holds the string denoting the group edge name in mutations.
EdgeGroup = "group" EdgeGroup = "group"
// EdgeLabel holds the string denoting the label edge name in mutations.
EdgeLabel = "label"
// EdgeLocation holds the string denoting the location edge name in mutations. // EdgeLocation holds the string denoting the location edge name in mutations.
EdgeLocation = "location" EdgeLocation = "location"
// EdgeFields holds the string denoting the fields edge name in mutations. // EdgeFields holds the string denoting the fields edge name in mutations.
EdgeFields = "fields" EdgeFields = "fields"
// EdgeLabel holds the string denoting the label edge name in mutations.
EdgeLabel = "label"
// EdgeAttachments holds the string denoting the attachments edge name in mutations. // EdgeAttachments holds the string denoting the attachments edge name in mutations.
EdgeAttachments = "attachments" EdgeAttachments = "attachments"
// Table holds the table name of the item in the database. // Table holds the table name of the item in the database.
@ -74,6 +74,11 @@ const (
GroupInverseTable = "groups" GroupInverseTable = "groups"
// GroupColumn is the table column denoting the group relation/edge. // GroupColumn is the table column denoting the group relation/edge.
GroupColumn = "group_items" GroupColumn = "group_items"
// LabelTable is the table that holds the label relation/edge. The primary key declared below.
LabelTable = "label_items"
// LabelInverseTable is the table name for the Label entity.
// It exists in this package in order to avoid circular dependency with the "label" package.
LabelInverseTable = "labels"
// LocationTable is the table that holds the location relation/edge. // LocationTable is the table that holds the location relation/edge.
LocationTable = "items" LocationTable = "items"
// LocationInverseTable is the table name for the Location entity. // LocationInverseTable is the table name for the Location entity.
@ -88,11 +93,6 @@ const (
FieldsInverseTable = "item_fields" FieldsInverseTable = "item_fields"
// FieldsColumn is the table column denoting the fields relation/edge. // FieldsColumn is the table column denoting the fields relation/edge.
FieldsColumn = "item_fields" FieldsColumn = "item_fields"
// LabelTable is the table that holds the label relation/edge. The primary key declared below.
LabelTable = "label_items"
// LabelInverseTable is the table name for the Label entity.
// It exists in this package in order to avoid circular dependency with the "label" package.
LabelInverseTable = "labels"
// AttachmentsTable is the table that holds the attachments relation/edge. // AttachmentsTable is the table that holds the attachments relation/edge.
AttachmentsTable = "attachments" AttachmentsTable = "attachments"
// AttachmentsInverseTable is the table name for the Attachment entity. // AttachmentsInverseTable is the table name for the Attachment entity.

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Item {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Item { func IDIn(ids ...uuid.UUID) predicate.Item {
return predicate.Item(func(s *sql.Selector) { return predicate.Item(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Item {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Item { func IDNotIn(ids ...uuid.UUID) predicate.Item {
return predicate.Item(func(s *sql.Selector) { return predicate.Item(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Item { func CreatedAtIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Item { func CreatedAtNotIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Item { func UpdatedAtIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Item { func UpdatedAtNotIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -373,7 +373,7 @@ func NameNEQ(v string) predicate.Item {
// NameIn applies the In predicate on the "name" field. // NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.Item { func NameIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -384,7 +384,7 @@ func NameIn(vs ...string) predicate.Item {
// NameNotIn applies the NotIn predicate on the "name" field. // NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.Item { func NameNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -472,7 +472,7 @@ func DescriptionNEQ(v string) predicate.Item {
// DescriptionIn applies the In predicate on the "description" field. // DescriptionIn applies the In predicate on the "description" field.
func DescriptionIn(vs ...string) predicate.Item { func DescriptionIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -483,7 +483,7 @@ func DescriptionIn(vs ...string) predicate.Item {
// DescriptionNotIn applies the NotIn predicate on the "description" field. // DescriptionNotIn applies the NotIn predicate on the "description" field.
func DescriptionNotIn(vs ...string) predicate.Item { func DescriptionNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -585,7 +585,7 @@ func ImportRefNEQ(v string) predicate.Item {
// ImportRefIn applies the In predicate on the "import_ref" field. // ImportRefIn applies the In predicate on the "import_ref" field.
func ImportRefIn(vs ...string) predicate.Item { func ImportRefIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -596,7 +596,7 @@ func ImportRefIn(vs ...string) predicate.Item {
// ImportRefNotIn applies the NotIn predicate on the "import_ref" field. // ImportRefNotIn applies the NotIn predicate on the "import_ref" field.
func ImportRefNotIn(vs ...string) predicate.Item { func ImportRefNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -698,7 +698,7 @@ func NotesNEQ(v string) predicate.Item {
// NotesIn applies the In predicate on the "notes" field. // NotesIn applies the In predicate on the "notes" field.
func NotesIn(vs ...string) predicate.Item { func NotesIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -709,7 +709,7 @@ func NotesIn(vs ...string) predicate.Item {
// NotesNotIn applies the NotIn predicate on the "notes" field. // NotesNotIn applies the NotIn predicate on the "notes" field.
func NotesNotIn(vs ...string) predicate.Item { func NotesNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -811,7 +811,7 @@ func QuantityNEQ(v int) predicate.Item {
// QuantityIn applies the In predicate on the "quantity" field. // QuantityIn applies the In predicate on the "quantity" field.
func QuantityIn(vs ...int) predicate.Item { func QuantityIn(vs ...int) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -822,7 +822,7 @@ func QuantityIn(vs ...int) predicate.Item {
// QuantityNotIn applies the NotIn predicate on the "quantity" field. // QuantityNotIn applies the NotIn predicate on the "quantity" field.
func QuantityNotIn(vs ...int) predicate.Item { func QuantityNotIn(vs ...int) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -889,7 +889,7 @@ func SerialNumberNEQ(v string) predicate.Item {
// SerialNumberIn applies the In predicate on the "serial_number" field. // SerialNumberIn applies the In predicate on the "serial_number" field.
func SerialNumberIn(vs ...string) predicate.Item { func SerialNumberIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -900,7 +900,7 @@ func SerialNumberIn(vs ...string) predicate.Item {
// SerialNumberNotIn applies the NotIn predicate on the "serial_number" field. // SerialNumberNotIn applies the NotIn predicate on the "serial_number" field.
func SerialNumberNotIn(vs ...string) predicate.Item { func SerialNumberNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1002,7 +1002,7 @@ func ModelNumberNEQ(v string) predicate.Item {
// ModelNumberIn applies the In predicate on the "model_number" field. // ModelNumberIn applies the In predicate on the "model_number" field.
func ModelNumberIn(vs ...string) predicate.Item { func ModelNumberIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1013,7 +1013,7 @@ func ModelNumberIn(vs ...string) predicate.Item {
// ModelNumberNotIn applies the NotIn predicate on the "model_number" field. // ModelNumberNotIn applies the NotIn predicate on the "model_number" field.
func ModelNumberNotIn(vs ...string) predicate.Item { func ModelNumberNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1115,7 +1115,7 @@ func ManufacturerNEQ(v string) predicate.Item {
// ManufacturerIn applies the In predicate on the "manufacturer" field. // ManufacturerIn applies the In predicate on the "manufacturer" field.
func ManufacturerIn(vs ...string) predicate.Item { func ManufacturerIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1126,7 +1126,7 @@ func ManufacturerIn(vs ...string) predicate.Item {
// ManufacturerNotIn applies the NotIn predicate on the "manufacturer" field. // ManufacturerNotIn applies the NotIn predicate on the "manufacturer" field.
func ManufacturerNotIn(vs ...string) predicate.Item { func ManufacturerNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // WarrantyExpiresIn applies the In predicate on the "warranty_expires" field.
func WarrantyExpiresIn(vs ...time.Time) predicate.Item { func WarrantyExpiresIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // WarrantyExpiresNotIn applies the NotIn predicate on the "warranty_expires" field.
func WarrantyExpiresNotIn(vs ...time.Time) predicate.Item { func WarrantyExpiresNotIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1320,7 +1320,7 @@ func WarrantyDetailsNEQ(v string) predicate.Item {
// WarrantyDetailsIn applies the In predicate on the "warranty_details" field. // WarrantyDetailsIn applies the In predicate on the "warranty_details" field.
func WarrantyDetailsIn(vs ...string) predicate.Item { func WarrantyDetailsIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1331,7 +1331,7 @@ func WarrantyDetailsIn(vs ...string) predicate.Item {
// WarrantyDetailsNotIn applies the NotIn predicate on the "warranty_details" field. // WarrantyDetailsNotIn applies the NotIn predicate on the "warranty_details" field.
func WarrantyDetailsNotIn(vs ...string) predicate.Item { func WarrantyDetailsNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // PurchaseTimeIn applies the In predicate on the "purchase_time" field.
func PurchaseTimeIn(vs ...time.Time) predicate.Item { func PurchaseTimeIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // PurchaseTimeNotIn applies the NotIn predicate on the "purchase_time" field.
func PurchaseTimeNotIn(vs ...time.Time) predicate.Item { func PurchaseTimeNotIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1511,7 +1511,7 @@ func PurchaseFromNEQ(v string) predicate.Item {
// PurchaseFromIn applies the In predicate on the "purchase_from" field. // PurchaseFromIn applies the In predicate on the "purchase_from" field.
func PurchaseFromIn(vs ...string) predicate.Item { func PurchaseFromIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1522,7 +1522,7 @@ func PurchaseFromIn(vs ...string) predicate.Item {
// PurchaseFromNotIn applies the NotIn predicate on the "purchase_from" field. // PurchaseFromNotIn applies the NotIn predicate on the "purchase_from" field.
func PurchaseFromNotIn(vs ...string) predicate.Item { func PurchaseFromNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1624,7 +1624,7 @@ func PurchasePriceNEQ(v float64) predicate.Item {
// PurchasePriceIn applies the In predicate on the "purchase_price" field. // PurchasePriceIn applies the In predicate on the "purchase_price" field.
func PurchasePriceIn(vs ...float64) predicate.Item { func PurchasePriceIn(vs ...float64) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1635,7 +1635,7 @@ func PurchasePriceIn(vs ...float64) predicate.Item {
// PurchasePriceNotIn applies the NotIn predicate on the "purchase_price" field. // PurchasePriceNotIn applies the NotIn predicate on the "purchase_price" field.
func PurchasePriceNotIn(vs ...float64) predicate.Item { func PurchasePriceNotIn(vs ...float64) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // SoldTimeIn applies the In predicate on the "sold_time" field.
func SoldTimeIn(vs ...time.Time) predicate.Item { func SoldTimeIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // SoldTimeNotIn applies the NotIn predicate on the "sold_time" field.
func SoldTimeNotIn(vs ...time.Time) predicate.Item { func SoldTimeNotIn(vs ...time.Time) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1766,7 +1766,7 @@ func SoldToNEQ(v string) predicate.Item {
// SoldToIn applies the In predicate on the "sold_to" field. // SoldToIn applies the In predicate on the "sold_to" field.
func SoldToIn(vs ...string) predicate.Item { func SoldToIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1777,7 +1777,7 @@ func SoldToIn(vs ...string) predicate.Item {
// SoldToNotIn applies the NotIn predicate on the "sold_to" field. // SoldToNotIn applies the NotIn predicate on the "sold_to" field.
func SoldToNotIn(vs ...string) predicate.Item { func SoldToNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1879,7 +1879,7 @@ func SoldPriceNEQ(v float64) predicate.Item {
// SoldPriceIn applies the In predicate on the "sold_price" field. // SoldPriceIn applies the In predicate on the "sold_price" field.
func SoldPriceIn(vs ...float64) predicate.Item { func SoldPriceIn(vs ...float64) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1890,7 +1890,7 @@ func SoldPriceIn(vs ...float64) predicate.Item {
// SoldPriceNotIn applies the NotIn predicate on the "sold_price" field. // SoldPriceNotIn applies the NotIn predicate on the "sold_price" field.
func SoldPriceNotIn(vs ...float64) predicate.Item { func SoldPriceNotIn(vs ...float64) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1943,7 +1943,7 @@ func SoldNotesNEQ(v string) predicate.Item {
// SoldNotesIn applies the In predicate on the "sold_notes" field. // SoldNotesIn applies the In predicate on the "sold_notes" field.
func SoldNotesIn(vs ...string) predicate.Item { func SoldNotesIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -1954,7 +1954,7 @@ func SoldNotesIn(vs ...string) predicate.Item {
// SoldNotesNotIn applies the NotIn predicate on the "sold_notes" field. // SoldNotesNotIn applies the NotIn predicate on the "sold_notes" field.
func SoldNotesNotIn(vs ...string) predicate.Item { func SoldNotesNotIn(vs ...string) predicate.Item {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // HasLocation applies the HasEdge predicate on the "location" edge.
func HasLocation() predicate.Item { func HasLocation() predicate.Item {
return predicate.Item(func(s *sql.Selector) { return predicate.Item(func(s *sql.Selector) {
@ -2124,34 +2152,6 @@ func HasFieldsWith(preds ...predicate.ItemField) predicate.Item {
}) })
} }
// HasLabel applies the HasEdge predicate on the "label" edge.
func HasLabel() predicate.Item {
return predicate.Item(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(LabelTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, LabelTable, LabelPrimaryKey...),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasLabelWith applies the HasEdge predicate on the "label" edge with a given conditions (other predicates).
func HasLabelWith(preds ...predicate.Label) predicate.Item {
return predicate.Item(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(LabelInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, LabelTable, LabelPrimaryKey...),
)
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasAttachments applies the HasEdge predicate on the "attachments" edge. // HasAttachments applies the HasEdge predicate on the "attachments" edge.
func HasAttachments() predicate.Item { func HasAttachments() predicate.Item {
return predicate.Item(func(s *sql.Selector) { return predicate.Item(func(s *sql.Selector) {

View file

@ -337,6 +337,21 @@ func (ic *ItemCreate) SetGroup(g *Group) *ItemCreate {
return ic.SetGroupID(g.ID) return ic.SetGroupID(g.ID)
} }
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
func (ic *ItemCreate) AddLabelIDs(ids ...uuid.UUID) *ItemCreate {
ic.mutation.AddLabelIDs(ids...)
return ic
}
// AddLabel adds the "label" edges to the Label entity.
func (ic *ItemCreate) AddLabel(l ...*Label) *ItemCreate {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return ic.AddLabelIDs(ids...)
}
// SetLocationID sets the "location" edge to the Location entity by ID. // SetLocationID sets the "location" edge to the Location entity by ID.
func (ic *ItemCreate) SetLocationID(id uuid.UUID) *ItemCreate { func (ic *ItemCreate) SetLocationID(id uuid.UUID) *ItemCreate {
ic.mutation.SetLocationID(id) ic.mutation.SetLocationID(id)
@ -371,21 +386,6 @@ func (ic *ItemCreate) AddFields(i ...*ItemField) *ItemCreate {
return ic.AddFieldIDs(ids...) return ic.AddFieldIDs(ids...)
} }
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
func (ic *ItemCreate) AddLabelIDs(ids ...uuid.UUID) *ItemCreate {
ic.mutation.AddLabelIDs(ids...)
return ic
}
// AddLabel adds the "label" edges to the Label entity.
func (ic *ItemCreate) AddLabel(l ...*Label) *ItemCreate {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return ic.AddLabelIDs(ids...)
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs. // AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
func (ic *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate { func (ic *ItemCreate) AddAttachmentIDs(ids ...uuid.UUID) *ItemCreate {
ic.mutation.AddAttachmentIDs(ids...) ic.mutation.AddAttachmentIDs(ids...)
@ -810,6 +810,25 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
_node.group_items = &nodes[0] _node.group_items = &nodes[0]
_spec.Edges = append(_spec.Edges, edge) _spec.Edges = append(_spec.Edges, edge)
} }
if nodes := ic.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := ic.mutation.LocationIDs(); len(nodes) > 0 { if nodes := ic.mutation.LocationIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O, Rel: sqlgraph.M2O,
@ -849,25 +868,6 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) {
} }
_spec.Edges = append(_spec.Edges, edge) _spec.Edges = append(_spec.Edges, edge)
} }
if nodes := ic.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := ic.mutation.AttachmentsIDs(); len(nodes) > 0 { if nodes := ic.mutation.AttachmentsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M, Rel: sqlgraph.O2M,

View file

@ -31,9 +31,9 @@ type ItemQuery struct {
fields []string fields []string
predicates []predicate.Item predicates []predicate.Item
withGroup *GroupQuery withGroup *GroupQuery
withLabel *LabelQuery
withLocation *LocationQuery withLocation *LocationQuery
withFields *ItemFieldQuery withFields *ItemFieldQuery
withLabel *LabelQuery
withAttachments *AttachmentQuery withAttachments *AttachmentQuery
withFKs bool withFKs bool
// intermediate query (i.e. traversal path). // intermediate query (i.e. traversal path).
@ -94,6 +94,28 @@ func (iq *ItemQuery) QueryGroup() *GroupQuery {
return query return query
} }
// QueryLabel chains the current query on the "label" edge.
func (iq *ItemQuery) QueryLabel() *LabelQuery {
query := &LabelQuery{config: iq.config}
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := iq.prepareQuery(ctx); err != nil {
return nil, err
}
selector := iq.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, selector),
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
)
fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryLocation chains the current query on the "location" edge. // QueryLocation chains the current query on the "location" edge.
func (iq *ItemQuery) QueryLocation() *LocationQuery { func (iq *ItemQuery) QueryLocation() *LocationQuery {
query := &LocationQuery{config: iq.config} query := &LocationQuery{config: iq.config}
@ -138,28 +160,6 @@ func (iq *ItemQuery) QueryFields() *ItemFieldQuery {
return query return query
} }
// QueryLabel chains the current query on the "label" edge.
func (iq *ItemQuery) QueryLabel() *LabelQuery {
query := &LabelQuery{config: iq.config}
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := iq.prepareQuery(ctx); err != nil {
return nil, err
}
selector := iq.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(item.Table, item.FieldID, selector),
sqlgraph.To(label.Table, label.FieldID),
sqlgraph.Edge(sqlgraph.M2M, true, item.LabelTable, item.LabelPrimaryKey...),
)
fromU = sqlgraph.SetNeighbors(iq.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryAttachments chains the current query on the "attachments" edge. // QueryAttachments chains the current query on the "attachments" edge.
func (iq *ItemQuery) QueryAttachments() *AttachmentQuery { func (iq *ItemQuery) QueryAttachments() *AttachmentQuery {
query := &AttachmentQuery{config: iq.config} query := &AttachmentQuery{config: iq.config}
@ -364,9 +364,9 @@ func (iq *ItemQuery) Clone() *ItemQuery {
order: append([]OrderFunc{}, iq.order...), order: append([]OrderFunc{}, iq.order...),
predicates: append([]predicate.Item{}, iq.predicates...), predicates: append([]predicate.Item{}, iq.predicates...),
withGroup: iq.withGroup.Clone(), withGroup: iq.withGroup.Clone(),
withLabel: iq.withLabel.Clone(),
withLocation: iq.withLocation.Clone(), withLocation: iq.withLocation.Clone(),
withFields: iq.withFields.Clone(), withFields: iq.withFields.Clone(),
withLabel: iq.withLabel.Clone(),
withAttachments: iq.withAttachments.Clone(), withAttachments: iq.withAttachments.Clone(),
// clone intermediate query. // clone intermediate query.
sql: iq.sql.Clone(), sql: iq.sql.Clone(),
@ -386,6 +386,17 @@ func (iq *ItemQuery) WithGroup(opts ...func(*GroupQuery)) *ItemQuery {
return iq return iq
} }
// WithLabel tells the query-builder to eager-load the nodes that are connected to
// the "label" edge. The optional arguments are used to configure the query builder of the edge.
func (iq *ItemQuery) WithLabel(opts ...func(*LabelQuery)) *ItemQuery {
query := &LabelQuery{config: iq.config}
for _, opt := range opts {
opt(query)
}
iq.withLabel = query
return iq
}
// WithLocation tells the query-builder to eager-load the nodes that are connected to // WithLocation tells the query-builder to eager-load the nodes that are connected to
// the "location" edge. The optional arguments are used to configure the query builder of the edge. // the "location" edge. The optional arguments are used to configure the query builder of the edge.
func (iq *ItemQuery) WithLocation(opts ...func(*LocationQuery)) *ItemQuery { func (iq *ItemQuery) WithLocation(opts ...func(*LocationQuery)) *ItemQuery {
@ -408,17 +419,6 @@ func (iq *ItemQuery) WithFields(opts ...func(*ItemFieldQuery)) *ItemQuery {
return iq return iq
} }
// WithLabel tells the query-builder to eager-load the nodes that are connected to
// the "label" edge. The optional arguments are used to configure the query builder of the edge.
func (iq *ItemQuery) WithLabel(opts ...func(*LabelQuery)) *ItemQuery {
query := &LabelQuery{config: iq.config}
for _, opt := range opts {
opt(query)
}
iq.withLabel = query
return iq
}
// WithAttachments tells the query-builder to eager-load the nodes that are connected to // WithAttachments tells the query-builder to eager-load the nodes that are connected to
// the "attachments" edge. The optional arguments are used to configure the query builder of the edge. // the "attachments" edge. The optional arguments are used to configure the query builder of the edge.
func (iq *ItemQuery) WithAttachments(opts ...func(*AttachmentQuery)) *ItemQuery { func (iq *ItemQuery) WithAttachments(opts ...func(*AttachmentQuery)) *ItemQuery {
@ -501,9 +501,9 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
_spec = iq.querySpec() _spec = iq.querySpec()
loadedTypes = [5]bool{ loadedTypes = [5]bool{
iq.withGroup != nil, iq.withGroup != nil,
iq.withLabel != nil,
iq.withLocation != nil, iq.withLocation != nil,
iq.withFields != nil, iq.withFields != nil,
iq.withLabel != nil,
iq.withAttachments != nil, iq.withAttachments != nil,
} }
) )
@ -513,10 +513,10 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, item.ForeignKeys...) _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) 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} node := &Item{config: iq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes node.Edges.loadedTypes = loadedTypes
@ -537,6 +537,13 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
return nil, err return nil, err
} }
} }
if query := iq.withLabel; query != nil {
if err := iq.loadLabel(ctx, query, nodes,
func(n *Item) { n.Edges.Label = []*Label{} },
func(n *Item, e *Label) { n.Edges.Label = append(n.Edges.Label, e) }); err != nil {
return nil, err
}
}
if query := iq.withLocation; query != nil { if query := iq.withLocation; query != nil {
if err := iq.loadLocation(ctx, query, nodes, nil, if err := iq.loadLocation(ctx, query, nodes, nil,
func(n *Item, e *Location) { n.Edges.Location = e }); err != nil { func(n *Item, e *Location) { n.Edges.Location = e }); err != nil {
@ -550,13 +557,6 @@ func (iq *ItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Item, e
return nil, err return nil, err
} }
} }
if query := iq.withLabel; query != nil {
if err := iq.loadLabel(ctx, query, nodes,
func(n *Item) { n.Edges.Label = []*Label{} },
func(n *Item, e *Label) { n.Edges.Label = append(n.Edges.Label, e) }); err != nil {
return nil, err
}
}
if query := iq.withAttachments; query != nil { if query := iq.withAttachments; query != nil {
if err := iq.loadAttachments(ctx, query, nodes, if err := iq.loadAttachments(ctx, query, nodes,
func(n *Item) { n.Edges.Attachments = []*Attachment{} }, func(n *Item) { n.Edges.Attachments = []*Attachment{} },
@ -596,6 +596,64 @@ func (iq *ItemQuery) loadGroup(ctx context.Context, query *GroupQuery, nodes []*
} }
return nil return nil
} }
func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*Item, init func(*Item), assign func(*Item, *Label)) error {
edgeIDs := make([]driver.Value, len(nodes))
byID := make(map[uuid.UUID]*Item)
nids := make(map[uuid.UUID]map[*Item]struct{})
for i, node := range nodes {
edgeIDs[i] = node.ID
byID[node.ID] = node
if init != nil {
init(node)
}
}
query.Where(func(s *sql.Selector) {
joinT := sql.Table(item.LabelTable)
s.Join(joinT).On(s.C(label.FieldID), joinT.C(item.LabelPrimaryKey[0]))
s.Where(sql.InValues(joinT.C(item.LabelPrimaryKey[1]), edgeIDs...))
columns := s.SelectedColumns()
s.Select(joinT.C(item.LabelPrimaryKey[1]))
s.AppendSelect(columns...)
s.SetDistinct(false)
})
if err := query.prepareQuery(ctx); err != nil {
return err
}
neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
assign := spec.Assign
values := spec.ScanValues
spec.ScanValues = func(columns []string) ([]any, error) {
values, err := values(columns[1:])
if err != nil {
return nil, err
}
return append([]any{new(uuid.UUID)}, values...), nil
}
spec.Assign = func(columns []string, values []any) error {
outValue := *values[0].(*uuid.UUID)
inValue := *values[1].(*uuid.UUID)
if nids[inValue] == nil {
nids[inValue] = map[*Item]struct{}{byID[outValue]: struct{}{}}
return assign(columns[1:], values[1:])
}
nids[inValue][byID[outValue]] = struct{}{}
return nil
}
})
if err != nil {
return err
}
for _, n := range neighbors {
nodes, ok := nids[n.ID]
if !ok {
return fmt.Errorf(`unexpected "label" node returned %v`, n.ID)
}
for kn := range nodes {
assign(kn, n)
}
}
return nil
}
func (iq *ItemQuery) loadLocation(ctx context.Context, query *LocationQuery, nodes []*Item, init func(*Item), assign func(*Item, *Location)) error { func (iq *ItemQuery) loadLocation(ctx context.Context, query *LocationQuery, nodes []*Item, init func(*Item), assign func(*Item, *Location)) error {
ids := make([]uuid.UUID, 0, len(nodes)) ids := make([]uuid.UUID, 0, len(nodes))
nodeids := make(map[uuid.UUID][]*Item) nodeids := make(map[uuid.UUID][]*Item)
@ -656,64 +714,6 @@ func (iq *ItemQuery) loadFields(ctx context.Context, query *ItemFieldQuery, node
} }
return nil return nil
} }
func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, nodes []*Item, init func(*Item), assign func(*Item, *Label)) error {
edgeIDs := make([]driver.Value, len(nodes))
byID := make(map[uuid.UUID]*Item)
nids := make(map[uuid.UUID]map[*Item]struct{})
for i, node := range nodes {
edgeIDs[i] = node.ID
byID[node.ID] = node
if init != nil {
init(node)
}
}
query.Where(func(s *sql.Selector) {
joinT := sql.Table(item.LabelTable)
s.Join(joinT).On(s.C(label.FieldID), joinT.C(item.LabelPrimaryKey[0]))
s.Where(sql.InValues(joinT.C(item.LabelPrimaryKey[1]), edgeIDs...))
columns := s.SelectedColumns()
s.Select(joinT.C(item.LabelPrimaryKey[1]))
s.AppendSelect(columns...)
s.SetDistinct(false)
})
if err := query.prepareQuery(ctx); err != nil {
return err
}
neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
assign := spec.Assign
values := spec.ScanValues
spec.ScanValues = func(columns []string) ([]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 { func (iq *ItemQuery) loadAttachments(ctx context.Context, query *AttachmentQuery, nodes []*Item, init func(*Item), assign func(*Item, *Attachment)) error {
fks := make([]driver.Value, 0, len(nodes)) fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[uuid.UUID]*Item) nodeids := make(map[uuid.UUID]*Item)
@ -756,11 +756,14 @@ func (iq *ItemQuery) sqlCount(ctx context.Context) (int, error) {
} }
func (iq *ItemQuery) sqlExist(ctx context.Context) (bool, error) { func (iq *ItemQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := iq.sqlCount(ctx) switch _, err := iq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (iq *ItemQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := igb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -870,7 +873,7 @@ func (igb *ItemGroupBy) Scan(ctx context.Context, v interface{}) error {
return igb.sqlScan(ctx, v) 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 { for _, f := range igb.fields {
if !item.ValidColumn(f) { if !item.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := is.prepareQuery(ctx); err != nil {
return err return err
} }
@ -925,7 +928,7 @@ func (is *ItemSelect) Scan(ctx context.Context, v interface{}) error {
return is.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := is.sql.Query() query, args := is.sql.Query()
if err := is.driver.Query(ctx, query, args, rows); err != nil { if err := is.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -388,6 +388,21 @@ func (iu *ItemUpdate) SetGroup(g *Group) *ItemUpdate {
return iu.SetGroupID(g.ID) return iu.SetGroupID(g.ID)
} }
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
func (iu *ItemUpdate) AddLabelIDs(ids ...uuid.UUID) *ItemUpdate {
iu.mutation.AddLabelIDs(ids...)
return iu
}
// AddLabel adds the "label" edges to the Label entity.
func (iu *ItemUpdate) AddLabel(l ...*Label) *ItemUpdate {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iu.AddLabelIDs(ids...)
}
// SetLocationID sets the "location" edge to the Location entity by ID. // SetLocationID sets the "location" edge to the Location entity by ID.
func (iu *ItemUpdate) SetLocationID(id uuid.UUID) *ItemUpdate { func (iu *ItemUpdate) SetLocationID(id uuid.UUID) *ItemUpdate {
iu.mutation.SetLocationID(id) iu.mutation.SetLocationID(id)
@ -422,21 +437,6 @@ func (iu *ItemUpdate) AddFields(i ...*ItemField) *ItemUpdate {
return iu.AddFieldIDs(ids...) return iu.AddFieldIDs(ids...)
} }
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
func (iu *ItemUpdate) AddLabelIDs(ids ...uuid.UUID) *ItemUpdate {
iu.mutation.AddLabelIDs(ids...)
return iu
}
// AddLabel adds the "label" edges to the Label entity.
func (iu *ItemUpdate) AddLabel(l ...*Label) *ItemUpdate {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iu.AddLabelIDs(ids...)
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs. // AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
func (iu *ItemUpdate) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdate { func (iu *ItemUpdate) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdate {
iu.mutation.AddAttachmentIDs(ids...) iu.mutation.AddAttachmentIDs(ids...)
@ -463,6 +463,27 @@ func (iu *ItemUpdate) ClearGroup() *ItemUpdate {
return iu return iu
} }
// ClearLabel clears all "label" edges to the Label entity.
func (iu *ItemUpdate) ClearLabel() *ItemUpdate {
iu.mutation.ClearLabel()
return iu
}
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
func (iu *ItemUpdate) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdate {
iu.mutation.RemoveLabelIDs(ids...)
return iu
}
// RemoveLabel removes "label" edges to Label entities.
func (iu *ItemUpdate) RemoveLabel(l ...*Label) *ItemUpdate {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iu.RemoveLabelIDs(ids...)
}
// ClearLocation clears the "location" edge to the Location entity. // ClearLocation clears the "location" edge to the Location entity.
func (iu *ItemUpdate) ClearLocation() *ItemUpdate { func (iu *ItemUpdate) ClearLocation() *ItemUpdate {
iu.mutation.ClearLocation() iu.mutation.ClearLocation()
@ -490,27 +511,6 @@ func (iu *ItemUpdate) RemoveFields(i ...*ItemField) *ItemUpdate {
return iu.RemoveFieldIDs(ids...) return iu.RemoveFieldIDs(ids...)
} }
// ClearLabel clears all "label" edges to the Label entity.
func (iu *ItemUpdate) ClearLabel() *ItemUpdate {
iu.mutation.ClearLabel()
return iu
}
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
func (iu *ItemUpdate) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdate {
iu.mutation.RemoveLabelIDs(ids...)
return iu
}
// RemoveLabel removes "label" edges to Label entities.
func (iu *ItemUpdate) RemoveLabel(l ...*Label) *ItemUpdate {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iu.RemoveLabelIDs(ids...)
}
// ClearAttachments clears all "attachments" edges to the Attachment entity. // ClearAttachments clears all "attachments" edges to the Attachment entity.
func (iu *ItemUpdate) ClearAttachments() *ItemUpdate { func (iu *ItemUpdate) ClearAttachments() *ItemUpdate {
iu.mutation.ClearAttachments() iu.mutation.ClearAttachments()
@ -934,6 +934,60 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
} }
_spec.Edges.Add = append(_spec.Edges.Add, edge) _spec.Edges.Add = append(_spec.Edges.Add, edge)
} }
if iu.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iu.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iu.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iu.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if iu.mutation.LocationCleared() { if iu.mutation.LocationCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O, Rel: sqlgraph.M2O,
@ -1023,60 +1077,6 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) {
} }
_spec.Edges.Add = append(_spec.Edges.Add, edge) _spec.Edges.Add = append(_spec.Edges.Add, edge)
} }
if iu.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iu.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iu.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iu.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if iu.mutation.AttachmentsCleared() { if iu.mutation.AttachmentsCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M, Rel: sqlgraph.O2M,
@ -1504,6 +1504,21 @@ func (iuo *ItemUpdateOne) SetGroup(g *Group) *ItemUpdateOne {
return iuo.SetGroupID(g.ID) return iuo.SetGroupID(g.ID)
} }
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
func (iuo *ItemUpdateOne) AddLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
iuo.mutation.AddLabelIDs(ids...)
return iuo
}
// AddLabel adds the "label" edges to the Label entity.
func (iuo *ItemUpdateOne) AddLabel(l ...*Label) *ItemUpdateOne {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iuo.AddLabelIDs(ids...)
}
// SetLocationID sets the "location" edge to the Location entity by ID. // SetLocationID sets the "location" edge to the Location entity by ID.
func (iuo *ItemUpdateOne) SetLocationID(id uuid.UUID) *ItemUpdateOne { func (iuo *ItemUpdateOne) SetLocationID(id uuid.UUID) *ItemUpdateOne {
iuo.mutation.SetLocationID(id) iuo.mutation.SetLocationID(id)
@ -1538,21 +1553,6 @@ func (iuo *ItemUpdateOne) AddFields(i ...*ItemField) *ItemUpdateOne {
return iuo.AddFieldIDs(ids...) return iuo.AddFieldIDs(ids...)
} }
// AddLabelIDs adds the "label" edge to the Label entity by IDs.
func (iuo *ItemUpdateOne) AddLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
iuo.mutation.AddLabelIDs(ids...)
return iuo
}
// AddLabel adds the "label" edges to the Label entity.
func (iuo *ItemUpdateOne) AddLabel(l ...*Label) *ItemUpdateOne {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iuo.AddLabelIDs(ids...)
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs. // AddAttachmentIDs adds the "attachments" edge to the Attachment entity by IDs.
func (iuo *ItemUpdateOne) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne { func (iuo *ItemUpdateOne) AddAttachmentIDs(ids ...uuid.UUID) *ItemUpdateOne {
iuo.mutation.AddAttachmentIDs(ids...) iuo.mutation.AddAttachmentIDs(ids...)
@ -1579,6 +1579,27 @@ func (iuo *ItemUpdateOne) ClearGroup() *ItemUpdateOne {
return iuo return iuo
} }
// ClearLabel clears all "label" edges to the Label entity.
func (iuo *ItemUpdateOne) ClearLabel() *ItemUpdateOne {
iuo.mutation.ClearLabel()
return iuo
}
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
func (iuo *ItemUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
iuo.mutation.RemoveLabelIDs(ids...)
return iuo
}
// RemoveLabel removes "label" edges to Label entities.
func (iuo *ItemUpdateOne) RemoveLabel(l ...*Label) *ItemUpdateOne {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iuo.RemoveLabelIDs(ids...)
}
// ClearLocation clears the "location" edge to the Location entity. // ClearLocation clears the "location" edge to the Location entity.
func (iuo *ItemUpdateOne) ClearLocation() *ItemUpdateOne { func (iuo *ItemUpdateOne) ClearLocation() *ItemUpdateOne {
iuo.mutation.ClearLocation() iuo.mutation.ClearLocation()
@ -1606,27 +1627,6 @@ func (iuo *ItemUpdateOne) RemoveFields(i ...*ItemField) *ItemUpdateOne {
return iuo.RemoveFieldIDs(ids...) return iuo.RemoveFieldIDs(ids...)
} }
// ClearLabel clears all "label" edges to the Label entity.
func (iuo *ItemUpdateOne) ClearLabel() *ItemUpdateOne {
iuo.mutation.ClearLabel()
return iuo
}
// RemoveLabelIDs removes the "label" edge to Label entities by IDs.
func (iuo *ItemUpdateOne) RemoveLabelIDs(ids ...uuid.UUID) *ItemUpdateOne {
iuo.mutation.RemoveLabelIDs(ids...)
return iuo
}
// RemoveLabel removes "label" edges to Label entities.
func (iuo *ItemUpdateOne) RemoveLabel(l ...*Label) *ItemUpdateOne {
ids := make([]uuid.UUID, len(l))
for i := range l {
ids[i] = l[i].ID
}
return iuo.RemoveLabelIDs(ids...)
}
// ClearAttachments clears all "attachments" edges to the Attachment entity. // ClearAttachments clears all "attachments" edges to the Attachment entity.
func (iuo *ItemUpdateOne) ClearAttachments() *ItemUpdateOne { func (iuo *ItemUpdateOne) ClearAttachments() *ItemUpdateOne {
iuo.mutation.ClearAttachments() iuo.mutation.ClearAttachments()
@ -2080,6 +2080,60 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
} }
_spec.Edges.Add = append(_spec.Edges.Add, edge) _spec.Edges.Add = append(_spec.Edges.Add, edge)
} }
if iuo.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iuo.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iuo.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iuo.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if iuo.mutation.LocationCleared() { if iuo.mutation.LocationCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O, Rel: sqlgraph.M2O,
@ -2169,60 +2223,6 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error)
} }
_spec.Edges.Add = append(_spec.Edges.Add, edge) _spec.Edges.Add = append(_spec.Edges.Add, edge)
} }
if iuo.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iuo.mutation.RemovedLabelIDs(); len(nodes) > 0 && !iuo.mutation.LabelCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := iuo.mutation.LabelIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: item.LabelTable,
Columns: item.LabelPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: &sqlgraph.FieldSpec{
Type: field.TypeUUID,
Column: label.FieldID,
},
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if iuo.mutation.AttachmentsCleared() { if iuo.mutation.AttachmentsCleared() {
edge := &sqlgraph.EdgeSpec{ edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M, Rel: sqlgraph.O2M,

View file

@ -65,8 +65,8 @@ func (e ItemFieldEdges) ItemOrErr() (*Item, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*ItemField) scanValues(columns []string) ([]interface{}, error) { func (*ItemField) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case itemfield.FieldBooleanValue: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the ItemField fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.ItemField {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.ItemField { func IDIn(ids ...uuid.UUID) predicate.ItemField {
return predicate.ItemField(func(s *sql.Selector) { return predicate.ItemField(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.ItemField {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.ItemField { func IDNotIn(ids ...uuid.UUID) predicate.ItemField {
return predicate.ItemField(func(s *sql.Selector) { return predicate.ItemField(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.ItemField { func CreatedAtIn(vs ...time.Time) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.ItemField { func CreatedAtNotIn(vs ...time.Time) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.ItemField { func UpdatedAtIn(vs ...time.Time) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.ItemField { func UpdatedAtNotIn(vs ...time.Time) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -282,7 +282,7 @@ func NameNEQ(v string) predicate.ItemField {
// NameIn applies the In predicate on the "name" field. // NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.ItemField { func NameIn(vs ...string) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -293,7 +293,7 @@ func NameIn(vs ...string) predicate.ItemField {
// NameNotIn applies the NotIn predicate on the "name" field. // NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.ItemField { func NameNotIn(vs ...string) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -381,7 +381,7 @@ func DescriptionNEQ(v string) predicate.ItemField {
// DescriptionIn applies the In predicate on the "description" field. // DescriptionIn applies the In predicate on the "description" field.
func DescriptionIn(vs ...string) predicate.ItemField { func DescriptionIn(vs ...string) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -392,7 +392,7 @@ func DescriptionIn(vs ...string) predicate.ItemField {
// DescriptionNotIn applies the NotIn predicate on the "description" field. // DescriptionNotIn applies the NotIn predicate on the "description" field.
func DescriptionNotIn(vs ...string) predicate.ItemField { func DescriptionNotIn(vs ...string) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -494,7 +494,7 @@ func TypeNEQ(v Type) predicate.ItemField {
// TypeIn applies the In predicate on the "type" field. // TypeIn applies the In predicate on the "type" field.
func TypeIn(vs ...Type) predicate.ItemField { func TypeIn(vs ...Type) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -505,7 +505,7 @@ func TypeIn(vs ...Type) predicate.ItemField {
// TypeNotIn applies the NotIn predicate on the "type" field. // TypeNotIn applies the NotIn predicate on the "type" field.
func TypeNotIn(vs ...Type) predicate.ItemField { func TypeNotIn(vs ...Type) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -530,7 +530,7 @@ func TextValueNEQ(v string) predicate.ItemField {
// TextValueIn applies the In predicate on the "text_value" field. // TextValueIn applies the In predicate on the "text_value" field.
func TextValueIn(vs ...string) predicate.ItemField { func TextValueIn(vs ...string) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -541,7 +541,7 @@ func TextValueIn(vs ...string) predicate.ItemField {
// TextValueNotIn applies the NotIn predicate on the "text_value" field. // TextValueNotIn applies the NotIn predicate on the "text_value" field.
func TextValueNotIn(vs ...string) predicate.ItemField { func TextValueNotIn(vs ...string) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -643,7 +643,7 @@ func NumberValueNEQ(v int) predicate.ItemField {
// NumberValueIn applies the In predicate on the "number_value" field. // NumberValueIn applies the In predicate on the "number_value" field.
func NumberValueIn(vs ...int) predicate.ItemField { func NumberValueIn(vs ...int) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -654,7 +654,7 @@ func NumberValueIn(vs ...int) predicate.ItemField {
// NumberValueNotIn applies the NotIn predicate on the "number_value" field. // NumberValueNotIn applies the NotIn predicate on the "number_value" field.
func NumberValueNotIn(vs ...int) predicate.ItemField { func NumberValueNotIn(vs ...int) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // TimeValueIn applies the In predicate on the "time_value" field.
func TimeValueIn(vs ...time.Time) predicate.ItemField { func TimeValueIn(vs ...time.Time) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // TimeValueNotIn applies the NotIn predicate on the "time_value" field.
func TimeValueNotIn(vs ...time.Time) predicate.ItemField { func TimeValueNotIn(vs ...time.Time) predicate.ItemField {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -364,10 +364,10 @@ func (ifq *ItemFieldQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*I
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, itemfield.ForeignKeys...) _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) 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} node := &ItemField{config: ifq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (ifq *ItemFieldQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := ifq.sqlCount(ctx) switch _, err := ifq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (ifq *ItemFieldQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := ifgb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -545,7 +548,7 @@ func (ifgb *ItemFieldGroupBy) Scan(ctx context.Context, v interface{}) error {
return ifgb.sqlScan(ctx, v) 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 { for _, f := range ifgb.fields {
if !itemfield.ValidColumn(f) { if !itemfield.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := ifs.prepareQuery(ctx); err != nil {
return err return err
} }
@ -600,7 +603,7 @@ func (ifs *ItemFieldSelect) Scan(ctx context.Context, v interface{}) error {
return ifs.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := ifs.sql.Query() query, args := ifs.sql.Query()
if err := ifs.driver.Query(ctx, query, args, rows); err != nil { if err := ifs.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -68,8 +68,8 @@ func (e LabelEdges) ItemsOrErr() ([]*Item, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*Label) scanValues(columns []string) ([]interface{}, error) { func (*Label) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case label.FieldName, label.FieldDescription, label.FieldColor: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Label fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Label {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Label { func IDIn(ids ...uuid.UUID) predicate.Label {
return predicate.Label(func(s *sql.Selector) { return predicate.Label(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Label {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Label { func IDNotIn(ids ...uuid.UUID) predicate.Label {
return predicate.Label(func(s *sql.Selector) { return predicate.Label(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Label { func CreatedAtIn(vs ...time.Time) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Label { func CreatedAtNotIn(vs ...time.Time) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Label { func UpdatedAtIn(vs ...time.Time) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Label { func UpdatedAtNotIn(vs ...time.Time) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -261,7 +261,7 @@ func NameNEQ(v string) predicate.Label {
// NameIn applies the In predicate on the "name" field. // NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.Label { func NameIn(vs ...string) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -272,7 +272,7 @@ func NameIn(vs ...string) predicate.Label {
// NameNotIn applies the NotIn predicate on the "name" field. // NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.Label { func NameNotIn(vs ...string) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -360,7 +360,7 @@ func DescriptionNEQ(v string) predicate.Label {
// DescriptionIn applies the In predicate on the "description" field. // DescriptionIn applies the In predicate on the "description" field.
func DescriptionIn(vs ...string) predicate.Label { func DescriptionIn(vs ...string) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -371,7 +371,7 @@ func DescriptionIn(vs ...string) predicate.Label {
// DescriptionNotIn applies the NotIn predicate on the "description" field. // DescriptionNotIn applies the NotIn predicate on the "description" field.
func DescriptionNotIn(vs ...string) predicate.Label { func DescriptionNotIn(vs ...string) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -473,7 +473,7 @@ func ColorNEQ(v string) predicate.Label {
// ColorIn applies the In predicate on the "color" field. // ColorIn applies the In predicate on the "color" field.
func ColorIn(vs ...string) predicate.Label { func ColorIn(vs ...string) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -484,7 +484,7 @@ func ColorIn(vs ...string) predicate.Label {
// ColorNotIn applies the NotIn predicate on the "color" field. // ColorNotIn applies the NotIn predicate on the "color" field.
func ColorNotIn(vs ...string) predicate.Label { func ColorNotIn(vs ...string) predicate.Label {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -402,10 +402,10 @@ func (lq *LabelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Label,
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, label.ForeignKeys...) _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) 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} node := &Label{config: lq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { neighbors, err := query.sqlAll(ctx, func(_ context.Context, spec *sqlgraph.QuerySpec) {
assign := spec.Assign assign := spec.Assign
values := spec.ScanValues values := spec.ScanValues
spec.ScanValues = func(columns []string) ([]interface{}, error) { spec.ScanValues = func(columns []string) ([]any, error) {
values, err := values(columns[1:]) values, err := values(columns[1:])
if err != nil { if err != nil {
return nil, err 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) outValue := *values[0].(*uuid.UUID)
inValue := *values[1].(*uuid.UUID) inValue := *values[1].(*uuid.UUID)
if nids[inValue] == nil { 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) { func (lq *LabelQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := lq.sqlCount(ctx) switch _, err := lq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (lq *LabelQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := lgb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -648,7 +651,7 @@ func (lgb *LabelGroupBy) Scan(ctx context.Context, v interface{}) error {
return lgb.sqlScan(ctx, v) 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 { for _, f := range lgb.fields {
if !label.ValidColumn(f) { if !label.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := ls.prepareQuery(ctx); err != nil {
return err return err
} }
@ -703,7 +706,7 @@ func (ls *LabelSelect) Scan(ctx context.Context, v interface{}) error {
return ls.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := ls.sql.Query() query, args := ls.sql.Query()
if err := ls.driver.Query(ctx, query, args, rows); err != nil { if err := ls.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -66,8 +66,8 @@ func (e LocationEdges) ItemsOrErr() ([]*Item, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*Location) scanValues(columns []string) ([]interface{}, error) { func (*Location) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case location.FieldName, location.FieldDescription: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Location fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.Location {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Location { func IDIn(ids ...uuid.UUID) predicate.Location {
return predicate.Location(func(s *sql.Selector) { return predicate.Location(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.Location {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Location { func IDNotIn(ids ...uuid.UUID) predicate.Location {
return predicate.Location(func(s *sql.Selector) { return predicate.Location(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Location { func CreatedAtIn(vs ...time.Time) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Location { func CreatedAtNotIn(vs ...time.Time) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Location { func UpdatedAtIn(vs ...time.Time) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Location { func UpdatedAtNotIn(vs ...time.Time) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -254,7 +254,7 @@ func NameNEQ(v string) predicate.Location {
// NameIn applies the In predicate on the "name" field. // NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.Location { func NameIn(vs ...string) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -265,7 +265,7 @@ func NameIn(vs ...string) predicate.Location {
// NameNotIn applies the NotIn predicate on the "name" field. // NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.Location { func NameNotIn(vs ...string) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -353,7 +353,7 @@ func DescriptionNEQ(v string) predicate.Location {
// DescriptionIn applies the In predicate on the "description" field. // DescriptionIn applies the In predicate on the "description" field.
func DescriptionIn(vs ...string) predicate.Location { func DescriptionIn(vs ...string) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -364,7 +364,7 @@ func DescriptionIn(vs ...string) predicate.Location {
// DescriptionNotIn applies the NotIn predicate on the "description" field. // DescriptionNotIn applies the NotIn predicate on the "description" field.
func DescriptionNotIn(vs ...string) predicate.Location { func DescriptionNotIn(vs ...string) predicate.Location {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -402,10 +402,10 @@ func (lq *LocationQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Loc
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, location.ForeignKeys...) _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) 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} node := &Location{config: lq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (lq *LocationQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := lq.sqlCount(ctx) switch _, err := lq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (lq *LocationQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := lgb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -621,7 +624,7 @@ func (lgb *LocationGroupBy) Scan(ctx context.Context, v interface{}) error {
return lgb.sqlScan(ctx, v) 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 { for _, f := range lgb.fields {
if !location.ValidColumn(f) { if !location.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := ls.prepareQuery(ctx); err != nil {
return err return err
} }
@ -676,7 +679,7 @@ func (ls *LocationSelect) Scan(ctx context.Context, v interface{}) error {
return ls.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := ls.sql.Query() query, args := ls.sql.Query()
if err := ls.driver.Query(ctx, query, args, rows); err != nil { if err := ls.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -542,8 +542,6 @@ func (m *AttachmentMutation) RemovedEdges() []string {
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation. // the given name in this mutation.
func (m *AttachmentMutation) RemovedIDs(name string) []ent.Value { func (m *AttachmentMutation) RemovedIDs(name string) []ent.Value {
switch name {
}
return nil 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 // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation. // the given name in this mutation.
func (m *AuthTokensMutation) RemovedIDs(name string) []ent.Value { func (m *AuthTokensMutation) RemovedIDs(name string) []ent.Value {
switch name {
}
return nil 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 // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation. // the given name in this mutation.
func (m *DocumentTokenMutation) RemovedIDs(name string) []ent.Value { func (m *DocumentTokenMutation) RemovedIDs(name string) []ent.Value {
switch name {
}
return nil return nil
} }
@ -3436,14 +3430,14 @@ type ItemMutation struct {
clearedFields map[string]struct{} clearedFields map[string]struct{}
group *uuid.UUID group *uuid.UUID
clearedgroup bool clearedgroup bool
label map[uuid.UUID]struct{}
removedlabel map[uuid.UUID]struct{}
clearedlabel bool
location *uuid.UUID location *uuid.UUID
clearedlocation bool clearedlocation bool
fields map[uuid.UUID]struct{} fields map[uuid.UUID]struct{}
removedfields map[uuid.UUID]struct{} removedfields map[uuid.UUID]struct{}
clearedfields bool clearedfields bool
label map[uuid.UUID]struct{}
removedlabel map[uuid.UUID]struct{}
clearedlabel bool
attachments map[uuid.UUID]struct{} attachments map[uuid.UUID]struct{}
removedattachments map[uuid.UUID]struct{} removedattachments map[uuid.UUID]struct{}
clearedattachments bool clearedattachments bool
@ -4580,6 +4574,60 @@ func (m *ItemMutation) ResetGroup() {
m.clearedgroup = false m.clearedgroup = false
} }
// AddLabelIDs adds the "label" edge to the Label entity by ids.
func (m *ItemMutation) AddLabelIDs(ids ...uuid.UUID) {
if m.label == nil {
m.label = make(map[uuid.UUID]struct{})
}
for i := range ids {
m.label[ids[i]] = struct{}{}
}
}
// ClearLabel clears the "label" edge to the Label entity.
func (m *ItemMutation) ClearLabel() {
m.clearedlabel = true
}
// LabelCleared reports if the "label" edge to the Label entity was cleared.
func (m *ItemMutation) LabelCleared() bool {
return m.clearedlabel
}
// RemoveLabelIDs removes the "label" edge to the Label entity by IDs.
func (m *ItemMutation) RemoveLabelIDs(ids ...uuid.UUID) {
if m.removedlabel == nil {
m.removedlabel = make(map[uuid.UUID]struct{})
}
for i := range ids {
delete(m.label, ids[i])
m.removedlabel[ids[i]] = struct{}{}
}
}
// RemovedLabel returns the removed IDs of the "label" edge to the Label entity.
func (m *ItemMutation) RemovedLabelIDs() (ids []uuid.UUID) {
for id := range m.removedlabel {
ids = append(ids, id)
}
return
}
// LabelIDs returns the "label" edge IDs in the mutation.
func (m *ItemMutation) LabelIDs() (ids []uuid.UUID) {
for id := range m.label {
ids = append(ids, id)
}
return
}
// ResetLabel resets all changes to the "label" edge.
func (m *ItemMutation) ResetLabel() {
m.label = nil
m.clearedlabel = false
m.removedlabel = nil
}
// SetLocationID sets the "location" edge to the Location entity by id. // SetLocationID sets the "location" edge to the Location entity by id.
func (m *ItemMutation) SetLocationID(id uuid.UUID) { func (m *ItemMutation) SetLocationID(id uuid.UUID) {
m.location = &id m.location = &id
@ -4673,60 +4721,6 @@ func (m *ItemMutation) ResetFields() {
m.removedfields = nil m.removedfields = nil
} }
// AddLabelIDs adds the "label" edge to the Label entity by ids.
func (m *ItemMutation) AddLabelIDs(ids ...uuid.UUID) {
if m.label == nil {
m.label = make(map[uuid.UUID]struct{})
}
for i := range ids {
m.label[ids[i]] = struct{}{}
}
}
// ClearLabel clears the "label" edge to the Label entity.
func (m *ItemMutation) ClearLabel() {
m.clearedlabel = true
}
// LabelCleared reports if the "label" edge to the Label entity was cleared.
func (m *ItemMutation) LabelCleared() bool {
return m.clearedlabel
}
// RemoveLabelIDs removes the "label" edge to the Label entity by IDs.
func (m *ItemMutation) RemoveLabelIDs(ids ...uuid.UUID) {
if m.removedlabel == nil {
m.removedlabel = make(map[uuid.UUID]struct{})
}
for i := range ids {
delete(m.label, ids[i])
m.removedlabel[ids[i]] = struct{}{}
}
}
// RemovedLabel returns the removed IDs of the "label" edge to the Label entity.
func (m *ItemMutation) RemovedLabelIDs() (ids []uuid.UUID) {
for id := range m.removedlabel {
ids = append(ids, id)
}
return
}
// LabelIDs returns the "label" edge IDs in the mutation.
func (m *ItemMutation) LabelIDs() (ids []uuid.UUID) {
for id := range m.label {
ids = append(ids, id)
}
return
}
// ResetLabel resets all changes to the "label" edge.
func (m *ItemMutation) ResetLabel() {
m.label = nil
m.clearedlabel = false
m.removedlabel = nil
}
// AddAttachmentIDs adds the "attachments" edge to the Attachment entity by ids. // AddAttachmentIDs adds the "attachments" edge to the Attachment entity by ids.
func (m *ItemMutation) AddAttachmentIDs(ids ...uuid.UUID) { func (m *ItemMutation) AddAttachmentIDs(ids ...uuid.UUID) {
if m.attachments == nil { if m.attachments == nil {
@ -5363,15 +5357,15 @@ func (m *ItemMutation) AddedEdges() []string {
if m.group != nil { if m.group != nil {
edges = append(edges, item.EdgeGroup) edges = append(edges, item.EdgeGroup)
} }
if m.label != nil {
edges = append(edges, item.EdgeLabel)
}
if m.location != nil { if m.location != nil {
edges = append(edges, item.EdgeLocation) edges = append(edges, item.EdgeLocation)
} }
if m.fields != nil { if m.fields != nil {
edges = append(edges, item.EdgeFields) edges = append(edges, item.EdgeFields)
} }
if m.label != nil {
edges = append(edges, item.EdgeLabel)
}
if m.attachments != nil { if m.attachments != nil {
edges = append(edges, item.EdgeAttachments) edges = append(edges, item.EdgeAttachments)
} }
@ -5386,6 +5380,12 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
if id := m.group; id != nil { if id := m.group; id != nil {
return []ent.Value{*id} return []ent.Value{*id}
} }
case item.EdgeLabel:
ids := make([]ent.Value, 0, len(m.label))
for id := range m.label {
ids = append(ids, id)
}
return ids
case item.EdgeLocation: case item.EdgeLocation:
if id := m.location; id != nil { if id := m.location; id != nil {
return []ent.Value{*id} return []ent.Value{*id}
@ -5396,12 +5396,6 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
ids = append(ids, id) ids = append(ids, id)
} }
return ids return ids
case item.EdgeLabel:
ids := make([]ent.Value, 0, len(m.label))
for id := range m.label {
ids = append(ids, id)
}
return ids
case item.EdgeAttachments: case item.EdgeAttachments:
ids := make([]ent.Value, 0, len(m.attachments)) ids := make([]ent.Value, 0, len(m.attachments))
for id := range m.attachments { for id := range m.attachments {
@ -5415,12 +5409,12 @@ func (m *ItemMutation) AddedIDs(name string) []ent.Value {
// RemovedEdges returns all edge names that were removed in this mutation. // RemovedEdges returns all edge names that were removed in this mutation.
func (m *ItemMutation) RemovedEdges() []string { func (m *ItemMutation) RemovedEdges() []string {
edges := make([]string, 0, 5) edges := make([]string, 0, 5)
if m.removedfields != nil {
edges = append(edges, item.EdgeFields)
}
if m.removedlabel != nil { if m.removedlabel != nil {
edges = append(edges, item.EdgeLabel) edges = append(edges, item.EdgeLabel)
} }
if m.removedfields != nil {
edges = append(edges, item.EdgeFields)
}
if m.removedattachments != nil { if m.removedattachments != nil {
edges = append(edges, item.EdgeAttachments) edges = append(edges, item.EdgeAttachments)
} }
@ -5431,18 +5425,18 @@ func (m *ItemMutation) RemovedEdges() []string {
// the given name in this mutation. // the given name in this mutation.
func (m *ItemMutation) RemovedIDs(name string) []ent.Value { func (m *ItemMutation) RemovedIDs(name string) []ent.Value {
switch name { switch name {
case item.EdgeFields:
ids := make([]ent.Value, 0, len(m.removedfields))
for id := range m.removedfields {
ids = append(ids, id)
}
return ids
case item.EdgeLabel: case item.EdgeLabel:
ids := make([]ent.Value, 0, len(m.removedlabel)) ids := make([]ent.Value, 0, len(m.removedlabel))
for id := range m.removedlabel { for id := range m.removedlabel {
ids = append(ids, id) ids = append(ids, id)
} }
return ids return ids
case item.EdgeFields:
ids := make([]ent.Value, 0, len(m.removedfields))
for id := range m.removedfields {
ids = append(ids, id)
}
return ids
case item.EdgeAttachments: case item.EdgeAttachments:
ids := make([]ent.Value, 0, len(m.removedattachments)) ids := make([]ent.Value, 0, len(m.removedattachments))
for id := range m.removedattachments { for id := range m.removedattachments {
@ -5459,15 +5453,15 @@ func (m *ItemMutation) ClearedEdges() []string {
if m.clearedgroup { if m.clearedgroup {
edges = append(edges, item.EdgeGroup) edges = append(edges, item.EdgeGroup)
} }
if m.clearedlabel {
edges = append(edges, item.EdgeLabel)
}
if m.clearedlocation { if m.clearedlocation {
edges = append(edges, item.EdgeLocation) edges = append(edges, item.EdgeLocation)
} }
if m.clearedfields { if m.clearedfields {
edges = append(edges, item.EdgeFields) edges = append(edges, item.EdgeFields)
} }
if m.clearedlabel {
edges = append(edges, item.EdgeLabel)
}
if m.clearedattachments { if m.clearedattachments {
edges = append(edges, item.EdgeAttachments) edges = append(edges, item.EdgeAttachments)
} }
@ -5480,12 +5474,12 @@ func (m *ItemMutation) EdgeCleared(name string) bool {
switch name { switch name {
case item.EdgeGroup: case item.EdgeGroup:
return m.clearedgroup return m.clearedgroup
case item.EdgeLabel:
return m.clearedlabel
case item.EdgeLocation: case item.EdgeLocation:
return m.clearedlocation return m.clearedlocation
case item.EdgeFields: case item.EdgeFields:
return m.clearedfields return m.clearedfields
case item.EdgeLabel:
return m.clearedlabel
case item.EdgeAttachments: case item.EdgeAttachments:
return m.clearedattachments return m.clearedattachments
} }
@ -5513,15 +5507,15 @@ func (m *ItemMutation) ResetEdge(name string) error {
case item.EdgeGroup: case item.EdgeGroup:
m.ResetGroup() m.ResetGroup()
return nil return nil
case item.EdgeLabel:
m.ResetLabel()
return nil
case item.EdgeLocation: case item.EdgeLocation:
m.ResetLocation() m.ResetLocation()
return nil return nil
case item.EdgeFields: case item.EdgeFields:
m.ResetFields() m.ResetFields()
return nil return nil
case item.EdgeLabel:
m.ResetLabel()
return nil
case item.EdgeAttachments: case item.EdgeAttachments:
m.ResetAttachments() m.ResetAttachments()
return nil return nil
@ -6398,8 +6392,6 @@ func (m *ItemFieldMutation) RemovedEdges() []string {
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation. // the given name in this mutation.
func (m *ItemFieldMutation) RemovedIDs(name string) []ent.Value { func (m *ItemFieldMutation) RemovedIDs(name string) []ent.Value {
switch name {
}
return nil return nil
} }

View file

@ -5,6 +5,6 @@ package runtime
// The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/ent/runtime.go // The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/ent/runtime.go
const ( const (
Version = "v0.11.2" // Version of ent codegen. Version = "v0.11.3" // Version of ent codegen.
Sum = "h1:UM2/BUhF2FfsxPHRxLjQbhqJNaDdVlOwNIAMLs2jyto=" // Sum of ent codegen. Sum = "h1:F5FBGAWiDCGder7YT+lqMnyzXl6d0xU3xMBM/SO3CMc=" // Sum of ent codegen.
) )

View file

@ -98,6 +98,8 @@ func (Item) Edges() []ent.Edge {
Ref("items"). Ref("items").
Required(). Required().
Unique(), Unique(),
edge.From("label", Label.Type).
Ref("items"),
edge.From("location", Location.Type). edge.From("location", Location.Type).
Ref("items"). Ref("items").
Unique(), Unique(),
@ -105,11 +107,6 @@ func (Item) Edges() []ent.Edge {
Annotations(entsql.Annotation{ Annotations(entsql.Annotation{
OnDelete: entsql.Cascade, OnDelete: entsql.Cascade,
}), }),
edge.From("label", Label.Type).
Ref("items").
Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
edge.To("attachments", Attachment.Type). edge.To("attachments", Attachment.Type).
Annotations(entsql.Annotation{ Annotations(entsql.Annotation{
OnDelete: entsql.Cascade, OnDelete: entsql.Cascade,

View file

@ -2,7 +2,6 @@ package schema
import ( import (
"entgo.io/ent" "entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema/edge" "entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field" "entgo.io/ent/schema/field"
"github.com/hay-kot/homebox/backend/ent/schema/mixins" "github.com/hay-kot/homebox/backend/ent/schema/mixins"
@ -36,9 +35,6 @@ func (Label) Edges() []ent.Edge {
Ref("labels"). Ref("labels").
Required(). Required().
Unique(), Unique(),
edge.To("items", Item.Type). edge.To("items", Item.Type),
Annotations(entsql.Annotation{
OnDelete: entsql.Cascade,
}),
} }
} }

View file

@ -45,7 +45,8 @@ func (User) Edges() []ent.Edge {
Ref("users"). Ref("users").
Required(). Required().
Unique(), Unique(),
edge.To("auth_tokens", AuthTokens.Type).Annotations(entsql.Annotation{ edge.To("auth_tokens", AuthTokens.Type).
Annotations(entsql.Annotation{
OnDelete: entsql.Cascade, OnDelete: entsql.Cascade,
}), }),
} }

View file

@ -225,12 +225,12 @@ func (*txDriver) Commit() error { return nil }
func (*txDriver) Rollback() error { return nil } func (*txDriver) Rollback() error { return nil }
// Exec calls tx.Exec. // 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) return tx.tx.Exec(ctx, query, args, v)
} }
// Query calls tx.Query. // 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) return tx.tx.Query(ctx, query, args, v)
} }

View file

@ -70,8 +70,8 @@ func (e UserEdges) AuthTokensOrErr() ([]*AuthTokens, error) {
} }
// scanValues returns the types for scanning values from sql.Rows. // scanValues returns the types for scanning values from sql.Rows.
func (*User) scanValues(columns []string) ([]interface{}, error) { func (*User) scanValues(columns []string) ([]any, error) {
values := make([]interface{}, len(columns)) values := make([]any, len(columns))
for i := range columns { for i := range columns {
switch columns[i] { switch columns[i] {
case user.FieldIsSuperuser: 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) // assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the User fields. // 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 { if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
} }

View file

@ -35,7 +35,7 @@ func IDNEQ(id uuid.UUID) predicate.User {
// IDIn applies the In predicate on the ID field. // IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.User { func IDIn(ids ...uuid.UUID) predicate.User {
return predicate.User(func(s *sql.Selector) { return predicate.User(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] v[i] = ids[i]
} }
@ -46,7 +46,7 @@ func IDIn(ids ...uuid.UUID) predicate.User {
// IDNotIn applies the NotIn predicate on the ID field. // IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.User { func IDNotIn(ids ...uuid.UUID) predicate.User {
return predicate.User(func(s *sql.Selector) { return predicate.User(func(s *sql.Selector) {
v := make([]interface{}, len(ids)) v := make([]any, len(ids))
for i := range v { for i := range v {
v[i] = ids[i] 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. // CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.User { func CreatedAtIn(vs ...time.Time) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.User { func CreatedAtNotIn(vs ...time.Time) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.User { func UpdatedAtIn(vs ...time.Time) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] 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. // UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.User { func UpdatedAtNotIn(vs ...time.Time) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -268,7 +268,7 @@ func NameNEQ(v string) predicate.User {
// NameIn applies the In predicate on the "name" field. // NameIn applies the In predicate on the "name" field.
func NameIn(vs ...string) predicate.User { func NameIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -279,7 +279,7 @@ func NameIn(vs ...string) predicate.User {
// NameNotIn applies the NotIn predicate on the "name" field. // NameNotIn applies the NotIn predicate on the "name" field.
func NameNotIn(vs ...string) predicate.User { func NameNotIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -367,7 +367,7 @@ func EmailNEQ(v string) predicate.User {
// EmailIn applies the In predicate on the "email" field. // EmailIn applies the In predicate on the "email" field.
func EmailIn(vs ...string) predicate.User { func EmailIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -378,7 +378,7 @@ func EmailIn(vs ...string) predicate.User {
// EmailNotIn applies the NotIn predicate on the "email" field. // EmailNotIn applies the NotIn predicate on the "email" field.
func EmailNotIn(vs ...string) predicate.User { func EmailNotIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -466,7 +466,7 @@ func PasswordNEQ(v string) predicate.User {
// PasswordIn applies the In predicate on the "password" field. // PasswordIn applies the In predicate on the "password" field.
func PasswordIn(vs ...string) predicate.User { func PasswordIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }
@ -477,7 +477,7 @@ func PasswordIn(vs ...string) predicate.User {
// PasswordNotIn applies the NotIn predicate on the "password" field. // PasswordNotIn applies the NotIn predicate on the "password" field.
func PasswordNotIn(vs ...string) predicate.User { func PasswordNotIn(vs ...string) predicate.User {
v := make([]interface{}, len(vs)) v := make([]any, len(vs))
for i := range v { for i := range v {
v[i] = vs[i] v[i] = vs[i]
} }

View file

@ -402,10 +402,10 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e
if withFKs { if withFKs {
_spec.Node.Columns = append(_spec.Node.Columns, user.ForeignKeys...) _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) 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} node := &User{config: uq.config}
nodes = append(nodes, node) nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes 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) { func (uq *UserQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := uq.sqlCount(ctx) switch _, err := uq.FirstID(ctx); {
if err != nil { case IsNotFound(err):
return false, nil
case err != nil:
return false, fmt.Errorf("ent: check existence: %w", err) return false, fmt.Errorf("ent: check existence: %w", err)
default:
return true, nil
} }
return n > 0, nil
} }
func (uq *UserQuery) querySpec() *sqlgraph.QuerySpec { 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. // 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) query, err := ugb.path(ctx)
if err != nil { if err != nil {
return err return err
@ -621,7 +624,7 @@ func (ugb *UserGroupBy) Scan(ctx context.Context, v interface{}) error {
return ugb.sqlScan(ctx, v) 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 { for _, f := range ugb.fields {
if !user.ValidColumn(f) { if !user.ValidColumn(f) {
return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", 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. // 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 { if err := us.prepareQuery(ctx); err != nil {
return err return err
} }
@ -676,7 +679,7 @@ func (us *UserSelect) Scan(ctx context.Context, v interface{}) error {
return us.sqlScan(ctx, v) 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{} rows := &sql.Rows{}
query, args := us.sql.Query() query, args := us.sql.Query()
if err := us.driver.Query(ctx, query, args, rows); err != nil { if err := us.driver.Query(ctx, query, args, rows); err != nil {

View file

@ -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.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 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 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 h1:vfoHhTN1af61xCRSWzFIWzx2YskyMTwHLrExkBOjvxI=
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= 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 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= 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/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/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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY=
github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= 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.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 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= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=

View file

@ -1,2 +1,2 @@
h1:A58dgWs4yGTcWkHBZwIedtCwK1LIWHYxqB5uKQ40f6E= h1:ihsTwGsfNb8b/1qt+jw0OPKM8I/Bcw1J3Ise0ZFu5co=
20220928001319_init.sql h1:KOJZuCHJ5dTHHwVDGgAWyUFahBXqGtmuv4d+rxwpuX0= 20220929052825_init.sql h1:ZlCqm1wzjDmofeAcSX3jE4h4VcdTNGpRg2eabztDy9Q=

View file

@ -18,7 +18,7 @@
if (auth.self === null) { if (auth.self === null) {
const { data, error } = await api.self(); const { data, error } = await api.self();
if (error) { if (error) {
navigateTo("/login"); navigateTo("/");
} }
auth.$patch({ self: data.item }); auth.$patch({ self: data.item });