mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 18:07:31 +00:00
linting
This commit is contained in:
@@ -33,6 +33,7 @@ func (c *pgxConn) Begin(ctx context.Context, opts *database.TransactionOptions)
|
||||
// Query implements sql.Client.
|
||||
// Subtle: this method shadows the method (*Conn).Query of pgxConn.Conn.
|
||||
func (c *pgxConn) Query(ctx context.Context, sql string, args ...any) (database.Rows, error) {
|
||||
//nolint:sqlclosecheck // Rows.Close is called by the caller
|
||||
rows, err := c.Conn.Query(ctx, sql, args...)
|
||||
if err != nil {
|
||||
return nil, wrapError(err)
|
||||
|
@@ -33,6 +33,7 @@ func (c *pgxPool) Acquire(ctx context.Context) (database.Client, error) {
|
||||
// Query implements [database.Pool].
|
||||
// Subtle: this method shadows the method (Pool).Query of pgxPool.Pool.
|
||||
func (c *pgxPool) Query(ctx context.Context, sql string, args ...any) (database.Rows, error) {
|
||||
//nolint:sqlclosecheck // Rows.Close is called by the caller
|
||||
rows, err := c.Pool.Query(ctx, sql, args...)
|
||||
if err != nil {
|
||||
return nil, wrapError(err)
|
||||
|
@@ -40,6 +40,7 @@ func (tx *pgxTx) End(ctx context.Context, err error) error {
|
||||
// Query implements [database.Transaction].
|
||||
// Subtle: this method shadows the method (Tx).Query of pgxTx.Tx.
|
||||
func (tx *pgxTx) Query(ctx context.Context, sql string, args ...any) (database.Rows, error) {
|
||||
//nolint:sqlclosecheck // Rows.Close is called by the caller
|
||||
rows, err := tx.Tx.Query(ctx, sql, args...)
|
||||
if err != nil {
|
||||
return nil, wrapError(err)
|
||||
|
@@ -30,6 +30,7 @@ func (c *sqlConn) Begin(ctx context.Context, opts *database.TransactionOptions)
|
||||
// Query implements sql.Client.
|
||||
// Subtle: this method shadows the method (*Conn).Query of pgxConn.Conn.
|
||||
func (c *sqlConn) Query(ctx context.Context, sql string, args ...any) (database.Rows, error) {
|
||||
//nolint:sqlclosecheck // Rows.Close is called by the caller
|
||||
rows, err := c.QueryContext(ctx, sql, args...)
|
||||
if err != nil {
|
||||
return nil, wrapError(err)
|
||||
|
@@ -31,6 +31,7 @@ func (c *sqlPool) Acquire(ctx context.Context) (database.Client, error) {
|
||||
// Query implements [database.Pool].
|
||||
// Subtle: this method shadows the method (Pool).Query of pgxPool.Pool.
|
||||
func (c *sqlPool) Query(ctx context.Context, sql string, args ...any) (database.Rows, error) {
|
||||
//nolint:sqlclosecheck // Rows.Close is called by the caller
|
||||
rows, err := c.QueryContext(ctx, sql, args...)
|
||||
if err != nil {
|
||||
return nil, wrapError(err)
|
||||
|
@@ -74,6 +74,5 @@ func (r *Rows) CollectExactlyOneRow(dest any) (err error) {
|
||||
// Close implements [database.Rows].
|
||||
// Subtle: this method shadows the method (Rows).Close of Rows.Rows.
|
||||
func (r *Rows) Close() error {
|
||||
r.Rows.Close()
|
||||
return nil
|
||||
return r.Rows.Close()
|
||||
}
|
||||
|
@@ -43,6 +43,7 @@ func (tx *sqlTx) End(ctx context.Context, err error) error {
|
||||
// Query implements [database.Transaction].
|
||||
// Subtle: this method shadows the method (Tx).Query of pgxTx.Tx.
|
||||
func (tx *sqlTx) Query(ctx context.Context, sql string, args ...any) (database.Rows, error) {
|
||||
//nolint:sqlclosecheck // Rows.Close is called by the caller
|
||||
rows, err := tx.QueryContext(ctx, sql, args...)
|
||||
if err != nil {
|
||||
return nil, wrapError(err)
|
||||
|
@@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var NoChangesError = errors.New("Update must contain a change")
|
||||
var ErrNoChanges = errors.New("update must contain a change")
|
||||
|
||||
// NoRowFoundError is returned when QueryRow does not find any row.
|
||||
// It wraps the dialect specific original error to provide more context.
|
||||
|
@@ -105,7 +105,7 @@ func (i *instance) Create(ctx context.Context, instance *domain.Instance) error
|
||||
// Update implements [domain.InstanceRepository].
|
||||
func (i instance) Update(ctx context.Context, id string, changes ...database.Change) (int64, error) {
|
||||
if len(changes) == 0 {
|
||||
return 0, database.NoChangesError
|
||||
return 0, database.ErrNoChanges
|
||||
}
|
||||
var builder database.StatementBuilder
|
||||
|
||||
|
@@ -77,7 +77,7 @@ func (i *instanceDomain) Remove(ctx context.Context, condition database.Conditio
|
||||
// Subtle: this method shadows the method ([domain.InstanceRepository]).Update of instanceDomain.instance.
|
||||
func (i *instanceDomain) Update(ctx context.Context, condition database.Condition, changes ...database.Change) (int64, error) {
|
||||
if len(changes) == 0 {
|
||||
return 0, database.NoChangesError
|
||||
return 0, database.ErrNoChanges
|
||||
}
|
||||
var builder database.StatementBuilder
|
||||
|
||||
|
@@ -475,7 +475,7 @@ func TestUpdateInstanceDomain(t *testing.T) {
|
||||
condition: domainRepo.DomainCondition(database.TextOperationEqual, domainName),
|
||||
changes: []database.Change{},
|
||||
expected: 0,
|
||||
err: database.NoChangesError,
|
||||
err: database.ErrNoChanges,
|
||||
},
|
||||
}
|
||||
|
||||
|
@@ -105,7 +105,7 @@ func (o *org) Create(ctx context.Context, organization *domain.Organization) err
|
||||
// Update implements [domain.OrganizationRepository].
|
||||
func (o *org) Update(ctx context.Context, id domain.OrgIdentifierCondition, instanceID string, changes ...database.Change) (int64, error) {
|
||||
if len(changes) == 0 {
|
||||
return 0, database.NoChangesError
|
||||
return 0, database.ErrNoChanges
|
||||
}
|
||||
builder := database.StatementBuilder{}
|
||||
builder.WriteString(`UPDATE zitadel.organizations SET `)
|
||||
|
@@ -67,7 +67,7 @@ func (o *orgDomain) Add(ctx context.Context, domain *domain.AddOrganizationDomai
|
||||
// Subtle: this method shadows the method ([domain.OrganizationRepository]).Update of orgDomain.org.
|
||||
func (o *orgDomain) Update(ctx context.Context, condition database.Condition, changes ...database.Change) (int64, error) {
|
||||
if len(changes) == 0 {
|
||||
return 0, database.NoChangesError
|
||||
return 0, database.ErrNoChanges
|
||||
}
|
||||
|
||||
var builder database.StatementBuilder
|
||||
|
@@ -600,7 +600,7 @@ func TestUpdateOrganizationDomain(t *testing.T) {
|
||||
condition: domainRepo.DomainCondition(database.TextOperationEqual, domainName),
|
||||
changes: []database.Change{},
|
||||
expected: 0,
|
||||
err: database.NoChangesError,
|
||||
err: database.ErrNoChanges,
|
||||
},
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user