From 3a40c83017c11e279c02bd242c7de93853040094 Mon Sep 17 00:00:00 2001 From: Snider Date: Tue, 28 Oct 2025 12:06:24 +0000 Subject: [PATCH] Refactor service documentation to standardize naming conventions and improve clarity Signed-off-by: Snider --- config/config.go | 26 ++++++++++++------------- crypt/crypt.go | 34 ++++++++++++++++++++++++++++----- display/display.go | 16 ++++++++++------ go.work | 2 +- help/help.go | 14 +++++++++----- i18n/i18n.go | 19 +++++++++++------- io/io.go | 24 ----------------------- pkg/io/{filesystem.go => io.go} | 0 workspace/workspace.go | 24 +++++++++++++++++------ 9 files changed, 92 insertions(+), 67 deletions(-) delete mode 100644 io/io.go rename pkg/io/{filesystem.go => io.go} (100%) diff --git a/config/config.go b/config/config.go index 12b6e429..67c5ed43 100644 --- a/config/config.go +++ b/config/config.go @@ -1,4 +1,4 @@ -// package config provides the public API for the Config service. +// package config provides the public API for the config service. package config import ( @@ -9,19 +9,19 @@ import ( "github.com/Snider/Core/pkg/core" ) -// Service is the public type for the Config service. It is a type alias +// New is a public function that points to the real function in the implementation package. +var New = impl.New + +// Register is a public function that points to the real function in the implementation package. +var Register = impl.Register + +// Options is the public type for the Options service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Options = impl.Options + +// Service is the public type for the Service service. It is a type alias // to the underlying implementation, making it transparent to the user. type Service = impl.Service -// Options is the public type for the Config service options. -type Options = impl.Options - -// New is the public constructor for the Config service. It is a variable -// that points to the real constructor in the implementation package. -var New = impl.New - -// Register is the public factory for the dynamic core.WithService pattern. -var Register = impl.Register - -// Config is the public interface for the Config service. +// Config is the public interface for the config service. type Config = core.Config diff --git a/crypt/crypt.go b/crypt/crypt.go index 7f5b4588..ba0328d4 100644 --- a/crypt/crypt.go +++ b/crypt/crypt.go @@ -1,4 +1,4 @@ -// package crypt provides the public API for the Crypt service. +// package crypt provides the public API for the crypt service. package crypt import ( @@ -9,14 +9,38 @@ import ( "github.com/Snider/Core/pkg/core" ) -// Service is the public type for the Crypt service. +// Service is the public type for the Service service. It is a type alias +// to the underlying implementation, making it transparent to the user. type Service = impl.Service -// New is the public constructor for the Crypt service. +// Options is the public type for the Options service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Options = impl.Options + +// HashType is the public type for the HashType service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type HashType = impl.HashType + +// LTHN is a public constant that points to the real constant in the implementation package. +const LTHN = impl.LTHN + +// SHA512 is a public constant that points to the real constant in the implementation package. +const SHA512 = impl.SHA512 + +// SHA256 is a public constant that points to the real constant in the implementation package. +const SHA256 = impl.SHA256 + +// SHA1 is a public constant that points to the real constant in the implementation package. +const SHA1 = impl.SHA1 + +// MD5 is a public constant that points to the real constant in the implementation package. +const MD5 = impl.MD5 + +// New is a public function that points to the real function in the implementation package. var New = impl.New -// Register is the public factory for the dynamic core.WithService pattern. +// Register is a public function that points to the real function in the implementation package. var Register = impl.Register -// Crypt is the public interface for the Crypt service. +// Crypt is the public interface for the crypt service. type Crypt = core.Crypt diff --git a/display/display.go b/display/display.go index 37d9b6a9..f78af7fb 100644 --- a/display/display.go +++ b/display/display.go @@ -1,23 +1,27 @@ -// Package display provides the public API for the Display service. +// package display provides the public API for the display service. package display import ( // Import the internal implementation with an alias. impl "github.com/Snider/Core/pkg/display" + // Import the core contracts to re-export the interface. "github.com/Snider/Core/pkg/core" ) -// Service is the public type for the Display service. It is a type alias +// Options is the public type for the Options service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Options = impl.Options + +// Service is the public type for the Service service. It is a type alias // to the underlying implementation, making it transparent to the user. type Service = impl.Service -// New is the public constructor for the Display service. It is a variable -// that points to the real constructor in the implementation package. +// New is a public function that points to the real function in the implementation package. var New = impl.New -// Register is the public factory for the dynamic core.WithService pattern. +// Register is a public function that points to the real function in the implementation package. var Register = impl.Register -// Display is the public interface for the Display service. +// Display is the public interface for the display service. type Display = core.Display diff --git a/go.work b/go.work index fd9ef8c7..5db5bbcf 100644 --- a/go.work +++ b/go.work @@ -4,5 +4,5 @@ use ( . ./cmd/core ./cmd/core-gui - ./cmd/core-static-di + ./cmd/examples/core-static-di ) diff --git a/help/help.go b/help/help.go index bdb2929f..371f47b6 100644 --- a/help/help.go +++ b/help/help.go @@ -1,4 +1,4 @@ -// package help provides the public API for the Help service. +// package help provides the public API for the help service. package help import ( @@ -9,15 +9,19 @@ import ( "github.com/Snider/Core/pkg/core" ) -// Service is the public type for the Help service. It is a type alias +// Options is the public type for the Options service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Options = impl.Options + +// Service is the public type for the Service service. It is a type alias // to the underlying implementation, making it transparent to the user. type Service = impl.Service -// New is the public constructor for the Help service. +// New is a public function that points to the real function in the implementation package. var New = impl.New -// Register is the public factory for the dynamic core.WithService pattern. +// Register is a public function that points to the real function in the implementation package. var Register = impl.Register -// Help is the public interface for the Help service. +// Help is the public interface for the help service. type Help = core.Help diff --git a/i18n/i18n.go b/i18n/i18n.go index 100040c8..bfea9b75 100644 --- a/i18n/i18n.go +++ b/i18n/i18n.go @@ -1,4 +1,4 @@ -// package i18n provides the public API for the I18n service. +// package i18n provides the public API for the i18n service. package i18n import ( @@ -9,14 +9,19 @@ import ( "github.com/Snider/Core/pkg/core" ) -// Service is the public type for the I18n service. -type Service = impl.Service - -// New is the public factory for the core.WithService pattern. +// New is a public function that points to the real function in the implementation package. var New = impl.New -// Register is the public factory for the dynamic core.WithService pattern. +// Register is a public function that points to the real function in the implementation package. var Register = impl.Register -// I18n is the public interface for the I18n service. +// Options is the public type for the Options service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Options = impl.Options + +// Service is the public type for the Service service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Service = impl.Service + +// I18n is the public interface for the i18n service. type I18n = core.I18n diff --git a/io/io.go b/io/io.go deleted file mode 100644 index 0be9a714..00000000 --- a/io/io.go +++ /dev/null @@ -1,24 +0,0 @@ -// package io provides a unified interface for interacting with different filesystems. -package io - -import ( - // Import the internal implementation with an alias. - impl "github.com/Snider/Core/pkg/io" - "github.com/Snider/Core/pkg/io/sftp" - "github.com/Snider/Core/pkg/io/webdav" -) - -// Medium is the standard interface for a storage backend. -type Medium = impl.Medium - -// Expose the factory functions for creating different media. -var ( - NewSFTPMedium = impl.NewSFTPMedium - NewWebDAVMedium = impl.NewWebDAVMedium -) - -// Expose the connection config structs for convenience. -type ( - SFTPConnectionConfig = sftp.ConnectionConfig - WebDAVConnectionConfig = webdav.ConnectionConfig -) diff --git a/pkg/io/filesystem.go b/pkg/io/io.go similarity index 100% rename from pkg/io/filesystem.go rename to pkg/io/io.go diff --git a/workspace/workspace.go b/workspace/workspace.go index 7db7df09..60bc0eeb 100644 --- a/workspace/workspace.go +++ b/workspace/workspace.go @@ -1,19 +1,31 @@ -// Package workspace package workspace provides the public API for the Workspace service. +// package workspace provides the public API for the workspace service. package workspace import ( // Import the internal implementation with an alias. impl "github.com/Snider/Core/pkg/workspace" + + // Import the core contracts to re-export the interface. + "github.com/Snider/Core/pkg/core" ) -// Service is the public type for the Workspace service. +// Options is the public type for the Options service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Options = impl.Options + +// Workspace is the public type for the Workspace service. It is a type alias +// to the underlying implementation, making it transparent to the user. +type Workspace = impl.Workspace + +// Service is the public type for the Service service. It is a type alias +// to the underlying implementation, making it transparent to the user. type Service = impl.Service -// New is the public factory for the core.WithService pattern. +// New is a public function that points to the real function in the implementation package. var New = impl.New -// Register is the public factory for the dynamic core.WithService pattern. +// Register is a public function that points to the real function in the implementation package. var Register = impl.Register -// Workspace is the public interface for the Workspace service. -type Workspace = impl.Workspace +// Workspace is the public interface for the workspace service. +type Workspace = core.Workspace