From 4f8bce44441081f265765c2e932a2791537a6427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20=C3=9Cmit=20=C3=96zden?= Date: Tue, 31 Oct 2023 01:10:15 +0300 Subject: [PATCH] feat: Implement cacher and logger ports --- internal/core/app/app.go | 0 internal/core/ports/cacher.go | 13 +++++++++++++ internal/core/ports/logger.go | 12 ++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 internal/core/app/app.go create mode 100644 internal/core/ports/cacher.go create mode 100644 internal/core/ports/logger.go diff --git a/internal/core/app/app.go b/internal/core/app/app.go new file mode 100644 index 0000000..e69de29 diff --git a/internal/core/ports/cacher.go b/internal/core/ports/cacher.go new file mode 100644 index 0000000..2fc8ef2 --- /dev/null +++ b/internal/core/ports/cacher.go @@ -0,0 +1,13 @@ +package ports + +import ( + "context" + "time" +) + +type Cacher interface { + Get(ctx context.Context, key string) ([]byte, error) + Set(ctx context.Context, key string, val []byte, ttl time.Duration) error + Delete(ctx context.Context, key string) error + Flush(ctx context.Context) error +} diff --git a/internal/core/ports/logger.go b/internal/core/ports/logger.go new file mode 100644 index 0000000..0dbdc93 --- /dev/null +++ b/internal/core/ports/logger.go @@ -0,0 +1,12 @@ +package ports + +import "io" + +type Logger interface { + SetDebugLevel(dl bool) + SetWriter(w io.Writer) + Error(v ...any) + Info(v ...any) + Debug(v ...any) + Panic(v ...any) +}