mirror of
https://github.com/harness/drone.git
synced 2025-05-05 00:30:05 +08:00
remove tx from list
This commit is contained in:
parent
2b633f9fd8
commit
2d91d3acf1
@ -9,7 +9,6 @@ import (
|
||||
|
||||
apiauth "github.com/harness/gitness/internal/api/auth"
|
||||
"github.com/harness/gitness/internal/auth"
|
||||
"github.com/harness/gitness/store/database/dbtx"
|
||||
"github.com/harness/gitness/types"
|
||||
"github.com/harness/gitness/types/enum"
|
||||
)
|
||||
@ -34,18 +33,16 @@ func (c *Controller) ListConnectors(
|
||||
var count int64
|
||||
var connectors []*types.Connector
|
||||
|
||||
err = dbtx.New(c.db).WithTx(ctx, func(ctx context.Context) (err error) {
|
||||
count, err = c.connectorStore.Count(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to count child executions: %w", err)
|
||||
}
|
||||
count, err = c.connectorStore.Count(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return nil, 0, fmt.Errorf("failed to count child executions: %w", err)
|
||||
}
|
||||
|
||||
connectors, err = c.connectorStore.List(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return nil, 0, fmt.Errorf("failed to list child executions: %w", err)
|
||||
}
|
||||
|
||||
connectors, err = c.connectorStore.List(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list child executions: %w", err)
|
||||
}
|
||||
return
|
||||
}, dbtx.TxDefaultReadOnly)
|
||||
if err != nil {
|
||||
return connectors, count, fmt.Errorf("failed to list connectors: %w", err)
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
|
||||
apiauth "github.com/harness/gitness/internal/api/auth"
|
||||
"github.com/harness/gitness/internal/auth"
|
||||
"github.com/harness/gitness/store/database/dbtx"
|
||||
"github.com/harness/gitness/types"
|
||||
"github.com/harness/gitness/types/enum"
|
||||
)
|
||||
@ -34,20 +33,14 @@ func (c *Controller) ListTemplates(
|
||||
var count int64
|
||||
var templates []*types.Template
|
||||
|
||||
err = dbtx.New(c.db).WithTx(ctx, func(ctx context.Context) (err error) {
|
||||
count, err = c.templateStore.Count(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to count child executions: %w", err)
|
||||
}
|
||||
|
||||
templates, err = c.templateStore.List(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list child executions: %w", err)
|
||||
}
|
||||
return
|
||||
}, dbtx.TxDefaultReadOnly)
|
||||
count, err = c.templateStore.Count(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return templates, count, fmt.Errorf("failed to list templates: %w", err)
|
||||
return nil, 0, fmt.Errorf("failed to count templates in the space: %w", err)
|
||||
}
|
||||
|
||||
templates, err = c.templateStore.List(ctx, space.ID, filter)
|
||||
if err != nil {
|
||||
return nil, 0, fmt.Errorf("failed to list templates: %w", err)
|
||||
}
|
||||
|
||||
return templates, count, nil
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
|
||||
apiauth "github.com/harness/gitness/internal/api/auth"
|
||||
"github.com/harness/gitness/internal/auth"
|
||||
"github.com/harness/gitness/store/database/dbtx"
|
||||
"github.com/harness/gitness/types"
|
||||
"github.com/harness/gitness/types/enum"
|
||||
)
|
||||
@ -35,24 +34,14 @@ func (c *Controller) List(
|
||||
return nil, 0, fmt.Errorf("failed to authorize: %w", err)
|
||||
}
|
||||
|
||||
var count int64
|
||||
var triggers []*types.Trigger
|
||||
|
||||
err = dbtx.New(c.db).WithTx(ctx, func(ctx context.Context) (err error) {
|
||||
count, err = c.triggerStore.Count(ctx, pipeline.ID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to count child triggers: %w", err)
|
||||
}
|
||||
|
||||
triggers, err = c.triggerStore.List(ctx, pipeline.ID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to list child triggers: %w", err)
|
||||
}
|
||||
|
||||
return
|
||||
}, dbtx.TxDefaultReadOnly)
|
||||
count, err := c.triggerStore.Count(ctx, pipeline.ID, filter)
|
||||
if err != nil {
|
||||
return triggers, count, fmt.Errorf("failed to fetch list: %w", err)
|
||||
return nil, 0, fmt.Errorf("failed to count child triggers: %w", err)
|
||||
}
|
||||
|
||||
triggers, err := c.triggerStore.List(ctx, pipeline.ID, filter)
|
||||
if err != nil {
|
||||
return nil, 0, fmt.Errorf("failed to list child triggers: %w", err)
|
||||
}
|
||||
|
||||
return triggers, count, nil
|
||||
|
Loading…
Reference in New Issue
Block a user