Skip to content

Commit

Permalink
feat: add bcs-task mysql store add createdAt
Browse files Browse the repository at this point in the history
  • Loading branch information
ifooth committed Oct 24, 2024
1 parent 86c8306 commit 14ff909
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
version: v1.61.0
args: --timeout=30m
working-directory: bcs-services/bcs-webconsole
bcs-monitor:
Expand All @@ -38,7 +38,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
version: v1.61.0
args: --timeout=30m
working-directory: bcs-services/bcs-monitor
bcs-bscp:
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
version: v1.61.0
args: --timeout=30m --out-format=colored-line-number
working-directory: bcs-services/bcs-project-manager
bcs-user-manager:
Expand All @@ -139,7 +139,7 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
args: --timeout=30m
args: --timeout=30m --out-format=colored-line-number
working-directory: bcs-services/bcs-user-manager
bcs-cluster-resources:
name: bcs-cluster-resources
Expand All @@ -158,7 +158,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
version: v1.61.0
args: --timeout=30m
working-directory: bcs-services/cluster-resources

Expand All @@ -179,7 +179,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
version: v1.61.0
args: --timeout=30m
working-directory: bcs-common/common/task
- name: Test
Expand Down
4 changes: 2 additions & 2 deletions bcs-common/common/task/stores/iface/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type ListOption struct {
CurrentStep string
Status string
Creator string
StartGte *time.Time // StartGte start time greater or equal to
StartLte *time.Time // StartLte start time less or equal to
CreatedGte *time.Time // CreatedGte create time greater or equal to
CreatedLte *time.Time // CreatedLte create time less or equal to
Sort map[string]int // Sort map for sort list results
Offset int64 // Offset offset for list results
Limit int64 // Limit limit for list results
Expand Down
3 changes: 2 additions & 1 deletion bcs-common/common/task/stores/mysql/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ func toTask(task *TaskRecord, steps []*StepRecord) *types.Task {
End: task.End,
ExecutionTime: task.ExecutionTime,
MaxExecutionSeconds: task.MaxExecutionSeconds,
Creator: task.Creator,
CreatedAt: task.CreatedAt,
LastUpdate: task.UpdatedAt,
Creator: task.Creator,
Updater: task.Updater,
}

Expand Down
8 changes: 4 additions & 4 deletions bcs-common/common/task/stores/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ func (s *mysqlStore) ListTask(ctx context.Context, opt *iface.ListOption) (*ifac
})

// mysql store 使用创建时间过滤
if opt.StartGte != nil {
tx = tx.Where("created_at >= ?", opt.StartGte)
if opt.CreatedGte != nil {
tx = tx.Where("created_at >= ?", opt.CreatedGte)
}
if opt.StartLte != nil {
tx = tx.Where("created_at <= ?", opt.StartLte)
if opt.CreatedLte != nil {
tx = tx.Where("created_at <= ?", opt.CreatedLte)
}

// 只使用id排序
Expand Down
1 change: 1 addition & 0 deletions bcs-common/common/task/types/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type Task struct {
Updater string `json:"updater"`
Start time.Time `json:"start"`
End time.Time `json:"end"`
CreatedAt time.Time `json:"createdAt"`
LastUpdate time.Time `json:"lastUpdate"`
}

Expand Down
4 changes: 2 additions & 2 deletions bcs-services/bcs-user-manager/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ func parseConfig(op *options.UserManagerOptions) (*config.UserMgrConfig, error)

// RedisDSN 没有配置,检查 RedisConfig
if userMgrConfig.RedisDSN == "" {
redisConfig, err := parseRedisConfig(op.RedisConfig)
redisConfig, aErr := parseRedisConfig(op.RedisConfig)
if err != nil {
return nil, fmt.Errorf("error parsing redis config and exit: %s", err.Error())
return nil, fmt.Errorf("error parsing redis config and exit: %s", aErr.Error())
}
userMgrConfig.RedisConfig = redisConfig
}
Expand Down

0 comments on commit 14ff909

Please sign in to comment.