From f42bc60311e34a042776726521a217b44059b07a Mon Sep 17 00:00:00 2001 From: ZueffC Date: Tue, 7 Jan 2025 22:48:45 +0300 Subject: [PATCH] First try to add DI --- dns_manager.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/dns_manager.go b/dns_manager.go index 1fdf978..dd3ae53 100644 --- a/dns_manager.go +++ b/dns_manager.go @@ -18,14 +18,22 @@ type Record struct { TTL uint16 } -type Response struct { +type Actions interface { + AddRecord(Record) response + DeleteRecord() response + UpdateRecord(Record) response + ReadRecords() (error, *[]Record) +} + +type Manager interface { + New() *Actions +} + +type response struct { error string message string } -type Actions interface { - AddRecord(Record) Response - DeleteRecord() Response - UpdateRecord(Record) Response - ReadRecords() (error, *[]Record) +func New(manager_config Manager) *Actions { + return manager_config.New() }