Documentation
¶
Overview ¶
Package config provides generic configuration interfaces and adapters.
Package config provides generic configuration interfaces that can be used across different applications.
Package config provides generic configuration interfaces that can be used across different applications.
Index ¶
- type AppConfig
- type AppConfigProvider
- type Config
- type ConfigInterface
- type DatabaseConfig
- type DatabaseConfigProvider
- type GenericAppConfigAdapter
- type GenericConfigAdapter
- func (a *GenericConfigAdapter[T]) GetApp() AppConfig
- func (a *GenericConfigAdapter[T]) GetDatabase() DatabaseConfig
- func (a *GenericConfigAdapter[T]) WithAppEnvironment(env string) *GenericConfigAdapter[T]
- func (a *GenericConfigAdapter[T]) WithAppName(name string) *GenericConfigAdapter[T]
- func (a *GenericConfigAdapter[T]) WithDatabaseName(name string) *GenericConfigAdapter[T]
- type GenericDatabaseConfigAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig = interfaces.AppConfig
AppConfig is an alias for interfaces.AppConfig for backward compatibility
type AppConfigProvider ¶
type AppConfigProvider interface {
// GetAppVersion returns the application version
GetAppVersion() string
// GetAppName returns the application name (optional)
GetAppName() string
// GetAppEnvironment returns the application environment (optional)
GetAppEnvironment() string
}
AppConfigProvider defines the interface for accessing application configuration
type Config ¶
type Config = interfaces.Config
Config is an alias for interfaces.Config for backward compatibility
type ConfigInterface ¶
type ConfigInterface interface {
// GetApp returns the App configuration
GetApp() interface{}
// GetDatabase returns the Database configuration
GetDatabase() interface{}
}
ConfigInterface is an interface for configuration Deprecated: Use Config interface instead
type DatabaseConfig ¶
type DatabaseConfig = interfaces.DatabaseConfig
DatabaseConfig is an alias for interfaces.DatabaseConfig for backward compatibility
type DatabaseConfigProvider ¶
type DatabaseConfigProvider interface {
// GetDatabaseType returns the database type
GetDatabaseType() string
// GetDatabaseConnectionString returns the database connection string
GetDatabaseConnectionString(dbType string) string
}
DatabaseConfigProvider defines the interface for accessing database configuration
type GenericAppConfigAdapter ¶
type GenericAppConfigAdapter[T any] struct { // contains filtered or unexported fields }
GenericAppConfigAdapter is a generic adapter for application configuration
func (*GenericAppConfigAdapter[T]) GetEnvironment ¶
func (a *GenericAppConfigAdapter[T]) GetEnvironment() string
GetEnvironment returns the application environment
func (*GenericAppConfigAdapter[T]) GetName ¶
func (a *GenericAppConfigAdapter[T]) GetName() string
GetName returns the application name
func (*GenericAppConfigAdapter[T]) GetVersion ¶
func (a *GenericAppConfigAdapter[T]) GetVersion() string
GetVersion returns the application version
type GenericConfigAdapter ¶
type GenericConfigAdapter[T any] struct { // contains filtered or unexported fields }
GenericConfigAdapter is a generic adapter for any config type that provides the necessary methods
func NewGenericConfigAdapter ¶
func NewGenericConfigAdapter[T any](cfg T) *GenericConfigAdapter[T]
NewGenericConfigAdapter creates a new GenericConfigAdapter with default values
func (*GenericConfigAdapter[T]) GetApp ¶
func (a *GenericConfigAdapter[T]) GetApp() AppConfig
GetApp returns the application configuration
func (*GenericConfigAdapter[T]) GetDatabase ¶
func (a *GenericConfigAdapter[T]) GetDatabase() DatabaseConfig
GetDatabase returns the database configuration
func (*GenericConfigAdapter[T]) WithAppEnvironment ¶
func (a *GenericConfigAdapter[T]) WithAppEnvironment(env string) *GenericConfigAdapter[T]
WithAppEnvironment sets the application environment
func (*GenericConfigAdapter[T]) WithAppName ¶
func (a *GenericConfigAdapter[T]) WithAppName(name string) *GenericConfigAdapter[T]
WithAppName sets the application name
func (*GenericConfigAdapter[T]) WithDatabaseName ¶
func (a *GenericConfigAdapter[T]) WithDatabaseName(name string) *GenericConfigAdapter[T]
WithDatabaseName sets the database name
type GenericDatabaseConfigAdapter ¶
type GenericDatabaseConfigAdapter[T any] struct { // contains filtered or unexported fields }
GenericDatabaseConfigAdapter is a generic adapter for database configuration
func (*GenericDatabaseConfigAdapter[T]) GetCollectionName ¶
func (a *GenericDatabaseConfigAdapter[T]) GetCollectionName(entityType string) string
GetCollectionName returns the collection/table name for a given entity type
func (*GenericDatabaseConfigAdapter[T]) GetConnectionString ¶
func (a *GenericDatabaseConfigAdapter[T]) GetConnectionString() string
GetConnectionString returns the database connection string
func (*GenericDatabaseConfigAdapter[T]) GetDatabaseName ¶
func (a *GenericDatabaseConfigAdapter[T]) GetDatabaseName() string
GetDatabaseName returns the database name
func (*GenericDatabaseConfigAdapter[T]) GetType ¶
func (a *GenericDatabaseConfigAdapter[T]) GetType() string
GetType returns the database type
Directories
¶
| Path | Synopsis |
|---|---|
|
Package interfaces provides generic configuration interfaces that can be used across different applications.
|
Package interfaces provides generic configuration interfaces that can be used across different applications. |
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |