esconfig

package
v5.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplaceGlobals

func ReplaceGlobals(repository Repository) func()

ReplaceGlobals affect a new repository to the global repository singleton

Types

type PostgresRepository

type PostgresRepository struct {
	// contains filtered or unexported fields
}

PostgresRepository is a repository containing the ExternalConfig definition based on a PSQL database and implementing the repository interface

func (*PostgresRepository) Create

func (r *PostgresRepository) Create(elasticSearchConfig models.ElasticSearchConfig) (int64, error)

Create method used to create an elasticSearchConfig

func (*PostgresRepository) Delete

func (r *PostgresRepository) Delete(id int64) error

Delete use to retrieve an elasticSearchConfig by name

func (*PostgresRepository) Get

Get use to retrieve an elasticSearchConfig by id

func (*PostgresRepository) GetAll

GetAll method used to get all elasticSearchConfigs

func (*PostgresRepository) GetByName

GetByName use to retrieve an elasticSearchConfig by name

func (*PostgresRepository) GetDefault

GetDefault use to retrieve the default elasticSearchConfig

func (*PostgresRepository) Update

func (r *PostgresRepository) Update(id int64, elasticSearchConfig models.ElasticSearchConfig) error

Update method used to update un elasticSearchConfig

type Repository

type Repository interface {
	Get(id int64) (models.ElasticSearchConfig, bool, error)
	GetByName(name string) (models.ElasticSearchConfig, bool, error)
	GetDefault() (models.ElasticSearchConfig, bool, error)
	Create(config models.ElasticSearchConfig) (int64, error)
	Update(id int64, config models.ElasticSearchConfig) error
	Delete(id int64) error
	GetAll() (map[int64]models.ElasticSearchConfig, error)
}

Repository is a storage interface which can be implemented by multiple backend (in-memory map, sql database, in-memory cache, file system, ...) It allows standard CRUD operation on ElasticSearchConfigs

func NewPostgresRepository

func NewPostgresRepository(dbClient *sqlx.DB) Repository

NewPostgresRepository returns a new instance of PostgresRepository

func R

func R() Repository

R is used to access the global repository singleton

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL