From cab56b09049a5ea0d4a3e185f29193aa2edd6b09 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 23 Sep 2024 10:29:27 +1000 Subject: [PATCH] refactor: make encryption/dal internal (#2769) This continues the service split refactoring. --- backend/controller/encryption/{ => internal}/dal/dal.go | 8 ++++---- .../controller/encryption/{dal => }/internal/sql/db.go | 0 .../encryption/{dal => }/internal/sql/models.go | 0 .../encryption/{dal => }/internal/sql/querier.go | 0 .../encryption/{dal => }/internal/sql/queries.sql | 0 .../encryption/{dal => }/internal/sql/queries.sql.go | 0 backend/controller/encryption/service.go | 2 +- sqlc.yaml | 4 ++-- 8 files changed, 7 insertions(+), 7 deletions(-) rename backend/controller/encryption/{ => internal}/dal/dal.go (93%) rename backend/controller/encryption/{dal => }/internal/sql/db.go (100%) rename backend/controller/encryption/{dal => }/internal/sql/models.go (100%) rename backend/controller/encryption/{dal => }/internal/sql/querier.go (100%) rename backend/controller/encryption/{dal => }/internal/sql/queries.sql (100%) rename backend/controller/encryption/{dal => }/internal/sql/queries.sql.go (100%) diff --git a/backend/controller/encryption/dal/dal.go b/backend/controller/encryption/internal/dal/dal.go similarity index 93% rename from backend/controller/encryption/dal/dal.go rename to backend/controller/encryption/internal/dal/dal.go index 02cdc946ab..d967411a06 100644 --- a/backend/controller/encryption/dal/dal.go +++ b/backend/controller/encryption/internal/dal/dal.go @@ -5,14 +5,14 @@ import ( "fmt" "github.com/TBD54566975/ftl/backend/controller/encryption/api" - "github.com/TBD54566975/ftl/backend/controller/encryption/dal/internal/sql" + encryptionsql "github.com/TBD54566975/ftl/backend/controller/encryption/internal/sql" "github.com/TBD54566975/ftl/backend/libdal" "github.com/TBD54566975/ftl/internal/log" ) type DAL struct { *libdal.Handle[DAL] - db sql.Querier + db encryptionsql.Querier } func New(ctx context.Context, conn libdal.Connection) *DAL { @@ -20,10 +20,10 @@ func New(ctx context.Context, conn libdal.Connection) *DAL { Handle: libdal.New(conn, func(h *libdal.Handle[DAL]) *DAL { return &DAL{ Handle: h, - db: sql.New(h.Connection), + db: encryptionsql.New(h.Connection), } }), - db: sql.New(conn), + db: encryptionsql.New(conn), } } diff --git a/backend/controller/encryption/dal/internal/sql/db.go b/backend/controller/encryption/internal/sql/db.go similarity index 100% rename from backend/controller/encryption/dal/internal/sql/db.go rename to backend/controller/encryption/internal/sql/db.go diff --git a/backend/controller/encryption/dal/internal/sql/models.go b/backend/controller/encryption/internal/sql/models.go similarity index 100% rename from backend/controller/encryption/dal/internal/sql/models.go rename to backend/controller/encryption/internal/sql/models.go diff --git a/backend/controller/encryption/dal/internal/sql/querier.go b/backend/controller/encryption/internal/sql/querier.go similarity index 100% rename from backend/controller/encryption/dal/internal/sql/querier.go rename to backend/controller/encryption/internal/sql/querier.go diff --git a/backend/controller/encryption/dal/internal/sql/queries.sql b/backend/controller/encryption/internal/sql/queries.sql similarity index 100% rename from backend/controller/encryption/dal/internal/sql/queries.sql rename to backend/controller/encryption/internal/sql/queries.sql diff --git a/backend/controller/encryption/dal/internal/sql/queries.sql.go b/backend/controller/encryption/internal/sql/queries.sql.go similarity index 100% rename from backend/controller/encryption/dal/internal/sql/queries.sql.go rename to backend/controller/encryption/internal/sql/queries.sql.go diff --git a/backend/controller/encryption/service.go b/backend/controller/encryption/service.go index 896e3de39a..db97fbc98c 100644 --- a/backend/controller/encryption/service.go +++ b/backend/controller/encryption/service.go @@ -8,7 +8,7 @@ import ( "github.com/alecthomas/types/optional" "github.com/TBD54566975/ftl/backend/controller/encryption/api" - "github.com/TBD54566975/ftl/backend/controller/encryption/dal" + "github.com/TBD54566975/ftl/backend/controller/encryption/internal/dal" "github.com/TBD54566975/ftl/backend/libdal" ) diff --git a/sqlc.yaml b/sqlc.yaml index f1b2df3955..04c723e5a4 100644 --- a/sqlc.yaml +++ b/sqlc.yaml @@ -175,11 +175,11 @@ sql: out: "backend/controller/leases/dal/internal/sql" - <<: *daldir queries: - - backend/controller/encryption/dal/internal/sql/queries.sql + - backend/controller/encryption/internal/sql/queries.sql gen: go: <<: *gengo - out: "backend/controller/encryption/dal/internal/sql" + out: "backend/controller/encryption/internal/sql" - <<: *daldir queries: - backend/controller/timeline/internal/sql/queries.sql