Documentation ¶
Index ¶
- func ReplaceGlobals(repository Repository) func()
- type PostgresRepository
- func (r *PostgresRepository) Create(tx *sqlx.Tx, externalConfig models.ExternalConfig) error
- func (r *PostgresRepository) Delete(tx *sqlx.Tx, name string) error
- func (r *PostgresRepository) Get(name string) (models.ExternalConfig, bool, error)
- func (r *PostgresRepository) GetAll() (map[string]models.ExternalConfig, error)
- func (r *PostgresRepository) Update(tx *sqlx.Tx, name string, externalConfig models.ExternalConfig) error
- type Repository
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(tx *sqlx.Tx, externalConfig models.ExternalConfig) error
Create method used to create an externalConfig
func (*PostgresRepository) Delete ¶
func (r *PostgresRepository) Delete(tx *sqlx.Tx, name string) error
Delete use to retrieve an externalConfig by name
func (*PostgresRepository) Get ¶
func (r *PostgresRepository) Get(name string) (models.ExternalConfig, bool, error)
Get use to retrieve an externalConfig by name
func (*PostgresRepository) GetAll ¶
func (r *PostgresRepository) GetAll() (map[string]models.ExternalConfig, error)
GetAll method used to get all externalConfigs
func (*PostgresRepository) Update ¶
func (r *PostgresRepository) Update(tx *sqlx.Tx, name string, externalConfig models.ExternalConfig) error
Update method used to update un externalConfig
type Repository ¶
type Repository interface { Get(name string) (models.ExternalConfig, bool, error) Create(tx *sqlx.Tx, rootCause models.ExternalConfig) error Update(tx *sqlx.Tx, name string, rootCause models.ExternalConfig) error Delete(tx *sqlx.Tx, name string) error GetAll() (map[string]models.ExternalConfig, 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 ExternalConfigs
func NewPostgresRepository ¶
func NewPostgresRepository(dbClient *sqlx.DB) Repository
NewPostgresRepository returns a new instance of PostgresRepository