Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade ptypes.TimestampProto to timestamppb.New #492

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions db/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"fmt"
"time"

"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/google/uuid"
"github.com/pkg/errors"
tb "github.com/tinkerbell/tink/protos/template"
wflow "github.com/tinkerbell/tink/workflow"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
)

// CreateTemplate creates a new workflow template
Expand Down Expand Up @@ -83,8 +83,8 @@ func (d TinkDB) GetTemplate(ctx context.Context, fields map[string]string, delet
)
err = row.Scan(&id, &name, &data, &createdAt, &updatedAt)
if err == nil {
crAt, _ := ptypes.TimestampProto(createdAt)
upAt, _ := ptypes.TimestampProto(updatedAt)
crAt := timestamppb.New(createdAt)
upAt := timestamppb.New(updatedAt)
return &tb.WorkflowTemplate{
Id: id,
Name: name,
Expand Down Expand Up @@ -160,8 +160,8 @@ func (d TinkDB) ListTemplates(filter string, fn func(id, n string, in, del *time
return err
}

tCr, _ := ptypes.TimestampProto(createdAt)
tUp, _ := ptypes.TimestampProto(updatedAt)
tCr := timestamppb.New(createdAt)
tUp := timestamppb.New(updatedAt)
err = fn(id, name, tCr, tUp)
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions db/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import (
"strings"
"time"

"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/google/uuid"
"github.com/pkg/errors"
pb "github.com/tinkerbell/tink/protos/workflow"
wflow "github.com/tinkerbell/tink/workflow"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/timestamppb"
)

// Workflow represents a workflow instance in database
Expand Down Expand Up @@ -351,8 +351,8 @@ func (d TinkDB) GetWorkflow(ctx context.Context, id string) (Workflow, error) {
)
err := row.Scan(&tmp, &tar, &crAt, &upAt)
if err == nil {
createdAt, _ := ptypes.TimestampProto(crAt)
updatedAt, _ := ptypes.TimestampProto(upAt)
createdAt := timestamppb.New(crAt)
updatedAt := timestamppb.New(upAt)
return Workflow{
ID: id,
Template: tmp,
Expand Down Expand Up @@ -449,8 +449,8 @@ func (d TinkDB) ListWorkflows(fn func(wf Workflow) error) error {
Template: tmp,
Hardware: tar,
}
wf.CreatedAt, _ = ptypes.TimestampProto(crAt)
wf.UpdatedAt, _ = ptypes.TimestampProto(upAt)
wf.CreatedAt = timestamppb.New(crAt)
wf.UpdatedAt = timestamppb.New(upAt)
err = fn(wf)
if err != nil {
return err
Expand Down Expand Up @@ -645,7 +645,7 @@ func (d TinkDB) ShowWorkflowEvents(wfID string, fn func(wfs *pb.WorkflowActionSt
d.logger.Error(err)
return err
}
createdAt, _ := ptypes.TimestampProto(evTime)
createdAt := timestamppb.New(evTime)
wfs := &pb.WorkflowActionStatus{
WorkerId: id,
TaskName: tName,
Expand Down