Documentation ¶
Index ¶
- Constants
- Variables
- type BackendConfig
- type BookmarkManagerConfig
- type BookmarkRepositoryConfig
- type Config
- type ConfigManager
- func (m *ConfigManager) GetDefaultDBConfig() DBConfig
- func (m *ConfigManager) GetDefaultSettings() map[string]any
- func (m *ConfigManager) NewBackendFromConfig() *backend.Backend
- func (m *ConfigManager) NewBookmarkManagerFromConfig(logger *log.Logger, repo repository.BookmarkRepository) libbookmarks.BookmarkManager
- func (m *ConfigManager) NewBookmarkRepositoryFromConfig(logger *log.Logger, repoDB *sql.DB, tagRepository repository.TagRepository) repository.BookmarkRepository
- func (m *ConfigManager) NewDBFromConfig() *sql.DB
- func (m *ConfigManager) NewDocumentContentManagerFromConfig(logger *log.Logger, repo repository.DocumentContentRepository) libdocuments.DocumentContentManager
- func (m *ConfigManager) NewDocumentContentRepositoryFromConfig(logger *log.Logger, fs afero.Fs) repository.DocumentContentRepository
- func (m *ConfigManager) NewDocumentManagerFromConfig(logger *log.Logger, repo repository.DocumentRepository) libdocuments.DocumentManager
- func (m *ConfigManager) NewDocumentRepositoryFromConfig(logger *log.Logger, repoDB *sql.DB, tagRepository repository.TagRepository) repository.DocumentRepository
- func (m *ConfigManager) NewTagsManagerFromConfig(logger *log.Logger, repo repository.TagRepository) libtags.TagManager
- func (m *ConfigManager) NewTagsRepositoryFromConfig(logger *log.Logger, repoDB *sql.DB) repository.TagRepository
- type DBConfig
- type DocumentContentManagerConfig
- type DocumentContentRepositoryConfig
- type DocumentManagerConfig
- type DocumentRepositoryConfig
- type HooksConfig
- type TagsManagerConfig
- type TagsRepositoryConfig
Constants ¶
View Source
const ( ValidatorLogrusLogLevel = "logrus_log_level" ValidateDBDriver = "db_driver" ValidatorBookmarkManager = "bookmark_manager" ValidatorTagsManager = "tags_manager" ValidatorDocumentManager = "document_manager" ValidatorDocumentContentManager = "document_content_manager" ValidatorBookmarkRepository = "bookmark_repository" ValidatorTagsRepository = "tags_repository" ValidatorDocumentRepository = "document_repository" ValidatorDocumentContentRepository = "document_content_repository" ValidatorHooks = "hooks" ValidatorHookPoint = "hook_point" ValidatorHook = "hook" )
View Source
const ( LogFile = "log_file" ConsoleLogLevel = "console_log_level" FileLogLevel = "file_log_level" DB = "db" DB_Driver = DB + ".driver" DB_DataSource = DB + ".data_source" DB_Args = DB + ".args" Backend = "backend" )
Variables ¶
View Source
var ConfigValidator = validator.New()
Functions ¶
This section is empty.
Types ¶
type BackendConfig ¶
type BackendConfig struct { Bookmarkmanager BookmarkManagerConfig `name:"bookmark_manager" mapstructure:"bookmark_manager" validate:"required,bookmark_manager"` TagsManager TagsManagerConfig `name:"tags_manager" mapstructure:"tags_manager" validate:"required,tags_manager"` DocumentManager DocumentManagerConfig `name:"document_manager" mapstructure:"document_manager" validate:"required,document_manager"` DocumentContentManager DocumentContentManagerConfig `name:"document_content_manager" mapstructure:"document_content_manager" validate:"required,document_content_manager"` }
type BookmarkManagerConfig ¶
type BookmarkManagerConfig struct { Hooks HooksConfig `name:"hooks" mapstructure:"hooks"` BookmarkRepository BookmarkRepositoryConfig `name:"bookmark_repository" mapstructure:"bookmark_repository" validate:"required,bookmark_repository"` }
type BookmarkRepositoryConfig ¶
type BookmarkRepositoryConfig struct { DB DBConfig `name:"db" mapstructure:"db" validate:"required"` TagRepository TagsRepositoryConfig `name:"tag_repository" mapstructure:"tag_repository" validate:"required"` }
type Config ¶
type Config struct { LogFile string `name:"log_file" mapstructure:"log_file" validate:"required,file"` ConsoleLogLevel string `name:"console_log_level" mapstructure:"console_log_level" validate:"required,logrus_log_level"` FileLogLevel string `name:"file_log_level" mapstructure:"file_log_level" validate:"required,logrus_log_level"` DB DBConfig `name:"db" mapstructure:"db" validate:"required"` Backend BackendConfig `name:"backend" mapstructure:"backend" validate:"required"` }
TODO: Add test to validate that The field name, tag "name" and "mapstructure" match.
type ConfigManager ¶ added in v0.6.0
type ConfigManager struct { Viper *viper.Viper DBOverride *sql.DB FSOverride afero.Fs PendingLogMessage []message Logger *log.Logger PassedConfigPath string ConfigDir string ConfigFileBaseName string ConfigSearchPaths []string }
func NewConfigManager ¶ added in v0.6.0
func (*ConfigManager) GetDefaultDBConfig ¶ added in v0.6.0
func (m *ConfigManager) GetDefaultDBConfig() DBConfig
func (*ConfigManager) GetDefaultSettings ¶ added in v0.6.0
func (m *ConfigManager) GetDefaultSettings() map[string]any
func (*ConfigManager) NewBackendFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewBackendFromConfig() *backend.Backend
********************** Set up backend **********************//
func (*ConfigManager) NewBookmarkManagerFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewBookmarkManagerFromConfig(logger *log.Logger, repo repository.BookmarkRepository) libbookmarks.BookmarkManager
TODO: Implement proper hook parsing ******************** Manager builders ********************//
func (*ConfigManager) NewBookmarkRepositoryFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewBookmarkRepositoryFromConfig(logger *log.Logger, repoDB *sql.DB, tagRepository repository.TagRepository) repository.BookmarkRepository
******************** Repository builders ********************// TODO: Allow using non-sql repositories.
func (*ConfigManager) NewDBFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewDBFromConfig() *sql.DB
func (*ConfigManager) NewDocumentContentManagerFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewDocumentContentManagerFromConfig(logger *log.Logger, repo repository.DocumentContentRepository) libdocuments.DocumentContentManager
func (*ConfigManager) NewDocumentContentRepositoryFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewDocumentContentRepositoryFromConfig(logger *log.Logger, fs afero.Fs) repository.DocumentContentRepository
TODO: Allow non-fs content repositories
func (*ConfigManager) NewDocumentManagerFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewDocumentManagerFromConfig(logger *log.Logger, repo repository.DocumentRepository) libdocuments.DocumentManager
func (*ConfigManager) NewDocumentRepositoryFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewDocumentRepositoryFromConfig(logger *log.Logger, repoDB *sql.DB, tagRepository repository.TagRepository) repository.DocumentRepository
func (*ConfigManager) NewTagsManagerFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewTagsManagerFromConfig(logger *log.Logger, repo repository.TagRepository) libtags.TagManager
func (*ConfigManager) NewTagsRepositoryFromConfig ¶ added in v0.6.0
func (m *ConfigManager) NewTagsRepositoryFromConfig(logger *log.Logger, repoDB *sql.DB) repository.TagRepository
type DocumentContentManagerConfig ¶
type DocumentContentManagerConfig struct { Hooks HooksConfig `name:"hooks" mapstructure:"hooks"` DocumentContentRepository DocumentContentRepositoryConfig `name:"document_content_repository" mapstructure:"document_content_repository" validate:"required,document_content_repository"` }
type DocumentContentRepositoryConfig ¶
type DocumentContentRepositoryConfig struct {
DB DBConfig `name:"db" mapstructure:"db" validate:"required"`
}
type DocumentManagerConfig ¶
type DocumentManagerConfig struct { Hooks HooksConfig `name:"hooks" mapstructure:"hooks"` DocumentRepository DocumentRepositoryConfig `name:"document_repository" mapstructure:"document_repository" validate:"required,document_repository"` }
type DocumentRepositoryConfig ¶
type DocumentRepositoryConfig struct { DB DBConfig `name:"db" mapstructure:"db" validate:"required"` TagRepository TagsRepositoryConfig `name:"tag_repository" mapstructure:"tag_repository" validate:"required"` }
type HooksConfig ¶
type TagsManagerConfig ¶
type TagsManagerConfig struct { Hooks HooksConfig `name:"hooks" mapstructure:"hooks"` TagsRepository TagsRepositoryConfig `name:"tags_repository" mapstructure:"tags_repository" validate:"required,tags_repository"` }
type TagsRepositoryConfig ¶
type TagsRepositoryConfig struct {
DB DBConfig `name:"db" mapstructure:"db" validate:"required"`
}
Click to show internal directories.
Click to hide internal directories.