do ent generation

This commit is contained in:
Hayden 2022-09-28 20:44:43 -08:00
parent 8a43fc953d
commit c547678e36
37 changed files with 311 additions and 285 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

@ -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

@ -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)
} }

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]
} }

View file

@ -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
@ -682,14 +682,14 @@ func (iq *ItemQuery) loadLabel(ctx context.Context, query *LabelQuery, 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 {
@ -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

@ -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
} }
@ -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

@ -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=