refact: to use go-dbw CreateItems, DeleteItems (#4974)

* refact: to use go-dbw CreateItems, DeleteItems

Latest version of go-dbw updated the signature of
CreateItems(...) and DeleteItems(...) on a happy
note this latest version of go-dbw actually does
batch inserts and updates for this functions.

* all: regenerate protos with new protoc-gen-go version
This commit is contained in:
Jim authored and GitHub committed 2024-08-01 11:18:53 -04:00
1 parent b24f6dcee8
commit 28b465e4b8
167 files changed
+2254 -2248

No files matched your search

+2 -2
View File
@@ -455,7 +455,7 @@ func setWorkerTags(ctx context.Context, w db.Writer, id string, ts TagSource, ta
// Otherwise, go through and stage each tuple for insertion
// below.
if len(tags) > 0 {
uTags := make([]any, 0, len(tags))
uTags := make([]*store.WorkerTag, 0, len(tags))
for _, v := range tags {
if v == nil {
return errors.New(ctx, errors.InvalidParameter, op, fmt.Sprintf("found nil tag value for worker %s", id))
@@ -822,7 +822,7 @@ func (r *Repository) DeleteWorkerTags(ctx context.Context, workerId string, work
}
rowsDeleted := 0
deleteTags := make([]any, 0, len(tags))
deleteTags := make([]*store.WorkerTag, 0, len(tags))
for _, t := range tags {
if t == nil {
return db.NoRowsAffected, errors.New(ctx, errors.InvalidParameter, op, "found nil tag value in input")
+3 -3
View File
@@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: controller/storage/servers/store/v1/controller.proto
@@ -158,7 +158,7 @@ func file_controller_storage_servers_store_v1_controller_proto_rawDescGZIP() []b
}
var file_controller_storage_servers_store_v1_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_controller_storage_servers_store_v1_controller_proto_goTypes = []interface{}{
var file_controller_storage_servers_store_v1_controller_proto_goTypes = []any{
(*Controller)(nil), // 0: controller.storage.servers.store.v1.Controller
(*timestamp.Timestamp)(nil), // 1: controller.storage.timestamp.v1.Timestamp
}
@@ -178,7 +178,7 @@ func file_controller_storage_servers_store_v1_controller_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_controller_storage_servers_store_v1_controller_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_controller_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Controller); i {
case 0:
return &v.state
+4 -4
View File
@@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: controller/storage/servers/store/v1/root_certificate.proto
@@ -289,7 +289,7 @@ func file_controller_storage_servers_store_v1_root_certificate_proto_rawDescGZIP
}
var file_controller_storage_servers_store_v1_root_certificate_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_controller_storage_servers_store_v1_root_certificate_proto_goTypes = []interface{}{
var file_controller_storage_servers_store_v1_root_certificate_proto_goTypes = []any{
(*CertificateAuthority)(nil), // 0: controller.storage.servers.store.v1.CertificateAuthority
(*RootCertificate)(nil), // 1: controller.storage.servers.store.v1.RootCertificate
(*timestamp.Timestamp)(nil), // 2: controller.storage.timestamp.v1.Timestamp
@@ -310,7 +310,7 @@ func file_controller_storage_servers_store_v1_root_certificate_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_controller_storage_servers_store_v1_root_certificate_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_root_certificate_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*CertificateAuthority); i {
case 0:
return &v.state
@@ -322,7 +322,7 @@ func file_controller_storage_servers_store_v1_root_certificate_proto_init() {
return nil
}
}
file_controller_storage_servers_store_v1_root_certificate_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_root_certificate_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*RootCertificate); i {
case 0:
return &v.state
+5 -5
View File
@@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: controller/storage/servers/store/v1/worker.proto
@@ -482,7 +482,7 @@ func file_controller_storage_servers_store_v1_worker_proto_rawDescGZIP() []byte
}
var file_controller_storage_servers_store_v1_worker_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_controller_storage_servers_store_v1_worker_proto_goTypes = []interface{}{
var file_controller_storage_servers_store_v1_worker_proto_goTypes = []any{
(*Worker)(nil), // 0: controller.storage.servers.store.v1.Worker
(*WorkerTag)(nil), // 1: controller.storage.servers.store.v1.WorkerTag
(*WorkerStorageBucketCredentialState)(nil), // 2: controller.storage.servers.store.v1.WorkerStorageBucketCredentialState
@@ -506,7 +506,7 @@ func file_controller_storage_servers_store_v1_worker_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_controller_storage_servers_store_v1_worker_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_worker_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*Worker); i {
case 0:
return &v.state
@@ -518,7 +518,7 @@ func file_controller_storage_servers_store_v1_worker_proto_init() {
return nil
}
}
file_controller_storage_servers_store_v1_worker_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_worker_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*WorkerTag); i {
case 0:
return &v.state
@@ -530,7 +530,7 @@ func file_controller_storage_servers_store_v1_worker_proto_init() {
return nil
}
}
file_controller_storage_servers_store_v1_worker_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_worker_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*WorkerStorageBucketCredentialState); i {
case 0:
return &v.state
+5 -5
View File
@@ -3,7 +3,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc-gen-go v1.34.2
// protoc (unknown)
// source: controller/storage/servers/store/v1/worker_auth.proto
@@ -433,7 +433,7 @@ func file_controller_storage_servers_store_v1_worker_auth_proto_rawDescGZIP() []
}
var file_controller_storage_servers_store_v1_worker_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_controller_storage_servers_store_v1_worker_auth_proto_goTypes = []interface{}{
var file_controller_storage_servers_store_v1_worker_auth_proto_goTypes = []any{
(*WorkerAuth)(nil), // 0: controller.storage.servers.store.v1.WorkerAuth
(*WorkerCertBundle)(nil), // 1: controller.storage.servers.store.v1.WorkerCertBundle
(*WorkerAuthServerLedActivationToken)(nil), // 2: controller.storage.servers.store.v1.WorkerAuthServerLedActivationToken
@@ -455,7 +455,7 @@ func file_controller_storage_servers_store_v1_worker_auth_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_controller_storage_servers_store_v1_worker_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_worker_auth_proto_msgTypes[0].Exporter = func(v any, i int) any {
switch v := v.(*WorkerAuth); i {
case 0:
return &v.state
@@ -467,7 +467,7 @@ func file_controller_storage_servers_store_v1_worker_auth_proto_init() {
return nil
}
}
file_controller_storage_servers_store_v1_worker_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_worker_auth_proto_msgTypes[1].Exporter = func(v any, i int) any {
switch v := v.(*WorkerCertBundle); i {
case 0:
return &v.state
@@ -479,7 +479,7 @@ func file_controller_storage_servers_store_v1_worker_auth_proto_init() {
return nil
}
}
file_controller_storage_servers_store_v1_worker_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
file_controller_storage_servers_store_v1_worker_auth_proto_msgTypes[2].Exporter = func(v any, i int) any {
switch v := v.(*WorkerAuthServerLedActivationToken); i {
case 0:
return &v.state
+2 -2
View File
@@ -131,7 +131,7 @@ func TestKmsWorker(t *testing.T, conn *db.DB, wrapper wrapping.Wrapper, opt ...O
require.Equal(t, "kms", wrk.Type)
if len(opts.withWorkerTags) > 0 {
var tags []any
var tags []*store.WorkerTag
for _, t := range opts.withWorkerTags {
tags = append(tags, &store.WorkerTag{
WorkerId: wrk.GetPublicId(),
@@ -170,7 +170,7 @@ func TestPkiWorker(t *testing.T, conn *db.DB, wrapper wrapping.Wrapper, opt ...O
require.NotNil(t, wrk)
if len(opts.withWorkerTags) > 0 {
var tags []any
var tags []*store.WorkerTag
for _, t := range opts.withWorkerTags {
tags = append(tags, &store.WorkerTag{
WorkerId: wrk.GetPublicId(),